diff options
author | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-10-22 16:54:15 +0000 |
---|---|---|
committer | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-10-22 16:54:15 +0000 |
commit | 7ce564cccb246ec56427085872b2e1458fe74bd1 (patch) | |
tree | 0018fffb8bb19b9cbee7b12cbf802f746aaf0bbd /include | |
parent | c294a97842d6d24b220e7512a8043b93554ed40e (diff) |
Revert "If the path is a rect, call drawRect to raster the geometry in SkCanvas::drawPath to get better performance."
This reverts commit r11904
Review URL: https://codereview.chromium.org/35543002
git-svn-id: http://skia.googlecode.com/svn/trunk@11909 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkCanvas.h | 26 | ||||
-rw-r--r-- | include/utils/SkDeferredCanvas.h | 5 | ||||
-rw-r--r-- | include/utils/SkDumpCanvas.h | 6 | ||||
-rw-r--r-- | include/utils/SkLuaCanvas.h | 6 | ||||
-rw-r--r-- | include/utils/SkNWayCanvas.h | 4 | ||||
-rw-r--r-- | include/utils/SkProxyCanvas.h | 6 |
6 files changed, 15 insertions, 38 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 6869585419..dc3953ed4b 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -575,20 +575,16 @@ 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) { - this->onDrawRect(rect, paint); - } + virtual void drawRect(const SkRect& rect, const SkPaint& 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); @@ -660,18 +656,8 @@ 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) { - SkRect rect; - if (path.isRect(&rect) && !path.isInverseFillType()) { - this->onDrawRect(rect, paint); - } else { - this->onDrawPath(path, paint); - } - } + virtual void drawPath(const SkPath& path, const SkPaint& 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 @@ -1048,10 +1034,6 @@ 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 diff --git a/include/utils/SkDeferredCanvas.h b/include/utils/SkDeferredCanvas.h index 052c667123..c0613ed544 100644 --- a/include/utils/SkDeferredCanvas.h +++ b/include/utils/SkDeferredCanvas.h @@ -162,7 +162,10 @@ public: virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint& paint) SK_OVERRIDE; virtual void drawOval(const SkRect&, const SkPaint& paint) SK_OVERRIDE; + virtual void drawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE; virtual void drawRRect(const SkRRect&, const SkPaint& paint) SK_OVERRIDE; + virtual void drawPath(const SkPath& path, const SkPaint& paint) + SK_OVERRIDE; virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, const SkPaint* paint) SK_OVERRIDE; @@ -231,8 +234,6 @@ public: }; protected: - virtual void onDrawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE; - virtual void onDrawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE; virtual SkCanvas* canvasForDrawIter(); DeferredDevice* getDeferredDevice() const; diff --git a/include/utils/SkDumpCanvas.h b/include/utils/SkDumpCanvas.h index d3ff9a1c18..96b45e7ba2 100644 --- a/include/utils/SkDumpCanvas.h +++ b/include/utils/SkDumpCanvas.h @@ -93,7 +93,9 @@ public: virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint& paint) SK_OVERRIDE; virtual void drawOval(const SkRect&, const SkPaint& paint) SK_OVERRIDE; + virtual void drawRect(const SkRect&, const SkPaint& paint) SK_OVERRIDE; virtual void drawRRect(const SkRRect&, const SkPaint& paint) SK_OVERRIDE; + virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE; virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, const SkPaint* paint) SK_OVERRIDE; virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, @@ -124,10 +126,6 @@ public: virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE; virtual void endCommentGroup() SK_OVERRIDE; -protected: - virtual void onDrawRect(const SkRect&, const SkPaint& paint) SK_OVERRIDE; - virtual void onDrawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE; - private: Dumper* fDumper; int fNestLevel; // for nesting recursive elements like pictures diff --git a/include/utils/SkLuaCanvas.h b/include/utils/SkLuaCanvas.h index b604d3c92c..c34d134423 100644 --- a/include/utils/SkLuaCanvas.h +++ b/include/utils/SkLuaCanvas.h @@ -42,7 +42,9 @@ public: virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint& paint) SK_OVERRIDE; virtual void drawOval(const SkRect&, const SkPaint& paint) SK_OVERRIDE; + virtual void drawRect(const SkRect&, const SkPaint& paint) SK_OVERRIDE; virtual void drawRRect(const SkRRect&, const SkPaint& paint) SK_OVERRIDE; + virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE; virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, const SkPaint* paint) SK_OVERRIDE; virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, @@ -70,10 +72,6 @@ public: const SkPaint& paint) SK_OVERRIDE; virtual void drawData(const void* data, size_t length) SK_OVERRIDE; -protected: - virtual void onDrawRect(const SkRect&, const SkPaint& paint) SK_OVERRIDE; - virtual void onDrawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE; - private: lua_State* fL; SkString fFunc; diff --git a/include/utils/SkNWayCanvas.h b/include/utils/SkNWayCanvas.h index 6791c51d58..c48bcab3c4 100644 --- a/include/utils/SkNWayCanvas.h +++ b/include/utils/SkNWayCanvas.h @@ -43,7 +43,9 @@ public: virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint&) SK_OVERRIDE; virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE; + virtual void drawRect(const SkRect&, const SkPaint&) SK_OVERRIDE; virtual void drawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE; + virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE; virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE; virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, @@ -78,8 +80,6 @@ public: virtual void endCommentGroup() SK_OVERRIDE; protected: - virtual void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE; - virtual void onDrawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE; SkTDArray<SkCanvas*> fList; class Iter; diff --git a/include/utils/SkProxyCanvas.h b/include/utils/SkProxyCanvas.h index 54cdc3b2b0..383e532fbf 100644 --- a/include/utils/SkProxyCanvas.h +++ b/include/utils/SkProxyCanvas.h @@ -48,7 +48,9 @@ public: virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint& paint) SK_OVERRIDE; virtual void drawOval(const SkRect&, const SkPaint& paint) SK_OVERRIDE; + virtual void drawRect(const SkRect&, const SkPaint& paint) SK_OVERRIDE; virtual void drawRRect(const SkRRect&, const SkPaint& paint) SK_OVERRIDE; + virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE; virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, const SkPaint* paint = NULL) SK_OVERRIDE; virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, @@ -83,10 +85,6 @@ public: virtual SkBounder* setBounder(SkBounder* bounder) SK_OVERRIDE; virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE; -protected: - virtual void onDrawRect(const SkRect&, const SkPaint& paint) SK_OVERRIDE; - virtual void onDrawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE; - private: SkCanvas* fProxy; |