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

Unified Diff: include/core/SkCanvas.h

Issue 23484007: call drawRect to try GrAARectRenderer if the path is a rect (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: rebase to ToT Created 7 years, 2 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 | « experimental/SimpleCocoaApp/SimpleApp.mm ('k') | include/utils/SkDeferredCanvas.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkCanvas.h
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index dc3953ed4b1df71634992a1bec5bd1d7a85450e3..68695854198b7bfbe6125a3289814a3b230d7f4b 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -575,16 +575,20 @@ public:
will be filled or stroked based on the Style in the paint.
@param rect The rect to be drawn
@param paint The paint used to draw the rect
+
+ Overriding this function is deprecated. It will be made non-virtual
+ soon. Instead override onDrawRect.
*/
- virtual void drawRect(const SkRect& rect, const SkPaint& paint);
+ virtual void drawRect(const SkRect& rect, const SkPaint& paint) {
+ 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.
@param rect The rect to be drawn
@param paint The paint used to draw the rect
*/
- void drawIRect(const SkIRect& rect, const SkPaint& paint)
- {
+ void drawIRect(const SkIRect& rect, const SkPaint& paint) {
SkRect r;
r.set(rect); // promotes the ints to scalars
this->drawRect(r, paint);
@@ -656,8 +660,18 @@ public:
filled or framed based on the Style in the paint.
@param path The path to be drawn
@param paint The paint used to draw the path
+
+ Overriding this function is deprecated. It will be made non-virtual
+ soon. Instead override onDrawRect.
*/
- virtual void drawPath(const SkPath& path, const SkPaint& paint);
+ virtual void drawPath(const SkPath& path, const SkPaint& paint) {
+ SkRect rect;
+ if (path.isRect(&rect) && !path.isInverseFillType()) {
+ 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 +1048,10 @@ protected:
// can perform copy-on-write or invalidate any cached images
void predrawNotify();
+ virtual void onDrawRect(const SkRect& rect, const SkPaint& paint);
+
+ 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
« no previous file with comments | « experimental/SimpleCocoaApp/SimpleApp.mm ('k') | include/utils/SkDeferredCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698