| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 uint32_t x() const { return fX; } | 124 uint32_t x() const { return fX; } |
| 125 uint32_t y() const { return fY; } | 125 uint32_t y() const { return fY; } |
| 126 | 126 |
| 127 private: | 127 private: |
| 128 BatchPlot() | 128 BatchPlot() |
| 129 : fLastUpload(0) | 129 : fLastUpload(0) |
| 130 , fLastUse(0) | 130 , fLastUse(0) |
| 131 , fIndex(-1) | 131 , fIndex(-1) |
| 132 , fGenID(-1) | 132 , fGenID(-1) |
| 133 , fID(0) | 133 , fID(0) |
| 134 , fData(NULL) | 134 , fData(nullptr) |
| 135 , fWidth(0) | 135 , fWidth(0) |
| 136 , fHeight(0) | 136 , fHeight(0) |
| 137 , fX(0) | 137 , fX(0) |
| 138 , fY(0) | 138 , fY(0) |
| 139 , fTexture(NULL) | 139 , fTexture(nullptr) |
| 140 , fRects(NULL) | 140 , fRects(nullptr) |
| 141 , fAtlas(NULL) | 141 , fAtlas(nullptr) |
| 142 , fBytesPerPixel(1) | 142 , fBytesPerPixel(1) |
| 143 #ifdef SK_DEBUG | 143 #ifdef SK_DEBUG |
| 144 , fDirty(false) | 144 , fDirty(false) |
| 145 #endif | 145 #endif |
| 146 { | 146 { |
| 147 fOffset.set(0, 0); | 147 fOffset.set(0, 0); |
| 148 } | 148 } |
| 149 | 149 |
| 150 ~BatchPlot() { | 150 ~BatchPlot() { |
| 151 sk_free(fData); | 151 sk_free(fData); |
| 152 fData = NULL; | 152 fData = nullptr; |
| 153 delete fRects; | 153 delete fRects; |
| 154 } | 154 } |
| 155 | 155 |
| 156 void init(GrBatchAtlas* atlas, GrTexture* texture, int index, uint64_t gener
ation, | 156 void init(GrBatchAtlas* atlas, GrTexture* texture, int index, uint64_t gener
ation, |
| 157 int offX, int offY, int width, int height, size_t bpp) { | 157 int offX, int offY, int width, int height, size_t bpp) { |
| 158 fIndex = index; | 158 fIndex = index; |
| 159 fGenID = generation; | 159 fGenID = generation; |
| 160 fID = create_id(index, generation); | 160 fID = create_id(index, generation); |
| 161 fWidth = width; | 161 fWidth = width; |
| 162 fHeight = height; | 162 fHeight = height; |
| 163 fX = offX; | 163 fX = offX; |
| 164 fY = offY; | 164 fY = offY; |
| 165 fRects = GrRectanizer::Factory(width, height); | 165 fRects = GrRectanizer::Factory(width, height); |
| 166 fAtlas = atlas; | 166 fAtlas = atlas; |
| 167 fOffset.set(offX * width, offY * height); | 167 fOffset.set(offX * width, offY * height); |
| 168 fBytesPerPixel = bpp; | 168 fBytesPerPixel = bpp; |
| 169 fData = NULL; | 169 fData = nullptr; |
| 170 fDirtyRect.setEmpty(); | 170 fDirtyRect.setEmpty(); |
| 171 SkDEBUGCODE(fDirty = false;) | 171 SkDEBUGCODE(fDirty = false;) |
| 172 fTexture = texture; | 172 fTexture = texture; |
| 173 } | 173 } |
| 174 | 174 |
| 175 GrBatchToken fLastUpload; | 175 GrBatchToken fLastUpload; |
| 176 GrBatchToken fLastUse; | 176 GrBatchToken fLastUse; |
| 177 | 177 |
| 178 uint32_t fIndex; | 178 uint32_t fIndex; |
| 179 uint64_t fGenID; | 179 uint64_t fGenID; |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 369 |
| 370 void GrBatchAtlas::setLastUseTokenBulk(const BulkUseTokenUpdater& updater, | 370 void GrBatchAtlas::setLastUseTokenBulk(const BulkUseTokenUpdater& updater, |
| 371 GrBatchToken batchToken) { | 371 GrBatchToken batchToken) { |
| 372 int count = updater.fPlotsToUpdate.count(); | 372 int count = updater.fPlotsToUpdate.count(); |
| 373 for (int i = 0; i < count; i++) { | 373 for (int i = 0; i < count; i++) { |
| 374 BatchPlot* plot = fPlotArray[updater.fPlotsToUpdate[i]]; | 374 BatchPlot* plot = fPlotArray[updater.fPlotsToUpdate[i]]; |
| 375 this->makeMRU(plot); | 375 this->makeMRU(plot); |
| 376 plot->setLastUseToken(batchToken); | 376 plot->setLastUseToken(batchToken); |
| 377 } | 377 } |
| 378 } | 378 } |
| OLD | NEW |