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

Unified Diff: src/ports/SkFontHost_mac.cpp

Issue 1076183004: Ammend font table data experiment on Mac. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontHost_mac.cpp
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index 836576bc2a2adc7e067080817f49df02141fe925..5eaf7df6036b281fe08560d07baeef9e418fa7fe 100755
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -913,6 +913,14 @@ CGRGBPixel* Offscreen::getCG(const SkScalerContext_Mac& context, const SkGlyph&
AutoCFRelease<CFDataRef> sbix;
if (static_cast<SkTypeface_Mac*>(context.getTypeface())->fHasColorGlyphs) {
sbix.reset(CGFontCopyTableForTag(context.fCGFont, 'sbix'));
+ // Attempt to read from the sbix table data to determine if the returned data is valid.
+ const UInt8* sbixData = CFDataGetBytePtr(sbix);
+ CFIndex sbixLength = CFDataGetLength(sbix);
+ if (sbixLength > 0 && *sbixData > 0x80) {
+ // We need to actually do something to avoid this being optimized away.
+ CFRetain(sbix);
+ CFRelease(sbix);
+ }
}
ctFontDrawGlyphs(context.fCTUnrotatedFont, &glyphID, &point, 1, fCG);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698