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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 void GM::drawSizeBounds(SkCanvas* canvas, SkColor color) { | 56 void GM::drawSizeBounds(SkCanvas* canvas, SkColor color) { |
57 SkISize size = this->getISize(); | 57 SkISize size = this->getISize(); |
58 SkRect r = SkRect::MakeWH(SkIntToScalar(size.width()), | 58 SkRect r = SkRect::MakeWH(SkIntToScalar(size.width()), |
59 SkIntToScalar(size.height())); | 59 SkIntToScalar(size.height())); |
60 SkPaint paint; | 60 SkPaint paint; |
61 paint.setColor(color); | 61 paint.setColor(color); |
62 canvas->drawRect(r, paint); | 62 canvas->drawRect(r, paint); |
63 } | 63 } |
64 | 64 |
| 65 #if SK_SUPPORT_GPU |
| 66 // canvas could almost be a const&, but accessRenderTarget isn't const. |
| 67 /*static*/ GrContext* GM::GetGr(SkCanvas* canvas) { |
| 68 SkASSERT(NULL != canvas); |
| 69 SkBaseDevice* device = canvas->getTopDevice(); |
| 70 GrRenderTarget* renderTarget = device->accessRenderTarget(); |
| 71 if (NULL != renderTarget) { |
| 72 return renderTarget->getContext(); |
| 73 } |
| 74 return NULL; |
| 75 } |
| 76 #endif |
| 77 |
65 // need to explicitly declare this, or we get some weird infinite loop llist | 78 // need to explicitly declare this, or we get some weird infinite loop llist |
66 template GMRegistry* SkTRegistry<GM*(*)(void*)>::gHead; | 79 template GMRegistry* SkTRegistry<GM*(*)(void*)>::gHead; |
OLD | NEW |