diff options
author | Herb Derby <herb@google.com> | 2018-03-12 13:56:21 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-12 18:50:48 +0000 |
commit | 24f25dc8bca79fc8bb6a4676b2b341bd17fd77ab (patch) | |
tree | d631c4326401b7fda11b4d2b667aa74f94f18bb7 | |
parent | 18e7556371506fd08bd0767a270c5db5a7804103 (diff) |
Move ComputeAxisAlignmentForHText to Rec.
BUG=skia:7515
Change-Id: I81d7950e508e0893f3591cc07596c10e8aaa636a
Reviewed-on: https://skia-review.googlesource.com/113749
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
-rw-r--r-- | src/core/SkScalerContext.cpp | 10 | ||||
-rw-r--r-- | src/core/SkScalerContext.h | 7 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp index 0f1acf3832..6d5984abdf 100644 --- a/src/core/SkScalerContext.cpp +++ b/src/core/SkScalerContext.cpp @@ -772,7 +772,11 @@ bool SkScalerContextRec::computeMatrices(PreMatrixScale preMatrixScale, SkVector return true; } -SkAxisAlignment SkScalerContext::computeAxisAlignmentForHText() { +SkAxisAlignment SkScalerContext::computeAxisAlignmentForHText() const { + return fRec.computeAxisAlignmentForHText(); +} + +SkAxisAlignment SkScalerContextRec::computeAxisAlignmentForHText() const { // Why fPost2x2 can be used here. // getSingleMatrix multiplies in getLocalMatrix, which consists of // * fTextSize (a scale, which has no effect) @@ -781,11 +785,11 @@ SkAxisAlignment SkScalerContext::computeAxisAlignmentForHText() { // In other words, making the text bigger, stretching it along the // horizontal axis, or fake italicizing it does not move the baseline. - if (0 == fRec.fPost2x2[1][0]) { + if (0 == fPost2x2[1][0]) { // The x axis is mapped onto the x axis. return kX_SkAxisAlignment; } - if (0 == fRec.fPost2x2[0][0]) { + if (0 == fPost2x2[0][0]) { // The x axis is mapped onto the y axis. return kY_SkAxisAlignment; } diff --git a/src/core/SkScalerContext.h b/src/core/SkScalerContext.h index 21c05dc808..33072f8a57 100644 --- a/src/core/SkScalerContext.h +++ b/src/core/SkScalerContext.h @@ -56,7 +56,6 @@ enum SkAxisAlignment { * than a nested struct inside SkScalerContext (where it started). */ struct SkScalerContextRec { - uint32_t fFontID; SkScalar fTextSize, fPreScaleX, fPreSkewX; SkScalar fPost2x2[2][2]; @@ -136,6 +135,8 @@ public: fPost2x2[0][1], fPost2x2[1][0], fPost2x2[1][1]); msg.appendf(" frame %g miter %g format %d join %d cap %d flags %#hx\n", fFrameWidth, fMiterLimit, fMaskFormat, fStrokeJoin, fStrokeCap, fFlags); + msg.appendf(" lum bits %x, device gamma %d, paint gamma %d contrast %d\n", + fLumBits, fDeviceGamma, fPaintGamma, fContrast); return msg; } @@ -188,6 +189,8 @@ public: SkMatrix* remainingRotation = nullptr, SkMatrix* total = nullptr); + SkAxisAlignment computeAxisAlignmentForHText() const; + inline SkPaint::Hinting getHinting() const; inline void setHinting(SkPaint::Hinting); @@ -338,7 +341,7 @@ public: * Return the axis (if any) that the baseline for horizontal text should land on. * As an example, the identity matrix will return kX_SkAxisAlignment */ - SkAxisAlignment computeAxisAlignmentForHText(); + SkAxisAlignment computeAxisAlignmentForHText() const; static SkDescriptor* CreateDescriptorAndEffectsUsingPaint( const SkPaint& paint, const SkSurfaceProps* surfaceProps, |