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

Unified Diff: src/gpu/GrGpu.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: 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/GrGpu.h ('k') | src/gpu/GrTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrGpu.cpp
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index bb020f5b503d7ac7c7207fcc663e37e00542bab2..24cd08a1b60f9a5848d08ba9d5b9ed0be1317134 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -222,7 +222,24 @@ void GrGpu::clear(const SkIRect* rect,
GrRenderTarget* renderTarget) {
SkASSERT(renderTarget);
this->handleDirtyContext();
- this->onClear(renderTarget, rect, color, canIgnoreRect);
+
+ if (canIgnoreRect && this->caps()->fullClearIsFree()) {
+ rect = NULL;
+ }
+
+ SkIRect clippedRect;
+ if (rect) {
+ // flushScissor expects rect to be clipped to the target.
+ clippedRect = *rect;
+ SkIRect rtRect = SkIRect::MakeWH(renderTarget->width(), renderTarget->height());
+ if (clippedRect.intersect(rtRect)) {
egdaniel 2015/08/05 19:59:05 I wonder if its worth also checking if the clipped
bsalomon 2015/08/05 20:18:57 Should this all be done even higher up (e.g. GrDT)
+ rect = &clippedRect;
+ } else {
+ return;
+ }
+ }
+
+ this->onClear(renderTarget, rect, color);
}
void GrGpu::clearStencilClip(const SkIRect& rect,
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/GrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698