| Index: src/gpu/GrBatchFontCache.cpp
|
| diff --git a/src/gpu/GrBatchFontCache.cpp b/src/gpu/GrBatchFontCache.cpp
|
| index 2d6213c085175414adbb861a40d6c90b80d3f301..007f18a3018bed347258b07c5730e4e9efa446bb 100644
|
| --- a/src/gpu/GrBatchFontCache.cpp
|
| +++ b/src/gpu/GrBatchFontCache.cpp
|
| @@ -173,20 +173,20 @@ GrBatchTextStrike::~GrBatchTextStrike() {
|
| }
|
| }
|
|
|
| -GrGlyph* GrBatchTextStrike::generateGlyph(GrGlyph::PackedID packed,
|
| +GrGlyph* GrBatchTextStrike::generateGlyph(const SkGlyph& skGlyph, GrGlyph::PackedID packed,
|
| GrFontScaler* scaler) {
|
| SkIRect bounds;
|
| if (GrGlyph::kDistance_MaskStyle == GrGlyph::UnpackMaskStyle(packed)) {
|
| - if (!scaler->getPackedGlyphDFBounds(packed, &bounds)) {
|
| + if (!scaler->getPackedGlyphDFBounds(skGlyph, &bounds)) {
|
| return NULL;
|
| }
|
| } else {
|
| - if (!scaler->getPackedGlyphBounds(packed, &bounds)) {
|
| + if (!scaler->getPackedGlyphBounds(skGlyph, &bounds)) {
|
| return NULL;
|
| }
|
| }
|
| - GrMaskFormat format = scaler->getPackedGlyphMaskFormat(packed);
|
| -
|
| + GrMaskFormat format = scaler->getPackedGlyphMaskFormat(skGlyph);
|
| +
|
| GrGlyph* glyph = (GrGlyph*)fPool.alloc(sizeof(GrGlyph), SK_MALLOC_THROW);
|
| glyph->init(packed, bounds, format);
|
| fCache.add(glyph);
|
| @@ -206,7 +206,8 @@ void GrBatchTextStrike::removeID(GrBatchAtlas::AtlasID id) {
|
| }
|
|
|
| bool GrBatchTextStrike::addGlyphToAtlas(GrBatchTarget* batchTarget, GrGlyph* glyph,
|
| - GrFontScaler* scaler) {
|
| + GrFontScaler* scaler, const SkGlyph& skGlyph,
|
| + GrMaskFormat expectedMaskFormat) {
|
| SkASSERT(glyph);
|
| SkASSERT(scaler);
|
| SkASSERT(fCache.find(glyph->fPackedID));
|
| @@ -214,27 +215,25 @@ bool GrBatchTextStrike::addGlyphToAtlas(GrBatchTarget* batchTarget, GrGlyph* gly
|
|
|
| SkAutoUnref ar(SkSafeRef(scaler));
|
|
|
| - int bytesPerPixel = GrMaskFormatBytesPerPixel(glyph->fMaskFormat);
|
| + int bytesPerPixel = GrMaskFormatBytesPerPixel(expectedMaskFormat);
|
|
|
| size_t size = glyph->fBounds.area() * bytesPerPixel;
|
| GrAutoMalloc<1024> storage(size);
|
|
|
| if (GrGlyph::kDistance_MaskStyle == GrGlyph::UnpackMaskStyle(glyph->fPackedID)) {
|
| - if (!scaler->getPackedGlyphDFImage(glyph->fPackedID, glyph->width(),
|
| - glyph->height(),
|
| + if (!scaler->getPackedGlyphDFImage(skGlyph, glyph->width(), glyph->height(),
|
| storage.get())) {
|
| return false;
|
| }
|
| } else {
|
| - if (!scaler->getPackedGlyphImage(glyph->fPackedID, glyph->width(),
|
| - glyph->height(),
|
| - glyph->width() * bytesPerPixel,
|
| + if (!scaler->getPackedGlyphImage(skGlyph, glyph->width(), glyph->height(),
|
| + glyph->width() * bytesPerPixel, expectedMaskFormat,
|
| storage.get())) {
|
| return false;
|
| }
|
| }
|
|
|
| - bool success = fBatchFontCache->addToAtlas(this, &glyph->fID, batchTarget, glyph->fMaskFormat,
|
| + bool success = fBatchFontCache->addToAtlas(this, &glyph->fID, batchTarget, expectedMaskFormat,
|
| glyph->width(), glyph->height(),
|
| storage.get(), &glyph->fAtlasLocation);
|
| if (success) {
|
|
|