35 const uint32_t* canvasPixels =
static_cast<const uint32_t*
>(
bitmap.getPixels());
37 bool failureFound =
false;
38 bool foundNonBlue =
false;
40 for (
int cy = 0; cy < 8 && !failureFound; ++cy) {
42 SkPMColor canvasPixel = canvasPixels[cy * 8 + cx];
49 if (canvasPixel != 0xFFFF0000 && canvasPixel != 0xFF00FF00) {
51 ERRORF(
reporter,
"Wrong color at %d, %d. Got 0x%08x when we expected Blue or Green."
53 cx, cy, canvasPixel, GrSurfaceOriginToStr(origin));
55 if (canvasPixel != 0XFFFF0000) {
60 if (cy == 4 && !foundNonBlue) {
61 expectedPixel = 0xFF00FF00;
63 expectedPixel = 0xFFFF0000;
65 if (canvasPixel != expectedPixel) {
68 "Wrong color at %d, %d. Got 0x%08x when we expected 0x%08x. Origin is: %s",
69 cx, cy, canvasPixel, expectedPixel, GrSurfaceOriginToStr(origin));
78 using namespace skgpu;
89 if (!beTexture.isValid()) {
@ kBottomLeft_GrSurfaceOrigin
@ kTopLeft_GrSurfaceOrigin
skgpu::Protected Protected
DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(SaveLayerOrigin, reporter, context_info, CtsEnforcement::kApiLevel_T)
static void check_pixels(skiatest::Reporter *reporter, const SkBitmap &bitmap, GrSurfaceOrigin origin)
static void run_test(skiatest::Reporter *reporter, GrDirectContext *context, GrSurfaceOrigin origin)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorGREEN
#define REPORTER_ASSERT(r, cond,...)
const GrCaps * caps() const
bool supportsProtectedContent() const
void deleteBackendTexture(const GrBackendTexture &)
GrBackendTexture createBackendTexture(int width, int height, const GrBackendFormat &, skgpu::Mipmapped, GrRenderable, GrProtected=GrProtected::kNo, std::string_view label={})
GrDirectContextPriv priv()
int saveLayer(const SkRect *bounds, const SkPaint *paint)
void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint &paint)
void clear(SkColor color)
Optional< SkRect > bounds
SK_API sk_sp< SkSurface > WrapBackendTexture(GrRecordingContext *context, const GrBackendTexture &backendTexture, GrSurfaceOrigin origin, int sampleCnt, SkColorType colorType, sk_sp< SkColorSpace > colorSpace, const SkSurfaceProps *surfaceProps, TextureReleaseProc textureReleaseProc=nullptr, ReleaseContext releaseContext=nullptr)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static constexpr SkRect MakeWH(float w, float h)