diff options
author | 2016-06-13 11:30:10 -0700 | |
---|---|---|
committer | 2016-06-13 11:30:10 -0700 | |
commit | f533f116e6324ee8592fbb49b8fca096c7fe926e (patch) | |
tree | e03e19c9051ceb190b531afe46401720f91274be /tools | |
parent | f8f9c07c283a3204a38b4324c14597e644686428 (diff) |
Revert of Add samples to Viewer. (patchset #4 id:60001 of https://codereview.chromium.org/2056343004/ )
Reason for revert:
breaking on android compile
Original issue's description:
> Add samples to Viewer.
>
> This adds support with animation, assuming the sample has
> implemented onAnimate. Event handling has not been
> implemented.
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2056343004
>
> Committed: https://skia.googlesource.com/skia/+/76963e73704a42a18c29d6fbdcccb566e5c67658
TBR=bsalomon@google.com,jvanverth@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review-Url: https://codereview.chromium.org/2063883002
Diffstat (limited to 'tools')
-rw-r--r-- | tools/viewer/SKPSlide.cpp | 2 | ||||
-rw-r--r-- | tools/viewer/SKPSlide.h | 2 | ||||
-rwxr-xr-x | tools/viewer/SampleSlide.cpp | 37 | ||||
-rwxr-xr-x | tools/viewer/SampleSlide.h | 34 | ||||
-rw-r--r-- | tools/viewer/Slide.h | 6 | ||||
-rw-r--r-- | tools/viewer/Viewer.cpp | 12 |
6 files changed, 6 insertions, 87 deletions
diff --git a/tools/viewer/SKPSlide.cpp b/tools/viewer/SKPSlide.cpp index 9419253f0c..6a9899b92f 100644 --- a/tools/viewer/SKPSlide.cpp +++ b/tools/viewer/SKPSlide.cpp @@ -48,7 +48,7 @@ static sk_sp<SkPicture> read_picture(const char path[]) { return pic; } -void SKPSlide::load(SkScalar, SkScalar) { +void SKPSlide::load() { fPic = read_picture(fPath.c_str()); fCullRect = fPic->cullRect().roundOut(); } diff --git a/tools/viewer/SKPSlide.h b/tools/viewer/SKPSlide.h index ff92ed1a39..42845fa30d 100644 --- a/tools/viewer/SKPSlide.h +++ b/tools/viewer/SKPSlide.h @@ -19,7 +19,7 @@ public: SkISize getDimensions() const override { return fCullRect.size(); } void draw(SkCanvas* canvas) override; - void load(SkScalar winWidth, SkScalar winHeight) override; + void load() override; void unload() override; private: diff --git a/tools/viewer/SampleSlide.cpp b/tools/viewer/SampleSlide.cpp deleted file mode 100755 index 2ae1280dc3..0000000000 --- a/tools/viewer/SampleSlide.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* -* Copyright 2016 Google Inc. -* -* Use of this source code is governed by a BSD-style license that can be -* found in the LICENSE file. -*/ - -#include "SampleSlide.h" - -#include "SkCanvas.h" -#include "SkCommonFlags.h" -#include "SkOSFile.h" -#include "SkStream.h" - -SampleSlide::SampleSlide(const SkViewFactory* factory) : fViewFactory(factory) { - SkView* view = (*factory)(); - SampleCode::RequestTitle(view, &fName); - view->unref(); -} - -SampleSlide::~SampleSlide() {} - -void SampleSlide::draw(SkCanvas* canvas) { - fView->draw(canvas); -} - -void SampleSlide::load(SkScalar winWidth, SkScalar winHeight) { - fView = (*fViewFactory)(); - fView->setVisibleP(true); - fView->setClipToBounds(false); - fView->setSize(winWidth, winHeight); -} - -void SampleSlide::unload() { - fView->unref(); - fView = nullptr; -} diff --git a/tools/viewer/SampleSlide.h b/tools/viewer/SampleSlide.h deleted file mode 100755 index 3d772d093d..0000000000 --- a/tools/viewer/SampleSlide.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -* Copyright 2016 Google Inc. -* -* Use of this source code is governed by a BSD-style license that can be -* found in the LICENSE file. -*/ - -#ifndef SampleSlide_DEFINED -#define SampleSlide_DEFINED - -#include "Slide.h" -#include "SampleCode.h" - -class SampleSlide : public Slide { -public: - SampleSlide(const SkViewFactory* factory); - ~SampleSlide() override; - - void draw(SkCanvas* canvas) override; - void load(SkScalar winWidth, SkScalar winHeight) override; - void unload() override; - bool animate(const SkAnimTimer& timer) override { - if (SampleView::IsSampleView(fView)) { - return ((SampleView*)fView)->animate(timer); - } - return false; - } - -private: - const SkViewFactory* fViewFactory; - SkView* fView; -}; - -#endif diff --git a/tools/viewer/Slide.h b/tools/viewer/Slide.h index bc0ffd4016..cdc225b0a8 100644 --- a/tools/viewer/Slide.h +++ b/tools/viewer/Slide.h @@ -19,13 +19,11 @@ class Slide : public SkRefCnt { public: virtual ~Slide() {} - virtual SkISize getDimensions() const { - return SkISize::Make(0, 0); - } + virtual SkISize getDimensions() const = 0; virtual void draw(SkCanvas* canvas) = 0; virtual bool animate(const SkAnimTimer&) { return false; } - virtual void load(SkScalar winWidth, SkScalar winHeight) {} + virtual void load() {} virtual void unload() {} SkString getName() { return fName; } diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp index ca7eddd12d..499673572b 100644 --- a/tools/viewer/Viewer.cpp +++ b/tools/viewer/Viewer.cpp @@ -8,7 +8,6 @@ #include "Viewer.h" #include "GMSlide.h" -#include "SampleSlide.h" #include "SKPSlide.h" #include "SkCanvas.h" @@ -43,6 +42,7 @@ static void on_ui_state_changed_handler(const SkString& stateName, const SkStrin } DEFINE_bool2(fullscreen, f, true, "Run fullscreen."); +DEFINE_string(key, "", "Space-separated key/value pairs to add to JSON identifying this builder."); DEFINE_string2(match, m, nullptr, "[~][^]substring[$] [...] of bench name to run.\n" "Multiple matches may be separated by spaces.\n" @@ -196,14 +196,6 @@ void Viewer::initSlides() { fSlides[fSlides.count() - i - 1] = temp; } - // samples - const SkViewRegister* reg = SkViewRegister::Head(); - while (reg) { - sk_sp<Slide> slide(new SampleSlide(reg->factory())); - fSlides.push_back(slide); - reg = reg->next(); - } - // SKPs for (int i = 0; i < FLAGS_skps.count(); i++) { if (SkStrEndsWith(FLAGS_skps[i], ".skp")) { @@ -280,7 +272,7 @@ void Viewer::setupCurrentSlide(int previousSlide) { this->updateTitle(); this->updateUIState(); - fSlides[fCurrentSlide]->load(SkIntToScalar(fWindow->width()), SkIntToScalar(fWindow->height())); + fSlides[fCurrentSlide]->load(); if (previousSlide >= 0) { fSlides[previousSlide]->unload(); } |