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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 /** | 47 /** |
48 * Test decoding an image from an ASTC file and then from compressed ASTC data. | 48 * Test decoding an image from an ASTC file and then from compressed ASTC data. |
49 */ | 49 */ |
50 class ASTCBitmapGM : public GM { | 50 class ASTCBitmapGM : public GM { |
51 public: | 51 public: |
52 ASTCBitmapGM() { } | 52 ASTCBitmapGM() { } |
53 virtual ~ASTCBitmapGM() { } | 53 virtual ~ASTCBitmapGM() { } |
54 | 54 |
55 protected: | 55 protected: |
56 virtual SkString onShortName() SK_OVERRIDE { | 56 SkString onShortName() SK_OVERRIDE { |
57 return SkString("astcbitmap"); | 57 return SkString("astcbitmap"); |
58 } | 58 } |
59 | 59 |
60 virtual SkISize onISize() SK_OVERRIDE { | 60 SkISize onISize() SK_OVERRIDE { |
61 return SkISize::Make(kGMDimension, kGMDimension); | 61 return SkISize::Make(kGMDimension, kGMDimension); |
62 } | 62 } |
63 | 63 |
64 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 64 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
65 for (int j = 0; j < 4; ++j) { | 65 for (int j = 0; j < 4; ++j) { |
66 for (int i = 0; i < 4; ++i) { | 66 for (int i = 0; i < 4; ++i) { |
67 SkString filename = GetResourcePath(get_astc_filename(j*4+i)); | 67 SkString filename = GetResourcePath(get_astc_filename(j*4+i)); |
68 if (filename == GetResourcePath("")) { | 68 if (filename == GetResourcePath("")) { |
69 continue; | 69 continue; |
70 } | 70 } |
71 | 71 |
72 SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(filename.c
_str())); | 72 SkAutoTUnref<SkData> fileData(SkData::NewFromFileName(filename.c
_str())); |
73 if (NULL == fileData) { | 73 if (NULL == fileData) { |
74 SkDebugf("Could not open the file. Did you forget to set the
resourcePath?\n"); | 74 SkDebugf("Could not open the file. Did you forget to set the
resourcePath?\n"); |
(...skipping 18 matching lines...) Expand all Loading... |
93 static const int kBitmapDimension = kGMDimension/4; | 93 static const int kBitmapDimension = kGMDimension/4; |
94 | 94 |
95 typedef GM INHERITED; | 95 typedef GM INHERITED; |
96 }; | 96 }; |
97 | 97 |
98 } // namespace skiagm | 98 } // namespace skiagm |
99 | 99 |
100 ////////////////////////////////////////////////////////////////////////////// | 100 ////////////////////////////////////////////////////////////////////////////// |
101 | 101 |
102 DEF_GM( return SkNEW(skiagm::ASTCBitmapGM); ) | 102 DEF_GM( return SkNEW(skiagm::ASTCBitmapGM); ) |
OLD | NEW |