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 24 matching lines...) Expand all Loading... |
35 typedef GrBatchAtlas::BatchToken BatchToken; | 35 typedef GrBatchAtlas::BatchToken BatchToken; |
36 | 36 |
37 SK_DECLARE_INTERNAL_LLIST_INTERFACE(BatchPlot); | 37 SK_DECLARE_INTERNAL_LLIST_INTERFACE(BatchPlot); |
38 | 38 |
39 // index() refers to the index of the plot in the owning GrAtlas's plot arra
y. genID() is a | 39 // index() refers to the index of the plot in the owning GrAtlas's plot arra
y. genID() is a |
40 // monotonically incrementing number which is bumped every time the cpu back
ing store is | 40 // monotonically incrementing number which is bumped every time the cpu back
ing store is |
41 // wiped, or when the plot itself is evicted from the atlas(ie, there is con
tinuity in genID() | 41 // wiped, or when the plot itself is evicted from the atlas(ie, there is con
tinuity in genID() |
42 // across atlas spills) | 42 // across atlas spills) |
43 uint32_t index() const { return fIndex; } | 43 uint32_t index() const { return fIndex; } |
44 uint64_t genID() const { return fGenID; } | 44 uint64_t genID() const { return fGenID; } |
45 GrBatchAtlas::AtlasID id() { return fID; } | 45 GrBatchAtlas::AtlasID id() { |
| 46 SkASSERT(GrBatchAtlas::kInvalidAtlasID != fID); |
| 47 return fID; |
| 48 } |
46 | 49 |
47 GrTexture* texture() const { return fTexture; } | 50 GrTexture* texture() const { return fTexture; } |
48 | 51 |
49 bool addSubImage(int width, int height, const void* image, SkIPoint16* loc,
size_t rowBytes) { | 52 bool addSubImage(int width, int height, const void* image, SkIPoint16* loc,
size_t rowBytes) { |
50 if (!fRects->addRect(width, height, loc)) { | 53 if (!fRects->addRect(width, height, loc)) { |
51 return false; | 54 return false; |
52 } | 55 } |
53 | 56 |
54 if (!fData) { | 57 if (!fData) { |
55 fData = reinterpret_cast<unsigned char*>(sk_calloc_throw(fBytesPerPi
xel * fWidth * | 58 fData = reinterpret_cast<unsigned char*>(sk_calloc_throw(fBytesPerPi
xel * fWidth * |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 } | 371 } |
369 | 372 |
370 void GrBatchAtlas::setLastUseTokenBulk(const BulkUseTokenUpdater& updater, Batch
Token batchToken) { | 373 void GrBatchAtlas::setLastUseTokenBulk(const BulkUseTokenUpdater& updater, Batch
Token batchToken) { |
371 int count = updater.fPlotsToUpdate.count(); | 374 int count = updater.fPlotsToUpdate.count(); |
372 for (int i = 0; i < count; i++) { | 375 for (int i = 0; i < count; i++) { |
373 BatchPlot* plot = fPlotArray[updater.fPlotsToUpdate[i]]; | 376 BatchPlot* plot = fPlotArray[updater.fPlotsToUpdate[i]]; |
374 this->makeMRU(plot); | 377 this->makeMRU(plot); |
375 plot->setLastUseToken(batchToken); | 378 plot->setLastUseToken(batchToken); |
376 } | 379 } |
377 } | 380 } |
OLD | NEW |