aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
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 /tests
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 'tests')
-rw-r--r--tests/CodecAnimTest.cpp22
-rw-r--r--tests/CodecTest.cpp2
2 files changed, 12 insertions, 12 deletions
diff --git a/tests/CodecAnimTest.cpp b/tests/CodecAnimTest.cpp
index 3d7080e35d..79e03bdef8 100644
--- a/tests/CodecAnimTest.cpp
+++ b/tests/CodecAnimTest.cpp
@@ -43,15 +43,15 @@ DEF_TEST(Codec_frames, r) {
#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 @@ DEF_TEST(Codec_frames, r) {
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 @@ DEF_TEST(Codec_frames, r) {
// 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 @@ DEF_TEST(Codec_frames, r) {
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 @@ DEF_TEST(Codec_frames, r) {
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 @@ DEF_TEST(Codec_frames, r) {
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;
diff --git a/tests/CodecTest.cpp b/tests/CodecTest.cpp
index ceafa15cb1..52240542c6 100644
--- a/tests/CodecTest.cpp
+++ b/tests/CodecTest.cpp
@@ -1508,7 +1508,7 @@ DEF_TEST(Codec_InvalidAnimated, r) {
auto frameInfos = codec->getFrameInfo();
SkCodec::Options opts;
- for (size_t i = 0; i < frameInfos.size(); i++) {
+ for (int i = 0; static_cast<size_t>(i) < frameInfos.size(); i++) {
opts.fFrameIndex = i;
opts.fHasPriorFrame = frameInfos[i].fRequiredFrame == i - 1;
auto result = codec->startIncrementalDecode(info, bm.getPixels(), bm.rowBytes(), &opts);