| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "gm_expectations.h" | 8 #include "gm_expectations.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 | 580 |
| 581 write_expectations(bitmapAndDigest, filename); | 581 write_expectations(bitmapAndDigest, filename); |
| 582 | 582 |
| 583 if (FLAGS_testSubsetDecoding) { | 583 if (FLAGS_testSubsetDecoding) { |
| 584 SkDEBUGCODE(bool couldRewind =) stream.rewind(); | 584 SkDEBUGCODE(bool couldRewind =) stream.rewind(); |
| 585 SkASSERT(couldRewind); | 585 SkASSERT(couldRewind); |
| 586 int width, height; | 586 int width, height; |
| 587 // Build the tile index for decoding subsets. If the image is 1x1, skip
subset | 587 // Build the tile index for decoding subsets. If the image is 1x1, skip
subset |
| 588 // decoding since there are no smaller subsets. | 588 // decoding since there are no smaller subsets. |
| 589 if (codec->buildTileIndex(&stream, &width, &height) && width > 1 && heig
ht > 1) { | 589 if (codec->buildTileIndex(&stream, &width, &height) && width > 1 && heig
ht > 1) { |
| 590 SkASSERT(bitmap.width() == width && bitmap.height() == height); | 590 SkASSERT((bitmap.width() == width && bitmap.height() == height) |
| 591 || FLAGS_sampleSize != 1); |
| 591 // Call decodeSubset multiple times: | 592 // Call decodeSubset multiple times: |
| 592 SkRandom rand(0); | 593 SkRandom rand(0); |
| 593 for (int i = 0; i < 5; i++) { | 594 for (int i = 0; i < 5; i++) { |
| 594 SkBitmap bitmapFromDecodeSubset; | 595 SkBitmap bitmapFromDecodeSubset; |
| 595 // FIXME: Come up with a more representative set of rectangles. | 596 // FIXME: Come up with a more representative set of rectangles. |
| 596 SkIRect rect = generate_random_rect(&rand, width, height); | 597 SkIRect rect = generate_random_rect(&rand, width, height); |
| 597 SkString subsetDim = SkStringPrintf("%d_%d_%d_%d", rect.fLeft, r
ect.fTop, | 598 SkString subsetDim = SkStringPrintf("%d_%d_%d_%d", rect.fLeft, r
ect.fTop, |
| 598 rect.fRight, rect.fBottom); | 599 rect.fRight, rect.fBottom); |
| 599 if (codec->decodeSubset(&bitmapFromDecodeSubset, rect, gPrefColo
rType)) { | 600 if (codec->decodeSubset(&bitmapFromDecodeSubset, rect, gPrefColo
rType)) { |
| 600 SkString subsetName = SkStringPrintf("%s-%s", filename, subs
etDim.c_str()); | 601 SkString subsetName = SkStringPrintf("%s-%s", filename, subs
etDim.c_str()); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 print_strings("Known failures", gKnownFailures); | 834 print_strings("Known failures", gKnownFailures); |
| 834 | 835 |
| 835 return failed ? -1 : 0; | 836 return failed ? -1 : 0; |
| 836 } | 837 } |
| 837 | 838 |
| 838 #if !defined SK_BUILD_FOR_IOS | 839 #if !defined SK_BUILD_FOR_IOS |
| 839 int main(int argc, char * const argv[]) { | 840 int main(int argc, char * const argv[]) { |
| 840 return tool_main(argc, (char**) argv); | 841 return tool_main(argc, (char**) argv); |
| 841 } | 842 } |
| 842 #endif | 843 #endif |
| OLD | NEW |