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

Unified Diff: Source/core/platform/graphics/GraphicsContext.h

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
« no previous file with comments | « Source/core/platform/graphics/FontFastPath.cpp ('k') | Source/core/platform/graphics/GraphicsContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/graphics/GraphicsContext.h
diff --git a/Source/core/platform/graphics/GraphicsContext.h b/Source/core/platform/graphics/GraphicsContext.h
index 1b196bdd459da1d3e3a14e98c477e3299ff5b40b..20a4fdf5c4c60b0d546b69a4b49381500a02b9b8 100644
--- a/Source/core/platform/graphics/GraphicsContext.h
+++ b/Source/core/platform/graphics/GraphicsContext.h
@@ -69,6 +69,7 @@ class KURL;
class GraphicsContext3D;
class PlatformContextSkiaState;
class TextRun;
+struct TextRunPaintInfo;
class TransformationMatrix;
enum TextDrawingMode {
@@ -295,6 +296,11 @@ public:
void setTrackOpaqueRegion(bool track) { m_trackOpaqueRegion = track; }
const OpaqueRegionSkia& opaqueRegion() const { return m_opaqueRegion; }
+ // The text region is empty until tracking is turned on.
+ // It is never clerared by the context.
+ void setTrackTextRegion(bool track) { m_trackTextRegion = track; }
+ const SkRect& textRegion() const { return m_textRegion; }
+
void setImageInterpolationQuality(InterpolationQuality);
InterpolationQuality imageInterpolationQuality() const;
@@ -373,9 +379,9 @@ public:
// smaller rect than the one drawn to, due to its clipping logic.
void didDrawRect(const SkRect&, const SkPaint&, const SkBitmap* = 0);
void drawRect(const SkRect&, const SkPaint&);
- void drawPosText(const void* text, size_t byteLength, const SkPoint pos[], const SkPaint&);
- void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY, const SkPaint&);
- void drawTextOnPath(const void* text, size_t byteLength, const SkPath&, const SkMatrix*, const SkPaint&);
+ void drawPosText(const void* text, size_t byteLength, const SkPoint pos[], const SkRect& textRect, const SkPaint&);
+ void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY, const SkRect& textRect, const SkPaint&);
+ void drawTextOnPath(const void* text, size_t byteLength, const SkPath&, const SkRect& textRect, const SkMatrix*, const SkPaint&);
void clip(const IntRect&);
void clip(const FloatRect&);
@@ -389,9 +395,9 @@ public:
TextDrawingModeFlags textDrawingMode() const;
void setTextDrawingMode(TextDrawingModeFlags);
- void drawText(const Font&, const TextRun&, const FloatPoint&, int from = 0, int to = -1);
- void drawEmphasisMarks(const Font&, const TextRun& , const AtomicString& mark, const FloatPoint&, int from = 0, int to = -1);
- void drawBidiText(const Font&, const TextRun&, const FloatPoint&, Font::CustomFontNotReadyAction = Font::DoNotPaintIfFontNotReady);
+ void drawText(const Font&, const TextRunPaintInfo&, const FloatPoint&);
+ void drawEmphasisMarks(const Font&, const TextRunPaintInfo&, const AtomicString& mark, const FloatPoint&);
+ void drawBidiText(const Font&, const TextRunPaintInfo&, const FloatPoint&, Font::CustomFontNotReadyAction = Font::DoNotPaintIfFontNotReady);
void drawHighlightForText(const Font&, const TextRun&, const FloatPoint&, int h, const Color& backgroundColor, ColorSpace, int from = 0, int to = -1);
void drawLineForText(const FloatPoint&, float width, bool printing);
@@ -564,6 +570,8 @@ private:
}
}
+ void didDrawTextInRect(const SkRect& textRect);
+
// null indicates painting is disabled. Never delete this object.
SkCanvas* m_canvas;
@@ -592,6 +600,10 @@ private:
OpaqueRegionSkia m_opaqueRegion;
bool m_trackOpaqueRegion;
+ // Tracks the region where text is painted via the GraphicsContext.
+ bool m_trackTextRegion;
+ SkRect m_textRegion;
+
// Are we on a high DPI display? If so, spelling and grammer markers are larger.
bool m_useHighResMarker;
// FIXME: Make this go away: crbug.com/236892
« no previous file with comments | « Source/core/platform/graphics/FontFastPath.cpp ('k') | Source/core/platform/graphics/GraphicsContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698