aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrFontScaler.cpp
diff options
context:
space:
mode:
authorGravatar jvanverth <jvanverth@google.com>2014-10-10 11:36:12 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-10-10 11:36:12 -0700
commit294c32612d712eb56361ac5439271a91ae96862e (patch)
tree296fe453480d2c47365ff64a05d6e79aa04c657e /src/gpu/GrFontScaler.cpp
parent71856d520461ae025a0332aa0ce9735a096d9baf (diff)
Fix color emoji.
Removes the GrMaskFormat and single atlas in GrTextStrike. Replaces it by storing the GrMaskFormat in each GrGlyph, and doing a lookup for the correct atlas based on that. Disables color glyph rendering in GrDistanceFieldTextContext for now. BUG=skia:2887 Committed: https://skia.googlesource.com/skia/+/bc92163ddfe957ad6ffbb02ac40e0ba75ff82216 Review URL: https://codereview.chromium.org/636183005
Diffstat (limited to 'src/gpu/GrFontScaler.cpp')
-rw-r--r--src/gpu/GrFontScaler.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/gpu/GrFontScaler.cpp b/src/gpu/GrFontScaler.cpp
index 164768f3b0..b16b498ac1 100644
--- a/src/gpu/GrFontScaler.cpp
+++ b/src/gpu/GrFontScaler.cpp
@@ -59,7 +59,7 @@ GrFontScaler::~GrFontScaler() {
SkSafeUnref(fKey);
}
-GrMaskFormat GrFontScaler::getMaskFormat() {
+GrMaskFormat GrFontScaler::getMaskFormat() const {
SkMask::Format format = fStrike->getMaskFormat();
switch (format) {
case SkMask::kBW_Format:
@@ -85,6 +85,28 @@ const GrFontDescKey* GrFontScaler::getKey() {
return fKey;
}
+GrMaskFormat GrFontScaler::getPackedGlyphMaskFormat(GrGlyph::PackedID packed) const {
+ const SkGlyph& glyph = fStrike->getGlyphIDMetrics(GrGlyph::UnpackID(packed),
+ GrGlyph::UnpackFixedX(packed),
+ GrGlyph::UnpackFixedY(packed));
+ SkMask::Format format = static_cast<SkMask::Format>(glyph.fMaskFormat);
+ switch (format) {
+ case SkMask::kBW_Format:
+ // fall through to kA8 -- we store BW glyphs in our 8-bit cache
+ case SkMask::kA8_Format:
+ return kA8_GrMaskFormat;
+ case SkMask::kLCD16_Format:
+ return kA565_GrMaskFormat;
+ case SkMask::kLCD32_Format:
+ return kA888_GrMaskFormat;
+ case SkMask::kARGB32_Format:
+ return kARGB_GrMaskFormat;
+ default:
+ SkDEBUGFAIL("unsupported SkMask::Format");
+ return kA8_GrMaskFormat;
+ }
+}
+
bool GrFontScaler::getPackedGlyphBounds(GrGlyph::PackedID packed, SkIRect* bounds) {
const SkGlyph& glyph = fStrike->getGlyphIDMetrics(GrGlyph::UnpackID(packed),
GrGlyph::UnpackFixedX(packed),