Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
crbug_905548.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2018 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "gm/gm.h"
15#include "include/core/SkRect.h"
19
20DEF_SIMPLE_GM(crbug_905548, canvas, 100, 200) {
21 auto surface = canvas->makeSurface(SkImageInfo::MakeN32Premul(100, 100));
22 if (!surface) {
24 }
25 surface->getCanvas()->clear(0);
26 surface->getCanvas()->drawCircle(50, 50, 45, SkPaint());
27 auto imageSource = SkImageFilters::Image(surface->makeImageSnapshot(), SkFilterMode::kNearest);
28
29 auto blurred = SkImageFilters::Blur(15, 15, imageSource);
30 auto eroded = SkImageFilters::Erode(0, 0, blurred);
31 auto blended = SkImageFilters::Blend(SkBlendMode::kDstOut, eroded, imageSource, nullptr);
32
34 paint.setImageFilter(blended);
35 canvas->drawRect(SkRect::MakeWH(100, 100), paint);
36
37 auto mult = SkImageFilters::Arithmetic(1, 0, 0, 0, false, eroded, imageSource, nullptr);
38 paint.setImageFilter(mult);
39 canvas->translate(0, 100);
40 canvas->drawRect(SkRect::MakeWH(100, 100), paint);
41}
@ kDstOut
r = d * (1-sa)
static sk_sp< SkImageFilter > Erode(SkScalar radiusX, SkScalar radiusY, sk_sp< SkImageFilter > input, 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 > Image(sk_sp< SkImage > image, const SkRect &srcRect, const SkRect &dstRect, const SkSamplingOptions &sampling)
static sk_sp< SkImageFilter > Blend(SkBlendMode mode, sk_sp< SkImageFilter > background, sk_sp< SkImageFilter > foreground=nullptr, const CropRect &cropRect={})
const Paint & paint
VkSurfaceKHR surface
Definition main.cc:49
#define DEF_SIMPLE_GM(NAME, CANVAS, W, H)
Definition gm.h:50
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
static SkImageInfo MakeN32Premul(int width, int height)
static constexpr SkRect MakeWH(float w, float h)
Definition SkRect.h:609