| 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 batch->setStencilSettings(stencilSettings); | 343 batch->setStencilSettings(stencilSettings); |
| 344 | 344 |
| 345 GrPipeline::CreateArgs args; | 345 GrPipeline::CreateArgs args; |
| 346 if (!this->installPipelineInDrawBatch(&pipelineBuilder, &clip.scissorState()
, batch)) { | 346 if (!this->installPipelineInDrawBatch(&pipelineBuilder, &clip.scissorState()
, batch)) { |
| 347 return; | 347 return; |
| 348 } | 348 } |
| 349 | 349 |
| 350 this->recordBatch(batch); | 350 this->recordBatch(batch); |
| 351 } | 351 } |
| 352 | 352 |
| 353 void GrDrawTarget::drawNonAARect(const GrPipelineBuilder& pipelineBuilder, | |
| 354 GrColor color, | |
| 355 const SkMatrix& viewMatrix, | |
| 356 const SkRect& rect) { | |
| 357 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, vi
ewMatrix, rect, | |
| 358 nullptr,
nullptr)); | |
| 359 this->drawBatch(pipelineBuilder, batch); | |
| 360 } | |
| 361 | |
| 362 void GrDrawTarget::drawAARect(const GrPipelineBuilder& pipelineBuilder, | |
| 363 GrColor color, | |
| 364 const SkMatrix& viewMatrix, | |
| 365 const SkRect& rect, | |
| 366 const SkRect& devRect) { | |
| 367 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateAAFill(color, view
Matrix, rect, | |
| 368 devRect)); | |
| 369 this->drawBatch(pipelineBuilder, batch); | |
| 370 } | |
| 371 | |
| 372 void GrDrawTarget::clear(const SkIRect* rect, | 353 void GrDrawTarget::clear(const SkIRect* rect, |
| 373 GrColor color, | 354 GrColor color, |
| 374 bool canIgnoreRect, | 355 bool canIgnoreRect, |
| 375 GrRenderTarget* renderTarget) { | 356 GrRenderTarget* renderTarget) { |
| 376 SkIRect rtRect = SkIRect::MakeWH(renderTarget->width(), renderTarget->height
()); | 357 SkIRect rtRect = SkIRect::MakeWH(renderTarget->width(), renderTarget->height
()); |
| 377 SkIRect clippedRect; | 358 SkIRect clippedRect; |
| 378 if (!rect || | 359 if (!rect || |
| 379 (canIgnoreRect && this->caps()->fullClearIsFree()) || | 360 (canIgnoreRect && this->caps()->fullClearIsFree()) || |
| 380 rect->contains(rtRect)) { | 361 rect->contains(rtRect)) { |
| 381 rect = &rtRect; | 362 rect = &rtRect; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 393 // target before the target is read. | 374 // target before the target is read. |
| 394 if (rect == &rtRect) { | 375 if (rect == &rtRect) { |
| 395 this->discard(renderTarget); | 376 this->discard(renderTarget); |
| 396 } | 377 } |
| 397 | 378 |
| 398 GrPipelineBuilder pipelineBuilder; | 379 GrPipelineBuilder pipelineBuilder; |
| 399 pipelineBuilder.setXPFactory( | 380 pipelineBuilder.setXPFactory( |
| 400 GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref(); | 381 GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref(); |
| 401 pipelineBuilder.setRenderTarget(renderTarget); | 382 pipelineBuilder.setRenderTarget(renderTarget); |
| 402 | 383 |
| 403 this->drawNonAARect(pipelineBuilder, color, SkMatrix::I(), *rect); | 384 SkRect scalarRect = SkRect::Make(*rect); |
| 385 SkAutoTUnref<GrDrawBatch> batch( |
| 386 GrRectBatchFactory::CreateNonAAFill(color, SkMatrix::I(), scalar
Rect, |
| 387 nullptr, nullptr)); |
| 388 this->drawBatch(pipelineBuilder, batch); |
| 404 } else { | 389 } else { |
| 405 GrBatch* batch = new GrClearBatch(*rect, color, renderTarget); | 390 GrBatch* batch = new GrClearBatch(*rect, color, renderTarget); |
| 406 this->recordBatch(batch); | 391 this->recordBatch(batch); |
| 407 batch->unref(); | 392 batch->unref(); |
| 408 } | 393 } |
| 409 } | 394 } |
| 410 | 395 |
| 411 void GrDrawTarget::discard(GrRenderTarget* renderTarget) { | 396 void GrDrawTarget::discard(GrRenderTarget* renderTarget) { |
| 412 if (this->caps()->discardRenderTargetSupport()) { | 397 if (this->caps()->discardRenderTargetSupport()) { |
| 413 GrBatch* batch = new GrDiscardBatch(renderTarget); | 398 GrBatch* batch = new GrDiscardBatch(renderTarget); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 } | 502 } |
| 518 | 503 |
| 519 return true; | 504 return true; |
| 520 } | 505 } |
| 521 | 506 |
| 522 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { | 507 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { |
| 523 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); | 508 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); |
| 524 this->recordBatch(batch); | 509 this->recordBatch(batch); |
| 525 batch->unref(); | 510 batch->unref(); |
| 526 } | 511 } |
| OLD | NEW |