aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkCanvas.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-06-30 08:15:35 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-30 08:15:35 -0700
commit744671639dae1d5589181856d54cf0dfdb59272d (patch)
tree8fbf597653104a86a96642ed761a446fb52dd71f /src/core/SkCanvas.cpp
parentd92b4198aef1ba719222e737edf6e28a39b43b6d (diff)
use mapRectScaleTranslate for common case in clipRect
Diffstat (limited to 'src/core/SkCanvas.cpp')
-rw-r--r--src/core/SkCanvas.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index df6eccb999..ce90275047 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);