| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrBatchAtlas_DEFINED | 8 #ifndef GrBatchAtlas_DEFINED |
| 9 #define GrBatchAtlas_DEFINED | 9 #define GrBatchAtlas_DEFINED |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // A function pointer for use as a callback during eviction. Whenever GrBat
chAtlas evicts a | 39 // A function pointer for use as a callback during eviction. Whenever GrBat
chAtlas evicts a |
| 40 // specific AtlasID, it will call all of the registered listeners so they ca
n optionally process | 40 // specific AtlasID, it will call all of the registered listeners so they ca
n optionally process |
| 41 // the eviction | 41 // the eviction |
| 42 typedef void (*EvictionFunc)(GrBatchAtlas::AtlasID, void*); | 42 typedef void (*EvictionFunc)(GrBatchAtlas::AtlasID, void*); |
| 43 | 43 |
| 44 GrBatchAtlas(GrTexture*, int numPlotsX, int numPlotsY); | 44 GrBatchAtlas(GrTexture*, int numPlotsX, int numPlotsY); |
| 45 ~GrBatchAtlas(); | 45 ~GrBatchAtlas(); |
| 46 | 46 |
| 47 // Adds a width x height subimage to the atlas. Upon success it returns | 47 // Adds a width x height subimage to the atlas. Upon success it returns |
| 48 // the containing GrPlot and absolute location in the backing texture. | 48 // the containing GrPlot and absolute location in the backing texture. |
| 49 // NULL is returned if the subimage cannot fit in the atlas. | 49 // nullptr is returned if the subimage cannot fit in the atlas. |
| 50 // If provided, the image data will be written to the CPU-side backing bitma
p. | 50 // If provided, the image data will be written to the CPU-side backing bitma
p. |
| 51 // NOTE: If the client intends to refer to the atlas, they should immediatel
y call 'setUseToken' | 51 // NOTE: If the client intends to refer to the atlas, they should immediatel
y call 'setUseToken' |
| 52 // with the currentToken from the batch target, otherwise the next call to a
ddToAtlas might | 52 // with the currentToken from the batch target, otherwise the next call to a
ddToAtlas might |
| 53 // cause an eviction | 53 // cause an eviction |
| 54 bool addToAtlas(AtlasID*, GrDrawBatch::Target*, int width, int height, const
void* image, | 54 bool addToAtlas(AtlasID*, GrDrawBatch::Target*, int width, int height, const
void* image, |
| 55 SkIPoint16* loc); | 55 SkIPoint16* loc); |
| 56 | 56 |
| 57 GrTexture* getTexture() const { return fTexture; } | 57 GrTexture* getTexture() const { return fTexture; } |
| 58 | 58 |
| 59 uint64_t atlasGeneration() const { return fAtlasGeneration; } | 59 uint64_t atlasGeneration() const { return fAtlasGeneration; } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 SkTDArray<EvictionData> fEvictionCallbacks; | 151 SkTDArray<EvictionData> fEvictionCallbacks; |
| 152 // allocated array of GrBatchPlots | 152 // allocated array of GrBatchPlots |
| 153 SkAutoTUnref<BatchPlot>* fPlotArray; | 153 SkAutoTUnref<BatchPlot>* fPlotArray; |
| 154 // LRU list of GrPlots (MRU at head - LRU at tail) | 154 // LRU list of GrPlots (MRU at head - LRU at tail) |
| 155 GrBatchPlotList fPlotList; | 155 GrBatchPlotList fPlotList; |
| 156 }; | 156 }; |
| 157 | 157 |
| 158 #endif | 158 #endif |
| OLD | NEW |