aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm
diff options
context:
space:
mode:
authorGravatar Leon Scroggins III <scroggo@google.com>2017-04-17 12:46:33 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-17 17:38:35 +0000
commit249b8e3a2b6450be2e2315f8f9496eec03cfd1c1 (patch)
tree4c857c72d3716f13658e52dde2afe93b5d07cb70 /gm
parentcd11c809f206af0da3ce1779dee3c91193baa7b0 (diff)
Switch SkCodec to int for counts and indices
This matches other Skia APIs. size_t was adopted from blink/ GIFImageReader. Change-Id: Ic83e59f0942f597c4fb834e623acd9886ad483fe Reviewed-on: https://skia-review.googlesource.com/13274 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Matt Sarett <msarett@google.com> Reviewed-by: Chris Blume <cblume@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'gm')
-rw-r--r--gm/animatedGif.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/gm/animatedGif.cpp b/gm/animatedGif.cpp
index 03bf66c526..c7871e0d12 100644
--- a/gm/animatedGif.cpp
+++ b/gm/animatedGif.cpp
@@ -34,9 +34,9 @@ namespace {
class AnimatedGifGM : public skiagm::GM {
private:
std::unique_ptr<SkCodec> fCodec;
- size_t fFrame;
+ int fFrame;
double fNextUpdate;
- size_t fTotalFrames;
+ int fTotalFrames;
std::vector<SkCodec::FrameInfo> fFrameInfos;
std::vector<SkBitmap> fFrames;
@@ -53,9 +53,10 @@ private:
SkCodec::Options opts;
opts.fFrameIndex = frameIndex;
opts.fHasPriorFrame = false;
- const size_t requiredFrame = fFrameInfos[frameIndex].fRequiredFrame;
+ const int requiredFrame = fFrameInfos[frameIndex].fRequiredFrame;
if (requiredFrame != SkCodec::kNone) {
- SkASSERT(requiredFrame < fFrames.size());
+ SkASSERT(requiredFrame >= 0
+ && static_cast<size_t>(requiredFrame) < fFrames.size());
SkBitmap& requiredBitmap = fFrames[requiredFrame];
// For simplicity, do not try to cache old frames
if (requiredBitmap.getPixels() && requiredBitmap.copyTo(&bm)) {
@@ -101,7 +102,7 @@ private:
canvas->clear(SK_ColorWHITE);
if (this->initCodec()) {
SkAutoCanvasRestore acr(canvas, true);
- for (size_t frameIndex = 0; frameIndex < fTotalFrames; frameIndex++) {
+ for (int frameIndex = 0; frameIndex < fTotalFrames; frameIndex++) {
this->drawFrame(canvas, frameIndex);
canvas->translate(SkIntToScalar(fCodec->getInfo().width()), 0);
}