aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/utils
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-22 13:19:12 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-22 13:19:12 +0000
commitad254fee73ad70a45acba69dccb9b65f88c3a92a (patch)
tree12b18a7e1d9f810991864d61120bd74a7d72a1b1 /include/utils
parentdb6fa1729a5117e1bdacd6c237373812cd44a7c0 (diff)
If the path is a rect, call drawRect to raster the geometry in SkCanvas::drawPath to get better performance.
Committed: http://code.google.com/p/skia/source/detail?r=11842 R=bsalomon@google.com Review URL: https://codereview.chromium.org/23484007 git-svn-id: http://skia.googlecode.com/svn/trunk@11904 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/utils')
-rw-r--r--include/utils/SkDeferredCanvas.h5
-rw-r--r--include/utils/SkDumpCanvas.h6
-rw-r--r--include/utils/SkLuaCanvas.h6
-rw-r--r--include/utils/SkNWayCanvas.h4
-rw-r--r--include/utils/SkProxyCanvas.h6
5 files changed, 16 insertions, 11 deletions
diff --git a/include/utils/SkDeferredCanvas.h b/include/utils/SkDeferredCanvas.h
index c0613ed544..052c667123 100644
--- a/include/utils/SkDeferredCanvas.h
+++ b/include/utils/SkDeferredCanvas.h
@@ -162,10 +162,7 @@ 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;
@@ -234,6 +231,8 @@ 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 96b45e7ba2..d3ff9a1c18 100644
--- a/include/utils/SkDumpCanvas.h
+++ b/include/utils/SkDumpCanvas.h
@@ -93,9 +93,7 @@ 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,
@@ -126,6 +124,10 @@ 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 c34d134423..b604d3c92c 100644
--- a/include/utils/SkLuaCanvas.h
+++ b/include/utils/SkLuaCanvas.h
@@ -42,9 +42,7 @@ 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,
@@ -72,6 +70,10 @@ 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 c48bcab3c4..6791c51d58 100644
--- a/include/utils/SkNWayCanvas.h
+++ b/include/utils/SkNWayCanvas.h
@@ -43,9 +43,7 @@ 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,
@@ -80,6 +78,8 @@ 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 383e532fbf..54cdc3b2b0 100644
--- a/include/utils/SkProxyCanvas.h
+++ b/include/utils/SkProxyCanvas.h
@@ -48,9 +48,7 @@ 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,
@@ -85,6 +83,10 @@ 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;