diff options
author | Robert Phillips <robertphillips@google.com> | 2017-02-22 15:28:38 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-02-23 15:01:42 +0000 |
commit | 30f9bc69cfc506075e1fce8e7934f941c0203023 (patch) | |
tree | f15f11bcb790206acaff8bfe6bb881eb254bec39 /src/effects/SkTableColorFilter.cpp | |
parent | bcfb8f639e516b673b6dbda41900efac69be2daf (diff) |
Switch GrTextureStripAtlas over to GrTextureProxies
This is split out of: https://skia-review.googlesource.com/c/8823/ (Remove GrFragmentProcessor-derived class' GrTexture-based ctors)
Change-Id: I9f602985b6010fc58b595e2be6d4e67e50179747
Reviewed-on: https://skia-review.googlesource.com/8881
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/effects/SkTableColorFilter.cpp')
-rw-r--r-- | src/effects/SkTableColorFilter.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp index 98016e081d..b63ed47ad9 100644 --- a/src/effects/SkTableColorFilter.cpp +++ b/src/effects/SkTableColorFilter.cpp @@ -375,7 +375,7 @@ public: const SkBitmap& bitmap, unsigned flags); - virtual ~ColorTableEffect(); + ~ColorTableEffect() override; const char* name() const override { return "ColorTable"; } @@ -389,7 +389,8 @@ private: bool onIsEqual(const GrFragmentProcessor&) const override; - ColorTableEffect(GrTexture* texture, GrTextureStripAtlas* atlas, int row, unsigned flags); + ColorTableEffect(GrContext* context, sk_sp<GrTextureProxy> proxy, + GrTextureStripAtlas* atlas, int row, unsigned flags); GR_DECLARE_FRAGMENT_PROCESSOR_TEST; @@ -494,29 +495,27 @@ sk_sp<GrFragmentProcessor> ColorTableEffect::Make(GrContext* context, const SkBi desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info(), *context->caps()); GrTextureStripAtlas* atlas = GrTextureStripAtlas::GetAtlas(desc); int row = atlas->lockRow(bitmap); - sk_sp<GrTexture> texture; + sk_sp<GrTextureProxy> proxy; if (-1 == row) { atlas = nullptr; - sk_sp<GrTextureProxy> proxy = GrMakeCachedBitmapProxy(context, bitmap); - if (proxy) { - texture.reset(proxy->instantiate(context->textureProvider())); - } + proxy = GrMakeCachedBitmapProxy(context, bitmap); } else { - texture.reset(SkRef(atlas->getTexture())); + proxy = atlas->asTextureProxyRef(); } - if (!texture) { + if (!proxy) { return nullptr; } - return sk_sp<GrFragmentProcessor>(new ColorTableEffect(texture.get(), atlas, row, flags)); + return sk_sp<GrFragmentProcessor>(new ColorTableEffect(context, std::move(proxy), + atlas, row, flags)); } -ColorTableEffect::ColorTableEffect(GrTexture* texture, GrTextureStripAtlas* atlas, int row, - unsigned flags) +ColorTableEffect::ColorTableEffect(GrContext* context, sk_sp<GrTextureProxy> proxy, + GrTextureStripAtlas* atlas, int row, unsigned flags) : INHERITED(kNone_OptimizationFlags) // Not bothering with table-specific optimizations. - , fTextureSampler(texture) + , fTextureSampler(context->textureProvider(), std::move(proxy)) , fAtlas(atlas) , fRow(row) { this->initClassID<ColorTableEffect>(); |