OLD | NEW |
(Empty) | |
| 1 |
| 2 /* |
| 3 * Copyright 2013 Google Inc. |
| 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. |
| 7 */ |
| 8 |
| 9 #if SK_SUPPORT_GPU |
| 10 |
| 11 #include "GrContext.h" |
| 12 #include "GrUtils.h" |
| 13 #include "GrRenderTarget.h" |
| 14 #include "SkCanvas.h" |
| 15 #include "SkDevice.h" |
| 16 |
| 17 // canvas could almost be a const&, but accessRenderTarget isn't const. |
| 18 GrContext* GrUtils::GetGr(SkCanvas* canvas) { |
| 19 SkASSERT(NULL != canvas); |
| 20 SkBaseDevice* device = canvas->getTopDevice(); |
| 21 GrRenderTarget* renderTarget = device->accessRenderTarget(); |
| 22 if (NULL != renderTarget) { |
| 23 return renderTarget->getContext(); |
| 24 } |
| 25 |
| 26 return NULL; |
| 27 } |
| 28 |
| 29 #endif |
OLD | NEW |