OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "gm.h" | 8 #include "gm.h" |
9 using namespace skiagm; | 9 using namespace skiagm; |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 } | 33 } |
34 | 34 |
35 void GM::drawBackground(SkCanvas* canvas) { | 35 void GM::drawBackground(SkCanvas* canvas) { |
36 if (!fHaveCalledOnceBeforeDraw) { | 36 if (!fHaveCalledOnceBeforeDraw) { |
37 fHaveCalledOnceBeforeDraw = true; | 37 fHaveCalledOnceBeforeDraw = true; |
38 this->onOnceBeforeDraw(); | 38 this->onOnceBeforeDraw(); |
39 } | 39 } |
40 this->onDrawBackground(canvas); | 40 this->onDrawBackground(canvas); |
41 } | 41 } |
42 | 42 |
43 const char* GM::shortName() { | 43 const char* GM::getName() { |
44 if (fShortName.size() == 0) { | 44 if (fShortName.size() == 0) { |
45 fShortName = this->onShortName(); | 45 fShortName = this->onShortName(); |
46 } | 46 } |
47 return fShortName.c_str(); | 47 return fShortName.c_str(); |
48 } | 48 } |
49 | 49 |
50 void GM::setBGColor(SkColor color) { | 50 void GM::setBGColor(SkColor color) { |
51 fBGColor = color; | 51 fBGColor = color; |
52 } | 52 } |
53 | 53 |
54 void GM::onDrawBackground(SkCanvas* canvas) { | 54 void GM::onDrawBackground(SkCanvas* canvas) { |
55 canvas->drawColor(fBGColor, SkXfermode::kSrc_Mode); | 55 canvas->drawColor(fBGColor, SkXfermode::kSrc_Mode); |
56 } | 56 } |
57 | 57 |
58 void GM::drawSizeBounds(SkCanvas* canvas, SkColor color) { | 58 void GM::drawSizeBounds(SkCanvas* canvas, SkColor color) { |
59 SkISize size = this->getISize(); | 59 SkISize size = this->getISize(); |
60 SkRect r = SkRect::MakeWH(SkIntToScalar(size.width()), | 60 SkRect r = SkRect::MakeWH(SkIntToScalar(size.width()), |
61 SkIntToScalar(size.height())); | 61 SkIntToScalar(size.height())); |
62 SkPaint paint; | 62 SkPaint paint; |
63 paint.setColor(color); | 63 paint.setColor(color); |
64 canvas->drawRect(r, paint); | 64 canvas->drawRect(r, paint); |
65 } | 65 } |
66 | 66 |
67 // need to explicitly declare this, or we get some weird infinite loop llist | 67 // need to explicitly declare this, or we get some weird infinite loop llist |
68 template GMRegistry* SkTRegistry<GM*(*)(void*)>::gHead; | 68 template GMRegistry* SkTRegistry<GM*(*)(void*)>::gHead; |
OLD | NEW |