aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@skia.org>2017-12-15 13:11:41 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-15 18:37:39 +0000
commit2d53d984251a753b9d0fb3adad3be09243cf5c14 (patch)
tree8cbe3bfc4a81624efdc79c2992e056040080a251 /src
parent2a8ad669097f5e0b57e5acd174554d875728c75b (diff)
move homogenous with stride to matrixpriv
this appears to be needed only by Skia internally, so move it out of the public includes. R=bsalomon@google.com Bug: skia:6898 Change-Id: Iebdda8f2c9a8fd953dd44bac9b74158d7491c21a Reviewed-on: https://skia-review.googlesource.com/85961 Commit-Queue: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkMatrix.cpp20
-rw-r--r--src/core/SkMatrixPriv.h3
-rw-r--r--src/gpu/ops/GrAtlasTextOp.cpp3
3 files changed, 16 insertions, 10 deletions
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
index 4851aeacf6..23b465277f 100644
--- a/src/core/SkMatrix.cpp
+++ b/src/core/SkMatrix.cpp
@@ -6,7 +6,7 @@
*/
#include "SkFloatBits.h"
-#include "SkMatrix.h"
+#include "SkMatrixPriv.h"
#include "SkNx.h"
#include "SkPaint.h"
#include "SkPoint3.h"
@@ -1037,14 +1037,15 @@ const SkMatrix::MapPtsProc SkMatrix::gMapPtsProcs[] = {
///////////////////////////////////////////////////////////////////////////////
-void SkMatrix::mapHomogeneousPointsWithStride(SkPoint3 dst[], const SkPoint3 src[], size_t stride,
- int count) const {
+void SkMatrixPriv::MapHomogeneousPointsWithStride(const SkMatrix& mx, SkPoint3 dst[],
+ const SkPoint3 src[], size_t stride,
+ int count) {
SkASSERT((dst && src && count > 0) || 0 == count);
// no partial overlap
SkASSERT(src == dst || &dst[count] <= &src[0] || &src[count] <= &dst[0]);
if (count > 0) {
- if (this->isIdentity()) {
+ if (mx.isIdentity()) {
if (src != dst) {
if (stride == sizeof(SkPoint3)) {
memcpy(dst, src, count * sizeof(SkPoint3));
@@ -1064,10 +1065,11 @@ void SkMatrix::mapHomogeneousPointsWithStride(SkPoint3 dst[], const SkPoint3 src
SkScalar sy = src->fY;
SkScalar sw = src->fZ;
src = reinterpret_cast<const SkPoint3*>(reinterpret_cast<const char*>(src) + stride);
-
- 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]);
+ const SkScalar* mat = mx.fMat;
+ typedef SkMatrix M;
+ SkScalar x = sdot(sx, mat[M::kMScaleX], sy, mat[M::kMSkewX], sw, mat[M::kMTransX]);
+ SkScalar y = sdot(sx, mat[M::kMSkewY], sy, mat[M::kMScaleY], sw, mat[M::kMTransY]);
+ SkScalar w = sdot(sx, mat[M::kMPersp0], sy, mat[M::kMPersp1], sw, mat[M::kMPersp2]);
dst->set(x, y, w);
dst = reinterpret_cast<SkPoint3*>(reinterpret_cast<char*>(dst) + stride);
@@ -1076,7 +1078,7 @@ void SkMatrix::mapHomogeneousPointsWithStride(SkPoint3 dst[], const SkPoint3 src
}
void SkMatrix::mapHomogeneousPoints(SkPoint3 dst[], const SkPoint3 src[], int count) const {
- this->mapHomogeneousPointsWithStride(dst, src, sizeof(SkPoint3), count);
+ SkMatrixPriv::MapHomogeneousPointsWithStride(*this, dst, src, sizeof(SkPoint3), count);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/SkMatrixPriv.h b/src/core/SkMatrixPriv.h
index 8b437c636f..166981ac5b 100644
--- a/src/core/SkMatrixPriv.h
+++ b/src/core/SkMatrixPriv.h
@@ -92,6 +92,9 @@ public:
}
}
+ static void MapHomogeneousPointsWithStride(const SkMatrix& mx, SkPoint3 dst[],
+ const SkPoint3 src[], size_t stride, int count);
+
static void SetMappedRectTriStrip(const SkMatrix& mx, const SkRect& rect, SkPoint quad[4]) {
SkMatrix::TypeMask tm = mx.getType();
SkScalar l = rect.fLeft;
diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp
index d71cd92fde..c3698b992f 100644
--- a/src/gpu/ops/GrAtlasTextOp.cpp
+++ b/src/gpu/ops/GrAtlasTextOp.cpp
@@ -11,6 +11,7 @@
#include "GrResourceProvider.h"
#include "SkGlyphCache.h"
#include "SkMathPriv.h"
+#include "SkMatrixPriv.h"
#include "SkPoint3.h"
#include "effects/GrBitmapTextGeoProc.h"
#include "effects/GrDistanceFieldGeoProc.h"
@@ -281,7 +282,7 @@ void GrAtlasTextOp::onPrepareDraws(Target* target) {
// arbitrary transformations would be complicated and accumulate error.
if (args.fViewMatrix.hasPerspective()) {
auto* pos = reinterpret_cast<SkPoint3*>(currVertex);
- args.fViewMatrix.mapHomogeneousPointsWithStride(
+ SkMatrixPriv::MapHomogeneousPointsWithStride(args.fViewMatrix,
pos, pos, vertexStride, result.fGlyphsRegenerated * kVerticesPerGlyph);
} else {
auto* pos = reinterpret_cast<SkPoint*>(currVertex);