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

Side by Side Diff: gm/etc1bitmap.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 | « gm/copyTo4444.cpp ('k') | gm/factory.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 2014 Google Inc. 2 * Copyright 2014 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 "SkData.h" 10 #include "SkData.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 86 }
87 87
88 virtual SkISize onISize() SK_OVERRIDE { 88 virtual SkISize onISize() SK_OVERRIDE {
89 return make_isize(128, 128); 89 return make_isize(128, 128);
90 } 90 }
91 91
92 virtual SkString fileExtension() const = 0; 92 virtual SkString fileExtension() const = 0;
93 93
94 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 94 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
95 SkBitmap bm; 95 SkBitmap bm;
96 SkString filename = SkOSPath::SkPathJoin(INHERITED::gResourcePath, "mand rill_128."); 96 SkString filename = SkOSPath::SkPathJoin(
97 INHERITED::gResourcePath.c_str(), "mandrill_128.");
97 filename.append(this->fileExtension()); 98 filename.append(this->fileExtension());
98 99
99 SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(filename.c_str())) ; 100 SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(filename.c_str())) ;
100 if (NULL == fileData) { 101 if (NULL == fileData) {
101 SkDebugf("Could not open the file. Did you forget to set the resourc ePath?\n"); 102 SkDebugf("Could not open the file. Did you forget to set the resourc ePath?\n");
102 return; 103 return;
103 } 104 }
104 105
105 if (!SkInstallDiscardablePixelRef( 106 if (!SkInstallDiscardablePixelRef(
106 SkDecodingImageGenerator::Create( 107 SkDecodingImageGenerator::Create(
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 return SkString("etc1bitmap_npot"); 162 return SkString("etc1bitmap_npot");
162 } 163 }
163 164
164 virtual SkISize onISize() SK_OVERRIDE { 165 virtual SkISize onISize() SK_OVERRIDE {
165 return make_isize(124, 124); 166 return make_isize(124, 124);
166 } 167 }
167 168
168 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 169 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
169 170
170 SkBitmap bm; 171 SkBitmap bm;
171 SkString filename = SkOSPath::SkPathJoin(INHERITED::gResourcePath, "mand rill_128.pkm"); 172 SkString filename = SkOSPath::SkPathJoin(
173 INHERITED::gResourcePath.c_str(), "mandrill_128.pkm");
172 174
173 SkAutoDataUnref fileData(SkData::NewFromFileName(filename.c_str())); 175 SkAutoDataUnref fileData(SkData::NewFromFileName(filename.c_str()));
174 if (NULL == fileData) { 176 if (NULL == fileData) {
175 SkDebugf("Could not open the file. Did you forget to set the resourc ePath?\n"); 177 SkDebugf("Could not open the file. Did you forget to set the resourc ePath?\n");
176 return; 178 return;
177 } 179 }
178 180
179 SkAutoMalloc am(fileData->size()); 181 SkAutoMalloc am(fileData->size());
180 memcpy(am.get(), fileData->data(), fileData->size()); 182 memcpy(am.get(), fileData->data(), fileData->size());
181 183
(...skipping 27 matching lines...) Expand all
209 } // namespace skiagm 211 } // namespace skiagm
210 212
211 ////////////////////////////////////////////////////////////////////////////// 213 //////////////////////////////////////////////////////////////////////////////
212 214
213 DEF_GM( return SkNEW(skiagm::ETC1Bitmap_PKM_GM); ) 215 DEF_GM( return SkNEW(skiagm::ETC1Bitmap_PKM_GM); )
214 DEF_GM( return SkNEW(skiagm::ETC1Bitmap_KTX_GM); ) 216 DEF_GM( return SkNEW(skiagm::ETC1Bitmap_KTX_GM); )
215 217
216 #ifndef SK_IGNORE_ETC1_SUPPORT 218 #ifndef SK_IGNORE_ETC1_SUPPORT
217 DEF_GM( return SkNEW(skiagm::ETC1Bitmap_NPOT_GM); ) 219 DEF_GM( return SkNEW(skiagm::ETC1Bitmap_NPOT_GM); )
218 #endif // SK_IGNORE_ETC1_SUPPORT 220 #endif // SK_IGNORE_ETC1_SUPPORT
OLDNEW
« no previous file with comments | « gm/copyTo4444.cpp ('k') | gm/factory.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698