aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrDrawContext.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-08-10 16:31:05 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-10 16:31:06 -0700
commit9f129de595053a641828b73a8f563dcbae3f034d (patch)
tree88a68d85d24856c73c879769c444ca88154e0b8f /src/gpu/GrDrawContext.cpp
parent0cbe77c383a1c829341b27df1a9219bc33524440 (diff)
Add a full clear method to GrDrawTarget.
This will allow us to avoid ClearBatch creation for successive clears. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2233043002 Review-Url: https://codereview.chromium.org/2233043002
Diffstat (limited to 'src/gpu/GrDrawContext.cpp')
-rw-r--r--src/gpu/GrDrawContext.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index 344ae1c2ab..0a6ab5b527 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -203,10 +203,12 @@ void GrDrawContext::clear(const SkIRect* rect,
const SkIRect rtRect = SkIRect::MakeWH(this->width(), this->height());
SkIRect clippedRect;
+ bool isFull = false;
if (!rect ||
(canIgnoreRect && fContext->caps()->fullClearIsFree()) ||
rect->contains(rtRect)) {
rect = &rtRect;
+ isFull = true;
} else {
clippedRect = *rect;
if (!clippedRect.intersect(rtRect)) {
@@ -228,6 +230,8 @@ void GrDrawContext::clear(const SkIRect* rect,
paint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode));
this->drawRect(GrNoClip(), paint, SkMatrix::I(), SkRect::Make(*rect));
+ } else if (isFull) {
+ this->getDrawTarget()->fullClear(this->accessRenderTarget(), color);
} else {
sk_sp<GrBatch> batch = GrClearBatch::Make(*rect, color, this->accessRenderTarget());
this->getDrawTarget()->addBatch(std::move(batch));