46 lines
918 B
C++
46 lines
918 B
C++
|
/*
|
||
|
* 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;
|