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

Side by Side Diff: gm/filterindiabox.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/filterbitmap.cpp ('k') | samplecode/SamplePicture.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 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 #include "gm.h" 8 #include "gm.h"
9 9
10 #include "Resources.h" 10 #include "Resources.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 protected: 98 protected:
99 SkString fFilename; 99 SkString fFilename;
100 int fSize; 100 int fSize;
101 101
102 SkScalar getScale() { 102 SkScalar getScale() {
103 return 192.f/fSize; 103 return 192.f/fSize;
104 } 104 }
105 105
106 void makeBitmap() { 106 void makeBitmap() {
107 SkString resourcePath = GetResourcePath();
108 resourcePath.append("/");
109 resourcePath.append(fFilename);
110
111 SkImageDecoder* codec = NULL; 107 SkImageDecoder* codec = NULL;
108 SkString resourcePath = GetResourcePath(fFilename.c_str());
112 SkFILEStream stream(resourcePath.c_str()); 109 SkFILEStream stream(resourcePath.c_str());
113 if (stream.isValid()) { 110 if (stream.isValid()) {
114 codec = SkImageDecoder::Factory(&stream); 111 codec = SkImageDecoder::Factory(&stream);
115 } 112 }
116 if (codec) { 113 if (codec) {
117 stream.rewind(); 114 stream.rewind();
118 codec->decode(&stream, &fBM, kN32_SkColorType, SkImageDecoder::kDe codePixels_Mode); 115 codec->decode(&stream, &fBM, kN32_SkColorType, SkImageDecoder::kDe codePixels_Mode);
119 SkDELETE(codec); 116 SkDELETE(codec);
120 } else { 117 } else {
121 fBM.allocN32Pixels(1, 1); 118 fBM.allocN32Pixels(1, 1);
122 *(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad 119 *(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad
123 } 120 }
124 fSize = fBM.height(); 121 fSize = fBM.height();
125 } 122 }
126 private: 123 private:
127 typedef skiagm::GM INHERITED; 124 typedef skiagm::GM INHERITED;
128 }; 125 };
129 126
130 ////////////////////////////////////////////////////////////////////////////// 127 //////////////////////////////////////////////////////////////////////////////
131 128
132 129
133 DEF_GM( return new FilterIndiaBoxGM("box.gif"); ) 130 DEF_GM( return new FilterIndiaBoxGM("box.gif"); )
OLDNEW
« no previous file with comments | « gm/filterbitmap.cpp ('k') | samplecode/SamplePicture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698