blob: 00ee53453b2969d996714ae50e783cca74f540aa [file] [log] [blame]
jvanverthc7027ab2016-06-16 09:52:35 -07001/*
2* Copyright 2016 Google Inc.
3*
4* Use of this source code is governed by a BSD-style license that can be
5* found in the LICENSE file.
6*/
7
8#include "SampleSlide.h"
9
10#include "SkCanvas.h"
11#include "SkCommonFlags.h"
12#include "SkOSFile.h"
13#include "SkStream.h"
14
15SampleSlide::SampleSlide(const SkViewFactory* factory) : fViewFactory(factory) {
16 SkView* view = (*factory)();
17 SampleCode::RequestTitle(view, &fName);
18 view->unref();
19}
20
21SampleSlide::~SampleSlide() {}
22
23void SampleSlide::draw(SkCanvas* canvas) {
24 fView->draw(canvas);
25}
26
27void SampleSlide::load(SkScalar winWidth, SkScalar winHeight) {
28 fView = (*fViewFactory)();
29 fView->setVisibleP(true);
30 fView->setClipToBounds(false);
31 fView->setSize(winWidth, winHeight);
32}
33
34void SampleSlide::unload() {
35 fView->unref();
36 fView = nullptr;
37}
38
Jim Van Verth6f449692017-02-14 15:16:46 -050039bool SampleSlide::onChar(SkUnichar c) {
40 SkEvent evt(gCharEvtName);
41 evt.setFast32(c);
42 return fView->doQuery(&evt);
43}
44
jvanverthc7027ab2016-06-16 09:52:35 -070045#if defined(SK_BUILD_FOR_ANDROID)
46// these are normally defined in SkOSWindow_unix, but we don't
47// want to include that
48void SkEvent::SignalNonEmptyQueue() {}
49
50void SkEvent::SignalQueueTimer(SkMSec delay) {}
51#endif