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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 // before we get a new plot, make sure we have a backing texture | 219 // before we get a new plot, make sure we have a backing texture |
220 if (NULL == fTexture) { | 220 if (NULL == fTexture) { |
221 // TODO: Update this to use the cache rather than directly creating a te
xture. | 221 // TODO: Update this to use the cache rather than directly creating a te
xture. |
222 GrSurfaceDesc desc; | 222 GrSurfaceDesc desc; |
223 desc.fFlags = fFlags; | 223 desc.fFlags = fFlags; |
224 desc.fWidth = fBackingTextureSize.width(); | 224 desc.fWidth = fBackingTextureSize.width(); |
225 desc.fHeight = fBackingTextureSize.height(); | 225 desc.fHeight = fBackingTextureSize.height(); |
226 desc.fConfig = fPixelConfig; | 226 desc.fConfig = fPixelConfig; |
227 | 227 |
228 fTexture = fGpu->createTexture(desc, true, NULL, 0); | 228 fTexture = fGpu->createTexture(desc, true, NULL, 0); |
229 if (NULL == fTexture) { | |
230 return NULL; | |
231 } | |
232 } | 229 } |
233 | 230 |
234 // now look through all allocated plots for one we can share, in MRU order | 231 // now look through all allocated plots for one we can share, in MRU order |
235 GrPlotList::Iter plotIter; | 232 GrPlotList::Iter plotIter; |
236 plotIter.init(fPlotList, GrPlotList::Iter::kHead_IterStart); | 233 plotIter.init(fPlotList, GrPlotList::Iter::kHead_IterStart); |
237 GrPlot* plot; | 234 GrPlot* plot; |
238 while ((plot = plotIter.get())) { | 235 while ((plot = plotIter.get())) { |
239 // make sure texture is set for quick lookup | 236 // make sure texture is set for quick lookup |
240 plot->fTexture = fTexture; | 237 plot->fTexture = fTexture; |
241 if (plot->addSubImage(width, height, image, loc)) { | 238 if (plot->addSubImage(width, height, image, loc)) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 if (fBatchUploads) { | 275 if (fBatchUploads) { |
279 GrPlotList::Iter plotIter; | 276 GrPlotList::Iter plotIter; |
280 plotIter.init(fPlotList, GrPlotList::Iter::kHead_IterStart); | 277 plotIter.init(fPlotList, GrPlotList::Iter::kHead_IterStart); |
281 GrPlot* plot; | 278 GrPlot* plot; |
282 while ((plot = plotIter.get())) { | 279 while ((plot = plotIter.get())) { |
283 plot->uploadToTexture(); | 280 plot->uploadToTexture(); |
284 plotIter.next(); | 281 plotIter.next(); |
285 } | 282 } |
286 } | 283 } |
287 } | 284 } |
OLD | NEW |