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

Unified Diff: src/core/SkCanvas.cpp

Issue 2137853002: change mapRectScaleTranslate to pass args/ret by value (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 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
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 0ce97fff20661f8e2c82aacb801d2bb1cf574718..23442779ce0406f403436c33560ac6fc7d15a970 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -75,13 +75,11 @@ bool SkCanvas::wouldOverwriteEntireSurface(const SkRect* rect, const SkPaint* pa
}
if (rect) {
- if (!this->getTotalMatrix().isScaleTranslate()) {
+ const SkMatrix& ctm = this->getTotalMatrix();
+ if (!ctm.isScaleTranslate()) {
return false; // conservative
}
-
- SkRect devRect;
- this->getTotalMatrix().mapRectScaleTranslate(&devRect, *rect);
- if (!devRect.contains(bounds)) {
+ if (!ctm.mapRectScaleTranslate(*rect).contains(bounds)) {
return false;
}
}
@@ -1544,8 +1542,7 @@ void SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
// Check if we can quick-accept the clip call (and do nothing)
//
if (SkRegion::kIntersect_Op == op && !doAA && fMCRec->fMatrix.isScaleTranslate()) {
- SkRect devR;
- fMCRec->fMatrix.mapRectScaleTranslate(&devR, rect);
+ SkRect devR = fMCRec->fMatrix.mapRectScaleTranslate(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).
@@ -1585,7 +1582,7 @@ void SkCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edg
const bool isScaleTrans = fMCRec->fMatrix.isScaleTranslate();
SkRect devR;
if (isScaleTrans) {
- fMCRec->fMatrix.mapRectScaleTranslate(&devR, rect);
+ devR = fMCRec->fMatrix.mapRectScaleTranslate(rect);
}
#ifndef SK_SUPPORT_PRECHECK_CLIPRECT
« no previous file with comments | « include/core/SkMatrix.h ('k') | src/core/SkMatrix.cpp » ('j') | src/core/SkMatrix.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698