aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-03-19 10:57:42 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-19 15:36:26 +0000
commit96b6d537c2466ec760af816cde1fd665d2011fab (patch)
tree504476d9c0e27a915563a56a841e0432668daafb /src/effects
parentf7466bd84acd28594b3f4df47d91211d9508a16e (diff)
Fix GrTextureStripAtlasManager cleanup order bug
Bug: 820703 Change-Id: I6f1a895ceb213d38361bc03a472cf2a48e4720a5 Reviewed-on: https://skia-review.googlesource.com/115001 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/effects')
-rw-r--r--src/effects/SkTableColorFilter.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index 3896acda59..dda50268fb 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -332,7 +332,7 @@ public:
const char* name() const override { return "ColorTable"; }
- const GrTextureStripAtlas* atlas() const { return fAtlas; }
+ const GrTextureStripAtlas* atlas() const { return fAtlas.get(); }
int atlasRow() const { return fRow; }
std::unique_ptr<GrFragmentProcessor> clone() const override;
@@ -344,12 +344,12 @@ private:
bool onIsEqual(const GrFragmentProcessor&) const override;
- ColorTableEffect(sk_sp<GrTextureProxy> proxy, GrTextureStripAtlas* atlas, int row);
+ ColorTableEffect(sk_sp<GrTextureProxy> proxy, sk_sp<GrTextureStripAtlas> atlas, int row);
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
TextureSampler fTextureSampler;
- GrTextureStripAtlas* fAtlas;
+ sk_sp<GrTextureStripAtlas> fAtlas;
int fRow;
typedef GrFragmentProcessor INHERITED;
@@ -452,7 +452,7 @@ std::unique_ptr<GrFragmentProcessor> ColorTableEffect::Make(GrContext* context,
auto atlasManager = context->contextPriv().textureStripAtlasManager();
- GrTextureStripAtlas* atlas = atlasManager->getAtlas(desc);
+ sk_sp<GrTextureStripAtlas> atlas = atlasManager->refAtlas(desc);
int row = atlas->lockRow(context, bitmap);
sk_sp<GrTextureProxy> proxy;
if (-1 == row) {
@@ -474,14 +474,16 @@ std::unique_ptr<GrFragmentProcessor> ColorTableEffect::Make(GrContext* context,
return nullptr;
}
- return std::unique_ptr<GrFragmentProcessor>(new ColorTableEffect(std::move(proxy), atlas, row));
+ return std::unique_ptr<GrFragmentProcessor>(new ColorTableEffect(std::move(proxy),
+ std::move(atlas), row));
}
-ColorTableEffect::ColorTableEffect(sk_sp<GrTextureProxy> proxy, GrTextureStripAtlas* atlas, int row)
+ColorTableEffect::ColorTableEffect(sk_sp<GrTextureProxy> proxy,
+ sk_sp<GrTextureStripAtlas> atlas, int row)
: INHERITED(kColorTableEffect_ClassID,
kNone_OptimizationFlags) // Not bothering with table-specific optimizations.
, fTextureSampler(std::move(proxy))
- , fAtlas(atlas)
+ , fAtlas(std::move(atlas))
, fRow(row) {
this->addTextureSampler(&fTextureSampler);
}