diff options
author | Robert Phillips <robertphillips@google.com> | 2018-01-08 13:40:32 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-08 19:05:31 +0000 |
commit | 1afd4cdb0800e2e395b465da24eb71e0e834dafa (patch) | |
tree | d3353e7e4487a86d00002ab882f34ec24347000b /src/image/SkImage_Lazy.cpp | |
parent | 5ec5d677b02c41a3c58609461cd8b62c2feaeddc (diff) |
Add GrProxyProvider
This pulls all the proxy tracking & creation functionality out of the GrResourceCache and GrResourceProvider and consolidates it in the GrProxyProvider.
Change-Id: I7256f7c544319a70c1bd93dd5a9ccbe5fa0a544f
Reviewed-on: https://skia-review.googlesource.com/91501
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/image/SkImage_Lazy.cpp')
-rw-r--r-- | src/image/SkImage_Lazy.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/image/SkImage_Lazy.cpp b/src/image/SkImage_Lazy.cpp index 3c9c4611e8..ae4dfd6c70 100644 --- a/src/image/SkImage_Lazy.cpp +++ b/src/image/SkImage_Lazy.cpp @@ -23,7 +23,7 @@ #include "GrGpuResourcePriv.h" #include "GrImageTextureMaker.h" #include "GrResourceKey.h" -#include "GrResourceProvider.h" +#include "GrProxyProvider.h" #include "GrSamplerState.h" #include "GrYUVProvider.h" #include "SkGr.h" @@ -695,7 +695,7 @@ public: } }; -static void set_key_on_proxy(GrResourceProvider* resourceProvider, +static void set_key_on_proxy(GrProxyProvider* proxyProvider, GrTextureProxy* proxy, GrTextureProxy* originalProxy, const GrUniqueKey& key) { if (key.isValid()) { @@ -706,9 +706,9 @@ static void set_key_on_proxy(GrResourceProvider* resourceProvider, // If we had an originalProxy, that means there already is a proxy in the cache which // matches the key, but it does not have mip levels and we require them. Thus we must // remove the unique key from that proxy. - resourceProvider->removeUniqueKeyFromProxy(key, originalProxy); + proxyProvider->removeUniqueKeyFromProxy(key, originalProxy); } - resourceProvider->assignUniqueKeyToProxy(key, proxy); + proxyProvider->assignUniqueKeyToProxy(key, proxy); } } @@ -760,12 +760,12 @@ sk_sp<GrTextureProxy> SkImage_Lazy::lockTextureProxy(GrContext* ctx, GrUniqueKey key; this->makeCacheKeyFromOrigKey(origKey, format, &key); + GrProxyProvider* proxyProvider = ctx->contextPriv().proxyProvider(); sk_sp<GrTextureProxy> proxy; // 1. Check the cache for a pre-existing one if (key.isValid()) { - proxy = ctx->resourceProvider()->findOrCreateProxyByUniqueKey(key, - kTopLeft_GrSurfaceOrigin); + proxy = proxyProvider->findOrCreateProxyByUniqueKey(key, kTopLeft_GrSurfaceOrigin); if (proxy) { SK_HISTOGRAM_ENUMERATION("LockTexturePath", kPreExisting_LockTexturePath, kLockTexturePathCount); @@ -793,7 +793,7 @@ sk_sp<GrTextureProxy> SkImage_Lazy::lockTextureProxy(GrContext* ctx, willBeMipped))) { SK_HISTOGRAM_ENUMERATION("LockTexturePath", kNative_LockTexturePath, kLockTexturePathCount); - set_key_on_proxy(ctx->resourceProvider(), proxy.get(), nullptr, key); + set_key_on_proxy(proxyProvider, proxy.get(), nullptr, key); if (!willBeMipped || GrMipMapped::kYes == proxy->mipMapped()) { return proxy; } @@ -820,7 +820,7 @@ sk_sp<GrTextureProxy> SkImage_Lazy::lockTextureProxy(GrContext* ctx, if (proxy) { SK_HISTOGRAM_ENUMERATION("LockTexturePath", kYUV_LockTexturePath, kLockTexturePathCount); - set_key_on_proxy(ctx->resourceProvider(), proxy.get(), nullptr, key); + set_key_on_proxy(proxyProvider, proxy.get(), nullptr, key); return proxy; } } @@ -832,12 +832,12 @@ sk_sp<GrTextureProxy> SkImage_Lazy::lockTextureProxy(GrContext* ctx, proxy = GrGenerateMipMapsAndUploadToTextureProxy(ctx, bitmap, dstColorSpace); } if (!proxy) { - proxy = GrUploadBitmapToTextureProxy(ctx->resourceProvider(), bitmap, dstColorSpace); + proxy = GrUploadBitmapToTextureProxy(proxyProvider, bitmap, dstColorSpace); } if (proxy && (!willBeMipped || GrMipMapped::kYes == proxy->mipMapped())) { SK_HISTOGRAM_ENUMERATION("LockTexturePath", kRGBA_LockTexturePath, kLockTexturePathCount); - set_key_on_proxy(ctx->resourceProvider(), proxy.get(), nullptr, key); + set_key_on_proxy(proxyProvider, proxy.get(), nullptr, key); return proxy; } } @@ -850,7 +850,7 @@ sk_sp<GrTextureProxy> SkImage_Lazy::lockTextureProxy(GrContext* ctx, SkASSERT(willBeMipped); SkASSERT(GrMipMapped::kNo == proxy->mipMapped()); if (auto mippedProxy = GrCopyBaseMipMapToTextureProxy(ctx, proxy.get())) { - set_key_on_proxy(ctx->resourceProvider(), mippedProxy.get(), proxy.get(), key); + set_key_on_proxy(proxyProvider, mippedProxy.get(), proxy.get(), key); return mippedProxy; } // We failed to make a mipped proxy with the base copied into it. This could have |