aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/views
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2015-01-30 12:37:02 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-30 12:37:02 -0800
commitc8fcafb3f0d152fb92465451bdb2e4bd3ef37222 (patch)
treeed205c0bdd413c88bec4a59373f64dcc04760cfe /src/views
parent8d17a13a71edb0d8412e4354c428582b74587b79 (diff)
First cut at cleaning up Sergio's example code and moving some common code to SkWindow.
Eventually, this will be moved to be a peer of SampleApp so it is compiled by the bots to avoid future bit rot. Also ignore XCode auto-generated flag in CommandLineFlags, and remove the unused multiple-example part. Review URL: https://codereview.chromium.org/890873003
Diffstat (limited to 'src/views')
-rw-r--r--src/views/SkWindow.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/views/SkWindow.cpp b/src/views/SkWindow.cpp
index 7870d06bfe..61eaa978b1 100644
--- a/src/views/SkWindow.cpp
+++ b/src/views/SkWindow.cpp
@@ -341,3 +341,26 @@ bool SkWindow::onDispatchClick(int x, int y, Click::State state,
}
return handled;
}
+
+#if SK_SUPPORT_GPU
+
+#include "gl/GrGLInterface.h"
+#include "gl/GrGLUtil.h"
+#include "SkGr.h"
+
+GrRenderTarget* SkWindow::renderTarget(const AttachmentInfo& attachmentInfo,
+ const GrGLInterface* interface, GrContext* grContext) {
+ GrBackendRenderTargetDesc desc;
+ desc.fWidth = SkScalarRoundToInt(this->width());
+ desc.fHeight = SkScalarRoundToInt(this->height());
+ desc.fConfig = kSkia8888_GrPixelConfig;
+ desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
+ desc.fSampleCnt = attachmentInfo.fSampleCount;
+ desc.fStencilBits = attachmentInfo.fStencilBits;
+ GrGLint buffer;
+ GR_GL_GetIntegerv(interface, GR_GL_FRAMEBUFFER_BINDING, &buffer);
+ desc.fRenderTargetHandle = buffer;
+ return grContext->wrapBackendRenderTarget(desc);
+}
+
+#endif