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

Unified Diff: src/core/SkMatrix.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
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/utils/SkDeferredCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMatrix.cpp
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
index 492f3f6ac447fd3575dbcb775b6a7abf4531644b..71ef24c5e8e13ea9799ca6cf1f996697c96610ab 100644
--- a/src/core/SkMatrix.cpp
+++ b/src/core/SkMatrix.cpp
@@ -1097,8 +1097,7 @@ void SkMatrix::mapVectors(SkPoint dst[], const SkPoint src[], int count) const {
}
}
-void SkMatrix::mapRectScaleTranslate(SkRect* dst, const SkRect& src) const {
- SkASSERT(dst);
+SkRect SkMatrix::mapRectScaleTranslate(SkRect src) const {
SkASSERT(this->isScaleTranslate());
SkScalar sx = fMat[kMScaleX];
@@ -1107,7 +1106,7 @@ void SkMatrix::mapRectScaleTranslate(SkRect* dst, const SkRect& src) const {
SkScalar ty = fMat[kMTransY];
Sk4f scale(sx, sy, sx, sy);
Sk4f trans(tx, ty, tx, ty);
-
+
Sk4f ltrb = Sk4f::Load(&src.fLeft) * scale + trans;
// need to sort so we're not inverted
Sk4f rblt(ltrb[2], ltrb[3], ltrb[0], ltrb[1]);
@@ -1115,14 +1114,16 @@ void SkMatrix::mapRectScaleTranslate(SkRect* dst, const SkRect& src) const {
Sk4f max = Sk4f::Max(ltrb, rblt);
// We can extract either pair [0,1] or [2,3] from min and max and be correct, but on
mtklein 2016/07/11 13:32:05 If you do keep this change this comment becomes mi
// ARM this sequence generates the fastest (a single instruction).
- Sk4f(min[2], min[3], max[0], max[1]).store(&dst->fLeft);
+ SkRect dst;
+ Sk4f(min[0], min[1], max[0], max[1]).store(&dst.fLeft);
msarett 2016/07/11 12:38:13 Why the change to (0, 1, 0, 1) here?
+ return dst;
}
bool SkMatrix::mapRect(SkRect* dst, const SkRect& src) const {
SkASSERT(dst);
if (this->isScaleTranslate()) {
- this->mapRectScaleTranslate(dst, src);
+ *dst = this->mapRectScaleTranslate(src);
return true;
} else {
SkPoint quad[4];
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/utils/SkDeferredCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698