Bug 895078. Implement ScaledFontMac::CopyGlyphsToBuilder. r=mattwoodrow

--HG--
extra : rebase_source : e18c584de856676b84c9aac50021f255185a677a
This commit is contained in:
Jeff Muizelaar 2013-07-16 11:25:49 -04:00
parent 8566657ec1
commit 390cefe9d9
3 changed files with 22 additions and 0 deletions

View File

@ -48,6 +48,7 @@ public:
private:
friend class PathCG;
friend class ScaledFontMac;
void EnsureActive(const Point &aPoint);

View File

@ -101,5 +101,25 @@ ScaledFontMac::GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aT
}
}
void
ScaledFontMac::CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder)
{
PathBuilderCG *pathBuilderCG =
static_cast<PathBuilderCG*>(aBuilder);
// XXX: check builder type
for (unsigned int i = 0; i < aBuffer.mNumGlyphs; i++) {
// XXX: we could probably fold both of these transforms together to avoid extra work
CGAffineTransform flip = CGAffineTransformMakeScale(1, -1);
CGPathRef glyphPath = ::CGFontGetGlyphPath(mFont, &flip, 0, aBuffer.mGlyphs[i].mIndex);
CGAffineTransform matrix = CGAffineTransformMake(mSize, 0, 0, mSize,
aBuffer.mGlyphs[i].mPosition.x,
aBuffer.mGlyphs[i].mPosition.y);
CGPathAddPath(pathBuilderCG->mCGPath, &matrix, glyphPath);
CGPathRelease(glyphPath);
}
}
}
}

View File

@ -25,6 +25,7 @@ public:
virtual SkTypeface* GetSkTypeface();
#endif
virtual TemporaryRef<Path> GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget);
virtual void CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder);
private:
friend class DrawTargetCG;