92#include <initializer_list>
115 if (!viewMatrix.
invert(&inverse)) {
123 matrix.preConcat(viewMatrix);
124 paint.setCoverageFragmentProcessor(
145 drawRect.
fTop - origDevBounds.
fTop},
155 origDevBounds.
fTop + drawRectData->fOffset.fY,
156 drawRectData->fSize.fWidth,
157 drawRectData->fSize.fHeight);
164 const SkIRect& unclippedDevShapeBounds,
176 if (
key->isValid()) {
177 std::tie(filteredMaskView,
data) = threadSafeCache->findWithData(*
key);
180 if (filteredMaskView) {
208 if (!
as_MFB(filter)->filterMask(&dstM, srcM, viewMatrix,
nullptr)) {
229 if (!filteredMaskView) {
237 if (
key->isValid()) {
238 key->setCustomData(
create_data(*drawRect, unclippedDevShapeBounds));
239 std::tie(filteredMaskView,
data) = threadSafeCache->addWithData(*
key, filteredMaskView);
245 return filteredMaskView;
293 SkMatrix viewMatrix = origViewMatrix;
310 matrix.mapRect(&shapeDevBounds, shapeBounds);
316 static constexpr int32_t
kMaxInt = 2147483520;
335 SkIRect* unclippedDevShapeBounds,
338 *devClipBounds =
clip ?
clip->getConservativeBounds()
374 const SkIRect& devSpaceShapeBounds,
384 *maskRect = devSpaceShapeBounds;
389 float sigma3 = 3 * xformedSigma;
405 if (devSpaceShapeBounds.
width() <= kMIN_GPU_BLUR_SIZE &&
406 devSpaceShapeBounds.
height() <= kMIN_GPU_BLUR_SIZE &&
407 xformedSigma <= kMIN_GPU_BLUR_SIGMA) {
422 float* textureRadius) {
423 float circleR = circle.
width() / 2.0f;
432 SkScalar sigmaToCircleRRatio = sigma / circleR;
437 sigmaToCircleRRatio =
std::min(sigmaToCircleRRatio, 8.f);
438 SkFixed sigmaToCircleRRatioFixed;
439 static const SkScalar kHalfPlaneThreshold = 0.1f;
440 bool useHalfPlaneApprox =
false;
441 if (sigmaToCircleRRatio <= kHalfPlaneThreshold) {
442 useHalfPlaneApprox =
true;
443 sigmaToCircleRRatioFixed = 0;
444 *solidRadius = circleR - 3 * sigma;
445 *textureRadius = 6 * sigma;
451 sigmaToCircleRRatioFixed &= ~0xff;
453 sigma = circleR * sigmaToCircleRRatio;
455 *textureRadius = circleR + 3 * sigma;
458 static constexpr int kProfileTextureWidth = 512;
467 builder[0] = sigmaToCircleRRatioFixed;
478 if (useHalfPlaneApprox) {
491 profileView = threadSafeCache->add(
key, profileView);
504 std::unique_ptr<GrFragmentProcessor>
profile =
511 "uniform shader blurProfile;"
512 "uniform half4 circleData;"
514 "half4 main(float2 xy) {"
517 "half2 vec = half2((sk_FragCoord.xy - circleData.xy) * circleData.w);"
518 "half dist = length(vec) + (0.5 - circleData.z) * circleData.w;"
519 "return blurProfile.eval(half2(dist, 0.5)).aaaa;"
523 SkV4 circleData = {circle.
centerX(), circle.
centerY(), solidRadius, 1.f / textureRadius};
527 "circleData", circleData);
529 return GrBlendFragmentProcessor::Make<SkBlendMode::kModulate>(std::move(circleBlurFP),
570 view = threadSafeCache->add(
key, view);
581 float transformedSigma) {
607 if (!
m.invert(&invM)) {
626 const float sixSigma = 6 * transformedSigma;
636 float threeSigma = sixSigma / 2;
638 rect.top() + threeSigma,
639 rect.right() - threeSigma,
640 rect.bottom() - threeSigma};
652 "uniform shader integral;"
654 "uniform float4 rect;"
655 "uniform int isFast;"
657 "half4 main(float2 pos) {"
658 "half xCoverage, yCoverage;"
659 "if (bool(isFast)) {"
665 "half2 xy = max(half2(rect.LT - pos), half2(pos - rect.RB));"
666 "xCoverage = integral.eval(half2(xy.x, 0.5)).a;"
667 "yCoverage = integral.eval(half2(xy.y, 0.5)).a;"
684 "half4 rect = half4(half2(rect.LT - pos), half2(pos - rect.RB));"
685 "xCoverage = 1 - integral.eval(half2(rect.L, 0.5)).a"
686 "- integral.eval(half2(rect.R, 0.5)).a;"
687 "yCoverage = 1 - integral.eval(half2(rect.T, 0.5)).a"
688 "- integral.eval(half2(rect.B, 0.5)).a;"
690 "return half4(xCoverage * yCoverage);"
694 std::unique_ptr<GrFragmentProcessor>
fp =
699 "isFast", GrSkSLFP::Specialize<int>(isFast));
701 fp = GrBlendFragmentProcessor::Make<SkBlendMode::kModulate>(std::move(
fp),
717 float xformedSigma) {
742 float xformedSigma) {
749 std::unique_ptr<skgpu::ganesh::SurfaceDrawContext> sdc =
767 sdc->drawRRect(
nullptr,
778 sdc->colorInfo().colorType(),
779 sdc->colorInfo().alphaType(),
787 if (!rtc2 || !rtc2->readSurfaceView()) {
791 auto view = rtc2->readSurfaceView();
794 trampoline->
fProxy = view.asTextureProxyRef();
804 float xformedSigma) {
823 float xformedSigma) {
852 view = threadSafeCache->findOrAdd(
key, lazyView);
853 if (view != lazyView) {
867 threadSafeCache->remove(
key);
871 view = threadSafeCache->find(
key);
883 view = threadSafeCache->add(
key, view);
897 "Unexpected circle. %d\n\t%s\n\t%s",
902 "Unexpected rect. %d\n\t%s\n\t%s",
932 if (!ninePatchable) {
936 std::unique_ptr<GrFragmentProcessor> maskFP =
943 "uniform shader ninePatchFP;"
945 "uniform half cornerRadius;"
946 "uniform float4 proxyRect;"
947 "uniform half blurRadius;"
949 "half4 main(float2 xy) {"
952 "float2 translatedFragPosFloat = sk_FragCoord.xy - proxyRect.LT;"
953 "float2 proxyCenter = (proxyRect.RB - proxyRect.LT) * 0.5;"
954 "half edgeSize = 2.0 * blurRadius + cornerRadius + 0.5;"
959 "translatedFragPosFloat -= proxyCenter;"
963 "half2 fragDirection = half2(sign(translatedFragPosFloat));"
964 "translatedFragPosFloat = abs(translatedFragPosFloat);"
970 "half2 translatedFragPosHalf = half2(translatedFragPosFloat - (proxyCenter - edgeSize));"
973 "translatedFragPosHalf = max(translatedFragPosHalf, 0);"
977 "translatedFragPosHalf *= fragDirection;"
981 "translatedFragPosHalf += half2(edgeSize);"
983 "half2 proxyDims = half2(2.0 * edgeSize);"
984 "half2 texCoord = translatedFragPosHalf / proxyDims;"
986 "return ninePatchFP.eval(texCoord).aaaa;"
997 "cornerRadius", cornerRadius,
998 "proxyRect", proxyRect,
999 "blurRadius", blurRadius);
1001 return GrBlendFragmentProcessor::Make<SkBlendMode::kModulate>(std::move(rrectBlurFP),
1039 if (!shape.
asRRect(&srcRRect, &inverted) || inverted) {
1043 std::unique_ptr<GrFragmentProcessor>
fp;
1046 bool devRRectIsValid = srcRRect.
transform(viewMatrix, &devRRect);
1054 if (canBeRect || canBeCircle) {
1057 srcRRect.
rect(), viewMatrix, xformedSigma);
1060 if (devRRectIsCircle) {
1066 devBounds = {center.x() - radius,
1067 center.y() - radius,
1068 center.x() + radius,
1069 center.y() + radius};
1080 SkScalar outsetX = 3.0f*xformedSigma;
1081 SkScalar outsetY = 3.0f*xformedSigma;
1090 outsetX /=
scale.width();
1091 outsetY /=
scale.height();
1093 srcProxyRect.
outset(outsetX, outsetY);
1095 paint.setCoverageFragmentProcessor(std::move(
fp));
1111 if (!bmf->ignoreXform()) {
1113 srcProxyRect.
outset(3.0f*bmf->sigma(), 3.0f*bmf->sigma());
1114 paint.setCoverageFragmentProcessor(std::move(
fp));
1118 if (!viewMatrix.
invert(&inverse)) {
1126 paint.setCoverageFragmentProcessor(std::move(
fp));
1143 const SkIRect& unclippedDevShapeBounds,
1144 const SkIRect& devClipBounds) {
1146 *boundsForClip = devClipBounds;
1148#ifndef SK_DISABLE_MASKFILTERED_MASK_CACHING
1155 SkIRect clippedMaskRect, unClippedMaskRect;
1156 can_filter_mask(maskFilter, shape, unclippedDevShapeBounds, devClipBounds,
1157 viewMatrix, &clippedMaskRect);
1158 if (clippedMaskRect.
isEmpty()) {
1161 can_filter_mask(maskFilter, shape, unclippedDevShapeBounds, unclippedDevShapeBounds,
1162 viewMatrix, &unClippedMaskRect);
1165 int unclippedWidth = unClippedMaskRect.
width();
1166 int unclippedHeight = unClippedMaskRect.
height();
1167 int64_t unclippedArea =
sk_64_mul(unclippedWidth, unclippedHeight);
1170 if (unclippedArea > 2 * clippedArea || unclippedWidth > maxTextureSize ||
1171 unclippedHeight > maxTextureSize) {
1175 *boundsForClip = unclippedDevShapeBounds;
1182 "Mask Filtered Masks");
1207 builder[4] = fracX | (fracY >> 8) | (styleBits << 16);
1242 SkScalar xformedSigma = bmf->computeXformedSigma(ctm);
1258 if (!surfaceDrawContext || !surfaceDrawContext->asTextureProxy()) {
1262 if (!isNormalBlur) {
1281 surfaceDrawContext->fillPixelsWithLocalMatrix(
nullptr, std::move(
paint),
clipRect,
1285 return surfaceDrawContext->readSurfaceView();
1293 const SkIRect& unclippedDevShapeBounds,
1297 if (!
can_filter_mask(filter, shape, unclippedDevShapeBounds, clipBounds, viewMatrix,
1312 if (
key->isValid()) {
1322 key->setCustomData(
create_data(*maskRect, unclippedDevShapeBounds));
1323 auto [cachedView,
data] = threadSafeCache->findOrAddWithData(*
key, lazyView);
1324 if (cachedView != lazyView) {
1327 SkASSERT(cachedView.asTextureProxy());
1335 std::unique_ptr<skgpu::ganesh::SurfaceDrawContext> maskSDC(
1338 if (
key->isValid()) {
1343 threadSafeCache->remove(*
key);
1348 auto filteredMaskView =
filter_mask(dContext, filter,
1349 maskSDC->readSurfaceView(),
1350 maskSDC->colorInfo().colorType(),
1351 maskSDC->colorInfo().alphaType(),
1354 if (!filteredMaskView) {
1355 if (
key->isValid()) {
1359 threadSafeCache->remove(*
key);
1364 if (
key->isValid()) {
1369 trampoline->fProxy = filteredMaskView.asTextureProxyRef();
1373 return filteredMaskView;
1390 if (styleScale == 0) {
1395 if (tmpShape->isEmpty()) {
1399 shape = tmpShape.
get();
1407 assert_alive(
paint);
1413 SkIRect unclippedDevShapeBounds, devClipBounds;
1415 &unclippedDevShapeBounds, &devClipBounds)) {
1417 if (!inverseFilled) {
1426 viewMatrix, inverseFilled,
1428 unclippedDevShapeBounds,
1438 viewMatrix, *shape, maskFilter,
1439 unclippedDevShapeBounds, boundsForClip,
1440 &maskRect, &maskKey);
1441 if (filteredMaskView) {
1443 std::move(filteredMaskView))) {
1447 assert_alive(
paint);
1453 viewMatrix, *shape, maskFilter,
1454 unclippedDevShapeBounds, boundsForClip,
1455 &maskRect, &maskKey);
1456 if (filteredMaskView) {
1458 std::move(filteredMaskView))) {
1461 assert_alive(
paint);
1476 SkScalar srcBlurRadius = 3.0f * sigma;
1490 if (devOrig.
fLeft + devLeft + devBlurRadius >= devOrig.
fRight - devRight - devBlurRadius ||
1491 devOrig.
fTop + devTop + devBlurRadius >= devOrig.
fBottom - devBot - devBlurRadius) {
1500 const SkScalar srcLeft = std::max<SkScalar>(srcRadiiUL.
fX, srcRadiiLL.
fX);
1501 const SkScalar srcTop = std::max<SkScalar>(srcRadiiUL.
fY, srcRadiiUR.
fY);
1502 const SkScalar srcRight = std::max<SkScalar>(srcRadiiUR.
fX, srcRadiiLR.
fX);
1503 const SkScalar srcBot = std::max<SkScalar>(srcRadiiLL.
fY, srcRadiiLR.
fY);
1505 int newRRWidth = 2 * devBlurRadius + devLeft + devRight + 1;
1506 int newRRHeight = 2 * devBlurRadius + devTop + devBot + 1;
1507 widthHeight->
fWidth = newRRWidth + 2 * devBlurRadius;
1508 widthHeight->
fHeight = newRRHeight + 2 * devBlurRadius;
1512 rectXs[0] = srcProxyRect.
fLeft;
1513 rectXs[1] = srcProxyRect.
fLeft + 2 * srcBlurRadius + srcLeft;
1514 rectXs[2] = srcProxyRect.
fRight - 2 * srcBlurRadius - srcRight;
1515 rectXs[3] = srcProxyRect.
fRight;
1517 rectYs[0] = srcProxyRect.
fTop;
1518 rectYs[1] = srcProxyRect.
fTop + 2 * srcBlurRadius + srcTop;
1519 rectYs[2] = srcProxyRect.
fBottom - 2 * srcBlurRadius - srcBot;
1520 rectYs[3] = srcProxyRect.
fBottom;
1523 texXs[1] = 2.0f * devBlurRadius + devLeft;
1524 texXs[2] = 2.0f * devBlurRadius + devLeft + 1;
1528 texYs[1] = 2.0f * devBlurRadius + devTop;
1529 texYs[2] = 2.0f * devBlurRadius + devTop + 1;
1554 viewMatrix,
as_MFB(mf), shape);
1586enum class Direction { kX, kY };
1588std::unique_ptr<GrFragmentProcessor> make_texture_effect(
const GrCaps* caps,
1593 const SkIRect& srcRelativeDstRect,
1609 domain.
inset(0.5f, 0.5f);
1633 Direction direction,
1638 auto srcRect = dstRect.
makeOffset(dstToSrcOffset);
1647 direction == Direction::kY ? radius : 0};
1648 std::unique_ptr<GrFragmentProcessor> child = make_texture_effect(sfc->
caps(),
1663 "child", std::move(child));
1692 "SurfaceDrawContext_ConvolveGaussian2d",
1703 const SkISize radii{radiusX, radiusY};
1710 auto child = make_texture_effect(sdc->caps(),
1723 "child", std::move(child));
1726 paint.setColorFragmentProcessor(std::move(conv));
1732 sdc->fillRectToRect(
nullptr,
1749 Direction direction,
1769 "SurfaceDrawContext_ConvolveGaussian",
1778 auto rtcToSrcOffset = dstBounds.
topLeft();
1786 srcBounds.
contains(srcBackingBounds) &&
1789 if (!canSplit || canHWTile) {
1816 top = {dstBounds.
left(), dstBounds.
top(), dstBounds.
right(), srcBounds.
top()};
1823 mid = {srcBounds.
left() + radius, midA, srcBounds.
right() - radius, midB};
1835 top = {dstBounds.
left(), dstBounds.
top(), srcBounds.
left(), dstBounds.
bottom()};
1840 mid = {midA, srcBounds.
top() + radius, midB, srcBounds.
bottom() - radius};
1852 rect.offset(-rtcToSrcOffset);
1866 rect.offset(-rtcToSrcOffset);
1919static std::unique_ptr<skgpu::ganesh::SurfaceDrawContext>
reexpand(
1921 std::unique_ptr<skgpu::ganesh::SurfaceContext>
src,
1934#if defined(SK_USE_PADDED_BLUR_UPSCALE)
1946 std::move(colorSpace),
1950 "SurfaceDrawContext_Reexpand",
1964#
if defined(SK_USE_PADDED_BLUR_UPSCALE)
1971 paint.setColorFragmentProcessor(std::move(
fp));
1974 dstSDC->fillRectToRect(
1995 std::unique_ptr<skgpu::ganesh::SurfaceDrawContext> dstSDC;
2002 SkIRect xPassDstBounds = dstBounds;
2004 xPassDstBounds.
outset(0, radiusY);
2006 int srcH = srcBounds.
height();
2007 int srcTop = srcBounds.
top();
2013 float floatH = srcH;
2016 int topClip = srcTop + n * srcH;
2021 int bottomClip = srcBounds.
bottom() + n * srcH;
2026 if (xPassDstBounds.
fBottom <= srcBounds.
top()) {
2030 xPassDstBounds.
fTop = srcBounds.
top();
2032 }
else if (xPassDstBounds.
fTop >= srcBounds.
bottom()) {
2042 int leftSrcEdge = srcBounds.
fLeft - radiusX;
2043 int rightSrcEdge = srcBounds.
fRight + radiusX;
2050 if (xPassDstBounds.
fRight <= leftSrcEdge) {
2058 if (xPassDstBounds.
fLeft >= rightSrcEdge) {
2083 srcView = dstSDC->readSurfaceView();
2103 std::move(colorSpace),
2119 TRACE_EVENT2(
"skia.gpu",
"GaussianBlur",
"sigmaX", sigmaX,
"sigmaY", sigmaY);
2126 if (dstBounds.
width() > maxRenderTargetSize || dstBounds.
height() > maxRenderTargetSize) {
2138 if (!intersection.
intersect(reach, srcBounds)) {
2154 srcBounds = intersection;
2162 if (srcBounds.
width() == 1) {
2166 if (srcBounds.
height() == 1) {
2174 if (!radiusX && !radiusY) {
2180 std::move(colorSpace),
2184 "SurfaceDrawContext_GaussianBlur",
2208 if (sigmaX <= kMaxSigma && sigmaY <= kMaxSigma) {
2212 if (radiusX > 0 && radiusY > 0 &&
2226 std::move(colorSpace),
2237 std::move(colorSpace),
2248 GrColorInfo colorInfo(srcColorType, srcAlphaType, colorSpace);
2249 auto srcCtx = rContext->
priv().
makeSC(srcView, colorInfo);
2252#if defined(SK_USE_PADDED_BLUR_UPSCALE)
2276 float scaleX = sigmaX > kMaxSigma ? kMaxSigma / sigmaX : 1.f;
2277 float scaleY = sigmaY > kMaxSigma ? kMaxSigma / sigmaY : 1.f;
2284 scaleX =
static_cast<float>(rescaledSize.
width()) / srcBounds.
width();
2285 scaleY =
static_cast<float>(rescaledSize.
height()) / srcBounds.
height();
2289#if !defined(SK_USE_PADDED_BLUR_UPSCALE)
2302 srcCtx->recordingContext(),
2306 {rescaledSize.width() + 2 * padX, rescaledSize.height() + 2 * padY},
2308 "RescaledSurfaceDrawContext",
2311 srcCtx->asSurfaceProxy()->isProtected(),
2319 if (!srcCtx->rescaleInto(rescaledSDC.get(),
2332 rescaledSDC->drawTexture(
nullptr,
2333 srcCtx->readSurfaceView(),
2342 SkCanvas::SrcRectConstraint::kFast_SrcRectConstraint,
2346 auto [dw, dh] = rescaledSize;
2348 float sLCol = srcBounds.
left();
2349 float sTRow = srcBounds.
top();
2350 float sRCol = srcBounds.
right() - 1;
2351 float sBRow = srcBounds.
bottom() - 1;
2353 int sx = srcBounds.
left();
2354 int sy = srcBounds.
top();
2355 int sw = srcBounds.
width();
2374 srcView = rescaledSDC->readSurfaceView();
2376 rescaledSDC.
reset();
2383 scaledDstBounds.
fLeft *= scaleX;
2384 scaledDstBounds.
fTop *= scaleY;
2385 scaledDstBounds.
fRight *= scaleX;
2386 scaledDstBounds.
fBottom *= scaleY;
2388 scaledDstBounds.
offset(padX, padY);
2393#if defined(SK_USE_PADDED_BLUR_UPSCALE)
2394 static constexpr int kDstPadding = 1;
2396 static constexpr int kDstPadding = 0;
2398 auto scaledDstBoundsI = scaledDstBounds.
roundOut();
2399 scaledDstBoundsI.outset(kDstPadding, kDstPadding);
2417 SkASSERT(sdc->width() == scaledDstBoundsI.width() &&
2418 sdc->height() == scaledDstBoundsI.height());
2422 scaledDstBounds.
offset(-scaledDstBoundsI.left(), -scaledDstBoundsI.top());
2427 std::move(colorSpace),
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
@ kTopLeft_GrSurfaceOrigin
bool GrIsStrokeHairlineOrEquivalent(const GrStyle &style, const SkMatrix &matrix, SkScalar *outCoverage)
@ kUnknown_SkAlphaType
uninitialized
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
#define SkASSERTF(cond, fmt,...)
@ kOuter_SkBlurStyle
nothing inside, fuzzy outside
@ kSolid_SkBlurStyle
solid inside, fuzzy outside
@ kInner_SkBlurStyle
fuzzy inside, nothing outside
@ kNormal_SkBlurStyle
fuzzy inside and outside
constexpr SkPMColor4f SK_PMColor4fWHITE
constexpr SkPMColor4f SK_PMColor4fTRANSPARENT
#define SkScalarToFixed(x)
#define SkFixedToScalar(x)
static uint32_t SkFloat2Bits(float value)
#define sk_float_floor2int_no_saturate(x)
#define sk_float_ceil2int_no_saturate(x)
static bool SkIsFinite(T x, Pack... values)
#define sk_float_floor2int(x)
std::tuple< GrSurfaceProxyView, GrColorType > GrMakeUncachedBitmapProxyView(GrRecordingContext *rContext, const SkBitmap &bitmap, skgpu::Mipmapped mipmapped, SkBackingFit fit, skgpu::Budgeted budgeted)
bool SkPaintToGrPaint(GrRecordingContext *context, const GrColorInfo &dstColorInfo, const SkPaint &skPaint, const SkMatrix &ctm, const SkSurfaceProps &surfaceProps, GrPaint *grPaint)
static constexpr GrSamplerState::WrapMode SkTileModeToWrapMode(SkTileMode tileMode)
SkMaskFilterBase * as_MFB(SkMaskFilter *mf)
std::unique_ptr< uint8_t, SkFunctionObject< SkMaskBuilder::FreeImage > > SkAutoMaskFreeImage
static int64_t sk_64_mul(int64_t a, int64_t b)
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
SkRuntimeEffect * SkMakeRuntimeEffect(SkRuntimeEffect::Result(*make)(SkString, const SkRuntimeEffect::Options &), const char *sksl, SkRuntimeEffect::Options options=SkRuntimeEffect::Options{})
#define SkScalarRoundToInt(x)
#define SkScalarCeilToInt(x)
#define SK_ScalarNearlyZero
static bool SkScalarIsInt(SkScalar x)
#define SK_ScalarInfinity
static SkScalar SkScalarFraction(SkScalar x)
#define SkScalarCeilToScalar(x)
#define SK_ScalarNegativeInfinity
const GrCaps * caps() const
bool reducedShaderMode() const
const GrShaderCaps * shaderCaps() const
int maxTextureSize() const
int maxRenderTargetSize() const
bool clampToBorderSupport() const
sk_sp< SkColorSpace > refColorSpace() const
GrColorType colorType() const
virtual GrDirectContext * asDirectContext()
GrDirectContextPriv priv()
static std::unique_ptr< GrFragmentProcessor > DeviceSpace(std::unique_ptr< GrFragmentProcessor >)
static std::unique_ptr< GrFragmentProcessor > Make(const SkMatrix &matrix, std::unique_ptr< GrFragmentProcessor > child)
void setCoverageSetOpXPFactory(SkRegion::Op, bool invertCoverage=false)
GrThreadSafeCache * threadSafeCache()
std::unique_ptr< skgpu::ganesh::SurfaceContext > makeSC(GrSurfaceProxyView readView, const GrColorInfo &)
GrRecordingContextPriv priv()
bool abandoned() override
@ kCompatibleWithCoverageAsAlpha
static GrIgnoreOptFlags IgnoreOptFlags(std::unique_ptr< GrFragmentProcessor > child)
static std::unique_ptr< GrSkSLFP > Make(const SkRuntimeEffect *effect, const char *name, std::unique_ptr< GrFragmentProcessor > inputFP, OptFlags optFlags, Args &&... args)
@ kPathEffectAndStrokeRec
bool isSimpleHairline() const
static const GrStyle & SimpleFill()
static SkScalar MatrixToScaleFactor(const SkMatrix &matrix)
bool isSimpleFill() const
const SkStrokeRec & strokeRec() const
void asPath(SkPath *out) const
void writeUnstyledKey(uint32_t *key) const
int unstyledKeySize() const
bool asRRect(SkRRect *rrect, bool *inverted) const
bool hasUnstyledKey() const
bool inverseFilled() const
const GrStyle & style() const
SkRect styledBounds() const
GrStyledShape applyStyle(GrStyle::Apply apply, SkScalar scale) const
skgpu::Swizzle swizzle() const
void concatSwizzle(skgpu::Swizzle swizzle)
GrTextureProxy * asTextureProxy() const
SkISize dimensions() const
GrSurfaceOrigin origin() const
GrSurfaceProxy * proxy() const
SkISize backingStoreDimensions() const
GrProtected isProtected() const
SkISize dimensions() const
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 constexpr float kDefaultBorder[4]
static std::unique_ptr< GrFragmentProcessor > Make(GrSurfaceProxyView, SkAlphaType, const SkMatrix &=SkMatrix::I(), GrSamplerState::Filter=GrSamplerState::Filter::kNearest, GrSamplerState::MipmapMode mipmapMode=GrSamplerState::MipmapMode::kNone)
sk_sp< GrTextureProxy > fProxy
static std::tuple< GrSurfaceProxyView, sk_sp< Trampoline > > CreateLazyView(GrDirectContext *, GrColorType, SkISize dimensions, GrSurfaceOrigin, SkBackingFit)
bool installPixels(const SkImageInfo &info, void *pixels, size_t rowBytes, void(*releaseProc)(void *addr, void *context), void *context)
SkScalar computeXformedSigma(const SkMatrix &ctm) const
static sk_sp< SkData > MakeWithCopy(const void *data, size_t length)
static bool DrawToMask(const SkPath &devPath, const SkIRect &clipBounds, const SkMaskFilter *, const SkMatrix *filterMatrix, SkMaskBuilder *dst, SkMaskBuilder::CreateMode mode, SkStrokeRec::InitStyle style)
virtual bool asABlur(BlurRec *) const
virtual Type type() const =0
static SkMatrix Scale(SkScalar sx, SkScalar sy)
SkMatrix & postTranslate(SkScalar dx, SkScalar dy)
static constexpr int kMScaleX
horizontal scale factor
static constexpr int kMTransY
vertical translation
static SkMatrix Translate(SkScalar dx, SkScalar dy)
bool preservesRightAngles(SkScalar tol=SK_ScalarNearlyZero) const
void mapPoints(SkPoint dst[], const SkPoint src[], int count) const
bool invert(SkMatrix *inverse) const
bool rectStaysRect() const
SkScalar getScaleX() const
static const SkMatrix & I()
bool decomposeScale(SkSize *scale, SkMatrix *remaining=nullptr) const
SkScalar getScaleY() const
bool isScaleTranslate() const
static constexpr int kMTransX
horizontal translation
static constexpr int kMSkewY
vertical skew factor
SkScalar get(int index) const
static constexpr int kMScaleY
vertical scale factor
bool preservesAxisAlignment() const
bool isSimilarity(SkScalar tol=SK_ScalarNearlyZero) const
static constexpr int kMSkewX
horizontal skew factor
bool mapRect(SkRect *dst, const SkRect &src, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
void mapVector(SkScalar dx, SkScalar dy, SkVector *result) const
void transform(const SkMatrix &matrix, SkPath *dst, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
static bool IsSimpleCircular(const SkRRect &rr)
static SkVector GetSimpleRadii(const SkRRect &rr)
static bool AllCornersCircular(const SkRRect &rr, SkScalar tolerance=SK_ScalarNearlyZero)
static bool IsCircle(const SkRRect &rr)
const SkRect & rect() const
SkVector radii(Corner corner) const
SkString dumpToString(bool asHex) const
@ kUpperLeft_Corner
index of top-left corner radii
@ kLowerRight_Corner
index of bottom-right corner radii
@ kUpperRight_Corner
index of top-right corner radii
@ kLowerLeft_Corner
index of bottom-left corner radii
bool transform(const SkMatrix &matrix, SkRRect *dst) const
void setRectRadii(const SkRect &rect, const SkVector radii[4])
const SkRect & getBounds() const
@ kUnion_Op
target unioned with operand
@ kReplace_Op
replace target with operand
@ kIntersect_Op
target intersected with operand
@ kDifference_Op
target minus operand
static Result MakeForShader(SkString sksl, const Options &)
const char * c_str() const
SkPaint::Cap getCap() const
T * init(Args &&... args)
static Domain GenerateDomain()
const GrCaps * caps() const
const GrColorInfo & colorInfo() const
void fillPixelsWithLocalMatrix(const GrClip *clip, GrPaint &&paint, const SkIRect &bounds, const SkMatrix &localMatrix)
void drawShape(const GrClip *, GrPaint &&, GrAA, const SkMatrix &viewMatrix, GrStyledShape &&)
GrAA chooseAA(const SkPaint &paint)
const SkSurfaceProps & surfaceProps() const
static std::unique_ptr< SurfaceDrawContext > Make(GrRecordingContext *, GrColorType, sk_sp< GrSurfaceProxy >, sk_sp< SkColorSpace >, GrSurfaceOrigin, const SkSurfaceProps &)
void drawRect(const GrClip *, GrPaint &&paint, GrAA, const SkMatrix &viewMatrix, const SkRect &, const GrStyle *style=nullptr)
static std::unique_ptr< SurfaceDrawContext > MakeWithFallback(GrRecordingContext *, GrColorType, sk_sp< SkColorSpace >, SkBackingFit, SkISize dimensions, const SkSurfaceProps &, int sampleCnt, skgpu::Mipmapped, skgpu::Protected, GrSurfaceOrigin=kBottomLeft_GrSurfaceOrigin, skgpu::Budgeted=skgpu::Budgeted::kYes)
void fillRectToRectWithFP(const SkRect &srcRect, const SkIRect &dstRect, std::unique_ptr< GrFragmentProcessor > fp)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
static void mask_release_proc(void *addr, void *)
static std::unique_ptr< skgpu::ganesh::SurfaceDrawContext > two_pass_gaussian(GrRecordingContext *rContext, GrSurfaceProxyView srcView, GrColorType srcColorType, SkAlphaType srcAlphaType, sk_sp< SkColorSpace > colorSpace, SkIRect srcBounds, SkIRect dstBounds, float sigmaX, float sigmaY, int radiusX, int radiusY, SkTileMode mode, SkBackingFit fit)
static constexpr int kBlurRRectMaxDivisions
static std::unique_ptr< GrFragmentProcessor > make_rrect_blur(GrRecordingContext *context, float sigma, float xformedSigma, const SkRRect &srcRRect, const SkRRect &devRRect)
static SkIRect extract_draw_rect_from_data(SkData *data, const SkIRect &origDevBounds)
static std::unique_ptr< skgpu::ganesh::SurfaceDrawContext > create_mask_GPU(GrRecordingContext *rContext, const SkIRect &maskRect, const SkMatrix &origViewMatrix, const GrStyledShape &shape, int sampleCnt)
bool ComputeBlurredRRectParams(const SkRRect &srcRRect, const SkRRect &devRRect, SkScalar sigma, SkScalar xformedSigma, SkRRect *rrectToDraw, SkISize *widthHeight, SkScalar rectXs[kBlurRRectMaxDivisions], SkScalar rectYs[kBlurRRectMaxDivisions], SkScalar texXs[kBlurRRectMaxDivisions], SkScalar texYs[kBlurRRectMaxDivisions])
static bool get_unclipped_shape_dev_bounds(const GrStyledShape &shape, const SkMatrix &matrix, SkIRect *devBounds)
static bool draw_mask(skgpu::ganesh::SurfaceDrawContext *sdc, const GrClip *clip, const SkMatrix &viewMatrix, const SkIRect &maskBounds, GrPaint &&paint, GrSurfaceProxyView mask)
static GrSurfaceProxyView filter_mask(GrRecordingContext *context, const SkMaskFilterBase *maskFilter, GrSurfaceProxyView srcView, GrColorType srcColorType, SkAlphaType srcAlphaType, const SkMatrix &ctm, const SkIRect &maskRect)
void DrawShapeWithMaskFilter(GrRecordingContext *rContext, skgpu::ganesh::SurfaceDrawContext *sdc, const GrClip *clip, const GrStyledShape &shape, GrPaint &&paint, const SkMatrix &viewMatrix, const SkMaskFilter *mf)
static std::unique_ptr< skgpu::ganesh::SurfaceDrawContext > reexpand(GrRecordingContext *rContext, std::unique_ptr< skgpu::ganesh::SurfaceContext > src, const SkRect &srcBounds, SkISize dstSize, sk_sp< SkColorSpace > colorSpace, SkBackingFit fit)
static std::unique_ptr< GrFragmentProcessor > make_circle_blur(GrRecordingContext *context, const SkRect &circle, float sigma)
static bool can_filter_mask(const SkMaskFilterBase *maskFilter, const GrStyledShape &shape, const SkIRect &devSpaceShapeBounds, const SkIRect &clipBounds, const SkMatrix &ctm, SkIRect *maskRect)
static constexpr auto kMaskOrigin
static GrSurfaceProxyView sw_create_filtered_mask(GrRecordingContext *rContext, const SkMatrix &viewMatrix, const GrStyledShape &shape, const SkMaskFilter *filter, const SkIRect &unclippedDevShapeBounds, const SkIRect &clipBounds, SkIRect *drawRect, skgpu::UniqueKey *key)
static std::unique_ptr< skgpu::ganesh::SurfaceDrawContext > convolve_gaussian(GrRecordingContext *rContext, GrSurfaceProxyView srcView, GrColorType srcColorType, SkAlphaType srcAlphaType, SkIRect srcBounds, SkIRect dstBounds, Direction direction, int radius, float sigma, SkTileMode mode, sk_sp< SkColorSpace > finalCS, SkBackingFit fit)
static void draw_shape_with_mask_filter(GrRecordingContext *rContext, skgpu::ganesh::SurfaceDrawContext *sdc, const GrClip *clip, GrPaint &&paint, const SkMatrix &viewMatrix, const SkMaskFilterBase *maskFilter, const GrStyledShape &origShape)
static bool compute_key_and_clip_bounds(skgpu::UniqueKey *maskKey, SkIRect *boundsForClip, const GrCaps *caps, const SkMatrix &viewMatrix, bool inverseFilled, const SkMaskFilterBase *maskFilter, const GrStyledShape &shape, const SkIRect &unclippedDevShapeBounds, const SkIRect &devClipBounds)
static bool clip_bounds_quick_reject(const SkIRect &clipBounds, const SkIRect &rect)
static constexpr auto kBlurredRRectMaskOrigin
static std::unique_ptr< GrFragmentProcessor > make_rect_blur(GrRecordingContext *context, const GrShaderCaps &caps, const SkRect &srcRect, const SkMatrix &viewMatrix, float transformedSigma)
static GrSurfaceProxyView hw_create_filtered_mask(GrDirectContext *dContext, skgpu::ganesh::SurfaceDrawContext *sdc, const SkMatrix &viewMatrix, const GrStyledShape &shape, const SkMaskFilterBase *filter, const SkIRect &unclippedDevShapeBounds, const SkIRect &clipBounds, SkIRect *maskRect, skgpu::UniqueKey *key)
static std::unique_ptr< skgpu::ganesh::SurfaceDrawContext > convolve_gaussian_2d(GrRecordingContext *rContext, GrSurfaceProxyView srcView, GrColorType srcColorType, const SkIRect &srcBounds, const SkIRect &dstBounds, int radiusX, int radiusY, SkScalar sigmaX, SkScalar sigmaY, SkTileMode mode, sk_sp< SkColorSpace > finalCS, SkBackingFit dstFit)
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)
static std::unique_ptr< GrFragmentProcessor > find_or_create_rrect_blur_mask_fp(GrRecordingContext *rContext, const SkRRect &rrectToDraw, const SkISize &dimensions, float xformedSigma)
static bool direct_filter_mask(GrRecordingContext *context, const SkMaskFilterBase *maskFilter, skgpu::ganesh::SurfaceDrawContext *sdc, GrPaint &&paint, const GrClip *clip, const SkMatrix &viewMatrix, const GrStyledShape &shape)
static GrSurfaceProxyView create_mask_on_cpu(GrRecordingContext *rContext, const SkRRect &rrectToDraw, const SkISize &dimensions, float xformedSigma)
static sk_sp< SkData > create_data(const SkIRect &drawRect, const SkIRect &origDevBounds)
static bool get_shape_and_clip_bounds(skgpu::ganesh::SurfaceDrawContext *sdc, const GrClip *clip, const GrStyledShape &shape, const SkMatrix &matrix, SkIRect *unclippedDevShapeBounds, SkIRect *devClipBounds)
static void make_blurred_rrect_key(skgpu::UniqueKey *key, const SkRRect &rrectToDraw, float xformedSigma)
static bool fillin_view_on_gpu(GrDirectContext *dContext, const GrSurfaceProxyView &lazyView, GrThreadSafeCache::Trampoline *trampoline, const SkRRect &rrectToDraw, const SkISize &dimensions, float xformedSigma)
static std::unique_ptr< GrFragmentProcessor > make_rect_integral_fp(GrRecordingContext *rContext, float sixSigma)
static void convolve_gaussian_1d(skgpu::ganesh::SurfaceFillContext *sfc, GrSurfaceProxyView srcView, const SkIRect &srcSubset, SkIVector dstToSrcOffset, const SkIRect &dstRect, SkAlphaType srcAlphaType, Direction direction, int radius, float sigma, SkTileMode mode)
static std::unique_ptr< GrFragmentProcessor > create_profile_effect(GrRecordingContext *rContext, const SkRect &circle, float sigma, float *solidRadius, float *textureRadius)
bool IsSupported(const SkMaskFilter *maskfilter)
unsigned useCenter Optional< SkMatrix > matrix
clipRect(r.rect, r.opAA.op(), r.opAA.aa())) template<> void Draw
sk_sp< SkBlender > blender SkRect rect
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
const myers::Point & get< 0 >(const myers::Segment &s)
constexpr bool BlurIsEffectivelyIdentity(float sigma)
SkBitmap CreateRRectBlurMask(const SkRRect &rrectToDraw, const SkISize &dimensions, float sigma)
static constexpr int kMaxBlurSamples
SkISize GetApproxSize(SkISize size)
int ComputeIntegralTableWidth(float sixSigma)
static constexpr float kMaxLinearBlurSigma
void Compute2DBlurOffsets(SkISize radius, std::array< SkV4, kMaxBlurSamples/2 > &offsets)
SkBitmap CreateCircleProfile(float sigma, float radius, int profileWidth)
const SkRuntimeEffect * GetLinearBlur1DEffect(int radius)
int BlurSigmaRadius(float sigma)
constexpr int BlurKernelWidth(int radius)
void Compute2DBlurKernel(SkSize sigma, SkISize radius, SkSpan< float > kernel)
constexpr int BlurLinearKernelWidth(int radius)
SkBitmap CreateHalfPlaneProfile(int profileWidth)
SkBitmap CreateIntegralTable(int width)
const SkRuntimeEffect * GetBlur2DEffect(const SkISize &radii)
void Compute1DBlurLinearKernel(float sigma, int radius, std::array< SkV4, kMaxBlurSamples/2 > &offsetsAndKernel)
SkIRect makeOutset(int32_t dx, int32_t dy) const
bool intersect(const SkIRect &r)
static bool Intersects(const SkIRect &a, const SkIRect &b)
int32_t fBottom
larger y-axis bounds
constexpr int32_t top() const
constexpr SkISize size() const
constexpr int32_t bottom() const
constexpr int32_t height() const
constexpr int32_t right() const
int32_t fTop
smaller y-axis bounds
static constexpr SkIRect MakeSize(const SkISize &size)
static constexpr SkIRect MakeEmpty()
constexpr int32_t width() const
constexpr SkIRect makeOffset(int32_t dx, int32_t dy) const
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
constexpr SkIPoint topLeft() const
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
int32_t fLeft
smaller x-axis bounds
void outset(int32_t dx, int32_t dy)
constexpr int32_t left() const
bool contains(int32_t x, int32_t y) const
int32_t fRight
larger x-axis bounds
constexpr int32_t width() const
constexpr int32_t height() const
static SkImageInfo MakeA8(int width, int height)
static void FreeImage(void *image)
@ kComputeBoundsAndRenderImage_CreateMode
compute bounds, alloc image and render into it
@ kA8_Format
8bits per pixel mask (e.g. antialiasing)
static SkRect Make(const SkISize &size)
SkScalar fBottom
larger y-axis bounds
constexpr float left() const
void inset(float dx, float dy)
constexpr float top() const
bool intersect(const SkRect &r)
SkScalar fLeft
smaller x-axis bounds
static SkRect MakeIWH(int w, int h)
void outset(float dx, float dy)
SkRect makeOutset(float dx, float dy) const
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
SkScalar fRight
larger x-axis bounds
void roundOut(SkIRect *dst) const
constexpr float centerX() const
void offset(float dx, float dy)
constexpr float height() const
constexpr float right() const
constexpr float centerY() const
constexpr float width() const
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
constexpr float bottom() const
SkScalar fTop
smaller y-axis bounds
std::shared_ptr< const fml::Mapping > data
#define TRACE_EVENT2(category_group, name, arg1_name, arg1_val, arg2_name, arg2_val)