Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Unified Diff: src/pdf/SkPDFDevice.cpp

Issue 1718423002: Simplify and combine SkDrawCacheProc and SkMeasureCacheProc to SkPaint::GlyphCacheProc. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/text/GrTextUtils.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFDevice.cpp
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 0e11f617084b8052bb4c302ad62ad2e434c90bd8..315c84317d72c42abc3da60b7e388d463b3a9c22 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -80,7 +80,7 @@ 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,
+static void align_text(SkPaint::GlyphCacheProc glyphCacheProc, const SkPaint& paint,
const uint16_t* glyphs, size_t len,
SkScalar* x, SkScalar* y) {
if (paint.getTextAlign() == SkPaint::kLeft_Align) {
@@ -98,7 +98,7 @@ static void align_text(SkDrawCacheProc glyphCacheProc, const SkPaint& paint,
// TODO(vandebo): This probably needs to take kerning into account.
while (start < stop) {
- const SkGlyph& glyph = glyphCacheProc(cache, &start, 0, 0);
+ const SkGlyph& glyph = glyphCacheProc(cache, &start);
xAdv += glyph.fAdvanceX;
yAdv += glyph.fAdvanceY;
};
@@ -1302,7 +1302,7 @@ void SkPDFDevice::drawText(const SkDraw& d, const void* text, size_t len,
int numGlyphs = force_glyph_encoding(paint, text, len, &storage, &glyphIDs);
textPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
- SkDrawCacheProc glyphCacheProc = textPaint.getDrawCacheProc();
+ SkPaint::GlyphCacheProc glyphCacheProc = textPaint.getGlyphCacheProc(true);
align_text(glyphCacheProc, textPaint, glyphIDs, numGlyphs, &x, &y);
content.entry()->fContent.writeText("BT\n");
set_text_transform(x, y, textPaint.getTextSkewX(),
@@ -1378,7 +1378,7 @@ void SkPDFDevice::drawPosText(const SkDraw& d, const void* text, size_t len,
size_t numGlyphs = force_glyph_encoding(paint, text, len, &storage, &glyphIDs);
textPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
- SkDrawCacheProc glyphCacheProc = textPaint.getDrawCacheProc();
+ SkPaint::GlyphCacheProc glyphCacheProc = textPaint.getGlyphCacheProc(true);
content.entry()->fContent.writeText("BT\n");
this->updateFont(textPaint, glyphIDs[0], content.entry());
for (size_t i = 0; i < numGlyphs; i++) {
« no previous file with comments | « src/gpu/text/GrTextUtils.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698