diff options
author | robertphillips <robertphillips@google.com> | 2014-06-04 05:40:44 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-06-04 05:40:44 -0700 |
commit | 9b14f26d0f3a974f3dd626c8354e1db1cfcd322f (patch) | |
tree | 542d5f1d7a1266454675745139e956b4424fde4b /src/utils | |
parent | 232f7259a939c70ce447a729a5094fcc272b679d (diff) |
Alter SkCanvas::drawPicture (devirtualize, take const SkPicture, take pointer)
R=reed@google.com, bsalomon@google.com, mtklein@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/313613004
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/SkDeferredCanvas.cpp | 2 | ||||
-rw-r--r-- | src/utils/SkDumpCanvas.cpp | 10 | ||||
-rw-r--r-- | src/utils/SkGatherPixelRefsAndRects.cpp | 2 | ||||
-rw-r--r-- | src/utils/SkLuaCanvas.cpp | 4 | ||||
-rw-r--r-- | src/utils/SkNWayCanvas.cpp | 2 | ||||
-rw-r--r-- | src/utils/SkPictureUtils.cpp | 2 | ||||
-rw-r--r-- | src/utils/SkProxyCanvas.cpp | 2 | ||||
-rw-r--r-- | src/utils/debugger/SkDebugCanvas.cpp | 2 | ||||
-rw-r--r-- | src/utils/debugger/SkDebugCanvas.h | 4 | ||||
-rw-r--r-- | src/utils/debugger/SkDrawCommand.cpp | 12 | ||||
-rw-r--r-- | src/utils/debugger/SkDrawCommand.h | 4 |
11 files changed, 23 insertions, 23 deletions
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp index 02c2c5af28..e244505263 100644 --- a/src/utils/SkDeferredCanvas.cpp +++ b/src/utils/SkDeferredCanvas.cpp @@ -936,7 +936,7 @@ void SkDeferredCanvas::onDrawTextOnPath(const void* text, size_t byteLength, con this->recordedDrawCommand(); } -void SkDeferredCanvas::drawPicture(SkPicture& picture) { +void SkDeferredCanvas::onDrawPicture(const SkPicture* picture) { this->drawingCanvas()->drawPicture(picture); this->recordedDrawCommand(); } diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp index 9814fb5762..4dfed395e0 100644 --- a/src/utils/SkDumpCanvas.cpp +++ b/src/utils/SkDumpCanvas.cpp @@ -422,14 +422,14 @@ void SkDumpCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const S str.c_str(), byteLength); } -void SkDumpCanvas::drawPicture(SkPicture& picture) { - this->dump(kDrawPicture_Verb, NULL, "drawPicture(%p) %d:%d", &picture, - picture.width(), picture.height()); +void SkDumpCanvas::onDrawPicture(const SkPicture* picture) { + this->dump(kDrawPicture_Verb, NULL, "drawPicture(%p) %d:%d", picture, + picture->width(), picture->height()); fNestLevel += 1; - this->INHERITED::drawPicture(picture); + this->INHERITED::onDrawPicture(picture); fNestLevel -= 1; this->dump(kDrawPicture_Verb, NULL, "endPicture(%p) %d:%d", &picture, - picture.width(), picture.height()); + picture->width(), picture->height()); } void SkDumpCanvas::drawVertices(VertexMode vmode, int vertexCount, diff --git a/src/utils/SkGatherPixelRefsAndRects.cpp b/src/utils/SkGatherPixelRefsAndRects.cpp index 320d99694a..f46fe8ed42 100644 --- a/src/utils/SkGatherPixelRefsAndRects.cpp +++ b/src/utils/SkGatherPixelRefsAndRects.cpp @@ -21,5 +21,5 @@ void SkPictureUtils::GatherPixelRefsAndRects(SkPicture* pict, canvas.clipRect(SkRect::MakeWH(SkIntToScalar(pict->width()), SkIntToScalar(pict->height())), SkRegion::kIntersect_Op, false); - canvas.drawPicture(*pict); + canvas.drawPicture(pict); } diff --git a/src/utils/SkLuaCanvas.cpp b/src/utils/SkLuaCanvas.cpp index b4c7c771c3..d9c5dc1d76 100644 --- a/src/utils/SkLuaCanvas.cpp +++ b/src/utils/SkLuaCanvas.cpp @@ -268,10 +268,10 @@ void SkLuaCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const Sk lua.pushPaint(paint, "paint"); } -void SkLuaCanvas::drawPicture(SkPicture& picture) { +void SkLuaCanvas::onDrawPicture(const SkPicture* picture) { AUTO_LUA("drawPicture"); // call through so we can see the nested picture ops - this->INHERITED::drawPicture(picture); + this->INHERITED::onDrawPicture(picture); } void SkLuaCanvas::drawVertices(VertexMode vmode, int vertexCount, diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp index 3c98e4be09..505c05cbf1 100644 --- a/src/utils/SkNWayCanvas.cpp +++ b/src/utils/SkNWayCanvas.cpp @@ -265,7 +265,7 @@ void SkNWayCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const S } } -void SkNWayCanvas::drawPicture(SkPicture& picture) { +void SkNWayCanvas::onDrawPicture(const SkPicture* picture) { Iter iter(fList); while (iter.next()) { iter->drawPicture(picture); diff --git a/src/utils/SkPictureUtils.cpp b/src/utils/SkPictureUtils.cpp index a2d6da131e..02fa6b11c4 100644 --- a/src/utils/SkPictureUtils.cpp +++ b/src/utils/SkPictureUtils.cpp @@ -214,7 +214,7 @@ SkData* SkPictureUtils::GatherPixelRefs(SkPicture* pict, const SkRect& area) { SkNoSaveLayerCanvas canvas(&device); canvas.clipRect(area, SkRegion::kIntersect_Op, false); - canvas.drawPicture(*pict); + canvas.drawPicture(pict); SkData* data = NULL; int count = array.count(); diff --git a/src/utils/SkProxyCanvas.cpp b/src/utils/SkProxyCanvas.cpp index 20f93071c0..5cb54698f6 100644 --- a/src/utils/SkProxyCanvas.cpp +++ b/src/utils/SkProxyCanvas.cpp @@ -136,7 +136,7 @@ void SkProxyCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const fProxy->drawTextOnPath(text, byteLength, path, matrix, paint); } -void SkProxyCanvas::drawPicture(SkPicture& picture) { +void SkProxyCanvas::onDrawPicture(const SkPicture* picture) { fProxy->drawPicture(picture); } diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp index 89a388e110..8f6dc1b7a2 100644 --- a/src/utils/debugger/SkDebugCanvas.cpp +++ b/src/utils/debugger/SkDebugCanvas.cpp @@ -519,7 +519,7 @@ void SkDebugCanvas::drawPath(const SkPath& path, const SkPaint& paint) { this->addDrawCommand(new SkDrawPathCommand(path, paint)); } -void SkDebugCanvas::drawPicture(SkPicture& picture) { +void SkDebugCanvas::onDrawPicture(const SkPicture* picture) { this->addDrawCommand(new SkDrawPictureCommand(picture)); } diff --git a/src/utils/debugger/SkDebugCanvas.h b/src/utils/debugger/SkDebugCanvas.h index e94f30f335..f15b397251 100644 --- a/src/utils/debugger/SkDebugCanvas.h +++ b/src/utils/debugger/SkDebugCanvas.h @@ -189,8 +189,6 @@ public: virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE; - virtual void drawPicture(SkPicture& picture) SK_OVERRIDE; - virtual void drawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) SK_OVERRIDE; @@ -257,6 +255,8 @@ protected: virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; virtual void onClipRegion(const SkRegion& region, SkRegion::Op) SK_OVERRIDE; + virtual void onDrawPicture(const SkPicture* picture) SK_OVERRIDE; + void markActiveCommands(int index); private: diff --git a/src/utils/debugger/SkDrawCommand.cpp b/src/utils/debugger/SkDrawCommand.cpp index 079961ae70..7c73cec786 100644 --- a/src/utils/debugger/SkDrawCommand.cpp +++ b/src/utils/debugger/SkDrawCommand.cpp @@ -502,11 +502,11 @@ bool SkDrawPathCommand::render(SkCanvas* canvas) const { return true; } -SkDrawPictureCommand::SkDrawPictureCommand(SkPicture& picture) +SkDrawPictureCommand::SkDrawPictureCommand(const SkPicture* picture) : INHERITED(DRAW_PICTURE) - , fPicture(picture) { + , fPicture(SkRef(picture)) { SkString* temp = new SkString; - temp->appendf("SkPicture: W: %d H: %d", picture.width(), picture.height()); + temp->appendf("SkPicture: W: %d H: %d", picture->width(), picture->height()); fInfo.push(temp); } @@ -518,11 +518,11 @@ bool SkDrawPictureCommand::render(SkCanvas* canvas) const { canvas->clear(0xFFFFFFFF); canvas->save(); - SkRect bounds = SkRect::MakeWH(SkIntToScalar(fPicture.width()), - SkIntToScalar(fPicture.height())); + SkRect bounds = SkRect::MakeWH(SkIntToScalar(fPicture->width()), + SkIntToScalar(fPicture->height())); xlate_and_scale_to_bounds(canvas, bounds); - canvas->drawPicture(const_cast<SkPicture&>(fPicture)); + canvas->drawPicture(fPicture.get()); canvas->restore(); diff --git a/src/utils/debugger/SkDrawCommand.h b/src/utils/debugger/SkDrawCommand.h index f2e151ae4f..a0bfb2ddca 100644 --- a/src/utils/debugger/SkDrawCommand.h +++ b/src/utils/debugger/SkDrawCommand.h @@ -343,12 +343,12 @@ private: class SkDrawPictureCommand : public SkDrawCommand { public: - SkDrawPictureCommand(SkPicture& picture); + SkDrawPictureCommand(const SkPicture* picture); virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; private: - SkPicture fPicture; + SkAutoTUnref<const SkPicture> fPicture; typedef SkDrawCommand INHERITED; }; |