| 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 "GrBatchTest.h" | 8 #include "GrBatchTest.h" |
| 9 #include "GrColor.h" | 9 #include "GrColor.h" |
| 10 #include "GrDrawContext.h" | 10 #include "GrDrawContext.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 // target before the target is read. | 234 // target before the target is read. |
| 235 SkRect clearRect = SkRect::MakeIWH(this->width(), this->height()); | 235 SkRect clearRect = SkRect::MakeIWH(this->width(), this->height()); |
| 236 if (isFull) { | 236 if (isFull) { |
| 237 this->discard(); | 237 this->discard(); |
| 238 } else if (!clearRect.intersect(SkRect::Make(clip.scissorRect()))) { | 238 } else if (!clearRect.intersect(SkRect::Make(clip.scissorRect()))) { |
| 239 return; | 239 return; |
| 240 } | 240 } |
| 241 | 241 |
| 242 GrPaint paint; | 242 GrPaint paint; |
| 243 paint.setColor4f(GrColor4f::FromGrColor(color)); | 243 paint.setColor4f(GrColor4f::FromGrColor(color)); |
| 244 paint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); | 244 paint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::Mode::kSrc_Mo
de)); |
| 245 | 245 |
| 246 this->drawRect(clip, paint, SkMatrix::I(), clearRect); | 246 this->drawRect(clip, paint, SkMatrix::I(), clearRect); |
| 247 } else if (isFull) { | 247 } else if (isFull) { |
| 248 this->getDrawTarget()->fullClear(this->accessRenderTarget(), color); | 248 this->getDrawTarget()->fullClear(this->accessRenderTarget(), color); |
| 249 } else { | 249 } else { |
| 250 sk_sp<GrBatch> batch(GrClearBatch::Make(clip, color, this->accessRenderT
arget())); | 250 sk_sp<GrBatch> batch(GrClearBatch::Make(clip, color, this->accessRenderT
arget())); |
| 251 if (!batch) { | 251 if (!batch) { |
| 252 return; | 252 return; |
| 253 } | 253 } |
| 254 this->getDrawTarget()->addBatch(std::move(batch)); | 254 this->getDrawTarget()->addBatch(std::move(batch)); |
| (...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1426 | 1426 |
| 1427 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, | 1427 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, |
| 1428 GrDrawBatch* batch) { | 1428 GrDrawBatch* batch) { |
| 1429 ASSERT_SINGLE_OWNER | 1429 ASSERT_SINGLE_OWNER |
| 1430 RETURN_IF_ABANDONED | 1430 RETURN_IF_ABANDONED |
| 1431 SkDEBUGCODE(this->validate();) | 1431 SkDEBUGCODE(this->validate();) |
| 1432 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); | 1432 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); |
| 1433 | 1433 |
| 1434 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); | 1434 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); |
| 1435 } | 1435 } |
| OLD | NEW |