aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode/SampleCode.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-11-22 16:36:07 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-29 18:12:35 +0000
commitede860e91c2a0021266907885ea2c9b4be09e121 (patch)
tree65e11fcdab6d13d133fc881f38d3efda85402d92 /samplecode/SampleCode.cpp
parent3f67914c01f32fe61fd0af5022ebfd4e19d68f0e (diff)
Delete even more unused views code
Bug: skia: Change-Id: I41480aa89dfcd8cb7e016e477cbabe354f35ce8a Reviewed-on: https://skia-review.googlesource.com/75480 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'samplecode/SampleCode.cpp')
-rw-r--r--samplecode/SampleCode.cpp67
1 files changed, 6 insertions, 61 deletions
diff --git a/samplecode/SampleCode.cpp b/samplecode/SampleCode.cpp
index 84c3945ba2..252ca2a670 100644
--- a/samplecode/SampleCode.cpp
+++ b/samplecode/SampleCode.cpp
@@ -26,16 +26,6 @@ bool SampleCode::CharQ(const SkEvent& evt, SkUnichar* outUni) {
return false;
}
-bool SampleCode::KeyQ(const SkEvent& evt, SkKey* outKey) {
- if (evt.isType(gKeyEvtName, sizeof(gKeyEvtName) - 1)) {
- if (outKey) {
- *outKey = (SkKey)evt.getFast32();
- }
- return true;
- }
- return false;
-}
-
bool SampleCode::TitleQ(const SkEvent& evt) {
return evt.isType(gTitleEvtName, sizeof(gTitleEvtName) - 1);
}
@@ -54,22 +44,6 @@ bool SampleCode::RequestTitle(SkView* view, SkString* title) {
return false;
}
-bool SampleCode::PrefSizeQ(const SkEvent& evt) {
- return evt.isType(gPrefSizeEvtName, sizeof(gPrefSizeEvtName) - 1);
-}
-
-void SampleCode::PrefSizeR(SkEvent* evt, SkScalar width, SkScalar height) {
- SkASSERT(evt && PrefSizeQ(*evt));
- SkScalar size[2];
- size[0] = width;
- size[1] = height;
- evt->setScalars(gPrefSizeEvtName, 2, size);
-}
-
-bool SampleCode::FastTextQ(const SkEvent& evt) {
- return evt.isType(gFastTextEvtName, sizeof(gFastTextEvtName) - 1);
-}
-
SkViewRegister* SkViewRegister::gHead;
SkViewRegister::SkViewRegister(SkViewFactory* fact) : fFact(fact) {
fFact->ref();
@@ -87,48 +61,21 @@ SkView* SkFuncViewFactory::operator() () const {
return (*fCreateFunc)();
}
-#include "GMSampleView.h"
-
-SkGMSampleViewFactory::SkGMSampleViewFactory(GMFactoryFunc func)
- : fFunc(func) {
-}
-
-SkView* SkGMSampleViewFactory::operator() () const {
- skiagm::GM* gm = fFunc(nullptr);
- gm->setMode(skiagm::GM::kSample_Mode);
- return new GMSampleView(gm);
-}
-
SkViewRegister::SkViewRegister(SkViewCreateFunc func) {
fFact = new SkFuncViewFactory(func);
fChain = gHead;
gHead = this;
}
-SkViewRegister::SkViewRegister(GMFactoryFunc func) {
- fFact = new SkGMSampleViewFactory(func);
- fChain = gHead;
- gHead = this;
-}
-
///////////////////////////////////////////////////////////////////////////////
static const char is_sample_view_tag[] = "sample-is-sample-view";
-static const char repeat_count_tag[] = "sample-set-repeat-count";
bool SampleView::IsSampleView(SkView* view) {
SkEvent evt(is_sample_view_tag);
return view->doQuery(&evt);
}
-bool SampleView::onEvent(const SkEvent& evt) {
- if (evt.isType(repeat_count_tag)) {
- fRepeatCount = evt.getFast32();
- return true;
- }
- return this->INHERITED::onEvent(evt);
-}
-
bool SampleView::onQuery(SkEvent* evt) {
if (evt->isType(is_sample_view_tag)) {
return true;
@@ -143,16 +90,14 @@ void SampleView::onDraw(SkCanvas* canvas) {
}
this->onDrawBackground(canvas);
- for (int i = 0; i < fRepeatCount; i++) {
- SkAutoCanvasRestore acr(canvas, true);
- this->onDrawContent(canvas);
+ SkAutoCanvasRestore acr(canvas, true);
+ this->onDrawContent(canvas);
#if SK_SUPPORT_GPU
- // Ensure the GrContext doesn't combine GrDrawOps across draw loops.
- if (GrContext* context = canvas->getGrContext()) {
- context->flush();
- }
-#endif
+ // Ensure the GrContext doesn't combine GrDrawOps across draw loops.
+ if (GrContext* context = canvas->getGrContext()) {
+ context->flush();
}
+#endif
}
void SampleView::onDrawBackground(SkCanvas* canvas) {