aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode/GMSampleView.h
diff options
context:
space:
mode:
authorGravatar reed <reed@chromium.org>2015-02-21 09:36:50 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-21 09:36:50 -0800
commit0ab326f530c0d3597471bbbe7bc92e7cd1fac60f (patch)
tree4a84c68fbda4efb06c12bc06fbf35e27abd9e20a /samplecode/GMSampleView.h
parentf7f79d2a6e669058ee9bb9fc4f0a9e998bfc5da6 (diff)
move GMSampleView into its own cpp
BUG=skia: TBR= Review URL: https://codereview.chromium.org/947733002
Diffstat (limited to 'samplecode/GMSampleView.h')
-rw-r--r--samplecode/GMSampleView.h61
1 files changed, 8 insertions, 53 deletions
diff --git a/samplecode/GMSampleView.h b/samplecode/GMSampleView.h
index adaf23d43f..f97ce92d2b 100644
--- a/samplecode/GMSampleView.h
+++ b/samplecode/GMSampleView.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2011 Google Inc.
*
@@ -6,7 +5,6 @@
* found in the LICENSE file.
*/
-
#ifndef GMSampleView_DEFINED
#define GMSampleView_DEFINED
@@ -19,60 +17,17 @@ private:
typedef skiagm::GM GM;
public:
- GMSampleView(GM* gm)
- : fShowSize(false), fGM(gm) {}
+ GMSampleView(GM*);
+ virtual ~GMSampleView();
- virtual ~GMSampleView() {
- delete fGM;
- }
-
- static SkEvent* NewShowSizeEvt(bool doShowSize) {
- SkEvent* evt = SkNEW_ARGS(SkEvent, ("GMSampleView::showSize"));
- evt->setFast32(doShowSize);
- return evt;
- }
+ static SkEvent* NewShowSizeEvt(bool doShowSize);
protected:
- virtual bool onQuery(SkEvent* evt) {
- if (SampleCode::TitleQ(*evt)) {
- SkString name("GM:");
- name.append(fGM->getName());
- SampleCode::TitleR(evt, name.c_str());
- return true;
- }
- return this->INHERITED::onQuery(evt);
- }
-
- bool onEvent(const SkEvent& evt) SK_OVERRIDE {
- if (evt.isType("GMSampleView::showSize")) {
- fShowSize = SkToBool(evt.getFast32());
- return true;
- }
- return this->INHERITED::onEvent(evt);
- }
-
- virtual void onDrawContent(SkCanvas* canvas) {
- {
- SkAutoCanvasRestore acr(canvas, fShowSize);
- fGM->drawContent(canvas);
- }
- if (fShowSize) {
- SkISize size = fGM->getISize();
- SkRect r = SkRect::MakeWH(SkIntToScalar(size.width()),
- SkIntToScalar(size.height()));
- SkPaint paint;
- paint.setColor(0x40FF8833);
- canvas->drawRect(r, paint);
- }
- }
-
- virtual void onDrawBackground(SkCanvas* canvas) {
- fGM->drawBackground(canvas);
- }
-
- bool onAnimate(const SkAnimTimer& timer) SK_OVERRIDE {
- return fGM->animate(timer);
- }
+ bool onQuery(SkEvent*) SK_OVERRIDE;
+ bool onEvent(const SkEvent&) SK_OVERRIDE;
+ void onDrawContent(SkCanvas*) SK_OVERRIDE;
+ void onDrawBackground(SkCanvas*) SK_OVERRIDE;
+ bool onAnimate(const SkAnimTimer&) SK_OVERRIDE;
private:
GM* fGM;