diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gpu/GrTest.cpp | 3 | ||||
-rw-r--r-- | tools/viewer/sk_app/GLWindowContext.cpp | 34 |
2 files changed, 20 insertions, 17 deletions
diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp index 5582a2593a..7fe9a43f28 100644 --- a/tools/gpu/GrTest.cpp +++ b/tools/gpu/GrTest.cpp @@ -358,7 +358,8 @@ private: return nullptr; } - sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&) override { + sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&, + GrSurfaceOrigin) override { return nullptr; } diff --git a/tools/viewer/sk_app/GLWindowContext.cpp b/tools/viewer/sk_app/GLWindowContext.cpp index ff56ce8668..6195199ce0 100644 --- a/tools/viewer/sk_app/GLWindowContext.cpp +++ b/tools/viewer/sk_app/GLWindowContext.cpp @@ -6,19 +6,18 @@ * found in the LICENSE file. */ +#include "GrBackendSurface.h" #include "GrContext.h" -#include "SkSurface.h" +#include "GrRenderTarget.h" #include "GLWindowContext.h" #include "gl/GrGLDefines.h" - #include "gl/GrGLUtil.h" -#include "GrRenderTarget.h" -#include "GrContext.h" #include "SkCanvas.h" #include "SkImage_Base.h" #include "SkMathPriv.h" +#include "SkSurface.h" namespace sk_app { @@ -64,7 +63,7 @@ void GLWindowContext::destroyContext() { fContext->unref(); fContext = nullptr; } - + fBackendContext.reset(nullptr); this->onDestroyContext(); @@ -73,18 +72,21 @@ void GLWindowContext::destroyContext() { sk_sp<SkSurface> GLWindowContext::getBackbufferSurface() { if (nullptr == fSurface) { if (fContext) { - GrBackendRenderTargetDesc desc; - desc.fWidth = this->fWidth; - desc.fHeight = this->fHeight; - desc.fConfig = fPixelConfig; - desc.fOrigin = kBottomLeft_GrSurfaceOrigin; - desc.fSampleCnt = fSampleCount; - desc.fStencilBits = fStencilBits; + GrGLFramebufferInfo fbInfo; GrGLint buffer; - GR_GL_CALL(fBackendContext.get(), GetIntegerv(GR_GL_FRAMEBUFFER_BINDING, &buffer)); - desc.fRenderTargetHandle = buffer; - - fSurface = SkSurface::MakeFromBackendRenderTarget(fContext, desc, + GR_GL_CALL(fBackendContext.get(), GetIntegerv(GR_GL_FRAMEBUFFER_BINDING, + &buffer)); + fbInfo.fFBOID = buffer; + + GrBackendRenderTarget backendRT(fWidth, + fHeight, + fSampleCount, + fStencilBits, + fPixelConfig, + fbInfo); + + fSurface = SkSurface::MakeFromBackendRenderTarget(fContext, backendRT, + kBottomLeft_GrSurfaceOrigin, fDisplayParams.fColorSpace, &fSurfaceProps); } |