blob: cf4b640691db8b61052f2a290f02b293ad365c0f [file] [log] [blame]
bsalomon@google.com48dd1a22011-10-31 14:18:20 +00001/*
2 * Copyright 2011 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "gm.h"
9using namespace skiagm;
10
11GM::GM() {
12 fBGColor = SK_ColorWHITE;
13}
14GM::~GM() {}
15
16void GM::draw(SkCanvas* canvas) {
17 this->drawBackground(canvas);
18 this->drawContent(canvas);
19}
20
21void GM::drawContent(SkCanvas* canvas) {
22 this->onDraw(canvas);
23}
24
25void GM::drawBackground(SkCanvas* canvas) {
26 this->onDrawBackground(canvas);
27}
28
29const char* GM::shortName() {
30 if (fShortName.size() == 0) {
31 fShortName = this->onShortName();
32 }
33 return fShortName.c_str();
34}
35
36void GM::setBGColor(SkColor color) {
37 fBGColor = color;
38}
39
40void GM::onDrawBackground(SkCanvas* canvas) {
41 canvas->drawColor(fBGColor);
42}
43
44// need to explicitly declare this, or we get some weird infinite loop llist
45template GMRegistry* SkTRegistry<GM*, void*>::gHead;