diff options
author | Herb Derby <herb@google.com> | 2018-04-26 11:38:58 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-26 16:26:13 +0000 |
commit | 927fcb13f28214d213e5fca7bdafce4db5f4e5f9 (patch) | |
tree | 1c559b824a80a795f5d00a7aef6b8c35d86ac061 | |
parent | c2a887031691c675cc519347258019f45ceb555c (diff) |
Make rounding code public
Change-Id: I37fec55277fe99734980c7473f964d37ca4248b8
Reviewed-on: https://skia-review.googlesource.com/123931
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
-rw-r--r-- | src/core/SkFindAndPlaceGlyph.h | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/core/SkFindAndPlaceGlyph.h b/src/core/SkFindAndPlaceGlyph.h index d3cf327e63..d92edb6b17 100644 --- a/src/core/SkFindAndPlaceGlyph.h +++ b/src/core/SkFindAndPlaceGlyph.h @@ -72,6 +72,21 @@ public: return {0, 0}; } + // The SubpixelPositionRounding function returns a point suitable for rounding a sub-pixel + // positioned glyph. + static SkPoint SubpixelPositionRounding(SkAxisAlignment axisAlignment) { + switch (axisAlignment) { + case kX_SkAxisAlignment: + return {kSubpixelRounding, SK_ScalarHalf}; + case kY_SkAxisAlignment: + return {SK_ScalarHalf, kSubpixelRounding}; + case kNone_SkAxisAlignment: + return {kSubpixelRounding, kSubpixelRounding}; + } + SK_ABORT("Should not get here."); + return {0.0f, 0.0f}; + } + private: // GlyphFinderInterface is the polymorphic base for classes that parse a stream of chars into // the right UniChar (or GlyphID) and lookup up the glyph on the cache. The concrete @@ -295,21 +310,6 @@ private: // Needs to be a macro because you can't have a const float unless you make it constexpr. static constexpr SkScalar kSubpixelRounding = SkFixedToScalar(SkGlyph::kSubpixelRound); - // The SubpixelPositionRounding function returns a point suitable for rounding a sub-pixel - // positioned glyph. - static SkPoint SubpixelPositionRounding(SkAxisAlignment axisAlignment) { - switch (axisAlignment) { - case kX_SkAxisAlignment: - return {kSubpixelRounding, SK_ScalarHalf}; - case kY_SkAxisAlignment: - return {SK_ScalarHalf, kSubpixelRounding}; - case kNone_SkAxisAlignment: - return {kSubpixelRounding, kSubpixelRounding}; - } - SK_ABORT("Should not get here."); - return {0.0f, 0.0f}; - } - // GlyphFindAndPlaceInterface given the text and position finds the correct glyph and does // glyph specific position adjustment. The findAndPositionGlyph method takes text and // position and calls processOneGlyph with the correct glyph, final position and rounding |