aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils/debugger
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2014-06-04 05:40:44 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-06-04 05:40:44 -0700
commit9b14f26d0f3a974f3dd626c8354e1db1cfcd322f (patch)
tree542d5f1d7a1266454675745139e956b4424fde4b /src/utils/debugger
parent232f7259a939c70ce447a729a5094fcc272b679d (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/debugger')
-rw-r--r--src/utils/debugger/SkDebugCanvas.cpp2
-rw-r--r--src/utils/debugger/SkDebugCanvas.h4
-rw-r--r--src/utils/debugger/SkDrawCommand.cpp12
-rw-r--r--src/utils/debugger/SkDrawCommand.h4
4 files changed, 11 insertions, 11 deletions
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;
};