40 static const int kWidth = 10;
49 canvasFilter.
clear(0x00000000);
53 canvasPaint.
clear(0x00000000);
73 paint.setShader(gradient);
81 for (
int x = 0;
x <
kWidth; ++
x, ++filterPtr, ++paintPtr) {
88 static const int kWidth = 10;
97 canvasFilter.
clear(0x00000000);
101 canvasPaint.
clear(0x00000000);
122 paint.setShader(gradient);
130 SkString errString(
"Image filter doesn't match paint reference");
131 errString.
append(
"\nExpected: ");
133 errString.
append(encoded);
135 errString.
append(
"failed to encode");
138 errString.
append(
"\nActual: ");
140 errString.
append(encoded);
142 errString.
append(
"failed to encode");
156 uniform shader child;
157 vec4 main(vec2 coord) {
158 return child.eval(coord) * 0.5;
169 std::vector<sk_sp<SkImageFilter>> filters = {
173 for (
auto&& filter : filters) {
174 auto canvas =
surface->getCanvas();
180 canvas->drawPaint(
paint);
186 canvas->saveLayer(
nullptr, &filterPaint);
205 REPORTER_ASSERT(r, alpha >= 127 && alpha <= 129,
"Expected: %d Actual: %d", 128, alpha);
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(SkRuntimeShaderImageFilter_GPU, r, ctxInfo, CtsEnforcement::kApiLevel_T)
static void test_scaled(skiatest::Reporter *reporter)
static void test_unscaled(skiatest::Reporter *reporter)
DEF_TEST(ShaderImageFilter, reporter)
static void test_runtime_shader(skiatest::Reporter *r, SkSurface *surface)
constexpr SkColor SK_ColorTRANSPARENT
constexpr SkColor SK_ColorBLUE
static constexpr SkColor SkColorSetA(SkColor c, U8CPU a)
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorGREEN
#define SkColorGetA(color)
#define REPORTER_ASSERT(r, cond,...)
static SkScalar center(float pos0, float pos1)
void allocN32Pixels(int width, int height, bool isOpaque=false)
uint32_t * getAddr32(int x, int y) const
void drawRect(const SkRect &rect, const SkPaint &paint)
void clear(SkColor color)
void scale(SkScalar sx, SkScalar sy)
static sk_sp< SkShader > MakeRadial(const SkPoint ¢er, SkScalar radius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
static sk_sp< SkImageFilter > RuntimeShader(const SkRuntimeShaderBuilder &builder, std::string_view childShaderName, sk_sp< SkImageFilter > input)
static sk_sp< SkImageFilter > Shader(sk_sp< SkShader > shader, const CropRect &cropRect={})
void setColor(SkColor color)
void setImageFilter(sk_sp< SkImageFilter > imageFilter)
static Result MakeForShader(SkString sksl, const Options &)
void append(const char text[])
const char * c_str() const
PODArray< SkColor > colors
SK_API sk_sp< SkShader > Color(SkColor)
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)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
static SkImageInfo MakeN32Premul(int width, int height)
static constexpr SkPoint Make(float x, float y)
static SkRect Make(const SkISize &size)
sk_sp< SkRuntimeEffect > effect