49 return resultSDC->readSurfaceView();
78 sfc->fillWithFP(std::move(
fp));
79 return sfc->readSurfaceView();
90 while (sigmaX || sigmaY) {
100 float stepY = sigmaY;
121 src = sdc->readSurfaceView();
134 const SkIRect* contentArea =
nullptr) {
144 surf->getCanvas()->clipIRect(contentArea->makeOutset(1, 1));
146 surf->getCanvas()->clipIRect(*contentArea);
147 surf->getCanvas()->translate(contentArea->top(), contentArea->left());
148 w = contentArea->width();
149 h = contentArea->height();
157 paint.setAntiAlias(
true);
160 paint.setStrokeWidth(
h/12.f);
162 surf->getCanvas()->drawLine({0.f, 1.f*
h/8.f}, {
w, 1.f*
h/8.f},
paint);
163 paint.setColor( 0xFF71EEB8);
164 surf->getCanvas()->drawLine({0.f, 1.f*
h/4.f}, {
w, 1.f*
h/4.f},
paint);
166 surf->getCanvas()->drawLine({0.f, 3.f*
h/4.f}, {
w, 3.f*
h/4.f},
paint);
168 surf->getCanvas()->drawLine({0.f, 7.f*
h/8.f}, {
w, 7.f*
h/8.f},
paint);
171 paint.setStrokeWidth(
w/12.f);
172 paint.setColor( 0xFFFFA500);
173 surf->getCanvas()->drawLine({1.f*
w/8.f, 0.f}, {1.f*
h/8.f,
h},
paint);
175 surf->getCanvas()->drawLine({1.f*
w/4.f, 0.f}, {1.f*
h/4.f,
h},
paint);
177 surf->getCanvas()->drawLine({3.f*
w/4.f, 0.f}, {3.f*
h/4.f,
h},
paint);
179 surf->getCanvas()->drawLine({7.f*
w/8.f, 0.f}, {7.f*
h/8.f,
h},
paint);
181 auto img = surf->makeImageSnapshot();
191 bool subsetSrc,
bool ref) {
194 *errorMsg =
"Failed to create source image";
208 5.f*srcRect.
width() /8.f,
209 6.f*srcRect.
height()/8.f);
211 int srcW = srcRect.
width();
212 int srcH = srcRect.
height();
215 const std::vector<SkIRect> dstRectSets[] = {
260 const auto& caps = *rContext->
priv().
caps();
269 for (
const auto& dstRectSet : dstRectSets) {
277 static constexpr float kAlpha = 0.2f;
281 {kAlpha, kAlpha, kAlpha, kAlpha});
283 paint.setColorFragmentProcessor(std::move(
fp));
287 for (
const auto& dstRect : dstRectSet) {
290 auto blurFn = ref ? slow_blur : blur;
292 if (
auto blurView = blurFn(rContext,
305 fp = GrBlendFragmentProcessor::Make<SkBlendMode::kSrcOver>(std::move(
fp),
310 fp = GrBlendFragmentProcessor::Make<SkBlendMode::kSrcOver>(std::move(
fp),
312 paint.setColorFragmentProcessor(std::move(
fp));
314 sdc->fillRectToRect(
nullptr,
325 static constexpr float kAlpha = 0.6f;
326 paint.setColor4f({0, kAlpha, 0, kAlpha});
329 stroke.setStrokeWidth(1.f);
338 static constexpr float kAlpha = 0.3f;
339 paint.setColor4f({0, 0, 0, kAlpha});
342 stroke.setStrokeWidth(1.f);
357 return run(rContext, canvas, errorMsg,
false,
false);
361 return run(rContext, canvas, errorMsg,
false,
true);
365 return run(rContext, canvas, errorMsg,
true,
false);
369 return run(rContext, canvas, errorMsg,
true,
true);
389 sdc->clear(
SkColor4f{0.3f, 0.4f, 0.2f, 1});
393 for (
auto blurDirs : {0b01, 0b10, 0b11}) {
397 for (
float sigma : {0.f, 5.f, 25.f, 80.f}) {
398 std::vector<
decltype(blur)*> blurs;
399 blurs.push_back(blur);
401 blurs.push_back(slow_blur);
403 for (
auto b : blurs) {
404 float sigX = sigma*((blurDirs & 0b01) >> 0);
405 float sigY = sigma*((blurDirs & 0b10) >> 1);
412 sdc->drawRect(
nullptr,
419 std::unique_ptr<GrFragmentProcessor>
fp =
421 fp = GrBlendFragmentProcessor::Make<SkBlendMode::kSrcOver>(std::move(
fp),
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static sk_sp< SkImage > make_src_image()
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
constexpr SkPMColor4f SK_PMColor4fWHITE
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
constexpr SkColor SK_ColorYELLOW
constexpr SkColor SK_ColorMAGENTA
constexpr SkColor SK_ColorCYAN
constexpr SkColor SK_ColorTRANSPARENT
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorGREEN
constexpr SkColor SK_ColorDKGRAY
static constexpr GrSamplerState::WrapMode SkTileModeToWrapMode(SkTileMode tileMode)
static constexpr int kSkTileModeCount
const GrCaps * caps() const
static std::unique_ptr< GrFragmentProcessor > ModulateRGBA(std::unique_ptr< GrFragmentProcessor > child, const SkPMColor4f &color)
std::unique_ptr< skgpu::ganesh::SurfaceFillContext > makeSFC(GrImageInfo, std::string_view label, SkBackingFit=SkBackingFit::kExact, int sampleCount=1, skgpu::Mipmapped=skgpu::Mipmapped::kNo, skgpu::Protected=skgpu::Protected::kNo, GrSurfaceOrigin=kTopLeft_GrSurfaceOrigin, skgpu::Budgeted=skgpu::Budgeted::kYes)
GrRecordingContextPriv priv()
static const GrStyle & SimpleHairline()
static std::unique_ptr< GrFragmentProcessor > MakeSubset(GrSurfaceProxyView, SkAlphaType, const SkMatrix &, GrSamplerState, const SkRect &subset, const GrCaps &caps, const float border[4]=kDefaultBorder, bool alwaysUseShaderTileMode=false)
static std::unique_ptr< GrFragmentProcessor > Make(GrSurfaceProxyView, SkAlphaType, const SkMatrix &=SkMatrix::I(), GrSamplerState::Filter=GrSamplerState::Filter::kNearest, GrSamplerState::MipmapMode mipmapMode=GrSamplerState::MipmapMode::kNone)
static SkMatrix Translate(SkScalar dx, SkScalar dy)
static const SkMatrix & I()
@ kStroke_Style
set to stroke geometry
static constexpr char kErrorMsg_DrawSkippedGpuOnly[]
std::unique_ptr< skgpu::ganesh::SurfaceDrawContext > GaussianBlur(GrRecordingContext *rContext, GrSurfaceProxyView srcView, GrColorType srcColorType, SkAlphaType srcAlphaType, sk_sp< SkColorSpace > colorSpace, SkIRect dstBounds, SkIRect srcBounds, float sigmaX, float sigmaY, SkTileMode mode, SkBackingFit fit)
Optional< SkRect > bounds
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 mode
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
SurfaceDrawContext * TopDeviceSurfaceDrawContext(const SkCanvas *canvas)
std::tuple< GrSurfaceProxyView, GrColorType > AsView(GrRecordingContext *rContext, const SkImage *img, skgpu::Mipmapped mipmapped, GrImageTexGenPolicy policy)
static constexpr float kMaxLinearBlurSigma
int BlurSigmaRadius(float sigma)
static DrawResult do_very_large_blur_gm(GrRecordingContext *rContext, SkCanvas *canvas, SkString *errorMsg, GrSurfaceProxyView src, SkIRect srcB)
static GM::DrawResult run(GrRecordingContext *rContext, SkCanvas *canvas, SkString *errorMsg, bool subsetSrc, bool ref)
DEF_SIMPLE_GPU_GM_CAN_FAIL(clear_swizzle, rContext, canvas, errorMsg, 6 *kSize, 2 *kSize)
static bool constexpr kShowSlowRefImages
SIN Vec< N, float > sqrt(const Vec< N, float > &x)
constexpr int32_t x() const
SkIRect makeOutset(int32_t dx, int32_t dy) const
constexpr int32_t y() const
constexpr SkISize size() const
constexpr int32_t height() const
static constexpr SkIRect MakeSize(const SkISize &size)
constexpr int32_t width() const
constexpr SkIRect makeOffset(int32_t dx, int32_t dy) const
constexpr SkIPoint topLeft() const
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
void outset(int32_t dx, int32_t dy)
static constexpr SkIRect MakePtSize(SkIPoint pt, SkISize size)
constexpr int32_t width() const
constexpr int32_t height() const
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
constexpr float y() const
constexpr float x() const
static SkRect Make(const SkISize &size)
SkRect makeOutset(float dx, float dy) const