diff options
author | Florin Malita <fmalita@chromium.org> | 2016-11-15 10:03:32 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-11-15 15:41:09 +0000 |
commit | f530586c417800d086e6e727ecb1b31e678f4183 (patch) | |
tree | 5606ada8e35643dbeaf57bb020ef339a3aae2ab1 /debugger | |
parent | c73a1ecbed64652b3d7aa8dc6face9a2205ce830 (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')
-rw-r--r-- | debugger/QT/SkDebuggerGUI.cpp | 6 | ||||
-rw-r--r-- | debugger/QT/SkGLWidget.cpp | 2 | ||||
-rw-r--r-- | debugger/SkDebugger.cpp | 25 | ||||
-rw-r--r-- | debugger/SkDebugger.h | 6 |
4 files changed, 16 insertions, 23 deletions
diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp index 3b84afcdfe..1437faf02a 100644 --- a/debugger/QT/SkDebuggerGUI.cpp +++ b/debugger/QT/SkDebuggerGUI.cpp @@ -283,7 +283,7 @@ void SkDebuggerGUI::saveToFile(const SkString& filename) { sk_sp<SkPixelSerializer> serializer( SkImageEncoder::CreatePixelSerializer()); - copy->serialize(&file, serializer); + copy->serialize(&file, serializer.get()); } void SkDebuggerGUI::loadFile(QListWidgetItem *item) { @@ -672,9 +672,9 @@ void SkDebuggerGUI::populateDirectoryWidget() { void SkDebuggerGUI::loadPicture(const SkString& fileName) { fFileName = fileName; fLoading = true; - std::unique_ptr<SkStream> stream(new SkFILEStream(fileName.c_str())); + SkFILEStream stream(fileName.c_str()); - auto picture = SkPicture::MakeFromStream(stream); + auto picture = SkPicture::MakeFromStream(&stream); if (nullptr == picture) { QMessageBox::critical(this, "Error loading file", "Couldn't read file, sorry."); diff --git a/debugger/QT/SkGLWidget.cpp b/debugger/QT/SkGLWidget.cpp index 5335da47bd..f95af848a2 100644 --- a/debugger/QT/SkGLWidget.cpp +++ b/debugger/QT/SkGLWidget.cpp @@ -59,7 +59,7 @@ void SkGLWidget::createRenderTarget() { GrBackendRenderTargetDesc desc = this->getDesc(this->width(), this->height()); desc.fOrigin = kBottomLeft_GrSurfaceOrigin; - fGpuSurface = SkSurface::MakeFromBackendRenderTarget(fCurContext, desc, nullptr); + fGpuSurface = SkSurface::MakeFromBackendRenderTarget(fCurContext.get(), desc, nullptr); fCanvas = fGpuSurface->getCanvas(); } 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; } diff --git a/debugger/SkDebugger.h b/debugger/SkDebugger.h index 1fa285ab57..7e58047942 100644 --- a/debugger/SkDebugger.h +++ b/debugger/SkDebugger.h @@ -86,7 +86,7 @@ public: } SkRect pictureCull() const { - return nullptr == fPicture ? SkRect::MakeEmpty() : fPicture->cullRect(); + return fPicture ? fPicture->cullRect() : SkRect::MakeEmpty(); } int index() { @@ -123,8 +123,8 @@ public: void getClipStackText(SkString* clipStack); private: - SkDebugCanvas* fDebugCanvas; - SkPicture* fPicture; + std::unique_ptr<SkDebugCanvas> fDebugCanvas; + sk_sp<SkPicture> fPicture; int fIndex; }; |