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>
This commit is contained in:
Cary Clark 2017-10-19 18:01:13 -04:00 committed by Skia Commit-Bot
parent b68defab6d
commit 9480d822f2
12 changed files with 54 additions and 39 deletions

View File

@ -572,30 +572,6 @@ public:
*/
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 @@ private:
}
}
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);

View File

@ -155,7 +155,7 @@ bool SkBitmapProcInfo::init(const SkMatrix& inv, const SkPaint& paint) {
* 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());

View File

@ -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 @@ struct SkBitmapProcState : public SkBitmapProcInfo {
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;

View File

@ -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 @@ bool SkBaseDevice::peekPixels(SkPixmap* pmap) {
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;

View File

@ -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 @@ private:
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:
private:
const SkPoint fOrigin;
const SkMatrix& fMatrix;
const SkMatrix::MapXYProc fMapProc;
const SkMatrixPriv::MapXYProc fMapProc;
};
// TextAlignmentAdjustment handles shifting the glyph based on its width.

View File

@ -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.

View File

@ -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 @@ void SkPath::addPath(const SkPath& path, const SkMatrix& matrix, AddPathMode mod
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) {

View File

@ -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 @@ private:
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.
};

View File

@ -293,7 +293,7 @@ GradientShaderBase4fContext::GradientShaderBase4fContext(const SkGradientShaderB
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;

View File

@ -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 @@ public:
protected:
Sk4fGradientIntervalBuffer fIntervals;
SkMatrix fDstToPos;
SkMatrix::MapXYProc fDstToPosProc;
SkMatrixPriv::MapXYProc fDstToPosProc;
uint8_t fFlags;
bool fColorsArePremul;
bool fDither;

View File

@ -512,7 +512,7 @@ SkGradientShaderBase::GradientShaderBaseContext::GradientShaderBaseContext(
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();

View File

@ -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 @@ public:
protected:
SkMatrix fDstToIndex;
SkMatrix::MapXYProc fDstToIndexProc;
SkMatrixPriv::MapXYProc fDstToIndexProc;
uint8_t fDstToIndexClass;
uint8_t fFlags;
bool fDither;