Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: gm/gm_expectations.h

Issue 14170010: rename SkBitmapChecksummer as SkBitmapHasher, and prepare for it to possibly use (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: sync_to_r8638 Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | gm/gmmain.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef gm_expectations_DEFINED 7 #ifndef gm_expectations_DEFINED
8 #define gm_expectations_DEFINED 8 #define gm_expectations_DEFINED
9 9
10 #include <stdarg.h> 10 #include <stdarg.h>
11 #include "gm.h" 11 #include "gm.h"
12 #include "SkBitmap.h" 12 #include "SkBitmap.h"
13 #include "SkBitmapChecksummer.h" 13 #include "SkBitmapHasher.h"
14 #include "SkData.h" 14 #include "SkData.h"
15 #include "SkImageDecoder.h" 15 #include "SkImageDecoder.h"
16 #include "SkOSFile.h" 16 #include "SkOSFile.h"
17 #include "SkRefCnt.h" 17 #include "SkRefCnt.h"
18 #include "SkStream.h" 18 #include "SkStream.h"
19 #include "SkTArray.h" 19 #include "SkTArray.h"
20 20
21 #ifdef SK_BUILD_FOR_WIN 21 #ifdef SK_BUILD_FOR_WIN
22 // json includes xlocale which generates warning 4530 because we're compilin g without 22 // json includes xlocale which generates warning 4530 because we're compilin g without
23 // exceptions; see https://code.google.com/p/skia/issues/detail?id=1067 23 // exceptions; see https://code.google.com/p/skia/issues/detail?id=1067
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 fIgnoreFailure = ignoreFailure; 87 fIgnoreFailure = ignoreFailure;
88 } 88 }
89 89
90 /** 90 /**
91 * Expect exactly one image (appropriate for the case when we 91 * Expect exactly one image (appropriate for the case when we
92 * are comparing against a single PNG file). 92 * are comparing against a single PNG file).
93 */ 93 */
94 Expectations(const SkBitmap& bitmap, bool ignoreFailure=kDefaultIgnoreFa ilure) { 94 Expectations(const SkBitmap& bitmap, bool ignoreFailure=kDefaultIgnoreFa ilure) {
95 fBitmap = bitmap; 95 fBitmap = bitmap;
96 fIgnoreFailure = ignoreFailure; 96 fIgnoreFailure = ignoreFailure;
97 fAllowedChecksums.push_back() = SkBitmapChecksummer::Compute64(bitma p); 97 SkHashDigest digest;
98 // TODO(epoger): Better handling for error returned by ComputeDigest ()?
99 // For now, we just report a digest of 0 in error cases, like before .
100 if (!SkBitmapHasher::ComputeDigest(bitmap, &digest)) {
101 digest = 0;
102 }
103 fAllowedChecksums.push_back() = digest;
98 } 104 }
99 105
100 /** 106 /**
101 * Create Expectations from a JSON element as found within the 107 * Create Expectations from a JSON element as found within the
102 * kJsonKey_ExpectedResults section. 108 * kJsonKey_ExpectedResults section.
103 * 109 *
104 * It's fine if the jsonElement is null or empty; in that case, we just 110 * It's fine if the jsonElement is null or empty; in that case, we just
105 * don't have any expectations. 111 * don't have any expectations.
106 */ 112 */
107 Expectations(Json::Value jsonElement) { 113 Expectations(Json::Value jsonElement) {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 } 363 }
358 return true; 364 return true;
359 } 365 }
360 366
361 Json::Value fJsonRoot; 367 Json::Value fJsonRoot;
362 Json::Value fJsonExpectedResults; 368 Json::Value fJsonExpectedResults;
363 }; 369 };
364 370
365 } 371 }
366 #endif 372 #endif
OLDNEW
« no previous file with comments | « no previous file | gm/gmmain.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698