From 6d138bf681eee54a8b4a40e5dbbd08a137ae0d93 Mon Sep 17 00:00:00 2001 From: Greg Daniel Date: Thu, 3 May 2018 16:54:03 -0400 Subject: Reland "Remove GrBackendObject and all related functions from Skia." This is a reland of ccd4cfc23ebbbecbc6b292359352aad335ad7b73 Original change's description: > Remove GrBackendObject and all related functions from Skia. > > Bug: skia: > Change-Id: I59434b7477c0bc26fd982bd81eb97ab94bbba073 > Reviewed-on: https://skia-review.googlesource.com/125822 > Reviewed-by: Brian Salomon > Commit-Queue: Greg Daniel Bug: skia: Change-Id: Ibd1b9bd04b36840d9d872e2f0970dd6bac378bc9 Reviewed-on: https://skia-review.googlesource.com/129380 Reviewed-by: Greg Daniel Commit-Queue: Greg Daniel --- src/image/SkImage.cpp | 11 ----------- src/image/SkImage_Base.h | 6 ------ src/image/SkImage_Gpu.cpp | 40 ---------------------------------------- src/image/SkImage_Gpu.h | 4 ---- src/image/SkSurface.cpp | 10 ---------- src/image/SkSurface_Base.h | 10 ---------- src/image/SkSurface_Gpu.cpp | 23 ----------------------- src/image/SkSurface_Gpu.h | 5 ----- 8 files changed, 109 deletions(-) (limited to 'src/image') diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp index 3be804fca8..72285bd698 100644 --- a/src/image/SkImage.cpp +++ b/src/image/SkImage.cpp @@ -163,13 +163,6 @@ GrTexture* SkImage::getTexture() const { bool SkImage::isTextureBacked() const { return SkToBool(as_IB(this)->peekProxy()); } -#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS -GrBackendObject SkImage::getTextureHandle(bool flushPendingGrContextIO, - GrSurfaceOrigin* origin) const { - return as_IB(this)->onGetTextureHandle(flushPendingGrContextIO, origin); -} -#endif - GrBackendTexture SkImage::getBackendTexture(bool flushPendingGrContextIO, GrSurfaceOrigin* origin) const { return as_IB(this)->onGetBackendTexture(flushPendingGrContextIO, origin); @@ -188,10 +181,6 @@ GrTexture* SkImage::getTexture() const { return nullptr; } bool SkImage::isTextureBacked() const { return false; } -#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS -GrBackendObject SkImage::getTextureHandle(bool, GrSurfaceOrigin*) const { return 0; } -#endif - GrBackendTexture SkImage::getBackendTexture(bool flushPendingGrContextIO, GrSurfaceOrigin* origin) const { return GrBackendTexture(); // invalid diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h index 47df69928e..2049fb3561 100644 --- a/src/image/SkImage_Base.h +++ b/src/image/SkImage_Base.h @@ -55,12 +55,6 @@ public: virtual sk_sp refPinnedTextureProxy(uint32_t* uniqueID) const { return nullptr; } -#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS - virtual GrBackendObject onGetTextureHandle(bool flushPendingGrContextIO, - GrSurfaceOrigin* origin) const { - return 0; - } -#endif virtual GrTexture* onGetTexture() const { return nullptr; } #endif diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 62b97ae131..40e055e520 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -162,46 +162,6 @@ static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes) } } -#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS -GrBackendObject SkImage_Gpu::onGetTextureHandle(bool flushPendingGrContextIO, - GrSurfaceOrigin* origin) const { - SkASSERT(fProxy); - - if (!fContext->contextPriv().resourceProvider() && !fProxy->priv().isInstantiated()) { - // This image was created with a DDL context and cannot be instantiated. Thus we return 0 - // here which is considered invalid for all backends. - return 0; - } - - if (GrSurfaceProxy::LazyState::kNot != fProxy->lazyInstantiationState()) { - SkASSERT(fContext->contextPriv().resourceProvider()); - fProxy->priv().doLazyInstantiation(fContext->contextPriv().resourceProvider()); - if (!fProxy->priv().isInstantiated()) { - // We failed to instantiate the lazy proxy. Thus we return 0 here which is considered - // invalid for all backends. - return 0; - } - } - - if (!fProxy->instantiate(fContext->contextPriv().resourceProvider())) { - return 0; - } - - GrTexture* texture = fProxy->priv().peekTexture(); - - if (texture) { - if (flushPendingGrContextIO) { - fContext->contextPriv().prepareSurfaceForExternalIO(fProxy.get()); - } - if (origin) { - *origin = fProxy->origin(); - } - return texture->getTextureHandle(); - } - return 0; -} -#endif - GrBackendTexture SkImage_Gpu::onGetBackendTexture(bool flushPendingGrContextIO, GrSurfaceOrigin* origin) const { SkASSERT(fProxy); diff --git a/src/image/SkImage_Gpu.h b/src/image/SkImage_Gpu.h index 1425c875ce..cb9a7c7a9f 100644 --- a/src/image/SkImage_Gpu.h +++ b/src/image/SkImage_Gpu.h @@ -50,10 +50,6 @@ public: return fProxy; } -#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS - GrBackendObject onGetTextureHandle(bool flushPendingGrContextIO, - GrSurfaceOrigin* origin) const override; -#endif GrBackendTexture onGetBackendTexture(bool flushPendingGrContextIO, GrSurfaceOrigin* origin) const override; diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp index 73f3175ab9..1a3eb4312e 100644 --- a/src/image/SkSurface.cpp +++ b/src/image/SkSurface.cpp @@ -218,16 +218,6 @@ void SkSurface::writePixels(const SkBitmap& src, int x, int y) { } } -#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS -GrBackendObject SkSurface::getTextureHandle(BackendHandleAccess access) { - return asSB(this)->onGetTextureHandle(access); -} - -bool SkSurface::getRenderTargetHandle(GrBackendObject* obj, BackendHandleAccess access) { - return asSB(this)->onGetRenderTargetHandle(obj, access); -} -#endif - GrBackendTexture SkSurface::getBackendTexture(BackendHandleAccess access) { return asSB(this)->onGetBackendTexture(access); } diff --git a/src/image/SkSurface_Base.h b/src/image/SkSurface_Base.h index 90bcdff1dd..67d330f9bb 100644 --- a/src/image/SkSurface_Base.h +++ b/src/image/SkSurface_Base.h @@ -19,16 +19,6 @@ public: SkSurface_Base(const SkImageInfo&, const SkSurfaceProps*); virtual ~SkSurface_Base(); -#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS - virtual GrBackendObject onGetTextureHandle(BackendHandleAccess) { - return 0; - } - - virtual bool onGetRenderTargetHandle(GrBackendObject*, BackendHandleAccess) { - return false; - } -#endif - virtual GrBackendTexture onGetBackendTexture(BackendHandleAccess); virtual GrBackendRenderTarget onGetBackendRenderTarget(BackendHandleAccess); diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp index b4e6acf0c2..2f7b039488 100644 --- a/src/image/SkSurface_Gpu.cpp +++ b/src/image/SkSurface_Gpu.cpp @@ -51,29 +51,6 @@ static GrRenderTarget* prepare_rt_for_external_access(SkSurface_Gpu* surface, return rtc->accessRenderTarget(); } -#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS -GrBackendObject SkSurface_Gpu::onGetTextureHandle(BackendHandleAccess access) { - GrRenderTarget* rt = prepare_rt_for_external_access(this, access); - if (!rt) { - return 0; - } - GrTexture* texture = rt->asTexture(); - if (texture) { - return texture->getTextureHandle(); - } - return 0; -} - -bool SkSurface_Gpu::onGetRenderTargetHandle(GrBackendObject* obj, BackendHandleAccess access) { - GrRenderTarget* rt = prepare_rt_for_external_access(this, access); - if (!rt) { - return false; - } - *obj = rt->getRenderTargetHandle(); - return true; -} -#endif - GrBackendTexture SkSurface_Gpu::onGetBackendTexture(BackendHandleAccess access) { GrRenderTarget* rt = prepare_rt_for_external_access(this, access); if (!rt) { diff --git a/src/image/SkSurface_Gpu.h b/src/image/SkSurface_Gpu.h index fc014c2cd2..97fe5e5d5a 100644 --- a/src/image/SkSurface_Gpu.h +++ b/src/image/SkSurface_Gpu.h @@ -23,11 +23,6 @@ public: // This is an internal-only factory static sk_sp MakeWrappedRenderTarget(GrContext*, sk_sp); -#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS - GrBackendObject onGetTextureHandle(BackendHandleAccess) override; - bool onGetRenderTargetHandle(GrBackendObject*, BackendHandleAccess) override; -#endif - GrBackendTexture onGetBackendTexture(BackendHandleAccess) override; GrBackendRenderTarget onGetBackendRenderTarget(BackendHandleAccess) override; -- cgit v1.2.3