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

Unified Diff: Source/platform/graphics/GraphicsContext.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/mac/FontMac.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/GraphicsContext.cpp
diff --git a/Source/platform/graphics/GraphicsContext.cpp b/Source/platform/graphics/GraphicsContext.cpp
index 8c3c69cbb93109c57ab46372a8e8d86021a23223..f40f5c98a3d134f14998cef88eab492597ef62f7 100644
--- a/Source/platform/graphics/GraphicsContext.cpp
+++ b/Source/platform/graphics/GraphicsContext.cpp
@@ -1031,6 +1031,7 @@ void GraphicsContext::drawBidiText(const Font& font, const TextRunPaintInfo& run
FloatPoint currPoint = point;
BidiCharacterRun* bidiRun = bidiRuns.firstRun();
+ float width = 0;
while (bidiRun) {
TextRun subrun = run.subRun(bidiRun->start(), bidiRun->stop() - bidiRun->start());
bool isRTL = bidiRun->level() % 2;
@@ -1039,12 +1040,12 @@ void GraphicsContext::drawBidiText(const Font& font, const TextRunPaintInfo& run
TextRunPaintInfo subrunInfo(subrun);
subrunInfo.bounds = runInfo.bounds;
- font.drawText(this, subrunInfo, currPoint, customFontNotReadyAction);
+ width = font.drawText(this, subrunInfo, currPoint, customFontNotReadyAction);
+
bidiRun = bidiRun->next();
- // FIXME: Have Font::drawText return the width of what it drew so that we don't have to re-measure here.
if (bidiRun)
- currPoint.move(font.width(subrun), 0);
+ currPoint.move(width, 0);
}
bidiRuns.deleteRuns();
« no previous file with comments | « Source/platform/fonts/mac/FontMac.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698