aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-03-09 14:51:39 +0000
committerGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-03-09 14:51:39 +0000
commit60dfdbc1aef8d8df1c35a1b8ef0ce0a81a20a8b7 (patch)
tree9b4f5c4bafbed576d1e904834cc62b5021e71459
parent5e5adfd12cc2cb194db971708cd7f34ff47e10b4 (diff)
minor check-point for switching to glyphs
git-svn-id: http://skia.googlecode.com/svn/trunk@114 2bbb7eff-a529-9590-31e7-b0007b416f81
-rwxr-xr-xsrc/ports/SkFontHost_mac.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index f0e3a93372..15a987ebdb 100755
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -393,7 +393,6 @@ void SkScalerContext_Mac::generateImage(const SkGlyph& glyph)
{
SkAutoMutexAcquire ac(gFTMutex);
SkASSERT(fLayout);
- OSStatus err;
bzero(glyph.fImage, glyph.fHeight * glyph.rowBytes());
CGContextRef contextRef = ::CGBitmapContextCreate(glyph.fImage,
@@ -408,15 +407,24 @@ void SkScalerContext_Mac::generateImage(const SkGlyph& glyph)
::CGContextSetGrayFillColor(contextRef, 1.0, 1.0);
::CGContextSetTextDrawingMode(contextRef, kCGTextFill);
+#if 1
ATSUAttributeTag tag = kATSUCGContextTag;
ByteCount size = sizeof(CGContextRef);
ATSUAttributeValuePtr value = &contextRef;
- err = ::ATSUSetLayoutControls(fLayout, 1, &tag, &size, &value);
+ OSStatus err = ::ATSUSetLayoutControls(fLayout, 1, &tag, &size, &value);
SkASSERT(!err);
err = ::ATSUDrawText(fLayout, kATSUFromTextBeginning, kATSUToTextEnd,
SkIntToFixed(-glyph.fLeft),
SkIntToFixed(glyph.fTop + glyph.fHeight));
SkASSERT(!err);
+#else
+ CGGlyph glyphID = glyph.getGlyphID();
+ CGFontRef fontRef = CGFontCreateWithPlatformFont(&fRec.fFontID);
+ CGContextSetFont(contextRef, fontRef);
+ CGContextSetFontSize(contextRef, SkScalarToFloat(fRec.fTextSize));
+ CGContextShowGlyphsAtPoint(contextRef, -glyph.fLeft,
+ glyph.fTop + glyph.fHeight, &glyphID, 1);
+#endif
::CGContextRelease(contextRef);
}