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

Unified Diff: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 14160005: Track the region where text is painted. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed build on win and mac Created 7 years, 7 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
Index: Source/core/html/canvas/CanvasRenderingContext2D.cpp
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
index a986d81fab5afedf2a0afc40540d2da38ef33423..fd7ab2e56cefa4195e766bbbf83f68c4e79c19db 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
@@ -2191,10 +2191,13 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
}
// The slop built in to this mask rect matches the heuristic used in FontCGWin.cpp for GDI text.
- FloatRect textRect = FloatRect(location.x() - fontMetrics.height() / 2, location.y() - fontMetrics.ascent() - fontMetrics.lineGap(),
- width + fontMetrics.height(), fontMetrics.lineSpacing());
+ TextRunPaintInfo textRunPaintInfo(textRun);
+ textRunPaintInfo.bounds = FloatRect(location.x() - fontMetrics.height() / 2,
+ location.y() - fontMetrics.ascent() - fontMetrics.lineGap(),
+ width + fontMetrics.height(),
+ fontMetrics.lineSpacing());
if (!fill)
- inflateStrokeRect(textRect);
+ inflateStrokeRect(textRunPaintInfo.bounds);
c->setTextDrawingMode(fill ? TextModeFill : TextModeStroke);
if (useMaxWidth) {
@@ -2202,11 +2205,11 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
c->translate(location.x(), location.y());
// We draw when fontWidth is 0 so compositing operations (eg, a "copy" op) still work.
c->scale(FloatSize((fontWidth > 0 ? (width / fontWidth) : 0), 1));
- c->drawBidiText(font, textRun, FloatPoint(0, 0), Font::UseFallbackIfFontNotReady);
+ c->drawBidiText(font, textRunPaintInfo, FloatPoint(0, 0), Font::UseFallbackIfFontNotReady);
} else
- c->drawBidiText(font, textRun, location, Font::UseFallbackIfFontNotReady);
+ c->drawBidiText(font, textRunPaintInfo, location, Font::UseFallbackIfFontNotReady);
- didDraw(textRect);
+ didDraw(textRunPaintInfo.bounds);
}
void CanvasRenderingContext2D::inflateStrokeRect(FloatRect& rect) const
« no previous file with comments | « Source/WebKit/chromium/tests/GraphicsContextTest.cpp ('k') | Source/core/platform/chromium/PopupListBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698