136 {
137 static const int kW = 10;
138 static const int kH = 10;
139
141 std::unique_ptr<SurfaceDrawContext> sdc;
142
143
144
146
147
148
150
151 uint32_t actualValue;
152 int failX, failY;
153
158
161
162
163 sdc->clear(fullRect, kColor1f);
164 if (!
check_rect(dContext, sdc.get(), fullRect,
kColor1, &actualValue, &failX, &failY)) {
166 failX, failY);
167 }
168
171
172
173 sdc->clear(fullRect, kColor1f);
174 sdc->clear(fullRect, kColor1f);
175 if (!
check_rect(dContext, sdc.get(), fullRect,
kColor1, &actualValue, &failX, &failY)) {
177 failX, failY);
178 }
179
182
183
184 sdc->clear(fullRect, kColor1f);
185 sdc->clear(fullRect, kColor2f);
186 if (!
check_rect(dContext, sdc.get(), fullRect,
kColor2, &actualValue, &failX, &failY)) {
188 failX, failY);
189 }
190
193
194
195 sdc->clear(fullRect, kColor1f);
196 sdc->clear(mid1Rect, kColor1f);
197 if (!
check_rect(dContext, sdc.get(), fullRect,
kColor1, &actualValue, &failX, &failY)) {
199 failX, failY);
200 }
201
204
205
206 sdc->clear(mid1Rect, kColor1f);
207 sdc->clear(fullRect, kColor1f);
208 if (!
check_rect(dContext, sdc.get(), fullRect,
kColor1, &actualValue, &failX, &failY)) {
210 failX, failY);
211 }
212
215
216
217 sdc->clear(fullRect, kColor1f);
218 sdc->clear(mid1Rect, kColor2f);
219 if (!
check_rect(dContext, sdc.get(), mid1Rect,
kColor2, &actualValue, &failX, &failY)) {
221 failX, failY);
222 }
223
224 if (!
check_ring(dContext, sdc.get(), 0,
kColor1, &actualValue, &failX, &failY)) {
226 failX, failY);
227 }
228
231
232
233 sdc->clear(mid1Rect, kColor2f);
234 sdc->clear(fullRect, kColor1f);
235 if (!
check_rect(dContext, sdc.get(), fullRect,
kColor1, &actualValue, &failX, &failY)) {
237 failX, failY);
238 }
239
242
243
244
245 sdc->clear(fullRect, kColor1f);
246 sdc->clear(mid1Rect, kColor2f);
247 sdc->clear(mid2Rect, kColor1f);
248 if (!
check_rect(dContext, sdc.get(), mid2Rect,
kColor1, &actualValue, &failX, &failY)) {
250 failX, failY);
251 }
252
253 if (!
check_ring(dContext, sdc.get(), 1,
kColor2, &actualValue, &failX, &failY)) {
255 failX, failY);
256 }
257
258 if (!
check_ring(dContext, sdc.get(), 0,
kColor1, &actualValue, &failX, &failY)) {
260 failX, failY);
261 }
262
265
266
267 sdc->clear(fullRect, kColor1f);
268 sdc->clear(mid2Rect, kColor1f);
269 sdc->clear(mid1Rect, kColor2f);
270 if (!
check_rect(dContext, sdc.get(), mid1Rect,
kColor2, &actualValue, &failX, &failY)) {
272 failX, failY);
273 }
274 if (!
check_ring(dContext, sdc.get(), 0,
kColor1, &actualValue, &failX, &failY)) {
276 failX, failY);
277 }
278
279
284
285
286
287 {
290
291 sdc->clearStencilClip(kScissorRect, true);
292
294
295
297
298 auto opsTask = sdc->getOpsTask();
300
302
303 constexpr std::array<float, 4> kExpected { 0, 0, 0, 1 };
306
308 }
309
310
311
312 {
315
316 sdc->clearStencilClip(kScissorRect, true);
317
319
320
321
322 sdc->clearStencilClip(kScissorRect, false);
323
324 auto opsTask = sdc->getOpsTask();
326
328
329 constexpr std::array<float, 4> kExpected { 1, 1, 1, 1 };
332
334 }
335 }
336}
static bool check_ring(GrDirectContext *dContext, SurfaceDrawContext *sdc, int inset, uint32_t expectedValue, uint32_t *actualValue, int *failX, int *failY)
std::unique_ptr< SurfaceDrawContext > newSDC(GrRecordingContext *rContext, int w, int h)
static bool check_rect(GrDirectContext *dContext, SurfaceDrawContext *sdc, const SkIRect &rect, uint32_t expectedValue, uint32_t *actualValue, int *failX, int *failY)
constexpr SkPMColor4f SK_PMColor4fWHITE
constexpr SkPMColor4f SK_PMColor4fBLACK
#define REPORTER_ASSERT(r, cond,...)
const GrCaps * caps() const
bool performPartialClearsAsDraws() const
bool performColorClearsAsDraws() const
bool performStencilClearsAsDraws() const
void flushAndSubmit(GrSyncCpu sync=GrSyncCpu::kNo)
GrDirectContextPriv priv()
bool stencilInsideMask() const
const std::array< float, 4 > & color() const
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
static SkRGBA4f FromBytes_RGBA(uint32_t color)