diff options
author | Brian Osman <brianosman@google.com> | 2017-05-10 12:06:26 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-11 18:07:20 +0000 |
commit | 85d34b2e841d99dab914111fe2eaa4db99345e1e (patch) | |
tree | e5f7e81602d89c608fc72b0d84827cdfcd154d60 /include | |
parent | 97627d4434d4f559bd2ccf2235b5d75366add4dd (diff) |
Remove SkCrossContextImageData and all support code
Bug: skia:
Change-Id: I8eb8cef5456c05a8e314d8404698893c7af82d13
Reviewed-on: https://skia-review.googlesource.com/16368
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkCrossContextImageData.h | 96 | ||||
-rw-r--r-- | include/core/SkImage.h | 9 | ||||
-rw-r--r-- | include/gpu/GrExternalTextureData.h | 29 | ||||
-rw-r--r-- | include/gpu/GrGpuResource.h | 5 | ||||
-rw-r--r-- | include/gpu/GrTexture.h | 2 | ||||
-rw-r--r-- | include/gpu/GrTypes.h | 3 | ||||
-rw-r--r-- | include/gpu/gl/GrGLTypes.h | 20 | ||||
-rw-r--r-- | include/gpu/vk/GrVkTypes.h | 19 |
8 files changed, 0 insertions, 183 deletions
diff --git a/include/core/SkCrossContextImageData.h b/include/core/SkCrossContextImageData.h deleted file mode 100644 index a408f71446..0000000000 --- a/include/core/SkCrossContextImageData.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - -#ifndef SkCrossContextImageData_DEFINED -#define SkCrossContextImageData_DEFINED - -#include "SkImage.h" - -#if SK_SUPPORT_GPU -#include "GrBackendSurface.h" -#include "GrExternalTextureData.h" -#endif - -class SK_API SkCrossContextImageData : SkNoncopyable { -public: - /** - * Decodes and uploads the encoded data to a texture using the supplied GrContext, then - * returns an instance of SkCrossContextImageData that can be used to transport that texture - * to a different GrContext, across thread boundaries. The GrContext used here, and the one - * used to reconstruct the texture-backed image later must be in the same GL share group, - * or otherwise be able to share resources. After calling this, you *must* construct exactly - * one SkImage from the returned value, using SkImage::MakeFromCrossContextImageData. - * - * The texture will be decoded and uploaded to be suitable for use with surfaces that have the - * supplied destination color space. The color space of the texture itself will be determined - * from the encoded data. - */ - static std::unique_ptr<SkCrossContextImageData> MakeFromEncoded( - GrContext*, sk_sp<SkData>, SkColorSpace* dstColorSpace); - - virtual ~SkCrossContextImageData() {} - -protected: - SkCrossContextImageData() {} - -private: - virtual sk_sp<SkImage> makeImage(GrContext*) = 0; - - friend class SkImage; -}; - -class SkCCIDImage : public SkCrossContextImageData { -public: - ~SkCCIDImage() override {} - -private: - SkCCIDImage(sk_sp<SkImage> image) : fImage(std::move(image)) { - SkASSERT(!fImage->isTextureBacked()); - } - - sk_sp<SkImage> makeImage(GrContext*) override { - return fImage; - } - - sk_sp<SkImage> fImage; - - friend class SkCrossContextImageData; - friend class SkImage; -}; - -#if SK_SUPPORT_GPU -class SkCCIDBackendTexture : public SkCrossContextImageData { -public: - ~SkCCIDBackendTexture() override {} - -private: - SkCCIDBackendTexture(const GrBackendTexture& backendTex, - GrSurfaceOrigin origin, - std::unique_ptr<GrExternalTextureData> textureData, - SkAlphaType alphaType, sk_sp<SkColorSpace> colorSpace) - : fAlphaType(alphaType) - , fColorSpace(std::move(colorSpace)) - , fBackendTex(backendTex) - , fOrigin(origin) - , fTextureData(std::move(textureData)) {} - - sk_sp<SkImage> makeImage(GrContext*) override; - - // GPU-backed images store some generic information (needed to reconstruct the SkImage), - // and some backend-specific info (to reconstruct the texture). - SkAlphaType fAlphaType; - sk_sp<SkColorSpace> fColorSpace; - GrBackendTexture fBackendTex; - GrSurfaceOrigin fOrigin; - std::unique_ptr<GrExternalTextureData> fTextureData; - - friend class SkCrossContextImageData; -}; -#endif - -#endif diff --git a/include/core/SkImage.h b/include/core/SkImage.h index 2ba67619fe..729e43de05 100644 --- a/include/core/SkImage.h +++ b/include/core/SkImage.h @@ -18,7 +18,6 @@ class SkData; class SkCanvas; class SkColorTable; -class SkCrossContextImageData; class SkImageGenerator; class SkPaint; class SkPicture; @@ -406,14 +405,6 @@ public: sk_sp<SkImage> makeTextureImage(GrContext*, SkColorSpace* dstColorSpace) const; /** - * Constructs a texture backed image from data that was previously uploaded on another thread - * and GrContext. The GrContext used to upload the data must be in the same GL share group as - * the one passed in here, or otherwise be able to share resources with the passed in context. - */ - static sk_sp<SkImage> MakeFromCrossContextImageData(GrContext*, - std::unique_ptr<SkCrossContextImageData>); - - /** * If the image is texture-backed this will make a raster copy of it (or nullptr if reading back * the pixels fails). Otherwise, it returns the original image. */ diff --git a/include/gpu/GrExternalTextureData.h b/include/gpu/GrExternalTextureData.h deleted file mode 100644 index b3b0594aa3..0000000000 --- a/include/gpu/GrExternalTextureData.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - -#ifndef GrExternalTextureData_DEFINED -#define GrExternalTextureData_DEFINED - -#include "GrTypes.h" - -class GrContext; - -class SK_API GrExternalTextureData : SkNoncopyable { -public: - virtual ~GrExternalTextureData() {} - virtual GrBackend getBackend() const = 0; -protected: - virtual GrBackendObject getBackendObject() const = 0; - virtual void attachToContext(GrContext*) = 0; - - friend class SkCrossContextImageData; - friend class SkCCIDBackendTexture; - friend class SkImage; -}; - -#endif diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h index 2d84c633ee..1ed64adb8f 100644 --- a/include/gpu/GrGpuResource.h +++ b/include/gpu/GrGpuResource.h @@ -260,11 +260,6 @@ protected: // final class). void registerWithCacheWrapped(); - // This is only called by resources that are being exported from Ganesh to client code. It - // ensures that the cache can no longer reach this resource, and that it no longer counts - // against the budget. - void detachFromCache(); - GrGpuResource(GrGpu*); virtual ~GrGpuResource(); diff --git a/include/gpu/GrTexture.h b/include/gpu/GrTexture.h index ba7d506c7d..0edcbd0e13 100644 --- a/include/gpu/GrTexture.h +++ b/include/gpu/GrTexture.h @@ -14,7 +14,6 @@ #include "SkPoint.h" #include "SkRefCnt.h" -class GrExternalTextureData; class GrTexturePriv; class GrTexture : virtual public GrSurface { @@ -56,7 +55,6 @@ protected: GrSamplerParams::FilterMode highestFilterMode, bool wasMipMapDataProvided); void validateDesc() const; - virtual std::unique_ptr<GrExternalTextureData> detachBackendTexture() = 0; private: void computeScratchKey(GrScratchKey*) const override; diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h index 62e8a791b3..654febd3ca 100644 --- a/include/gpu/GrTypes.h +++ b/include/gpu/GrTypes.h @@ -676,9 +676,6 @@ enum GrWrapOwnership { /** Skia will assume ownership of the resource and free it. */ kAdopt_GrWrapOwnership, - - /** Skia will assume ownership of the resource, free it, and reuse it within the cache. */ - kAdoptAndCache_GrWrapOwnership, }; /** diff --git a/include/gpu/gl/GrGLTypes.h b/include/gpu/gl/GrGLTypes.h index 345364b050..a615888980 100644 --- a/include/gpu/gl/GrGLTypes.h +++ b/include/gpu/gl/GrGLTypes.h @@ -9,7 +9,6 @@ #ifndef GrGLTypes_DEFINED #define GrGLTypes_DEFINED -#include "GrExternalTextureData.h" #include "GrGLConfig.h" #include "SkRefCnt.h" @@ -114,25 +113,6 @@ struct GrGLTextureInfo { GrGLuint fID; }; -class GrSemaphore; - -class GrGLExternalTextureData : public GrExternalTextureData { -public: - GrGLExternalTextureData(const GrGLTextureInfo& info, sk_sp<GrSemaphore> semaphore, GrContext*); - GrBackend getBackend() const override { return kOpenGL_GrBackend; } - -protected: - GrBackendObject getBackendObject() const override { - return reinterpret_cast<GrBackendObject>(&fInfo); - } - void attachToContext(GrContext*) override; - - GrGLTextureInfo fInfo; - sk_sp<GrSemaphore> fSemaphore; - - typedef GrExternalTextureData INHERITED; -}; - GR_STATIC_ASSERT(sizeof(GrBackendObject) >= sizeof(const GrGLTextureInfo*)); struct GrGLFramebufferInfo { diff --git a/include/gpu/vk/GrVkTypes.h b/include/gpu/vk/GrVkTypes.h index c98a94aa92..aa1334adca 100644 --- a/include/gpu/vk/GrVkTypes.h +++ b/include/gpu/vk/GrVkTypes.h @@ -9,7 +9,6 @@ #ifndef GrVkTypes_DEFINED #define GrVkTypes_DEFINED -#include "GrExternalTextureData.h" #include "GrTypes.h" #include "vk/GrVkDefines.h" @@ -60,24 +59,6 @@ struct GrVkImageInfo { void updateImageLayout(VkImageLayout layout) { fImageLayout = layout; } }; -class GrVkExternalTextureData : public GrExternalTextureData { -public: - GrVkExternalTextureData(const GrVkImageInfo& info) : fInfo(info) {} - GrBackend getBackend() const override { return kVulkan_GrBackend; } - -protected: - GrBackendObject getBackendObject() const override { - return reinterpret_cast<GrBackendObject>(&fInfo); - } - void attachToContext(GrContext*) override { - // TODO: Implement this - } - - GrVkImageInfo fInfo; - - typedef GrExternalTextureData INHERITED; -}; - GR_STATIC_ASSERT(sizeof(GrBackendObject) >= sizeof(const GrVkImageInfo*)); #endif |