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