diff options
author | bsalomon <bsalomon@google.com> | 2016-07-19 09:46:29 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-19 09:46:29 -0700 |
commit | c7b4b28496a94c3fce7f11a18ce04deffbf9cfcb (patch) | |
tree | 79f874593ee36589f3d355232cce5625c3bf1bb3 /tools | |
parent | 6bdbf4412bd1a6fe26be1042ccf080174b13021f (diff) |
Make sk_app::WindowContext directly create a SkSurface without an intermediate GrRenderTarget
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2165703002
Review-Url: https://codereview.chromium.org/2165703002
Diffstat (limited to 'tools')
-rw-r--r-- | tools/viewer/sk_app/GLWindowContext.cpp | 3 | ||||
-rw-r--r-- | tools/viewer/sk_app/VulkanWindowContext.cpp | 3 | ||||
-rwxr-xr-x | tools/viewer/sk_app/WindowContext.cpp | 8 | ||||
-rw-r--r-- | tools/viewer/sk_app/WindowContext.h | 5 |
4 files changed, 9 insertions, 10 deletions
diff --git a/tools/viewer/sk_app/GLWindowContext.cpp b/tools/viewer/sk_app/GLWindowContext.cpp index b960da4824..31ba01c292 100644 --- a/tools/viewer/sk_app/GLWindowContext.cpp +++ b/tools/viewer/sk_app/GLWindowContext.cpp @@ -83,9 +83,8 @@ sk_sp<SkSurface> GLWindowContext::getBackbufferSurface() { GrGLint buffer; GR_GL_CALL(fBackendContext, GetIntegerv(GR_GL_FRAMEBUFFER_BINDING, &buffer)); desc.fRenderTargetHandle = buffer; - fRenderTarget.reset(fContext->textureProvider()->wrapBackendRenderTarget(desc)); - fSurface = this->createRenderSurface(fRenderTarget, fActualColorBits); + fSurface = this->createRenderSurface(desc, fActualColorBits); } } diff --git a/tools/viewer/sk_app/VulkanWindowContext.cpp b/tools/viewer/sk_app/VulkanWindowContext.cpp index 5087e5d4fd..c969f28d85 100644 --- a/tools/viewer/sk_app/VulkanWindowContext.cpp +++ b/tools/viewer/sk_app/VulkanWindowContext.cpp @@ -278,9 +278,8 @@ void VulkanWindowContext::createBuffers(VkFormat format) { desc.fSampleCnt = 0; desc.fStencilBits = 0; desc.fRenderTargetHandle = (GrBackendObject) &info; - fRenderTargets[i].reset(fContext->textureProvider()->wrapBackendRenderTarget(desc)); - fSurfaces[i] = this->createRenderSurface(fRenderTargets[i], 24); + fSurfaces[i] = this->createRenderSurface(desc, 24); } // create the command pool for the command buffers diff --git a/tools/viewer/sk_app/WindowContext.cpp b/tools/viewer/sk_app/WindowContext.cpp index ba04e7eace..5d364bc497 100755 --- a/tools/viewer/sk_app/WindowContext.cpp +++ b/tools/viewer/sk_app/WindowContext.cpp @@ -25,12 +25,12 @@ sk_sp<SkSurface> WindowContext::createOffscreenSurface(bool forceSRGB) { return createSurface(nullptr, 0, true, forceSRGB); } -sk_sp<SkSurface> WindowContext::createRenderSurface(sk_sp<GrRenderTarget> rt, int colorBits) { - return createSurface(rt, colorBits, false, false); +sk_sp<SkSurface> WindowContext::createRenderSurface(GrBackendRenderTargetDesc desc, int colorBits) { + return createSurface(&desc, colorBits, false, false); } sk_sp<SkSurface> WindowContext::createSurface( - sk_sp<GrRenderTarget> rt, int colorBits, bool offscreen, bool forceSRGB) { + GrBackendRenderTargetDesc* rtDesc, int colorBits, bool offscreen, bool forceSRGB) { auto flags = (fSurfaceProps.flags() & ~SkSurfaceProps::kGammaCorrect_Flag) | (GrPixelConfigIsSRGB(fPixelConfig) || forceSRGB ? SkSurfaceProps::kGammaCorrect_Flag : 0); @@ -57,7 +57,7 @@ sk_sp<SkSurface> WindowContext::createSurface( return SkSurface::MakeRaster(info, &props); } } else { - return SkSurface::MakeRenderTargetDirect(rt.get(), &props); + return SkSurface::MakeFromBackendRenderTarget(fContext, *rtDesc, &props); } } diff --git a/tools/viewer/sk_app/WindowContext.h b/tools/viewer/sk_app/WindowContext.h index 2c526a4bfe..917eb4edf8 100644 --- a/tools/viewer/sk_app/WindowContext.h +++ b/tools/viewer/sk_app/WindowContext.h @@ -45,13 +45,14 @@ public: GrContext* getGrContext() const { return fContext; } sk_sp<SkSurface> createOffscreenSurface(bool sRGB); - sk_sp<SkSurface> createRenderSurface(sk_sp<GrRenderTarget>, int colorBits); void presentRenderSurface(sk_sp<SkSurface> renderSurface, sk_sp<GrRenderTarget> rt, int colorBits); protected: virtual bool isGpuContext() { return true; } + sk_sp<SkSurface> createRenderSurface(GrBackendRenderTargetDesc, int colorBits); + GrContext* fContext; int fWidth; @@ -62,7 +63,7 @@ protected: private: sk_sp<SkSurface> createSurface( - sk_sp<GrRenderTarget>, int colorBits, bool offscreen, bool forceSRGB); + GrBackendRenderTargetDesc*, int colorBits, bool offscreen, bool forceSRGB); }; } // namespace sk_app |