| 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 | 9 |
| 10 #include "Resources.h" | 10 #include "Resources.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 SkBitmap bm; | 98 SkBitmap bm; |
| 99 SkString filename = GetResourcePath("mandrill_128."); | 99 SkString filename = GetResourcePath("mandrill_128."); |
| 100 filename.append(this->fileExtension()); | 100 filename.append(this->fileExtension()); |
| 101 SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(filename.c_str()))
; | 101 SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(filename.c_str()))
; |
| 102 if (nullptr == fileData) { | 102 if (nullptr == fileData) { |
| 103 SkDebugf("Could not open the file. Did you forget to set the resourc
ePath?\n"); | 103 SkDebugf("Could not open the file. Did you forget to set the resourc
ePath?\n"); |
| 104 return; | 104 return; |
| 105 } | 105 } |
| 106 | 106 |
| 107 SkAutoTUnref<SkImage> image(SkImage::NewFromEncoded(fileData)); | 107 SkAutoTUnref<SkImage> image(SkImage::NewFromEncoded(fileData)); |
| 108 if (nullptr == image) { |
| 109 SkDebugf("Could not decode the ETC file. ETC may not be included in
this platform.\n"); |
| 110 return; |
| 111 } |
| 108 canvas->drawImage(image, 0, 0); | 112 canvas->drawImage(image, 0, 0); |
| 109 } | 113 } |
| 110 | 114 |
| 111 private: | 115 private: |
| 112 typedef GM INHERITED; | 116 typedef GM INHERITED; |
| 113 }; | 117 }; |
| 114 | 118 |
| 115 // This class specializes ETC1BitmapGM to load the mandrill_128.pkm file. | 119 // This class specializes ETC1BitmapGM to load the mandrill_128.pkm file. |
| 116 class ETC1Bitmap_PKM_GM : public ETC1BitmapGM { | 120 class ETC1Bitmap_PKM_GM : public ETC1BitmapGM { |
| 117 public: | 121 public: |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 216 |
| 213 ////////////////////////////////////////////////////////////////////////////// | 217 ////////////////////////////////////////////////////////////////////////////// |
| 214 | 218 |
| 215 DEF_GM(return new skiagm::ETC1Bitmap_PKM_GM;) | 219 DEF_GM(return new skiagm::ETC1Bitmap_PKM_GM;) |
| 216 DEF_GM(return new skiagm::ETC1Bitmap_KTX_GM;) | 220 DEF_GM(return new skiagm::ETC1Bitmap_KTX_GM;) |
| 217 DEF_GM(return new skiagm::ETC1Bitmap_R11_KTX_GM;) | 221 DEF_GM(return new skiagm::ETC1Bitmap_R11_KTX_GM;) |
| 218 | 222 |
| 219 #ifndef SK_IGNORE_ETC1_SUPPORT | 223 #ifndef SK_IGNORE_ETC1_SUPPORT |
| 220 DEF_GM(return new skiagm::ETC1Bitmap_NPOT_GM;) | 224 DEF_GM(return new skiagm::ETC1Bitmap_NPOT_GM;) |
| 221 #endif // SK_IGNORE_ETC1_SUPPORT | 225 #endif // SK_IGNORE_ETC1_SUPPORT |
| OLD | NEW |