OLD | NEW |
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 Loading... |
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( | 96 SkString filename = SkOSPath::SkPathJoin(INHERITED::gResourcePath, "mand
rill_128."); |
97 INHERITED::gResourcePath.c_str(), "mandrill_128."); | |
98 filename.append(this->fileExtension()); | 97 filename.append(this->fileExtension()); |
99 | 98 |
100 SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(filename.c_str()))
; | 99 SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(filename.c_str()))
; |
101 if (NULL == fileData) { | 100 if (NULL == fileData) { |
102 SkDebugf("Could not open the file. Did you forget to set the resourc
ePath?\n"); | 101 SkDebugf("Could not open the file. Did you forget to set the resourc
ePath?\n"); |
103 return; | 102 return; |
104 } | 103 } |
105 | 104 |
106 if (!SkInstallDiscardablePixelRef( | 105 if (!SkInstallDiscardablePixelRef( |
107 SkDecodingImageGenerator::Create( | 106 SkDecodingImageGenerator::Create( |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 return SkString("etc1bitmap_npot"); | 161 return SkString("etc1bitmap_npot"); |
163 } | 162 } |
164 | 163 |
165 virtual SkISize onISize() SK_OVERRIDE { | 164 virtual SkISize onISize() SK_OVERRIDE { |
166 return make_isize(124, 124); | 165 return make_isize(124, 124); |
167 } | 166 } |
168 | 167 |
169 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 168 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
170 | 169 |
171 SkBitmap bm; | 170 SkBitmap bm; |
172 SkString filename = SkOSPath::SkPathJoin( | 171 SkString filename = SkOSPath::SkPathJoin(INHERITED::gResourcePath, "mand
rill_128.pkm"); |
173 INHERITED::gResourcePath.c_str(), "mandrill_128.pkm"); | |
174 | 172 |
175 SkAutoDataUnref fileData(SkData::NewFromFileName(filename.c_str())); | 173 SkAutoDataUnref fileData(SkData::NewFromFileName(filename.c_str())); |
176 if (NULL == fileData) { | 174 if (NULL == fileData) { |
177 SkDebugf("Could not open the file. Did you forget to set the resourc
ePath?\n"); | 175 SkDebugf("Could not open the file. Did you forget to set the resourc
ePath?\n"); |
178 return; | 176 return; |
179 } | 177 } |
180 | 178 |
181 SkAutoMalloc am(fileData->size()); | 179 SkAutoMalloc am(fileData->size()); |
182 memcpy(am.get(), fileData->data(), fileData->size()); | 180 memcpy(am.get(), fileData->data(), fileData->size()); |
183 | 181 |
(...skipping 27 matching lines...) Expand all Loading... |
211 } // namespace skiagm | 209 } // namespace skiagm |
212 | 210 |
213 ////////////////////////////////////////////////////////////////////////////// | 211 ////////////////////////////////////////////////////////////////////////////// |
214 | 212 |
215 DEF_GM( return SkNEW(skiagm::ETC1Bitmap_PKM_GM); ) | 213 DEF_GM( return SkNEW(skiagm::ETC1Bitmap_PKM_GM); ) |
216 DEF_GM( return SkNEW(skiagm::ETC1Bitmap_KTX_GM); ) | 214 DEF_GM( return SkNEW(skiagm::ETC1Bitmap_KTX_GM); ) |
217 | 215 |
218 #ifndef SK_IGNORE_ETC1_SUPPORT | 216 #ifndef SK_IGNORE_ETC1_SUPPORT |
219 DEF_GM( return SkNEW(skiagm::ETC1Bitmap_NPOT_GM); ) | 217 DEF_GM( return SkNEW(skiagm::ETC1Bitmap_NPOT_GM); ) |
220 #endif // SK_IGNORE_ETC1_SUPPORT | 218 #endif // SK_IGNORE_ETC1_SUPPORT |
OLD | NEW |