OLD | NEW |
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 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 HasAABloat::kNo, IsZeroArea::kNo); | 64 HasAABloat::kNo, IsZeroArea::kNo); |
65 fRenderTarget.reset(rt); | 65 fRenderTarget.reset(rt); |
66 } | 66 } |
67 | 67 |
68 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { | 68 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
69 // This could be much more complicated. Currently we look at cases where
the new clear | 69 // This could be much more complicated. Currently we look at cases where
the new clear |
70 // contains the old clear, or when the new clear is a subset of the old
clear and is the | 70 // contains the old clear, or when the new clear is a subset of the old
clear and is the |
71 // same color. | 71 // same color. |
72 GrClearBatch* cb = t->cast<GrClearBatch>(); | 72 GrClearBatch* cb = t->cast<GrClearBatch>(); |
73 SkASSERT(cb->fRenderTarget == fRenderTarget); | 73 SkASSERT(cb->fRenderTarget == fRenderTarget); |
74 if (!fClip.windowRectsState().cheapEqualTo(cb->fClip.windowRectsState())
) { | |
75 return false; | |
76 } | |
77 if (cb->contains(this)) { | 74 if (cb->contains(this)) { |
78 fClip = cb->fClip; | 75 fClip = cb->fClip; |
79 this->replaceBounds(*t); | 76 this->replaceBounds(*t); |
80 fColor = cb->fColor; | 77 fColor = cb->fColor; |
81 return true; | 78 return true; |
82 } else if (cb->fColor == fColor && this->contains(cb)) { | 79 } else if (cb->fColor == fColor && this->contains(cb)) { |
83 return true; | 80 return true; |
84 } | 81 } |
85 return false; | 82 return false; |
86 } | 83 } |
(...skipping 12 matching lines...) Expand all Loading... |
99 } | 96 } |
100 | 97 |
101 GrFixedClip fClip; | 98 GrFixedClip fClip; |
102 GrColor fColor; | 99 GrColor fColor; |
103 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; | 100 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; |
104 | 101 |
105 typedef GrBatch INHERITED; | 102 typedef GrBatch INHERITED; |
106 }; | 103 }; |
107 | 104 |
108 #endif | 105 #endif |
OLD | NEW |