50 uint32_t* actualValue,
int* failX,
int* failY) {
52 if (pixel != expectedValue) {
65 uint32_t expectedValue,
66 uint32_t* actualValue,
97 uint32_t expectedValue,
98 uint32_t* actualValue,
137 static const int kW = 10;
138 static const int kH = 10;
141 std::unique_ptr<SurfaceDrawContext> sdc;
151 uint32_t actualValue;
163 sdc->clear(fullRect, kColor1f);
164 if (!
check_rect(dContext, sdc.get(), fullRect,
kColor1, &actualValue, &failX, &failY)) {
173 sdc->clear(fullRect, kColor1f);
174 sdc->clear(fullRect, kColor1f);
175 if (!
check_rect(dContext, sdc.get(), fullRect,
kColor1, &actualValue, &failX, &failY)) {
184 sdc->clear(fullRect, kColor1f);
185 sdc->clear(fullRect, kColor2f);
186 if (!
check_rect(dContext, sdc.get(), fullRect,
kColor2, &actualValue, &failX, &failY)) {
195 sdc->clear(fullRect, kColor1f);
196 sdc->clear(mid1Rect, kColor1f);
197 if (!
check_rect(dContext, sdc.get(), fullRect,
kColor1, &actualValue, &failX, &failY)) {
206 sdc->clear(mid1Rect, kColor1f);
207 sdc->clear(fullRect, kColor1f);
208 if (!
check_rect(dContext, sdc.get(), fullRect,
kColor1, &actualValue, &failX, &failY)) {
217 sdc->clear(fullRect, kColor1f);
218 sdc->clear(mid1Rect, kColor2f);
219 if (!
check_rect(dContext, sdc.get(), mid1Rect,
kColor2, &actualValue, &failX, &failY)) {
224 if (!
check_ring(dContext, sdc.get(), 0,
kColor1, &actualValue, &failX, &failY)) {
233 sdc->clear(mid1Rect, kColor2f);
234 sdc->clear(fullRect, kColor1f);
235 if (!
check_rect(dContext, sdc.get(), fullRect,
kColor1, &actualValue, &failX, &failY)) {
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)) {
253 if (!
check_ring(dContext, sdc.get(), 1,
kColor2, &actualValue, &failX, &failY)) {
258 if (!
check_ring(dContext, sdc.get(), 0,
kColor1, &actualValue, &failX, &failY)) {
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)) {
274 if (!
check_ring(dContext, sdc.get(), 0,
kColor1, &actualValue, &failX, &failY)) {
291 sdc->clearStencilClip(kScissorRect,
true);
298 auto opsTask = sdc->getOpsTask();
303 constexpr std::array<float, 4> kExpected { 0, 0, 0, 1 };
316 sdc->clearStencilClip(kScissorRect,
true);
322 sdc->clearStencilClip(kScissorRect,
false);
324 auto opsTask = sdc->getOpsTask();
329 constexpr std::array<float, 4> kExpected { 1, 1, 1, 1 };
359 static const int kLeftX = 158;
360 static const int kMidX = 258;
361 static const int kRightX = 383;
362 static const int kTopY = 26;
363 static const int kBotY = 51;
366 { kLeftX, kTopY, kMidX, kBotY },
367 { kMidX, kTopY, kRightX, kBotY },
370 for (
int i = 0;
i < 2; ++
i) {
382 bool isCorrect =
true;
383 for (
int y = kTopY; isCorrect &&
y < kBotY; ++
y) {
386 for (
int x = kLeftX;
x < kMidX; ++
x) {
393 for (
int x = kMidX;
x < kRightX; ++
x) {
static void readback(const SkBitmap &src, int *result, int resultCount)
DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(ClearOp, reporter, ctxInfo, CtsEnforcement::kApiLevel_T)
static void clear_op_test(skiatest::Reporter *reporter, GrDirectContext *dContext)
skgpu::ganesh::SurfaceDrawContext SurfaceDrawContext
static bool check_ring(GrDirectContext *dContext, SurfaceDrawContext *sdc, int inset, uint32_t expectedValue, uint32_t *actualValue, int *failX, int *failY)
void fullscreen_clear_with_layer_test(skiatest::Reporter *reporter, GrRecordingContext *rContext)
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)
skgpu::ganesh::ClearOp ClearOp
static bool pixel_matches(const SkPixmap &pm, int x, int y, uint32_t expectedValue, uint32_t *actualValue, int *failX, int *failY)
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
constexpr SkPMColor4f SK_PMColor4fWHITE
constexpr SkPMColor4f SK_PMColor4fBLACK
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
constexpr SkColor SK_ColorGRAY
constexpr SkColor SK_ColorGREEN
#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()
void allocPixels(const SkImageInfo &info, size_t rowBytes)
uint32_t * getAddr32(int x, int y) const
int saveLayer(const SkRect *bounds, const SkPaint *paint)
void drawRect(const SkRect &rect, const SkPaint &paint)
void setColor(SkColor color)
const uint32_t * addr32() const
bool readPixels(const SkPixmap &dst, int srcX, int srcY)
GrDirectContext * get(ContextType type, ContextOverrides overrides=ContextOverrides::kNone)
bool stencilInsideMask() const
const std::array< float, 4 > & color() const
bool readPixels(GrDirectContext *dContext, GrPixmap dst, SkIPoint srcPt)
static std::unique_ptr< SurfaceDrawContext > Make(GrRecordingContext *, GrColorType, sk_sp< GrSurfaceProxy >, sk_sp< SkColorSpace >, GrSurfaceOrigin, const SkSurfaceProps &)
sk_sp< SkBlender > blender SkRect rect
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
static SkRect inset(const SkRect &r)
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 SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static SkRGBA4f FromBytes_RGBA(uint32_t color)