aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrBatchAtlas.h
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2016-11-08 14:13:39 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-08 19:48:16 +0000
commit594f9ed9c9cf0fcbbc2fa111b09d376014314315 (patch)
treee41486dee3f05d94cc3e64a04e2ac641f9e36b8b /src/gpu/GrBatchAtlas.h
parent08c896378ee2090f27d6ea782839701679dc68df (diff)
Smart pointers for GrBatchAtlas.
While navigating this code the ownership rules were found to not be entirely clear. This updates GrBatchAtlas:: fPlotArray and fTexture to be smart pointers and propagates some clarifying changes. Change-Id: I6ca67247575c2d7c4e7986c10b948201fe0080f1 Reviewed-on: https://skia-review.googlesource.com/4549 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'src/gpu/GrBatchAtlas.h')
-rw-r--r--src/gpu/GrBatchAtlas.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/gpu/GrBatchAtlas.h b/src/gpu/GrBatchAtlas.h
index d8856e8ef1..7cf15bd336 100644
--- a/src/gpu/GrBatchAtlas.h
+++ b/src/gpu/GrBatchAtlas.h
@@ -41,8 +41,7 @@ public:
// the eviction
typedef void (*EvictionFunc)(GrBatchAtlas::AtlasID, void*);
- GrBatchAtlas(GrTexture*, int numPlotsX, int numPlotsY);
- ~GrBatchAtlas();
+ GrBatchAtlas(sk_sp<GrTexture>, int numPlotsX, int numPlotsY);
// Adds a width x height subimage to the atlas. Upon success it returns
// the containing GrPlot and absolute location in the backing texture.
@@ -54,7 +53,7 @@ public:
bool addToAtlas(AtlasID*, GrDrawBatch::Target*, int width, int height, const void* image,
SkIPoint16* loc);
- GrTexture* getTexture() const { return fTexture; }
+ GrTexture* getTexture() const { return fTexture.get(); }
uint64_t atlasGeneration() const { return fAtlasGeneration; }
@@ -240,9 +239,9 @@ private:
inline void processEviction(AtlasID);
- GrTexture* fTexture;
- int fPlotWidth;
- int fPlotHeight;
+ sk_sp<GrTexture> fTexture;
+ int fPlotWidth;
+ int fPlotHeight;
SkDEBUGCODE(uint32_t fNumPlots;)
uint64_t fAtlasGeneration;
@@ -254,7 +253,7 @@ private:
SkTDArray<EvictionData> fEvictionCallbacks;
// allocated array of GrBatchPlots
- sk_sp<BatchPlot>* fPlotArray;
+ std::unique_ptr<sk_sp<BatchPlot>[]> fPlotArray;
// LRU list of GrPlots (MRU at head - LRU at tail)
GrBatchPlotList fPlotList;
};