| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 bool addSubImage(int width, int height, const void*, GrIPoint16*); | 29 bool addSubImage(int width, int height, const void*, GrIPoint16*); |
| 30 | 30 |
| 31 static void FreeLList(GrAtlas* atlas) { | 31 static void FreeLList(GrAtlas* atlas) { |
| 32 while (NULL != atlas) { | 32 while (NULL != atlas) { |
| 33 GrAtlas* next = atlas->fNext; | 33 GrAtlas* next = atlas->fNext; |
| 34 delete atlas; | 34 delete atlas; |
| 35 atlas = next; | 35 atlas = next; |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 | 38 |
| 39 static void MarkAllUnused(GrAtlas* atlas) { | 39 static bool RemoveUnusedAtlases(GrAtlasMgr* atlasMgr, GrAtlas** startAtlas, |
| 40 while (NULL != atlas) { | 40 uint64_t flushCount); |
| 41 atlas->fUsed = false; | |
| 42 atlas = atlas->fNext; | |
| 43 } | |
| 44 } | |
| 45 | 41 |
| 46 static bool RemoveUnusedAtlases(GrAtlasMgr* atlasMgr, GrAtlas** startAtlas); | 42 uint64_t lastFlush() const { return fLastFlush; } |
| 47 | 43 void setLastFlush(uint64_t flush) { fLastFlush = flush; } |
| 48 bool used() const { return fUsed; } | |
| 49 void setUsed(bool used) { fUsed = used; } | |
| 50 | 44 |
| 51 private: | 45 private: |
| 52 GrAtlas(GrAtlasMgr*, int plotX, int plotY, GrMaskFormat format); | 46 GrAtlas(GrAtlasMgr*, int plotX, int plotY, GrMaskFormat format); |
| 53 ~GrAtlas(); // does not try to delete the fNext field | 47 ~GrAtlas(); // does not try to delete the fNext field |
| 54 | 48 |
| 49 // for recycling |
| 50 uint64_t fLastFlush; |
| 51 |
| 55 GrAtlas* fNext; | 52 GrAtlas* fNext; |
| 56 | 53 |
| 57 // for recycling | |
| 58 bool fUsed; | |
| 59 | |
| 60 GrTexture* fTexture; | 54 GrTexture* fTexture; |
| 61 GrRectanizer* fRects; | 55 GrRectanizer* fRects; |
| 62 GrAtlasMgr* fAtlasMgr; | 56 GrAtlasMgr* fAtlasMgr; |
| 63 GrIPoint16 fPlot; | 57 GrIPoint16 fPlot; |
| 64 GrMaskFormat fMaskFormat; | 58 GrMaskFormat fMaskFormat; |
| 65 | 59 |
| 66 friend class GrAtlasMgr; | 60 friend class GrAtlasMgr; |
| 67 }; | 61 }; |
| 68 | 62 |
| 69 class GrPlotMgr; | 63 class GrPlotMgr; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 85 // to be called by ~GrAtlas() | 79 // to be called by ~GrAtlas() |
| 86 void freePlot(GrMaskFormat format, int x, int y); | 80 void freePlot(GrMaskFormat format, int x, int y); |
| 87 | 81 |
| 88 private: | 82 private: |
| 89 GrGpu* fGpu; | 83 GrGpu* fGpu; |
| 90 GrTexture* fTexture[kCount_GrMaskFormats]; | 84 GrTexture* fTexture[kCount_GrMaskFormats]; |
| 91 GrPlotMgr* fPlotMgr; | 85 GrPlotMgr* fPlotMgr; |
| 92 }; | 86 }; |
| 93 | 87 |
| 94 #endif | 88 #endif |
| OLD | NEW |