diff options
author | reed <reed@chromium.org> | 2015-01-05 04:49:38 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-05 04:49:38 -0800 |
commit | e87e383351e1547b21d96d02bcd0c3cbbe0837f1 (patch) | |
tree | 0a801ccf7519250589c28f06fe17d05882c16b88 /src | |
parent | f3a9e993399fcb8dae4bf6f1dd9674a72b289da3 (diff) |
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:
Review URL: https://codereview.chromium.org/835913002
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, 349 insertions, 430 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 13b84e7f0f..09b9783cb9 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -1196,7 +1196,8 @@ void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y, LOOPER_END } -void SkCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint* paint) { +void SkCanvas::drawSprite(const SkBitmap& bitmap, int x, int y, + const SkPaint* paint) { if (gTreatSpriteAsBitmap) { this->save(); this->resetMatrix(); @@ -1670,66 +1671,6 @@ 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 ////////////////////////////////////////////////////////////////////////////// @@ -1740,7 +1681,7 @@ void SkCanvas::onDiscard() { } } -void SkCanvas::onDrawPaint(const SkPaint& paint) { +void SkCanvas::drawPaint(const SkPaint& paint) { TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPaint()"); this->internalDrawPaint(paint); } @@ -1755,8 +1696,8 @@ void SkCanvas::internalDrawPaint(const SkPaint& paint) { LOOPER_END } -void SkCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[], - const SkPaint& paint) { +void SkCanvas::drawPoints(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; @@ -1788,7 +1729,7 @@ void SkCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[], LOOPER_END } -void SkCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) { +void SkCanvas::drawRect(const SkRect& r, const SkPaint& paint) { TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRect()"); SkRect storage; const SkRect* bounds = NULL; @@ -1808,7 +1749,7 @@ void SkCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) { LOOPER_END } -void SkCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) { +void SkCanvas::drawOval(const SkRect& oval, const SkPaint& paint) { TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawOval()"); SkRect storage; const SkRect* bounds = NULL; @@ -1828,7 +1769,7 @@ void SkCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) { LOOPER_END } -void SkCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { +void SkCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRRect()"); SkRect storage; const SkRect* bounds = NULL; @@ -1878,7 +1819,7 @@ void SkCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, LOOPER_END } -void SkCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) { +void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) { TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPath()"); if (!path.isFinite()) { return; @@ -1911,18 +1852,21 @@ void SkCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) { LOOPER_END } -void SkCanvas::onDrawImage(const SkImage* image, SkScalar dx, SkScalar dy, const SkPaint* paint) { +void SkCanvas::drawImage(const SkImage* image, SkScalar left, SkScalar top, + const SkPaint* paint) { TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImage()"); - image->draw(this, dx, dy, paint); + image->draw(this, left, top, paint); } -void SkCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst, - const SkPaint* paint) { +void SkCanvas::drawImageRect(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::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, const SkPaint* paint) { +void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, + const SkPaint* paint) { TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmap()"); SkDEBUGCODE(bitmap.validate();) @@ -1978,8 +1922,9 @@ void SkCanvas::internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, LOOPER_END } -void SkCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst, - const SkPaint* paint, DrawBitmapRectFlags flags) { +void SkCanvas::drawBitmapRectToRect(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); @@ -2055,8 +2000,8 @@ void SkCanvas::internalDrawBitmapNine(const SkBitmap& bitmap, } } -void SkCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst, - const SkPaint* paint) { +void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, + const SkRect& dst, const SkPaint* paint) { TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmapNine()"); SkDEBUGCODE(bitmap.validate();) @@ -2263,11 +2208,11 @@ void SkCanvas::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, } } -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) { +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) { 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 53ecdd0be6..fcae49ad68 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::onDrawPaint(const SkPaint& paint) { +void SkPictureRecord::drawPaint(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::onDrawPaint(const SkPaint& paint) { this->validate(initialOffset, size); } -void SkPictureRecord::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[], - const SkPaint& paint) { +void SkPictureRecord::drawPoints(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::onDrawPoints(PointMode mode, size_t count, const SkPoint p this->validate(initialOffset, size); } -void SkPictureRecord::onDrawOval(const SkRect& oval, const SkPaint& paint) { +void SkPictureRecord::drawOval(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::onDrawOval(const SkRect& oval, const SkPaint& paint) { this->validate(initialOffset, size); } -void SkPictureRecord::onDrawRect(const SkRect& rect, const SkPaint& paint) { +void SkPictureRecord::drawRect(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::onDrawRect(const SkRect& rect, const SkPaint& paint) { this->validate(initialOffset, size); } -void SkPictureRecord::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { +void SkPictureRecord::drawRRect(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::onDrawPath(const SkPath& path, const SkPaint& paint) { +void SkPictureRecord::drawPath(const SkPath& path, const SkPaint& paint) { fContentInfo.onDrawPath(path, paint); // op + paint index + path index @@ -530,8 +530,8 @@ void SkPictureRecord::onDrawPath(const SkPath& path, const SkPaint& paint) { this->validate(initialOffset, size); } -void SkPictureRecord::onDrawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, - const SkPaint* paint) { +void SkPictureRecord::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, + const SkPaint* paint = NULL) { // op + paint index + bitmap index + left + top size_t size = 3 * kUInt32Size + 2 * sizeof(SkScalar); size_t initialOffset = this->addDraw(DRAW_BITMAP, &size); @@ -543,8 +543,9 @@ void SkPictureRecord::onDrawBitmap(const SkBitmap& bitmap, SkScalar left, SkScal this->validate(initialOffset, size); } -void SkPictureRecord::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst, - const SkPaint* paint, DrawBitmapRectFlags flags) { +void SkPictureRecord::drawBitmapRectToRect(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) { @@ -563,8 +564,8 @@ void SkPictureRecord::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src this->validate(initialOffset, size); } -void SkPictureRecord::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, - const SkRect& dst, const SkPaint* paint) { +void SkPictureRecord::drawBitmapNine(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); @@ -576,8 +577,8 @@ void SkPictureRecord::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& ce this->validate(initialOffset, size); } -void SkPictureRecord::onDrawSprite(const SkBitmap& bitmap, int left, int top, - const SkPaint* paint) { +void SkPictureRecord::drawSprite(const SkBitmap& bitmap, int left, int top, + const SkPaint* paint = NULL) { // op + paint index + bitmap index + left + top size_t size = 5 * kUInt32Size; size_t initialOffset = this->addDraw(DRAW_SPRITE, &size); @@ -692,11 +693,11 @@ void SkPictureRecord::onDrawPicture(const SkPicture* picture, const SkMatrix* ma this->validate(initialOffset, size); } -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) { +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) { uint32_t flags = 0; if (texs) { flags |= DRAW_VERTICES_HAS_TEXS; diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h index ca2c13329c..009506394e 100644 --- a/src/core/SkPictureRecord.h +++ b/src/core/SkPictureRecord.h @@ -29,6 +29,27 @@ 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; @@ -175,30 +196,6 @@ 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 de16d6244f..55b8a00588 100644 --- a/src/core/SkRecorder.cpp +++ b/src/core/SkRecorder.cpp @@ -116,26 +116,26 @@ char* SkRecorder::copy(const char* src) { } -void SkRecorder::onDrawPaint(const SkPaint& paint) { +void SkRecorder::drawPaint(const SkPaint& paint) { APPEND(DrawPaint, delay_copy(paint)); } -void SkRecorder::onDrawPoints(PointMode mode, - size_t count, - const SkPoint pts[], - const SkPaint& paint) { +void SkRecorder::drawPoints(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::onDrawRect(const SkRect& rect, const SkPaint& paint) { +void SkRecorder::drawRect(const SkRect& rect, const SkPaint& paint) { APPEND(DrawRect, delay_copy(paint), rect); } -void SkRecorder::onDrawOval(const SkRect& oval, const SkPaint& paint) { +void SkRecorder::drawOval(const SkRect& oval, const SkPaint& paint) { APPEND(DrawOval, delay_copy(paint), oval); } -void SkRecorder::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { +void SkRecorder::drawRRect(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::onDrawPath(const SkPath& path, const SkPaint& paint) { +void SkRecorder::drawPath(const SkPath& path, const SkPaint& paint) { APPEND(DrawPath, delay_copy(paint), delay_copy(path)); } -void SkRecorder::onDrawBitmap(const SkBitmap& bitmap, - SkScalar left, - SkScalar top, - const SkPaint* paint) { +void SkRecorder::drawBitmap(const SkBitmap& bitmap, + SkScalar left, + SkScalar top, + const SkPaint* paint) { APPEND(DrawBitmap, this->copy(paint), delay_copy(bitmap), left, top); } -void SkRecorder::onDrawBitmapRect(const SkBitmap& bitmap, - const SkRect* src, - const SkRect& dst, - const SkPaint* paint, - DrawBitmapRectFlags flags) { +void SkRecorder::drawBitmapRectToRect(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::onDrawBitmapRect(const SkBitmap& bitmap, this->copy(paint), delay_copy(bitmap), this->copy(src), dst); } -void SkRecorder::onDrawBitmapNine(const SkBitmap& bitmap, - const SkIRect& center, - const SkRect& dst, - const SkPaint* paint) { +void SkRecorder::drawBitmapNine(const SkBitmap& bitmap, + const SkIRect& center, + const SkRect& dst, + const SkPaint* paint) { APPEND(DrawBitmapNine, this->copy(paint), delay_copy(bitmap), center, dst); } -void SkRecorder::onDrawImage(const SkImage* image, SkScalar left, SkScalar top, - const SkPaint* paint) { +void SkRecorder::drawImage(const SkImage* image, SkScalar left, SkScalar top, + const SkPaint* paint) { APPEND(DrawImage, this->copy(paint), image, left, top); } -void SkRecorder::onDrawImageRect(const SkImage* image, const SkRect* src, - const SkRect& dst, - const SkPaint* paint) { +void SkRecorder::drawImageRect(const SkImage* image, const SkRect* src, + const SkRect& dst, + const SkPaint* paint) { APPEND(DrawImageRect, this->copy(paint), image, this->copy(src), dst); } -void SkRecorder::onDrawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint) { +void SkRecorder::drawSprite(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::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) { +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) { APPEND(DrawVertices, delay_copy(paint), vmode, vertexCount, diff --git a/src/core/SkRecorder.h b/src/core/SkRecorder.h index 611dbbdcd7..0e4252baac 100644 --- a/src/core/SkRecorder.h +++ b/src/core/SkRecorder.h @@ -45,6 +45,47 @@ 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 {} @@ -82,27 +123,6 @@ 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 6044360933..45b26dbaf8 100644 --- a/src/pipe/SkGPipeWrite.cpp +++ b/src/pipe/SkGPipeWrite.cpp @@ -231,6 +231,28 @@ 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; @@ -263,29 +285,6 @@ 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; @@ -669,7 +668,7 @@ void SkGPipeCanvas::onClipRegion(const SkRegion& region, SkRegion::Op rgnOp) { /////////////////////////////////////////////////////////////////////////////// -void SkGPipeCanvas::onDrawPaint(const SkPaint& paint) { +void SkGPipeCanvas::drawPaint(const SkPaint& paint) { NOTIFY_SETUP(this); this->writePaint(paint); if (this->needOpBytes()) { @@ -677,8 +676,8 @@ void SkGPipeCanvas::onDrawPaint(const SkPaint& paint) { } } -void SkGPipeCanvas::onDrawPoints(PointMode mode, size_t count, - const SkPoint pts[], const SkPaint& paint) { +void SkGPipeCanvas::drawPoints(PointMode mode, size_t count, + const SkPoint pts[], const SkPaint& paint) { if (count) { NOTIFY_SETUP(this); this->writePaint(paint); @@ -690,7 +689,7 @@ void SkGPipeCanvas::onDrawPoints(PointMode mode, size_t count, } } -void SkGPipeCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) { +void SkGPipeCanvas::drawOval(const SkRect& rect, const SkPaint& paint) { NOTIFY_SETUP(this); this->writePaint(paint); if (this->needOpBytes(sizeof(SkRect))) { @@ -699,7 +698,7 @@ void SkGPipeCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) { } } -void SkGPipeCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) { +void SkGPipeCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { NOTIFY_SETUP(this); this->writePaint(paint); if (this->needOpBytes(sizeof(SkRect))) { @@ -708,7 +707,7 @@ void SkGPipeCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) { } } -void SkGPipeCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { +void SkGPipeCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { NOTIFY_SETUP(this); this->writePaint(paint); if (this->needOpBytes(kSizeOfFlatRRect)) { @@ -728,7 +727,7 @@ void SkGPipeCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, } } -void SkGPipeCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) { +void SkGPipeCanvas::drawPath(const SkPath& path, const SkPaint& paint) { NOTIFY_SETUP(this); this->writePaint(paint); if (this->needOpBytes(path.writeToMemory(NULL))) { @@ -764,8 +763,8 @@ bool SkGPipeCanvas::commonDrawBitmap(const SkBitmap& bm, DrawOps op, return false; } -void SkGPipeCanvas::onDrawBitmap(const SkBitmap& bm, SkScalar left, SkScalar top, - const SkPaint* paint) { +void SkGPipeCanvas::drawBitmap(const SkBitmap& bm, SkScalar left, SkScalar top, + const SkPaint* paint) { NOTIFY_SETUP(this); size_t opBytesNeeded = sizeof(SkScalar) * 2; @@ -775,8 +774,9 @@ void SkGPipeCanvas::onDrawBitmap(const SkBitmap& bm, SkScalar left, SkScalar top } } -void SkGPipeCanvas::onDrawBitmapRect(const SkBitmap& bm, const SkRect* src, const SkRect& dst, - const SkPaint* paint, DrawBitmapRectFlags dbmrFlags) { +void SkGPipeCanvas::drawBitmapRectToRect(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::onDrawBitmapRect(const SkBitmap& bm, const SkRect* src, cons } } -void SkGPipeCanvas::onDrawBitmapNine(const SkBitmap& bm, const SkIRect& center, - const SkRect& dst, const SkPaint* paint) { +void SkGPipeCanvas::drawBitmapNine(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,7 +813,8 @@ void SkGPipeCanvas::onDrawBitmapNine(const SkBitmap& bm, const SkIRect& center, } } -void SkGPipeCanvas::onDrawSprite(const SkBitmap& bm, int left, int top, const SkPaint* paint) { +void SkGPipeCanvas::drawSprite(const SkBitmap& bm, int left, int top, + const SkPaint* paint) { NOTIFY_SETUP(this); size_t opBytesNeeded = sizeof(int32_t) * 2; @@ -979,11 +980,11 @@ void SkGPipeCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matr this->INHERITED::onDrawPicture(picture, matrix, 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) { +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) { if (0 == vertexCount) { return; } diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp index a41b3ab3b4..5083cf7e42 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::onDrawPaint(const SkPaint& paint) { +void SkDeferredCanvas::drawPaint(const SkPaint& paint) { if (fDeferredDrawing && this->isFullFrame(NULL, &paint) && isPaintOpaque(&paint)) { this->getDeferredDevice()->skipPendingCommands(); @@ -764,20 +764,20 @@ void SkDeferredCanvas::onDrawPaint(const SkPaint& paint) { this->recordedDrawCommand(); } -void SkDeferredCanvas::onDrawPoints(PointMode mode, size_t count, - const SkPoint pts[], const SkPaint& paint) { +void SkDeferredCanvas::drawPoints(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::onDrawOval(const SkRect& rect, const SkPaint& paint) { +void SkDeferredCanvas::drawOval(const SkRect& rect, const SkPaint& paint) { AutoImmediateDrawIfNeeded autoDraw(*this, &paint); this->drawingCanvas()->drawOval(rect, paint); this->recordedDrawCommand(); } -void SkDeferredCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) { +void SkDeferredCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { if (fDeferredDrawing && this->isFullFrame(&rect, &paint) && isPaintOpaque(&paint)) { this->getDeferredDevice()->skipPendingCommands(); @@ -788,7 +788,7 @@ void SkDeferredCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) { this->recordedDrawCommand(); } -void SkDeferredCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { +void SkDeferredCanvas::drawRRect(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::onDrawPath(const SkPath& path, const SkPaint& paint) { +void SkDeferredCanvas::drawPath(const SkPath& path, const SkPaint& paint) { AutoImmediateDrawIfNeeded autoDraw(*this, &paint); this->drawingCanvas()->drawPath(path, paint); this->recordedDrawCommand(); } -void SkDeferredCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar left, - SkScalar top, const SkPaint* paint) { +void SkDeferredCanvas::drawBitmap(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,9 +828,11 @@ void SkDeferredCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar left, this->recordedDrawCommand(); } -void SkDeferredCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, - const SkRect& dst, - const SkPaint* paint, DrawBitmapRectFlags flags) { +void SkDeferredCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, + const SkRect* src, + const SkRect& dst, + const SkPaint* paint, + DrawBitmapRectFlags flags) { if (fDeferredDrawing && this->isFullFrame(&dst, paint) && isPaintOpaque(paint, &bitmap)) { @@ -842,9 +844,9 @@ void SkDeferredCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* sr this->recordedDrawCommand(); } -void SkDeferredCanvas::onDrawBitmapNine(const SkBitmap& bitmap, - const SkIRect& center, const SkRect& dst, - const SkPaint* paint) { +void SkDeferredCanvas::drawBitmapNine(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); @@ -852,8 +854,8 @@ void SkDeferredCanvas::onDrawBitmapNine(const SkBitmap& bitmap, this->recordedDrawCommand(); } -void SkDeferredCanvas::onDrawSprite(const SkBitmap& bitmap, int left, int top, - const SkPaint* paint) { +void SkDeferredCanvas::drawSprite(const SkBitmap& bitmap, int left, int top, + const SkPaint* paint) { SkRect bitmapRect = SkRect::MakeXYWH( SkIntToScalar(left), SkIntToScalar(top), @@ -911,12 +913,12 @@ void SkDeferredCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* m this->recordedDrawCommand(); } -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) { +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) { 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 54ca691dce..1bfb1ba806 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::onDrawPaint(const SkPaint& paint) { +void SkDumpCanvas::drawPaint(const SkPaint& paint) { this->dump(kDrawPaint_Verb, &paint, "drawPaint()"); } -void SkDumpCanvas::onDrawPoints(PointMode mode, size_t count, +void SkDumpCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint& paint) { this->dump(kDrawPoints_Verb, &paint, "drawPoints(%s, %d)", toString(mode), count); } -void SkDumpCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) { +void SkDumpCanvas::drawOval(const SkRect& rect, const SkPaint& paint) { SkString str; toString(rect, &str); this->dump(kDrawOval_Verb, &paint, "drawOval(%s)", str.c_str()); } -void SkDumpCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) { +void SkDumpCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { SkString str; toString(rect, &str); this->dump(kDrawRect_Verb, &paint, "drawRect(%s)", str.c_str()); } -void SkDumpCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { +void SkDumpCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { SkString str; toString(rrect, &str); this->dump(kDrawDRRect_Verb, &paint, "drawRRect(%s)", str.c_str()); @@ -331,22 +331,23 @@ void SkDumpCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, str0.c_str(), str1.c_str()); } -void SkDumpCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) { +void SkDumpCanvas::drawPath(const SkPath& path, const SkPaint& paint) { SkString str; toString(path, &str); this->dump(kDrawPath_Verb, &paint, "drawPath(%s)", str.c_str()); } -void SkDumpCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, - const SkPaint* paint) { +void SkDumpCanvas::drawBitmap(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::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst, - const SkPaint* paint, DrawBitmapRectFlags flags) { +void SkDumpCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, + const SkRect& dst, const SkPaint* paint, + DrawBitmapRectFlags flags) { SkString bs, rs; bitmap.toString(&bs); toString(dst, &rs); @@ -363,42 +364,8 @@ void SkDumpCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, c bs.c_str(), rs.c_str()); } -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) { +void SkDumpCanvas::drawSprite(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(), @@ -460,11 +427,11 @@ void SkDumpCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matri picture->cullRect().fRight, picture->cullRect().fBottom); } -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) { +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) { 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 68094f2ca0..ca04ba9d22 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::onDrawPaint(const SkPaint& paint) { +void SkLuaCanvas::drawPaint(const SkPaint& paint) { AUTO_LUA("drawPaint"); lua.pushPaint(paint, "paint"); } -void SkLuaCanvas::onDrawPoints(PointMode mode, size_t count, +void SkLuaCanvas::drawPoints(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::onDrawOval(const SkRect& rect, const SkPaint& paint) { +void SkLuaCanvas::drawOval(const SkRect& rect, const SkPaint& paint) { AUTO_LUA("drawOval"); lua.pushRect(rect, "rect"); lua.pushPaint(paint, "paint"); } -void SkLuaCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) { +void SkLuaCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { AUTO_LUA("drawRect"); lua.pushRect(rect, "rect"); lua.pushPaint(paint, "paint"); } -void SkLuaCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { +void SkLuaCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { AUTO_LUA("drawRRect"); lua.pushRRect(rrect, "rrect"); lua.pushPaint(paint, "paint"); @@ -200,52 +200,31 @@ void SkLuaCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, lua.pushPaint(paint, "paint"); } -void SkLuaCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) { +void SkLuaCanvas::drawPath(const SkPath& path, const SkPaint& paint) { AUTO_LUA("drawPath"); lua.pushPath(path, "path"); lua.pushPaint(paint, "paint"); } -void SkLuaCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, - const SkPaint* paint) { +void SkLuaCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, + const SkPaint* paint) { AUTO_LUA("drawBitmap"); if (paint) { lua.pushPaint(*paint, "paint"); } } -void SkLuaCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst, - const SkPaint* paint, DrawBitmapRectFlags flags) { - AUTO_LUA("drawBitmapRect"); +void SkLuaCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, + const SkRect& dst, const SkPaint* paint, + DrawBitmapRectFlags flags) { + AUTO_LUA("drawBitmapRectToRect"); if (paint) { lua.pushPaint(*paint, "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) { +void SkLuaCanvas::drawSprite(const SkBitmap& bitmap, int x, int y, + const SkPaint* paint) { AUTO_LUA("drawSprite"); if (paint) { lua.pushPaint(*paint, "paint"); @@ -297,7 +276,7 @@ void SkLuaCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix this->INHERITED::onDrawPicture(picture, matrix, paint); } -void SkLuaCanvas::onDrawVertices(VertexMode vmode, int vertexCount, +void SkLuaCanvas::drawVertices(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 14ad6d6f81..f696de8e41 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::onDrawPaint(const SkPaint& paint) { +void SkNWayCanvas::drawPaint(const SkPaint& paint) { Iter iter(fList); while (iter.next()) { iter->drawPaint(paint); } } -void SkNWayCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[], - const SkPaint& paint) { +void SkNWayCanvas::drawPoints(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::onDrawRect(const SkRect& rect, const SkPaint& paint) { +void SkNWayCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { Iter iter(fList); while (iter.next()) { iter->drawRect(rect, paint); } } -void SkNWayCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) { +void SkNWayCanvas::drawOval(const SkRect& rect, const SkPaint& paint) { Iter iter(fList); while (iter.next()) { iter->drawOval(rect, paint); } } -void SkNWayCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { +void SkNWayCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { Iter iter(fList); while (iter.next()) { iter->drawRRect(rrect, paint); @@ -178,54 +178,57 @@ void SkNWayCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, } } -void SkNWayCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) { +void SkNWayCanvas::drawPath(const SkPath& path, const SkPaint& paint) { Iter iter(fList); while (iter.next()) { iter->drawPath(path, paint); } } -void SkNWayCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, - const SkPaint* paint) { +void SkNWayCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, + const SkPaint* paint) { Iter iter(fList); while (iter.next()) { iter->drawBitmap(bitmap, x, y, paint); } } -void SkNWayCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst, - const SkPaint* paint, DrawBitmapRectFlags flags) { +void SkNWayCanvas::drawBitmapRectToRect(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::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, - const SkRect& dst, const SkPaint* paint) { +void SkNWayCanvas::drawBitmapNine(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::onDrawImage(const SkImage* image, SkScalar left, SkScalar top, - const SkPaint* paint) { +void SkNWayCanvas::drawImage(const SkImage* image, SkScalar left, SkScalar top, + const SkPaint* paint) { Iter iter(fList); while (iter.next()) { iter->drawImage(image, left, top, paint); } } -void SkNWayCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst, - const SkPaint* paint) { +void SkNWayCanvas::drawImageRect(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::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint* paint) { +void SkNWayCanvas::drawSprite(const SkBitmap& bitmap, int x, int y, + const SkPaint* paint) { Iter iter(fList); while (iter.next()) { iter->drawSprite(bitmap, x, y, paint); @@ -280,11 +283,11 @@ void SkNWayCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matri } } -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) { +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) { 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 ade4315f3d..161f3c0794 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::onDrawPaint(const SkPaint& paint) { +void SkProxyCanvas::drawPaint(const SkPaint& paint) { fProxy->drawPaint(paint); } -void SkProxyCanvas::onDrawPoints(PointMode mode, size_t count, - const SkPoint pts[], const SkPaint& paint) { +void SkProxyCanvas::drawPoints(PointMode mode, size_t count, + const SkPoint pts[], const SkPaint& paint) { fProxy->drawPoints(mode, count, pts, paint); } -void SkProxyCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) { +void SkProxyCanvas::drawOval(const SkRect& rect, const SkPaint& paint) { fProxy->drawOval(rect, paint); } -void SkProxyCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) { +void SkProxyCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { fProxy->drawRect(rect, paint); } -void SkProxyCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { +void SkProxyCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { fProxy->drawRRect(rrect, paint); } @@ -91,36 +91,34 @@ void SkProxyCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, fProxy->drawDRRect(outer, inner, paint); } -void SkProxyCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) { +void SkProxyCanvas::drawPath(const SkPath& path, const SkPaint& paint) { fProxy->drawPath(path, paint); } -void SkProxyCanvas::onDrawImage(const SkImage* image, SkScalar left, SkScalar top, - const SkPaint* paint) { +void SkProxyCanvas::drawImage(const SkImage* image, SkScalar left, SkScalar top, + const SkPaint* paint) { fProxy->drawImage(image, left, top, paint); } -void SkProxyCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst, - const SkPaint* paint) { +void SkProxyCanvas::drawImageRect(const SkImage* image, const SkRect* src, + const SkRect& dst, + const SkPaint* paint) { fProxy->drawImageRect(image, src, dst, paint); } -void SkProxyCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, - const SkPaint* paint) { +void SkProxyCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, + const SkPaint* paint) { fProxy->drawBitmap(bitmap, x, y, paint); } -void SkProxyCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst, - const SkPaint* paint, DrawBitmapRectFlags flags) { +void SkProxyCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, + const SkRect& dst, const SkPaint* paint, + DrawBitmapRectFlags flags) { fProxy->drawBitmapRectToRect(bitmap, src, dst, paint, flags); } -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) { +void SkProxyCanvas::drawSprite(const SkBitmap& bitmap, int x, int y, + const SkPaint* paint) { fProxy->drawSprite(bitmap, x, y, paint); } @@ -154,11 +152,11 @@ void SkProxyCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matr fProxy->drawPicture(picture, matrix, 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) { +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) { 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 77cf8a027b..238d4688a8 100644 --- a/src/utils/debugger/SkDebugCanvas.cpp +++ b/src/utils/debugger/SkDebugCanvas.cpp @@ -431,31 +431,23 @@ void SkDebugCanvas::didConcat(const SkMatrix& matrix) { this->INHERITED::didConcat(matrix); } -void SkDebugCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar left, - SkScalar top, const SkPaint* paint) { +void SkDebugCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar left, + SkScalar top, const SkPaint* paint = NULL) { this->addDrawCommand(new SkDrawBitmapCommand(bitmap, left, top, paint)); } -void SkDebugCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst, - const SkPaint* paint, DrawBitmapRectFlags flags) { +void SkDebugCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, + const SkRect* src, const SkRect& dst, + const SkPaint* paint, + SkCanvas::DrawBitmapRectFlags flags) { this->addDrawCommand(new SkDrawBitmapRectCommand(bitmap, src, dst, paint, flags)); } -void SkDebugCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, - const SkRect& dst, const SkPaint* paint) { +void SkDebugCanvas::drawBitmapNine(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)); } @@ -468,15 +460,15 @@ void SkDebugCanvas::endCommentGroup() { this->addDrawCommand(new SkEndCommentGroupCommand()); } -void SkDebugCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) { +void SkDebugCanvas::drawOval(const SkRect& oval, const SkPaint& paint) { this->addDrawCommand(new SkDrawOvalCommand(oval, paint)); } -void SkDebugCanvas::onDrawPaint(const SkPaint& paint) { +void SkDebugCanvas::drawPaint(const SkPaint& paint) { this->addDrawCommand(new SkDrawPaintCommand(paint)); } -void SkDebugCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) { +void SkDebugCanvas::drawPath(const SkPath& path, const SkPaint& paint) { this->addDrawCommand(new SkDrawPathCommand(path, paint)); } @@ -486,8 +478,8 @@ void SkDebugCanvas::onDrawPicture(const SkPicture* picture, this->addDrawCommand(new SkDrawPictureCommand(picture, matrix, paint)); } -void SkDebugCanvas::onDrawPoints(PointMode mode, size_t count, - const SkPoint pts[], const SkPaint& paint) { +void SkDebugCanvas::drawPoints(PointMode mode, size_t count, + const SkPoint pts[], const SkPaint& paint) { this->addDrawCommand(new SkDrawPointsCommand(mode, count, pts, paint)); } @@ -502,12 +494,12 @@ void SkDebugCanvas::onDrawPosTextH(const void* text, size_t byteLength, const Sk new SkDrawPosTextHCommand(text, byteLength, xpos, constY, paint)); } -void SkDebugCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) { +void SkDebugCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { // NOTE(chudy): Messing up when renamed to DrawRect... Why? addDrawCommand(new SkDrawRectCommand(rect, paint)); } -void SkDebugCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { +void SkDebugCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { this->addDrawCommand(new SkDrawRRectCommand(rrect, paint)); } @@ -516,7 +508,8 @@ void SkDebugCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, this->addDrawCommand(new SkDrawDRRectCommand(outer, inner, paint)); } -void SkDebugCanvas::onDrawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint) { +void SkDebugCanvas::drawSprite(const SkBitmap& bitmap, int left, int top, + const SkPaint* paint = NULL) { this->addDrawCommand(new SkDrawSpriteCommand(bitmap, left, top, paint)); } @@ -536,10 +529,10 @@ void SkDebugCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar this->addDrawCommand(new SkDrawTextBlobCommand(blob, x, y, 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) { +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) { 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 d74d30d24d..a74c41354f 100644 --- a/src/utils/debugger/SkDebugCanvas.h +++ b/src/utils/debugger/SkDebugCanvas.h @@ -148,10 +148,44 @@ 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; @@ -192,27 +226,6 @@ 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; |