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

Side by Side Diff: samplecode/SamplePathClip.cpp

Issue 2396953002: Revert[8] "replace SkXfermode obj with SkBlendMode enum in paints" (Closed)
Patch Set: add tmp virtual to unroll legacy arithmodes Created 4 years, 2 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/SampleLayers.cpp ('k') | samplecode/SampleQuadStroker.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 #include "SampleCode.h" 7 #include "SampleCode.h"
8 #include "SkView.h" 8 #include "SkView.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkGradientShader.h" 10 #include "SkGradientShader.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 canvas->drawPath(path, p); 218 canvas->drawPath(path, p);
219 canvas->restore(); 219 canvas->restore();
220 220
221 p.setStyle(SkPaint::kStroke_Style); 221 p.setStyle(SkPaint::kStroke_Style);
222 p.setStrokeWidth(6); 222 p.setStrokeWidth(6);
223 223
224 // Draw each of the "Edges" that survived the clipping 224 // Draw each of the "Edges" that survived the clipping
225 // We use a layer, so we can PLUS the different edge-colors, showing whe re two edges 225 // We use a layer, so we can PLUS the different edge-colors, showing whe re two edges
226 // canceled each other out. 226 // canceled each other out.
227 canvas->saveLayer(nullptr, nullptr); 227 canvas->saveLayer(nullptr, nullptr);
228 p.setXfermodeMode(SkXfermode::kPlus_Mode); 228 p.setBlendMode(SkBlendMode::kPlus);
229 for (int i = 0; i < N; ++i) { 229 for (int i = 0; i < N; ++i) {
230 const int j = (i + 1) % N; 230 const int j = (i + 1) % N;
231 p.setColor(fEdgeColor[i]); 231 p.setColor(fEdgeColor[i]);
232 draw_clipped_line(canvas, fClip, fPoly[i], fPoly[j], p); 232 draw_clipped_line(canvas, fClip, fPoly[i], fPoly[j], p);
233 } 233 }
234 canvas->restore(); 234 canvas->restore();
235 } 235 }
236 236
237 class MyClick : public Click { 237 class MyClick : public Click {
238 public: 238 public:
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 bool onClick(Click* click) override { 309 bool onClick(Click* click) override {
310 ((MyClick*)click)->handleMove(); 310 ((MyClick*)click)->handleMove();
311 this->inval(nullptr); 311 this->inval(nullptr);
312 return false; 312 return false;
313 } 313 }
314 314
315 private: 315 private:
316 typedef SampleView INHERITED; 316 typedef SampleView INHERITED;
317 }; 317 };
318 DEF_SAMPLE( return new EdgeClipView; ) 318 DEF_SAMPLE( return new EdgeClipView; )
OLDNEW
« no previous file with comments | « samplecode/SampleLayers.cpp ('k') | samplecode/SampleQuadStroker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698