Chromium Code Reviews| 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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 588 // Build the tile index for decoding subsets. If the image is 1x1, skip subset | 588 // Build the tile index for decoding subsets. If the image is 1x1, skip subset |
| 589 // decoding since there are no smaller subsets. | 589 // decoding since there are no smaller subsets. |
| 590 if (codec->buildTileIndex(&stream, &width, &height) && width > 1 && heig ht > 1) { | 590 if (codec->buildTileIndex(&stream, &width, &height) && width > 1 && heig ht > 1) { |
| 591 SkASSERT(bitmap.width() == width && bitmap.height() == height); | 591 SkASSERT(bitmap.width() == width && bitmap.height() == height); |
| 592 // Call decodeSubset multiple times: | 592 // Call decodeSubset multiple times: |
| 593 SkRandom rand(0); | 593 SkRandom rand(0); |
| 594 for (int i = 0; i < 5; i++) { | 594 for (int i = 0; i < 5; i++) { |
| 595 SkBitmap bitmapFromDecodeSubset; | 595 SkBitmap bitmapFromDecodeSubset; |
| 596 // FIXME: Come up with a more representative set of rectangles. | 596 // FIXME: Come up with a more representative set of rectangles. |
| 597 SkIRect rect = generate_random_rect(&rand, width, height); | 597 SkIRect rect = generate_random_rect(&rand, width, height); |
| 598 SkString subsetDim = SkStringPrintf("[%d,%d,%d,%d]", rect.fLeft, rect.fTop, | 598 SkString subsetDim = SkStringPrintf("%d_%d_%d_%d", rect.fLeft, r ect.fTop, |
|
epoger
2014/06/02 21:12:29
Sigh. My previous attempt (using parentheses) yie
| |
| 599 rect.fRight, rect.fBottom); | 599 rect.fRight, rect.fBottom); |
| 600 if (codec->decodeSubset(&bitmapFromDecodeSubset, rect, gPrefConf ig)) { | 600 if (codec->decodeSubset(&bitmapFromDecodeSubset, rect, gPrefConf ig)) { |
| 601 SkString subsetName = SkStringPrintf("%s-%s", filename, subs etDim.c_str()); | 601 SkString subsetName = SkStringPrintf("%s-%s", filename, subs etDim.c_str()); |
| 602 skiagm::BitmapAndDigest subsetBitmapAndDigest(bitmapFromDeco deSubset); | 602 skiagm::BitmapAndDigest subsetBitmapAndDigest(bitmapFromDeco deSubset); |
| 603 if (compare_to_expectations_if_necessary(subsetBitmapAndDige st.fDigest, | 603 if (compare_to_expectations_if_necessary(subsetBitmapAndDige st.fDigest, |
| 604 subsetName.c_str(), | 604 subsetName.c_str(), |
| 605 &gFailedSubsetDecod es, | 605 &gFailedSubsetDecod es, |
| 606 &gMissingSubsetExpe ctations, | 606 &gMissingSubsetExpe ctations, |
| 607 &gKnownSubsetFailur es)) { | 607 &gKnownSubsetFailur es)) { |
| 608 gSuccessfulSubsetDecodes.push_back().printf("Decoded sub set %s from %s", | 608 gSuccessfulSubsetDecodes.push_back().printf("Decoded sub set %s from %s", |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 834 print_strings("Known failures", gKnownFailures); | 834 print_strings("Known failures", gKnownFailures); |
| 835 | 835 |
| 836 return failed ? -1 : 0; | 836 return failed ? -1 : 0; |
| 837 } | 837 } |
| 838 | 838 |
| 839 #if !defined SK_BUILD_FOR_IOS | 839 #if !defined SK_BUILD_FOR_IOS |
| 840 int main(int argc, char * const argv[]) { | 840 int main(int argc, char * const argv[]) { |
| 841 return tool_main(argc, (char**) argv); | 841 return tool_main(argc, (char**) argv); |
| 842 } | 842 } |
| 843 #endif | 843 #endif |
| OLD | NEW |