2011-10-31 14:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2011 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef GMSampleView_DEFINED
|
|
|
|
#define GMSampleView_DEFINED
|
|
|
|
|
|
|
|
#include "SampleCode.h"
|
|
|
|
#include "gm.h"
|
|
|
|
|
|
|
|
class GMSampleView : public SampleView {
|
|
|
|
private:
|
|
|
|
typedef skiagm::GM GM;
|
|
|
|
|
|
|
|
public:
|
|
|
|
GMSampleView(GM* gm)
|
|
|
|
: fGM(gm) {}
|
2012-08-23 18:19:56 +00:00
|
|
|
|
2011-10-31 14:18:20 +00:00
|
|
|
virtual ~GMSampleView() {
|
|
|
|
delete fGM;
|
|
|
|
}
|
2012-08-23 18:19:56 +00:00
|
|
|
|
2011-10-31 14:18:20 +00:00
|
|
|
protected:
|
|
|
|
virtual bool onQuery(SkEvent* evt) {
|
|
|
|
if (SampleCode::TitleQ(*evt)) {
|
2011-12-09 19:50:48 +00:00
|
|
|
SkString name("GM:");
|
2011-11-08 15:06:34 +00:00
|
|
|
name.append(fGM->shortName());
|
|
|
|
SampleCode::TitleR(evt, name.c_str());
|
2011-10-31 14:18:20 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return this->INHERITED::onQuery(evt);
|
|
|
|
}
|
2012-08-23 18:19:56 +00:00
|
|
|
|
2011-10-31 14:18:20 +00:00
|
|
|
virtual void onDrawContent(SkCanvas* canvas) {
|
|
|
|
fGM->drawContent(canvas);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void onDrawBackground(SkCanvas* canvas) {
|
|
|
|
fGM->drawBackground(canvas);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
GM* fGM;
|
|
|
|
typedef SampleView INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|