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

Side by Side Diff: gm/xfermodeimagefilter.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/verylargebitmap.cpp ('k') | gm/xfermodes.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 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 #include "SkArithmeticMode.h" 9 #include "SkArithmeticMode.h"
10 #include "SkOffsetImageFilter.h" 10 #include "SkOffsetImageFilter.h"
11 #include "SkXfermodeImageFilter.h" 11 #include "SkXfermodeImageFilter.h"
12 #include "SkBitmapSource.h" 12 #include "SkBitmapSource.h"
13 13
14 #define WIDTH 600 14 #define WIDTH 600
15 #define HEIGHT 600 15 #define HEIGHT 600
16 #define MARGIN 12 16 #define MARGIN 12
17 17
18 namespace skiagm { 18 namespace skiagm {
19 19
20 class XfermodeImageFilterGM : public GM { 20 class XfermodeImageFilterGM : public GM {
21 public: 21 public:
22 XfermodeImageFilterGM(){ 22 XfermodeImageFilterGM(){
23 this->setBGColor(0xFF000000); 23 this->setBGColor(0xFF000000);
24 } 24 }
25 25
26 protected: 26 protected:
27 virtual SkString onShortName() SK_OVERRIDE { 27 SkString onShortName() SK_OVERRIDE {
28 return SkString("xfermodeimagefilter"); 28 return SkString("xfermodeimagefilter");
29 } 29 }
30 30
31 void make_bitmap() { 31 void make_bitmap() {
32 fBitmap.allocN32Pixels(80, 80); 32 fBitmap.allocN32Pixels(80, 80);
33 SkCanvas canvas(fBitmap); 33 SkCanvas canvas(fBitmap);
34 canvas.clear(0x00000000); 34 canvas.clear(0x00000000);
35 SkPaint paint; 35 SkPaint paint;
36 paint.setAntiAlias(true); 36 paint.setAntiAlias(true);
37 sk_tool_utils::set_portable_typeface(&paint); 37 sk_tool_utils::set_portable_typeface(&paint);
(...skipping 17 matching lines...) Expand all
55 canvas.translate(SkIntToScalar(x), SkIntToScalar(y)); 55 canvas.translate(SkIntToScalar(x), SkIntToScalar(y));
56 canvas.drawRect(SkRect::MakeXYWH(0, 0, 8, 8), darkPaint); 56 canvas.drawRect(SkRect::MakeXYWH(0, 0, 8, 8), darkPaint);
57 canvas.drawRect(SkRect::MakeXYWH(8, 0, 8, 8), lightPaint); 57 canvas.drawRect(SkRect::MakeXYWH(8, 0, 8, 8), lightPaint);
58 canvas.drawRect(SkRect::MakeXYWH(0, 8, 8, 8), lightPaint); 58 canvas.drawRect(SkRect::MakeXYWH(0, 8, 8, 8), lightPaint);
59 canvas.drawRect(SkRect::MakeXYWH(8, 8, 8, 8), darkPaint); 59 canvas.drawRect(SkRect::MakeXYWH(8, 8, 8, 8), darkPaint);
60 canvas.restore(); 60 canvas.restore();
61 } 61 }
62 } 62 }
63 } 63 }
64 64
65 virtual SkISize onISize() SK_OVERRIDE { 65 SkISize onISize() SK_OVERRIDE {
66 return SkISize::Make(WIDTH, HEIGHT); 66 return SkISize::Make(WIDTH, HEIGHT);
67 } 67 }
68 68
69 static void drawClippedBitmap(SkCanvas* canvas, const SkBitmap& bitmap, cons t SkPaint& paint, 69 static void drawClippedBitmap(SkCanvas* canvas, const SkBitmap& bitmap, cons t SkPaint& paint,
70 int x, int y) { 70 int x, int y) {
71 canvas->save(); 71 canvas->save();
72 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); 72 canvas->translate(SkIntToScalar(x), SkIntToScalar(y));
73 canvas->clipRect(SkRect::MakeWH( 73 canvas->clipRect(SkRect::MakeWH(
74 SkIntToScalar(bitmap.width()), SkIntToScalar(bitmap.height()))); 74 SkIntToScalar(bitmap.width()), SkIntToScalar(bitmap.height())));
75 canvas->drawBitmap(bitmap, 0, 0, &paint); 75 canvas->drawBitmap(bitmap, 0, 0, &paint);
76 canvas->restore(); 76 canvas->restore();
77 } 77 }
78 78
79 static void drawClippedPaint(SkCanvas* canvas, const SkRect& rect, const SkP aint& paint, 79 static void drawClippedPaint(SkCanvas* canvas, const SkRect& rect, const SkP aint& paint,
80 int x, int y) { 80 int x, int y) {
81 canvas->save(); 81 canvas->save();
82 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); 82 canvas->translate(SkIntToScalar(x), SkIntToScalar(y));
83 canvas->clipRect(rect); 83 canvas->clipRect(rect);
84 canvas->drawPaint(paint); 84 canvas->drawPaint(paint);
85 canvas->restore(); 85 canvas->restore();
86 } 86 }
87 87
88 virtual void onOnceBeforeDraw() SK_OVERRIDE { 88 void onOnceBeforeDraw() SK_OVERRIDE {
89 make_bitmap(); 89 make_bitmap();
90 make_checkerboard(); 90 make_checkerboard();
91 } 91 }
92 92
93 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 93 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
94 canvas->clear(0x00000000); 94 canvas->clear(0x00000000);
95 SkPaint paint; 95 SkPaint paint;
96 96
97 const struct { 97 const struct {
98 SkXfermode::Mode fMode; 98 SkXfermode::Mode fMode;
99 const char* fLabel; 99 const char* fLabel;
100 } gModes[] = { 100 } gModes[] = {
101 { SkXfermode::kClear_Mode, "Clear" }, 101 { SkXfermode::kClear_Mode, "Clear" },
102 { SkXfermode::kSrc_Mode, "Src" }, 102 { SkXfermode::kSrc_Mode, "Src" },
103 { SkXfermode::kDst_Mode, "Dst" }, 103 { SkXfermode::kDst_Mode, "Dst" },
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 private: 218 private:
219 SkBitmap fBitmap, fCheckerboard; 219 SkBitmap fBitmap, fCheckerboard;
220 typedef GM INHERITED; 220 typedef GM INHERITED;
221 }; 221 };
222 222
223 ////////////////////////////////////////////////////////////////////////////// 223 //////////////////////////////////////////////////////////////////////////////
224 224
225 DEF_GM( return new XfermodeImageFilterGM; ); 225 DEF_GM( return new XfermodeImageFilterGM; );
226 226
227 } 227 }
OLDNEW
« no previous file with comments | « gm/verylargebitmap.cpp ('k') | gm/xfermodes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698