minor check-point for switching to glyphs

git-svn-id: http://skia.googlecode.com/svn/trunk@114 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@android.com 2009-03-09 14:51:39 +00:00
parent 5e5adfd12c
commit 60dfdbc1ae

View File

@ -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);
}