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

Side by Side Diff: gm/copyTo4444.cpp

Issue 320733002: Revert of Clean up Test's resourcePath code. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « bench/SkBenchmark.cpp ('k') | gm/etc1bitmap.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 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkImageDecoder.h" 10 #include "SkImageDecoder.h"
(...skipping 12 matching lines...) Expand all
23 virtual SkString onShortName() { 23 virtual SkString onShortName() {
24 return SkString("copyTo4444"); 24 return SkString("copyTo4444");
25 } 25 }
26 26
27 virtual SkISize onISize() { 27 virtual SkISize onISize() {
28 return make_isize(1024, 512); 28 return make_isize(1024, 512);
29 } 29 }
30 30
31 virtual void onDraw(SkCanvas* canvas) { 31 virtual void onDraw(SkCanvas* canvas) {
32 SkBitmap bm, bm4444; 32 SkBitmap bm, bm4444;
33 SkString filename = SkOSPath::SkPathJoin(INHERITED::gResourcePath, "mand rill_512.png"); 33 SkString filename = SkOSPath::SkPathJoin(
34 INHERITED::gResourcePath.c_str(), "mandrill_512.png");
34 if (!SkImageDecoder::DecodeFile(filename.c_str(), &bm, 35 if (!SkImageDecoder::DecodeFile(filename.c_str(), &bm,
35 SkBitmap::kARGB_8888_Config, 36 SkBitmap::kARGB_8888_Config,
36 SkImageDecoder::kDecodePixels_Mode)) { 37 SkImageDecoder::kDecodePixels_Mode)) {
37 SkDebugf("Could not decode the file. Did you forget to set the " 38 SkDebugf("Could not decode the file. Did you forget to set the "
38 "resourcePath?\n"); 39 "resourcePath?\n");
39 return; 40 return;
40 } 41 }
41 canvas->drawBitmap(bm, 0, 0); 42 canvas->drawBitmap(bm, 0, 0);
42 SkAssertResult(bm.copyTo(&bm4444, kARGB_4444_SkColorType)); 43 SkAssertResult(bm.copyTo(&bm4444, kARGB_4444_SkColorType));
43 canvas->drawBitmap(bm4444, SkIntToScalar(bm.width()), 0); 44 canvas->drawBitmap(bm4444, SkIntToScalar(bm.width()), 0);
44 } 45 }
45 46
46 private: 47 private:
47 typedef GM INHERITED; 48 typedef GM INHERITED;
48 }; 49 };
49 50
50 ////////////////////////////////////////////////////////////////////////////// 51 //////////////////////////////////////////////////////////////////////////////
51 52
52 static GM* MyFactory(void*) { return new CopyTo4444GM; } 53 static GM* MyFactory(void*) { return new CopyTo4444GM; }
53 static GMRegistry reg(MyFactory); 54 static GMRegistry reg(MyFactory);
54 55
55 } 56 }
OLDNEW
« no previous file with comments | « bench/SkBenchmark.cpp ('k') | gm/etc1bitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698