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

Side by Side Diff: samplecode/SampleClip.cpp

Issue 2355483002: abstract name of clipping ops, to transtion to a more restricted set (Closed)
Patch Set: no need for ifdef for globals Created 4 years, 3 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 | « samplecode/SampleApp.cpp ('k') | samplecode/SampleClipDrawMatch.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 2011 Google Inc. 2 * Copyright 2011 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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 SkPath clipPath; 136 SkPath clipPath;
137 r.inset(SK_Scalar1 / 4, SK_Scalar1 / 4); 137 r.inset(SK_Scalar1 / 4, SK_Scalar1 / 4);
138 clipPath.addRoundRect(r, SkIntToScalar(20), SkIntToScalar(20)); 138 clipPath.addRoundRect(r, SkIntToScalar(20), SkIntToScalar(20));
139 139
140 // clipPath.toggleInverseFillType(); 140 // clipPath.toggleInverseFillType();
141 141
142 for (int aa = 0; aa <= 1; ++aa) { 142 for (int aa = 0; aa <= 1; ++aa) {
143 canvas->save(); 143 canvas->save();
144 for (size_t i = 0; i < SK_ARRAY_COUNT(gProc); ++i) { 144 for (size_t i = 0; i < SK_ARRAY_COUNT(gProc); ++i) {
145 canvas->save(); 145 canvas->save();
146 canvas->clipPath(clipPath, SkRegion::kIntersect_Op, SkToBool(aa) ); 146 canvas->clipPath(clipPath, SkCanvas::kIntersect_Op, SkToBool(aa) );
147 // canvas->drawColor(SK_ColorWHITE); 147 // canvas->drawColor(SK_ColorWHITE);
148 gProc[i](canvas, SkToBool(aa)); 148 gProc[i](canvas, SkToBool(aa));
149 canvas->restore(); 149 canvas->restore();
150 canvas->translate(W * SK_Scalar1 * 8 / 7, 0); 150 canvas->translate(W * SK_Scalar1 * 8 / 7, 0);
151 } 151 }
152 canvas->restore(); 152 canvas->restore();
153 canvas->translate(0, H * SK_Scalar1 * 8 / 7); 153 canvas->translate(0, H * SK_Scalar1 * 8 / 7);
154 } 154 }
155 } 155 }
156 156
157 private: 157 private:
158 typedef SampleView INHERITED; 158 typedef SampleView INHERITED;
159 }; 159 };
160 160
161 ////////////////////////////////////////////////////////////////////////////// 161 //////////////////////////////////////////////////////////////////////////////
162 162
163 static SkView* MyFactory() { return new ClipView; } 163 static SkView* MyFactory() { return new ClipView; }
164 static SkViewRegister reg(MyFactory); 164 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | samplecode/SampleClipDrawMatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698