aboutsummaryrefslogtreecommitdiffhomepage
path: root/debugger/SkDebugger.cpp
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2016-11-15 10:03:32 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-15 15:41:09 +0000
commitf530586c417800d086e6e727ecb1b31e678f4183 (patch)
tree5606ada8e35643dbeaf57bb020ef339a3aae2ab1 /debugger/SkDebugger.cpp
parentc73a1ecbed64652b3d7aa8dc6face9a2205ce830 (diff)
Resurrect SkDebugger
Can't let go <sniffle>. R=robertphillips@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4793 Change-Id: Ida5936d17af2ef60c3f50e27b4f4987a79165fa5 Reviewed-on: https://skia-review.googlesource.com/4793 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'debugger/SkDebugger.cpp')
-rw-r--r--debugger/SkDebugger.cpp25
1 files changed, 9 insertions, 16 deletions
diff --git a/debugger/SkDebugger.cpp b/debugger/SkDebugger.cpp
index 6639d2c829..197a27ff8a 100644
--- a/debugger/SkDebugger.cpp
+++ b/debugger/SkDebugger.cpp
@@ -7,31 +7,24 @@
*/
#include "SkDebugger.h"
+#include "SkMakeUnique.h"
#include "SkPictureRecorder.h"
#include "SkString.h"
SkDebugger::SkDebugger()
- : fPicture(nullptr)
- , fIndex(-1) {
- // Create this some other dynamic way?
- fDebugCanvas = new SkDebugCanvas(0, 0);
-}
+ : fDebugCanvas(skstd::make_unique<SkDebugCanvas>(0, 0))
+ , fIndex(-1) { }
-SkDebugger::~SkDebugger() {
- // Need to inherit from SkRef object in order for following to work
- SkSafeUnref(fDebugCanvas);
- SkSafeUnref(fPicture);
-}
+SkDebugger::~SkDebugger() {}
void SkDebugger::loadPicture(SkPicture* picture) {
- SkRefCnt_SafeAssign(fPicture, picture);
-
- delete fDebugCanvas;
- fDebugCanvas = new SkDebugCanvas(SkScalarCeilToInt(this->pictureCull().width()),
- SkScalarCeilToInt(this->pictureCull().height()));
+ fPicture = sk_ref_sp(picture);
+ fDebugCanvas = skstd::make_unique<SkDebugCanvas>(
+ SkScalarCeilToInt(this->pictureCull().width()),
+ SkScalarCeilToInt(this->pictureCull().height()));
fDebugCanvas->setPicture(picture);
- picture->playback(fDebugCanvas);
+ picture->playback(fDebugCanvas.get());
fDebugCanvas->setPicture(nullptr);
fIndex = fDebugCanvas->getSize() - 1;
}