OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "CodecPriv.h" | 8 #include "CodecPriv.h" |
9 #include "Resources.h" | 9 #include "Resources.h" |
10 #include "SkAndroidCodec.h" | 10 #include "SkAndroidCodec.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 static void test_gif_data_no_colormap(skiatest::Reporter* r, | 45 static void test_gif_data_no_colormap(skiatest::Reporter* r, |
46 void* data, | 46 void* data, |
47 size_t size) { | 47 size_t size) { |
48 SkBitmap bm; | 48 SkBitmap bm; |
49 bool imageDecodeSuccess = decode_memory(data, size, &bm); | 49 bool imageDecodeSuccess = decode_memory(data, size, &bm); |
50 REPORTER_ASSERT(r, imageDecodeSuccess); | 50 REPORTER_ASSERT(r, imageDecodeSuccess); |
51 REPORTER_ASSERT(r, bm.width() == 1); | 51 REPORTER_ASSERT(r, bm.width() == 1); |
52 REPORTER_ASSERT(r, bm.height() == 1); | 52 REPORTER_ASSERT(r, bm.height() == 1); |
53 REPORTER_ASSERT(r, !(bm.empty())); | 53 REPORTER_ASSERT(r, !(bm.empty())); |
54 if (!(bm.empty())) { | 54 if (!(bm.empty())) { |
55 REPORTER_ASSERT(r, bm.getColor(0, 0) == 0xFF000000); | 55 REPORTER_ASSERT(r, bm.getColor(0, 0) == 0x00000000); |
56 } | 56 } |
57 } | 57 } |
58 static void test_gif_data(skiatest::Reporter* r, void* data, size_t size) { | 58 static void test_gif_data(skiatest::Reporter* r, void* data, size_t size) { |
59 SkBitmap bm; | 59 SkBitmap bm; |
60 bool imageDecodeSuccess = decode_memory(data, size, &bm); | 60 bool imageDecodeSuccess = decode_memory(data, size, &bm); |
61 REPORTER_ASSERT(r, imageDecodeSuccess); | 61 REPORTER_ASSERT(r, imageDecodeSuccess); |
62 REPORTER_ASSERT(r, bm.width() == 3); | 62 REPORTER_ASSERT(r, bm.width() == 3); |
63 REPORTER_ASSERT(r, bm.height() == 3); | 63 REPORTER_ASSERT(r, bm.height() == 3); |
64 REPORTER_ASSERT(r, !(bm.empty())); | 64 REPORTER_ASSERT(r, !(bm.empty())); |
65 if (!(bm.empty())) { | 65 if (!(bm.empty())) { |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 options.fSampleSize = 4; | 220 options.fSampleSize = 4; |
221 options.fColorPtr = colorPtr; | 221 options.fColorPtr = colorPtr; |
222 options.fColorCount = colorCountPtr; | 222 options.fColorCount = colorCountPtr; |
223 | 223 |
224 SkBitmap bm; | 224 SkBitmap bm; |
225 bm.allocPixels(codec->getInfo(), nullptr, colorTable.get()); | 225 bm.allocPixels(codec->getInfo(), nullptr, colorTable.get()); |
226 const SkCodec::Result result = codec->getAndroidPixels(codec->getInfo(), bm.
getPixels(), | 226 const SkCodec::Result result = codec->getAndroidPixels(codec->getInfo(), bm.
getPixels(), |
227 bm.rowBytes(), &options); | 227 bm.rowBytes(), &options); |
228 REPORTER_ASSERT(r, result == SkCodec::kSuccess); | 228 REPORTER_ASSERT(r, result == SkCodec::kSuccess); |
229 } | 229 } |
OLD | NEW |