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 "GrBatchFlushState.h" | 9 #include "GrBatchFlushState.h" |
10 #include "GrRectanizer.h" | 10 #include "GrRectanizer.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 this->processEviction(plot->id()); | 324 this->processEviction(plot->id()); |
325 fPlotList.remove(plot); | 325 fPlotList.remove(plot); |
326 SkAutoTUnref<BatchPlot>& newPlot = fPlotArray[plot->index()]; | 326 SkAutoTUnref<BatchPlot>& newPlot = fPlotArray[plot->index()]; |
327 newPlot.reset(plot->clone()); | 327 newPlot.reset(plot->clone()); |
328 | 328 |
329 fPlotList.addToHead(newPlot.get()); | 329 fPlotList.addToHead(newPlot.get()); |
330 SkASSERT(GrBytesPerPixel(fTexture->desc().fConfig) == newPlot->bpp()); | 330 SkASSERT(GrBytesPerPixel(fTexture->desc().fConfig) == newPlot->bpp()); |
331 SkDEBUGCODE(bool verify = )newPlot->addSubImage(width, height, image, loc); | 331 SkDEBUGCODE(bool verify = )newPlot->addSubImage(width, height, image, loc); |
332 SkASSERT(verify); | 332 SkASSERT(verify); |
333 | 333 |
| 334 // Note that this plot will be uploaded inline with the draws whereas the |
| 335 // one it displaced most likely was uploaded asap. |
334 newPlot->setLastUploadToken(batchTarget->currentToken()); | 336 newPlot->setLastUploadToken(batchTarget->currentToken()); |
335 SkAutoTUnref<GrPlotUploader> uploader(new GrPlotUploader(newPlot, fTexture))
; | 337 SkAutoTUnref<GrPlotUploader> uploader(new GrPlotUploader(newPlot, fTexture))
; |
336 batchTarget->upload(uploader); | 338 batchTarget->upload(uploader); |
337 *id = newPlot->id(); | 339 *id = newPlot->id(); |
338 | 340 |
339 fAtlasGeneration++; | 341 fAtlasGeneration++; |
340 return true; | 342 return true; |
341 } | 343 } |
342 | 344 |
343 bool GrBatchAtlas::hasID(AtlasID id) { | 345 bool GrBatchAtlas::hasID(AtlasID id) { |
(...skipping 12 matching lines...) Expand all Loading... |
356 | 358 |
357 void GrBatchAtlas::setLastUseTokenBulk(const BulkUseTokenUpdater& updater, | 359 void GrBatchAtlas::setLastUseTokenBulk(const BulkUseTokenUpdater& updater, |
358 GrBatchToken batchToken) { | 360 GrBatchToken batchToken) { |
359 int count = updater.fPlotsToUpdate.count(); | 361 int count = updater.fPlotsToUpdate.count(); |
360 for (int i = 0; i < count; i++) { | 362 for (int i = 0; i < count; i++) { |
361 BatchPlot* plot = fPlotArray[updater.fPlotsToUpdate[i]]; | 363 BatchPlot* plot = fPlotArray[updater.fPlotsToUpdate[i]]; |
362 this->makeMRU(plot); | 364 this->makeMRU(plot); |
363 plot->setLastUseToken(batchToken); | 365 plot->setLastUseToken(batchToken); |
364 } | 366 } |
365 } | 367 } |
OLD | NEW |