39#if defined(SK_GANESH) || defined(SK_GRAPHITE)
49#if defined(SK_GRAPHITE)
55 int expectedW,
int expectedH,
102 SkVector rd[] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
110 half4 main(float2 coord) {
111 return half4(1, 0, 0, 1);
116 half4 main(float2 coord) {
117 return half4(0, 1, 0, 1);
122 half4 main(half4 src, half4 dst) {
123 return (src + dst) * 0.5;
128 uniform blender child_blender;
129 half4 main(half4 src, half4 dst) {
130 return (child_blender.eval(src, dst) + dst) * 0.5;
138 sk_sp<SkBlender> nestedBlender = nestedBlendEffect->makeBlender(
nullptr, children);
142 paint.setBlender(blender);
153 if (!
surface->readPixels(pixmap, 0, 0)) {
163 constexpr SkColor4f kExpected = {0.25f, 0.75f, 0.0f, 0.5f};
164 constexpr float kTolerance[4] = {0.01f, 0.01f, 0.0f, 0.01f};
166 for (
int i = 0;
i < 4; ++
i) {
169 "Wrong color, expected (%.2f %.2f %.2f %.2f), actual (%.2f, %.2f, %.2f, %.2f)",
170 kExpected.fR, kExpected.fG, kExpected.fB, kExpected.fA,
185#if defined(SK_GANESH)
199#if defined(SK_GRAPHITE)
207 std::unique_ptr<Recorder> recorder = context->makeRecorder();
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
static constexpr float kTolerance
static void check_isaimage(skiatest::Reporter *reporter, SkShader *shader, int expectedW, int expectedH, SkTileMode expectedX, SkTileMode expectedY, const SkMatrix &expectedM)
static void test_nested_blends(skiatest::Reporter *reporter, SkSurface *surface)
DEF_TEST(Shader_isAImage, reporter)
@ 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_ColorRED
#define REPORTER_ASSERT(r, cond,...)
#define DEF_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS(name, reporter, graphite_context, ctsEnforcement)
#define DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(name, reporter, context_info, ctsEnforcement)
sk_sp< SkImage > asImage() const
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
void allocN32Pixels(int width, int height, bool isOpaque=false)
void eraseColor(SkColor4f) const
void drawPaint(const SkPaint &paint)
void drawRRect(const SkRRect &rrect, const SkPaint &paint)
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
static SkMatrix Scale(SkScalar sx, SkScalar sy)
SkMatrix & setScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
SkColor4f getColor4f(int x, int y) const
void setRectRadii(const SkRect &rect, const SkVector radii[4])
static Result MakeForBlender(SkString sksl, const Options &)
static Result MakeForShader(SkString sksl, const Options &)
SkImage * isAImage(SkMatrix *localMatrix, SkTileMode xy[2]) const
sk_sp< const SkImage > image
SK_API sk_sp< SkShader > Blend(SkBlendMode mode, sk_sp< SkShader > dst, sk_sp< SkShader > src)
SK_API sk_sp< SkShader > MakeFractalNoise(SkScalar baseFrequencyX, SkScalar baseFrequencyY, int numOctaves, SkScalar seed, const SkISize *tileSize=nullptr)
SK_API sk_sp< SkShader > Empty()
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
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)
SkSamplingOptions(SkFilterMode::kLinear))
SIN Vec< N, float > abs(const Vec< N, float > &x)
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)