443ec1b794
Also removes fWidth and fHeight from Window and instead calls into WindowContent to get these values. BUG=skia: Change-Id: I72ee506004b7da73db9abb607a3bc82edfcf7d43 Reviewed-on: https://skia-review.googlesource.com/8795 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Jim Van Verth <jvanverth@google.com> Reviewed-by: Yuqian Li <liyuqian@google.com>
55 lines
1.2 KiB
C++
55 lines
1.2 KiB
C++
/*
|
|
* 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
|