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

Unified Diff: src/core/SkCanvas.cpp

Issue 2119473002: use mapRectScaleTranslate for common case in clipRect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index df6eccb999686109d5b024ba405167773b42f7f4..ce90275047a6466cf9217e32bc0e9505ed8eff36 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -75,12 +75,12 @@ bool SkCanvas::wouldOverwriteEntireSurface(const SkRect* rect, const SkPaint* pa
}
if (rect) {
- if (!this->getTotalMatrix().rectStaysRect()) {
+ if (!this->getTotalMatrix().isScaleTranslate()) {
return false; // conservative
}
SkRect devRect;
- this->getTotalMatrix().mapRect(&devRect, *rect);
+ this->getTotalMatrix().mapRectScaleTranslate(&devRect, *rect);
if (!devRect.contains(bounds)) {
return false;
}
@@ -1531,9 +1531,9 @@ void SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
#ifdef SK_SUPPORT_PRECHECK_CLIPRECT
// Check if we can quick-accept the clip call (and do nothing)
//
- if (SkRegion::kIntersect_Op == op && !doAA && fMCRec->fMatrix.rectStaysRect()) {
+ if (SkRegion::kIntersect_Op == op && !doAA && fMCRec->fMatrix.isScaleTranslate()) {
SkRect devR;
- fMCRec->fMatrix.mapRect(&devR, rect);
+ fMCRec->fMatrix.mapRectScaleTranslate(&devR, rect);
// NOTE: this check is CTM specific, since we might round differently with a different
// CTM. Thus this is only 100% reliable if there is not global CTM scale to be
// applied later (i.e. if this is going into a picture).
@@ -1570,16 +1570,16 @@ void SkCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edg
}
#endif
- const bool rectStaysRect = fMCRec->fMatrix.rectStaysRect();
+ const bool isScaleTrans = fMCRec->fMatrix.isScaleTranslate();
SkRect devR;
- if (rectStaysRect) {
- fMCRec->fMatrix.mapRect(&devR, rect);
+ if (isScaleTrans) {
+ fMCRec->fMatrix.mapRectScaleTranslate(&devR, rect);
}
#ifndef SK_SUPPORT_PRECHECK_CLIPRECT
if (SkRegion::kIntersect_Op == op &&
kHard_ClipEdgeStyle == edgeStyle
- && rectStaysRect)
+ && isScaleTrans)
{
if (devR.round().contains(fMCRec->fRasterClip.getBounds())) {
#if 0
@@ -1596,7 +1596,7 @@ void SkCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edg
fDeviceCMDirty = true;
fCachedLocalClipBoundsDirty = true;
- if (rectStaysRect) {
+ if (isScaleTrans) {
const bool isAA = kSoft_ClipEdgeStyle == edgeStyle;
fClipStack->clipDevRect(devR, op, isAA);
fMCRec->fRasterClip.op(devR, this->getTopLayerBounds(), op, isAA);
« 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