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 #include "GrAtlas.h" | 9 #include "GrAtlas.h" |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 int textureWidth = fBackingTextureSize.width(); | 157 int textureWidth = fBackingTextureSize.width(); |
158 int textureHeight = fBackingTextureSize.height(); | 158 int textureHeight = fBackingTextureSize.height(); |
159 | 159 |
160 int plotWidth = textureWidth / fNumPlotsX; | 160 int plotWidth = textureWidth / fNumPlotsX; |
161 int plotHeight = textureHeight / fNumPlotsY; | 161 int plotHeight = textureHeight / fNumPlotsY; |
162 | 162 |
163 SkASSERT(plotWidth * fNumPlotsX == textureWidth); | 163 SkASSERT(plotWidth * fNumPlotsX == textureWidth); |
164 SkASSERT(plotHeight * fNumPlotsY == textureHeight); | 164 SkASSERT(plotHeight * fNumPlotsY == textureHeight); |
165 | 165 |
| 166 // We currently do not support compressed atlases... |
| 167 SkASSERT(!GrPixelConfigIsCompressed(config)); |
| 168 |
166 // set up allocated plots | 169 // set up allocated plots |
167 size_t bpp = GrBytesPerPixel(fPixelConfig); | 170 size_t bpp = GrBytesPerPixel(fPixelConfig); |
168 fPlotArray = SkNEW_ARRAY(GrPlot, (fNumPlotsX*fNumPlotsY)); | 171 fPlotArray = SkNEW_ARRAY(GrPlot, (fNumPlotsX*fNumPlotsY)); |
169 | 172 |
170 GrPlot* currPlot = fPlotArray; | 173 GrPlot* currPlot = fPlotArray; |
171 for (int y = numPlotsY-1; y >= 0; --y) { | 174 for (int y = numPlotsY-1; y >= 0; --y) { |
172 for (int x = numPlotsX-1; x >= 0; --x) { | 175 for (int x = numPlotsX-1; x >= 0; --x) { |
173 currPlot->init(this, x, y, plotWidth, plotHeight, bpp, batchUploads)
; | 176 currPlot->init(this, x, y, plotWidth, plotHeight, bpp, batchUploads)
; |
174 | 177 |
175 // build LRU list | 178 // build LRU list |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 if (fBatchUploads) { | 281 if (fBatchUploads) { |
279 GrPlotList::Iter plotIter; | 282 GrPlotList::Iter plotIter; |
280 plotIter.init(fPlotList, GrPlotList::Iter::kHead_IterStart); | 283 plotIter.init(fPlotList, GrPlotList::Iter::kHead_IterStart); |
281 GrPlot* plot; | 284 GrPlot* plot; |
282 while (NULL != (plot = plotIter.get())) { | 285 while (NULL != (plot = plotIter.get())) { |
283 plot->uploadToTexture(); | 286 plot->uploadToTexture(); |
284 plotIter.next(); | 287 plotIter.next(); |
285 } | 288 } |
286 } | 289 } |
287 } | 290 } |
OLD | NEW |