inline common case when we are left-aligned in drawPosText

Review URL: https://codereview.appspot.com/6051051

git-svn-id: http://skia.googlecode.com/svn/trunk@3727 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2012-04-18 18:32:04 +00:00
parent 168e63418c
commit aeb0786405

View File

@ -1848,22 +1848,39 @@ void SkDraw::drawPosText(const char text[], size_t byteLength,
}
}
} else { // not subpixel
while (text < stop) {
// the last 2 parameters are ignored
const SkGlyph& glyph = glyphCacheProc(cache, &text, 0, 0);
if (SkPaint::kLeft_Align == paint.getTextAlign()) {
while (text < stop) {
// the last 2 parameters are ignored
const SkGlyph& glyph = glyphCacheProc(cache, &text, 0, 0);
if (glyph.fWidth) {
tmsProc(tms, pos);
if (glyph.fWidth) {
tmsProc(tms, pos);
SkIPoint fixedLoc;
alignProc(tms.fLoc, glyph, &fixedLoc);
proc(d1g,
fixedLoc.fX + SK_FixedHalf,
fixedLoc.fY + SK_FixedHalf,
glyph);
proc(d1g,
SkScalarToFixed(tms.fLoc.fX) + SK_FixedHalf,
SkScalarToFixed(tms.fLoc.fY) + SK_FixedHalf,
glyph);
}
pos += scalarsPerPosition;
}
} else {
while (text < stop) {
// the last 2 parameters are ignored
const SkGlyph& glyph = glyphCacheProc(cache, &text, 0, 0);
if (glyph.fWidth) {
tmsProc(tms, pos);
SkIPoint fixedLoc;
alignProc(tms.fLoc, glyph, &fixedLoc);
proc(d1g,
fixedLoc.fX + SK_FixedHalf,
fixedLoc.fY + SK_FixedHalf,
glyph);
}
pos += scalarsPerPosition;
}
pos += scalarsPerPosition;
}
}
}