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

Side by Side Diff: gm/tilemodes_scaled.cpp

Issue 815883002: Cleanup: Another round of override fixes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: revert include changes Created 6 years 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/tilemodes.cpp ('k') | gm/verttext.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkPath.h" 9 #include "SkPath.h"
10 #include "SkRegion.h" 10 #include "SkRegion.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 59
60 SkBitmap fTexture[SK_ARRAY_COUNT(gColorTypes)]; 60 SkBitmap fTexture[SK_ARRAY_COUNT(gColorTypes)];
61 61
62 protected: 62 protected:
63 enum { 63 enum {
64 kPOTSize = 4, 64 kPOTSize = 4,
65 kNPOTSize = 3, 65 kNPOTSize = 3,
66 }; 66 };
67 67
68 SkString onShortName() { 68 SkString onShortName() SK_OVERRIDE {
69 SkString name("scaled_tilemodes"); 69 SkString name("scaled_tilemodes");
70 if (!fPowerOfTwoSize) { 70 if (!fPowerOfTwoSize) {
71 name.append("_npot"); 71 name.append("_npot");
72 } 72 }
73 return name; 73 return name;
74 } 74 }
75 75
76 #ifdef SK_CPU_ARM64 76 #ifdef SK_CPU_ARM64
77 // Skip tiled drawing on 64-bit ARM until https://skbug.com/2908 is fixed. 77 // Skip tiled drawing on 64-bit ARM until https://skbug.com/2908 is fixed.
78 virtual uint32_t onGetFlags() const SK_OVERRIDE { 78 virtual uint32_t onGetFlags() const SK_OVERRIDE {
79 return kSkipTiled_Flag; 79 return kSkipTiled_Flag;
80 } 80 }
81 #endif 81 #endif
82 82
83 SkISize onISize() { return SkISize::Make(880, 760); } 83 SkISize onISize() SK_OVERRIDE { return SkISize::Make(880, 760); }
84 84
85 virtual void onOnceBeforeDraw() SK_OVERRIDE { 85 virtual void onOnceBeforeDraw() SK_OVERRIDE {
86 int size = fPowerOfTwoSize ? kPOTSize : kNPOTSize; 86 int size = fPowerOfTwoSize ? kPOTSize : kNPOTSize;
87 for (size_t i = 0; i < SK_ARRAY_COUNT(gColorTypes); i++) { 87 for (size_t i = 0; i < SK_ARRAY_COUNT(gColorTypes); i++) {
88 makebm(&fTexture[i], gColorTypes[i], size, size); 88 makebm(&fTexture[i], gColorTypes[i], size, size);
89 } 89 }
90 } 90 }
91 91
92 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 92 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
93
94 float scale = 32.f/kPOTSize; 93 float scale = 32.f/kPOTSize;
95 94
96 int size = fPowerOfTwoSize ? kPOTSize : kNPOTSize; 95 int size = fPowerOfTwoSize ? kPOTSize : kNPOTSize;
97 96
98 SkRect r = { 0, 0, SkIntToScalar(size*2), SkIntToScalar(size*2) }; 97 SkRect r = { 0, 0, SkIntToScalar(size*2), SkIntToScalar(size*2) };
99 98
100 static const char* gColorTypeNames[] = { "8888" , "565", "4444" }; 99 static const char* gColorTypeNames[] = { "8888" , "565", "4444" };
101 100
102 static const SkPaint::FilterLevel gFilterLevels[] = 101 static const SkPaint::FilterLevel gFilterLevels[] =
103 { SkPaint::kNone_FilterLevel, 102 { SkPaint::kNone_FilterLevel,
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 public: 210 public:
212 ScaledTiling2GM(ShaderProc proc, const char name[]) : fProc(proc) { 211 ScaledTiling2GM(ShaderProc proc, const char name[]) : fProc(proc) {
213 fName.printf("scaled_tilemode_%s", name); 212 fName.printf("scaled_tilemode_%s", name);
214 } 213 }
215 214
216 protected: 215 protected:
217 virtual uint32_t onGetFlags() const SK_OVERRIDE { 216 virtual uint32_t onGetFlags() const SK_OVERRIDE {
218 return kSkipTiled_Flag; 217 return kSkipTiled_Flag;
219 } 218 }
220 219
221 SkString onShortName() { 220 SkString onShortName() SK_OVERRIDE {
222 return fName; 221 return fName;
223 } 222 }
224 223
225 SkISize onISize() { return SkISize::Make(880, 560); } 224 SkISize onISize() SK_OVERRIDE { return SkISize::Make(880, 560); }
226 225
227 virtual void onDraw(SkCanvas* canvas) { 226 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
228 canvas->scale(SkIntToScalar(3)/2, SkIntToScalar(3)/2); 227 canvas->scale(SkIntToScalar(3)/2, SkIntToScalar(3)/2);
229 228
230 const SkScalar w = SkIntToScalar(gWidth); 229 const SkScalar w = SkIntToScalar(gWidth);
231 const SkScalar h = SkIntToScalar(gHeight); 230 const SkScalar h = SkIntToScalar(gHeight);
232 SkRect r = { -w, -h, w*2, h*2 }; 231 SkRect r = { -w, -h, w*2, h*2 };
233 232
234 static const SkShader::TileMode gModes[] = { 233 static const SkShader::TileMode gModes[] = {
235 SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode, SkShader::kMi rror_TileMode 234 SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode, SkShader::kMi rror_TileMode
236 }; 235 };
237 static const char* gModeNames[] = { 236 static const char* gModeNames[] = {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 private: 279 private:
281 typedef skiagm::GM INHERITED; 280 typedef skiagm::GM INHERITED;
282 }; 281 };
283 282
284 ////////////////////////////////////////////////////////////////////////////// 283 //////////////////////////////////////////////////////////////////////////////
285 284
286 DEF_GM( return new ScaledTilingGM(true); ) 285 DEF_GM( return new ScaledTilingGM(true); )
287 DEF_GM( return new ScaledTilingGM(false); ) 286 DEF_GM( return new ScaledTilingGM(false); )
288 DEF_GM( return new ScaledTiling2GM(make_bm, "bitmap"); ) 287 DEF_GM( return new ScaledTiling2GM(make_bm, "bitmap"); )
289 DEF_GM( return new ScaledTiling2GM(make_grad, "gradient"); ) 288 DEF_GM( return new ScaledTiling2GM(make_grad, "gradient"); )
OLDNEW
« no previous file with comments | « gm/tilemodes.cpp ('k') | gm/verttext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698