aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed <reed@chromium.org>2015-01-04 21:09:04 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-04 21:09:04 -0800
commit2e0f7d53bba5438c9bf11ee5ccae2c301e348419 (patch)
tree51f14164a524fff3b3f1b3043b8399c89e72e3f9
parentede901c7a2e21a44552b8c1436d9521ce33f4de5 (diff)
move remaining virtual draw methods to onDraw
-rw-r--r--gyp/skia_for_android_framework_defines.gypi1
-rw-r--r--gyp/skia_for_chromium_defines.gypi1
-rw-r--r--include/core/SkCanvas.h52
-rw-r--r--include/core/SkImage.h1
-rw-r--r--include/utils/SkDeferredCanvas.h52
-rw-r--r--include/utils/SkDumpCanvas.h40
-rw-r--r--include/utils/SkLuaCanvas.h41
-rw-r--r--include/utils/SkNWayCanvas.h49
-rw-r--r--include/utils/SkProxyCanvas.h46
-rw-r--r--src/core/SkCanvas.cpp109
-rw-r--r--src/core/SkPictureRecord.cpp41
-rw-r--r--src/core/SkPictureRecord.h45
-rw-r--r--src/core/SkRecorder.cpp66
-rw-r--r--src/core/SkRecorder.h62
-rw-r--r--src/pipe/SkGPipeWrite.cpp85
-rw-r--r--src/utils/SkDeferredCanvas.cpp48
-rw-r--r--src/utils/SkDumpCanvas.cpp69
-rw-r--r--src/utils/SkLuaCanvas.cpp51
-rw-r--r--src/utils/SkNWayCanvas.cpp49
-rw-r--r--src/utils/SkProxyCanvas.cpp50
-rw-r--r--src/utils/debugger/SkDebugCanvas.cpp49
-rw-r--r--src/utils/debugger/SkDebugCanvas.h55
-rw-r--r--tests/RecordDrawTest.cpp10
-rw-r--r--tests/TileGridTest.cpp2
24 files changed, 585 insertions, 489 deletions
diff --git a/gyp/skia_for_android_framework_defines.gypi b/gyp/skia_for_android_framework_defines.gypi
index 50f7e0ee29..779af88b4e 100644
--- a/gyp/skia_for_android_framework_defines.gypi
+++ b/gyp/skia_for_android_framework_defines.gypi
@@ -21,6 +21,7 @@
# TODO(tfarina): Remove this when Android is fixed. skbug.com/3178
'SK_SUPPORT_LEGACY_PORTER_DUFF',
'SK_SUPPORT_LEGACY_DRAWDATA',
+ 'SK_SUPPORT_LEGACY_CANVAS_VIRTUAL',
],
},
}
diff --git a/gyp/skia_for_chromium_defines.gypi b/gyp/skia_for_chromium_defines.gypi
index 775212730e..afc17c527b 100644
--- a/gyp/skia_for_chromium_defines.gypi
+++ b/gyp/skia_for_chromium_defines.gypi
@@ -14,6 +14,7 @@
#
'skia_for_chromium_defines': [
'SK_SUPPORT_LEGACY_DRAWDATA',
+ 'SK_SUPPORT_LEGACY_CANVAS_VIRTUAL',
],
},
}
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index cb4fedefdc..f2cacf124d 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -36,6 +36,12 @@ class GrRenderTarget;
class SkCanvasState;
+#ifdef SK_SUPPORT_LEGACY_CANVAS_VIRTUAL
+ #define SK_LEGACY_CANVAS_VIRTUAL virtual
+#else
+ #define SK_LEGACY_CANVAS_VIRTUAL
+#endif
+
/** \class SkCanvas
A Canvas encapsulates all of the state about drawing into a device (bitmap).
@@ -608,7 +614,7 @@ public:
* specified paint.
* @param paint The paint used to fill the canvas
*/
- virtual void drawPaint(const SkPaint& paint);
+ SK_LEGACY_CANVAS_VIRTUAL void drawPaint(const SkPaint& paint);
enum PointMode {
/** drawPoints draws each point separately */
@@ -640,8 +646,8 @@ public:
@param pts Array of points to draw
@param paint The paint used to draw the points
*/
- virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
- const SkPaint& paint);
+ SK_LEGACY_CANVAS_VIRTUAL void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
+ const SkPaint& paint);
/** Helper method for drawing a single point. See drawPoints() for a more
details.
@@ -672,7 +678,7 @@ 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);
+ SK_LEGACY_CANVAS_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.
@@ -701,7 +707,7 @@ public:
@param oval The rectangle bounds of the oval to be drawn
@param paint The paint used to draw the oval
*/
- virtual void drawOval(const SkRect& oval, const SkPaint&);
+ SK_LEGACY_CANVAS_VIRTUAL void drawOval(const SkRect& oval, const SkPaint&);
/**
* Draw the specified RRect using the specified paint The rrect will be filled or stroked
@@ -710,7 +716,7 @@ public:
* @param rrect The round-rect to draw
* @param paint The paint used to draw the round-rect
*/
- virtual void drawRRect(const SkRRect& rrect, const SkPaint& paint);
+ SK_LEGACY_CANVAS_VIRTUAL void drawRRect(const SkRRect& rrect, const SkPaint& paint);
/**
* Draw the annulus formed by the outer and inner rrects. The results
@@ -758,7 +764,7 @@ 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);
+ SK_LEGACY_CANVAS_VIRTUAL void drawPath(const SkPath& path, const SkPaint& paint);
/** Draw the specified image, with its top/left corner at (x,y), using the
specified paint, transformed by the current matrix.
@@ -768,7 +774,7 @@ public:
@param top The position of the top side of the image being drawn
@param paint The paint used to draw the image, or NULL
*/
- virtual void drawImage(const SkImage* image, SkScalar left, SkScalar top,
+ SK_LEGACY_CANVAS_VIRTUAL void drawImage(const SkImage* image, SkScalar left, SkScalar top,
const SkPaint* paint = NULL);
/** Draw the specified image, with the specified matrix applied (before the
canvas' matrix is applied).
@@ -779,7 +785,7 @@ public:
image will be drawn
@param paint The paint used to draw the image, or NULL
*/
- virtual void drawImageRect(const SkImage* image, const SkRect* src,
+ SK_LEGACY_CANVAS_VIRTUAL void drawImageRect(const SkImage* image, const SkRect* src,
const SkRect& dst,
const SkPaint* paint = NULL);
@@ -799,7 +805,7 @@ public:
@param top The position of the top side of the bitmap being drawn
@param paint The paint used to draw the bitmap, or NULL
*/
- virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
+ SK_LEGACY_CANVAS_VIRTUAL void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
const SkPaint* paint = NULL);
enum DrawBitmapRectFlags {
@@ -820,7 +826,7 @@ public:
image will be drawn
@param paint The paint used to draw the bitmap, or NULL
*/
- virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
+ SK_LEGACY_CANVAS_VIRTUAL void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
const SkRect& dst,
const SkPaint* paint = NULL,
DrawBitmapRectFlags flags = kNone_DrawBitmapRectFlag);
@@ -856,7 +862,7 @@ public:
* - The corners shrink proportionally
* - The sides (along the shrink axis) and center are not drawn
*/
- virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
+ SK_LEGACY_CANVAS_VIRTUAL void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
const SkRect& dst, const SkPaint* paint = NULL);
/** Draw the specified bitmap, with its top/left corner at (x,y),
@@ -870,7 +876,7 @@ public:
@param top The position of the top side of the bitmap being drawn
@param paint The paint used to draw the bitmap, or NULL
*/
- virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
+ SK_LEGACY_CANVAS_VIRTUAL void drawSprite(const SkBitmap& bitmap, int left, int top,
const SkPaint* paint = NULL);
/** Draw the text, with origin at (x,y), using the specified paint.
@@ -993,7 +999,7 @@ public:
@param indexCount number of entries in the indices array (if not null)
@param paint Specifies the shader/texture if present.
*/
- virtual void drawVertices(VertexMode vmode, int vertexCount,
+ SK_LEGACY_CANVAS_VIRTUAL void drawVertices(VertexMode vmode, int vertexCount,
const SkPoint vertices[], const SkPoint texs[],
const SkColor colors[], SkXfermode* xmode,
const uint16_t indices[], int indexCount,
@@ -1197,6 +1203,24 @@ protected:
virtual void onDrawDrawable(SkCanvasDrawable*);
+ virtual void onDrawPaint(const SkPaint&);
+ virtual void onDrawRect(const SkRect&, const SkPaint&);
+ virtual void onDrawOval(const SkRect&, const SkPaint&);
+ virtual void onDrawRRect(const SkRRect&, const SkPaint&);
+ virtual void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&);
+ virtual void onDrawVertices(VertexMode, int vertexCount, const SkPoint vertices[],
+ const SkPoint texs[], const SkColor colors[], SkXfermode*,
+ const uint16_t indices[], int indexCount, const SkPaint&);
+ virtual void onDrawPath(const SkPath&, const SkPaint&);
+ virtual void onDrawImage(const SkImage*, SkScalar dx, SkScalar dy, const SkPaint*);
+ virtual void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, const SkPaint*);
+ virtual void onDrawBitmap(const SkBitmap&, SkScalar dx, SkScalar dy, const SkPaint*);
+ virtual void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkPaint*,
+ DrawBitmapRectFlags);
+ virtual void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
+ const SkPaint*);
+ virtual void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*);
+
enum ClipEdgeStyle {
kHard_ClipEdgeStyle,
kSoft_ClipEdgeStyle
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index 39239fbf8f..5ce32eafb7 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -18,6 +18,7 @@ class SkData;
class SkCanvas;
class SkImageGenerator;
class SkPaint;
+class SkString;
class SkSurface;
class SkSurfaceProps;
class GrContext;
diff --git a/include/utils/SkDeferredCanvas.h b/include/utils/SkDeferredCanvas.h
index b9b85e6819..0527198d77 100644
--- a/include/utils/SkDeferredCanvas.h
+++ b/include/utils/SkDeferredCanvas.h
@@ -143,32 +143,6 @@ public:
*/
void silentFlush();
- // Overrides of the SkCanvas interface
- virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
- 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;
- virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
- const SkRect& dst, const SkPaint* paint,
- DrawBitmapRectFlags flags) SK_OVERRIDE;
-
- virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
- const SkRect& dst, const SkPaint* paint)
- SK_OVERRIDE;
- virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
- const SkPaint* paint) SK_OVERRIDE;
- virtual void drawVertices(VertexMode vmode, int vertexCount,
- const SkPoint vertices[], const SkPoint texs[],
- const SkColor colors[], SkXfermode* xmode,
- const uint16_t indices[], int indexCount,
- const SkPaint& paint) SK_OVERRIDE;
virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE;
protected:
@@ -193,7 +167,31 @@ protected:
virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
const SkPoint texCoords[4], SkXfermode* xmode,
const SkPaint& paint) SK_OVERRIDE;
-
+
+ void onDrawPaint(const SkPaint&) SK_OVERRIDE;
+ void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) SK_OVERRIDE;
+ void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawPath(const SkPath&, const SkPaint&) SK_OVERRIDE;
+ void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
+ void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
+ DrawBitmapRectFlags flags) SK_OVERRIDE;
+#if 0
+ // rely on conversion to bitmap(for now)
+ void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
+ void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
+ const SkPaint*) SK_OVERRIDE;
+#endif
+ void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
+ const SkPaint*) SK_OVERRIDE;
+ void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVERRIDE;
+ void onDrawVertices(VertexMode vmode, int vertexCount,
+ const SkPoint vertices[], const SkPoint texs[],
+ const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount,
+ const SkPaint&) SK_OVERRIDE;
+
virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
diff --git a/include/utils/SkDumpCanvas.h b/include/utils/SkDumpCanvas.h
index 0c66506c44..d8f50d0521 100644
--- a/include/utils/SkDumpCanvas.h
+++ b/include/utils/SkDumpCanvas.h
@@ -75,25 +75,6 @@ public:
int getNestLevel() const { return fNestLevel; }
- virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
- 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,
- const SkRect& dst, const SkPaint* paint,
- DrawBitmapRectFlags flags) SK_OVERRIDE;
- virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
- const SkPaint* paint) SK_OVERRIDE;
- virtual void drawVertices(VertexMode vmode, int vertexCount,
- const SkPoint vertices[], const SkPoint texs[],
- const SkColor colors[], SkXfermode* xmode,
- const uint16_t indices[], int indexCount,
- const SkPaint& paint) SK_OVERRIDE;
virtual void beginCommentGroup(const char* description) SK_OVERRIDE;
virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE;
virtual void endCommentGroup() SK_OVERRIDE;
@@ -121,6 +102,27 @@ protected:
const SkPoint texCoords[4], SkXfermode* xmode,
const SkPaint& paint) SK_OVERRIDE;
+ void onDrawPaint(const SkPaint&) SK_OVERRIDE;
+ void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) SK_OVERRIDE;
+ void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawPath(const SkPath&, const SkPaint&) SK_OVERRIDE;
+ void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
+ void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
+ DrawBitmapRectFlags flags) SK_OVERRIDE;
+ void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
+ void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
+ const SkPaint*) SK_OVERRIDE;
+ void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
+ const SkPaint*) SK_OVERRIDE;
+ void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVERRIDE;
+ void onDrawVertices(VertexMode vmode, int vertexCount,
+ const SkPoint vertices[], const SkPoint texs[],
+ const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount,
+ const SkPaint&) SK_OVERRIDE;
+
virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
diff --git a/include/utils/SkLuaCanvas.h b/include/utils/SkLuaCanvas.h
index d2019d4325..8c535226f2 100644
--- a/include/utils/SkLuaCanvas.h
+++ b/include/utils/SkLuaCanvas.h
@@ -20,26 +20,6 @@ public:
SkLuaCanvas(int width, int height, lua_State*, const char function[]);
virtual ~SkLuaCanvas();
- virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
- 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,
- const SkRect& dst, const SkPaint* paint,
- DrawBitmapRectFlags flags) SK_OVERRIDE;
- virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
- const SkPaint* paint) SK_OVERRIDE;
- virtual void drawVertices(VertexMode vmode, int vertexCount,
- const SkPoint vertices[], const SkPoint texs[],
- const SkColor colors[], SkXfermode* xmode,
- const uint16_t indices[], int indexCount,
- const SkPaint& paint) SK_OVERRIDE;
-
protected:
virtual void willSave() SK_OVERRIDE;
virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK_OVERRIDE;
@@ -60,6 +40,27 @@ protected:
virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) SK_OVERRIDE;
+ void onDrawPaint(const SkPaint&) SK_OVERRIDE;
+ void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) SK_OVERRIDE;
+ void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawPath(const SkPath&, const SkPaint&) SK_OVERRIDE;
+ void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
+ void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
+ DrawBitmapRectFlags flags) SK_OVERRIDE;
+ void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
+ void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
+ const SkPaint*) SK_OVERRIDE;
+ void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
+ const SkPaint*) SK_OVERRIDE;
+ void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVERRIDE;
+ void onDrawVertices(VertexMode vmode, int vertexCount,
+ const SkPoint vertices[], const SkPoint texs[],
+ const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount,
+ const SkPaint&) SK_OVERRIDE;
+
virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
diff --git a/include/utils/SkNWayCanvas.h b/include/utils/SkNWayCanvas.h
index 5e8c52d136..b547fe524a 100644
--- a/include/utils/SkNWayCanvas.h
+++ b/include/utils/SkNWayCanvas.h
@@ -23,34 +23,6 @@ public:
///////////////////////////////////////////////////////////////////////////
// These are forwarded to the N canvases we're referencing
- virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
- virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
- const SkPaint&) SK_OVERRIDE;
- virtual void drawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
- virtual void drawOval(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,
- const SkRect& dst, const SkPaint* paint,
- DrawBitmapRectFlags flags) SK_OVERRIDE;
- virtual void drawImage(const SkImage* image, SkScalar left, SkScalar top,
- const SkPaint* paint) SK_OVERRIDE;
- virtual void drawImageRect(const SkImage* image, const SkRect* src,
- const SkRect& dst,
- const SkPaint* paint) SK_OVERRIDE;
- virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
- const SkRect& dst,
- const SkPaint* paint = NULL) SK_OVERRIDE;
- virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
- const SkPaint*) SK_OVERRIDE;
- virtual void drawVertices(VertexMode vmode, int vertexCount,
- const SkPoint vertices[], const SkPoint texs[],
- const SkColor colors[], SkXfermode* xmode,
- const uint16_t indices[], int indexCount,
- const SkPaint&) SK_OVERRIDE;
-
virtual SkDrawFilter* setDrawFilter(SkDrawFilter*) SK_OVERRIDE;
virtual void beginCommentGroup(const char* description) SK_OVERRIDE;
@@ -82,6 +54,27 @@ protected:
const SkPoint texCoords[4], SkXfermode* xmode,
const SkPaint& paint) SK_OVERRIDE;
+ void onDrawPaint(const SkPaint&) SK_OVERRIDE;
+ void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) SK_OVERRIDE;
+ void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawPath(const SkPath&, const SkPaint&) SK_OVERRIDE;
+ void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
+ void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
+ DrawBitmapRectFlags flags) SK_OVERRIDE;
+ void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
+ void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
+ const SkPaint*) SK_OVERRIDE;
+ void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
+ const SkPaint*) SK_OVERRIDE;
+ void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVERRIDE;
+ void onDrawVertices(VertexMode vmode, int vertexCount,
+ const SkPoint vertices[], const SkPoint texs[],
+ const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount,
+ const SkPaint&) SK_OVERRIDE;
+
virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
diff --git a/include/utils/SkProxyCanvas.h b/include/utils/SkProxyCanvas.h
index c8a830f613..2a2d7746f5 100644
--- a/include/utils/SkProxyCanvas.h
+++ b/include/utils/SkProxyCanvas.h
@@ -26,31 +26,6 @@ public:
SkCanvas* getProxy() const { return fProxy; }
void setProxy(SkCanvas* proxy);
- virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
- 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,
- const SkRect& dst, const SkPaint* paint,
- DrawBitmapRectFlags flags) SK_OVERRIDE;
- virtual void drawImage(const SkImage* image, SkScalar left, SkScalar top,
- const SkPaint* paint = NULL) SK_OVERRIDE;
- virtual void drawImageRect(const SkImage* image, const SkRect* src,
- const SkRect& dst,
- const SkPaint* paint = NULL) SK_OVERRIDE;
- virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
- const SkPaint* paint = NULL) SK_OVERRIDE;
- virtual void drawVertices(VertexMode vmode, int vertexCount,
- const SkPoint vertices[], const SkPoint texs[],
- const SkColor colors[], SkXfermode* xmode,
- const uint16_t indices[], int indexCount,
- const SkPaint& paint) SK_OVERRIDE;
-
virtual void beginCommentGroup(const char* description) SK_OVERRIDE;
virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE;
virtual void endCommentGroup() SK_OVERRIDE;
@@ -79,6 +54,27 @@ protected:
virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
const SkPoint texCoords[4], SkXfermode* xmode,
const SkPaint& paint) SK_OVERRIDE;
+
+ void onDrawPaint(const SkPaint&) SK_OVERRIDE;
+ void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) SK_OVERRIDE;
+ void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawPath(const SkPath&, const SkPaint&) SK_OVERRIDE;
+ void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
+ void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
+ DrawBitmapRectFlags flags) SK_OVERRIDE;
+ void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
+ void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
+ const SkPaint*) SK_OVERRIDE;
+ void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
+ const SkPaint*) SK_OVERRIDE;
+ void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVERRIDE;
+ void onDrawVertices(VertexMode vmode, int vertexCount,
+ const SkPoint vertices[], const SkPoint texs[],
+ const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount,
+ const SkPaint&) SK_OVERRIDE;
virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 09b9783cb9..13b84e7f0f 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1196,8 +1196,7 @@ void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y,
LOOPER_END
}
-void SkCanvas::drawSprite(const SkBitmap& bitmap, int x, int y,
- const SkPaint* paint) {
+void SkCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint* paint) {
if (gTreatSpriteAsBitmap) {
this->save();
this->resetMatrix();
@@ -1671,6 +1670,66 @@ void SkCanvas::drawDRRect(const SkRRect& outer, const SkRRect& inner,
this->onDrawDRRect(outer, inner, paint);
}
+// These need to stop being virtual -- clients need to override the onDraw... versions
+
+void SkCanvas::drawPaint(const SkPaint& paint) {
+ this->onDrawPaint(paint);
+}
+
+void SkCanvas::drawRect(const SkRect& r, const SkPaint& paint) {
+ this->onDrawRect(r, paint);
+}
+
+void SkCanvas::drawOval(const SkRect& r, const SkPaint& paint) {
+ this->onDrawOval(r, paint);
+}
+
+void SkCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
+ this->onDrawRRect(rrect, paint);
+}
+
+void SkCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint& paint) {
+ this->onDrawPoints(mode, count, pts, paint);
+}
+
+void SkCanvas::drawVertices(VertexMode vmode, int vertexCount, const SkPoint vertices[],
+ const SkPoint texs[], const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount, const SkPaint& paint) {
+ this->onDrawVertices(vmode, vertexCount, vertices, texs, colors, xmode,
+ indices, indexCount, paint);
+}
+
+void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
+ this->onDrawPath(path, paint);
+}
+
+void SkCanvas::drawImage(const SkImage* image, SkScalar dx, SkScalar dy, const SkPaint* paint) {
+ this->onDrawImage(image, dx, dy, paint);
+}
+
+void SkCanvas::drawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint) {
+ this->onDrawImageRect(image, src, dst, paint);
+}
+
+void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar dx, SkScalar dy, const SkPaint* paint) {
+ this->onDrawBitmap(bitmap, dx, dy, paint);
+}
+
+void SkCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint, DrawBitmapRectFlags flags) {
+ this->onDrawBitmapRect(bitmap, src, dst, paint, flags);
+}
+
+void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst,
+ const SkPaint* paint) {
+ this->onDrawBitmapNine(bitmap, center, dst, paint);
+}
+
+void SkCanvas::drawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint) {
+ this->onDrawSprite(bitmap, left, top, paint);
+}
+
//////////////////////////////////////////////////////////////////////////////
// These are the virtual drawing methods
//////////////////////////////////////////////////////////////////////////////
@@ -1681,7 +1740,7 @@ void SkCanvas::onDiscard() {
}
}
-void SkCanvas::drawPaint(const SkPaint& paint) {
+void SkCanvas::onDrawPaint(const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPaint()");
this->internalDrawPaint(paint);
}
@@ -1696,8 +1755,8 @@ void SkCanvas::internalDrawPaint(const SkPaint& paint) {
LOOPER_END
}
-void SkCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[],
- const SkPaint& paint) {
+void SkCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[],
+ const SkPaint& paint) {
TRACE_EVENT1("disabled-by-default-skia", "SkCanvas::drawPoints()", "count", static_cast<uint64_t>(count));
if ((long)count <= 0) {
return;
@@ -1729,7 +1788,7 @@ void SkCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[],
LOOPER_END
}
-void SkCanvas::drawRect(const SkRect& r, const SkPaint& paint) {
+void SkCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRect()");
SkRect storage;
const SkRect* bounds = NULL;
@@ -1749,7 +1808,7 @@ void SkCanvas::drawRect(const SkRect& r, const SkPaint& paint) {
LOOPER_END
}
-void SkCanvas::drawOval(const SkRect& oval, const SkPaint& paint) {
+void SkCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawOval()");
SkRect storage;
const SkRect* bounds = NULL;
@@ -1769,7 +1828,7 @@ void SkCanvas::drawOval(const SkRect& oval, const SkPaint& paint) {
LOOPER_END
}
-void SkCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
+void SkCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRRect()");
SkRect storage;
const SkRect* bounds = NULL;
@@ -1819,7 +1878,7 @@ void SkCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
LOOPER_END
}
-void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
+void SkCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPath()");
if (!path.isFinite()) {
return;
@@ -1852,21 +1911,18 @@ void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
LOOPER_END
}
-void SkCanvas::drawImage(const SkImage* image, SkScalar left, SkScalar top,
- const SkPaint* paint) {
+void SkCanvas::onDrawImage(const SkImage* image, SkScalar dx, SkScalar dy, const SkPaint* paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImage()");
- image->draw(this, left, top, paint);
+ image->draw(this, dx, dy, paint);
}
-void SkCanvas::drawImageRect(const SkImage* image, const SkRect* src,
- const SkRect& dst,
- const SkPaint* paint) {
+void SkCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImageRect()");
image->drawRect(this, src, dst, paint);
}
-void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
- const SkPaint* paint) {
+void SkCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, const SkPaint* paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmap()");
SkDEBUGCODE(bitmap.validate();)
@@ -1922,9 +1978,8 @@ void SkCanvas::internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src,
LOOPER_END
}
-void SkCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
- const SkRect& dst, const SkPaint* paint,
- DrawBitmapRectFlags flags) {
+void SkCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint, DrawBitmapRectFlags flags) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmapRectToRect()");
SkDEBUGCODE(bitmap.validate();)
this->internalDrawBitmapRect(bitmap, src, dst, paint, flags);
@@ -2000,8 +2055,8 @@ void SkCanvas::internalDrawBitmapNine(const SkBitmap& bitmap,
}
}
-void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
- const SkRect& dst, const SkPaint* paint) {
+void SkCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst,
+ const SkPaint* paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmapNine()");
SkDEBUGCODE(bitmap.validate();)
@@ -2208,11 +2263,11 @@ void SkCanvas::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
}
}
-void SkCanvas::drawVertices(VertexMode vmode, int vertexCount,
- const SkPoint verts[], const SkPoint texs[],
- const SkColor colors[], SkXfermode* xmode,
- const uint16_t indices[], int indexCount,
- const SkPaint& paint) {
+void SkCanvas::onDrawVertices(VertexMode vmode, int vertexCount,
+ const SkPoint verts[], const SkPoint texs[],
+ const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount,
+ const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawVertices()");
LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL)
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index fcae49ad68..53ecdd0be6 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -451,7 +451,7 @@ size_t SkPictureRecord::recordClipRegion(const SkRegion& region, SkRegion::Op op
return offset;
}
-void SkPictureRecord::drawPaint(const SkPaint& paint) {
+void SkPictureRecord::onDrawPaint(const SkPaint& paint) {
// op + paint index
size_t size = 2 * kUInt32Size;
size_t initialOffset = this->addDraw(DRAW_PAINT, &size);
@@ -460,8 +460,8 @@ void SkPictureRecord::drawPaint(const SkPaint& paint) {
this->validate(initialOffset, size);
}
-void SkPictureRecord::drawPoints(PointMode mode, size_t count, const SkPoint pts[],
- const SkPaint& paint) {
+void SkPictureRecord::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[],
+ const SkPaint& paint) {
fContentInfo.onDrawPoints(count, paint);
// op + paint index + mode + count + point data
@@ -476,7 +476,7 @@ void SkPictureRecord::drawPoints(PointMode mode, size_t count, const SkPoint pts
this->validate(initialOffset, size);
}
-void SkPictureRecord::drawOval(const SkRect& oval, const SkPaint& paint) {
+void SkPictureRecord::onDrawOval(const SkRect& oval, const SkPaint& paint) {
// op + paint index + rect
size_t size = 2 * kUInt32Size + sizeof(oval);
size_t initialOffset = this->addDraw(DRAW_OVAL, &size);
@@ -486,7 +486,7 @@ void SkPictureRecord::drawOval(const SkRect& oval, const SkPaint& paint) {
this->validate(initialOffset, size);
}
-void SkPictureRecord::drawRect(const SkRect& rect, const SkPaint& paint) {
+void SkPictureRecord::onDrawRect(const SkRect& rect, const SkPaint& paint) {
// op + paint index + rect
size_t size = 2 * kUInt32Size + sizeof(rect);
size_t initialOffset = this->addDraw(DRAW_RECT, &size);
@@ -496,7 +496,7 @@ void SkPictureRecord::drawRect(const SkRect& rect, const SkPaint& paint) {
this->validate(initialOffset, size);
}
-void SkPictureRecord::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
+void SkPictureRecord::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
// op + paint index + rrect
size_t size = 2 * kUInt32Size + SkRRect::kSizeInMemory;
size_t initialOffset = this->addDraw(DRAW_RRECT, &size);
@@ -518,7 +518,7 @@ void SkPictureRecord::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
this->validate(initialOffset, size);
}
-void SkPictureRecord::drawPath(const SkPath& path, const SkPaint& paint) {
+void SkPictureRecord::onDrawPath(const SkPath& path, const SkPaint& paint) {
fContentInfo.onDrawPath(path, paint);
// op + paint index + path index
@@ -530,8 +530,8 @@ void SkPictureRecord::drawPath(const SkPath& path, const SkPaint& paint) {
this->validate(initialOffset, size);
}
-void SkPictureRecord::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
- const SkPaint* paint = NULL) {
+void SkPictureRecord::onDrawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
+ const SkPaint* paint) {
// op + paint index + bitmap index + left + top
size_t size = 3 * kUInt32Size + 2 * sizeof(SkScalar);
size_t initialOffset = this->addDraw(DRAW_BITMAP, &size);
@@ -543,9 +543,8 @@ void SkPictureRecord::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar
this->validate(initialOffset, size);
}
-void SkPictureRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
- const SkRect& dst, const SkPaint* paint,
- DrawBitmapRectFlags flags) {
+void SkPictureRecord::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint, DrawBitmapRectFlags flags) {
// id + paint index + bitmap index + bool for 'src' + flags
size_t size = 5 * kUInt32Size;
if (src) {
@@ -564,8 +563,8 @@ void SkPictureRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect*
this->validate(initialOffset, size);
}
-void SkPictureRecord::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
- const SkRect& dst, const SkPaint* paint) {
+void SkPictureRecord::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
+ const SkRect& dst, const SkPaint* paint) {
// op + paint index + bitmap id + center + dst rect
size_t size = 3 * kUInt32Size + sizeof(center) + sizeof(dst);
size_t initialOffset = this->addDraw(DRAW_BITMAP_NINE, &size);
@@ -577,8 +576,8 @@ void SkPictureRecord::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& cent
this->validate(initialOffset, size);
}
-void SkPictureRecord::drawSprite(const SkBitmap& bitmap, int left, int top,
- const SkPaint* paint = NULL) {
+void SkPictureRecord::onDrawSprite(const SkBitmap& bitmap, int left, int top,
+ const SkPaint* paint) {
// op + paint index + bitmap index + left + top
size_t size = 5 * kUInt32Size;
size_t initialOffset = this->addDraw(DRAW_SPRITE, &size);
@@ -693,11 +692,11 @@ void SkPictureRecord::onDrawPicture(const SkPicture* picture, const SkMatrix* ma
this->validate(initialOffset, size);
}
-void SkPictureRecord::drawVertices(VertexMode vmode, int vertexCount,
- const SkPoint vertices[], const SkPoint texs[],
- const SkColor colors[], SkXfermode* xfer,
- const uint16_t indices[], int indexCount,
- const SkPaint& paint) {
+void SkPictureRecord::onDrawVertices(VertexMode vmode, int vertexCount,
+ const SkPoint vertices[], const SkPoint texs[],
+ const SkColor colors[], SkXfermode* xfer,
+ const uint16_t indices[], int indexCount,
+ const SkPaint& paint) {
uint32_t flags = 0;
if (texs) {
flags |= DRAW_VERTICES_HAS_TEXS;
diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h
index 009506394e..ca2c13329c 100644
--- a/src/core/SkPictureRecord.h
+++ b/src/core/SkPictureRecord.h
@@ -29,27 +29,6 @@ public:
SkPictureRecord(const SkISize& dimensions, uint32_t recordFlags);
virtual ~SkPictureRecord();
- virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
- virtual void drawPoints(PointMode, 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&, SkScalar left, SkScalar top,
- const SkPaint*) SK_OVERRIDE;
- virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src,
- const SkRect& dst, const SkPaint* paint,
- DrawBitmapRectFlags flags) SK_OVERRIDE;
- virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
- const SkRect& dst, const SkPaint*) SK_OVERRIDE;
- virtual void drawSprite(const SkBitmap&, int left, int top,
- const SkPaint*) SK_OVERRIDE;
- virtual void drawVertices(VertexMode, int vertexCount,
- const SkPoint vertices[], const SkPoint texs[],
- const SkColor colors[], SkXfermode*,
- const uint16_t indices[], int indexCount,
- const SkPaint&) SK_OVERRIDE;
virtual void beginCommentGroup(const char* description) SK_OVERRIDE;
virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE;
virtual void endCommentGroup() SK_OVERRIDE;
@@ -196,6 +175,30 @@ protected:
const SkPoint texCoords[4], SkXfermode* xmode,
const SkPaint& paint) SK_OVERRIDE;
+ void onDrawPaint(const SkPaint&) SK_OVERRIDE;
+ void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) SK_OVERRIDE;
+ void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawPath(const SkPath&, const SkPaint&) SK_OVERRIDE;
+ void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
+ void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
+ DrawBitmapRectFlags flags) SK_OVERRIDE;
+#if 0
+ // rely on conversion to bitmap (for now)
+ void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
+ void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
+ const SkPaint*) SK_OVERRIDE;
+#endif
+ void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
+ const SkPaint*) SK_OVERRIDE;
+ void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVERRIDE;
+ void onDrawVertices(VertexMode vmode, int vertexCount,
+ const SkPoint vertices[], const SkPoint texs[],
+ const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount,
+ const SkPaint&) SK_OVERRIDE;
+
virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index 55b8a00588..de16d6244f 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -116,26 +116,26 @@ char* SkRecorder::copy(const char* src) {
}
-void SkRecorder::drawPaint(const SkPaint& paint) {
+void SkRecorder::onDrawPaint(const SkPaint& paint) {
APPEND(DrawPaint, delay_copy(paint));
}
-void SkRecorder::drawPoints(PointMode mode,
- size_t count,
- const SkPoint pts[],
- const SkPaint& paint) {
+void SkRecorder::onDrawPoints(PointMode mode,
+ size_t count,
+ const SkPoint pts[],
+ const SkPaint& paint) {
APPEND(DrawPoints, delay_copy(paint), mode, SkToUInt(count), this->copy(pts, count));
}
-void SkRecorder::drawRect(const SkRect& rect, const SkPaint& paint) {
+void SkRecorder::onDrawRect(const SkRect& rect, const SkPaint& paint) {
APPEND(DrawRect, delay_copy(paint), rect);
}
-void SkRecorder::drawOval(const SkRect& oval, const SkPaint& paint) {
+void SkRecorder::onDrawOval(const SkRect& oval, const SkPaint& paint) {
APPEND(DrawOval, delay_copy(paint), oval);
}
-void SkRecorder::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
+void SkRecorder::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
APPEND(DrawRRect, delay_copy(paint), rrect);
}
@@ -151,22 +151,22 @@ void SkRecorder::onDrawDrawable(SkCanvasDrawable* drawable) {
APPEND(DrawDrawable, drawable->getBounds(), fDrawableList->count() - 1);
}
-void SkRecorder::drawPath(const SkPath& path, const SkPaint& paint) {
+void SkRecorder::onDrawPath(const SkPath& path, const SkPaint& paint) {
APPEND(DrawPath, delay_copy(paint), delay_copy(path));
}
-void SkRecorder::drawBitmap(const SkBitmap& bitmap,
- SkScalar left,
- SkScalar top,
- const SkPaint* paint) {
+void SkRecorder::onDrawBitmap(const SkBitmap& bitmap,
+ SkScalar left,
+ SkScalar top,
+ const SkPaint* paint) {
APPEND(DrawBitmap, this->copy(paint), delay_copy(bitmap), left, top);
}
-void SkRecorder::drawBitmapRectToRect(const SkBitmap& bitmap,
- const SkRect* src,
- const SkRect& dst,
- const SkPaint* paint,
- DrawBitmapRectFlags flags) {
+void SkRecorder::onDrawBitmapRect(const SkBitmap& bitmap,
+ const SkRect* src,
+ const SkRect& dst,
+ const SkPaint* paint,
+ DrawBitmapRectFlags flags) {
if (kBleed_DrawBitmapRectFlag == flags) {
APPEND(DrawBitmapRectToRectBleed,
this->copy(paint), delay_copy(bitmap), this->copy(src), dst);
@@ -177,25 +177,25 @@ void SkRecorder::drawBitmapRectToRect(const SkBitmap& bitmap,
this->copy(paint), delay_copy(bitmap), this->copy(src), dst);
}
-void SkRecorder::drawBitmapNine(const SkBitmap& bitmap,
- const SkIRect& center,
- const SkRect& dst,
- const SkPaint* paint) {
+void SkRecorder::onDrawBitmapNine(const SkBitmap& bitmap,
+ const SkIRect& center,
+ const SkRect& dst,
+ const SkPaint* paint) {
APPEND(DrawBitmapNine, this->copy(paint), delay_copy(bitmap), center, dst);
}
-void SkRecorder::drawImage(const SkImage* image, SkScalar left, SkScalar top,
- const SkPaint* paint) {
+void SkRecorder::onDrawImage(const SkImage* image, SkScalar left, SkScalar top,
+ const SkPaint* paint) {
APPEND(DrawImage, this->copy(paint), image, left, top);
}
-void SkRecorder::drawImageRect(const SkImage* image, const SkRect* src,
- const SkRect& dst,
- const SkPaint* paint) {
+void SkRecorder::onDrawImageRect(const SkImage* image, const SkRect* src,
+ const SkRect& dst,
+ const SkPaint* paint) {
APPEND(DrawImageRect, this->copy(paint), image, this->copy(src), dst);
}
-void SkRecorder::drawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint) {
+void SkRecorder::onDrawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint) {
APPEND(DrawSprite, this->copy(paint), delay_copy(bitmap), left, top);
}
@@ -245,11 +245,11 @@ void SkRecorder::onDrawPicture(const SkPicture* pic, const SkMatrix* matrix, con
APPEND(DrawPicture, this->copy(paint), pic, matrix ? *matrix : SkMatrix::I());
}
-void SkRecorder::drawVertices(VertexMode vmode,
- int vertexCount, const SkPoint vertices[],
- const SkPoint texs[], const SkColor colors[],
- SkXfermode* xmode,
- const uint16_t indices[], int indexCount, const SkPaint& paint) {
+void SkRecorder::onDrawVertices(VertexMode vmode,
+ int vertexCount, const SkPoint vertices[],
+ const SkPoint texs[], const SkColor colors[],
+ SkXfermode* xmode,
+ const uint16_t indices[], int indexCount, const SkPaint& paint) {
APPEND(DrawVertices, delay_copy(paint),
vmode,
vertexCount,
diff --git a/src/core/SkRecorder.h b/src/core/SkRecorder.h
index 0e4252baac..611dbbdcd7 100644
--- a/src/core/SkRecorder.h
+++ b/src/core/SkRecorder.h
@@ -45,47 +45,6 @@ public:
// Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecorder will fail.
void forgetRecord();
- void drawPaint(const SkPaint& paint) SK_OVERRIDE;
- void drawPoints(PointMode mode,
- size_t count,
- const SkPoint pts[],
- const SkPaint& paint) SK_OVERRIDE;
- void drawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE;
- void drawOval(const SkRect& oval, const SkPaint&) SK_OVERRIDE;
- void drawRRect(const SkRRect& rrect, const SkPaint& paint) SK_OVERRIDE;
- void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
- void drawBitmap(const SkBitmap& bitmap,
- SkScalar left,
- SkScalar top,
- const SkPaint* paint = NULL) SK_OVERRIDE;
- void drawBitmapRectToRect(const SkBitmap& bitmap,
- const SkRect* src,
- const SkRect& dst,
- const SkPaint* paint = NULL,
- DrawBitmapRectFlags flags = kNone_DrawBitmapRectFlag) SK_OVERRIDE;
- void drawBitmapNine(const SkBitmap& bitmap,
- const SkIRect& center,
- const SkRect& dst,
- const SkPaint* paint = NULL) SK_OVERRIDE;
- virtual void drawImage(const SkImage* image, SkScalar left, SkScalar top,
- const SkPaint* paint = NULL) SK_OVERRIDE;
- virtual void drawImageRect(const SkImage* image, const SkRect* src,
- const SkRect& dst,
- const SkPaint* paint = NULL) SK_OVERRIDE;
- void drawSprite(const SkBitmap& bitmap,
- int left,
- int top,
- const SkPaint* paint = NULL) SK_OVERRIDE;
- void drawVertices(VertexMode vmode,
- int vertexCount,
- const SkPoint vertices[],
- const SkPoint texs[],
- const SkColor colors[],
- SkXfermode* xmode,
- const uint16_t indices[],
- int indexCount,
- const SkPaint& paint) SK_OVERRIDE;
-
void willSave() SK_OVERRIDE;
SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SkCanvas::SaveFlags) SK_OVERRIDE;
void willRestore() SK_OVERRIDE {}
@@ -123,6 +82,27 @@ public:
const SkPoint texCoords[4], SkXfermode* xmode,
const SkPaint& paint) SK_OVERRIDE;
+ void onDrawPaint(const SkPaint&) SK_OVERRIDE;
+ void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) SK_OVERRIDE;
+ void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawPath(const SkPath&, const SkPaint&) SK_OVERRIDE;
+ void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
+ void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
+ DrawBitmapRectFlags flags) SK_OVERRIDE;
+ void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
+ void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
+ const SkPaint*) SK_OVERRIDE;
+ void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
+ const SkPaint*) SK_OVERRIDE;
+ void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVERRIDE;
+ void onDrawVertices(VertexMode vmode, int vertexCount,
+ const SkPoint vertices[], const SkPoint texs[],
+ const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount,
+ const SkPaint&) SK_OVERRIDE;
+
void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) SK_OVERRIDE;
void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) SK_OVERRIDE;
void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) SK_OVERRIDE;
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index 45b26dbaf8..6044360933 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -231,28 +231,6 @@ public:
return (NULL == fBitmapHeap) ? 0 : fBitmapHeap->bytesAllocated();
}
- // overrides from SkCanvas
- virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
- virtual void drawPoints(PointMode, size_t count, const SkPoint pts[],
- const SkPaint&) SK_OVERRIDE;
- virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
- virtual void drawRect(const SkRect& rect, 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&, SkScalar left, SkScalar top,
- const SkPaint*) SK_OVERRIDE;
- virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src,
- const SkRect& dst, const SkPaint* paint,
- DrawBitmapRectFlags flags) SK_OVERRIDE;
- virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
- const SkRect& dst, const SkPaint* paint = NULL) SK_OVERRIDE;
- virtual void drawSprite(const SkBitmap&, int left, int top,
- const SkPaint*) SK_OVERRIDE;
- virtual void drawVertices(VertexMode, int vertexCount,
- const SkPoint vertices[], const SkPoint texs[],
- const SkColor colors[], SkXfermode*,
- const uint16_t indices[], int indexCount,
- const SkPaint&) SK_OVERRIDE;
virtual void beginCommentGroup(const char* description) SK_OVERRIDE;
virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE;
virtual void endCommentGroup() SK_OVERRIDE;
@@ -285,6 +263,29 @@ protected:
virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
const SkPoint texCoords[4], SkXfermode* xmode,
const SkPaint& paint) SK_OVERRIDE;
+ void onDrawPaint(const SkPaint&) SK_OVERRIDE;
+ void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) SK_OVERRIDE;
+ void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawPath(const SkPath&, const SkPaint&) SK_OVERRIDE;
+ void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
+ void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
+ DrawBitmapRectFlags flags) SK_OVERRIDE;
+#if 0
+ // rely on decomposition into bitmap (for now)
+ void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
+ void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
+ const SkPaint*) SK_OVERRIDE;
+#endif
+ void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
+ const SkPaint*) SK_OVERRIDE;
+ void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVERRIDE;
+ void onDrawVertices(VertexMode vmode, int vertexCount,
+ const SkPoint vertices[], const SkPoint texs[],
+ const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount,
+ const SkPaint&) SK_OVERRIDE;
virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
@@ -668,7 +669,7 @@ void SkGPipeCanvas::onClipRegion(const SkRegion& region, SkRegion::Op rgnOp) {
///////////////////////////////////////////////////////////////////////////////
-void SkGPipeCanvas::drawPaint(const SkPaint& paint) {
+void SkGPipeCanvas::onDrawPaint(const SkPaint& paint) {
NOTIFY_SETUP(this);
this->writePaint(paint);
if (this->needOpBytes()) {
@@ -676,8 +677,8 @@ void SkGPipeCanvas::drawPaint(const SkPaint& paint) {
}
}
-void SkGPipeCanvas::drawPoints(PointMode mode, size_t count,
- const SkPoint pts[], const SkPaint& paint) {
+void SkGPipeCanvas::onDrawPoints(PointMode mode, size_t count,
+ const SkPoint pts[], const SkPaint& paint) {
if (count) {
NOTIFY_SETUP(this);
this->writePaint(paint);
@@ -689,7 +690,7 @@ void SkGPipeCanvas::drawPoints(PointMode mode, size_t count,
}
}
-void SkGPipeCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
+void SkGPipeCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) {
NOTIFY_SETUP(this);
this->writePaint(paint);
if (this->needOpBytes(sizeof(SkRect))) {
@@ -698,7 +699,7 @@ void SkGPipeCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
}
}
-void SkGPipeCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
+void SkGPipeCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) {
NOTIFY_SETUP(this);
this->writePaint(paint);
if (this->needOpBytes(sizeof(SkRect))) {
@@ -707,7 +708,7 @@ void SkGPipeCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
}
}
-void SkGPipeCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
+void SkGPipeCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
NOTIFY_SETUP(this);
this->writePaint(paint);
if (this->needOpBytes(kSizeOfFlatRRect)) {
@@ -727,7 +728,7 @@ void SkGPipeCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
}
}
-void SkGPipeCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
+void SkGPipeCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
NOTIFY_SETUP(this);
this->writePaint(paint);
if (this->needOpBytes(path.writeToMemory(NULL))) {
@@ -763,8 +764,8 @@ bool SkGPipeCanvas::commonDrawBitmap(const SkBitmap& bm, DrawOps op,
return false;
}
-void SkGPipeCanvas::drawBitmap(const SkBitmap& bm, SkScalar left, SkScalar top,
- const SkPaint* paint) {
+void SkGPipeCanvas::onDrawBitmap(const SkBitmap& bm, SkScalar left, SkScalar top,
+ const SkPaint* paint) {
NOTIFY_SETUP(this);
size_t opBytesNeeded = sizeof(SkScalar) * 2;
@@ -774,9 +775,8 @@ void SkGPipeCanvas::drawBitmap(const SkBitmap& bm, SkScalar left, SkScalar top,
}
}
-void SkGPipeCanvas::drawBitmapRectToRect(const SkBitmap& bm, const SkRect* src,
- const SkRect& dst, const SkPaint* paint,
- DrawBitmapRectFlags dbmrFlags) {
+void SkGPipeCanvas::onDrawBitmapRect(const SkBitmap& bm, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint, DrawBitmapRectFlags dbmrFlags) {
NOTIFY_SETUP(this);
size_t opBytesNeeded = sizeof(SkRect);
bool hasSrc = src != NULL;
@@ -799,8 +799,8 @@ void SkGPipeCanvas::drawBitmapRectToRect(const SkBitmap& bm, const SkRect* src,
}
}
-void SkGPipeCanvas::drawBitmapNine(const SkBitmap& bm, const SkIRect& center,
- const SkRect& dst, const SkPaint* paint) {
+void SkGPipeCanvas::onDrawBitmapNine(const SkBitmap& bm, const SkIRect& center,
+ const SkRect& dst, const SkPaint* paint) {
NOTIFY_SETUP(this);
size_t opBytesNeeded = sizeof(int32_t) * 4 + sizeof(SkRect);
@@ -813,8 +813,7 @@ void SkGPipeCanvas::drawBitmapNine(const SkBitmap& bm, const SkIRect& center,
}
}
-void SkGPipeCanvas::drawSprite(const SkBitmap& bm, int left, int top,
- const SkPaint* paint) {
+void SkGPipeCanvas::onDrawSprite(const SkBitmap& bm, int left, int top, const SkPaint* paint) {
NOTIFY_SETUP(this);
size_t opBytesNeeded = sizeof(int32_t) * 2;
@@ -980,11 +979,11 @@ void SkGPipeCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matr
this->INHERITED::onDrawPicture(picture, matrix, paint);
}
-void SkGPipeCanvas::drawVertices(VertexMode vmode, int vertexCount,
- const SkPoint vertices[], const SkPoint texs[],
- const SkColor colors[], SkXfermode* xfer,
- const uint16_t indices[], int indexCount,
- const SkPaint& paint) {
+void SkGPipeCanvas::onDrawVertices(VertexMode vmode, int vertexCount,
+ const SkPoint vertices[], const SkPoint texs[],
+ const SkColor colors[], SkXfermode* xfer,
+ const uint16_t indices[], int indexCount,
+ const SkPaint& paint) {
if (0 == vertexCount) {
return;
}
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index 5083cf7e42..a41b3ab3b4 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -754,7 +754,7 @@ void SkDeferredCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op)
this->recordedDrawCommand();
}
-void SkDeferredCanvas::drawPaint(const SkPaint& paint) {
+void SkDeferredCanvas::onDrawPaint(const SkPaint& paint) {
if (fDeferredDrawing && this->isFullFrame(NULL, &paint) &&
isPaintOpaque(&paint)) {
this->getDeferredDevice()->skipPendingCommands();
@@ -764,20 +764,20 @@ void SkDeferredCanvas::drawPaint(const SkPaint& paint) {
this->recordedDrawCommand();
}
-void SkDeferredCanvas::drawPoints(PointMode mode, size_t count,
- const SkPoint pts[], const SkPaint& paint) {
+void SkDeferredCanvas::onDrawPoints(PointMode mode, size_t count,
+ const SkPoint pts[], const SkPaint& paint) {
AutoImmediateDrawIfNeeded autoDraw(*this, &paint);
this->drawingCanvas()->drawPoints(mode, count, pts, paint);
this->recordedDrawCommand();
}
-void SkDeferredCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
+void SkDeferredCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) {
AutoImmediateDrawIfNeeded autoDraw(*this, &paint);
this->drawingCanvas()->drawOval(rect, paint);
this->recordedDrawCommand();
}
-void SkDeferredCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
+void SkDeferredCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) {
if (fDeferredDrawing && this->isFullFrame(&rect, &paint) &&
isPaintOpaque(&paint)) {
this->getDeferredDevice()->skipPendingCommands();
@@ -788,7 +788,7 @@ void SkDeferredCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
this->recordedDrawCommand();
}
-void SkDeferredCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
+void SkDeferredCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
if (rrect.isRect()) {
this->SkDeferredCanvas::drawRect(rrect.getBounds(), paint);
} else if (rrect.isOval()) {
@@ -807,14 +807,14 @@ void SkDeferredCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
this->recordedDrawCommand();
}
-void SkDeferredCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
+void SkDeferredCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
AutoImmediateDrawIfNeeded autoDraw(*this, &paint);
this->drawingCanvas()->drawPath(path, paint);
this->recordedDrawCommand();
}
-void SkDeferredCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar left,
- SkScalar top, const SkPaint* paint) {
+void SkDeferredCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar left,
+ SkScalar top, const SkPaint* paint) {
SkRect bitmapRect = SkRect::MakeXYWH(left, top,
SkIntToScalar(bitmap.width()), SkIntToScalar(bitmap.height()));
if (fDeferredDrawing &&
@@ -828,11 +828,9 @@ void SkDeferredCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar left,
this->recordedDrawCommand();
}
-void SkDeferredCanvas::drawBitmapRectToRect(const SkBitmap& bitmap,
- const SkRect* src,
- const SkRect& dst,
- const SkPaint* paint,
- DrawBitmapRectFlags flags) {
+void SkDeferredCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src,
+ const SkRect& dst,
+ const SkPaint* paint, DrawBitmapRectFlags flags) {
if (fDeferredDrawing &&
this->isFullFrame(&dst, paint) &&
isPaintOpaque(paint, &bitmap)) {
@@ -844,9 +842,9 @@ void SkDeferredCanvas::drawBitmapRectToRect(const SkBitmap& bitmap,
this->recordedDrawCommand();
}
-void SkDeferredCanvas::drawBitmapNine(const SkBitmap& bitmap,
- const SkIRect& center, const SkRect& dst,
- const SkPaint* paint) {
+void SkDeferredCanvas::onDrawBitmapNine(const SkBitmap& bitmap,
+ const SkIRect& center, const SkRect& dst,
+ const SkPaint* paint) {
// TODO: reset recording canvas if paint+bitmap is opaque and clip rect
// covers canvas entirely and dst covers canvas entirely
AutoImmediateDrawIfNeeded autoDraw(*this, &bitmap, paint);
@@ -854,8 +852,8 @@ void SkDeferredCanvas::drawBitmapNine(const SkBitmap& bitmap,
this->recordedDrawCommand();
}
-void SkDeferredCanvas::drawSprite(const SkBitmap& bitmap, int left, int top,
- const SkPaint* paint) {
+void SkDeferredCanvas::onDrawSprite(const SkBitmap& bitmap, int left, int top,
+ const SkPaint* paint) {
SkRect bitmapRect = SkRect::MakeXYWH(
SkIntToScalar(left),
SkIntToScalar(top),
@@ -913,12 +911,12 @@ void SkDeferredCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* m
this->recordedDrawCommand();
}
-void SkDeferredCanvas::drawVertices(VertexMode vmode, int vertexCount,
- const SkPoint vertices[],
- const SkPoint texs[],
- const SkColor colors[], SkXfermode* xmode,
- const uint16_t indices[], int indexCount,
- const SkPaint& paint) {
+void SkDeferredCanvas::onDrawVertices(VertexMode vmode, int vertexCount,
+ const SkPoint vertices[],
+ const SkPoint texs[],
+ const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount,
+ const SkPaint& paint) {
AutoImmediateDrawIfNeeded autoDraw(*this, &paint);
this->drawingCanvas()->drawVertices(vmode, vertexCount, vertices, texs, colors, xmode,
indices, indexCount, paint);
diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp
index 1bfb1ba806..54ca691dce 100644
--- a/src/utils/SkDumpCanvas.cpp
+++ b/src/utils/SkDumpCanvas.cpp
@@ -294,29 +294,29 @@ void SkDumpCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
///////////////////////////////////////////////////////////////////////////////
-void SkDumpCanvas::drawPaint(const SkPaint& paint) {
+void SkDumpCanvas::onDrawPaint(const SkPaint& paint) {
this->dump(kDrawPaint_Verb, &paint, "drawPaint()");
}
-void SkDumpCanvas::drawPoints(PointMode mode, size_t count,
+void SkDumpCanvas::onDrawPoints(PointMode mode, size_t count,
const SkPoint pts[], const SkPaint& paint) {
this->dump(kDrawPoints_Verb, &paint, "drawPoints(%s, %d)", toString(mode),
count);
}
-void SkDumpCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
+void SkDumpCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) {
SkString str;
toString(rect, &str);
this->dump(kDrawOval_Verb, &paint, "drawOval(%s)", str.c_str());
}
-void SkDumpCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
+void SkDumpCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) {
SkString str;
toString(rect, &str);
this->dump(kDrawRect_Verb, &paint, "drawRect(%s)", str.c_str());
}
-void SkDumpCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
+void SkDumpCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
SkString str;
toString(rrect, &str);
this->dump(kDrawDRRect_Verb, &paint, "drawRRect(%s)", str.c_str());
@@ -331,23 +331,22 @@ void SkDumpCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
str0.c_str(), str1.c_str());
}
-void SkDumpCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
+void SkDumpCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
SkString str;
toString(path, &str);
this->dump(kDrawPath_Verb, &paint, "drawPath(%s)", str.c_str());
}
-void SkDumpCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
- const SkPaint* paint) {
+void SkDumpCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
+ const SkPaint* paint) {
SkString str;
bitmap.toString(&str);
this->dump(kDrawBitmap_Verb, paint, "drawBitmap(%s %g %g)", str.c_str(),
SkScalarToFloat(x), SkScalarToFloat(y));
}
-void SkDumpCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
- const SkRect& dst, const SkPaint* paint,
- DrawBitmapRectFlags flags) {
+void SkDumpCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint, DrawBitmapRectFlags flags) {
SkString bs, rs;
bitmap.toString(&bs);
toString(dst, &rs);
@@ -364,8 +363,42 @@ void SkDumpCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* sr
bs.c_str(), rs.c_str());
}
-void SkDumpCanvas::drawSprite(const SkBitmap& bitmap, int x, int y,
- const SkPaint* paint) {
+void SkDumpCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
+ const SkRect& dst, const SkPaint* paint) {
+ SkString str, centerStr, dstStr;
+ bitmap.toString(&str);
+ toString(center, &centerStr);
+ toString(dst, &dstStr);
+ this->dump(kDrawBitmap_Verb, paint, "drawBitmapNine(%s %s %s)", str.c_str(),
+ centerStr.c_str(), dstStr.c_str());
+}
+
+void SkDumpCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y, const SkPaint* paint) {
+ SkString str;
+ image->toString(&str);
+ this->dump(kDrawBitmap_Verb, paint, "drawImage(%s %g %g)", str.c_str(),
+ SkScalarToFloat(x), SkScalarToFloat(y));
+}
+
+void SkDumpCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint) {
+ SkString bs, rs;
+ image->toString(&bs);
+ toString(dst, &rs);
+ // show the src-rect only if its not everything
+ if (src && (src->fLeft > 0 || src->fTop > 0 ||
+ src->fRight < SkIntToScalar(image->width()) ||
+ src->fBottom < SkIntToScalar(image->height()))) {
+ SkString ss;
+ toString(*src, &ss);
+ rs.prependf("%s ", ss.c_str());
+ }
+
+ this->dump(kDrawBitmap_Verb, paint, "drawImageRectToRect(%s %s)",
+ bs.c_str(), rs.c_str());
+}
+
+void SkDumpCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint* paint) {
SkString str;
bitmap.toString(&str);
this->dump(kDrawBitmap_Verb, paint, "drawSprite(%s %d %d)", str.c_str(),
@@ -427,11 +460,11 @@ void SkDumpCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matri
picture->cullRect().fRight, picture->cullRect().fBottom);
}
-void SkDumpCanvas::drawVertices(VertexMode vmode, int vertexCount,
- const SkPoint vertices[], const SkPoint texs[],
- const SkColor colors[], SkXfermode* xmode,
- const uint16_t indices[], int indexCount,
- const SkPaint& paint) {
+void SkDumpCanvas::onDrawVertices(VertexMode vmode, int vertexCount,
+ const SkPoint vertices[], const SkPoint texs[],
+ const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount,
+ const SkPaint& paint) {
this->dump(kDrawVertices_Verb, &paint, "drawVertices(%s [%d] %g %g ...)",
toString(vmode), vertexCount, SkScalarToFloat(vertices[0].fX),
SkScalarToFloat(vertices[0].fY));
diff --git a/src/utils/SkLuaCanvas.cpp b/src/utils/SkLuaCanvas.cpp
index ca04ba9d22..68094f2ca0 100644
--- a/src/utils/SkLuaCanvas.cpp
+++ b/src/utils/SkLuaCanvas.cpp
@@ -162,31 +162,31 @@ void SkLuaCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
this->INHERITED::onClipRegion(deviceRgn, op);
}
-void SkLuaCanvas::drawPaint(const SkPaint& paint) {
+void SkLuaCanvas::onDrawPaint(const SkPaint& paint) {
AUTO_LUA("drawPaint");
lua.pushPaint(paint, "paint");
}
-void SkLuaCanvas::drawPoints(PointMode mode, size_t count,
+void SkLuaCanvas::onDrawPoints(PointMode mode, size_t count,
const SkPoint pts[], const SkPaint& paint) {
AUTO_LUA("drawPoints");
lua.pushArrayPoint(pts, SkToInt(count), "points");
lua.pushPaint(paint, "paint");
}
-void SkLuaCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
+void SkLuaCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) {
AUTO_LUA("drawOval");
lua.pushRect(rect, "rect");
lua.pushPaint(paint, "paint");
}
-void SkLuaCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
+void SkLuaCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) {
AUTO_LUA("drawRect");
lua.pushRect(rect, "rect");
lua.pushPaint(paint, "paint");
}
-void SkLuaCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
+void SkLuaCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
AUTO_LUA("drawRRect");
lua.pushRRect(rrect, "rrect");
lua.pushPaint(paint, "paint");
@@ -200,31 +200,52 @@ void SkLuaCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
lua.pushPaint(paint, "paint");
}
-void SkLuaCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
+void SkLuaCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
AUTO_LUA("drawPath");
lua.pushPath(path, "path");
lua.pushPaint(paint, "paint");
}
-void SkLuaCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
- const SkPaint* paint) {
+void SkLuaCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
+ const SkPaint* paint) {
AUTO_LUA("drawBitmap");
if (paint) {
lua.pushPaint(*paint, "paint");
}
}
-void SkLuaCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
- const SkRect& dst, const SkPaint* paint,
- DrawBitmapRectFlags flags) {
- AUTO_LUA("drawBitmapRectToRect");
+void SkLuaCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint, DrawBitmapRectFlags flags) {
+ AUTO_LUA("drawBitmapRect");
if (paint) {
lua.pushPaint(*paint, "paint");
}
}
-void SkLuaCanvas::drawSprite(const SkBitmap& bitmap, int x, int y,
- const SkPaint* paint) {
+void SkLuaCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst,
+ const SkPaint* paint) {
+ AUTO_LUA("drawBitmapNine");
+ if (paint) {
+ lua.pushPaint(*paint, "paint");
+ }
+}
+
+void SkLuaCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y, const SkPaint* paint) {
+ AUTO_LUA("drawImage");
+ if (paint) {
+ lua.pushPaint(*paint, "paint");
+ }
+}
+
+void SkLuaCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint) {
+ AUTO_LUA("drawImageRect");
+ if (paint) {
+ lua.pushPaint(*paint, "paint");
+ }
+}
+
+void SkLuaCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint* paint) {
AUTO_LUA("drawSprite");
if (paint) {
lua.pushPaint(*paint, "paint");
@@ -276,7 +297,7 @@ void SkLuaCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix
this->INHERITED::onDrawPicture(picture, matrix, paint);
}
-void SkLuaCanvas::drawVertices(VertexMode vmode, int vertexCount,
+void SkLuaCanvas::onDrawVertices(VertexMode vmode, int vertexCount,
const SkPoint vertices[], const SkPoint texs[],
const SkColor colors[], SkXfermode* xmode,
const uint16_t indices[], int indexCount,
diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp
index f696de8e41..14ad6d6f81 100644
--- a/src/utils/SkNWayCanvas.cpp
+++ b/src/utils/SkNWayCanvas.cpp
@@ -134,36 +134,36 @@ void SkNWayCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
this->INHERITED::onClipRegion(deviceRgn, op);
}
-void SkNWayCanvas::drawPaint(const SkPaint& paint) {
+void SkNWayCanvas::onDrawPaint(const SkPaint& paint) {
Iter iter(fList);
while (iter.next()) {
iter->drawPaint(paint);
}
}
-void SkNWayCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[],
- const SkPaint& paint) {
+void SkNWayCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[],
+ const SkPaint& paint) {
Iter iter(fList);
while (iter.next()) {
iter->drawPoints(mode, count, pts, paint);
}
}
-void SkNWayCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
+void SkNWayCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) {
Iter iter(fList);
while (iter.next()) {
iter->drawRect(rect, paint);
}
}
-void SkNWayCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
+void SkNWayCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) {
Iter iter(fList);
while (iter.next()) {
iter->drawOval(rect, paint);
}
}
-void SkNWayCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
+void SkNWayCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
Iter iter(fList);
while (iter.next()) {
iter->drawRRect(rrect, paint);
@@ -178,57 +178,54 @@ void SkNWayCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
}
}
-void SkNWayCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
+void SkNWayCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
Iter iter(fList);
while (iter.next()) {
iter->drawPath(path, paint);
}
}
-void SkNWayCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
- const SkPaint* paint) {
+void SkNWayCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
+ const SkPaint* paint) {
Iter iter(fList);
while (iter.next()) {
iter->drawBitmap(bitmap, x, y, paint);
}
}
-void SkNWayCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
- const SkRect& dst, const SkPaint* paint,
- DrawBitmapRectFlags flags) {
+void SkNWayCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint, DrawBitmapRectFlags flags) {
Iter iter(fList);
while (iter.next()) {
iter->drawBitmapRectToRect(bitmap, src, dst, paint, flags);
}
}
-void SkNWayCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
- const SkRect& dst, const SkPaint* paint) {
+void SkNWayCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
+ const SkRect& dst, const SkPaint* paint) {
Iter iter(fList);
while (iter.next()) {
iter->drawBitmapNine(bitmap, center, dst, paint);
}
}
-void SkNWayCanvas::drawImage(const SkImage* image, SkScalar left, SkScalar top,
- const SkPaint* paint) {
+void SkNWayCanvas::onDrawImage(const SkImage* image, SkScalar left, SkScalar top,
+ const SkPaint* paint) {
Iter iter(fList);
while (iter.next()) {
iter->drawImage(image, left, top, paint);
}
}
-void SkNWayCanvas::drawImageRect(const SkImage* image, const SkRect* src,
- const SkRect& dst,
- const SkPaint* paint) {
+void SkNWayCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint) {
Iter iter(fList);
while (iter.next()) {
iter->drawImageRect(image, src, dst, paint);
}
}
-void SkNWayCanvas::drawSprite(const SkBitmap& bitmap, int x, int y,
- const SkPaint* paint) {
+void SkNWayCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint* paint) {
Iter iter(fList);
while (iter.next()) {
iter->drawSprite(bitmap, x, y, paint);
@@ -283,11 +280,11 @@ void SkNWayCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matri
}
}
-void SkNWayCanvas::drawVertices(VertexMode vmode, int vertexCount,
- const SkPoint vertices[], const SkPoint texs[],
- const SkColor colors[], SkXfermode* xmode,
- const uint16_t indices[], int indexCount,
- const SkPaint& paint) {
+void SkNWayCanvas::onDrawVertices(VertexMode vmode, int vertexCount,
+ const SkPoint vertices[], const SkPoint texs[],
+ const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount,
+ const SkPaint& paint) {
Iter iter(fList);
while (iter.next()) {
iter->drawVertices(vmode, vertexCount, vertices, texs, colors, xmode,
diff --git a/src/utils/SkProxyCanvas.cpp b/src/utils/SkProxyCanvas.cpp
index 161f3c0794..ade4315f3d 100644
--- a/src/utils/SkProxyCanvas.cpp
+++ b/src/utils/SkProxyCanvas.cpp
@@ -65,24 +65,24 @@ void SkProxyCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
fProxy->clipRegion(deviceRgn, op);
}
-void SkProxyCanvas::drawPaint(const SkPaint& paint) {
+void SkProxyCanvas::onDrawPaint(const SkPaint& paint) {
fProxy->drawPaint(paint);
}
-void SkProxyCanvas::drawPoints(PointMode mode, size_t count,
- const SkPoint pts[], const SkPaint& paint) {
+void SkProxyCanvas::onDrawPoints(PointMode mode, size_t count,
+ const SkPoint pts[], const SkPaint& paint) {
fProxy->drawPoints(mode, count, pts, paint);
}
-void SkProxyCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
+void SkProxyCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) {
fProxy->drawOval(rect, paint);
}
-void SkProxyCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
+void SkProxyCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) {
fProxy->drawRect(rect, paint);
}
-void SkProxyCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
+void SkProxyCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
fProxy->drawRRect(rrect, paint);
}
@@ -91,34 +91,36 @@ void SkProxyCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
fProxy->drawDRRect(outer, inner, paint);
}
-void SkProxyCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
+void SkProxyCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
fProxy->drawPath(path, paint);
}
-void SkProxyCanvas::drawImage(const SkImage* image, SkScalar left, SkScalar top,
- const SkPaint* paint) {
+void SkProxyCanvas::onDrawImage(const SkImage* image, SkScalar left, SkScalar top,
+ const SkPaint* paint) {
fProxy->drawImage(image, left, top, paint);
}
-void SkProxyCanvas::drawImageRect(const SkImage* image, const SkRect* src,
- const SkRect& dst,
- const SkPaint* paint) {
+void SkProxyCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint) {
fProxy->drawImageRect(image, src, dst, paint);
}
-void SkProxyCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
- const SkPaint* paint) {
+void SkProxyCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
+ const SkPaint* paint) {
fProxy->drawBitmap(bitmap, x, y, paint);
}
-void SkProxyCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
- const SkRect& dst, const SkPaint* paint,
- DrawBitmapRectFlags flags) {
+void SkProxyCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint, DrawBitmapRectFlags flags) {
fProxy->drawBitmapRectToRect(bitmap, src, dst, paint, flags);
}
-void SkProxyCanvas::drawSprite(const SkBitmap& bitmap, int x, int y,
- const SkPaint* paint) {
+void SkProxyCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
+ const SkRect& dst, const SkPaint* paint) {
+ fProxy->drawBitmapNine(bitmap, center, dst, paint);
+}
+
+void SkProxyCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint* paint) {
fProxy->drawSprite(bitmap, x, y, paint);
}
@@ -152,11 +154,11 @@ void SkProxyCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matr
fProxy->drawPicture(picture, matrix, paint);
}
-void SkProxyCanvas::drawVertices(VertexMode vmode, int vertexCount,
- const SkPoint vertices[], const SkPoint texs[],
- const SkColor colors[], SkXfermode* xmode,
- const uint16_t indices[], int indexCount,
- const SkPaint& paint) {
+void SkProxyCanvas::onDrawVertices(VertexMode vmode, int vertexCount,
+ const SkPoint vertices[], const SkPoint texs[],
+ const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount,
+ const SkPaint& paint) {
fProxy->drawVertices(vmode, vertexCount, vertices, texs, colors,
xmode, indices, indexCount, paint);
}
diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp
index 238d4688a8..77cf8a027b 100644
--- a/src/utils/debugger/SkDebugCanvas.cpp
+++ b/src/utils/debugger/SkDebugCanvas.cpp
@@ -431,23 +431,31 @@ void SkDebugCanvas::didConcat(const SkMatrix& matrix) {
this->INHERITED::didConcat(matrix);
}
-void SkDebugCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar left,
- SkScalar top, const SkPaint* paint = NULL) {
+void SkDebugCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar left,
+ SkScalar top, const SkPaint* paint) {
this->addDrawCommand(new SkDrawBitmapCommand(bitmap, left, top, paint));
}
-void SkDebugCanvas::drawBitmapRectToRect(const SkBitmap& bitmap,
- const SkRect* src, const SkRect& dst,
- const SkPaint* paint,
- SkCanvas::DrawBitmapRectFlags flags) {
+void SkDebugCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint, DrawBitmapRectFlags flags) {
this->addDrawCommand(new SkDrawBitmapRectCommand(bitmap, src, dst, paint, flags));
}
-void SkDebugCanvas::drawBitmapNine(const SkBitmap& bitmap,
- const SkIRect& center, const SkRect& dst, const SkPaint* paint) {
+void SkDebugCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
+ const SkRect& dst, const SkPaint* paint) {
this->addDrawCommand(new SkDrawBitmapNineCommand(bitmap, center, dst, paint));
}
+void SkDebugCanvas::onDrawImage(const SkImage* image, SkScalar left, SkScalar top,
+ const SkPaint* paint) {
+ SkDebugf("SkDebugCanvas::onDrawImage unimplemented\n");
+}
+
+void SkDebugCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint) {
+ SkDebugf("SkDebugCanvas::onDrawImageRect unimplemented\n");
+}
+
void SkDebugCanvas::beginCommentGroup(const char* description) {
this->addDrawCommand(new SkBeginCommentGroupCommand(description));
}
@@ -460,15 +468,15 @@ void SkDebugCanvas::endCommentGroup() {
this->addDrawCommand(new SkEndCommentGroupCommand());
}
-void SkDebugCanvas::drawOval(const SkRect& oval, const SkPaint& paint) {
+void SkDebugCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) {
this->addDrawCommand(new SkDrawOvalCommand(oval, paint));
}
-void SkDebugCanvas::drawPaint(const SkPaint& paint) {
+void SkDebugCanvas::onDrawPaint(const SkPaint& paint) {
this->addDrawCommand(new SkDrawPaintCommand(paint));
}
-void SkDebugCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
+void SkDebugCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
this->addDrawCommand(new SkDrawPathCommand(path, paint));
}
@@ -478,8 +486,8 @@ void SkDebugCanvas::onDrawPicture(const SkPicture* picture,
this->addDrawCommand(new SkDrawPictureCommand(picture, matrix, paint));
}
-void SkDebugCanvas::drawPoints(PointMode mode, size_t count,
- const SkPoint pts[], const SkPaint& paint) {
+void SkDebugCanvas::onDrawPoints(PointMode mode, size_t count,
+ const SkPoint pts[], const SkPaint& paint) {
this->addDrawCommand(new SkDrawPointsCommand(mode, count, pts, paint));
}
@@ -494,12 +502,12 @@ void SkDebugCanvas::onDrawPosTextH(const void* text, size_t byteLength, const Sk
new SkDrawPosTextHCommand(text, byteLength, xpos, constY, paint));
}
-void SkDebugCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
+void SkDebugCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) {
// NOTE(chudy): Messing up when renamed to DrawRect... Why?
addDrawCommand(new SkDrawRectCommand(rect, paint));
}
-void SkDebugCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
+void SkDebugCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
this->addDrawCommand(new SkDrawRRectCommand(rrect, paint));
}
@@ -508,8 +516,7 @@ void SkDebugCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
this->addDrawCommand(new SkDrawDRRectCommand(outer, inner, paint));
}
-void SkDebugCanvas::drawSprite(const SkBitmap& bitmap, int left, int top,
- const SkPaint* paint = NULL) {
+void SkDebugCanvas::onDrawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint) {
this->addDrawCommand(new SkDrawSpriteCommand(bitmap, left, top, paint));
}
@@ -529,10 +536,10 @@ void SkDebugCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar
this->addDrawCommand(new SkDrawTextBlobCommand(blob, x, y, paint));
}
-void SkDebugCanvas::drawVertices(VertexMode vmode, int vertexCount,
- const SkPoint vertices[], const SkPoint texs[], const SkColor colors[],
- SkXfermode*, const uint16_t indices[], int indexCount,
- const SkPaint& paint) {
+void SkDebugCanvas::onDrawVertices(VertexMode vmode, int vertexCount, const SkPoint vertices[],
+ const SkPoint texs[], const SkColor colors[],
+ SkXfermode*, const uint16_t indices[], int indexCount,
+ const SkPaint& paint) {
this->addDrawCommand(new SkDrawVerticesCommand(vmode, vertexCount, vertices,
texs, colors, NULL, indices, indexCount, paint));
}
diff --git a/src/utils/debugger/SkDebugCanvas.h b/src/utils/debugger/SkDebugCanvas.h
index a74c41354f..d74d30d24d 100644
--- a/src/utils/debugger/SkDebugCanvas.h
+++ b/src/utils/debugger/SkDebugCanvas.h
@@ -148,44 +148,10 @@ public:
// Inherited from SkCanvas
////////////////////////////////////////////////////////////////////////////////
- virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top,
- const SkPaint*) SK_OVERRIDE;
-
- virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src,
- const SkRect& dst, const SkPaint* paint,
- DrawBitmapRectFlags flags) SK_OVERRIDE;
-
- virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
- const SkRect& dst, const SkPaint*) SK_OVERRIDE;
-
virtual void beginCommentGroup(const char* description) SK_OVERRIDE;
-
virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE;
-
virtual void endCommentGroup() SK_OVERRIDE;
- virtual void drawOval(const SkRect& oval, const SkPaint&) SK_OVERRIDE;
-
- virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
-
- virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE;
-
- virtual void drawPoints(PointMode, size_t count, const SkPoint pts[],
- const SkPaint&) SK_OVERRIDE;
-
- virtual void drawRect(const SkRect& rect, const SkPaint&) SK_OVERRIDE;
-
- virtual void drawRRect(const SkRRect& rrect, const SkPaint& paint) SK_OVERRIDE;
-
- virtual void drawSprite(const SkBitmap&, int left, int top,
- const SkPaint*) SK_OVERRIDE;
-
- virtual void drawVertices(VertexMode, int vertexCount,
- const SkPoint vertices[], const SkPoint texs[],
- const SkColor colors[], SkXfermode*,
- const uint16_t indices[], int indexCount,
- const SkPaint&) SK_OVERRIDE;
-
static const int kVizImageHeight = 256;
static const int kVizImageWidth = 256;
@@ -226,6 +192,27 @@ protected:
virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) SK_OVERRIDE;
+ void onDrawPaint(const SkPaint&) SK_OVERRIDE;
+ void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) SK_OVERRIDE;
+ void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
+ void onDrawPath(const SkPath&, const SkPaint&) SK_OVERRIDE;
+ void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
+ void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
+ DrawBitmapRectFlags flags) SK_OVERRIDE;
+ void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
+ void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
+ const SkPaint*) SK_OVERRIDE;
+ void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
+ const SkPaint*) SK_OVERRIDE;
+ void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVERRIDE;
+ void onDrawVertices(VertexMode vmode, int vertexCount,
+ const SkPoint vertices[], const SkPoint texs[],
+ const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount,
+ const SkPaint&) SK_OVERRIDE;
+
virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
diff --git a/tests/RecordDrawTest.cpp b/tests/RecordDrawTest.cpp
index d306cad6e9..ec3680c3a9 100644
--- a/tests/RecordDrawTest.cpp
+++ b/tests/RecordDrawTest.cpp
@@ -288,16 +288,14 @@ DEF_TEST(RecordDraw_drawImage, r){
SkCanvasMock(int width, int height) : SkCanvas(width, height) {
this->resetTestValues();
}
- virtual ~SkCanvasMock() {}
- virtual void drawImage(const SkImage* image, SkScalar left, SkScalar top,
- const SkPaint* paint = NULL) SK_OVERRIDE {
+ void onDrawImage(const SkImage* image, SkScalar left, SkScalar top,
+ const SkPaint* paint) SK_OVERRIDE {
fDrawImageCalled = true;
}
- virtual void drawImageRect(const SkImage* image, const SkRect* src,
- const SkRect& dst,
- const SkPaint* paint = NULL) SK_OVERRIDE {
+ void onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint) SK_OVERRIDE {
fDrawImageRectCalled = true;
}
diff --git a/tests/TileGridTest.cpp b/tests/TileGridTest.cpp
index c063fb0310..3cb32070b3 100644
--- a/tests/TileGridTest.cpp
+++ b/tests/TileGridTest.cpp
@@ -23,7 +23,7 @@ class MockCanvas : public SkCanvas {
public:
MockCanvas(const SkBitmap& bm) : SkCanvas(bm) {}
- virtual void drawRect(const SkRect& rect, const SkPaint&) {
+ void onDrawRect(const SkRect& rect, const SkPaint&) SK_OVERRIDE {
// This capture occurs before quick reject.
fRects.push(rect);
}