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

Side by Side Diff: gm/shadows.cpp

Issue 1232463006: Fix up -Winconsistent-missing-override (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: llvm_coverage_build Created 5 years, 5 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/dcshader.cpp ('k') | gm/simpleaaclip.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 "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkBlurDrawLooper.h" 10 #include "SkBlurDrawLooper.h"
(...skipping 18 matching lines...) Expand all
29 SkRect fRect; 29 SkRect fRect;
30 30
31 protected: 31 protected:
32 void onOnceBeforeDraw() override { 32 void onOnceBeforeDraw() override {
33 this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); 33 this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD));
34 fCirclePath.addCircle(SkIntToScalar(20), SkIntToScalar(20), SkIntToScala r(10) ); 34 fCirclePath.addCircle(SkIntToScalar(20), SkIntToScalar(20), SkIntToScala r(10) );
35 fRect.set(SkIntToScalar(10), SkIntToScalar(10), 35 fRect.set(SkIntToScalar(10), SkIntToScalar(10),
36 SkIntToScalar(30), SkIntToScalar(30)); 36 SkIntToScalar(30), SkIntToScalar(30));
37 } 37 }
38 38
39 virtual SkString onShortName() { 39 SkString onShortName() override {
40 return SkString("shadows"); 40 return SkString("shadows");
41 } 41 }
42 42
43 virtual SkISize onISize() { 43 SkISize onISize() override {
44 return SkISize::Make(200, 120); 44 return SkISize::Make(200, 120);
45 } 45 }
46 46
47 virtual void onDraw(SkCanvas* canvas) { 47 void onDraw(SkCanvas* canvas) override {
48 SkBlurDrawLooper* shadowLoopers[5]; 48 SkBlurDrawLooper* shadowLoopers[5];
49 shadowLoopers[0] = 49 shadowLoopers[0] =
50 SkBlurDrawLooper::Create(SK_ColorBLUE, 50 SkBlurDrawLooper::Create(SK_ColorBLUE,
51 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar( 10)), 51 SkBlurMask::ConvertRadiusToSigma(SkIntToSca lar(10)),
52 SkIntToScalar(5), SkIntToScalar(10), 52 SkIntToScalar(5), SkIntToScalar(10),
53 SkBlurDrawLooper::kIgnoreTransform_BlurFlag | 53 SkBlurDrawLooper::kIgnoreTransform_BlurFlag |
54 SkBlurDrawLooper::kOverrideColor_BlurFlag | 54 SkBlurDrawLooper::kOverrideColor_BlurFlag |
55 SkBlurDrawLooper::kHighQuality_BlurFlag); 55 SkBlurDrawLooper::kHighQuality_BlurFlag);
56 SkAutoUnref aurL0(shadowLoopers[0]); 56 SkAutoUnref aurL0(shadowLoopers[0]);
57 shadowLoopers[1] = 57 shadowLoopers[1] =
58 SkBlurDrawLooper::Create(SK_ColorBLUE, 58 SkBlurDrawLooper::Create(SK_ColorBLUE,
59 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar( 10)), 59 SkBlurMask::ConvertRadiusToSigma(SkIntToSca lar(10)),
60 SkIntToScalar(5), SkIntToScalar(10), 60 SkIntToScalar(5), SkIntToScalar(10),
61 SkBlurDrawLooper::kIgnoreTransform_BlurFlag | 61 SkBlurDrawLooper::kIgnoreTransform_BlurFlag |
62 SkBlurDrawLooper::kOverrideColor_BlurFlag); 62 SkBlurDrawLooper::kOverrideColor_BlurFlag);
63 SkAutoUnref aurL1(shadowLoopers[1]); 63 SkAutoUnref aurL1(shadowLoopers[1]);
64 shadowLoopers[2] = 64 shadowLoopers[2] =
65 SkBlurDrawLooper::Create(SK_ColorBLACK, 65 SkBlurDrawLooper::Create(SK_ColorBLACK,
66 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar( 5)), 66 SkBlurMask::ConvertRadiusToSigma(SkIntToSca lar(5)),
67 SkIntToScalar(5), 67 SkIntToScalar(5),
68 SkIntToScalar(10), 68 SkIntToScalar(10),
69 SkBlurDrawLooper::kIgnoreTransform_BlurFlag | 69 SkBlurDrawLooper::kIgnoreTransform_BlurFlag |
70 SkBlurDrawLooper::kHighQuality_BlurFlag); 70 SkBlurDrawLooper::kHighQuality_BlurFlag);
71 SkAutoUnref aurL2(shadowLoopers[2]); 71 SkAutoUnref aurL2(shadowLoopers[2]);
72 shadowLoopers[3] = 72 shadowLoopers[3] =
73 SkBlurDrawLooper::Create(0x7FFF0000, 73 SkBlurDrawLooper::Create(0x7FFF0000,
74 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar( 5)), 74 SkBlurMask::ConvertRadiusToSigma(SkIntToSca lar(5)),
75 SkIntToScalar(-5), SkIntToScalar(-10), 75 SkIntToScalar(-5), SkIntToScalar(-10),
76 SkBlurDrawLooper::kIgnoreTransform_BlurFlag | 76 SkBlurDrawLooper::kIgnoreTransform_BlurFlag |
77 SkBlurDrawLooper::kOverrideColor_BlurFlag | 77 SkBlurDrawLooper::kOverrideColor_BlurFlag |
78 SkBlurDrawLooper::kHighQuality_BlurFlag); 78 SkBlurDrawLooper::kHighQuality_BlurFlag);
79 SkAutoUnref aurL3(shadowLoopers[3]); 79 SkAutoUnref aurL3(shadowLoopers[3]);
80 shadowLoopers[4] = 80 shadowLoopers[4] =
81 SkBlurDrawLooper::Create(SK_ColorBLACK, SkIntToScalar(0), 81 SkBlurDrawLooper::Create(SK_ColorBLACK, SkIntToScalar(0),
82 SkIntToScalar(5), SkIntToScalar(5), 82 SkIntToScalar(5), SkIntToScalar(5),
83 SkBlurDrawLooper::kIgnoreTransform_BlurFlag | 83 SkBlurDrawLooper::kIgnoreTransform_BlurFlag |
84 SkBlurDrawLooper::kOverrideColor_BlurFlag | 84 SkBlurDrawLooper::kOverrideColor_BlurFlag |
85 SkBlurDrawLooper::kHighQuality_BlurFlag); 85 SkBlurDrawLooper::kHighQuality_BlurFlag);
86 SkAutoUnref aurL4(shadowLoopers[4]); 86 SkAutoUnref aurL4(shadowLoopers[4]);
87 87
88 static const struct { 88 static const struct {
89 SkColor fColor; 89 SkColor fColor;
90 SkScalar fStrokeWidth; 90 SkScalar fStrokeWidth;
91 } gRec[] = { 91 } gRec[] = {
92 { SK_ColorRED, -SK_Scalar1 }, 92 { SK_ColorRED, -SK_Scalar1 },
93 { SK_ColorGREEN, SkIntToScalar(4) }, 93 { SK_ColorGREEN, SkIntToScalar(4) },
94 { SK_ColorBLUE, SkIntToScalar(0)}, 94 { SK_ColorBLUE, SkIntToScalar(0)},
95 }; 95 };
96 96
97 SkPaint paint; 97 SkPaint paint;
98 paint.setAntiAlias(true); 98 paint.setAntiAlias(true);
99 for (size_t i = 0; i < SK_ARRAY_COUNT(shadowLoopers); ++i) { 99 for (size_t i = 0; i < SK_ARRAY_COUNT(shadowLoopers); ++i) {
100 SkAutoCanvasRestore acr(canvas, true); 100 SkAutoCanvasRestore acr(canvas, true);
101 101
102 paint.setLooper(shadowLoopers[i]); 102 paint.setLooper(shadowLoopers[i]);
103 103
104 canvas->translate(SkIntToScalar((unsigned int)i*40), SkIntToScalar(0)); 104 canvas->translate(SkIntToScalar((unsigned int)i*40), SkIntToScalar(0 ));
105 setup(&paint, gRec[0].fColor, gRec[0].fStrokeWidth); 105 setup(&paint, gRec[0].fColor, gRec[0].fStrokeWidth);
106 canvas->drawRect(fRect, paint); 106 canvas->drawRect(fRect, paint);
107 107
108 canvas->translate(SkIntToScalar(0), SkIntToScalar(40)); 108 canvas->translate(SkIntToScalar(0), SkIntToScalar(40));
109 setup(&paint, gRec[1].fColor, gRec[1].fStrokeWidth); 109 setup(&paint, gRec[1].fColor, gRec[1].fStrokeWidth);
110 canvas->drawPath(fCirclePath, paint); 110 canvas->drawPath(fCirclePath, paint);
111 111
112 canvas->translate(SkIntToScalar(0), SkIntToScalar(40)); 112 canvas->translate(SkIntToScalar(0), SkIntToScalar(40));
113 setup(&paint, gRec[2].fColor, gRec[2].fStrokeWidth); 113 setup(&paint, gRec[2].fColor, gRec[2].fStrokeWidth);
114 canvas->drawPath(fCirclePath, paint); 114 canvas->drawPath(fCirclePath, paint);
115 }
115 } 116 }
116 }
117 117
118 private: 118 private:
119 typedef GM INHERITED; 119 typedef GM INHERITED;
120 }; 120 };
121 121
122 /////////////////////////////////////////////////////////////////////////////// 122 ///////////////////////////////////////////////////////////////////////////////
123 123
124 static GM* MyFactory(void*) { return new ShadowsGM; } 124 static GM* MyFactory(void*) { return new ShadowsGM; }
125 static GMRegistry reg(MyFactory); 125 static GMRegistry reg(MyFactory);
126 126
127 } 127 }
OLDNEW
« no previous file with comments | « gm/dcshader.cpp ('k') | gm/simpleaaclip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698