| 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 |
| 11 #include "GrTexture.h" | 11 #include "GrTexture.h" |
| 12 #include "batches/GrDrawBatch.h" | 12 #include "batches/GrDrawBatch.h" |
| 13 #include "SkPoint.h" | 13 #include "SkPoint.h" |
| 14 #include "SkTDArray.h" | 14 #include "SkTDArray.h" |
| 15 #include "SkTInternalLList.h" | 15 #include "SkTInternalLList.h" |
| 16 | 16 |
| 17 class BatchPlot; | 17 class BatchPlot; |
| 18 class GrRectanizer; | 18 class GrRectanizer; |
| 19 | 19 |
| 20 typedef SkTInternalLList<BatchPlot> GrBatchPlotList; | 20 typedef SkTInternalLList<BatchPlot> GrBatchPlotList; |
| 21 | 21 |
| 22 struct GrBatchAtlasConfig { |
| 23 int numPlotsX() const { return fWidth / fPlotWidth; } |
| 24 int numPlotsY() const { return fHeight / fPlotWidth; } |
| 25 int fWidth; |
| 26 int fHeight; |
| 27 int fPlotWidth; |
| 28 int fPlotHeight; |
| 29 }; |
| 30 |
| 22 class GrBatchAtlas { | 31 class GrBatchAtlas { |
| 23 public: | 32 public: |
| 24 // An AtlasID is an opaque handle which callers can use to determine if the
atlas contains | 33 // An AtlasID is an opaque handle which callers can use to determine if the
atlas contains |
| 25 // a specific piece of data | 34 // a specific piece of data |
| 26 typedef uint64_t AtlasID; | 35 typedef uint64_t AtlasID; |
| 27 static const uint32_t kInvalidAtlasID = 0; | 36 static const uint32_t kInvalidAtlasID = 0; |
| 28 static const uint64_t kInvalidAtlasGeneration = 0; | 37 static const uint64_t kInvalidAtlasGeneration = 0; |
| 29 | 38 |
| 30 // 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 |
| 31 // 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 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 }; | 149 }; |
| 141 | 150 |
| 142 SkTDArray<EvictionData> fEvictionCallbacks; | 151 SkTDArray<EvictionData> fEvictionCallbacks; |
| 143 // allocated array of GrBatchPlots | 152 // allocated array of GrBatchPlots |
| 144 SkAutoTUnref<BatchPlot>* fPlotArray; | 153 SkAutoTUnref<BatchPlot>* fPlotArray; |
| 145 // LRU list of GrPlots (MRU at head - LRU at tail) | 154 // LRU list of GrPlots (MRU at head - LRU at tail) |
| 146 GrBatchPlotList fPlotList; | 155 GrBatchPlotList fPlotList; |
| 147 }; | 156 }; |
| 148 | 157 |
| 149 #endif | 158 #endif |
| OLD | NEW |