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 #ifndef GrAtlas_DEFINED | 9 #ifndef GrAtlas_DEFINED |
10 #define GrAtlas_DEFINED | 10 #define GrAtlas_DEFINED |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 return fPlots.contains(const_cast<GrPlot*>(plot)); | 86 return fPlots.contains(const_cast<GrPlot*>(plot)); |
87 } | 87 } |
88 #endif | 88 #endif |
89 | 89 |
90 private: | 90 private: |
91 SkTDArray<GrPlot*> fPlots; | 91 SkTDArray<GrPlot*> fPlots; |
92 | 92 |
93 friend class GrAtlas; | 93 friend class GrAtlas; |
94 }; | 94 }; |
95 | 95 |
96 GrAtlas(GrGpu*, GrPixelConfig, GrTextureFlags flags, | 96 GrAtlas(GrGpu*, GrPixelConfig, GrSurfaceFlags flags, |
97 const SkISize& backingTextureSize, | 97 const SkISize& backingTextureSize, |
98 int numPlotsX, int numPlotsY, bool batchUploads); | 98 int numPlotsX, int numPlotsY, bool batchUploads); |
99 ~GrAtlas(); | 99 ~GrAtlas(); |
100 | 100 |
101 // Adds a width x height subimage to the atlas. Upon success it returns | 101 // Adds a width x height subimage to the atlas. Upon success it returns |
102 // the containing GrPlot and absolute location in the backing texture. | 102 // the containing GrPlot and absolute location in the backing texture. |
103 // NULL is returned if the subimage cannot fit in the atlas. | 103 // NULL is returned if the subimage cannot fit in the atlas. |
104 // If provided, the image data will either be immediately uploaded or | 104 // If provided, the image data will either be immediately uploaded or |
105 // written to the CPU-side backing bitmap. | 105 // written to the CPU-side backing bitmap. |
106 GrPlot* addToAtlas(ClientPlotUsage*, int width, int height, const void* imag
e, SkIPoint16* loc); | 106 GrPlot* addToAtlas(ClientPlotUsage*, int width, int height, const void* imag
e, SkIPoint16* loc); |
(...skipping 21 matching lines...) Expand all Loading... |
128 return iter->init(fPlotList, kLRUFirst_IterOrder == order | 128 return iter->init(fPlotList, kLRUFirst_IterOrder == order |
129 ? GrPlotList::Iter::kTail
_IterStart | 129 ? GrPlotList::Iter::kTail
_IterStart |
130 : GrPlotList::Iter::kHead
_IterStart); | 130 : GrPlotList::Iter::kHead
_IterStart); |
131 } | 131 } |
132 | 132 |
133 private: | 133 private: |
134 void makeMRU(GrPlot* plot); | 134 void makeMRU(GrPlot* plot); |
135 | 135 |
136 GrGpu* fGpu; | 136 GrGpu* fGpu; |
137 GrPixelConfig fPixelConfig; | 137 GrPixelConfig fPixelConfig; |
138 GrTextureFlags fFlags; | 138 GrSurfaceFlags fFlags; |
139 GrTexture* fTexture; | 139 GrTexture* fTexture; |
140 SkISize fBackingTextureSize; | 140 SkISize fBackingTextureSize; |
141 int fNumPlotsX; | 141 int fNumPlotsX; |
142 int fNumPlotsY; | 142 int fNumPlotsY; |
143 bool fBatchUploads; | 143 bool fBatchUploads; |
144 | 144 |
145 // allocated array of GrPlots | 145 // allocated array of GrPlots |
146 GrPlot* fPlotArray; | 146 GrPlot* fPlotArray; |
147 // LRU list of GrPlots (MRU at head - LRU at tail) | 147 // LRU list of GrPlots (MRU at head - LRU at tail) |
148 GrPlotList fPlotList; | 148 GrPlotList fPlotList; |
149 }; | 149 }; |
150 | 150 |
151 #endif | 151 #endif |
OLD | NEW |