aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrLayerAtlas.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2015-11-06 05:59:14 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-11-06 05:59:14 -0800
commitcf1d19805a289c612532cf2d4505bb348b78ba77 (patch)
treea54ed4ffad1796d1ea2debe463f9cd2aa614d372 /src/gpu/GrLayerAtlas.cpp
parent42597bc99f00553825843b5ed41e81b121773368 (diff)
Revert of Update Layer Hoisting to store its atlas texture in the resource cache (patchset #6 id:100001 of https://codereview.chromium.org/1406013006/ )
Reason for revert: Android Original issue's description: > Update Layer Hoisting to store its atlas texture in the resource cache > > BUG=skia:4346 > > Committed: https://skia.googlesource.com/skia/+/42597bc99f00553825843b5ed41e81b121773368 TBR=bsalomon@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:4346 Review URL: https://codereview.chromium.org/1413483004
Diffstat (limited to 'src/gpu/GrLayerAtlas.cpp')
-rw-r--r--src/gpu/GrLayerAtlas.cpp45
1 files changed, 10 insertions, 35 deletions
diff --git a/src/gpu/GrLayerAtlas.cpp b/src/gpu/GrLayerAtlas.cpp
index 9beb509f86..3b30607c8c 100644
--- a/src/gpu/GrLayerAtlas.cpp
+++ b/src/gpu/GrLayerAtlas.cpp
@@ -6,7 +6,6 @@
* found in the LICENSE file.
*/
-#include "GrGpuResourcePriv.h"
#include "GrLayerAtlas.h"
#include "GrRectanizer.h"
#include "GrTextureProvider.h"
@@ -44,32 +43,6 @@ void GrLayerAtlas::Plot::reset() {
}
///////////////////////////////////////////////////////////////////////////////
-GR_DECLARE_STATIC_UNIQUE_KEY(gLayerAtlasKey);
-static const GrUniqueKey& get_layer_atlas_key() {
- GR_DEFINE_STATIC_UNIQUE_KEY(gLayerAtlasKey);
- return gLayerAtlasKey;
-}
-
-bool GrLayerAtlas::reattachBackingTexture() {
- SkASSERT(!fTexture);
-
- fTexture.reset(fTexProvider->findAndRefTextureByUniqueKey(get_layer_atlas_key()));
- return SkToBool(fTexture);
-}
-
-void GrLayerAtlas::createBackingTexture() {
- SkASSERT(!fTexture);
-
- GrSurfaceDesc desc;
- desc.fFlags = fFlags;
- desc.fWidth = fBackingTextureSize.width();
- desc.fHeight = fBackingTextureSize.height();
- desc.fConfig = fPixelConfig;
-
- fTexture.reset(fTexProvider->createTexture(desc, true, nullptr, 0));
-
- fTexture->resourcePriv().setUniqueKey(get_layer_atlas_key());
-}
GrLayerAtlas::GrLayerAtlas(GrTextureProvider* texProvider, GrPixelConfig config,
GrSurfaceFlags flags,
@@ -79,6 +52,7 @@ GrLayerAtlas::GrLayerAtlas(GrTextureProvider* texProvider, GrPixelConfig config,
fPixelConfig = config;
fFlags = flags;
fBackingTextureSize = backingTextureSize;
+ fTexture = nullptr;
int textureWidth = fBackingTextureSize.width();
int textureHeight = fBackingTextureSize.height();
@@ -107,14 +81,8 @@ GrLayerAtlas::GrLayerAtlas(GrTextureProvider* texProvider, GrPixelConfig config,
}
}
-void GrLayerAtlas::resetPlots() {
- PlotIter iter;
- for (Plot* plot = iter.init(fPlotList, PlotIter::kHead_IterStart); plot; plot = iter.next()) {
- plot->reset();
- }
-}
-
GrLayerAtlas::~GrLayerAtlas() {
+ SkSafeUnref(fTexture);
delete[] fPlotArray;
}
@@ -143,7 +111,14 @@ GrLayerAtlas::Plot* GrLayerAtlas::addToAtlas(ClientPlotUsage* usage,
// before we get a new plot, make sure we have a backing texture
if (nullptr == fTexture) {
- this->createBackingTexture();
+ // TODO: Update this to use the cache rather than directly creating a texture.
+ GrSurfaceDesc desc;
+ desc.fFlags = fFlags;
+ desc.fWidth = fBackingTextureSize.width();
+ desc.fHeight = fBackingTextureSize.height();
+ desc.fConfig = fPixelConfig;
+
+ fTexture = fTexProvider->createTexture(desc, true, nullptr, 0);
if (nullptr == fTexture) {
return nullptr;
}