Change Atlas recycling to track current flush count and recycle if Atlas not used in current flush.
BUG=
R=bsalomon@google.com, robertphillips@google.com
Author: jvanverth@google.com
Review URL: https://chromiumcodereview.appspot.com/23120004
git-svn-id: http://skia.googlecode.com/svn/trunk@10777 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrAtlas.cpp b/src/gpu/GrAtlas.cpp
index f2daca1..5207061 100644
--- a/src/gpu/GrAtlas.cpp
+++ b/src/gpu/GrAtlas.cpp
@@ -50,10 +50,10 @@
static int g_UploadCount = 0;
#endif
-GrAtlas::GrAtlas(GrAtlasMgr* mgr, int plotX, int plotY, GrMaskFormat format) {
+GrAtlas::GrAtlas(GrAtlasMgr* mgr, int plotX, int plotY, GrMaskFormat format) :
+ fDrawToken(NULL, 0) {
fAtlasMgr = mgr; // just a pointer, not an owner
fNext = NULL;
- fUsed = false;
fTexture = mgr->getTexture(format); // we're not an owner, just a pointer
fPlot.set(plotX, plotY);
@@ -87,7 +87,7 @@
GrAtlas* atlas = *startAtlas;
bool removed = false;
while (NULL != atlas) {
- if (!atlas->used()) {
+ if (atlas->drawToken().isIssued()) {
*atlasRef = atlas->fNext;
atlasMgr->deleteAtlas(atlas);
atlas = *atlasRef;
@@ -189,7 +189,7 @@
case kA888_GrMaskFormat:
return kSkia8888_GrPixelConfig;
default:
- GrAssert(!"unknown maskformat");
+ SkASSERT(!"unknown maskformat");
}
return kUnknown_GrPixelConfig;
}
@@ -217,8 +217,8 @@
return NULL;
}
- GrAssert(0 == kA8_GrMaskFormat);
- GrAssert(1 == kA565_GrMaskFormat);
+ SkASSERT(0 == kA8_GrMaskFormat);
+ SkASSERT(1 == kA565_GrMaskFormat);
if (NULL == fTexture[format]) {
// TODO: Update this to use the cache rather than directly creating a texture.
GrTextureDesc desc;
@@ -247,6 +247,6 @@
}
void GrAtlasMgr::freePlot(GrMaskFormat format, int x, int y) {
- GrAssert(fPlotMgr->isBusy(x, y));
+ SkASSERT(fPlotMgr->isBusy(x, y));
fPlotMgr->freePlot(x, y);
}