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

Side by Side Diff: gm/clipdrawdraw.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/clip_strokerect.cpp ('k') | gm/cmykjpeg.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 2014 Google Inc. 2 * Copyright 2014 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 9
10 namespace skiagm { 10 namespace skiagm {
11 11
12 // This GM exercises the use case found in crbug.com/423834. 12 // This GM exercises the use case found in crbug.com/423834.
13 // The following pattern: 13 // The following pattern:
14 // save(); 14 // save();
15 // clipRect(rect, noAA); 15 // clipRect(rect, noAA);
16 // drawRect(bigRect, noAA); 16 // drawRect(bigRect, noAA);
17 // restore(); 17 // restore();
18 // 18 //
19 // drawRect(rect, noAA); 19 // drawRect(rect, noAA);
20 // can leave 1 pixel wide remnants of the first rect. 20 // can leave 1 pixel wide remnants of the first rect.
21 class ClipDrawDrawGM : public GM { 21 class ClipDrawDrawGM : public GM {
22 public: 22 public:
23 ClipDrawDrawGM() { this->setBGColor(0xFFCCCCCC); } 23 ClipDrawDrawGM() { this->setBGColor(0xFFCCCCCC); }
24 24
25 protected: 25 protected:
26 SkString onShortName() SK_OVERRIDE { return SkString("clipdrawdraw"); } 26 SkString onShortName() override { return SkString("clipdrawdraw"); }
27 27
28 SkISize onISize() SK_OVERRIDE { return SkISize::Make(512, 512); } 28 SkISize onISize() override { return SkISize::Make(512, 512); }
29 29
30 static void Draw(SkCanvas* canvas, const SkRect& rect) { 30 static void Draw(SkCanvas* canvas, const SkRect& rect) {
31 SkPaint p; 31 SkPaint p;
32 p.setAntiAlias(false); 32 p.setAntiAlias(false);
33 33
34 const SkRect bigRect = SkRect::MakeWH(600, 600); 34 const SkRect bigRect = SkRect::MakeWH(600, 600);
35 35
36 canvas->save(); 36 canvas->save();
37 // draw a black rect through the clip 37 // draw a black rect through the clip
38 canvas->save(); 38 canvas->save();
39 canvas->clipRect(rect); 39 canvas->clipRect(rect);
40 canvas->drawRect(bigRect, p); 40 canvas->drawRect(bigRect, p);
41 canvas->restore(); 41 canvas->restore();
42 42
43 // now draw the white rect on top 43 // now draw the white rect on top
44 p.setColor(SK_ColorWHITE); 44 p.setColor(SK_ColorWHITE);
45 canvas->drawRect(rect, p); 45 canvas->drawRect(rect, p);
46 canvas->restore(); 46 canvas->restore();
47 } 47 }
48 48
49 void onDraw(SkCanvas* canvas) SK_OVERRIDE { 49 void onDraw(SkCanvas* canvas) override {
50 // Vertical remnant 50 // Vertical remnant
51 const SkRect rect1 = SkRect::MakeLTRB(136.5f, 137.5f, 338.5f, 293.5f); 51 const SkRect rect1 = SkRect::MakeLTRB(136.5f, 137.5f, 338.5f, 293.5f);
52 52
53 // Horizontal remnant 53 // Horizontal remnant
54 // 179.488 rounds the right way (i.e., 179), 179.499 rounds the wrong wa y (i.e., 180) 54 // 179.488 rounds the right way (i.e., 179), 179.499 rounds the wrong wa y (i.e., 180)
55 const SkRect rect2 = SkRect::MakeLTRB(207.5f, 179.499f, 530.5f, 429.5f); 55 const SkRect rect2 = SkRect::MakeLTRB(207.5f, 179.499f, 530.5f, 429.5f);
56 56
57 Draw(canvas, rect1); 57 Draw(canvas, rect1);
58 Draw(canvas, rect2); 58 Draw(canvas, rect2);
59 } 59 }
60 60
61 private: 61 private:
62 typedef GM INHERITED; 62 typedef GM INHERITED;
63 }; 63 };
64 64
65 ////////////////////////////////////////////////////////////////////////////// 65 //////////////////////////////////////////////////////////////////////////////
66 66
67 DEF_GM(return SkNEW(ClipDrawDrawGM);) 67 DEF_GM(return SkNEW(ClipDrawDrawGM);)
68 68
69 } 69 }
OLDNEW
« no previous file with comments | « gm/clip_strokerect.cpp ('k') | gm/cmykjpeg.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698