aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf
diff options
context:
space:
mode:
authorGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-08-23 17:02:18 +0000
committerGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-08-23 17:02:18 +0000
commit9a87cee904e2d8f0ea6a0e7e3ca864262a8cb7c4 (patch)
treeb2f0faa554c28df971ad2759f1e3392b8c4e206a /src/pdf
parent471d471dcd7422e5dd9c822c1092b2ba4721dcfe (diff)
Clean up PDF code for text decoration change.
Diffstat (limited to 'src/pdf')
-rw-r--r--src/pdf/SkPDFDevice.cpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index d459392523..e72a6b7603 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -66,9 +66,9 @@ static SkPaint calculate_text_paint(const SkPaint& paint) {
// Stolen from measure_text in SkDraw.cpp and then tweaked.
static void align_text(SkDrawCacheProc glyphCacheProc, const SkPaint& paint,
- const uint16_t* glyphs, size_t len, SkScalar* x,
- SkScalar* y, SkScalar* width) {
- if (paint.getTextAlign() == SkPaint::kLeft_Align && width == NULL) {
+ const uint16_t* glyphs, size_t len,
+ SkScalar* x, SkScalar* y) {
+ if (paint.getTextAlign() == SkPaint::kLeft_Align) {
return;
}
@@ -87,9 +87,6 @@ static void align_text(SkDrawCacheProc glyphCacheProc, const SkPaint& paint,
xAdv += glyph.fAdvanceX;
yAdv += glyph.fAdvanceY;
};
- if (width) {
- *width = SkFixedToScalar(xAdv);
- }
if (paint.getTextAlign() == SkPaint::kLeft_Align) {
return;
}
@@ -809,14 +806,8 @@ void SkPDFDevice::drawText(const SkDraw& d, const void* text, size_t len,
memcpy(glyphIDs, text, len);
}
- SkScalar width;
- SkScalar* widthPtr = NULL;
- if (textPaint.isUnderlineText() || textPaint.isStrikeThruText())
- widthPtr = &width;
-
SkDrawCacheProc glyphCacheProc = textPaint.getDrawCacheProc();
- align_text(glyphCacheProc, textPaint, glyphIDs, numGlyphs, &x, &y,
- widthPtr);
+ align_text(glyphCacheProc, textPaint, glyphIDs, numGlyphs, &x, &y);
content.entry()->fContent.writeText("BT\n");
set_text_transform(x, y, textPaint.getTextSkewX(),
&content.entry()->fContent);
@@ -880,7 +871,7 @@ void SkPDFDevice::drawPosText(const SkDraw& d, const void* text, size_t len,
fFontGlyphUsage->noteGlyphUsage(font, &encodedValue, 1);
SkScalar x = pos[i * scalarsPerPos];
SkScalar y = scalarsPerPos == 1 ? constY : pos[i * scalarsPerPos + 1];
- align_text(glyphCacheProc, textPaint, glyphIDs + i, 1, &x, &y, NULL);
+ align_text(glyphCacheProc, textPaint, glyphIDs + i, 1, &x, &y);
set_text_transform(x, y, textPaint.getTextSkewX(),
&content.entry()->fContent);
SkString encodedString =