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 #include "GrBatchAtlas.h" | 8 #include "GrBatchAtlas.h" |
9 #include "GrBatchTarget.h" | 9 #include "GrBatchTarget.h" |
10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 plot->setLastUploadToken(batchTarget->asapToken()); | 280 plot->setLastUploadToken(batchTarget->asapToken()); |
281 SkAutoTUnref<GrPlotUploader> uploader(SkNEW_ARGS(GrPlotUploader, (plot))
); | 281 SkAutoTUnref<GrPlotUploader> uploader(SkNEW_ARGS(GrPlotUploader, (plot))
); |
282 batchTarget->upload(uploader); | 282 batchTarget->upload(uploader); |
283 } | 283 } |
284 *id = plot->id(); | 284 *id = plot->id(); |
285 } | 285 } |
286 | 286 |
287 bool GrBatchAtlas::addToAtlas(AtlasID* id, GrBatchTarget* batchTarget, | 287 bool GrBatchAtlas::addToAtlas(AtlasID* id, GrBatchTarget* batchTarget, |
288 int width, int height, const void* image, SkIPoint
16* loc) { | 288 int width, int height, const void* image, SkIPoint
16* loc) { |
289 // We should already have a texture, TODO clean this up | 289 // We should already have a texture, TODO clean this up |
290 SkASSERT(fTexture && width < fPlotWidth && height < fPlotHeight); | 290 SkASSERT(fTexture && width <= fPlotWidth && height <= fPlotHeight); |
291 | 291 |
292 // now look through all allocated plots for one we can share, in Most Recent
ly Refed order | 292 // now look through all allocated plots for one we can share, in Most Recent
ly Refed order |
293 GrBatchPlotList::Iter plotIter; | 293 GrBatchPlotList::Iter plotIter; |
294 plotIter.init(fPlotList, GrBatchPlotList::Iter::kHead_IterStart); | 294 plotIter.init(fPlotList, GrBatchPlotList::Iter::kHead_IterStart); |
295 BatchPlot* plot; | 295 BatchPlot* plot; |
296 while ((plot = plotIter.get())) { | 296 while ((plot = plotIter.get())) { |
297 if (plot->addSubImage(width, height, image, loc, fBPP * width)) { | 297 if (plot->addSubImage(width, height, image, loc, fBPP * width)) { |
298 this->updatePlot(batchTarget, id, plot); | 298 this->updatePlot(batchTarget, id, plot); |
299 return true; | 299 return true; |
300 } | 300 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 } | 366 } |
367 | 367 |
368 void GrBatchAtlas::setLastUseTokenBulk(const BulkUseTokenUpdater& updater, Batch
Token batchToken) { | 368 void GrBatchAtlas::setLastUseTokenBulk(const BulkUseTokenUpdater& updater, Batch
Token batchToken) { |
369 int count = updater.fPlotsToUpdate.count(); | 369 int count = updater.fPlotsToUpdate.count(); |
370 for (int i = 0; i < count; i++) { | 370 for (int i = 0; i < count; i++) { |
371 BatchPlot* plot = fPlotArray[updater.fPlotsToUpdate[i]]; | 371 BatchPlot* plot = fPlotArray[updater.fPlotsToUpdate[i]]; |
372 this->makeMRU(plot); | 372 this->makeMRU(plot); |
373 plot->setLastUseToken(batchToken); | 373 plot->setLastUseToken(batchToken); |
374 } | 374 } |
375 } | 375 } |
OLD | NEW |