skia2/tools/viewer/SampleSlide.cpp
jvanverth c7027ab03f 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
Review-Url: https://codereview.chromium.org/2056343004
2016-06-16 09:52:35 -07:00

46 lines
1.0 KiB
C++
Executable File

/*
* 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;
}
#if defined(SK_BUILD_FOR_ANDROID)
// these are normally defined in SkOSWindow_unix, but we don't
// want to include that
void SkEvent::SignalNonEmptyQueue() {}
void SkEvent::SignalQueueTimer(SkMSec delay) {}
#endif