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

Side by Side Diff: gm/convexpolyclip.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, 8 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/conicpaths.cpp ('k') | gm/convexpolyeffect.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 2014 Google Inc. 3 * Copyright 2014 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 8
9 #include "gm.h" 9 #include "gm.h"
10 10
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 /** 72 /**
73 * This GM tests convex polygon clips. 73 * This GM tests convex polygon clips.
74 */ 74 */
75 class ConvexPolyClip : public GM { 75 class ConvexPolyClip : public GM {
76 public: 76 public:
77 ConvexPolyClip() { 77 ConvexPolyClip() {
78 this->setBGColor(0xFFFFFFFF); 78 this->setBGColor(0xFFFFFFFF);
79 } 79 }
80 80
81 protected: 81 protected:
82 SkString onShortName() SK_OVERRIDE { 82 SkString onShortName() override {
83 return SkString("convex_poly_clip"); 83 return SkString("convex_poly_clip");
84 } 84 }
85 85
86 SkISize onISize() SK_OVERRIDE { 86 SkISize onISize() override {
87 // When benchmarking the saveLayer set of draws is skipped. 87 // When benchmarking the saveLayer set of draws is skipped.
88 int w = 435; 88 int w = 435;
89 if (kBench_Mode != this->getMode()) { 89 if (kBench_Mode != this->getMode()) {
90 w *= 2; 90 w *= 2;
91 } 91 }
92 return SkISize::Make(w, 540); 92 return SkISize::Make(w, 540);
93 } 93 }
94 94
95 void onOnceBeforeDraw() SK_OVERRIDE { 95 void onOnceBeforeDraw() override {
96 SkPath tri; 96 SkPath tri;
97 tri.moveTo(5.f, 5.f); 97 tri.moveTo(5.f, 5.f);
98 tri.lineTo(100.f, 20.f); 98 tri.lineTo(100.f, 20.f);
99 tri.lineTo(15.f, 100.f); 99 tri.lineTo(15.f, 100.f);
100 100
101 fClips.addToTail()->setPath(tri); 101 fClips.addToTail()->setPath(tri);
102 102
103 SkPath hexagon; 103 SkPath hexagon;
104 static const SkScalar kRadius = 45.f; 104 static const SkScalar kRadius = 45.f;
105 const SkPoint center = { kRadius, kRadius }; 105 const SkPoint center = { kRadius, kRadius };
(...skipping 22 matching lines...) Expand all
128 SkRect rect = SkRect::MakeLTRB(10.f, 12.f, 80.f, 86.f); 128 SkRect rect = SkRect::MakeLTRB(10.f, 12.f, 80.f, 86.f);
129 rotRect.addRect(rect); 129 rotRect.addRect(rect);
130 SkMatrix rotM; 130 SkMatrix rotM;
131 rotM.setRotate(23.f, rect.centerX(), rect.centerY()); 131 rotM.setRotate(23.f, rect.centerX(), rect.centerY());
132 rotRect.transform(rotM); 132 rotRect.transform(rotM);
133 fClips.addToTail()->setPath(rotRect); 133 fClips.addToTail()->setPath(rotRect);
134 134
135 fBmp = make_bmp(100, 100); 135 fBmp = make_bmp(100, 100);
136 } 136 }
137 137
138 void onDraw(SkCanvas* canvas) SK_OVERRIDE { 138 void onDraw(SkCanvas* canvas) override {
139 SkScalar y = 0; 139 SkScalar y = 0;
140 static const SkScalar kMargin = 10.f; 140 static const SkScalar kMargin = 10.f;
141 141
142 SkPaint bgPaint; 142 SkPaint bgPaint;
143 bgPaint.setAlpha(0x15); 143 bgPaint.setAlpha(0x15);
144 SkISize size = canvas->getDeviceSize(); 144 SkISize size = canvas->getDeviceSize();
145 SkRect dstRect = SkRect::MakeWH(SkIntToScalar(size.fWidth), 145 SkRect dstRect = SkRect::MakeWH(SkIntToScalar(size.fWidth),
146 SkIntToScalar(size.fHeight)); 146 SkIntToScalar(size.fHeight));
147 canvas->drawBitmapRectToRect(fBmp, NULL, dstRect, &bgPaint); 147 canvas->drawBitmapRectToRect(fBmp, NULL, dstRect, &bgPaint);
148 148
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 canvas->restore(); 207 canvas->restore();
208 x += textW + 2 * kMargin; 208 x += textW + 2 * kMargin;
209 } 209 }
210 y += fBmp.height() + kMargin; 210 y += fBmp.height() + kMargin;
211 } 211 }
212 y = 0; 212 y = 0;
213 startX += 2 * fBmp.width() + SkScalarCeilToInt(2 * textW) + 6 * kMar gin; 213 startX += 2 * fBmp.width() + SkScalarCeilToInt(2 * textW) + 6 * kMar gin;
214 } 214 }
215 } 215 }
216 216
217 bool runAsBench() const SK_OVERRIDE { return true; } 217 bool runAsBench() const override { return true; }
218 218
219 private: 219 private:
220 class Clip { 220 class Clip {
221 public: 221 public:
222 enum ClipType { 222 enum ClipType {
223 kNone_ClipType, 223 kNone_ClipType,
224 kPath_ClipType, 224 kPath_ClipType,
225 kRect_ClipType 225 kRect_ClipType
226 }; 226 };
227 227
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 292
293 SkTLList<Clip> fClips; 293 SkTLList<Clip> fClips;
294 SkBitmap fBmp; 294 SkBitmap fBmp;
295 295
296 typedef GM INHERITED; 296 typedef GM INHERITED;
297 }; 297 };
298 298
299 DEF_GM( return SkNEW(ConvexPolyClip); ) 299 DEF_GM( return SkNEW(ConvexPolyClip); )
300 300
301 } 301 }
OLDNEW
« no previous file with comments | « gm/conicpaths.cpp ('k') | gm/convexpolyeffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698