86 {
87 this->init();
88 for (bool usePic : { true, false }) {
90 if (usePic) {
93 } else {
94 auto image = animatedImage->getCurrentFrame();
96 }
97 };
98 for (
float scale : { 1.25f, 1.0f, .75f, .5f }) {
100 for (bool doCrop : { false, true }) {
101 for (bool doPostProcess : { false, true }) {
103 const auto origin = codec->getOrigin();
105 auto info = androidCodec->getInfo();
108
111 info =
info.makeDimensions(scaledSize);
112
114 if (doCrop) {
118 unscaledSize.width(), unscaledSize.height()));
120 matrix.mapRect(&cropRectFloat);
122 }
123
127 info, cropRect, std::move(postProcessor));
128 animatedImage->setRepetitionCount(0);
129
131 {
133 if (doCrop) {
134 canvas->
translate(cropRect.left(), cropRect.top());
135 }
136 drawProc(animatedImage);
137 }
138
140 const auto duration = animatedImage->currentFrameDuration();
142 break;
143 }
144 for (
int i = 0;
i < fStep;
i++) {
145 animatedImage->decodeNextFrame();
146 }
147 }
148 }
149 }
152 }
153 }
154 }
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static bool SkEncodedOriginSwapsWidthHeight(SkEncodedOrigin origin)
static SkMatrix SkEncodedOriginToMatrix(SkEncodedOrigin origin, int w, int h)
#define SkScalarFloorToInt(x)
static sk_sp< SkPicture > post_processor(const SkRect &bounds)
static std::unique_ptr< SkAndroidCodec > MakeFromCodec(std::unique_ptr< SkCodec >)
static sk_sp< SkAnimatedImage > Make(std::unique_ptr< SkAndroidCodec >, const SkImageInfo &info, SkIRect cropRect, sk_sp< SkPicture > postProcess)
static constexpr int kFinished
void translate(SkScalar dx, SkScalar dy)
void drawPicture(const SkPicture *picture)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
static std::unique_ptr< SkCodec > MakeFromData(sk_sp< SkData >, SkSpan< const SkCodecs::Decoder > decoders, SkPngChunkReader *=nullptr)
static SkMatrix RectToRect(const SkRect &src, const SkRect &dst, ScaleToFit mode=kFill_ScaleToFit)
unsigned useCenter Optional< SkMatrix > matrix
sk_sp< const SkImage > image
static constexpr SkIRect MakeSize(const SkISize &size)
static SkRect Make(const SkISize &size)
void roundOut(SkIRect *dst) const