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

Side by Side Diff: samplecode/ClockFaceView.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 | « include/xml/SkXMLWriter.h ('k') | samplecode/GMSampleView.h » ('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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 14 matching lines...) Expand all
25 unsigned b = SkGetPackedB32(c); 25 unsigned b = SkGetPackedB32(c);
26 26
27 unsigned x = (r * 5 + g * 7 + b * 4) >> 4; 27 unsigned x = (r * 5 + g * 7 + b * 4) >> 4;
28 28
29 return SkPackARGB32(0, x, x, x) | (c & (SK_A32_MASK << SK_A32_SHIFT)); 29 return SkPackARGB32(0, x, x, x) | (c & (SK_A32_MASK << SK_A32_SHIFT));
30 } 30 }
31 31
32 class SkGrayScaleColorFilter : public SkColorFilter { 32 class SkGrayScaleColorFilter : public SkColorFilter {
33 public: 33 public:
34 virtual void filterSpan(const SkPMColor src[], int count, 34 virtual void filterSpan(const SkPMColor src[], int count,
35 SkPMColor result[]) const SK_OVERRIDE { 35 SkPMColor result[]) const override {
36 for (int i = 0; i < count; i++) { 36 for (int i = 0; i < count; i++) {
37 result[i] = rgb2gray(src[i]); 37 result[i] = rgb2gray(src[i]);
38 } 38 }
39 } 39 }
40 }; 40 };
41 41
42 class SkChannelMaskColorFilter : public SkColorFilter { 42 class SkChannelMaskColorFilter : public SkColorFilter {
43 public: 43 public:
44 SkChannelMaskColorFilter(U8CPU redMask, U8CPU greenMask, U8CPU blueMask) { 44 SkChannelMaskColorFilter(U8CPU redMask, U8CPU greenMask, U8CPU blueMask) {
45 fMask = SkPackARGB32(0xFF, redMask, greenMask, blueMask); 45 fMask = SkPackARGB32(0xFF, redMask, greenMask, blueMask);
46 } 46 }
47 47
48 virtual void filterSpan(const SkPMColor src[], int count, 48 virtual void filterSpan(const SkPMColor src[], int count,
49 SkPMColor result[]) const SK_OVERRIDE { 49 SkPMColor result[]) const override {
50 SkPMColor mask = fMask; 50 SkPMColor mask = fMask;
51 for (int i = 0; i < count; i++) { 51 for (int i = 0; i < count; i++) {
52 result[i] = src[i] & mask; 52 result[i] = src[i] & mask;
53 } 53 }
54 } 54 }
55 55
56 private: 56 private:
57 SkPMColor fMask; 57 SkPMColor fMask;
58 }; 58 };
59 59
60 /////////////////////////////////////////////////////////////////////////////// 60 ///////////////////////////////////////////////////////////////////////////////
61 61
62 #include "SkGradientShader.h" 62 #include "SkGradientShader.h"
63 #include "SkLayerRasterizer.h" 63 #include "SkLayerRasterizer.h"
64 #include "SkBlurMaskFilter.h" 64 #include "SkBlurMaskFilter.h"
65 65
66 #include "Sk2DPathEffect.h" 66 #include "Sk2DPathEffect.h"
67 67
68 class Dot2DPathEffect : public Sk2DPathEffect { 68 class Dot2DPathEffect : public Sk2DPathEffect {
69 public: 69 public:
70 Dot2DPathEffect(SkScalar radius, const SkMatrix& matrix, 70 Dot2DPathEffect(SkScalar radius, const SkMatrix& matrix,
71 SkTDArray<SkPoint>* pts) 71 SkTDArray<SkPoint>* pts)
72 : Sk2DPathEffect(matrix), fRadius(radius), fPts(pts) {} 72 : Sk2DPathEffect(matrix), fRadius(radius), fPts(pts) {}
73 73
74 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Dot2DPathEffect) 74 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Dot2DPathEffect)
75 75
76 protected: 76 protected:
77 void begin(const SkIRect& uvBounds, SkPath* dst) const SK_OVERRIDE { 77 void begin(const SkIRect& uvBounds, SkPath* dst) const override {
78 if (fPts) { 78 if (fPts) {
79 fPts->reset(); 79 fPts->reset();
80 } 80 }
81 this->INHERITED::begin(uvBounds, dst); 81 this->INHERITED::begin(uvBounds, dst);
82 } 82 }
83 83
84 virtual void next(const SkPoint& loc, int u, int v, 84 virtual void next(const SkPoint& loc, int u, int v,
85 SkPath* dst) const SK_OVERRIDE { 85 SkPath* dst) const override {
86 if (fPts) { 86 if (fPts) {
87 *fPts->append() = loc; 87 *fPts->append() = loc;
88 } 88 }
89 dst->addCircle(loc.fX, loc.fY, fRadius); 89 dst->addCircle(loc.fX, loc.fY, fRadius);
90 } 90 }
91 91
92 void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE { 92 void flatten(SkWriteBuffer& buffer) const override {
93 buffer.writeMatrix(this->getMatrix()); 93 buffer.writeMatrix(this->getMatrix());
94 buffer.writeScalar(fRadius); 94 buffer.writeScalar(fRadius);
95 } 95 }
96 96
97 private: 97 private:
98 SkScalar fRadius; 98 SkScalar fRadius;
99 SkTDArray<SkPoint>* fPts; 99 SkTDArray<SkPoint>* fPts;
100 100
101 typedef Sk2DPathEffect INHERITED; 101 typedef Sk2DPathEffect INHERITED;
102 }; 102 };
103 103
104 SkFlattenable* Dot2DPathEffect::CreateProc(SkReadBuffer& buffer) { 104 SkFlattenable* Dot2DPathEffect::CreateProc(SkReadBuffer& buffer) {
105 SkMatrix matrix; 105 SkMatrix matrix;
106 buffer.readMatrix(&matrix); 106 buffer.readMatrix(&matrix);
107 return SkNEW_ARGS(Dot2DPathEffect, (buffer.readScalar(), matrix, NULL)); 107 return SkNEW_ARGS(Dot2DPathEffect, (buffer.readScalar(), matrix, NULL));
108 } 108 }
109 109
110 class InverseFillPE : public SkPathEffect { 110 class InverseFillPE : public SkPathEffect {
111 public: 111 public:
112 InverseFillPE() {} 112 InverseFillPE() {}
113 virtual bool filterPath(SkPath* dst, const SkPath& src, 113 virtual bool filterPath(SkPath* dst, const SkPath& src,
114 SkStrokeRec*, const SkRect*) const SK_OVERRIDE { 114 SkStrokeRec*, const SkRect*) const override {
115 *dst = src; 115 *dst = src;
116 dst->setFillType(SkPath::kInverseWinding_FillType); 116 dst->setFillType(SkPath::kInverseWinding_FillType);
117 return true; 117 return true;
118 } 118 }
119 119
120 #ifndef SK_IGNORE_TO_STRING 120 #ifndef SK_IGNORE_TO_STRING
121 void toString(SkString* str) const SK_OVERRIDE { 121 void toString(SkString* str) const override {
122 str->appendf("InverseFillPE: ()"); 122 str->appendf("InverseFillPE: ()");
123 } 123 }
124 #endif 124 #endif
125 125
126 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(InverseFillPE) 126 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(InverseFillPE)
127 127
128 private: 128 private:
129 typedef SkPathEffect INHERITED; 129 typedef SkPathEffect INHERITED;
130 }; 130 };
131 131
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 } 252 }
253 253
254 private: 254 private:
255 typedef SkView INHERITED; 255 typedef SkView INHERITED;
256 }; 256 };
257 257
258 ////////////////////////////////////////////////////////////////////////////// 258 //////////////////////////////////////////////////////////////////////////////
259 259
260 static SkView* MyFactory() { return new ClockFaceView; } 260 static SkView* MyFactory() { return new ClockFaceView; }
261 static SkViewRegister reg(MyFactory); 261 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « include/xml/SkXMLWriter.h ('k') | samplecode/GMSampleView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698