Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(813)

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 1275543005: Move some work from backend onClear to base class clear (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Pass references and rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrGpu.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawTarget.cpp
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 0049767e8b420cfde0bc53b8487920ea80584c9a..2171f1e93473ba168acede74efad9600d68029c8 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -309,14 +309,25 @@ void GrDrawTarget::clear(const SkIRect* rect,
GrColor color,
bool canIgnoreRect,
GrRenderTarget* renderTarget) {
+ SkIRect rtRect = SkIRect::MakeWH(renderTarget->width(), renderTarget->height());
+ SkIRect clippedRect;
+ if (!rect ||
+ (canIgnoreRect && this->caps()->fullClearIsFree()) ||
+ rect->contains(rtRect)) {
+ rect = &rtRect;
+ } else {
+ clippedRect = *rect;
+ if (!clippedRect.intersect(rtRect)) {
+ return;
+ }
+ rect = &clippedRect;
+ }
+
if (fCaps->useDrawInsteadOfClear()) {
// This works around a driver bug with clear by drawing a rect instead.
// The driver will ignore a clear if it is the only thing rendered to a
// target before the target is read.
- SkIRect rtRect = SkIRect::MakeWH(renderTarget->width(), renderTarget->height());
- if (NULL == rect || canIgnoreRect || rect->contains(rtRect)) {
- rect = &rtRect;
- // We first issue a discard() since that may help tilers.
+ if (rect == &rtRect) {
this->discard(renderTarget);
}
@@ -325,7 +336,7 @@ void GrDrawTarget::clear(const SkIRect* rect,
this->drawSimpleRect(pipelineBuilder, color, SkMatrix::I(), *rect);
} else {
- this->onClear(rect, color, canIgnoreRect, renderTarget);
+ this->onClear(*rect, color, renderTarget);
}
}
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698