aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkMatrix.cpp
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@skia.org>2017-10-18 11:46:18 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-18 16:09:46 +0000
commite4442cb0b537720ab32106b3b5353dbb78f11b26 (patch)
treec96d6669865bc85ef278a178d501bd60d29cc2eb /src/core/SkMatrix.cpp
parentb4379132d12cd11e52944331487b045f1f32989d (diff)
convert mapHomogeneousPoints to SkPoint3
SkMatrix::mapHomogeneousPoints takes an array of SkScalar, but expects essentially SkPoint3, so make it so. R: robertphillips@google.com, reed@google.com Bug: skia:6898 Change-Id: Ibaf8b05c08b7df16c67d6a77d914667ace9a70da Reviewed-on: https://skia-review.googlesource.com/58380 Commit-Queue: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@google.com> Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/core/SkMatrix.cpp')
-rw-r--r--src/core/SkMatrix.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
index 5b1be84588..89bde4b42c 100644
--- a/src/core/SkMatrix.cpp
+++ b/src/core/SkMatrix.cpp
@@ -9,6 +9,7 @@
#include "SkMatrix.h"
#include "SkNx.h"
#include "SkPaint.h"
+#include "SkPoint3.h"
#include "SkRSXform.h"
#include "SkString.h"
#include <stddef.h>
@@ -1036,30 +1037,28 @@ const SkMatrix::MapPtsProc SkMatrix::gMapPtsProcs[] = {
///////////////////////////////////////////////////////////////////////////////
-void SkMatrix::mapHomogeneousPoints(SkScalar dst[], const SkScalar src[], int count) const {
+void SkMatrix::mapHomogeneousPoints(SkPoint3 dst[], const SkPoint3 src[], int count) const {
SkASSERT((dst && src && count > 0) || 0 == count);
// no partial overlap
- SkASSERT(src == dst || &dst[3*count] <= &src[0] || &src[3*count] <= &dst[0]);
+ SkASSERT(src == dst || &dst[count] <= &src[0] || &src[count] <= &dst[0]);
if (count > 0) {
if (this->isIdentity()) {
- memcpy(dst, src, 3*count*sizeof(SkScalar));
+ memcpy(dst, src, count * sizeof(SkPoint3));
return;
}
do {
- SkScalar sx = src[0];
- SkScalar sy = src[1];
- SkScalar sw = src[2];
- src += 3;
+ SkScalar sx = src->fX;
+ SkScalar sy = src->fY;
+ SkScalar sw = src->fZ;
+ src++;
SkScalar x = sdot(sx, fMat[kMScaleX], sy, fMat[kMSkewX], sw, fMat[kMTransX]);
SkScalar y = sdot(sx, fMat[kMSkewY], sy, fMat[kMScaleY], sw, fMat[kMTransY]);
SkScalar w = sdot(sx, fMat[kMPersp0], sy, fMat[kMPersp1], sw, fMat[kMPersp2]);
- dst[0] = x;
- dst[1] = y;
- dst[2] = w;
- dst += 3;
+ dst->set(x, y, w);
+ dst++;
} while (--count);
}
}