108 {
110 half4 main(float2 coord) {
111 return half4(1, 0, 0, 1);
112 }
113 )"));
114
116 half4 main(float2 coord) {
117 return half4(0, 1, 0, 1);
118 }
119 )"));
120
122 half4 main(half4 src, half4 dst) {
123 return (src + dst) * 0.5;
124 }
125 )"));
126
128 uniform blender child_blender;
129 half4 main(half4 src, half4 dst) {
130 return (child_blender.eval(src, dst) + dst) * 0.5;
131 }
132 )"));
133
138 sk_sp<SkBlender> nestedBlender = nestedBlendEffect->makeBlender(
nullptr, children);
139
142 paint.setBlender(blender);
143
144
147
148
153 if (!
surface->readPixels(pixmap, 0, 0)) {
155 return;
156 }
157
158
159
160
161
162
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,
172 break;
173 }
174 }
175}
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
static constexpr float kTolerance
void drawPaint(const SkPaint &paint)
SkColor4f getColor4f(int x, int y) const
static Result MakeForBlender(SkString sksl, const Options &)
static Result MakeForShader(SkString sksl, const Options &)
SIN Vec< N, float > abs(const Vec< N, float > &x)