From bcf612b5d0032f09d58c2ea5671de977130395db Mon Sep 17 00:00:00 2001 From: Greg Daniel Date: Mon, 1 May 2017 13:50:58 +0000 Subject: Revert "Revert "Plumb the use of GrBackendRenderTarget throughout Skia"" This reverts commit e3bd422fafc74dd3410c3de24a576635be92c3b4. Reason for revert: Pre-req changes have all landed in other projects at this point. Original change's description: > Revert "Plumb the use of GrBackendRenderTarget throughout Skia" > > This reverts commit fdd77daedbba3b7c53be74a82fb9fae891b51696. > > Reason for revert: Apparently I have a few more build files to update before this can land. > > Original change's description: > > Plumb the use of GrBackendRenderTarget throughout Skia > > > > Bug: skia: > > Change-Id: Ib99a58d9552f5c7b8d77c09dcc72fa88326c26aa > > Reviewed-on: https://skia-review.googlesource.com/14148 > > Reviewed-by: Brian Salomon > > Reviewed-by: Robert Phillips > > Commit-Queue: Greg Daniel > > > > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reviews@skia.org > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > > Change-Id: I984e1909870182474c4c3cce257f01b6a9d8581f > Reviewed-on: https://skia-review.googlesource.com/14531 > Reviewed-by: Greg Daniel > Commit-Queue: Greg Daniel > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reviews@skia.org # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: Ib7ab94aada8a7cb80fe38f24daf32f9208c5b169 Reviewed-on: https://skia-review.googlesource.com/14826 Reviewed-by: Greg Daniel Commit-Queue: Greg Daniel --- src/views/SkWindow.cpp | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'src/views') diff --git a/src/views/SkWindow.cpp b/src/views/SkWindow.cpp index f86bb9f9ef..ba06a1f3c2 100644 --- a/src/views/SkWindow.cpp +++ b/src/views/SkWindow.cpp @@ -316,6 +316,7 @@ bool SkWindow::onDispatchClick(int x, int y, Click::State state, #if SK_SUPPORT_GPU +#include "GrBackendSurface.h" #include "GrContext.h" #include "gl/GrGLInterface.h" #include "gl/GrGLUtil.h" @@ -324,10 +325,9 @@ bool SkWindow::onDispatchClick(int x, int y, Click::State state, sk_sp SkWindow::makeGpuBackedSurface(const AttachmentInfo& attachmentInfo, const GrGLInterface* interface, GrContext* grContext) { - GrBackendRenderTargetDesc desc; - desc.fWidth = SkScalarRoundToInt(this->width()); - desc.fHeight = SkScalarRoundToInt(this->height()); - if (0 == desc.fWidth || 0 == desc.fHeight) { + int width = SkScalarRoundToInt(this->width()); + int height = SkScalarRoundToInt(this->height()); + if (0 == width || 0 == height) { return nullptr; } @@ -340,22 +340,28 @@ sk_sp SkWindow::makeGpuBackedSurface(const AttachmentInfo& attachment // // ... and, if we're using a 10-bit/channel FB0, it doesn't do sRGB conversion on write, // so pretend that it's non-sRGB 8888: - desc.fConfig = - grContext->caps()->srgbSupport() && - info().colorSpace() && - (attachmentInfo.fColorBits != 30) - ? kSRGBA_8888_GrPixelConfig : kRGBA_8888_GrPixelConfig; - desc.fOrigin = kBottomLeft_GrSurfaceOrigin; - desc.fSampleCnt = attachmentInfo.fSampleCount; - desc.fStencilBits = attachmentInfo.fStencilBits; + GrPixelConfig config = grContext->caps()->srgbSupport() && + info().colorSpace() && + (attachmentInfo.fColorBits != 30) + ? kSRGBA_8888_GrPixelConfig : kRGBA_8888_GrPixelConfig; + GrGLFramebufferInfo fbInfo; GrGLint buffer; GR_GL_GetIntegerv(interface, GR_GL_FRAMEBUFFER_BINDING, &buffer); - desc.fRenderTargetHandle = buffer; + fbInfo.fFBOID = buffer; + + GrBackendRenderTarget backendRT(width, + height, + attachmentInfo.fSampleCount, + attachmentInfo.fStencilBits, + config, + fbInfo); + sk_sp colorSpace = grContext->caps()->srgbSupport() && info().colorSpace() ? SkColorSpace::MakeSRGB() : nullptr; - return SkSurface::MakeFromBackendRenderTarget(grContext, desc, colorSpace, &fSurfaceProps); + return SkSurface::MakeFromBackendRenderTarget(grContext, backendRT, kBottomLeft_GrSurfaceOrigin, + colorSpace, &fSurfaceProps); } #endif -- cgit v1.2.3