Index: src/gpu/GrFontScaler.cpp |
diff --git a/src/gpu/GrFontScaler.cpp b/src/gpu/GrFontScaler.cpp |
index cc98ac58adb22f421fef42462479d7b101b13f54..84fd58133c634f4936a5aae256280cfeeb575b2d 100644 |
--- a/src/gpu/GrFontScaler.cpp |
+++ b/src/gpu/GrFontScaler.cpp |
@@ -46,10 +46,7 @@ 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)); |
+GrMaskFormat GrFontScaler::getPackedGlyphMaskFormat(const SkGlyph& glyph) const { |
SkMask::Format format = static_cast<SkMask::Format>(glyph.fMaskFormat); |
switch (format) { |
case SkMask::kBW_Format: |
@@ -66,19 +63,13 @@ GrMaskFormat GrFontScaler::getPackedGlyphMaskFormat(GrGlyph::PackedID packed) co |
} |
} |
-bool GrFontScaler::getPackedGlyphBounds(GrGlyph::PackedID packed, SkIRect* bounds) { |
- const SkGlyph& glyph = fStrike->getGlyphIDMetrics(GrGlyph::UnpackID(packed), |
- GrGlyph::UnpackFixedX(packed), |
- GrGlyph::UnpackFixedY(packed)); |
+bool GrFontScaler::getPackedGlyphBounds(const SkGlyph& glyph, SkIRect* bounds) { |
bounds->setXYWH(glyph.fLeft, glyph.fTop, glyph.fWidth, glyph.fHeight); |
return true; |
} |
-bool GrFontScaler::getPackedGlyphDFBounds(GrGlyph::PackedID packed, SkIRect* bounds) { |
- const SkGlyph& glyph = fStrike->getGlyphIDMetrics(GrGlyph::UnpackID(packed), |
- GrGlyph::UnpackFixedX(packed), |
- GrGlyph::UnpackFixedY(packed)); |
+bool GrFontScaler::getPackedGlyphDFBounds(const SkGlyph& glyph, SkIRect* bounds) { |
bounds->setXYWH(glyph.fLeft, glyph.fTop, glyph.fWidth, glyph.fHeight); |
bounds->outset(SK_DistanceFieldPad, SK_DistanceFieldPad); |
@@ -111,12 +102,8 @@ void expand_bits(INT_TYPE* dst, |
} |
} |
-bool GrFontScaler::getPackedGlyphImage(GrGlyph::PackedID packed, |
- int width, int height, |
- int dstRB, void* dst) { |
- const SkGlyph& glyph = fStrike->getGlyphIDMetrics(GrGlyph::UnpackID(packed), |
- GrGlyph::UnpackFixedX(packed), |
- GrGlyph::UnpackFixedY(packed)); |
+bool GrFontScaler::getPackedGlyphImage(const SkGlyph& glyph, int width, int height, int dstRB, |
+ void* dst) { |
SkASSERT(glyph.fWidth == width); |
SkASSERT(glyph.fHeight == height); |
const void* src = fStrike->findImage(glyph); |
@@ -158,12 +145,7 @@ bool GrFontScaler::getPackedGlyphImage(GrGlyph::PackedID packed, |
return true; |
} |
-bool GrFontScaler::getPackedGlyphDFImage(GrGlyph::PackedID packed, |
- int width, int height, |
- void* dst) { |
- const SkGlyph& glyph = fStrike->getGlyphIDMetrics(GrGlyph::UnpackID(packed), |
- GrGlyph::UnpackFixedX(packed), |
- GrGlyph::UnpackFixedY(packed)); |
+bool GrFontScaler::getPackedGlyphDFImage(const SkGlyph& glyph, int width, int height, void* dst) { |
SkASSERT(glyph.fWidth + 2*SK_DistanceFieldPad == width); |
SkASSERT(glyph.fHeight + 2*SK_DistanceFieldPad == height); |
const void* image = fStrike->findImage(glyph); |
@@ -192,14 +174,12 @@ bool GrFontScaler::getPackedGlyphDFImage(GrGlyph::PackedID packed, |
return true; |
} |
-// we should just return const SkPath* (NULL means false) |
-bool GrFontScaler::getGlyphPath(uint16_t glyphID, SkPath* path) { |
+const SkPath* GrFontScaler::getGlyphPath(const SkGlyph& glyph) { |
+ return fStrike->findPath(glyph); |
+} |
- const SkGlyph& glyph = fStrike->getGlyphIDMetrics(glyphID); |
- const SkPath* skPath = fStrike->findPath(glyph); |
- if (skPath) { |
- *path = *skPath; |
- return true; |
- } |
- return false; |
+const SkGlyph& GrFontScaler::grToSkGlyph(GrGlyph::PackedID id) { |
+ return fStrike->getGlyphIDMetrics(GrGlyph::UnpackID(id), |
+ GrGlyph::UnpackFixedX(id), |
+ GrGlyph::UnpackFixedY(id)); |
} |