diff options
author | bsalomon <bsalomon@google.com> | 2015-10-15 12:14:55 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-15 12:14:55 -0700 |
commit | 5f5527fb46664297fbeb575033886a757eb44147 (patch) | |
tree | 3370bdc9bc9b765d2817b4d25b1a9d9b22f0b632 /src/core | |
parent | 41c054eeb0109c35cadaa90c546cbf954edcb3fe (diff) |
Remove params from Cacherator_GrTextureMaker
Review URL: https://codereview.chromium.org/1403313003
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkImageCacherator.cpp | 24 | ||||
-rw-r--r-- | src/core/SkImageCacherator.h | 2 | ||||
-rw-r--r-- | src/core/SkImageGenerator.cpp | 5 | ||||
-rw-r--r-- | src/core/SkPictureImageGenerator.cpp | 5 |
4 files changed, 16 insertions, 20 deletions
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp index 5c0d05451d..cd5ae57699 100644 --- a/src/core/SkImageCacherator.cpp +++ b/src/core/SkImageCacherator.cpp @@ -140,7 +140,7 @@ bool SkImageCacherator::lockAsBitmap(SkBitmap* bitmap, const SkImage* client) { { ScopedGenerator generator(this); SkIRect subset = SkIRect::MakeXYWH(fOrigin.x(), fOrigin.y(), fInfo.width(), fInfo.height()); - tex.reset(generator->generateTexture(nullptr, GrTextureParams::ClampNoFilter(), &subset)); + tex.reset(generator->generateTexture(nullptr, &subset)); } if (!tex) { bitmap->reset(); @@ -217,8 +217,7 @@ static GrTexture* set_key_and_return(GrTexture* tex, const GrUniqueKey& key) { * 4. Ask the generator to return YUV planes, which the GPU can convert * 5. Ask the generator to return RGB(A) data, which the GPU can convert */ -GrTexture* SkImageCacherator::lockUnstretchedTexture(GrContext* ctx, const GrTextureParams& params, - const SkImage* client) { +GrTexture* SkImageCacherator::lockUnstretchedTexture(GrContext* ctx, const SkImage* client) { // textures (at least the texture-key) only support 16bit dimensions, so abort early // if we're too big. if (fInfo.width() > 0xFFFF || fInfo.height() > 0xFFFF) { @@ -226,8 +225,9 @@ GrTexture* SkImageCacherator::lockUnstretchedTexture(GrContext* ctx, const GrTex } GrUniqueKey key; + const GrTextureParams& noStretchParams = GrTextureParams::ClampNoFilter(); GrMakeKeyFromImageID(&key, fUniqueID, SkIRect::MakeWH(fInfo.width(), fInfo.height()), - *ctx->caps(), params); + *ctx->caps(), noStretchParams); // 1. Check the cache for a pre-existing one if (GrTexture* tex = ctx->textureProvider()->findAndRefTextureByUniqueKey(key)) { @@ -238,7 +238,7 @@ GrTexture* SkImageCacherator::lockUnstretchedTexture(GrContext* ctx, const GrTex { ScopedGenerator generator(this); SkIRect subset = SkIRect::MakeXYWH(fOrigin.x(), fOrigin.y(), fInfo.width(), fInfo.height()); - if (GrTexture* tex = generator->generateTexture(ctx, params, &subset)) { + if (GrTexture* tex = generator->generateTexture(ctx, &subset)) { return set_key_and_return(tex, key); } } @@ -267,7 +267,7 @@ GrTexture* SkImageCacherator::lockUnstretchedTexture(GrContext* ctx, const GrTex // 5. Ask the generator to return RGB(A) data, which the GPU can convert SkBitmap bitmap; if (this->tryLockAsBitmap(&bitmap, client)) { - return GrRefCachedBitmapTexture(ctx, bitmap, params); + return GrRefCachedBitmapTexture(ctx, bitmap, noStretchParams); } return nullptr; } @@ -278,11 +278,10 @@ GrTexture* SkImageCacherator::lockUnstretchedTexture(GrContext* ctx, const GrTex class Cacherator_GrTextureMaker : public GrTextureMaker { public: - Cacherator_GrTextureMaker(SkImageCacherator* cacher, const GrTextureParams& params, - const SkImage* client, const GrUniqueKey& unstretchedKey) + Cacherator_GrTextureMaker(SkImageCacherator* cacher, const SkImage* client, + const GrUniqueKey& unstretchedKey) : INHERITED(cacher->info().width(), cacher->info().height()) , fCacher(cacher) - , fParams(params) , fClient(client) , fUnstretchedKey(unstretchedKey) {} @@ -293,7 +292,7 @@ protected: // GrTexture* onGenerateStretchedTexture(GrContext*, const SkGrStretch&) override; GrTexture* onRefUnstretchedTexture(GrContext* ctx) override { - return fCacher->lockUnstretchedTexture(ctx, fParams, fClient); + return fCacher->lockUnstretchedTexture(ctx, fClient); } bool onMakeStretchedKey(const SkGrStretch& stretch, GrUniqueKey* stretchedKey) override { @@ -312,7 +311,6 @@ protected: private: SkImageCacherator* fCacher; - const GrTextureParams& fParams; const SkImage* fClient; const GrUniqueKey fUnstretchedKey; @@ -328,9 +326,9 @@ GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParam GrUniqueKey key; GrMakeKeyFromImageID(&key, this->uniqueID(), SkIRect::MakeWH(this->info().width(), this->info().height()), - *ctx->caps(), params); + *ctx->caps(), GrTextureParams::ClampNoFilter()); - return Cacherator_GrTextureMaker(this, params, client, key).refCachedTexture(ctx, params); + return Cacherator_GrTextureMaker(this, client, key).refCachedTexture(ctx, params); } #else diff --git a/src/core/SkImageCacherator.h b/src/core/SkImageCacherator.h index 1d00117e18..7508f34fe7 100644 --- a/src/core/SkImageCacherator.h +++ b/src/core/SkImageCacherator.h @@ -60,7 +60,7 @@ private: bool generateBitmap(SkBitmap*); bool tryLockAsBitmap(SkBitmap*, const SkImage*); #if SK_SUPPORT_GPU - GrTexture* lockUnstretchedTexture(GrContext*, const GrTextureParams&, const SkImage* client); + GrTexture* lockUnstretchedTexture(GrContext*, const SkImage* client); #endif class ScopedGenerator { diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp index 98a40148f2..440ae7f5b8 100644 --- a/src/core/SkImageGenerator.cpp +++ b/src/core/SkImageGenerator.cpp @@ -104,12 +104,11 @@ bool SkImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t return this->onGetYUV8Planes(sizes, planes, rowBytes); } -GrTexture* SkImageGenerator::generateTexture(GrContext* ctx, const GrTextureParams& params, - const SkIRect* subset) { +GrTexture* SkImageGenerator::generateTexture(GrContext* ctx, const SkIRect* subset) { if (subset && !SkIRect::MakeWH(fInfo.width(), fInfo.height()).contains(*subset)) { return nullptr; } - return this->onGenerateTexture(ctx, params, subset); + return this->onGenerateTexture(ctx, subset); } ///////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/SkPictureImageGenerator.cpp b/src/core/SkPictureImageGenerator.cpp index a27291f1a8..556015d99e 100644 --- a/src/core/SkPictureImageGenerator.cpp +++ b/src/core/SkPictureImageGenerator.cpp @@ -22,7 +22,7 @@ protected: bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkPMColor ctable[], int* ctableCount) override; #if SK_SUPPORT_GPU - GrTexture* onGenerateTexture(GrContext*, const GrTextureParams&, const SkIRect*) override; + GrTexture* onGenerateTexture(GrContext*, const SkIRect*) override; #endif private: @@ -88,8 +88,7 @@ SkImageGenerator* SkImageGenerator::NewFromPicture(const SkISize& size, const Sk #if SK_SUPPORT_GPU #include "GrTexture.h" -GrTexture* SkPictureImageGenerator::onGenerateTexture(GrContext* ctx, const GrTextureParams&, - const SkIRect* subset) { +GrTexture* SkPictureImageGenerator::onGenerateTexture(GrContext* ctx, const SkIRect* subset) { const SkImageInfo& info = this->getInfo(); SkImageInfo surfaceInfo = subset ? info.makeWH(subset->width(), subset->height()) : info; |