Chromium Code Reviews| 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 canvas->drawImage(image, 0, 0); | 108 if (image) { |
|
djsollen
2016/01/07 14:59:19
should we print a debug statement if image == null
| |
| 109 canvas->drawImage(image, 0, 0); | |
| 110 } | |
| 109 } | 111 } |
| 110 | 112 |
| 111 private: | 113 private: |
| 112 typedef GM INHERITED; | 114 typedef GM INHERITED; |
| 113 }; | 115 }; |
| 114 | 116 |
| 115 // This class specializes ETC1BitmapGM to load the mandrill_128.pkm file. | 117 // This class specializes ETC1BitmapGM to load the mandrill_128.pkm file. |
| 116 class ETC1Bitmap_PKM_GM : public ETC1BitmapGM { | 118 class ETC1Bitmap_PKM_GM : public ETC1BitmapGM { |
| 117 public: | 119 public: |
| 118 ETC1Bitmap_PKM_GM() : ETC1BitmapGM() { } | 120 ETC1Bitmap_PKM_GM() : ETC1BitmapGM() { } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 | 214 |
| 213 ////////////////////////////////////////////////////////////////////////////// | 215 ////////////////////////////////////////////////////////////////////////////// |
| 214 | 216 |
| 215 DEF_GM(return new skiagm::ETC1Bitmap_PKM_GM;) | 217 DEF_GM(return new skiagm::ETC1Bitmap_PKM_GM;) |
| 216 DEF_GM(return new skiagm::ETC1Bitmap_KTX_GM;) | 218 DEF_GM(return new skiagm::ETC1Bitmap_KTX_GM;) |
| 217 DEF_GM(return new skiagm::ETC1Bitmap_R11_KTX_GM;) | 219 DEF_GM(return new skiagm::ETC1Bitmap_R11_KTX_GM;) |
| 218 | 220 |
| 219 #ifndef SK_IGNORE_ETC1_SUPPORT | 221 #ifndef SK_IGNORE_ETC1_SUPPORT |
| 220 DEF_GM(return new skiagm::ETC1Bitmap_NPOT_GM;) | 222 DEF_GM(return new skiagm::ETC1Bitmap_NPOT_GM;) |
| 221 #endif // SK_IGNORE_ETC1_SUPPORT | 223 #endif // SK_IGNORE_ETC1_SUPPORT |
| OLD | NEW |