| Index: src/image/SkImage_Gpu.cpp
|
| diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
|
| index 8e5ce4564c24afdfab2ebbc212a90748ef73632d..28ba9274fd81f9b76e468adf1661b350a1a1afe1 100644
|
| --- a/src/image/SkImage_Gpu.cpp
|
| +++ b/src/image/SkImage_Gpu.cpp
|
| @@ -14,7 +14,7 @@
|
| #include "effects/GrYUVtoRGBEffect.h"
|
| #include "SkCanvas.h"
|
| #include "SkGpuDevice.h"
|
| -#include "SkGr.h"
|
| +#include "SkGrPriv.h"
|
| #include "SkPixelRef.h"
|
|
|
| SkImage_Gpu::SkImage_Gpu(int w, int h, uint32_t uniqueID, SkAlphaType at, GrTexture* tex,
|
| @@ -68,7 +68,7 @@ bool SkImage_Gpu::getROPixels(SkBitmap* dst) const {
|
| }
|
|
|
| static void make_raw_texture_stretched_key(uint32_t imageID,
|
| - const GrTextureParamsAdjuster::CopyParams& params,
|
| + const GrTextureAdjuster::CopyParams& params,
|
| GrUniqueKey* stretchedKey) {
|
| static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
|
| GrUniqueKey::Builder builder(stretchedKey, kDomain, 4);
|
| @@ -78,36 +78,31 @@ static void make_raw_texture_stretched_key(uint32_t imageID,
|
| builder[3] = params.fHeight;
|
| }
|
|
|
| -class Texture_GrTextureParamsAdjuster : public GrTextureParamsAdjuster {
|
| +class GpuImage_GrTextureAdjuster : public GrTextureAdjuster {
|
| public:
|
| - Texture_GrTextureParamsAdjuster(const SkImage* image, GrTexture* unstretched)
|
| - : INHERITED(image->width(), image->height())
|
| + GpuImage_GrTextureAdjuster(const SkImage_Gpu* image)
|
| + : INHERITED(image->peekTexture())
|
| , fImage(image)
|
| - , fOriginal(unstretched)
|
| {}
|
|
|
| protected:
|
| - GrTexture* refOriginalTexture(GrContext* ctx) override {
|
| - return SkRef(fOriginal);
|
| + void makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) override {
|
| + GrUniqueKey baseKey;
|
| + GrMakeKeyFromImageID(&baseKey, fImage->uniqueID(),
|
| + SkIRect::MakeWH(fImage->width(), fImage->height()));
|
| + MakeCopyKeyFromOrigKey(baseKey, params, copyKey);
|
| }
|
|
|
| - void makeCopyKey(const CopyParams& copyParams, GrUniqueKey* copyKey) override {
|
| - make_raw_texture_stretched_key(fImage->uniqueID(), copyParams, copyKey);
|
| - }
|
| -
|
| - void didCacheCopy(const GrUniqueKey& copyKey) override {
|
| - as_IB(fImage)->notifyAddedToCache();
|
| - }
|
| + void didCacheCopy(const GrUniqueKey& copyKey) override { as_IB(fImage)->notifyAddedToCache(); }
|
|
|
| private:
|
| const SkImage* fImage;
|
| - GrTexture* fOriginal;
|
|
|
| - typedef GrTextureParamsAdjuster INHERITED;
|
| + typedef GrTextureAdjuster INHERITED;
|
| };
|
|
|
| GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, const GrTextureParams& params) const {
|
| - return Texture_GrTextureParamsAdjuster(this, fTexture).refTextureForParams(ctx, params);
|
| + return GpuImage_GrTextureAdjuster(this).refTextureSafeForParams(params, nullptr);
|
| }
|
|
|
| bool SkImage_Gpu::isOpaque() const {
|
|
|