OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 "GrDrawTarget.h" | 8 #include "GrDrawTarget.h" |
9 | 9 |
10 #include "GrAppliedClip.h" | 10 #include "GrAppliedClip.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 if (fRecordedBatches[i].fBatch) { | 214 if (fRecordedBatches[i].fBatch) { |
215 fRecordedBatches[i].fBatch->prepare(flushState); | 215 fRecordedBatches[i].fBatch->prepare(flushState); |
216 } | 216 } |
217 } | 217 } |
218 | 218 |
219 if (fInstancedRendering) { | 219 if (fInstancedRendering) { |
220 fInstancedRendering->beginFlush(flushState->resourceProvider()); | 220 fInstancedRendering->beginFlush(flushState->resourceProvider()); |
221 } | 221 } |
222 } | 222 } |
223 | 223 |
224 void GrDrawTarget::drawBatches(GrBatchFlushState* flushState) { | 224 bool GrDrawTarget::drawBatches(GrBatchFlushState* flushState) { |
225 if (0 == fRecordedBatches.count()) { | 225 if (0 == fRecordedBatches.count()) { |
226 return; | 226 return false; |
227 } | 227 } |
228 // Draw all the generated geometry. | 228 // Draw all the generated geometry. |
229 SkRandom random; | 229 SkRandom random; |
230 GrRenderTarget* currentRT = nullptr; | 230 GrRenderTarget* currentRT = nullptr; |
231 SkAutoTDelete<GrGpuCommandBuffer> commandBuffer; | 231 SkAutoTDelete<GrGpuCommandBuffer> commandBuffer; |
232 SkRect bounds = SkRect::MakeEmpty(); | 232 SkRect bounds = SkRect::MakeEmpty(); |
233 for (int i = 0; i < fRecordedBatches.count(); ++i) { | 233 for (int i = 0; i < fRecordedBatches.count(); ++i) { |
234 if (!fRecordedBatches[i].fBatch) { | 234 if (!fRecordedBatches[i].fBatch) { |
235 continue; | 235 continue; |
236 } | 236 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 SkIntToScalar(currentRT->width()), | 279 SkIntToScalar(currentRT->width()), |
280 SkIntToScalar(currentRT->height()))) { | 280 SkIntToScalar(currentRT->height()))) { |
281 SkIRect iBounds; | 281 SkIRect iBounds; |
282 bounds.roundOut(&iBounds); | 282 bounds.roundOut(&iBounds); |
283 commandBuffer->submit(iBounds); | 283 commandBuffer->submit(iBounds); |
284 } | 284 } |
285 flushState->setCommandBuffer(nullptr); | 285 flushState->setCommandBuffer(nullptr); |
286 } | 286 } |
287 | 287 |
288 fGpu->finishDrawTarget(); | 288 fGpu->finishDrawTarget(); |
| 289 return true; |
289 } | 290 } |
290 | 291 |
291 void GrDrawTarget::reset() { | 292 void GrDrawTarget::reset() { |
292 fLastFullClearBatch = nullptr; | 293 fLastFullClearBatch = nullptr; |
293 fRecordedBatches.reset(); | 294 fRecordedBatches.reset(); |
294 if (fInstancedRendering) { | 295 if (fInstancedRendering) { |
295 fInstancedRendering->endFlush(); | 296 fInstancedRendering->endFlush(); |
296 } | 297 } |
297 } | 298 } |
298 | 299 |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 } | 617 } |
617 } | 618 } |
618 | 619 |
619 /////////////////////////////////////////////////////////////////////////////// | 620 /////////////////////////////////////////////////////////////////////////////// |
620 | 621 |
621 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { | 622 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { |
622 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); | 623 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); |
623 this->recordBatch(batch, batch->bounds()); | 624 this->recordBatch(batch, batch->bounds()); |
624 batch->unref(); | 625 batch->unref(); |
625 } | 626 } |
OLD | NEW |