make skmatrix getmapproc private
Make SkMatrix MapXYProc MapPtsProc and friends private.
Code search turned up no clients in chromium, google3,
android. Fingers crossed.
R:reed@google.com
Bug: skia:6898
Change-Id: Iee20fe5150499215a09f67cc6f117b685f38f455
Reviewed-on: https://skia-review.googlesource.com/62140
Commit-Queue: Cary Clark <caryclark@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h
index 7e45911..e22099c 100644
--- a/include/core/SkMatrix.h
+++ b/include/core/SkMatrix.h
@@ -572,30 +572,6 @@
*/
SkScalar mapRadius(SkScalar radius) const;
- typedef void (*MapXYProc)(const SkMatrix& mat, SkScalar x, SkScalar y,
- SkPoint* result);
-
- static MapXYProc GetMapXYProc(TypeMask mask) {
- SkASSERT((mask & ~kAllMasks) == 0);
- return gMapXYProcs[mask & kAllMasks];
- }
-
- MapXYProc getMapXYProc() const {
- return GetMapXYProc(this->getType());
- }
-
- typedef void (*MapPtsProc)(const SkMatrix& mat, SkPoint dst[],
- const SkPoint src[], int count);
-
- static MapPtsProc GetMapPtsProc(TypeMask mask) {
- SkASSERT((mask & ~kAllMasks) == 0);
- return gMapPtsProcs[mask & kAllMasks];
- }
-
- MapPtsProc getMapPtsProc() const {
- return GetMapPtsProc(this->getType());
- }
-
/** Returns true if the matrix can be stepped in X (not complex
perspective).
*/
@@ -823,6 +799,30 @@
}
}
+ typedef void (*MapXYProc)(const SkMatrix& mat, SkScalar x, SkScalar y,
+ SkPoint* result);
+
+ static MapXYProc GetMapXYProc(TypeMask mask) {
+ SkASSERT((mask & ~kAllMasks) == 0);
+ return gMapXYProcs[mask & kAllMasks];
+ }
+
+ MapXYProc getMapXYProc() const {
+ return GetMapXYProc(this->getType());
+ }
+
+ typedef void (*MapPtsProc)(const SkMatrix& mat, SkPoint dst[],
+ const SkPoint src[], int count);
+
+ static MapPtsProc GetMapPtsProc(TypeMask mask) {
+ SkASSERT((mask & ~kAllMasks) == 0);
+ return gMapPtsProcs[mask & kAllMasks];
+ }
+
+ MapPtsProc getMapPtsProc() const {
+ return GetMapPtsProc(this->getType());
+ }
+
bool SK_WARN_UNUSED_RESULT invertNonIdentity(SkMatrix* inverse) const;
static bool Poly2Proc(const SkPoint[], SkMatrix*, const SkPoint& scale);
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp
index e5643974..2f72739 100644
--- a/src/core/SkBitmapProcState.cpp
+++ b/src/core/SkBitmapProcState.cpp
@@ -155,7 +155,7 @@
* and may be removed.
*/
bool SkBitmapProcState::chooseProcs() {
- fInvProc = fInvMatrix.getMapXYProc();
+ fInvProc = SkMatrixPriv::GetMapXYProc(fInvMatrix);
fInvSx = SkScalarToFixed(fInvMatrix.getScaleX());
fInvSxFractionalInt = SkScalarToFractionalInt(fInvMatrix.getScaleX());
fInvKy = SkScalarToFixed(fInvMatrix.getSkewY());
diff --git a/src/core/SkBitmapProcState.h b/src/core/SkBitmapProcState.h
index 00fb160..46e418c 100644
--- a/src/core/SkBitmapProcState.h
+++ b/src/core/SkBitmapProcState.h
@@ -13,7 +13,7 @@
#include "SkBitmapProvider.h"
#include "SkFixed.h"
#include "SkFloatBits.h"
-#include "SkMatrix.h"
+#include "SkMatrixPriv.h"
#include "SkMipMap.h"
#include "SkPaint.h"
#include "SkShader.h"
@@ -78,7 +78,7 @@
typedef U16CPU (*FixedTileProc)(SkFixed); // returns 0..0xFFFF
typedef U16CPU (*IntTileProc)(int value, int count); // returns 0..count-1
- SkMatrix::MapXYProc fInvProc; // chooseProcs
+ SkMatrixPriv::MapXYProc fInvProc; // chooseProcs
SkFractionalInt fInvSxFractionalInt;
SkFractionalInt fInvKyFractionalInt;
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index b69c441..b36a73a 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -14,6 +14,7 @@
#include "SkImagePriv.h"
#include "SkImage_Base.h"
#include "SkLatticeIter.h"
+#include "SkMatrixPriv.h"
#include "SkPatchUtils.h"
#include "SkPathMeasure.h"
#include "SkPathPriv.h"
@@ -328,7 +329,7 @@
static void morphpoints(SkPoint dst[], const SkPoint src[], int count,
SkPathMeasure& meas, const SkMatrix& matrix) {
- SkMatrix::MapXYProc proc = matrix.getMapXYProc();
+ SkMatrixPriv::MapXYProc proc = SkMatrixPriv::GetMapXYProc(matrix);
for (int i = 0; i < count; i++) {
SkPoint pos;
diff --git a/src/core/SkFindAndPlaceGlyph.h b/src/core/SkFindAndPlaceGlyph.h
index a11c4ec..7ef4a46 100644
--- a/src/core/SkFindAndPlaceGlyph.h
+++ b/src/core/SkFindAndPlaceGlyph.h
@@ -12,6 +12,7 @@
#include "SkAutoKern.h"
#include "SkGlyph.h"
#include "SkGlyphCache.h"
+#include "SkMatrixPriv.h"
#include "SkPaint.h"
#include "SkTemplates.h"
#include "SkUtils.h"
@@ -235,7 +236,7 @@
class GeneralMapper final : public MapperInterface {
public:
GeneralMapper(const SkMatrix& matrix, const SkPoint origin)
- : fOrigin(origin), fMatrix(matrix), fMapProc(matrix.getMapXYProc()) { }
+ : fOrigin(origin), fMatrix(matrix), fMapProc(SkMatrixPriv::GetMapXYProc(matrix)) { }
SkPoint map(SkPoint position) const override {
SkPoint result;
@@ -246,7 +247,7 @@
private:
const SkPoint fOrigin;
const SkMatrix& fMatrix;
- const SkMatrix::MapXYProc fMapProc;
+ const SkMatrixPriv::MapXYProc fMapProc;
};
// TextAlignmentAdjustment handles shifting the glyph based on its width.
diff --git a/src/core/SkMatrixPriv.h b/src/core/SkMatrixPriv.h
index 47a1d5f..b0df2ec 100644
--- a/src/core/SkMatrixPriv.h
+++ b/src/core/SkMatrixPriv.h
@@ -13,6 +13,17 @@
class SkMatrixPriv {
public:
+ typedef SkMatrix::MapXYProc MapXYProc;
+ typedef SkMatrix::MapPtsProc MapPtsProc;
+
+ static MapPtsProc GetMapPtsProc(const SkMatrix& matrix) {
+ return SkMatrix::GetMapPtsProc(matrix.getType());
+ }
+
+ static MapXYProc GetMapXYProc(const SkMatrix& matrix) {
+ return SkMatrix::GetMapXYProc(matrix.getType());
+ }
+
/**
* 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/core/SkPath.cpp b/src/core/SkPath.cpp
index a460990..a053c76 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -11,6 +11,7 @@
#include "SkData.h"
#include "SkGeometry.h"
#include "SkMath.h"
+#include "SkMatrixPriv.h"
#include "SkPathPriv.h"
#include "SkPathRef.h"
#include "SkRRect.h"
@@ -1526,7 +1527,7 @@
SkPoint pts[4];
Verb verb;
- SkMatrix::MapPtsProc proc = matrix.getMapPtsProc();
+ SkMatrixPriv::MapPtsProc proc = SkMatrixPriv::GetMapPtsProc(matrix);
bool firstVerb = true;
while ((verb = iter.next(pts)) != kDone_Verb) {
switch (verb) {
diff --git a/src/core/SkTextMapStateProc.h b/src/core/SkTextMapStateProc.h
index 81ef5de..3989706 100644
--- a/src/core/SkTextMapStateProc.h
+++ b/src/core/SkTextMapStateProc.h
@@ -9,13 +9,13 @@
#define SkTextMapStateProc_DEFINED
#include "SkPoint.h"
-#include "SkMatrix.h"
+#include "SkMatrixPriv.h"
class SkTextMapStateProc {
public:
SkTextMapStateProc(const SkMatrix& matrix, const SkPoint& offset, int scalarsPerPosition)
: fMatrix(matrix)
- , fProc(matrix.getMapXYProc())
+ , fProc(SkMatrixPriv::GetMapXYProc(matrix))
, fOffset(offset)
, fScaleX(fMatrix.getScaleX()) {
SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition);
@@ -50,7 +50,7 @@
kOnlyTransX,
kX
} fMapCase;
- const SkMatrix::MapXYProc fProc;
+ const SkMatrixPriv::MapXYProc fProc;
SkPoint fOffset; // In kOnly* mode, this includes the matrix translation component.
SkScalar fScaleX; // This is only used by kOnly... cases.
};
diff --git a/src/shaders/gradients/Sk4fGradientBase.cpp b/src/shaders/gradients/Sk4fGradientBase.cpp
index 60f8ced..42f30c4 100644
--- a/src/shaders/gradients/Sk4fGradientBase.cpp
+++ b/src/shaders/gradients/Sk4fGradientBase.cpp
@@ -293,7 +293,7 @@
const SkMatrix& inverse = this->getTotalInverse();
fDstToPos.setConcat(shader.fPtsToUnit, inverse);
SkASSERT(!fDstToPos.hasPerspective());
- fDstToPosProc = fDstToPos.getMapXYProc();
+ fDstToPosProc = SkMatrixPriv::GetMapXYProc(fDstToPos);
if (shader.fColorsAreOpaque && this->getPaintAlpha() == SK_AlphaOPAQUE) {
fFlags |= kOpaqueAlpha_Flag;
diff --git a/src/shaders/gradients/Sk4fGradientBase.h b/src/shaders/gradients/Sk4fGradientBase.h
index b2c2b37..6361eec 100644
--- a/src/shaders/gradients/Sk4fGradientBase.h
+++ b/src/shaders/gradients/Sk4fGradientBase.h
@@ -11,7 +11,7 @@
#include "Sk4fGradientPriv.h"
#include "SkColor.h"
#include "SkGradientShaderPriv.h"
-#include "SkMatrix.h"
+#include "SkMatrixPriv.h"
#include "SkNx.h"
#include "SkPM4f.h"
#include "SkShaderBase.h"
@@ -65,7 +65,7 @@
protected:
Sk4fGradientIntervalBuffer fIntervals;
SkMatrix fDstToPos;
- SkMatrix::MapXYProc fDstToPosProc;
+ SkMatrixPriv::MapXYProc fDstToPosProc;
uint8_t fFlags;
bool fColorsArePremul;
bool fDither;
diff --git a/src/shaders/gradients/SkGradientShader.cpp b/src/shaders/gradients/SkGradientShader.cpp
index 53f2564..6dcc0ae 100644
--- a/src/shaders/gradients/SkGradientShader.cpp
+++ b/src/shaders/gradients/SkGradientShader.cpp
@@ -512,7 +512,7 @@
fDstToIndex.setConcat(shader.fPtsToUnit, inverse);
SkASSERT(!fDstToIndex.hasPerspective());
- fDstToIndexProc = fDstToIndex.getMapXYProc();
+ fDstToIndexProc = SkMatrixPriv::GetMapXYProc(fDstToIndex);
// now convert our colors in to PMColors
unsigned paintAlpha = this->getPaintAlpha();
diff --git a/src/shaders/gradients/SkGradientShaderPriv.h b/src/shaders/gradients/SkGradientShaderPriv.h
index da9098c..23ff30f 100644
--- a/src/shaders/gradients/SkGradientShaderPriv.h
+++ b/src/shaders/gradients/SkGradientShaderPriv.h
@@ -16,6 +16,7 @@
#include "SkClampRange.h"
#include "SkColorData.h"
#include "SkColorSpace.h"
+#include "SkMatrixPriv.h"
#include "SkOnce.h"
#include "SkPM4fPriv.h"
#include "SkRasterPipeline.h"
@@ -162,7 +163,7 @@
protected:
SkMatrix fDstToIndex;
- SkMatrix::MapXYProc fDstToIndexProc;
+ SkMatrixPriv::MapXYProc fDstToIndexProc;
uint8_t fDstToIndexClass;
uint8_t fFlags;
bool fDither;