| 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 /* | 8 /* |
| 9 * Code for the "gm" (Golden Master) rendering comparison tool. | 9 * Code for the "gm" (Golden Master) rendering comparison tool. |
| 10 * | 10 * |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 #define DEFAULT_CACHE_VALUE -1 | 56 #define DEFAULT_CACHE_VALUE -1 |
| 57 static int gGpuCacheSizeBytes; | 57 static int gGpuCacheSizeBytes; |
| 58 static int gGpuCacheSizeCount; | 58 static int gGpuCacheSizeCount; |
| 59 #else | 59 #else |
| 60 class GrContextFactory; | 60 class GrContextFactory; |
| 61 class GrContext; | 61 class GrContext; |
| 62 class GrSurface; | 62 class GrSurface; |
| 63 typedef int GLContextType; | 63 typedef int GLContextType; |
| 64 #endif | 64 #endif |
| 65 | 65 |
| 66 #define DEBUGFAIL_SEE_STDERR SkDEBUGFAIL("see stderr for message") |
| 67 |
| 66 extern bool gSkSuppressFontCachePurgeSpew; | 68 extern bool gSkSuppressFontCachePurgeSpew; |
| 67 | 69 |
| 68 #ifdef SK_SUPPORT_PDF | 70 #ifdef SK_SUPPORT_PDF |
| 69 #include "SkPDFDevice.h" | 71 #include "SkPDFDevice.h" |
| 70 #include "SkPDFDocument.h" | 72 #include "SkPDFDocument.h" |
| 71 #endif | 73 #endif |
| 72 | 74 |
| 73 // Until we resolve http://code.google.com/p/skia/issues/detail?id=455 , | 75 // Until we resolve http://code.google.com/p/skia/issues/detail?id=455 , |
| 74 // stop writing out XPS-format image baselines in gm. | 76 // stop writing out XPS-format image baselines in gm. |
| 75 #undef SK_SUPPORT_XPS | 77 #undef SK_SUPPORT_XPS |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 | 761 |
| 760 if (addToJsonSummary) { | 762 if (addToJsonSummary) { |
| 761 add_actual_results_to_json_summary(completeName, actualBitmapHash, e
rrors, | 763 add_actual_results_to_json_summary(completeName, actualBitmapHash, e
rrors, |
| 762 expectations.ignoreFailure()); | 764 expectations.ignoreFailure()); |
| 763 add_expected_results_to_json_summary(completeName, expectations); | 765 add_expected_results_to_json_summary(completeName, expectations); |
| 764 } | 766 } |
| 765 | 767 |
| 766 return errors; | 768 return errors; |
| 767 } | 769 } |
| 768 | 770 |
| 771 // EPOGER: move this into gm_expectations.h (or a .cpp file) to isolate the
code that knows about JSON structure |
| 769 /** | 772 /** |
| 770 * Add this result to the appropriate JSON collection of actual results, | 773 * Add this result to the appropriate JSON collection of actual results, |
| 771 * depending on status. | 774 * depending on status. |
| 772 */ | 775 */ |
| 776 // EPOGER: replace SkHashDigest actualBitmapHash with a level of indirection
: resultDigest, which may be a BitmapCityhash or a BytewiseCityhash. |
| 773 void add_actual_results_to_json_summary(const char testName[], | 777 void add_actual_results_to_json_summary(const char testName[], |
| 774 const SkHashDigest& actualBitmapHash
, | 778 const SkHashDigest& actualBitmapHash
, |
| 775 ErrorCombination result, | 779 ErrorCombination result, |
| 776 bool ignoreFailure) { | 780 bool ignoreFailure) { |
| 777 Json::Value actualResults; | 781 Json::Value actualResults; |
| 778 actualResults[kJsonKey_ActualResults_AnyStatus_Checksum] = | 782 actualResults[kJsonKey_ActualResults_AnyStatus_BitmapCityhash] = |
| 779 asJsonValue(actualBitmapHash); | 783 asJsonValue(actualBitmapHash); |
| 780 if (result.isEmpty()) { | 784 if (result.isEmpty()) { |
| 781 this->fJsonActualResults_Succeeded[testName] = actualResults; | 785 this->fJsonActualResults_Succeeded[testName] = actualResults; |
| 782 } else { | 786 } else { |
| 783 if (ignoreFailure) { | 787 if (ignoreFailure) { |
| 784 // TODO: Once we have added the ability to compare | 788 // TODO: Once we have added the ability to compare |
| 785 // actual results against expectations in a JSON file | 789 // actual results against expectations in a JSON file |
| 786 // (where we can set ignore-failure to either true or | 790 // (where we can set ignore-failure to either true or |
| 787 // false), add test cases that exercise ignored | 791 // false), add test cases that exercise ignored |
| 788 // failures (both for kMissingExpectations_ErrorType | 792 // failures (both for kMissingExpectations_ErrorType |
| (...skipping 26 matching lines...) Expand all Loading... |
| 815 | 819 |
| 816 /** | 820 /** |
| 817 * Add this test to the JSON collection of expected results. | 821 * Add this test to the JSON collection of expected results. |
| 818 */ | 822 */ |
| 819 void add_expected_results_to_json_summary(const char testName[], | 823 void add_expected_results_to_json_summary(const char testName[], |
| 820 Expectations expectations) { | 824 Expectations expectations) { |
| 821 // For now, we assume that this collection starts out empty and we | 825 // For now, we assume that this collection starts out empty and we |
| 822 // just fill it in as we go; once gm accepts a JSON file as input, | 826 // just fill it in as we go; once gm accepts a JSON file as input, |
| 823 // we'll have to change that. | 827 // we'll have to change that. |
| 824 Json::Value expectedResults; | 828 Json::Value expectedResults; |
| 825 expectedResults[kJsonKey_ExpectedResults_Checksums] = | 829 expectedResults[kJsonKey_ExpectedResults_AllowedBitmapCityhashes] = |
| 826 expectations.allowedChecksumsAsJson(); | 830 expectations.allowedChecksumsAsJson(); |
| 827 expectedResults[kJsonKey_ExpectedResults_IgnoreFailure] = | 831 expectedResults[kJsonKey_ExpectedResults_IgnoreFailure] = |
| 828 expectations.ignoreFailure(); | 832 expectations.ignoreFailure(); |
| 829 this->fJsonExpectedResults[testName] = expectedResults; | 833 this->fJsonExpectedResults[testName] = expectedResults; |
| 830 } | 834 } |
| 831 | 835 |
| 832 /** | 836 /** |
| 833 * Compare actualBitmap to expectations stored in this->fExpectationsSource. | 837 * Compare actualBitmap to expectations stored in this->fExpectationsSource. |
| 834 * | 838 * |
| 835 * @param gm which test generated the actualBitmap | 839 * @param gm which test generated the actualBitmap |
| (...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2002 if (FLAGS_forceBWtext) { | 2006 if (FLAGS_forceBWtext) { |
| 2003 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 2007 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
| 2004 } | 2008 } |
| 2005 } | 2009 } |
| 2006 | 2010 |
| 2007 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 2011 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 2008 int main(int argc, char * const argv[]) { | 2012 int main(int argc, char * const argv[]) { |
| 2009 return tool_main(argc, (char**) argv); | 2013 return tool_main(argc, (char**) argv); |
| 2010 } | 2014 } |
| 2011 #endif | 2015 #endif |
| OLD | NEW |