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

Side by Side Diff: src/gpu/batches/GrClearBatch.h

Issue 1293563003: Put clear and discard into GrBatch. (Closed) Base URL: https://skia.googlesource.com/skia.git@protectedprepare
Patch Set: tiny 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 unified diff | Download patch
« no previous file with comments | « src/gpu/batches/GrBatch.h ('k') | src/gpu/batches/GrDiscardBatch.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef GrClearBatch_DEFINED
9 #define GrClearBatch_DEFINED
10
11 #include "GrBatch.h"
12 #include "GrBatchFlushState.h"
13 #include "GrGpu.h"
14 #include "GrRenderTarget.h"
15
16 class GrClearBatch final : public GrBatch {
17 public:
18 GrClearBatch(const SkIRect& rect, GrColor color, GrRenderTarget* rt)
19 : fRect(rect)
20 , fColor(color)
21 , fRenderTarget(rt) {
22 this->initClassID<GrClearBatch>();
23 fBounds = SkRect::Make(rect);
24 }
25
26 const char* name() const override { return "Clear"; }
27
28 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()- >getUniqueID(); }
29
30 SkString dumpInfo() const {
31 SkString string;
32 string.printf("Color: 0x%08x, Rect [L: %d, T: %d, R: %d, B: %d], RT: 0x% p",
33 fColor, fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBott om,
34 fRenderTarget.get());
35 return string;
36 }
37
38 private:
39 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
40 // We could combine clears. TBD how much complexity to put here.
41 return false;
42 }
43
44 void onPrepare(GrBatchFlushState*) override {}
45
46 void onDraw(GrBatchFlushState* state) override {
47 state->gpu()->clear(fRect, fColor, fRenderTarget.get());
48 }
49
50 SkIRect fRect;
51 GrColor fColor;
52 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget;
53 };
54
55 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrBatch.h ('k') | src/gpu/batches/GrDiscardBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698