41#if defined(SK_GRAPHITE)
51 const SkIRect* rects[] {
clip, inSubset, outSubset };
102 std::move(displacement),
nullptr, cropRect);
123 SkScalar kernel[9] = {-1.f, -1.f, -1.f,
132 matrix.setRotate(45.f, 50.f, 50.f);
142 static const float kMatrix[20] = {
143 0.f, 0.f, 0.f, 0.f, 1.f,
144 0.f, 0.f, 0.f, 0.f, 1.f,
145 0.f, 0.f, 0.f, 0.f, 1.f,
146 0.2126f, 0.7152f, 0.0722f, 0.f, 0.f
158 spotTarget.
fY + 50 * sinAzimuth,
161 spotTarget.
fY + 50 * cosAzimuth,
164 diffLocation,
SK_ColorWHITE, 1.f, 2.f, srcToAlpha, cropRect);
167 srcToAlpha, cropRect);
178 enum class Strategy {
194 : fStrategy(strategy)
195 , fFilterWithCropRect(filterWithCropRect)
196 , fMainImage(nullptr)
197 , fAuxImage(nullptr) {}
203 if (fFilterWithCropRect) {
204 name.append(
"_crop");
206 if (fStrategy == Strategy::kSaveLayer) {
220 surface->getCanvas()->drawImageRect(
224 fMainImage =
surface->makeImageSnapshot();
227 fAuxImage =
surface->makeImageSnapshot();
246 const char* filterNames[] = {
264 { -20, -20, 100, 100 },
266 { 20, 20, 100, 100 },
267 { -20, -20, 50, 50 },
277 *errorMsg =
"Requires a direct context.";
280 if (dContext->abandoned()) {
281 *errorMsg =
"Direct context abandoned.";
290 if (!mainImage || !auxImage) {
311 for (
auto clipBound : clipBounds) {
323 this->drawImageWithFilter(canvas, mainImage, auxImage, filters[
i], clipBound,
328 SkIRect* outSubsetBounds =
nullptr;
329 if (fStrategy != Strategy::kSaveLayer) {
330 outSubsetBounds = &outSubset;
332 show_bounds(canvas, &clipBound, &subset, outSubsetBounds);
344 bool fFilterWithCropRect;
356 fFilterWithCropRect ? &
clip :
nullptr);
358 if (fStrategy == Strategy::kSaveLayer) {
366 paint.setImageFilter(filter);
380#if defined(SK_GANESH)
386#if defined(SK_GRAPHITE)
387 if (
auto recorder = canvas->
recorder()){
411 using INHERITED =
GM;
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
constexpr SkColor SK_ColorYELLOW
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorGREEN
constexpr SkColor SK_ColorWHITE
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
#define SkDegreesToRadians(degrees)
#define SkScalarSin(radians)
#define SkScalarCos(radians)
void onOnceBeforeDraw() override
SkISize getISize() override
DrawResult onDraw(SkCanvas *canvas, SkString *errorMsg) override
SkString getName() const override
ImageMakeWithFilterGM(Strategy strategy, bool filterWithCropRect=false)
int saveLayer(const SkRect *bounds, const SkPaint *paint)
void drawRect(const SkRect &rect, const SkPaint &paint)
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void translate(SkScalar dx, SkScalar dy)
virtual GrRecordingContext * recordingContext() const
virtual skgpu::graphite::Recorder * recorder() const
@ kStrict_SrcRectConstraint
sample only inside bounds; slower
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
static sk_sp< SkColorFilter > Blend(const SkColor4f &c, sk_sp< SkColorSpace >, SkBlendMode mode)
static sk_sp< SkColorFilter > Matrix(const SkColorMatrix &)
static sk_sp< SkImageFilter > PointLitDiffuse(const SkPoint3 &location, SkColor lightColor, SkScalar surfaceScale, SkScalar kd, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > MatrixConvolution(const SkISize &kernelSize, const SkScalar kernel[], SkScalar gain, SkScalar bias, const SkIPoint &kernelOffset, SkTileMode tileMode, bool convolveAlpha, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > ColorFilter(sk_sp< SkColorFilter > cf, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > DropShadow(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor color, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Erode(SkScalar radiusX, SkScalar radiusY, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Merge(sk_sp< SkImageFilter > *const filters, int count, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Arithmetic(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4, bool enforcePMColor, sk_sp< SkImageFilter > background, sk_sp< SkImageFilter > foreground, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > DisplacementMap(SkColorChannel xChannelSelector, SkColorChannel yChannelSelector, SkScalar scale, sk_sp< SkImageFilter > displacement, sk_sp< SkImageFilter > color, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Image(sk_sp< SkImage > image, const SkRect &srcRect, const SkRect &dstRect, const SkSamplingOptions &sampling)
static sk_sp< SkImageFilter > MatrixTransform(const SkMatrix &matrix, const SkSamplingOptions &sampling, sk_sp< SkImageFilter > input)
static sk_sp< SkImageFilter > Blend(SkBlendMode mode, sk_sp< SkImageFilter > background, sk_sp< SkImageFilter > foreground=nullptr, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Offset(SkScalar dx, SkScalar dy, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Dilate(SkScalar radiusX, SkScalar radiusY, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Tile(const SkRect &src, const SkRect &dst, sk_sp< SkImageFilter > input)
static sk_sp< SkImageFilter > PointLitSpecular(const SkPoint3 &location, SkColor lightColor, SkScalar surfaceScale, SkScalar ks, SkScalar shininess, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
virtual bool isTextureBacked() const =0
static const SkMatrix & I()
void setAntiAlias(bool aa)
@ kStroke_Style
set to stroke geometry
GM(SkColor backgroundColor=SK_ColorWHITE)
static sk_sp< SkImageFilter > tile_factory(sk_sp< SkImage > auxImage, const SkIRect *cropRect)
static void show_bounds(SkCanvas *canvas, const SkIRect *clip, const SkIRect *inSubset, const SkIRect *outSubset)
static sk_sp< SkImageFilter > drop_shadow_factory(sk_sp< SkImage > auxImage, const SkIRect *cropRect)
static sk_sp< SkImageFilter > lighting_factory(sk_sp< SkImage > auxImage, const SkIRect *cropRect)
static sk_sp< SkImageFilter > dilate_factory(sk_sp< SkImage > auxImage, const SkIRect *cropRect)
static sk_sp< SkImageFilter > blur_filter_factory(sk_sp< SkImage > auxImage, const SkIRect *cropRect)
static sk_sp< SkImageFilter > convolution_factory(sk_sp< SkImage > auxImage, const SkIRect *cropRect)
static sk_sp< SkImageFilter > offset_factory(sk_sp< SkImage > auxImage, const SkIRect *cropRect)
static sk_sp< SkImageFilter > blend_factory(sk_sp< SkImage > auxImage, const SkIRect *cropRect)
static sk_sp< SkImageFilter > erode_factory(sk_sp< SkImage > auxImage, const SkIRect *cropRect)
static sk_sp< SkImageFilter > color_filter_factory(sk_sp< SkImage > auxImage, const SkIRect *cropRect)
static sk_sp< SkImageFilter > matrix_factory(sk_sp< SkImage > auxImage, const SkIRect *cropRect)
sk_sp< SkImageFilter >(* FilterFactory)(sk_sp< SkImage > auxImage, const SkIRect *cropRect)
static sk_sp< SkImageFilter > arithmetic_factory(sk_sp< SkImage > auxImage, const SkIRect *cropRect)
static sk_sp< SkImageFilter > displacement_factory(sk_sp< SkImage > auxImage, const SkIRect *cropRect)
SK_API sk_sp< SkImage > MakeWithFilter(sk_sp< SkImage > src, const SkImageFilter *filter, const SkIRect &subset, const SkIRect &clipBounds, SkIRect *outSubset, SkIPoint *offset)
unsigned useCenter Optional< SkMatrix > matrix
PODArray< SkColor > colors
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
DEF_SWITCHES_START aot vmservice shared library name
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
font
Font Metadata and Metrics.
SkSamplingOptions(SkFilterMode::kLinear))
static constexpr SkIPoint Make(int32_t x, int32_t y)
constexpr int32_t height() const
constexpr int32_t width() const
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo MakeN32(int width, int height, SkAlphaType at)
static SkPoint3 Make(SkScalar x, SkScalar y, SkScalar z)
static SkRect Make(const SkISize &size)
static constexpr SkRect MakeWH(float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)