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

Side by Side Diff: gm/drawfilter.cpp

Issue 1037793002: C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: git cl web Created 5 years, 9 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/drawbitmaprect.cpp ('k') | gm/drawlooper.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 2015 Google Inc. 2 * Copyright 2015 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 "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkBlurMaskFilter.h" 10 #include "SkBlurMaskFilter.h"
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "SkDrawFilter.h" 12 #include "SkDrawFilter.h"
13 #include "SkPaint.h" 13 #include "SkPaint.h"
14 14
15 /** 15 /**
16 * Initial test coverage for SkDrawFilter. 16 * Initial test coverage for SkDrawFilter.
17 * Draws two rectangles; if draw filters are broken, they will match. 17 * Draws two rectangles; if draw filters are broken, they will match.
18 * If draw filters are working correctly, the first will be blue and blurred, 18 * If draw filters are working correctly, the first will be blue and blurred,
19 * the second red and sharp. 19 * the second red and sharp.
20 */ 20 */
21 21
22 class TestFilter : public SkDrawFilter { 22 class TestFilter : public SkDrawFilter {
23 public: 23 public:
24 bool filter(SkPaint* p, Type) SK_OVERRIDE { 24 bool filter(SkPaint* p, Type) override {
25 p->setColor(SK_ColorRED); 25 p->setColor(SK_ColorRED);
26 p->setMaskFilter(NULL); 26 p->setMaskFilter(NULL);
27 return true; 27 return true;
28 } 28 }
29 }; 29 };
30 30
31 class DrawFilterGM : public skiagm::GM { 31 class DrawFilterGM : public skiagm::GM {
32 SkAutoTUnref<SkMaskFilter> fBlur; 32 SkAutoTUnref<SkMaskFilter> fBlur;
33 33
34 protected: 34 protected:
35 SkISize onISize() SK_OVERRIDE { 35 SkISize onISize() override {
36 return SkISize::Make(320, 240); 36 return SkISize::Make(320, 240);
37 } 37 }
38 38
39 SkString onShortName() SK_OVERRIDE { 39 SkString onShortName() override {
40 return SkString("drawfilter"); 40 return SkString("drawfilter");
41 } 41 }
42 42
43 void onOnceBeforeDraw() SK_OVERRIDE { 43 void onOnceBeforeDraw() override {
44 fBlur.reset(SkBlurMaskFilter::Create(kNormal_SkBlurStyle, 44 fBlur.reset(SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
45 SkBlurMask::ConvertRadiusToSigma(10.0f), 45 SkBlurMask::ConvertRadiusToSigma(10.0f),
46 kLow_SkBlurQuality)); 46 kLow_SkBlurQuality));
47 } 47 }
48 48
49 void onDraw(SkCanvas* canvas) SK_OVERRIDE { 49 void onDraw(SkCanvas* canvas) override {
50 SkPaint p; 50 SkPaint p;
51 p.setColor(SK_ColorBLUE); 51 p.setColor(SK_ColorBLUE);
52 p.setMaskFilter(fBlur.get()); 52 p.setMaskFilter(fBlur.get());
53 SkRect r = { 20, 20, 100, 100 }; 53 SkRect r = { 20, 20, 100, 100 };
54 canvas->setDrawFilter(NULL); 54 canvas->setDrawFilter(NULL);
55 canvas->drawRect(r, p); 55 canvas->drawRect(r, p);
56 TestFilter redNoBlur; 56 TestFilter redNoBlur;
57 canvas->setDrawFilter(&redNoBlur); 57 canvas->setDrawFilter(&redNoBlur);
58 canvas->translate(120.0f, 40.0f); 58 canvas->translate(120.0f, 40.0f);
59 canvas->drawRect(r, p); 59 canvas->drawRect(r, p);
60 60
61 // Must unset if the DrawFilter is from the stack to avoid refcount erro rs! 61 // Must unset if the DrawFilter is from the stack to avoid refcount erro rs!
62 canvas->setDrawFilter(NULL); 62 canvas->setDrawFilter(NULL);
63 } 63 }
64 64
65 private: 65 private:
66 typedef GM INHERITED; 66 typedef GM INHERITED;
67 }; 67 };
68 68
69 static skiagm::GM* MyFactory(void*) { return new DrawFilterGM; } 69 static skiagm::GM* MyFactory(void*) { return new DrawFilterGM; }
70 static skiagm::GMRegistry reg(MyFactory); 70 static skiagm::GMRegistry reg(MyFactory);
71 71
OLDNEW
« no previous file with comments | « gm/drawbitmaprect.cpp ('k') | gm/drawlooper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698