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

Side by Side Diff: gm/copyTo4444.cpp

Issue 351133003: Cleanup usage of GetResourcePath() after commit bcbc1788b478b1e54079318ad073e8490aa66fae. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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 | « gm/coloremoji.cpp ('k') | gm/downsamplebitmap.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 9
10 #include "Resources.h" 10 #include "Resources.h"
(...skipping 14 matching lines...) Expand all
25 virtual SkString onShortName() { 25 virtual SkString onShortName() {
26 return SkString("copyTo4444"); 26 return SkString("copyTo4444");
27 } 27 }
28 28
29 virtual SkISize onISize() { 29 virtual SkISize onISize() {
30 return SkISize::Make(1024, 512); 30 return SkISize::Make(1024, 512);
31 } 31 }
32 32
33 virtual void onDraw(SkCanvas* canvas) { 33 virtual void onDraw(SkCanvas* canvas) {
34 SkBitmap bm, bm4444; 34 SkBitmap bm, bm4444;
35 SkString resourcePath = GetResourcePath(); 35 SkString pngFilename = GetResourcePath("mandrill_512.png");
36 SkString filename = SkOSPath::SkPathJoin(resourcePath.c_str(), "mandrill _512.png"); 36 if (!SkImageDecoder::DecodeFile(pngFilename.c_str(), &bm, kN32_SkColorTy pe,
37 if (!SkImageDecoder::DecodeFile(filename.c_str(), &bm, kN32_SkColorType,
38 SkImageDecoder::kDecodePixels_Mode)) { 37 SkImageDecoder::kDecodePixels_Mode)) {
39 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 "
40 "resourcePath?\n"); 39 "resourcePath?\n");
41 return; 40 return;
42 } 41 }
43 canvas->drawBitmap(bm, 0, 0); 42 canvas->drawBitmap(bm, 0, 0);
44 SkAssertResult(bm.copyTo(&bm4444, kARGB_4444_SkColorType)); 43 SkAssertResult(bm.copyTo(&bm4444, kARGB_4444_SkColorType));
45 canvas->drawBitmap(bm4444, SkIntToScalar(bm.width()), 0); 44 canvas->drawBitmap(bm4444, SkIntToScalar(bm.width()), 0);
46 } 45 }
47 46
48 private: 47 private:
49 typedef GM INHERITED; 48 typedef GM INHERITED;
50 }; 49 };
51 50
52 ////////////////////////////////////////////////////////////////////////////// 51 //////////////////////////////////////////////////////////////////////////////
53 52
54 static GM* MyFactory(void*) { return new CopyTo4444GM; } 53 static GM* MyFactory(void*) { return new CopyTo4444GM; }
55 static GMRegistry reg(MyFactory); 54 static GMRegistry reg(MyFactory);
56 55
57 } 56 }
OLDNEW
« no previous file with comments | « gm/coloremoji.cpp ('k') | gm/downsamplebitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698