diff options
author | reed <reed@google.com> | 2015-01-05 07:49:08 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-05 07:49:08 -0800 |
commit | 41af966ab338e95eee81ab618ab28195075338f7 (patch) | |
tree | e11def4f93345bfb4204d20f6f28fc7a2fecda1a /src | |
parent | 49aabde6ef80e39f00a2d00487cf5a881987dd81 (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 'src')
-rw-r--r-- | src/core/SkCanvas.cpp | 109 | ||||
-rw-r--r-- | src/core/SkPictureRecord.cpp | 41 | ||||
-rw-r--r-- | src/core/SkPictureRecord.h | 45 | ||||
-rw-r--r-- | src/core/SkRecorder.cpp | 66 | ||||
-rw-r--r-- | src/core/SkRecorder.h | 62 | ||||
-rw-r--r-- | src/pipe/SkGPipeWrite.cpp | 85 | ||||
-rw-r--r-- | src/utils/SkDeferredCanvas.cpp | 48 | ||||
-rw-r--r-- | src/utils/SkDumpCanvas.cpp | 69 | ||||
-rw-r--r-- | src/utils/SkLuaCanvas.cpp | 51 | ||||
-rw-r--r-- | src/utils/SkNWayCanvas.cpp | 49 | ||||
-rw-r--r-- | src/utils/SkProxyCanvas.cpp | 50 | ||||
-rw-r--r-- | src/utils/debugger/SkDebugCanvas.cpp | 49 | ||||
-rw-r--r-- | src/utils/debugger/SkDebugCanvas.h | 55 |
13 files changed, 430 insertions, 349 deletions
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, ¢erStr); + 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; |