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

Side by Side Diff: gm/downsamplebitmap.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/copyTo4444.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 9
10 #include "Resources.h" 10 #include "Resources.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 : INHERITED(filterLevel), fFilename(filename) 165 : INHERITED(filterLevel), fFilename(filename)
166 { 166 {
167 fName.printf("downsamplebitmap_image_%s_%s", this->filterLevelToStri ng(), filename); 167 fName.printf("downsamplebitmap_image_%s_%s", this->filterLevelToStri ng(), filename);
168 } 168 }
169 169
170 protected: 170 protected:
171 SkString fFilename; 171 SkString fFilename;
172 int fSize; 172 int fSize;
173 173
174 virtual void make_bitmap() SK_OVERRIDE { 174 virtual void make_bitmap() SK_OVERRIDE {
175 SkString resourcePath = GetResourcePath();
176 resourcePath.append("/");
177 resourcePath.append(fFilename);
178
179 SkImageDecoder* codec = NULL; 175 SkImageDecoder* codec = NULL;
176 SkString resourcePath = GetResourcePath(fFilename.c_str());
180 SkFILEStream stream(resourcePath.c_str()); 177 SkFILEStream stream(resourcePath.c_str());
181 if (stream.isValid()) { 178 if (stream.isValid()) {
182 codec = SkImageDecoder::Factory(&stream); 179 codec = SkImageDecoder::Factory(&stream);
183 } 180 }
184 if (codec) { 181 if (codec) {
185 stream.rewind(); 182 stream.rewind();
186 codec->decode(&stream, &fBM, kN32_SkColorType, SkImageDecoder::kDe codePixels_Mode); 183 codec->decode(&stream, &fBM, kN32_SkColorType, SkImageDecoder::kDe codePixels_Mode);
187 SkDELETE(codec); 184 SkDELETE(codec);
188 } else { 185 } else {
189 fBM.allocN32Pixels(1, 1); 186 fBM.allocN32Pixels(1, 1);
(...skipping 15 matching lines...) Expand all
205 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kMedium_Filt erLevel); ) 202 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kMedium_Filt erLevel); )
206 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kMedium_ FilterLevel); ) 203 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kMedium_ FilterLevel); )
207 204
208 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kLow_FilterLevel); ) 205 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kLow_FilterLevel); )
209 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kLow_FilterL evel); ) 206 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kLow_FilterL evel); )
210 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kLow_Fil terLevel); ) 207 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kLow_Fil terLevel); )
211 208
212 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kNone_FilterLevel); ) 209 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kNone_FilterLevel); )
213 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kNone_Filter Level); ) 210 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kNone_Filter Level); )
214 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kNone_Fi lterLevel); ) 211 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kNone_Fi lterLevel); )
OLDNEW
« no previous file with comments | « gm/copyTo4444.cpp ('k') | gm/etc1bitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698