Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Unified Diff: samplecode/GMSampleView.h

Issue 947733002: move GMSampleView into its own cpp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/SampleApp.gyp ('k') | samplecode/GMSampleView.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/GMSampleView.h
diff --git a/samplecode/GMSampleView.h b/samplecode/GMSampleView.h
index adaf23d43f54f5c597ae0675dfe4a42cf253494d..f97ce92d2b25b97039d852fba43f63f717ccd7c5 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;
« no previous file with comments | « gyp/SampleApp.gyp ('k') | samplecode/GMSampleView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698