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

Side by Side Diff: gm/xfermodes3.cpp

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 11 months 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/xfermodes2.cpp ('k') | gm/yuvtorgbeffect.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 2013 Google Inc. 3 * Copyright 2013 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 "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkGradientShader.h" 10 #include "SkGradientShader.h"
11 #include "SkXfermode.h" 11 #include "SkXfermode.h"
12 #include "SkColorPriv.h" 12 #include "SkColorPriv.h"
13 13
14 #if SK_SUPPORT_GPU 14 #if SK_SUPPORT_GPU
15 #include "GrContext.h" 15 #include "GrContext.h"
16 #include "SkGpuDevice.h" 16 #include "SkGpuDevice.h"
17 #endif 17 #endif
18 18
19 namespace skiagm { 19 namespace skiagm {
20 20
21 /** 21 /**
22 * This tests drawing device-covering rects with solid colors and bitmap shaders over a 22 * This tests drawing device-covering rects with solid colors and bitmap shaders over a
23 * checkerboard background using different xfermodes. 23 * checkerboard background using different xfermodes.
24 */ 24 */
25 class Xfermodes3GM : public GM { 25 class Xfermodes3GM : public GM {
26 public: 26 public:
27 Xfermodes3GM() {} 27 Xfermodes3GM() {}
28 28
29 protected: 29 protected:
30 virtual SkString onShortName() SK_OVERRIDE { 30 SkString onShortName() SK_OVERRIDE {
31 return SkString("xfermodes3"); 31 return SkString("xfermodes3");
32 } 32 }
33 33
34 virtual SkISize onISize() SK_OVERRIDE { 34 SkISize onISize() SK_OVERRIDE {
35 return SkISize::Make(630, 1215); 35 return SkISize::Make(630, 1215);
36 } 36 }
37 37
38 virtual void onDrawBackground(SkCanvas* canvas) SK_OVERRIDE { 38 void onDrawBackground(SkCanvas* canvas) SK_OVERRIDE {
39 SkPaint bgPaint; 39 SkPaint bgPaint;
40 bgPaint.setColor(0xFF70D0E0); 40 bgPaint.setColor(0xFF70D0E0);
41 canvas->drawPaint(bgPaint); 41 canvas->drawPaint(bgPaint);
42 } 42 }
43 43
44 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 44 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
45 canvas->translate(SkIntToScalar(10), SkIntToScalar(20)); 45 canvas->translate(SkIntToScalar(10), SkIntToScalar(20));
46 46
47 SkPaint labelP; 47 SkPaint labelP;
48 labelP.setAntiAlias(true); 48 labelP.setAntiAlias(true);
49 sk_tool_utils::set_portable_typeface(&labelP); 49 sk_tool_utils::set_portable_typeface(&labelP);
50 50
51 static const SkColor kSolidColors[] = { 51 static const SkColor kSolidColors[] = {
52 SK_ColorTRANSPARENT, 52 SK_ColorTRANSPARENT,
53 SK_ColorBLUE, 53 SK_ColorBLUE,
54 0x80808000 54 0x80808000
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 } 177 }
178 178
179 r.inset(-SK_ScalarHalf, -SK_ScalarHalf); 179 r.inset(-SK_ScalarHalf, -SK_ScalarHalf);
180 SkPaint borderPaint; 180 SkPaint borderPaint;
181 borderPaint.setStyle(SkPaint::kStroke_Style); 181 borderPaint.setStyle(SkPaint::kStroke_Style);
182 canvas->drawRect(r, borderPaint); 182 canvas->drawRect(r, borderPaint);
183 183
184 canvas->restore(); 184 canvas->restore();
185 } 185 }
186 186
187 virtual void onOnceBeforeDraw() SK_OVERRIDE { 187 void onOnceBeforeDraw() SK_OVERRIDE {
188 static const uint32_t kCheckData[] = { 188 static const uint32_t kCheckData[] = {
189 SkPackARGB32(0xFF, 0x40, 0x40, 0x40), 189 SkPackARGB32(0xFF, 0x40, 0x40, 0x40),
190 SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0), 190 SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0),
191 SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0), 191 SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0),
192 SkPackARGB32(0xFF, 0x40, 0x40, 0x40) 192 SkPackARGB32(0xFF, 0x40, 0x40, 0x40)
193 }; 193 };
194 SkBitmap bg; 194 SkBitmap bg;
195 bg.allocN32Pixels(2, 2, true); 195 bg.allocN32Pixels(2, 2, true);
196 SkAutoLockPixels bgAlp(bg); 196 SkAutoLockPixels bgAlp(bg);
197 memcpy(bg.getPixels(), kCheckData, sizeof(kCheckData)); 197 memcpy(bg.getPixels(), kCheckData, sizeof(kCheckData));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 SkAutoTUnref<SkShader> fBmpShader; 238 SkAutoTUnref<SkShader> fBmpShader;
239 239
240 typedef GM INHERITED; 240 typedef GM INHERITED;
241 }; 241 };
242 242
243 ////////////////////////////////////////////////////////////////////////////// 243 //////////////////////////////////////////////////////////////////////////////
244 244
245 DEF_GM(return new Xfermodes3GM;) 245 DEF_GM(return new Xfermodes3GM;)
246 246
247 } 247 }
OLDNEW
« no previous file with comments | « gm/xfermodes2.cpp ('k') | gm/yuvtorgbeffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698