OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrDrawTarget.h" | 9 #include "GrDrawTarget.h" |
10 | 10 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 this->getGpu()->saveActiveTraceMarkers(); | 118 this->getGpu()->saveActiveTraceMarkers(); |
119 | 119 |
120 this->onFlush(); | 120 this->onFlush(); |
121 | 121 |
122 this->getGpu()->restoreActiveTraceMarkers(); | 122 this->getGpu()->restoreActiveTraceMarkers(); |
123 | 123 |
124 fFlushing = false; | 124 fFlushing = false; |
125 this->reset(); | 125 this->reset(); |
126 } | 126 } |
127 | 127 |
128 void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrBatch*
batch) { | 128 void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawBat
ch* batch) { |
129 // TODO some kind of checkdraw, but not at this level | 129 // TODO some kind of checkdraw, but not at this level |
130 | 130 |
131 // Setup clip | 131 // Setup clip |
132 GrScissorState scissorState; | 132 GrScissorState scissorState; |
133 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; | 133 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; |
134 GrPipelineBuilder::AutoRestoreStencil ars; | 134 GrPipelineBuilder::AutoRestoreStencil ars; |
135 if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, &batch->b
ounds())) { | 135 if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, &batch->b
ounds())) { |
136 return; | 136 return; |
137 } | 137 } |
138 | 138 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 this->onDrawPaths(pathProc, pathRange, indices, indexType, transformValues, | 288 this->onDrawPaths(pathProc, pathRange, indices, indexType, transformValues, |
289 transformType, count, stencilSettings, pipelineInfo); | 289 transformType, count, stencilSettings, pipelineInfo); |
290 } | 290 } |
291 | 291 |
292 void GrDrawTarget::drawBWRect(const GrPipelineBuilder& pipelineBuilder, | 292 void GrDrawTarget::drawBWRect(const GrPipelineBuilder& pipelineBuilder, |
293 GrColor color, | 293 GrColor color, |
294 const SkMatrix& viewMatrix, | 294 const SkMatrix& viewMatrix, |
295 const SkRect& rect, | 295 const SkRect& rect, |
296 const SkRect* localRect, | 296 const SkRect* localRect, |
297 const SkMatrix* localMatrix) { | 297 const SkMatrix* localMatrix) { |
298 SkAutoTUnref<GrBatch> batch(GrRectBatchFactory::CreateFillBW(color, viewMatri
x, rect, localRect, | 298 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateFillBW(color, viewM
atrix, rect, |
299 localMatrix)); | 299 localRect, l
ocalMatrix)); |
300 this->drawBatch(pipelineBuilder, batch); | 300 this->drawBatch(pipelineBuilder, batch); |
301 } | 301 } |
302 | 302 |
303 void GrDrawTarget::drawAARect(const GrPipelineBuilder& pipelineBuilder, | 303 void GrDrawTarget::drawAARect(const GrPipelineBuilder& pipelineBuilder, |
304 GrColor color, | 304 GrColor color, |
305 const SkMatrix& viewMatrix, | 305 const SkMatrix& viewMatrix, |
306 const SkRect& rect, | 306 const SkRect& rect, |
307 const SkRect& devRect) { | 307 const SkRect& devRect) { |
308 SkAutoTUnref<GrBatch> batch(GrRectBatchFactory::CreateFillAA(color, viewMatr
ix, rect, devRect)); | 308 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateFillAA(color, view
Matrix, rect, |
| 309 devRect)); |
309 this->drawBatch(pipelineBuilder, batch); | 310 this->drawBatch(pipelineBuilder, batch); |
310 } | 311 } |
311 | 312 |
312 void GrDrawTarget::clear(const SkIRect* rect, | 313 void GrDrawTarget::clear(const SkIRect* rect, |
313 GrColor color, | 314 GrColor color, |
314 bool canIgnoreRect, | 315 bool canIgnoreRect, |
315 GrRenderTarget* renderTarget) { | 316 GrRenderTarget* renderTarget) { |
316 SkIRect rtRect = SkIRect::MakeWH(renderTarget->width(), renderTarget->height
()); | 317 SkIRect rtRect = SkIRect::MakeWH(renderTarget->width(), renderTarget->height
()); |
317 SkIRect clippedRect; | 318 SkIRect clippedRect; |
318 if (!rect || | 319 if (!rect || |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 fArgs.fColorPOI = fArgs.fPipelineBuilder->colorProcInfo(primProc); | 474 fArgs.fColorPOI = fArgs.fPipelineBuilder->colorProcInfo(primProc); |
474 fArgs.fCoveragePOI = fArgs.fPipelineBuilder->coverageProcInfo(primProc); | 475 fArgs.fCoveragePOI = fArgs.fPipelineBuilder->coverageProcInfo(primProc); |
475 if (!target->setupDstReadIfNecessary(*fArgs.fPipelineBuilder, fArgs.fColorPO
I, | 476 if (!target->setupDstReadIfNecessary(*fArgs.fPipelineBuilder, fArgs.fColorPO
I, |
476 fArgs.fCoveragePOI, &fArgs.fDstTexture,
devBounds)) { | 477 fArgs.fCoveragePOI, &fArgs.fDstTexture,
devBounds)) { |
477 fArgs.fPipelineBuilder = NULL; | 478 fArgs.fPipelineBuilder = NULL; |
478 } | 479 } |
479 } | 480 } |
480 | 481 |
481 GrDrawTarget::PipelineInfo::PipelineInfo(const GrPipelineBuilder* pipelineBuilde
r, | 482 GrDrawTarget::PipelineInfo::PipelineInfo(const GrPipelineBuilder* pipelineBuilde
r, |
482 const GrScissorState* scissor, | 483 const GrScissorState* scissor, |
483 const GrBatch* batch, | 484 const GrDrawBatch* batch, |
484 const SkRect* devBounds, | 485 const SkRect* devBounds, |
485 GrDrawTarget* target) { | 486 GrDrawTarget* target) { |
486 fArgs.fPipelineBuilder = pipelineBuilder; | 487 fArgs.fPipelineBuilder = pipelineBuilder; |
487 fArgs.fCaps = target->caps(); | 488 fArgs.fCaps = target->caps(); |
488 fArgs.fScissor = scissor; | 489 fArgs.fScissor = scissor; |
489 fArgs.fColorPOI = fArgs.fPipelineBuilder->colorProcInfo(batch); | 490 fArgs.fColorPOI = fArgs.fPipelineBuilder->colorProcInfo(batch); |
490 fArgs.fCoveragePOI = fArgs.fPipelineBuilder->coverageProcInfo(batch); | 491 fArgs.fCoveragePOI = fArgs.fPipelineBuilder->coverageProcInfo(batch); |
491 if (!target->setupDstReadIfNecessary(*fArgs.fPipelineBuilder, fArgs.fColorPO
I, | 492 if (!target->setupDstReadIfNecessary(*fArgs.fPipelineBuilder, fArgs.fColorPO
I, |
492 fArgs.fCoveragePOI, &fArgs.fDstTexture,
devBounds)) { | 493 fArgs.fCoveragePOI, &fArgs.fDstTexture,
devBounds)) { |
493 fArgs.fPipelineBuilder = NULL; | 494 fArgs.fPipelineBuilder = NULL; |
(...skipping 18 matching lines...) Expand all Loading... |
512 ars, | 513 ars, |
513 scissorState, | 514 scissorState, |
514 devBounds); | 515 devBounds); |
515 } | 516 } |
516 | 517 |
517 void GrClipTarget::purgeResources() { | 518 void GrClipTarget::purgeResources() { |
518 // The clip mask manager can rebuild all its clip masks so just | 519 // The clip mask manager can rebuild all its clip masks so just |
519 // get rid of them all. | 520 // get rid of them all. |
520 fClipMaskManager->purgeResources(); | 521 fClipMaskManager->purgeResources(); |
521 }; | 522 }; |
OLD | NEW |