aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@skia.org>2017-10-12 15:33:28 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-12 19:56:31 +0000
commit708ec81d7a9bba12cd7e574b5c5ae80b2ad77919 (patch)
treeab62212c793e00eaab3e17372c75e67005d67675
parent2e67dea9d361dc80ed27a10c57efdd66e227e3c7 (diff)
move SkMatrix anonymous affine enum to private
enum members aren't used by SkMatrix.h or by clients outside of Skia. R: reed@google.com, bungeman@google.com Bug: skia:6898 Change-Id: I6873b4106e5ffe354caf5ec18cc613910304fa13 Reviewed-on: https://skia-review.googlesource.com/59160 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Cary Clark <caryclark@skia.org>
-rw-r--r--include/core/SkMatrix.h12
-rw-r--r--src/core/SkMatrix.cpp37
-rw-r--r--src/core/SkMatrixPriv.h12
-rw-r--r--src/xps/SkXPSDevice.cpp13
-rw-r--r--tests/MatrixTest.cpp4
5 files changed, 40 insertions, 38 deletions
diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h
index 6e9f421264..863d470dc4 100644
--- a/include/core/SkMatrix.h
+++ b/include/core/SkMatrix.h
@@ -126,18 +126,6 @@ public:
kMPersp2,
};
- /** Affine arrays are in column major order
- because that's how PDF and XPS like it.
- */
- enum {
- kAScaleX,
- kASkewY,
- kASkewX,
- kAScaleY,
- kATransX,
- kATransY,
- };
-
SkScalar operator[](int index) const {
SkASSERT((unsigned)index < 9);
return fMat[index];
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
index 0ed9565fb9..45f77344fb 100644
--- a/src/core/SkMatrix.cpp
+++ b/src/core/SkMatrix.cpp
@@ -7,6 +7,7 @@
#include "SkFloatBits.h"
#include "SkMatrix.h"
+#include "SkMatrixPriv.h"
#include "SkNx.h"
#include "SkPaint.h"
#include "SkRSXform.h"
@@ -75,12 +76,12 @@ void SkMatrix::set9(const SkScalar buffer[]) {
}
void SkMatrix::setAffine(const SkScalar buffer[]) {
- fMat[kMScaleX] = buffer[kAScaleX];
- fMat[kMSkewX] = buffer[kASkewX];
- fMat[kMTransX] = buffer[kATransX];
- fMat[kMSkewY] = buffer[kASkewY];
- fMat[kMScaleY] = buffer[kAScaleY];
- fMat[kMTransY] = buffer[kATransY];
+ fMat[kMScaleX] = buffer[SkMatrixPriv::kAScaleX];
+ fMat[kMSkewX] = buffer[SkMatrixPriv::kASkewX];
+ fMat[kMTransX] = buffer[SkMatrixPriv::kATransX];
+ fMat[kMSkewY] = buffer[SkMatrixPriv::kASkewY];
+ fMat[kMScaleY] = buffer[SkMatrixPriv::kAScaleY];
+ fMat[kMTransY] = buffer[SkMatrixPriv::kATransY];
fMat[kMPersp0] = 0;
fMat[kMPersp1] = 0;
fMat[kMPersp2] = 1;
@@ -778,12 +779,12 @@ static double sk_inv_determinant(const float mat[9], int isPerspective) {
}
void SkMatrix::SetAffineIdentity(SkScalar affine[6]) {
- affine[kAScaleX] = 1;
- affine[kASkewY] = 0;
- affine[kASkewX] = 0;
- affine[kAScaleY] = 1;
- affine[kATransX] = 0;
- affine[kATransY] = 0;
+ affine[SkMatrixPriv::kAScaleX] = 1;
+ affine[SkMatrixPriv::kASkewY] = 0;
+ affine[SkMatrixPriv::kASkewX] = 0;
+ affine[SkMatrixPriv::kAScaleY] = 1;
+ affine[SkMatrixPriv::kATransX] = 0;
+ affine[SkMatrixPriv::kATransY] = 0;
}
bool SkMatrix::asAffine(SkScalar affine[6]) const {
@@ -791,12 +792,12 @@ bool SkMatrix::asAffine(SkScalar affine[6]) const {
return false;
}
if (affine) {
- affine[kAScaleX] = this->fMat[kMScaleX];
- affine[kASkewY] = this->fMat[kMSkewY];
- affine[kASkewX] = this->fMat[kMSkewX];
- affine[kAScaleY] = this->fMat[kMScaleY];
- affine[kATransX] = this->fMat[kMTransX];
- affine[kATransY] = this->fMat[kMTransY];
+ affine[SkMatrixPriv::kAScaleX] = this->fMat[kMScaleX];
+ affine[SkMatrixPriv::kASkewY] = this->fMat[kMSkewY];
+ affine[SkMatrixPriv::kASkewX] = this->fMat[kMSkewX];
+ affine[SkMatrixPriv::kAScaleY] = this->fMat[kMScaleY];
+ affine[SkMatrixPriv::kATransX] = this->fMat[kMTransX];
+ affine[SkMatrixPriv::kATransY] = this->fMat[kMTransY];
}
return true;
}
diff --git a/src/core/SkMatrixPriv.h b/src/core/SkMatrixPriv.h
index ee6f8a153d..e38a99751f 100644
--- a/src/core/SkMatrixPriv.h
+++ b/src/core/SkMatrixPriv.h
@@ -13,6 +13,18 @@
class SkMatrixPriv {
public:
+ /** Affine arrays are in column major order
+ because that's how PDF and XPS like it.
+ */
+ enum {
+ kAScaleX,
+ kASkewY,
+ kASkewX,
+ kAScaleY,
+ kATransX,
+ kATransY,
+ };
+
/**
* Attempt to map the rect through the inverse of the matrix. If it is not invertible,
* then this returns false and dst is unchanged.
diff --git a/src/xps/SkXPSDevice.cpp b/src/xps/SkXPSDevice.cpp
index 801b80c0b0..6f62f89b45 100644
--- a/src/xps/SkXPSDevice.cpp
+++ b/src/xps/SkXPSDevice.cpp
@@ -35,6 +35,7 @@
#include "SkImageEncoder.h"
#include "SkImagePriv.h"
#include "SkMaskFilter.h"
+#include "SkMatrixPriv.h"
#include "SkPaint.h"
#include "SkPathEffect.h"
#include "SkPathOps.h"
@@ -519,12 +520,12 @@ HRESULT SkXPSDevice::createXpsTransform(const SkMatrix& matrix,
return S_FALSE;
}
XPS_MATRIX rawXpsMatrix = {
- SkScalarToFLOAT(affine[SkMatrix::kAScaleX]),
- SkScalarToFLOAT(affine[SkMatrix::kASkewY]),
- SkScalarToFLOAT(affine[SkMatrix::kASkewX]),
- SkScalarToFLOAT(affine[SkMatrix::kAScaleY]),
- SkScalarToFLOAT(affine[SkMatrix::kATransX]),
- SkScalarToFLOAT(affine[SkMatrix::kATransY]),
+ SkScalarToFLOAT(affine[SkMatrixPriv::kAScaleX]),
+ SkScalarToFLOAT(affine[SkMatrixPriv::kASkewY]),
+ SkScalarToFLOAT(affine[SkMatrixPriv::kASkewX]),
+ SkScalarToFLOAT(affine[SkMatrixPriv::kAScaleY]),
+ SkScalarToFLOAT(affine[SkMatrixPriv::kATransX]),
+ SkScalarToFLOAT(affine[SkMatrixPriv::kATransY]),
};
HRM(this->fXpsFactory->CreateMatrixTransform(&rawXpsMatrix, xpsTransform),
"Could not create transform.");
diff --git a/tests/MatrixTest.cpp b/tests/MatrixTest.cpp
index 6f7a14fdc7..3e20f0b765 100644
--- a/tests/MatrixTest.cpp
+++ b/tests/MatrixTest.cpp
@@ -6,7 +6,7 @@
*/
#include "SkMath.h"
-#include "SkMatrix.h"
+#include "SkMatrixPriv.h"
#include "SkMatrixUtils.h"
#include "SkRandom.h"
#include "Test.h"
@@ -912,7 +912,7 @@ DEF_TEST(Matrix, reporter) {
SkScalar affine[6];
REPORTER_ASSERT(reporter, mat.asAffine(affine));
- #define affineEqual(e) affine[SkMatrix::kA##e] == mat.get(SkMatrix::kM##e)
+ #define affineEqual(e) affine[SkMatrixPriv::kA##e] == mat.get(SkMatrix::kM##e)
REPORTER_ASSERT(reporter, affineEqual(ScaleX));
REPORTER_ASSERT(reporter, affineEqual(SkewY));
REPORTER_ASSERT(reporter, affineEqual(SkewX));