aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-01-05 07:49:08 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-05 07:49:08 -0800
commit41af966ab338e95eee81ab618ab28195075338f7 (patch)
treee11def4f93345bfb4204d20f6f28fc7a2fecda1a /include/core
parent49aabde6ef80e39f00a2d00487cf5a881987dd81 (diff)
Revert of Revert of move remaining virtual draw methods to onDraw (patchset #1 id:1 of https://codereview.chromium.org/835913002/)
Reason for revert: test to see if it wasn't this CL that broke chromeos Original issue's description: > Revert of move remaining virtual draw methods to onDraw (patchset #5 id:80001 of https://codereview.chromium.org/817723005/) > > Reason for revert: > did this cause chromeos heap corruption on skp? > > Original issue's description: > > move remaining virtual draw methods to onDraw > > > > BUG=skia: > > > > Committed: https://skia.googlesource.com/skia/+/2e0f7d53bba5438c9bf11ee5ccae2c301e348419 > > TBR=robertphillips@google.com,djsollen@google.com,bsalomon@google.com,mtklein@google.com > NOTREECHECKS=true > NOTRY=true > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/e87e383351e1547b21d96d02bcd0c3cbbe0837f1 TBR=robertphillips@google.com,djsollen@google.com,bsalomon@google.com,mtklein@google.com,reed@chromium.org NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/831253002
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkCanvas.h52
-rw-r--r--include/core/SkImage.h1
2 files changed, 39 insertions, 14 deletions
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;