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

Unified Diff: src/ports/SkFontHost_mac.cpp

Issue 796783003: Work around CG assert drawing tiny glyphs. (Closed) Base URL: https://skia.googlesource.com/skia.git@m40
Patch Set: Created 6 years 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 2f991c8615cbbf9d7fcb1ba1b1daf2b12a6a86cb..8c1abc91caeec0c42e07edb5b2e71b33aa365903 100755
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -741,9 +741,12 @@ SkScalerContext_Mac::SkScalerContext_Mac(SkTypeface_Mac* typeface,
CGFloat textSize = ScalarToCG(fRec.fTextSize);
// If a text size of 0 is requested, CoreGraphics will use 12 instead.
- // If the text size is 0, set it to something tiny.
+ // It would make sense to force the text size to something tiny,
+ // but this causes assertion failures inside CG (drawing glyphs at CGFLOAT_MIN size).
+ // Instead, set such tiny sizes to 1, and transform them down to 0 with a singular transform.
if (textSize < CGFLOAT_MIN) {
- textSize = CGFLOAT_MIN;
+ textSize = 1;
+ transform = CGAffineTransformMakeScale(0, 0);
}
fCTFont.reset(CTFontCreateCopyWithAttributes(ctFont, textSize, &transform, ctFontDesc));
« 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