Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1275)

Unified Diff: src/core/SkCanvas.cpp

Issue 73643005: Implement a benchmark for GrResourceCache (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address comments Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkCanvas.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « include/core/SkCanvas.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698