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

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 2233043002: Add a full clear method to GrDrawTarget. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: include order Created 4 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') | no next file » | 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 4ab467ccf43ad16a6d69d4d6f76ca25e5f773ad7..c424f5a593929b6ba7db0d15685f99b4a9d3cfb3 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -26,6 +26,7 @@
#include "SkStrokeRec.h"
+#include "batches/GrClearBatch.h"
#include "batches/GrClearStencilClipBatch.h"
#include "batches/GrCopySurfaceBatch.h"
#include "batches/GrDiscardBatch.h"
@@ -456,7 +457,18 @@ void GrDrawTarget::addBatch(sk_sp<GrBatch> batch) {
this->recordBatch(batch.get(), batch->bounds());
}
+void GrDrawTarget::fullClear(GrRenderTarget* renderTarget, GrColor color) {
+ // Currently this just inserts a clear batch. However, once in MDB this can remove all the
+ // previously recorded batches and change the load op to clear with supplied color.
+ sk_sp<GrBatch> batch = GrClearBatch::Make(SkIRect::MakeWH(renderTarget->width(),
+ renderTarget->height()),
+ color, renderTarget);
+ this->recordBatch(batch.get(), batch->bounds());
+}
+
void GrDrawTarget::discard(GrRenderTarget* renderTarget) {
+ // Currently this just inserts a discard batch. However, once in MDB this can remove all the
+ // previously recorded batches and change the load op to discard.
if (this->caps()->discardRenderTargetSupport()) {
GrBatch* batch = new GrDiscardBatch(renderTarget);
this->recordBatch(batch, batch->bounds());
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698