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

Unified Diff: Source/core/platform/graphics/FontFastPath.cpp

Issue 14160005: Track the region where text is painted. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase with TOT Created 7 years, 8 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/platform/graphics/FontFastPath.cpp
diff --git a/Source/core/platform/graphics/FontFastPath.cpp b/Source/core/platform/graphics/FontFastPath.cpp
index e4019f001badf8b7a9bb15eeff42937fd3fe776e..691b0f2f228f5d618ef4ae96ab54f81e96800784 100644
--- a/Source/core/platform/graphics/FontFastPath.cpp
+++ b/Source/core/platform/graphics/FontFastPath.cpp
@@ -443,7 +443,7 @@ float Font::getGlyphsAndAdvancesForSimpleText(const TextRun& run, int from, int
return initialAdvance;
}
-void Font::drawSimpleText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const
+void Font::drawSimpleText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, const FloatRect& textRect, int from, int to) const
{
// This glyph buffer holds our glyphs+advances+font data for each glyph.
GlyphBuffer glyphBuffer;
@@ -454,10 +454,10 @@ void Font::drawSimpleText(GraphicsContext* context, const TextRun& run, const Fl
return;
FloatPoint startPoint(startX, point.y());
- drawGlyphBuffer(context, run, glyphBuffer, startPoint);
+ drawGlyphBuffer(context, run, glyphBuffer, startPoint, textRect);
}
-void Font::drawEmphasisMarksForSimpleText(GraphicsContext* context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const
+void Font::drawEmphasisMarksForSimpleText(GraphicsContext* context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, const FloatRect& textRect, int from, int to) const
{
GlyphBuffer glyphBuffer;
float initialAdvance = getGlyphsAndAdvancesForSimpleText(run, from, to, glyphBuffer, ForTextEmphasis);
@@ -465,10 +465,10 @@ void Font::drawEmphasisMarksForSimpleText(GraphicsContext* context, const TextRu
if (glyphBuffer.isEmpty())
return;
- drawEmphasisMarks(context, run, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y()));
+ drawEmphasisMarks(context, run, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y()), textRect);
}
-void Font::drawGlyphBuffer(GraphicsContext* context, const TextRun& run, const GlyphBuffer& glyphBuffer, const FloatPoint& point) const
+void Font::drawGlyphBuffer(GraphicsContext* context, const TextRun& run, const GlyphBuffer& glyphBuffer, const FloatPoint& point, const FloatRect& textRect) const
{
#if !ENABLE(SVG_FONTS)
UNUSED_PARAM(run);
@@ -494,7 +494,7 @@ void Font::drawGlyphBuffer(GraphicsContext* context, const TextRun& run, const G
renderingContext->drawSVGGlyphs(context, run, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint);
else
#endif
- drawGlyphs(context, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint);
+ drawGlyphs(context, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint, textRect);
lastFrom = nextGlyph;
fontData = nextFontData;
@@ -510,7 +510,7 @@ void Font::drawGlyphBuffer(GraphicsContext* context, const TextRun& run, const G
renderingContext->drawSVGGlyphs(context, run, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint);
else
#endif
- drawGlyphs(context, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint);
+ drawGlyphs(context, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint, textRect);
}
inline static float offsetToMiddleOfGlyph(const SimpleFontData* fontData, Glyph glyph)
@@ -528,7 +528,7 @@ inline static float offsetToMiddleOfGlyphAtIndex(const GlyphBuffer& glyphBuffer,
return offsetToMiddleOfGlyph(glyphBuffer.fontDataAt(i), glyphBuffer.glyphAt(i));
}
-void Font::drawEmphasisMarks(GraphicsContext* context, const TextRun& run, const GlyphBuffer& glyphBuffer, const AtomicString& mark, const FloatPoint& point) const
+void Font::drawEmphasisMarks(GraphicsContext* context, const TextRun& run, const GlyphBuffer& glyphBuffer, const AtomicString& mark, const FloatPoint& point, const FloatRect& textRect) const
{
FontCachePurgePreventer purgePreventer;
@@ -556,7 +556,7 @@ void Font::drawEmphasisMarks(GraphicsContext* context, const TextRun& run, const
}
markBuffer.add(glyphBuffer.glyphAt(glyphBuffer.size() - 1) ? markGlyph : spaceGlyph, markFontData, 0);
- drawGlyphBuffer(context, run, markBuffer, startPoint);
+ drawGlyphBuffer(context, run, markBuffer, startPoint, textRect);
}
float Font::floatWidthForSimpleText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const

Powered by Google App Engine
This is Rietveld 408576698