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

Side by Side Diff: src/utils/SkDeferredCanvas.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 | « src/utils/SkDeferredCanvas.h ('k') | src/utils/SkDumpCanvas.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 2016 Google Inc. 2 * Copyright 2016 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 "SkDeferredCanvas.h" 8 #include "SkDeferredCanvas.h"
9 #include "SkDrawable.h" 9 #include "SkDrawable.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 void SkDeferredCanvas::emit(const Rec& rec) { 93 void SkDeferredCanvas::emit(const Rec& rec) {
94 switch (rec.fType) { 94 switch (rec.fType) {
95 case kSave_Type: 95 case kSave_Type:
96 fCanvas->save(); 96 fCanvas->save();
97 this->INHERITED::willSave(); 97 this->INHERITED::willSave();
98 break; 98 break;
99 case kClipRect_Type: 99 case kClipRect_Type:
100 fCanvas->clipRect(rec.fData.fBounds); 100 fCanvas->clipRect(rec.fData.fBounds);
101 this->INHERITED::onClipRect(rec.fData.fBounds, 101 this->INHERITED::onClipRect(rec.fData.fBounds,
102 SkRegion::kIntersect_Op, kHard_ClipEdgeS tyle); 102 kIntersect_Op, kHard_ClipEdgeStyle);
103 break; 103 break;
104 case kTrans_Type: 104 case kTrans_Type:
105 case kScaleTrans_Type: { 105 case kScaleTrans_Type: {
106 SkMatrix mat; 106 SkMatrix mat;
107 rec.getConcat(&mat); 107 rec.getConcat(&mat);
108 fCanvas->concat(mat); 108 fCanvas->concat(mat);
109 this->INHERITED::didConcat(mat); 109 this->INHERITED::didConcat(mat);
110 } break; 110 } break;
111 } 111 }
112 } 112 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 this->INHERITED::didConcat(matrix); 265 this->INHERITED::didConcat(matrix);
266 } 266 }
267 } 267 }
268 268
269 void SkDeferredCanvas::didSetMatrix(const SkMatrix& matrix) { 269 void SkDeferredCanvas::didSetMatrix(const SkMatrix& matrix) {
270 this->flush_all(); 270 this->flush_all();
271 fCanvas->setMatrix(matrix); 271 fCanvas->setMatrix(matrix);
272 this->INHERITED::didSetMatrix(matrix); 272 this->INHERITED::didSetMatrix(matrix);
273 } 273 }
274 274
275 void SkDeferredCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeS tyle edgeStyle) { 275 void SkDeferredCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle e dgeStyle) {
276 if (SkRegion::kIntersect_Op == op) { 276 if (kIntersect_Op == op) {
277 this->push_cliprect(rect); 277 this->push_cliprect(rect);
278 } else { 278 } else {
279 this->flush_all(); 279 this->flush_all();
280 fCanvas->clipRect(rect, op, kSoft_ClipEdgeStyle == edgeStyle); 280 fCanvas->clipRect(rect, op, kSoft_ClipEdgeStyle == edgeStyle);
281 this->INHERITED::onClipRect(rect, op, edgeStyle); 281 this->INHERITED::onClipRect(rect, op, edgeStyle);
282 } 282 }
283 } 283 }
284 284
285 void SkDeferredCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEd geStyle edgeStyle) { 285 void SkDeferredCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyl e edgeStyle) {
286 this->flush_all(); 286 this->flush_all();
287 fCanvas->clipRRect(rrect, op, kSoft_ClipEdgeStyle == edgeStyle); 287 fCanvas->clipRRect(rrect, op, kSoft_ClipEdgeStyle == edgeStyle);
288 this->INHERITED::onClipRRect(rrect, op, edgeStyle); 288 this->INHERITED::onClipRRect(rrect, op, edgeStyle);
289 } 289 }
290 290
291 void SkDeferredCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeS tyle edgeStyle) { 291 void SkDeferredCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle e dgeStyle) {
292 this->flush_all(); 292 this->flush_all();
293 fCanvas->clipPath(path, op, kSoft_ClipEdgeStyle == edgeStyle); 293 fCanvas->clipPath(path, op, kSoft_ClipEdgeStyle == edgeStyle);
294 this->INHERITED::onClipPath(path, op, edgeStyle); 294 this->INHERITED::onClipPath(path, op, edgeStyle);
295 } 295 }
296 296
297 void SkDeferredCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { 297 void SkDeferredCanvas::onClipRegion(const SkRegion& deviceRgn, ClipOp op) {
298 this->flush_all(); 298 this->flush_all();
299 fCanvas->clipRegion(deviceRgn, op); 299 fCanvas->clipRegion(deviceRgn, op);
300 this->INHERITED::onClipRegion(deviceRgn, op); 300 this->INHERITED::onClipRegion(deviceRgn, op);
301 } 301 }
302 302
303 void SkDeferredCanvas::onDrawPaint(const SkPaint& paint) { 303 void SkDeferredCanvas::onDrawPaint(const SkPaint& paint) {
304 // TODO: Can we turn this into drawRect? 304 // TODO: Can we turn this into drawRect?
305 this->flush_all(); 305 this->flush_all();
306 fCanvas->drawPaint(paint); 306 fCanvas->drawPaint(paint);
307 } 307 }
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 return true; 543 return true;
544 } 544 }
545 return false; 545 return false;
546 } 546 }
547 SkImageInfo SkDeferredCanvas::onImageInfo() const { return fCanvas->imageInfo(); } 547 SkImageInfo SkDeferredCanvas::onImageInfo() const { return fCanvas->imageInfo(); }
548 bool SkDeferredCanvas::onGetProps(SkSurfaceProps* props) const { return fCanvas- >getProps(props); } 548 bool SkDeferredCanvas::onGetProps(SkSurfaceProps* props) const { return fCanvas- >getProps(props); }
549 void SkDeferredCanvas::onFlush() { 549 void SkDeferredCanvas::onFlush() {
550 this->flush_all(); 550 this->flush_all();
551 return fCanvas->flush(); 551 return fCanvas->flush();
552 } 552 }
OLDNEW
« no previous file with comments | « src/utils/SkDeferredCanvas.h ('k') | src/utils/SkDumpCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698