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

Side by Side Diff: src/core/SkCanvas.cpp

Issue 777643003: use ClipOp instead of SkRegion for clipping (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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/SampleIdentityScale.cpp ('k') | src/core/SkPicturePlayback.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 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkCanvasDrawable.h" 9 #include "SkCanvasDrawable.h"
10 #include "SkCanvasPriv.h" 10 #include "SkCanvasPriv.h"
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 1328
1329 void SkCanvas::resetMatrix() { 1329 void SkCanvas::resetMatrix() {
1330 SkMatrix matrix; 1330 SkMatrix matrix;
1331 1331
1332 matrix.reset(); 1332 matrix.reset();
1333 this->setMatrix(matrix); 1333 this->setMatrix(matrix);
1334 } 1334 }
1335 1335
1336 ////////////////////////////////////////////////////////////////////////////// 1336 //////////////////////////////////////////////////////////////////////////////
1337 1337
1338 static SkRegion::Op clip2rgn(SkClipOp op) {
1339 if (kIntersect_SkClipOp == op) {
1340 return SkRegion::kIntersect_Op;
1341 } else {
1342 SkASSERT(kDifference_SkClipOp == op);
1343 return SkRegion::kDifference_Op;
1344 }
1345 }
1346
1347 void SkCanvas::clipRect(const SkRect& rect, SkClipOp op, bool doAntiAlias) {
1348 this->clipRect(rect, clip2rgn(op), doAntiAlias);
1349 }
1350
1351 void SkCanvas::clipRRect(const SkRRect& rrect, SkClipOp op, bool doAntiAlias) {
1352 this->clipRRect(rrect, clip2rgn(op), doAntiAlias);
1353 }
1354
1355 void SkCanvas::clipPath(const SkPath& path, SkClipOp op, bool doAntiAlias) {
1356 this->clipPath(path, clip2rgn(op), doAntiAlias);
1357 }
1358
1359 void SkCanvas::clipRegion(const SkRegion& deviceRgn, SkClipOp op) {
1360 this->clipRegion(deviceRgn, clip2rgn(op));
1361 }
1362
1338 void SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { 1363 void SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
1339 ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle; 1364 ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle;
1340 this->onClipRect(rect, op, edgeStyle); 1365 this->onClipRect(rect, op, edgeStyle);
1341 } 1366 }
1342 1367
1343 void SkCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edg eStyle) { 1368 void SkCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edg eStyle) {
1344 #ifdef SK_ENABLE_CLIP_QUICKREJECT 1369 #ifdef SK_ENABLE_CLIP_QUICKREJECT
1345 if (SkRegion::kIntersect_Op == op) { 1370 if (SkRegion::kIntersect_Op == op) {
1346 if (fMCRec->fRasterClip.isEmpty()) { 1371 if (fMCRec->fRasterClip.isEmpty()) {
1347 return false; 1372 return false;
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
2576 } 2601 }
2577 2602
2578 if (matrix) { 2603 if (matrix) {
2579 canvas->concat(*matrix); 2604 canvas->concat(*matrix);
2580 } 2605 }
2581 } 2606 }
2582 2607
2583 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2608 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2584 fCanvas->restoreToCount(fSaveCount); 2609 fCanvas->restoreToCount(fSaveCount);
2585 } 2610 }
OLDNEW
« no previous file with comments | « samplecode/SampleIdentityScale.cpp ('k') | src/core/SkPicturePlayback.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698