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

Unified Diff: src/gpu/utils/GrUtils.cpp

Issue 73643005: Implement a benchmark for GrResourceCache (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address review 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
« src/gpu/utils/GrUtils.h ('K') | « src/gpu/utils/GrUtils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/utils/GrUtils.cpp
diff --git a/src/gpu/utils/GrUtils.cpp b/src/gpu/utils/GrUtils.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..0b0d203a911eb0ed74304d9782983bdb42a25ea8
--- /dev/null
+++ b/src/gpu/utils/GrUtils.cpp
@@ -0,0 +1,29 @@
+
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#if SK_SUPPORT_GPU
+
+#include "GrContext.h"
+#include "GrUtils.h"
+#include "GrRenderTarget.h"
+#include "SkCanvas.h"
+#include "SkDevice.h"
+
+// canvas could almost be a const&, but accessRenderTarget isn't const.
+GrContext* GrUtils::GetGr(SkCanvas* canvas) {
+ SkASSERT(NULL != canvas);
+ SkBaseDevice* device = canvas->getTopDevice();
+ GrRenderTarget* renderTarget = device->accessRenderTarget();
+ if (NULL != renderTarget) {
+ return renderTarget->getContext();
+ }
+
+ return NULL;
+}
+
+#endif
« src/gpu/utils/GrUtils.h ('K') | « src/gpu/utils/GrUtils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698