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

Side by Side Diff: gm/pathopsinverse.cpp

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 11 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/pathinterior.cpp ('k') | gm/pathopsskpclip.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 2013 Google Inc. 2 * Copyright 2013 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 "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
11 #include "SkPathOps.h" 11 #include "SkPathOps.h"
12 #include "SkRect.h" 12 #include "SkRect.h"
13 13
14 namespace skiagm { 14 namespace skiagm {
15 15
16 class PathOpsInverseGM : public GM { 16 class PathOpsInverseGM : public GM {
17 public: 17 public:
18 PathOpsInverseGM() { 18 PathOpsInverseGM() {
19 } 19 }
20 20
21 protected: 21 protected:
22 virtual void onOnceBeforeDraw() SK_OVERRIDE { 22 void onOnceBeforeDraw() SK_OVERRIDE {
23 const unsigned oneColor = 0xFF8080FF; 23 const unsigned oneColor = 0xFF8080FF;
24 const unsigned twoColor = 0x807F1f1f; 24 const unsigned twoColor = 0x807F1f1f;
25 SkColor blendColor = blend(oneColor, twoColor); 25 SkColor blendColor = blend(oneColor, twoColor);
26 makePaint(&fOnePaint, oneColor); 26 makePaint(&fOnePaint, oneColor);
27 makePaint(&fTwoPaint, twoColor); 27 makePaint(&fTwoPaint, twoColor);
28 makePaint(&fOpPaint[kDifference_PathOp], oneColor); 28 makePaint(&fOpPaint[kDifference_PathOp], oneColor);
29 makePaint(&fOpPaint[kIntersect_PathOp], blendColor); 29 makePaint(&fOpPaint[kIntersect_PathOp], blendColor);
30 makePaint(&fOpPaint[kUnion_PathOp], 0xFFc0FFc0); 30 makePaint(&fOpPaint[kUnion_PathOp], 0xFFc0FFc0);
31 makePaint(&fOpPaint[kReverseDifference_PathOp], twoColor); 31 makePaint(&fOpPaint[kReverseDifference_PathOp], twoColor);
32 makePaint(&fOpPaint[kXOR_PathOp], 0xFFa0FFe0); 32 makePaint(&fOpPaint[kXOR_PathOp], 0xFFa0FFe0);
(...skipping 10 matching lines...) Expand all
43 void* pixels = temp.getPixels(); 43 void* pixels = temp.getPixels();
44 return *(SkColor*) pixels; 44 return *(SkColor*) pixels;
45 } 45 }
46 46
47 void makePaint(SkPaint* paint, SkColor color) { 47 void makePaint(SkPaint* paint, SkColor color) {
48 paint->setAntiAlias(true); 48 paint->setAntiAlias(true);
49 paint->setStyle(SkPaint::kFill_Style); 49 paint->setStyle(SkPaint::kFill_Style);
50 paint->setColor(color); 50 paint->setColor(color);
51 } 51 }
52 52
53 virtual SkString onShortName() SK_OVERRIDE { 53 SkString onShortName() SK_OVERRIDE {
54 return SkString("pathopsinverse"); 54 return SkString("pathopsinverse");
55 } 55 }
56 56
57 virtual SkISize onISize() SK_OVERRIDE { 57 SkISize onISize() SK_OVERRIDE {
58 return SkISize::Make(1200, 900); 58 return SkISize::Make(1200, 900);
59 } 59 }
60 60
61 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 61 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
62 SkPath one, two; 62 SkPath one, two;
63 int yPos = 0; 63 int yPos = 0;
64 for (int oneFill = 0; oneFill <= 1; ++oneFill) { 64 for (int oneFill = 0; oneFill <= 1; ++oneFill) {
65 SkPath::FillType oneF = oneFill ? SkPath::kInverseEvenOdd_FillType 65 SkPath::FillType oneF = oneFill ? SkPath::kInverseEvenOdd_FillType
66 : SkPath::kEvenOdd_FillType; 66 : SkPath::kEvenOdd_FillType;
67 for (int twoFill = 0; twoFill <= 1; ++twoFill) { 67 for (int twoFill = 0; twoFill <= 1; ++twoFill) {
68 SkPath::FillType twoF = twoFill ? SkPath::kInverseEvenOdd_FillTy pe 68 SkPath::FillType twoF = twoFill ? SkPath::kInverseEvenOdd_FillTy pe
69 : SkPath::kEvenOdd_FillType; 69 : SkPath::kEvenOdd_FillType;
70 one.reset(); 70 one.reset();
71 one.setFillType(oneF); 71 one.setFillType(oneF);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 SkPaint fOpPaint[kReverseDifference_PathOp - kDifference_PathOp + 1]; 105 SkPaint fOpPaint[kReverseDifference_PathOp - kDifference_PathOp + 1];
106 typedef GM INHERITED; 106 typedef GM INHERITED;
107 }; 107 };
108 108
109 ////////////////////////////////////////////////////////////////////////////// 109 //////////////////////////////////////////////////////////////////////////////
110 110
111 static GM* MyFactory(void*) { return new PathOpsInverseGM; } 111 static GM* MyFactory(void*) { return new PathOpsInverseGM; }
112 static GMRegistry reg(MyFactory); 112 static GMRegistry reg(MyFactory);
113 113
114 } 114 }
OLDNEW
« no previous file with comments | « gm/pathinterior.cpp ('k') | gm/pathopsskpclip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698