Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Unified Diff: src/gpu/GrBatchFontCache.cpp

Issue 1269743003: Dont try to draw glyphs with unexpected mask formats (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrBatchFontCache.h ('k') | src/gpu/GrFontScaler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrBatchFontCache.cpp
diff --git a/src/gpu/GrBatchFontCache.cpp b/src/gpu/GrBatchFontCache.cpp
index ecaa91e74d47e3e06a470abd610840fc78fd5ec1..dc5b43a54736759b2b325d8d7eccd45f40660239 100644
--- a/src/gpu/GrBatchFontCache.cpp
+++ b/src/gpu/GrBatchFontCache.cpp
@@ -196,7 +196,8 @@ void GrBatchTextStrike::removeID(GrBatchAtlas::AtlasID id) {
}
bool GrBatchTextStrike::addGlyphToAtlas(GrBatchTarget* batchTarget, GrGlyph* glyph,
- GrFontScaler* scaler, const SkGlyph& skGlyph) {
+ GrFontScaler* scaler, const SkGlyph& skGlyph,
+ GrMaskFormat expectedMaskFormat) {
SkASSERT(glyph);
SkASSERT(scaler);
SkASSERT(fCache.find(glyph->fPackedID));
@@ -204,7 +205,7 @@ 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;
SkAutoSMalloc<1024> storage(size);
@@ -216,12 +217,13 @@ bool GrBatchTextStrike::addGlyphToAtlas(GrBatchTarget* batchTarget, GrGlyph* gly
}
} else {
if (!scaler->getPackedGlyphImage(skGlyph, glyph->width(), glyph->height(),
- glyph->width() * bytesPerPixel, storage.get())) {
+ 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) {
« no previous file with comments | « src/gpu/GrBatchFontCache.h ('k') | src/gpu/GrFontScaler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698