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

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

Issue 1466303004: Add sniff for rect, oval & rrect to SkCanvas::clipPath (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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 | « no previous file | no next file » | 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 "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCanvasPriv.h" 10 #include "SkCanvasPriv.h"
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 1593
1594 SkPath path; 1594 SkPath path;
1595 path.addRRect(rrect); 1595 path.addRRect(rrect);
1596 // call the non-virtual version 1596 // call the non-virtual version
1597 this->SkCanvas::onClipPath(path, op, edgeStyle); 1597 this->SkCanvas::onClipPath(path, op, edgeStyle);
1598 } 1598 }
1599 1599
1600 void SkCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) { 1600 void SkCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
1601 this->checkForDeferredSave(); 1601 this->checkForDeferredSave();
1602 ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle; 1602 ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle;
1603 SkRect r; 1603
1604 if (!path.isInverseFillType() && path.isRect(&r)) { 1604 if (!path.isInverseFillType() && fMCRec->fMatrix.rectStaysRect()) {
1605 this->onClipRect(r, op, edgeStyle); 1605 SkRect r;
1606 } else { 1606 if (path.isRect(&r)) {
1607 this->onClipPath(path, op, edgeStyle); 1607 this->onClipRect(r, op, edgeStyle);
1608 return;
1609 }
1610 SkRRect rrect;
1611 if (path.isOval(&r)) {
1612 rrect.setOval(r);
1613 this->onClipRRect(rrect, op, edgeStyle);
1614 return;
1615 }
1616 if (path.isRRect(&rrect)) {
1617 this->onClipRRect(rrect, op, edgeStyle);
1618 return;
1619 }
1608 } 1620 }
1621
1622 this->onClipPath(path, op, edgeStyle);
1609 } 1623 }
1610 1624
1611 void SkCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edg eStyle) { 1625 void SkCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edg eStyle) {
1612 #ifdef SK_ENABLE_CLIP_QUICKREJECT 1626 #ifdef SK_ENABLE_CLIP_QUICKREJECT
1613 if (SkRegion::kIntersect_Op == op && !path.isInverseFillType()) { 1627 if (SkRegion::kIntersect_Op == op && !path.isInverseFillType()) {
1614 if (fMCRec->fRasterClip.isEmpty()) { 1628 if (fMCRec->fRasterClip.isEmpty()) {
1615 return false; 1629 return false;
1616 } 1630 }
1617 1631
1618 if (this->quickReject(path.getBounds())) { 1632 if (this->quickReject(path.getBounds())) {
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after
2949 } 2963 }
2950 2964
2951 if (matrix) { 2965 if (matrix) {
2952 canvas->concat(*matrix); 2966 canvas->concat(*matrix);
2953 } 2967 }
2954 } 2968 }
2955 2969
2956 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2970 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2957 fCanvas->restoreToCount(fSaveCount); 2971 fCanvas->restoreToCount(fSaveCount);
2958 } 2972 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698