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

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

Issue 2127673002: Consolidate handling of infinitely thin primitives and aa bloat handing WRT batch bounds (Closed) Base URL: https://skia.googlesource.com/skia.git@AAStrokeRect
Patch Set: update for instanced rendering Created 4 years, 5 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.cpp ('k') | src/gpu/batches/GrCopySurfaceBatch.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrClearBatch_DEFINED 8 #ifndef GrClearBatch_DEFINED
9 #define GrClearBatch_DEFINED 9 #define GrClearBatch_DEFINED
10 10
11 #include "GrBatch.h" 11 #include "GrBatch.h"
12 #include "GrBatchFlushState.h" 12 #include "GrBatchFlushState.h"
13 #include "GrGpu.h" 13 #include "GrGpu.h"
14 #include "GrGpuCommandBuffer.h" 14 #include "GrGpuCommandBuffer.h"
15 #include "GrRenderTarget.h" 15 #include "GrRenderTarget.h"
16 16
17 class GrClearBatch final : public GrBatch { 17 class GrClearBatch final : public GrBatch {
18 public: 18 public:
19 DEFINE_BATCH_CLASS_ID 19 DEFINE_BATCH_CLASS_ID
20 20
21 GrClearBatch(const SkIRect& rect, GrColor color, GrRenderTarget* rt) 21 GrClearBatch(const SkIRect& rect, GrColor color, GrRenderTarget* rt)
22 : INHERITED(ClassID()) 22 : INHERITED(ClassID())
23 , fRect(rect) 23 , fRect(rect)
24 , fColor(color) 24 , fColor(color)
25 , fRenderTarget(rt) { 25 , fRenderTarget(rt) {
26 fBounds = SkRect::Make(rect); 26 this->setBounds(SkRect::Make(rect), HasAABloat::kNo, IsZeroArea::kNo);
27 } 27 }
28 28
29 const char* name() const override { return "Clear"; } 29 const char* name() const override { return "Clear"; }
30 30
31 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()- >getUniqueID(); } 31 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()- >getUniqueID(); }
32 GrRenderTarget* renderTarget() const override { return fRenderTarget.get(); } 32 GrRenderTarget* renderTarget() const override { return fRenderTarget.get(); }
33 33
34 SkString dumpInfo() const override { 34 SkString dumpInfo() const override {
35 SkString string; 35 SkString string;
36 string.printf("Color: 0x%08x, Rect [L: %d, T: %d, R: %d, B: %d], RT: %d" , 36 string.printf("Color: 0x%08x, Rect [L: %d, T: %d, R: %d, B: %d], RT: %d" ,
37 fColor, fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBott om, 37 fColor, fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBott om,
38 fRenderTarget.get()->getUniqueID()); 38 fRenderTarget.get()->getUniqueID());
39 string.append(INHERITED::dumpInfo()); 39 string.append(INHERITED::dumpInfo());
40 return string; 40 return string;
41 } 41 }
42 42
43 private: 43 private:
44 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { 44 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
45 // This could be much more complicated. Currently we look at cases where the new clear 45 // This could be much more complicated. Currently we look at cases where the new clear
46 // contains the old clear, or when the new clear is a subset of the old clear and is the 46 // contains the old clear, or when the new clear is a subset of the old clear and is the
47 // same color. 47 // same color.
48 GrClearBatch* cb = t->cast<GrClearBatch>(); 48 GrClearBatch* cb = t->cast<GrClearBatch>();
49 SkASSERT(cb->fRenderTarget == fRenderTarget); 49 SkASSERT(cb->fRenderTarget == fRenderTarget);
50 if (cb->fRect.contains(fRect)) { 50 if (cb->fRect.contains(fRect)) {
51 fRect = cb->fRect; 51 fRect = cb->fRect;
52 fBounds = cb->fBounds; 52 this->replaceBounds(*t);
53 fColor = cb->fColor; 53 fColor = cb->fColor;
54 return true; 54 return true;
55 } else if (cb->fColor == fColor && fRect.contains(cb->fRect)) { 55 } else if (cb->fColor == fColor && fRect.contains(cb->fRect)) {
56 return true; 56 return true;
57 } 57 }
58 return false; 58 return false;
59 } 59 }
60 60
61 void onPrepare(GrBatchFlushState*) override {} 61 void onPrepare(GrBatchFlushState*) override {}
62 62
(...skipping 10 matching lines...) Expand all
73 73
74 class GrClearStencilClipBatch final : public GrBatch { 74 class GrClearStencilClipBatch final : public GrBatch {
75 public: 75 public:
76 DEFINE_BATCH_CLASS_ID 76 DEFINE_BATCH_CLASS_ID
77 77
78 GrClearStencilClipBatch(const SkIRect& rect, bool insideClip, GrRenderTarget * rt) 78 GrClearStencilClipBatch(const SkIRect& rect, bool insideClip, GrRenderTarget * rt)
79 : INHERITED(ClassID()) 79 : INHERITED(ClassID())
80 , fRect(rect) 80 , fRect(rect)
81 , fInsideClip(insideClip) 81 , fInsideClip(insideClip)
82 , fRenderTarget(rt) { 82 , fRenderTarget(rt) {
83 fBounds = SkRect::Make(rect); 83 this->setBounds(SkRect::Make(rect), HasAABloat::kNo, IsZeroArea::kNo);
84 } 84 }
85 85
86 const char* name() const override { return "ClearStencilClip"; } 86 const char* name() const override { return "ClearStencilClip"; }
87 87
88 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()- >getUniqueID(); } 88 uint32_t renderTargetUniqueID() const override { return fRenderTarget.get()- >getUniqueID(); }
89 GrRenderTarget* renderTarget() const override { return fRenderTarget.get(); } 89 GrRenderTarget* renderTarget() const override { return fRenderTarget.get(); }
90 90
91 SkString dumpInfo() const override { 91 SkString dumpInfo() const override {
92 SkString string; 92 SkString string;
93 string.printf("Rect [L: %d, T: %d, R: %d, B: %d], IC: %d, RT: 0x%p", 93 string.printf("Rect [L: %d, T: %d, R: %d, B: %d], IC: %d, RT: 0x%p",
(...skipping 13 matching lines...) Expand all
107 } 107 }
108 108
109 SkIRect fRect; 109 SkIRect fRect;
110 bool fInsideClip; 110 bool fInsideClip;
111 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; 111 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget;
112 112
113 typedef GrBatch INHERITED; 113 typedef GrBatch INHERITED;
114 }; 114 };
115 115
116 #endif 116 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrBatch.cpp ('k') | src/gpu/batches/GrCopySurfaceBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698