Index: src/core/SkCanvas.cpp |
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp |
index 0d5fccb91f39e5d232c53c35c448cec91c517d6c..4eaea11b87e582848b944ac31701d05156cb0db4 100644 |
--- a/src/core/SkCanvas.cpp |
+++ b/src/core/SkCanvas.cpp |
@@ -26,6 +26,10 @@ |
#include "SkTLazy.h" |
#include "SkUtils.h" |
+#if SK_SUPPORT_GPU |
+#include "GrRenderTarget.h" |
+#endif |
+ |
SK_DEFINE_INST_COUNT(SkBounder) |
SK_DEFINE_INST_COUNT(SkCanvas) |
SK_DEFINE_INST_COUNT(SkDrawFilter) |
@@ -1570,6 +1574,20 @@ SkBaseDevice* SkCanvas::createCompatibleDevice(SkBitmap::Config config, |
} |
} |
+GrContext* SkCanvas::getGrContext() { |
+#if SK_SUPPORT_GPU |
+ SkBaseDevice* device = this->getTopDevice(); |
+ if (NULL != device) { |
+ GrRenderTarget* renderTarget = device->accessRenderTarget(); |
+ if (NULL != renderTarget) { |
+ return renderTarget->getContext(); |
+ } |
+ } |
+#endif |
+ |
+ return NULL; |
+ |
+} |
////////////////////////////////////////////////////////////////////////////// |
// These are the virtual drawing methods |