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 |
9 using namespace skiagm; | 10 using namespace skiagm; |
10 | 11 |
11 SkString GM::gResourcePath; | 12 const char* GM::gResourcePath; |
12 | 13 |
13 GM::GM() { | 14 GM::GM() { |
14 fMode = kGM_Mode; | 15 fMode = kGM_Mode; |
15 fBGColor = SK_ColorWHITE; | 16 fBGColor = SK_ColorWHITE; |
16 fCanvasIsDeferred = false; | 17 fCanvasIsDeferred = false; |
17 fHaveCalledOnceBeforeDraw = false; | 18 fHaveCalledOnceBeforeDraw = false; |
18 fStarterMatrix.reset(); | 19 fStarterMatrix.reset(); |
19 } | 20 } |
| 21 |
20 GM::~GM() {} | 22 GM::~GM() {} |
21 | 23 |
22 void GM::draw(SkCanvas* canvas) { | 24 void GM::draw(SkCanvas* canvas) { |
23 this->drawBackground(canvas); | 25 this->drawBackground(canvas); |
24 this->drawContent(canvas); | 26 this->drawContent(canvas); |
25 } | 27 } |
26 | 28 |
27 void GM::drawContent(SkCanvas* canvas) { | 29 void GM::drawContent(SkCanvas* canvas) { |
28 if (!fHaveCalledOnceBeforeDraw) { | 30 if (!fHaveCalledOnceBeforeDraw) { |
29 fHaveCalledOnceBeforeDraw = true; | 31 fHaveCalledOnceBeforeDraw = true; |
(...skipping 27 matching lines...) Expand all Loading... |
57 | 59 |
58 void GM::drawSizeBounds(SkCanvas* canvas, SkColor color) { | 60 void GM::drawSizeBounds(SkCanvas* canvas, SkColor color) { |
59 SkISize size = this->getISize(); | 61 SkISize size = this->getISize(); |
60 SkRect r = SkRect::MakeWH(SkIntToScalar(size.width()), | 62 SkRect r = SkRect::MakeWH(SkIntToScalar(size.width()), |
61 SkIntToScalar(size.height())); | 63 SkIntToScalar(size.height())); |
62 SkPaint paint; | 64 SkPaint paint; |
63 paint.setColor(color); | 65 paint.setColor(color); |
64 canvas->drawRect(r, paint); | 66 canvas->drawRect(r, paint); |
65 } | 67 } |
66 | 68 |
| 69 void GM::SetResourcePath(const char* resourcePath) { |
| 70 gResourcePath = resourcePath; |
| 71 } |
| 72 |
| 73 SkString GM::GetResourcePath() { |
| 74 return SkString(gResourcePath); |
| 75 } |
| 76 |
67 // need to explicitly declare this, or we get some weird infinite loop llist | 77 // need to explicitly declare this, or we get some weird infinite loop llist |
68 template GMRegistry* SkTRegistry<GM*(*)(void*)>::gHead; | 78 template GMRegistry* SkTRegistry<GM*(*)(void*)>::gHead; |
OLD | NEW |