| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 fPlotList.addToHead(plot); | 209 fPlotList.addToHead(plot); |
| 210 }; | 210 }; |
| 211 | 211 |
| 212 GrPlot* GrAtlas::addToAtlas(ClientPlotUsage* usage, | 212 GrPlot* GrAtlas::addToAtlas(ClientPlotUsage* usage, |
| 213 int width, int height, const void* image, | 213 int width, int height, const void* image, |
| 214 SkIPoint16* loc) { | 214 SkIPoint16* loc) { |
| 215 // iterate through entire plot list for this atlas, see if we can find a hol
e | 215 // iterate through entire plot list for this atlas, see if we can find a hol
e |
| 216 // last one was most recently added and probably most empty | 216 // last one was most recently added and probably most empty |
| 217 for (int i = usage->fPlots.count()-1; i >= 0; --i) { | 217 for (int i = usage->fPlots.count()-1; i >= 0; --i) { |
| 218 GrPlot* plot = usage->fPlots[i]; | 218 GrPlot* plot = usage->fPlots[i]; |
| 219 if (plot->addSubImage(width, height, image, loc)) { | 219 // client may have plots from more than one atlas, must check for ours b
efore adding |
| 220 if (this == plot->fAtlas && plot->addSubImage(width, height, image, loc)
) { |
| 220 this->makeMRU(plot); | 221 this->makeMRU(plot); |
| 221 return plot; | 222 return plot; |
| 222 } | 223 } |
| 223 } | 224 } |
| 224 | 225 |
| 225 // before we get a new plot, make sure we have a backing texture | 226 // before we get a new plot, make sure we have a backing texture |
| 226 if (NULL == fTexture) { | 227 if (NULL == fTexture) { |
| 227 // TODO: Update this to use the cache rather than directly creating a te
xture. | 228 // TODO: Update this to use the cache rather than directly creating a te
xture. |
| 228 GrTextureDesc desc; | 229 GrTextureDesc desc; |
| 229 desc.fFlags = fFlags | kDynamicUpdate_GrTextureFlagBit; | 230 desc.fFlags = fFlags | kDynamicUpdate_GrTextureFlagBit; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 if (fBatchUploads) { | 285 if (fBatchUploads) { |
| 285 GrPlotList::Iter plotIter; | 286 GrPlotList::Iter plotIter; |
| 286 plotIter.init(fPlotList, GrPlotList::Iter::kHead_IterStart); | 287 plotIter.init(fPlotList, GrPlotList::Iter::kHead_IterStart); |
| 287 GrPlot* plot; | 288 GrPlot* plot; |
| 288 while ((plot = plotIter.get())) { | 289 while ((plot = plotIter.get())) { |
| 289 plot->uploadToTexture(); | 290 plot->uploadToTexture(); |
| 290 plotIter.next(); | 291 plotIter.next(); |
| 291 } | 292 } |
| 292 } | 293 } |
| 293 } | 294 } |
| OLD | NEW |