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>
diff --git a/tests/CodecAnimTest.cpp b/tests/CodecAnimTest.cpp
index 3d7080e..79e03bd 100644
--- a/tests/CodecAnimTest.cpp
+++ b/tests/CodecAnimTest.cpp
@@ -43,15 +43,15 @@
#define kUnpremul kUnpremul_SkAlphaType
static const struct {
const char* fName;
- size_t fFrameCount;
+ int fFrameCount;
// One less than fFramecount, since the first frame is always
// independent.
- std::vector<size_t> fRequiredFrames;
+ std::vector<int> fRequiredFrames;
// Same, since the first frame should match getInfo.
std::vector<SkAlphaType> fAlphaTypes;
// The size of this one should match fFrameCount for animated, empty
// otherwise.
- std::vector<size_t> fDurations;
+ std::vector<int> fDurations;
int fRepetitionCount;
} gRecs[] = {
{ "alphabetAnim.gif", 13,
@@ -126,14 +126,14 @@
rec.fName, rec.fRepetitionCount, repetitionCount);
}
- const size_t expected = rec.fFrameCount;
- if (rec.fRequiredFrames.size() + 1 != expected) {
+ const int expected = rec.fFrameCount;
+ if (rec.fRequiredFrames.size() + 1 != static_cast<size_t>(expected)) {
ERRORF(r, "'%s' has wrong number entries in fRequiredFrames; expected: %i\tactual: %i",
rec.fName, expected, rec.fRequiredFrames.size() + 1);
continue;
}
- if (rec.fDurations.size() != expected) {
+ if (rec.fDurations.size() != static_cast<size_t>(expected)) {
ERRORF(r, "'%s' has wrong number entries in fDurations; expected: %i\tactual: %i",
rec.fName, expected, rec.fDurations.size());
continue;
@@ -148,7 +148,7 @@
// Re-create the codec to reset state and test parsing.
codec.reset(SkCodec::NewFromData(data));
- size_t frameCount;
+ int frameCount;
std::vector<SkCodec::FrameInfo> frameInfos;
switch (mode) {
case TestMode::kVector:
@@ -172,7 +172,7 @@
continue;
}
- for (size_t i = 0; i < frameCount; i++) {
+ for (int i = 0; i < frameCount; i++) {
SkCodec::FrameInfo frameInfo;
switch (mode) {
case TestMode::kVector:
@@ -233,11 +233,11 @@
std::vector<SkBitmap> cachedFrames(frameCount);
const auto& info = codec->getInfo().makeColorType(kN32_SkColorType);
- auto decode = [&](SkBitmap* bm, bool cached, size_t index) {
+ auto decode = [&](SkBitmap* bm, bool cached, int index) {
bm->allocPixels(info);
if (cached) {
// First copy the pixels from the cached frame
- const size_t requiredFrame = frameInfos[index].fRequiredFrame;
+ const int requiredFrame = frameInfos[index].fRequiredFrame;
if (requiredFrame != SkCodec::kNone) {
const bool success = cachedFrames[requiredFrame].copyTo(bm);
REPORTER_ASSERT(r, success);
@@ -251,7 +251,7 @@
REPORTER_ASSERT(r, result == SkCodec::kSuccess);
};
- for (size_t i = 0; i < frameCount; i++) {
+ for (int i = 0; i < frameCount; i++) {
SkBitmap& cachedFrame = cachedFrames[i];
decode(&cachedFrame, true, i);
SkBitmap uncachedFrame;