forked from google/skia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[viewer] Add support for animated GIF, WEBP
- repurpose AnimatedImageSlide as a general animated image container - add support for loading gif and webp assets E.g.: viewer -f image.webp Change-Id: Iaf21f3b38a14728ba53edb6def050d0ede9d0300 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/929776 Reviewed-by: Daniel Dilan <[email protected]> Commit-Queue: Florin Malita <[email protected]>
- Loading branch information
Showing
7 changed files
with
119 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright 2024 Google Inc. | ||
* | ||
* Use of this source code is governed by a BSD-style license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
#ifndef AnimatedImageSlide_DEFINED | ||
#define AnimatedImageSlide_DEFINED | ||
|
||
#include "include/core/SkString.h" | ||
#include "modules/skresources/include/SkResources.h" | ||
#include "tools/viewer/Slide.h" | ||
|
||
class SkCanvas; | ||
|
||
class AnimatedImageSlide final : public Slide { | ||
public: | ||
AnimatedImageSlide(const SkString& name, const SkString& path); | ||
|
||
void load(SkScalar winWidth, SkScalar winHeight) override; | ||
void unload() override; | ||
|
||
void draw(SkCanvas*) override; | ||
bool animate(double nanos) override; | ||
|
||
private: | ||
const SkString fPath; | ||
sk_sp<skresources::MultiFrameImageAsset> fImageAsset; | ||
SkSize fWinSize; | ||
|
||
double fTimeBase = 0; | ||
float fFrameMs = 0; | ||
}; | ||
|
||
#endif // AnimatedImageSlide_DEFINED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters