| 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 // support NV_blend_equation_advanced. | 302 // support NV_blend_equation_advanced. |
| 303 GrDrawTarget::PipelineInfo pipelineInfo(&pipelineBuilder, &scissorState, pat
hProc, NULL, this); | 303 GrDrawTarget::PipelineInfo pipelineInfo(&pipelineBuilder, &scissorState, pat
hProc, NULL, this); |
| 304 if (!pipelineInfo.valid()) { | 304 if (!pipelineInfo.valid()) { |
| 305 return; | 305 return; |
| 306 } | 306 } |
| 307 | 307 |
| 308 this->onDrawPaths(pathProc, pathRange, indices, indexType, transformValues, | 308 this->onDrawPaths(pathProc, pathRange, indices, indexType, transformValues, |
| 309 transformType, count, stencilSettings, pipelineInfo); | 309 transformType, count, stencilSettings, pipelineInfo); |
| 310 } | 310 } |
| 311 | 311 |
| 312 void GrDrawTarget::drawBWRect(const GrPipelineBuilder& pipelineBuilder, | 312 void GrDrawTarget::drawNonAARect(const GrPipelineBuilder& pipelineBuilder, |
| 313 GrColor color, | 313 GrColor color, |
| 314 const SkMatrix& viewMatrix, | 314 const SkMatrix& viewMatrix, |
| 315 const SkRect& rect) { | 315 const SkRect& rect) { |
| 316 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateFillBW(color, viewM
atrix, rect, | 316 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, vi
ewMatrix, rect, |
| 317 nullptr, nul
lptr)); | 317 nullptr,
nullptr)); |
| 318 this->drawBatch(pipelineBuilder, batch); | 318 this->drawBatch(pipelineBuilder, batch); |
| 319 } | 319 } |
| 320 | 320 |
| 321 void GrDrawTarget::drawBWRect(const GrPipelineBuilder& pipelineBuilder, | 321 void GrDrawTarget::drawNonAARect(const GrPipelineBuilder& pipelineBuilder, |
| 322 GrColor color, | 322 GrColor color, |
| 323 const SkMatrix& viewMatrix, | 323 const SkMatrix& viewMatrix, |
| 324 const SkRect& rect, | 324 const SkRect& rect, |
| 325 const SkMatrix& localMatrix) { | 325 const SkMatrix& localMatrix) { |
| 326 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateFillBW(color, viewM
atrix, rect, | 326 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, vi
ewMatrix, rect, |
| 327 nullptr, &lo
calMatrix)); | 327 nullptr,
&localMatrix)); |
| 328 this->drawBatch(pipelineBuilder, batch); | 328 this->drawBatch(pipelineBuilder, batch); |
| 329 } | 329 } |
| 330 | 330 |
| 331 void GrDrawTarget::drawBWRect(const GrPipelineBuilder& pipelineBuilder, | 331 void GrDrawTarget::drawNonAARect(const GrPipelineBuilder& pipelineBuilder, |
| 332 GrColor color, | 332 GrColor color, |
| 333 const SkMatrix& viewMatrix, | 333 const SkMatrix& viewMatrix, |
| 334 const SkRect& rect, | 334 const SkRect& rect, |
| 335 const SkRect& localRect) { | 335 const SkRect& localRect) { |
| 336 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateFillBW(color, viewM
atrix, rect, | 336 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, vi
ewMatrix, rect, |
| 337 &localRect,
nullptr)); | 337 &localRec
t, nullptr)); |
| 338 this->drawBatch(pipelineBuilder, batch); | 338 this->drawBatch(pipelineBuilder, batch); |
| 339 } | 339 } |
| 340 | 340 |
| 341 | 341 |
| 342 void GrDrawTarget::drawAARect(const GrPipelineBuilder& pipelineBuilder, | 342 void GrDrawTarget::drawAARect(const GrPipelineBuilder& pipelineBuilder, |
| 343 GrColor color, | 343 GrColor color, |
| 344 const SkMatrix& viewMatrix, | 344 const SkMatrix& viewMatrix, |
| 345 const SkRect& rect, | 345 const SkRect& rect, |
| 346 const SkRect& devRect) { | 346 const SkRect& devRect) { |
| 347 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateFillAA(color, view
Matrix, rect, | 347 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateAAFill(color, view
Matrix, rect, |
| 348 devRect)); | 348 devRect)); |
| 349 this->drawBatch(pipelineBuilder, batch); | 349 this->drawBatch(pipelineBuilder, batch); |
| 350 } | 350 } |
| 351 | 351 |
| 352 void GrDrawTarget::clear(const SkIRect* rect, | 352 void GrDrawTarget::clear(const SkIRect* rect, |
| 353 GrColor color, | 353 GrColor color, |
| 354 bool canIgnoreRect, | 354 bool canIgnoreRect, |
| 355 GrRenderTarget* renderTarget) { | 355 GrRenderTarget* renderTarget) { |
| 356 SkIRect rtRect = SkIRect::MakeWH(renderTarget->width(), renderTarget->height
()); | 356 SkIRect rtRect = SkIRect::MakeWH(renderTarget->width(), renderTarget->height
()); |
| 357 SkIRect clippedRect; | 357 SkIRect clippedRect; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 371 // This works around a driver bug with clear by drawing a rect instead. | 371 // This works around a driver bug with clear by drawing a rect instead. |
| 372 // The driver will ignore a clear if it is the only thing rendered to a | 372 // The driver will ignore a clear if it is the only thing rendered to a |
| 373 // target before the target is read. | 373 // target before the target is read. |
| 374 if (rect == &rtRect) { | 374 if (rect == &rtRect) { |
| 375 this->discard(renderTarget); | 375 this->discard(renderTarget); |
| 376 } | 376 } |
| 377 | 377 |
| 378 GrPipelineBuilder pipelineBuilder; | 378 GrPipelineBuilder pipelineBuilder; |
| 379 pipelineBuilder.setRenderTarget(renderTarget); | 379 pipelineBuilder.setRenderTarget(renderTarget); |
| 380 | 380 |
| 381 this->drawSimpleRect(pipelineBuilder, color, SkMatrix::I(), *rect); | 381 this->drawNonAARect(pipelineBuilder, color, SkMatrix::I(), *rect); |
| 382 } else { | 382 } else { |
| 383 GrBatch* batch = SkNEW_ARGS(GrClearBatch, (*rect, color, renderTarget)); | 383 GrBatch* batch = SkNEW_ARGS(GrClearBatch, (*rect, color, renderTarget)); |
| 384 this->onDrawBatch(batch); | 384 this->onDrawBatch(batch); |
| 385 batch->unref(); | 385 batch->unref(); |
| 386 } | 386 } |
| 387 } | 387 } |
| 388 | 388 |
| 389 void GrDrawTarget::discard(GrRenderTarget* renderTarget) { | 389 void GrDrawTarget::discard(GrRenderTarget* renderTarget) { |
| 390 if (this->caps()->discardRenderTargetSupport()) { | 390 if (this->caps()->discardRenderTargetSupport()) { |
| 391 GrBatch* batch = SkNEW_ARGS(GrDiscardBatch, (renderTarget)); | 391 GrBatch* batch = SkNEW_ARGS(GrDiscardBatch, (renderTarget)); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 // The clip mask manager can rebuild all its clip masks so just | 504 // The clip mask manager can rebuild all its clip masks so just |
| 505 // get rid of them all. | 505 // get rid of them all. |
| 506 fClipMaskManager->purgeResources(); | 506 fClipMaskManager->purgeResources(); |
| 507 }; | 507 }; |
| 508 | 508 |
| 509 void GrClipTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { | 509 void GrClipTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { |
| 510 GrBatch* batch = SkNEW_ARGS(GrClearStencilClipBatch, (rect, insideClip, rt))
; | 510 GrBatch* batch = SkNEW_ARGS(GrClearStencilClipBatch, (rect, insideClip, rt))
; |
| 511 this->onDrawBatch(batch); | 511 this->onDrawBatch(batch); |
| 512 batch->unref(); | 512 batch->unref(); |
| 513 } | 513 } |
| OLD | NEW |