blob: 93a495eb8c79e2bfbb9a974f768262d53085752b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
/*
* 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) {
SkASSERT(fView);
fView->draw(canvas);
}
void SampleSlide::load(SkScalar winWidth, SkScalar winHeight) {
fView.reset((*fViewFactory)());
fView->setVisibleP(true);
fView->setClipToBounds(false);
fView->setSize(winWidth, winHeight);
}
void SampleSlide::unload() {
fView.reset();
}
bool SampleSlide::onChar(SkUnichar c) {
if (!fView) {
return false;
}
SkEvent evt(gCharEvtName);
evt.setFast32(c);
return fView->doQuery(&evt);
}
#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
|