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 int index() const { return fIndex; } | 43 int index() const { return fIndex; } |
44 int genID() const { return fGenID; } | 44 int genID() const { return fGenID; } |
45 GrBatchAtlas::AtlasID id() { | 45 GrBatchAtlas::AtlasID id() { return fID; } |
46 SkASSERT(GrBatchAtlas::kInvalidAtlasID != fID); | |
47 return fID; | |
48 } | |
49 | 46 |
50 GrTexture* texture() const { return fTexture; } | 47 GrTexture* texture() const { return fTexture; } |
51 | 48 |
52 bool addSubImage(int width, int height, const void* image, SkIPoint16* loc,
size_t rowBytes) { | 49 bool addSubImage(int width, int height, const void* image, SkIPoint16* loc,
size_t rowBytes) { |
53 if (!fRects->addRect(width, height, loc)) { | 50 if (!fRects->addRect(width, height, loc)) { |
54 return false; | 51 return false; |
55 } | 52 } |
56 | 53 |
57 if (!fData) { | 54 if (!fData) { |
58 fData = reinterpret_cast<unsigned char*>(sk_calloc_throw(fBytesPerPi
xel * fWidth * | 55 fData = reinterpret_cast<unsigned char*>(sk_calloc_throw(fBytesPerPi
xel * fWidth * |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 } | 366 } |
370 | 367 |
371 void GrBatchAtlas::setLastUseTokenBulk(const BulkUseTokenUpdater& updater, Batch
Token batchToken) { | 368 void GrBatchAtlas::setLastUseTokenBulk(const BulkUseTokenUpdater& updater, Batch
Token batchToken) { |
372 int count = updater.fPlotsToUpdate.count(); | 369 int count = updater.fPlotsToUpdate.count(); |
373 for (int i = 0; i < count; i++) { | 370 for (int i = 0; i < count; i++) { |
374 BatchPlot* plot = fPlotArray[updater.fPlotsToUpdate[i]]; | 371 BatchPlot* plot = fPlotArray[updater.fPlotsToUpdate[i]]; |
375 this->makeMRU(plot); | 372 this->makeMRU(plot); |
376 plot->setLastUseToken(batchToken); | 373 plot->setLastUseToken(batchToken); |
377 } | 374 } |
378 } | 375 } |
OLD | NEW |