diff options
author | Brian Osman <brianosman@google.com> | 2017-03-02 01:17:01 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-03-02 01:17:12 +0000 |
commit | 580ffa0fb17bc4e924776eafd941bf1fab397cde (patch) | |
tree | fe316c47d2d014d5f932f22c236ffc26d8853a78 /src | |
parent | 6be35238855dbbc7575e78d6723936293a4b38e6 (diff) |
Revert "Revert "Revert "Move GrTextureProvider to src"""
This reverts commit 2fe8373bb1d56f531f8a2e03a3087b0aa73e199c.
Reason for revert: Google3 fix isn't landing.
Original change's description:
> Revert "Revert "Move GrTextureProvider to src""
>
> This reverts commit 13d7f5d7c2872ed4298330758e173ae605578cb2.
>
> Reason for revert: Fixed client code. Re-landing.
>
> Original change's description:
> > Revert "Move GrTextureProvider to src"
> >
> > This reverts commit 24429c68c56683252e3fc2a79d9b660eaf96ec0c.
> >
> > Reason for revert: Breaking a roll
> >
> > Original change's description:
> > > Move GrTextureProvider to src
> > >
> > > With this hidden, we can make further simplification. Just want to test
> > > this change against our external clients first, to make sure we're okay
> > > to proceed.
> > >
> > > BUG=skia:
> > >
> > > Change-Id: I47f8c8f2912201c2890bc2f9a9d68aa92649a2d4
> > > Reviewed-on: https://skia-review.googlesource.com/9072
> > > Commit-Queue: Brian Osman <brianosman@google.com>
> > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > >
> >
> > TBR=bsalomon@google.com,brianosman@google.com,benjaminwagner@google.com,reviews@skia.org
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> > BUG=skia:
> >
> > Change-Id: I43cc135731245c29e24bbecf06ee46c562955c03
> > Reviewed-on: https://skia-review.googlesource.com/9123
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: Brian Osman <brianosman@google.com>
> >
>
> TBR=bsalomon@google.com,benjaminwagner@google.com,reviews@skia.org,brianosman@google.com
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=skia:
>
> Change-Id: Ibcb2ea34654315327c46ea8e4de5bf14376d9bdf
> Reviewed-on: https://skia-review.googlesource.com/9127
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
>
TBR=bsalomon@google.com,benjaminwagner@google.com,reviews@skia.org,brianosman@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Change-Id: If5c06c7608d76c45438d03fefb21c4edd7da4f36
Reviewed-on: https://skia-review.googlesource.com/9128
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkImageCacherator.cpp | 1 | ||||
-rw-r--r-- | src/effects/SkBlurMaskFilter.cpp | 1 | ||||
-rw-r--r-- | src/gpu/GrBitmapTextureMaker.cpp | 1 | ||||
-rw-r--r-- | src/gpu/GrTextureAdjuster.cpp | 1 | ||||
-rw-r--r-- | src/gpu/GrTextureMaker.cpp | 1 | ||||
-rw-r--r-- | src/gpu/GrTextureProvider.h | 177 | ||||
-rw-r--r-- | src/gpu/SkGr.cpp | 1 | ||||
-rw-r--r-- | src/gpu/effects/GrTextureStripAtlas.cpp | 1 | ||||
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 1 |
9 files changed, 0 insertions, 185 deletions
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp index 5ff7c0bae1..e971883f7c 100644 --- a/src/core/SkImageCacherator.cpp +++ b/src/core/SkImageCacherator.cpp @@ -22,7 +22,6 @@ #include "GrImageTextureMaker.h" #include "GrResourceKey.h" #include "GrSamplerParams.h" -#include "GrTextureProvider.h" #include "GrYUVProvider.h" #include "SkGr.h" #include "SkGrPriv.h" diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp index 2ee942d316..dcc34295a4 100644 --- a/src/effects/SkBlurMaskFilter.cpp +++ b/src/effects/SkBlurMaskFilter.cpp @@ -23,7 +23,6 @@ #include "GrFragmentProcessor.h" #include "GrShaderCaps.h" #include "GrStyle.h" -#include "GrTextureProvider.h" #include "GrTextureProxy.h" #include "effects/GrSimpleTextureEffect.h" #include "glsl/GrGLSLFragmentProcessor.h" diff --git a/src/gpu/GrBitmapTextureMaker.cpp b/src/gpu/GrBitmapTextureMaker.cpp index 5080c5dbcc..184640f3b1 100644 --- a/src/gpu/GrBitmapTextureMaker.cpp +++ b/src/gpu/GrBitmapTextureMaker.cpp @@ -9,7 +9,6 @@ #include "GrContext.h" #include "GrGpuResourcePriv.h" -#include "GrTextureProvider.h" #include "SkBitmap.h" #include "SkGrPriv.h" #include "SkPixelRef.h" diff --git a/src/gpu/GrTextureAdjuster.cpp b/src/gpu/GrTextureAdjuster.cpp index fca57b7f85..2fa5241060 100644 --- a/src/gpu/GrTextureAdjuster.cpp +++ b/src/gpu/GrTextureAdjuster.cpp @@ -11,7 +11,6 @@ #include "GrGpu.h" #include "GrGpuResourcePriv.h" #include "GrTexture.h" -#include "GrTextureProvider.h" #include "SkGrPriv.h" GrTextureAdjuster::GrTextureAdjuster(GrTexture* original, SkAlphaType alphaType, diff --git a/src/gpu/GrTextureMaker.cpp b/src/gpu/GrTextureMaker.cpp index ac89af7d87..e68703afa1 100644 --- a/src/gpu/GrTextureMaker.cpp +++ b/src/gpu/GrTextureMaker.cpp @@ -9,7 +9,6 @@ #include "GrContext.h" #include "GrGpu.h" -#include "GrTextureProvider.h" GrTexture* GrTextureMaker::refTextureForParams(const GrSamplerParams& params, SkColorSpace* dstColorSpace, diff --git a/src/gpu/GrTextureProvider.h b/src/gpu/GrTextureProvider.h deleted file mode 100644 index b8d185648d..0000000000 --- a/src/gpu/GrTextureProvider.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrTextureProvider_DEFINED -#define GrTextureProvider_DEFINED - -#include "GrTexture.h" -#include "GrTypes.h" - -class GrSingleOwner; - -class SK_API GrTextureProvider { -public: - /////////////////////////////////////////////////////////////////////////// - // Textures - - /** - * Creates a new texture in the resource cache and returns it. The caller owns a - * ref on the returned texture which must be balanced by a call to unref. - * - * @param desc Description of the texture properties. - * @param budgeted Does the texture count against the resource cache budget? - * @param texels A contiguous array of mipmap levels - * @param mipLevelCount The amount of elements in the texels array - */ - GrTexture* createMipMappedTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, - const GrMipLevel* texels, int mipLevelCount, - uint32_t flags = 0); - - /** - * This function is a shim which creates a SkTArray<GrMipLevel> of size 1. - * It then calls createTexture with that SkTArray. - * - * @param srcData Pointer to the pixel values (optional). - * @param rowBytes The number of bytes between rows of the texture. Zero - * implies tightly packed rows. For compressed pixel configs, this - * field is ignored. - */ - GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, const void* srcData, - size_t rowBytes, uint32_t flags = 0); - - /** Shortcut for creating a texture with no initial data to upload. */ - GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, uint32_t flags = 0) { - return this->createTexture(desc, budgeted, nullptr, 0, flags); - } - - /** Assigns a unique key to the texture. The texture will be findable via this key using - findTextureByUniqueKey(). If an existing texture has this key, it's key will be removed. */ - void assignUniqueKeyToTexture(const GrUniqueKey& key, GrTexture* texture) { - this->assignUniqueKeyToResource(key, texture); - } - - /** Finds a texture by unique key. If the texture is found it is ref'ed and returned. */ - GrTexture* findAndRefTextureByUniqueKey(const GrUniqueKey& key); - - /** - * Determines whether a texture is associated with the unique key. If the texture is found it - * will not be locked or returned. This call does not affect the priority of the resource for - * deletion. - */ - bool existsTextureWithUniqueKey(const GrUniqueKey& key) const { - return this->existsResourceWithUniqueKey(key); - } - - /** - * Finds a texture that approximately matches the descriptor. Will be at least as large in width - * and height as desc specifies. If desc specifies that the texture should be a render target - * then result will be a render target. Format and sample count will always match the request. - * The contents of the texture are undefined. The caller owns a ref on the returned texture and - * must balance with a call to unref. - */ - GrTexture* createApproxTexture(const GrSurfaceDesc&, uint32_t flags = 0); - - /** Legacy function that no longer should be used. */ - enum ScratchTexMatch { - kExact_ScratchTexMatch, - kApprox_ScratchTexMatch - }; - GrTexture* refScratchTexture(const GrSurfaceDesc& desc, ScratchTexMatch match, uint32_t flags) { - if (kApprox_ScratchTexMatch == match) { - return this->createApproxTexture(desc, flags); - } else { - return this->createTexture(desc, SkBudgeted::kYes, flags); - } - } - - /////////////////////////////////////////////////////////////////////////// - // Wrapped Backend Surfaces - - /** - * Wraps an existing texture with a GrTexture object. - * - * OpenGL: if the object is a texture Gr may change its GL texture params - * when it is drawn. - * - * @return GrTexture object or NULL on failure. - */ - sk_sp<GrTexture> wrapBackendTexture(const GrBackendTextureDesc& desc, - GrWrapOwnership = kBorrow_GrWrapOwnership); - - /** - * Wraps an existing render target with a GrRenderTarget object. It is - * similar to wrapBackendTexture but can be used to draw into surfaces - * that are not also textures (e.g. FBO 0 in OpenGL, or an MSAA buffer that - * the client will resolve to a texture). Currently wrapped render targets - * always use the kBorrow_GrWrapOwnership semantics. - * - * @return GrRenderTarget object or NULL on failure. - */ - sk_sp<GrRenderTarget> wrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc); - - static const int kMinScratchTextureSize; - -protected: - GrTextureProvider(GrGpu* gpu, GrResourceCache* cache, GrSingleOwner* singleOwner); - - /** - * Assigns a unique key to a resource. If the key is associated with another resource that - * association is removed and replaced by this resource. - */ - void assignUniqueKeyToResource(const GrUniqueKey&, GrGpuResource*); - - /** - * Finds a resource in the cache, based on the specified key. This is intended for use in - * conjunction with addResourceToCache(). The return value will be NULL if not found. The - * caller must balance with a call to unref(). - */ - GrGpuResource* findAndRefResourceByUniqueKey(const GrUniqueKey&); - - /** - * Determines whether a resource is in the cache. If the resource is found it - * will not be locked or returned. This call does not affect the priority of - * the resource for deletion. - */ - bool existsResourceWithUniqueKey(const GrUniqueKey& key) const; - - enum ScratchTextureFlags { - kExact_ScratchTextureFlag = 0x1, - kNoPendingIO_ScratchTextureFlag = 0x2, // (http://skbug.com/4156) - kNoCreate_ScratchTextureFlag = 0x4, - kLastScratchTextureFlag = kNoCreate_ScratchTextureFlag - }; - - /** A common impl for GrTextureProvider and GrResourceProvider variants. */ - GrTexture* internalCreateApproxTexture(const GrSurfaceDesc& desc, uint32_t scratchTextureFlags); - - GrTexture* refScratchTexture(const GrSurfaceDesc&, uint32_t scratchTextureFlags); - - void abandon() { - fCache = NULL; - fGpu = NULL; - } - - GrResourceCache* cache() { return fCache; } - const GrResourceCache* cache() const { return fCache; } - - GrGpu* gpu() { return fGpu; } - const GrGpu* gpu() const { return fGpu; } - - bool isAbandoned() const { - SkASSERT(SkToBool(fGpu) == SkToBool(fCache)); - return !SkToBool(fCache); - } - -private: - GrResourceCache* fCache; - GrGpu* fGpu; - - // In debug builds we guard against improper thread handling - SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) -}; - -#endif diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index 5b8e061b3a..fe7e98c8d9 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -14,7 +14,6 @@ #include "GrGpuResourcePriv.h" #include "GrRenderTargetContext.h" #include "GrTexturePriv.h" -#include "GrTextureProvider.h" #include "GrTextureProxy.h" #include "GrTypes.h" #include "GrXferProcessor.h" diff --git a/src/gpu/effects/GrTextureStripAtlas.cpp b/src/gpu/effects/GrTextureStripAtlas.cpp index 1791b20e70..f49830481b 100644 --- a/src/gpu/effects/GrTextureStripAtlas.cpp +++ b/src/gpu/effects/GrTextureStripAtlas.cpp @@ -10,7 +10,6 @@ #include "GrContextPriv.h" #include "GrResourceProvider.h" #include "GrSurfaceContext.h" -#include "GrTextureProvider.h" #include "SkGr.h" #include "SkPixelRef.h" #include "SkTSearch.h" diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 88d18893d7..33d17bc644 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -19,7 +19,6 @@ #include "GrRenderTargetContext.h" #include "GrTextureAdjuster.h" #include "GrTexturePriv.h" -#include "GrTextureProvider.h" #include "GrTextureProxy.h" #include "effects/GrYUVEffect.h" #include "SkCanvas.h" |