Chromium Code Reviews| Index: include/core/SkCanvas.h |
| diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h |
| index cfc252fccfc191c64804b4edfd172ba2e9b066e1..bd510e6d89fa4c2529fd537ba7add5b76618f93c 100644 |
| --- a/include/core/SkCanvas.h |
| +++ b/include/core/SkCanvas.h |
| @@ -576,7 +576,10 @@ public: |
| @param rect The rect to be drawn |
| @param paint The paint used to draw the rect |
| */ |
| - virtual void drawRect(const SkRect& rect, const SkPaint& paint); |
| + void drawRect(const SkRect& rect, const SkPaint& paint) |
| + { |
|
bsalomon
2013/10/15 13:25:51
style nit: brace on prev line.
|
| + this->onDrawRect(rect, paint); |
| + } |
| /** Draw the specified rectangle using the specified paint. The rectangle |
| will be filled or framed based on the Style in the paint. |
| @@ -657,7 +660,14 @@ public: |
| @param path The path to be drawn |
| @param paint The paint used to draw the path |
| */ |
| - virtual void drawPath(const SkPath& path, const SkPaint& paint); |
| + void drawPath(const SkPath& path, const SkPaint& paint) { |
| + SkRect rect; |
| + if (path.isRect(&rect)) { |
| + this->onDrawRect(rect, paint); |
| + } else { |
| + this->onDrawPath(path, paint); |
| + } |
| + } |
| /** Draw the specified bitmap, with its top/left corner at (x,y), using the |
| specified paint, transformed by the current matrix. Note: if the paint |
| @@ -1034,6 +1044,10 @@ protected: |
| // can perform copy-on-write or invalidate any cached images |
| void predrawNotify(); |
| + virtual void onDrawRect(const SkRect& rect, const SkPaint& paint); |
|
bsalomon
2013/10/15 13:25:51
Since these are protected the subclasses should no
|
| + |
| + virtual void onDrawPath(const SkPath& path, const SkPaint& paint); |
| + |
| /** DEPRECATED -- use constructor(device) |
| Marked as 'protected' to avoid new clients using this before we can |