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

Unified Diff: Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp

Issue 519373002: Return width from drawText to stop re-measure in Canvas (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updating Test Expectation file Created 6 years, 3 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 | « Source/platform/fonts/Font.cpp ('k') | Source/platform/fonts/mac/FontComplexTextMac.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp
diff --git a/Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp b/Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp
index 2ec7f1d021888f0421fa8f6cd498ef3a5c85e50e..f7c6289cb1d54ec33e32e6259b54b30accd02818 100644
--- a/Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp
+++ b/Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp
@@ -223,25 +223,25 @@ void Font::drawTextBlob(GraphicsContext* gc, const SkTextBlob* blob, const SkPoi
}
}
-void Font::drawComplexText(GraphicsContext* gc, const TextRunPaintInfo& runInfo, const FloatPoint& point) const
+float Font::drawComplexText(GraphicsContext* gc, const TextRunPaintInfo& runInfo, const FloatPoint& point) const
{
if (!runInfo.run.length())
- return;
+ return 0;
TextDrawingModeFlags textMode = gc->textDrawingMode();
bool fill = textMode & TextModeFill;
bool stroke = (textMode & TextModeStroke) && gc->hasStroke();
if (!fill && !stroke)
- return;
+ return 0;
GlyphBuffer glyphBuffer;
HarfBuzzShaper shaper(this, runInfo.run);
shaper.setDrawRange(runInfo.from, runInfo.to);
if (!shaper.shape(&glyphBuffer) || glyphBuffer.isEmpty())
- return;
+ return 0;
FloatPoint adjustedPoint = shaper.adjustStartPoint(point);
- drawGlyphBuffer(gc, runInfo, glyphBuffer, adjustedPoint);
+ return drawGlyphBuffer(gc, runInfo, glyphBuffer, adjustedPoint);
}
void Font::drawEmphasisMarksForComplexText(GraphicsContext* context, const TextRunPaintInfo& runInfo, const AtomicString& mark, const FloatPoint& point) const
@@ -299,7 +299,7 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run,
return shaper.selectionRect(point, height, from, to);
}
-PassTextBlobPtr Font::buildTextBlob(const GlyphBuffer& glyphBuffer, float initialAdvance, const FloatRect& bounds) const
+PassTextBlobPtr Font::buildTextBlob(const GlyphBuffer& glyphBuffer, float initialAdvance, const FloatRect& bounds, float& advance) const
{
// FIXME: Except for setupPaint, this is not specific to FontHarfBuzz.
// FIXME: Also implement the more general full-positioning path.
@@ -345,6 +345,7 @@ PassTextBlobPtr Font::buildTextBlob(const GlyphBuffer& glyphBuffer, float initia
}
}
+ advance = x;
return adoptRef(builder.build());
}
« no previous file with comments | « Source/platform/fonts/Font.cpp ('k') | Source/platform/fonts/mac/FontComplexTextMac.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698