Chromium Code Reviews| Index: Source/core/platform/graphics/skia/PlatformContextSkia.h |
| diff --git a/Source/core/platform/graphics/skia/PlatformContextSkia.h b/Source/core/platform/graphics/skia/PlatformContextSkia.h |
| index d33b9583b73424a979e92da367407b8c5eadbd34..1ccfe1142e167facff4503d5c0b69e63353b1ce5 100644 |
| --- a/Source/core/platform/graphics/skia/PlatformContextSkia.h |
| +++ b/Source/core/platform/graphics/skia/PlatformContextSkia.h |
| @@ -186,6 +186,10 @@ public: |
| // This will be an empty region unless tracking is enabled. |
| const OpaqueRegionSkia& opaqueRegion() const { return m_opaqueRegion; } |
| + void setTrackTextRegion(bool track) { m_trackTextRegion = track; } |
| + // This will be an empty region unless tracking is enabled. |
| + const SkRect& textRegion() const { return m_textRegion; } |
| + |
| // After drawing directly to the context's canvas, use this function to notify the context so |
| // it can track the opaque region. |
| // FIXME: this is still needed only because ImageSkia::paintSkBitmap() may need to notify for a |
| @@ -238,10 +242,10 @@ public: |
| void drawRect(const SkRect&, const SkPaint&); |
| void drawIRect(const SkIRect&, const SkPaint&); |
| void drawRRect(const SkRRect&, const SkPaint&); |
| - void drawPosText(const void* text, size_t byteLength, const SkPoint pos[], 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 SkPaint&); |
| - void drawTextOnPath(const void* text, size_t byteLength, const SkPath&, |
| + const SkRect& textRect, const SkPaint&); |
| + void drawTextOnPath(const void* text, size_t byteLength, const SkPath&, const SkRect& textRect, |
| const SkMatrix*, const SkPaint&); |
| private: |
| @@ -255,6 +259,8 @@ private: |
| void realizeSave(SkCanvas::SaveFlags); |
| + void trackTextRegion(const SkRect& textRect); |
| + |
| // Defines drawing style. |
| struct State; |
| @@ -282,6 +288,10 @@ private: |
| OpaqueRegionSkia m_opaqueRegion; |
| bool m_trackOpaqueRegion; |
| + // Tracks the region where text is painted via GraphicsContext. |
| + bool m_trackTextRegion; |
| + SkRect m_textRegion; |
| + |
| bool m_printing; |
| bool m_accelerated; |
| bool m_drawingToImageBuffer; |
| @@ -476,30 +486,44 @@ inline void PlatformContextSkia::drawRRect(const SkRRect& rect, const SkPaint& p |
| m_opaqueRegion.didDrawBounded(this, rect.getBounds(), paint); |
| } |
| -inline void PlatformContextSkia::drawPosText(const void* text, size_t byteLength, |
| - const SkPoint pos[], const SkPaint& paint) |
| +inline void PlatformContextSkia::drawPosText(const void* text, |
| + size_t byteLength, |
| + const SkPoint pos[], |
| + const SkRect& textRect, |
| + const SkPaint& paint) |
| { |
| m_canvas->drawPosText(text, byteLength, pos, paint); |
| + trackTextRegion(textRect); |
|
eseidel
2013/04/18 21:04:38
Do we ever stop tracking? Should this be didDrawT
alokp
2013/04/18 22:22:37
I like didDrawTextInRect. Changed.
|
| // FIXME: compute bounds for positioned text. |
| if (m_trackOpaqueRegion) |
| m_opaqueRegion.didDrawUnbounded(this, paint, OpaqueRegionSkia::FillOrStroke); |
| } |
| -inline void PlatformContextSkia::drawPosTextH(const void* text, size_t byteLength, |
| - const SkScalar xpos[], SkScalar constY, const SkPaint& paint) |
| +inline void PlatformContextSkia::drawPosTextH(const void* text, |
| + size_t byteLength, |
| + const SkScalar xpos[], |
| + SkScalar constY, |
| + const SkRect& textRect, |
| + const SkPaint& paint) |
| { |
| m_canvas->drawPosTextH(text, byteLength, xpos, constY, paint); |
| + trackTextRegion(textRect); |
| // FIXME: compute bounds for positioned text. |
| if (m_trackOpaqueRegion) |
| m_opaqueRegion.didDrawUnbounded(this, paint, OpaqueRegionSkia::FillOrStroke); |
| } |
| -inline void PlatformContextSkia::drawTextOnPath(const void* text, size_t byteLength, |
| - const SkPath& path, const SkMatrix* matrix, const SkPaint& paint) |
| +inline void PlatformContextSkia::drawTextOnPath(const void* text, |
| + size_t byteLength, |
| + const SkPath& path, |
| + const SkRect& textRect, |
| + const SkMatrix* matrix, |
| + const SkPaint& paint) |
| { |
| m_canvas->drawTextOnPath(text, byteLength, path, matrix, paint); |
| + trackTextRegion(textRect); |
|
eseidel
2013/04/18 21:04:38
It's not clear to me that "textRect" is the right
alokp
2013/04/18 22:22:37
It does not clip right now. The plan is to use for
|
| // FIXME: compute bounds for positioned text. |
| if (m_trackOpaqueRegion) |