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

Side by Side Diff: gm/circularclips.cpp

Issue 1110173002: Do circular clipping in normalized space (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix comments Created 5 years, 7 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 | « no previous file | src/gpu/effects/GrOvalEffect.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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 SkRegion::kUnion_Op, 42 SkRegion::kUnion_Op,
43 SkRegion::kXOR_Op, 43 SkRegion::kXOR_Op,
44 SkRegion::kReverseDifference_Op, 44 SkRegion::kReverseDifference_Op,
45 SkRegion::kReplace_Op, 45 SkRegion::kReplace_Op,
46 }; 46 };
47 47
48 SkRect rect = SkRect::MakeLTRB(fX1 - fR, fY - fR, fX2 + fR, fY + fR); 48 SkRect rect = SkRect::MakeLTRB(fX1 - fR, fY - fR, fX2 + fR, fY + fR);
49 49
50 SkPaint fillPaint; 50 SkPaint fillPaint;
51 51
52 // Giant background circular clips (AA, non-inverted, replace/isect)
53 fillPaint.setColor(0x80808080);
54 canvas->save();
55 canvas->scale(10, 10);
56 canvas->translate(-((fX1 + fX2)/2 - fR), -(fY - 2*fR/3));
57 canvas->clipPath(fCircle1, SkRegion::kReplace_Op, true);
58 canvas->clipPath(fCircle2, SkRegion::kIntersect_Op, true);
59
60 canvas->drawRect(rect, fillPaint);
61
62 canvas->restore();
63
64 fillPaint.setColor(0xFF000000);
65
52 for (size_t i = 0; i < 4; i++) { 66 for (size_t i = 0; i < 4; i++) {
53 fCircle1.toggleInverseFillType(); 67 fCircle1.toggleInverseFillType();
54 if (i % 2 == 0) { 68 if (i % 2 == 0) {
55 fCircle2.toggleInverseFillType(); 69 fCircle2.toggleInverseFillType();
56 } 70 }
57 71
58 canvas->save(); 72 canvas->save();
59 for (size_t op = 0; op < SK_ARRAY_COUNT(ops); op++) { 73 for (size_t op = 0; op < SK_ARRAY_COUNT(ops); op++) {
60 canvas->save(); 74 canvas->save();
61 75
(...skipping 10 matching lines...) Expand all
72 } 86 }
73 } 87 }
74 88
75 private: 89 private:
76 typedef skiagm::GM INHERITED; 90 typedef skiagm::GM INHERITED;
77 }; 91 };
78 92
79 ////////////////////////////////////////////////////////////////////////////// 93 //////////////////////////////////////////////////////////////////////////////
80 94
81 DEF_GM( return new CircularClipsGM; ) 95 DEF_GM( return new CircularClipsGM; )
OLDNEW
« no previous file with comments | « no previous file | src/gpu/effects/GrOvalEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698