Have multiple plotmgrs, one for each mask format.
Only flush/purge those strikes that match our format. R=bsalomon@google.com Review URL: https://codereview.chromium.org/24047005 git-svn-id: http://skia.googlecode.com/svn/trunk@11303 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
a2f4b15d4e
commit
bbe55fdf66
@ -165,14 +165,18 @@ GrAtlasMgr::GrAtlasMgr(GrGpu* gpu) {
|
||||
fGpu = gpu;
|
||||
gpu->ref();
|
||||
Gr_bzero(fTexture, sizeof(fTexture));
|
||||
fPlotMgr = SkNEW_ARGS(GrPlotMgr, (GR_PLOT_WIDTH, GR_PLOT_HEIGHT));
|
||||
for (int i = 0; i < kCount_GrMaskFormats; ++i) {
|
||||
fPlotMgr[i] = SkNEW_ARGS(GrPlotMgr, (GR_PLOT_WIDTH, GR_PLOT_HEIGHT));
|
||||
}
|
||||
}
|
||||
|
||||
GrAtlasMgr::~GrAtlasMgr() {
|
||||
for (size_t i = 0; i < GR_ARRAY_COUNT(fTexture); i++) {
|
||||
SkSafeUnref(fTexture[i]);
|
||||
}
|
||||
delete fPlotMgr;
|
||||
for (int i = 0; i < kCount_GrMaskFormats; ++i) {
|
||||
delete fPlotMgr[i];
|
||||
}
|
||||
|
||||
fGpu->unref();
|
||||
#if FONT_CACHE_STATS
|
||||
@ -213,7 +217,7 @@ GrAtlas* GrAtlasMgr::addToAtlas(GrAtlas** atlas,
|
||||
// atlas list is full. Either way we need to allocate a new atlas
|
||||
|
||||
GrIPoint16 plot;
|
||||
if (!fPlotMgr->newPlot(&plot)) {
|
||||
if (!fPlotMgr[format]->newPlot(&plot)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -247,6 +251,6 @@ GrAtlas* GrAtlasMgr::addToAtlas(GrAtlas** atlas,
|
||||
}
|
||||
|
||||
void GrAtlasMgr::freePlot(GrMaskFormat format, int x, int y) {
|
||||
SkASSERT(fPlotMgr->isBusy(x, y));
|
||||
fPlotMgr->freePlot(x, y);
|
||||
SkASSERT(fPlotMgr[format]->isBusy(x, y));
|
||||
fPlotMgr[format]->freePlot(x, y);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
private:
|
||||
GrGpu* fGpu;
|
||||
GrTexture* fTexture[kCount_GrMaskFormats];
|
||||
GrPlotMgr* fPlotMgr;
|
||||
GrPlotMgr* fPlotMgr[kCount_GrMaskFormats];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -69,10 +69,12 @@ void GrFontCache::freeAll() {
|
||||
}
|
||||
|
||||
void GrFontCache::purgeExceptFor(GrTextStrike* preserveStrike) {
|
||||
SkASSERT(NULL != preserveStrike);
|
||||
GrTextStrike* strike = fTail;
|
||||
bool purge = true;
|
||||
GrMaskFormat maskFormat = preserveStrike->fMaskFormat;
|
||||
while (strike) {
|
||||
if (strike == preserveStrike) {
|
||||
if (strike == preserveStrike || maskFormat != strike->fMaskFormat) {
|
||||
strike = strike->fPrev;
|
||||
continue;
|
||||
}
|
||||
@ -94,9 +96,11 @@ void GrFontCache::purgeExceptFor(GrTextStrike* preserveStrike) {
|
||||
}
|
||||
|
||||
void GrFontCache::freeAtlasExceptFor(GrTextStrike* preserveStrike) {
|
||||
SkASSERT(NULL != preserveStrike);
|
||||
GrTextStrike* strike = fTail;
|
||||
GrMaskFormat maskFormat = preserveStrike->fMaskFormat;
|
||||
while (strike) {
|
||||
if (strike == preserveStrike) {
|
||||
if (strike == preserveStrike || maskFormat != strike->fMaskFormat) {
|
||||
strike = strike->fPrev;
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user