diff options
author | 2011-10-31 14:18:20 +0000 | |
---|---|---|
committer | 2011-10-31 14:18:20 +0000 | |
commit | 48dd1a26ec07c5baa04856202e4e7e2a53e4d7e5 (patch) | |
tree | a9ceb415616952a40de7f286a556e20e4841bbf3 /gm/gm.cpp | |
parent | 562a2ac95b8cd8b359574f8c4d6300b0475938db (diff) |
Import all GMs as Samples.
Review URL: http://codereview.appspot.com/5332043/
git-svn-id: http://skia.googlecode.com/svn/trunk@2564 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm/gm.cpp')
-rw-r--r-- | gm/gm.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/gm/gm.cpp b/gm/gm.cpp new file mode 100644 index 0000000000..cf4b640691 --- /dev/null +++ b/gm/gm.cpp @@ -0,0 +1,45 @@ +/* + * Copyright 2011 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "gm.h" +using namespace skiagm; + +GM::GM() { + fBGColor = SK_ColorWHITE; +} +GM::~GM() {} + +void GM::draw(SkCanvas* canvas) { + this->drawBackground(canvas); + this->drawContent(canvas); +} + +void GM::drawContent(SkCanvas* canvas) { + this->onDraw(canvas); +} + +void GM::drawBackground(SkCanvas* canvas) { + this->onDrawBackground(canvas); +} + +const char* GM::shortName() { + if (fShortName.size() == 0) { + fShortName = this->onShortName(); + } + return fShortName.c_str(); +} + +void GM::setBGColor(SkColor color) { + fBGColor = color; +} + +void GM::onDrawBackground(SkCanvas* canvas) { + canvas->drawColor(fBGColor); +} + +// need to explicitly declare this, or we get some weird infinite loop llist +template GMRegistry* SkTRegistry<GM*, void*>::gHead; |