move set-text-matrix into private

Had no external callers, and was poorly named.

Bug: skia:
Change-Id: I5bed6853e9aa3b31fa106a436a73297bf55f0503
Reviewed-on: https://skia-review.googlesource.com/16155
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2017-05-09 12:16:04 -04:00 committed by Skia Commit-Bot
parent 2e61b182da
commit 7120b2d577
4 changed files with 21 additions and 18 deletions

View File

@ -1008,22 +1008,6 @@ public:
const SkRect& doComputeFastBounds(const SkRect& orig, SkRect* storage,
Style) const;
/**
* Return a matrix that applies the paint's text values: size, scale, skew
*/
static SkMatrix* SetTextMatrix(SkMatrix* matrix, SkScalar size,
SkScalar scaleX, SkScalar skewX) {
matrix->setScale(size * scaleX, size);
if (skewX) {
matrix->postSkew(skewX, 0);
}
return matrix;
}
SkMatrix* setTextMatrix(SkMatrix* matrix) const {
return SetTextMatrix(matrix, fTextSize, fTextScaleX, fTextSkewX);
}
typedef const SkGlyph& (*GlyphCacheProc)(SkGlyphCache*, const char**);
SK_TO_STRING_NONVIRT()

View File

@ -1381,6 +1381,7 @@ void SkDraw::drawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint& ori
///////////////////////////////////////////////////////////////////////////////
#include "SkPaintPriv.h"
#include "SkScalerContext.h"
#include "SkGlyphCache.h"
#include "SkTextToPathIter.h"
@ -1398,7 +1399,8 @@ bool SkDraw::ShouldDrawTextAsPaths(const SkPaint& paint, const SkMatrix& ctm) {
}
SkMatrix textM;
return SkPaint::TooBigToUseCache(ctm, *paint.setTextMatrix(&textM));
SkPaintPriv::MakeTextMatrix(&textM, paint);
return SkPaint::TooBigToUseCache(ctm, textM);
}
void SkDraw::drawText_asPaths(const char text[], size_t byteLength, SkScalar x, SkScalar y,

View File

@ -9,6 +9,7 @@
#define SkPaintPriv_DEFINED
#include "SkPaint.h"
#include "SkMatrix.h"
class SkBitmap;
class SkImage;
@ -46,6 +47,21 @@ public:
static bool Overwrites(const SkImage*, const SkPaint* paint);
static void ScaleFontMetrics(SkPaint::FontMetrics*, SkScalar);
/**
* Return a matrix that applies the paint's text values: size, scale, skew
*/
static void MakeTextMatrix(SkMatrix* matrix, SkScalar size, SkScalar scaleX, SkScalar skewX) {
matrix->setScale(size * scaleX, size);
if (skewX) {
matrix->postSkew(skewX, 0);
}
}
static void MakeTextMatrix(SkMatrix* matrix, const SkPaint& paint) {
MakeTextMatrix(matrix, paint.getTextSize(), paint.getTextScaleX(), paint.getTextSkewX());
}
};
#endif

View File

@ -17,6 +17,7 @@
#include "SkMaskFilter.h"
#include "SkMaskGamma.h"
#include "SkMatrix22.h"
#include "SkPaintPriv.h"
#include "SkPathEffect.h"
#include "SkRasterClip.h"
#include "SkRasterizer.h"
@ -678,7 +679,7 @@ void SkScalerContextRec::getMatrixFrom2x2(SkMatrix* dst) const {
}
void SkScalerContextRec::getLocalMatrix(SkMatrix* m) const {
SkPaint::SetTextMatrix(m, fTextSize, fPreScaleX, fPreSkewX);
SkPaintPriv::MakeTextMatrix(m, fTextSize, fPreScaleX, fPreSkewX);
}
void SkScalerContextRec::getSingleMatrix(SkMatrix* m) const {