Spin off incidental changes from DM CL (22839016).

BUG=
R=epoger@google.com, bsalomon@google.com

Author: mtklein@google.com

Review URL: https://codereview.chromium.org/27023004

git-svn-id: http://skia.googlecode.com/svn/trunk@11752 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2013-10-14 14:15:28 +00:00
parent 5e00989a28
commit 1d5bbb26cf
3 changed files with 14 additions and 12 deletions

View File

@ -203,7 +203,7 @@ namespace skiagm {
// IndividualImageExpectationsSource class... // IndividualImageExpectationsSource class...
Expectations IndividualImageExpectationsSource::get(const char *testName) { Expectations IndividualImageExpectationsSource::get(const char *testName) const {
SkString path = SkOSPath::SkPathJoin(fRootDir.c_str(), testName); SkString path = SkOSPath::SkPathJoin(fRootDir.c_str(), testName);
SkBitmap referenceBitmap; SkBitmap referenceBitmap;
bool decodedReferenceBitmap = bool decodedReferenceBitmap =
@ -226,7 +226,7 @@ namespace skiagm {
fJsonExpectedResults = fJsonRoot[kJsonKey_ExpectedResults]; fJsonExpectedResults = fJsonRoot[kJsonKey_ExpectedResults];
} }
Expectations JsonExpectationsSource::get(const char *testName) { Expectations JsonExpectationsSource::get(const char *testName) const {
return Expectations(fJsonExpectedResults[testName]); return Expectations(fJsonExpectedResults[testName]);
} }

View File

@ -49,14 +49,14 @@ namespace skiagm {
/** /**
* Create a ResultDigest representing an actual image result. * Create a ResultDigest representing an actual image result.
*/ */
GmResultDigest(const SkBitmap &bitmap); explicit GmResultDigest(const SkBitmap &bitmap);
/** /**
* Create a ResultDigest representing an allowed result * Create a ResultDigest representing an allowed result
* checksum within JSON expectations file, in the form * checksum within JSON expectations file, in the form
* ["bitmap-64bitMD5", 12345]. * ["bitmap-64bitMD5", 12345].
*/ */
GmResultDigest(const Json::Value &jsonTypeValuePair); explicit GmResultDigest(const Json::Value &jsonTypeValuePair);
/** /**
* Returns true if this GmResultDigest was fully and successfully * Returns true if this GmResultDigest was fully and successfully
@ -96,7 +96,7 @@ namespace skiagm {
*/ */
class BitmapAndDigest { class BitmapAndDigest {
public: public:
BitmapAndDigest(const SkBitmap &bitmap) : fBitmap(bitmap), fDigest(bitmap) {} explicit BitmapAndDigest(const SkBitmap &bitmap) : fBitmap(bitmap), fDigest(bitmap) {}
const SkBitmap fBitmap; const SkBitmap fBitmap;
const GmResultDigest fDigest; const GmResultDigest fDigest;
@ -110,7 +110,7 @@ namespace skiagm {
/** /**
* No expectations at all. * No expectations at all.
*/ */
Expectations(bool ignoreFailure=kDefaultIgnoreFailure); explicit Expectations(bool ignoreFailure=kDefaultIgnoreFailure);
/** /**
* Expect exactly one image (appropriate for the case when we * Expect exactly one image (appropriate for the case when we
@ -125,7 +125,7 @@ namespace skiagm {
* It's fine if the jsonElement is null or empty; in that case, we just * It's fine if the jsonElement is null or empty; in that case, we just
* don't have any expectations. * don't have any expectations.
*/ */
Expectations(Json::Value jsonElement); explicit Expectations(Json::Value jsonElement);
/** /**
* Returns true iff we want to ignore failed expectations. * Returns true iff we want to ignore failed expectations.
@ -179,7 +179,7 @@ namespace skiagm {
public: public:
SK_DECLARE_INST_COUNT(ExpectationsSource) SK_DECLARE_INST_COUNT(ExpectationsSource)
virtual Expectations get(const char *testName) = 0; virtual Expectations get(const char *testName) const = 0;
private: private:
typedef SkRefCnt INHERITED; typedef SkRefCnt INHERITED;
@ -197,9 +197,9 @@ namespace skiagm {
* rootDir: directory under which to look for image files * rootDir: directory under which to look for image files
* (this string will be copied to storage within this object) * (this string will be copied to storage within this object)
*/ */
IndividualImageExpectationsSource(const char *rootDir) : fRootDir(rootDir) {} explicit IndividualImageExpectationsSource(const char *rootDir) : fRootDir(rootDir) {}
Expectations get(const char *testName) SK_OVERRIDE ; Expectations get(const char *testName) const SK_OVERRIDE ;
private: private:
const SkString fRootDir; const SkString fRootDir;
@ -216,9 +216,9 @@ namespace skiagm {
* *
* jsonPath: path to JSON file to read * jsonPath: path to JSON file to read
*/ */
JsonExpectationsSource(const char *jsonPath); explicit JsonExpectationsSource(const char *jsonPath);
Expectations get(const char *testName) SK_OVERRIDE; Expectations get(const char *testName) const SK_OVERRIDE;
private: private:

View File

@ -35,6 +35,8 @@ protected:
return make_isize(2*S, 2*S); return make_isize(2*S, 2*S);
} }
virtual uint32_t onGetFlags() const SK_OVERRIDE { return kGPUOnly_Flag; }
virtual void onDraw(SkCanvas* canvas) { virtual void onDraw(SkCanvas* canvas) {
SkBaseDevice* device = canvas->getTopDevice(); SkBaseDevice* device = canvas->getTopDevice();
GrRenderTarget* target = device->accessRenderTarget(); GrRenderTarget* target = device->accessRenderTarget();