SkImage_Lazy::lockTextureProxyView computes its own key
Remove unused key from GrYUVAImageTextureMaker. Remove outdated comment about width/height for image/bitmap key. Change-Id: I76efd61725a0c63c058cdf480295f49dcfeab0fb Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274238 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
231f1bf565
commit
d6205322cd
@ -30,11 +30,10 @@ GrImageTextureMaker::GrImageTextureMaker(GrRecordingContext* context, const SkIm
|
||||
, fImage(static_cast<const SkImage_Lazy*>(client))
|
||||
, fCachingHint(chint) {
|
||||
SkASSERT(client->isLazyGenerated());
|
||||
GrMakeKeyFromImageID(&fOriginalKey, client->uniqueID(), SkIRect::MakeSize(this->dimensions()));
|
||||
}
|
||||
|
||||
GrSurfaceProxyView GrImageTextureMaker::refOriginalTextureProxyView(GrMipMapped mipMapped) {
|
||||
return fImage->lockTextureProxyView(this->context(), fOriginalKey, fCachingHint, mipMapped);
|
||||
return fImage->lockTextureProxyView(this->context(), fCachingHint, mipMapped);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -44,7 +43,6 @@ GrYUVAImageTextureMaker::GrYUVAImageTextureMaker(GrContext* context, const SkIma
|
||||
: INHERITED(context, client->imageInfo(), useDecal)
|
||||
, fImage(static_cast<const SkImage_GpuYUVA*>(client)) {
|
||||
SkASSERT(as_IB(client)->isYUVA());
|
||||
GrMakeKeyFromImageID(&fOriginalKey, client->uniqueID(), SkIRect::MakeSize(this->dimensions()));
|
||||
}
|
||||
|
||||
GrSurfaceProxyView GrYUVAImageTextureMaker::refOriginalTextureProxyView(GrMipMapped mipMapped) {
|
||||
|
@ -25,7 +25,6 @@ private:
|
||||
GrSurfaceProxyView refOriginalTextureProxyView(GrMipMapped) override;
|
||||
|
||||
const SkImage_Lazy* fImage;
|
||||
GrUniqueKey fOriginalKey;
|
||||
SkImage::CachingHint fCachingHint;
|
||||
|
||||
typedef GrTextureMaker INHERITED;
|
||||
@ -51,7 +50,6 @@ private:
|
||||
GrSurfaceProxyView refOriginalTextureProxyView(GrMipMapped) override;
|
||||
|
||||
const SkImage_GpuYUVA* fImage;
|
||||
GrUniqueKey fOriginalKey;
|
||||
|
||||
typedef GrTextureMaker INHERITED;
|
||||
};
|
||||
|
@ -194,8 +194,6 @@ GrSurfaceProxyView GrMakeCachedBitmapProxyView(GrRecordingContext*, const SkBitm
|
||||
* - SkBitmap/SkPixelRef
|
||||
* - SkImage
|
||||
* - SkImageGenerator
|
||||
*
|
||||
* Note: width/height must fit in 16bits for this impl.
|
||||
*/
|
||||
void GrMakeKeyFromImageID(GrUniqueKey* key, uint32_t imageID, const SkIRect& imageBounds);
|
||||
|
||||
|
@ -346,15 +346,6 @@ sk_sp<SkImage> SkImage::DecodeToRaster(const void* encoded, size_t length, const
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
|
||||
void SkImage_Lazy::makeCacheKeyFromOrigKey(const GrUniqueKey& origKey,
|
||||
GrUniqueKey* cacheKey) const {
|
||||
SkASSERT(!cacheKey->isValid());
|
||||
if (origKey.isValid()) {
|
||||
static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
|
||||
GrUniqueKey::Builder builder(cacheKey, origKey, kDomain, 0, "Image");
|
||||
}
|
||||
}
|
||||
|
||||
class Generator_GrYUVProvider : public GrYUVProvider {
|
||||
public:
|
||||
Generator_GrYUVProvider(SkImageGenerator* gen) : fGen(gen) {}
|
||||
@ -420,7 +411,6 @@ sk_sp<SkCachedData> SkImage_Lazy::getPlanes(SkYUVASizeInfo* yuvaSizeInfo,
|
||||
* 4. Ask the generator to return RGB(A) data, which the GPU can convert
|
||||
*/
|
||||
GrSurfaceProxyView SkImage_Lazy::lockTextureProxyView(GrRecordingContext* ctx,
|
||||
const GrUniqueKey& origKey,
|
||||
SkImage::CachingHint chint,
|
||||
GrMipMapped mipMapped) const {
|
||||
// Values representing the various texture lock paths we can take. Used for logging the path
|
||||
@ -441,13 +431,9 @@ GrSurfaceProxyView SkImage_Lazy::lockTextureProxyView(GrRecordingContext* ctx,
|
||||
return mipMapped == GrMipMapped::kNo ||
|
||||
view.asTextureProxy()->mipMapped() == GrMipMapped::kYes;
|
||||
};
|
||||
// Build our texture key.
|
||||
// Even though some proxies created here may have a specific origin and use that origin, we do
|
||||
// not include that in the key. Since SkImages are meant to be immutable, a given SkImage will
|
||||
// always have an associated proxy that is always one origin or the other. It never can change
|
||||
// origins. Thus we don't need to include that info in the key iteself.
|
||||
|
||||
GrUniqueKey key;
|
||||
this->makeCacheKeyFromOrigKey(origKey, &key);
|
||||
GrMakeKeyFromImageID(&key, this->uniqueID(), SkIRect::MakeSize(this->dimensions()));
|
||||
|
||||
const GrCaps* caps = ctx->priv().caps();
|
||||
GrProxyProvider* proxyProvider = ctx->priv().proxyProvider();
|
||||
|
@ -57,10 +57,9 @@ public:
|
||||
bool onIsValid(GrContext*) const override;
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
// Returns the texture proxy. If we're going to generate and cache the texture, we should use
|
||||
// the passed in key (if the key is valid).
|
||||
// Returns the texture proxy. CachingHint refers to whether the generator's output should be
|
||||
// cached in CPU memory. We will always cache the generated texture on success.
|
||||
GrSurfaceProxyView lockTextureProxyView(GrRecordingContext*,
|
||||
const GrUniqueKey& key,
|
||||
SkImage::CachingHint,
|
||||
GrMipMapped) const;
|
||||
|
||||
@ -69,8 +68,6 @@ public:
|
||||
// data to a texture but the GPU doesn't support the format of CPU data. In this case we convert
|
||||
// the data to RGBA_8888 unorm on the CPU then upload that.
|
||||
GrColorType colorTypeOfLockTextureProxy(const GrCaps* caps) const;
|
||||
|
||||
void makeCacheKeyFromOrigKey(const GrUniqueKey& origKey, GrUniqueKey* cacheKey) const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user