78#define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this->drawingManager()->getContext())
79#define ASSERT_SINGLE_OWNER SKGPU_ASSERT_SINGLE_OWNER(this->singleOwner())
80#define RETURN_IF_ABANDONED if (fContext->abandoned()) { return; }
81#define RETURN_FALSE_IF_ABANDONED if (fContext->abandoned()) { return false; }
93 bounds->outset(0.5f, 0.5f);
149 return std::make_unique<SurfaceDrawContext>(rContext,
151 std::move(writeView),
153 std::move(colorSpace),
170 std::string_view label) {
196 auto sdc = std::make_unique<SurfaceDrawContext>(rContext,
198 std::move(writeView),
200 std::move(colorSpace),
212 std::string_view label,
243 std::move(colorSpace),
266 "MakeSurfaceDrawContextWithFallback", sampleCnt,
282 std::move(releaseHelper)));
303 std::move(writeView),
305 , fSurfaceProps(surfaceProps)
306 , fCanUseDynamicMSAA(
308 rContext->priv().caps()->supportsDynamicMSAA(this->asRenderTargetProxy())) {
316void SurfaceDrawContext::willReplaceOpsTask(
OpsTask* prevTask,
OpsTask* nextTask) {
317 if (prevTask && fNeedsStencil) {
319 prevTask->setMustPreserveStencil();
325#if GR_GPU_STATS && defined(GR_TEST_UTILS)
326 if (fCanUseDynamicMSAA) {
357 auto [drawingClip, op] = subRun->makeAtlasTextOp(
358 clip, viewMatrix, drawOrigin,
paint, std::move(subRunStorage),
this);
360 this->
addDrawOp(drawingClip, std::move(op));
365 canvas, viewMatrix, glyphRunList,
paint, strikeDeviceInfo, atlasDelegate);
373 if (!
paint.numTotalFragmentProcessors()) {
381 if (!viewMatrix.
invert(&localMatrix)) {
418 if (!stencilSettings &&
paint && !
paint->hasCoverageFragmentProcessor() &&
419 paint->isConstantBlendedColor(&paintColor)) {
421 constColor = &paintColor;
446 auto conservativeCrop = [&]() {
447 static constexpr int kLargeDrawLimit = 15000;
450 if (drawBounds.
width() > kLargeDrawLimit || drawBounds.
height() > kLargeDrawLimit) {
455 bool simpleColor = !stencilSettings && constColor;
475 if (!
result.fIsRRect || (stencilSettings &&
result.fAA != drawUsesAA) ||
476 (!
result.fRRect.isRect() && !simpleColor)) {
491 if (!drawBounds.
intersect(clippedBounds)) {
497 if (drawBounds.
width() < 1.f || drawBounds.
height() < 1.f) {
501 if (
result.fRRect.isRect()) {
511 this->
clear(*constColor);
514 drawBounds.
width() > 256 && drawBounds.
height() > 256) {
517 drawBounds.
round(&scissorRect);
518 this->
clear(scissorRect, *constColor);
547void SurfaceDrawContext::drawFilledQuad(
const GrClip*
clip,
567 }
else if (fCanUseDynamicMSAA && aa ==
GrAA::kNo) {
612 std::unique_ptr<GrFragmentProcessor>
fp;
620 if (colorSpaceXform) {
623 fp = GrBlendFragmentProcessor::Make<SkBlendMode::kModulate>(std::move(
fp),
nullptr);
624 paint.setColorFragmentProcessor(std::move(
fp));
636 this->drawTexturedQuad(
clip, std::move(view), srcAlphaType, std::move(colorSpaceXform), filter,
637 mm,
color, blendMode, &quad, subset);
640void SurfaceDrawContext::drawTexturedQuad(
const GrClip*
clip,
675 std::move(textureXform), filter, mm,
color,
676 saturate, blendMode, aaType, quad, subset));
708 !this->caps()->reducedShaderMode()) {
715 GrAAType aaType = (fCanUseDynamicMSAA &&
729 this->drawShapeUsingPathRenderer(
clip, std::move(
paint), aa, viewMatrix,
738 const SkRect& localRect) {
744 this->caps()->drawInstancedSupport() &&
755 SkRect croppedRect, croppedLocal{};
762 if (!viewMatrix.
invert(&inverse)) {
768 optimizedClip =
nullptr;
773 croppedRect = rectToDraw;
774 croppedLocal = localRect;
780 this->
addDrawOp(optimizedClip, std::move(op));
786 this->drawFilledQuad(
clip, std::move(
paint), &quad);
805#if defined(GR_TEST_UTILS)
806 if (fPreserveOpsOnFullClear_TestingOnly) {
819void SurfaceDrawContext::setNeedsStencil() {
822 bool hasInitializedStencil = fNeedsStencil;
823 fNeedsStencil =
true;
824 if (!hasInitializedStencil) {
826 if (this->
caps()->performStencilClearsAsDraws()) {
829 this->internalStencilClear(
nullptr,
false);
837void SurfaceDrawContext::internalStencilClear(
const SkIRect* scissor,
bool insideStencilMask) {
838 this->setNeedsStencil();
841 if (scissor && !scissorState.set(*scissor)) {
875 canDrawArgs.
fShape = &shape;
876 canDrawArgs.
fPaint =
nullptr;
884 SkDebugf(
"WARNING: No path renderer to stencil path.\n");
890 args.fSurfaceDrawContext =
this;
892 args.fClipConservativeBounds = &clipBounds;
893 args.fViewMatrix = &viewMatrix;
894 args.fShape = &shape;
895 args.fDoStencilMSAA = doStencilMSAA;
896 pr->stencilPath(
args);
923 saturate,
mode, aaType, constraint, viewMatrix,
924 std::move(texXform));
932 bool skipColorXform) {
957 TArray<std::unique_ptr<GrFragmentProcessor>> children) {
969 this->colorInfo().colorSpace(),
970 this->colorInfo().alphaType());
1000 aaType, spriteCount, xform, texRect,
colors);
1034#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
1068#ifndef SK_ENABLE_OPTIMIZE_SIZE
1070 !fCanUseDynamicMSAA &&
1071 !this->
caps()->reducedShaderMode() &&
1076 assert_alive(
paint);
1082 assert_alive(
paint);
1086#ifndef SK_ENABLE_OPTIMIZE_SIZE
1088 assert_alive(
paint);
1098 assert_alive(
paint);
1099 this->drawShapeUsingPathRenderer(
clip, std::move(
paint), aa, viewMatrix,
1135 if (!isRRect &&
path.isRect(&
rect)) {
1169 const SkScalar devSpaceAmbientBlur = devSpaceInsetWidth * umbraRecipAlpha;
1172 SkScalar ambientPathOutset = devSpaceInsetWidth * devToSrcScale;
1190 devSpaceInsetWidth = ambientRRect.
width();
1197 devSpaceAmbientBlur,
1198 devSpaceInsetWidth);
1210 devLightPos.
fY, devLightPos.
fZ,
1212 &spotScale, &spotOffset);
1216 &devSpaceSpotBlur, &spotScale, &spotOffset);
1219 const SkScalar srcSpaceSpotBlur = devSpaceSpotBlur * devToSrcScale;
1226 if (viewMatrix.invert(&ctmInverse)) {
1230 SkDebugf(
"Matrix is degenerate. Will not render spot shadow correctly!\n");
1242 SkScalar blurOutset = srcSpaceSpotBlur;
1246 insetWidth += spotShadowRRect.
width();
1284 insetWidth +=
std::max(blurOutset, maxOffset);
1289 if (spotShadowRRect.
isOval()) {
1292 SkScalar outsetRad = spotRadius + blurOutset;
1304 2.0f * devSpaceSpotBlur,
1341 path.setIsVolatile(
true);
1378#ifndef SK_ENABLE_OPTIMIZE_SIZE
1380 !fCanUseDynamicMSAA &&
1381 !this->
caps()->reducedShaderMode() &&
1386 assert_alive(
paint);
1388 this->
caps()->shaderCaps());
1397 assert_alive(
paint);
1401#ifndef SK_ENABLE_OPTIMIZE_SIZE
1403 assert_alive(
paint);
1405 this->
caps()->shaderCaps());
1413 assert_alive(
paint);
1414 this->drawShapeUsingPathRenderer(
clip, std::move(
paint), aa, viewMatrix,
1432#ifndef SK_ENABLE_OPTIMIZE_SIZE
1449 assert_alive(
paint);
1452 this->drawShapeUsingPathRenderer(
clip,
1466 std::unique_ptr<SkLatticeIter> iter,
1477 alphaType, std::move(csxf), filter, std::move(iter),
dst);
1489 this->
addOp(std::move(op));
1494 int numClipAnalyticElements) {
1496 opsTask->fLastClipStackGenID = clipStackGenID;
1497 opsTask->fLastDevClipBounds = devClipBounds;
1498 opsTask->fLastClipNumAnalyticElements = numClipAnalyticElements;
1503 int numClipAnalyticElements) {
1505 return opsTask->fLastClipStackGenID != clipStackGenID ||
1506 !opsTask->fLastDevClipBounds.contains(devClipBounds) ||
1507 opsTask->fLastClipNumAnalyticElements != numClipAnalyticElements;
1512 bool deleteSemaphoresAfterWait) {
1520 if (numSemaphores && !this->
caps()->backendSemaphoreSupport()) {
1534 std::unique_ptr<std::unique_ptr<GrSemaphore>[]> grSemaphores(
1535 new std::unique_ptr<GrSemaphore>[numSemaphores]);
1536 for (
int i = 0;
i < numSemaphores; ++
i) {
1537 grSemaphores[
i] = resourceProvider->wrapBackendSemaphore(waitSemaphores[
i],
1558 this->
drawShape(clip, std::move(
paint), aa, viewMatrix, std::move(shape));
1571 if (shape.isEmpty()) {
1572 if (shape.inverseFilled()) {
1581 this->drawShapeUsingPathRenderer(
clip, std::move(
paint), aa, viewMatrix, std::move(shape),
1601 if (
path.isEmpty() &&
path.isInverseFillType()) {
1616 bool hasUserStencilSettings = !ss->
isUnused();
1625 canDrawArgs.fCaps = this->
caps();
1628 canDrawArgs.
fShape = &shape;
1640 DrawType::kStencilAndColor);
1650 &clipConservativeBounds,
1686 if (halfWidth <= 0.f) {
1701 parallel *= halfWidth;
1712 if (this->
caps()->drawInstancedSupport() &&
1716 p1.fY - p0.
fY, ortho.
fY, p0.
fY,
1731 SkPoint corners[4] = { p0 - ortho,
1738 assert_alive(
paint);
1742bool SurfaceDrawContext::drawSimpleShape(
const GrClip*
clip,
1753 if (shape.
asLine(linePts, &inverted) && !inverted &&
1770 }
else if (shape.
asRRect(&
rrect, &inverted) && !inverted) {
1785 !this->caps()->reducedShaderMode()) {
1805void SurfaceDrawContext::drawShapeUsingPathRenderer(
const GrClip*
clip,
1810 bool attemptDrawSimple) {
1824 PathRenderer::CanDrawPathArgs canDrawArgs;
1825 canDrawArgs.fCaps = this->
caps();
1827 canDrawArgs.fViewMatrix = &viewMatrix;
1828 canDrawArgs.fShape = &shape;
1829 canDrawArgs.fPaint = &
paint;
1830 canDrawArgs.fSurfaceProps = &fSurfaceProps;
1831 canDrawArgs.fClipConservativeBounds = &clipConservativeBounds;
1832 canDrawArgs.fHasUserStencilSettings =
false;
1833 canDrawArgs.fAAType = aaType;
1835 constexpr static bool kDisallowSWPathRenderer =
false;
1838 PathRenderer* pr =
nullptr;
1856 if (attemptDrawSimple || shape.
simplified()) {
1860 if (this->drawSimpleShape(
clip, &
paint, aa, viewMatrix, shape)) {
1871 if (styleScale == 0.0f) {
1898 canDrawArgs.fAAType = aaType;
1904#if GR_PATH_RENDERER_SPEW
1905 SkDebugf(
"falling back to: %s\n", pr->name());
1914 &clipConservativeBounds,
1924 const std::function<WillAddOpFn>& willAddFn) {
1936 op_bounds(&
bounds, op.get());
1938 const bool opUsesMSAA = drawOp->
usesMSAA();
1939 bool skipDraw =
false;
1966 const bool drawNeedsMSAA = opUsesMSAA || (fCanUseDynamicMSAA && opUsesStencil);
1969 op->setClippedBounds(
bounds);
1979 bool usesAttachmentIfDMSAA =
1980 fCanUseDynamicMSAA &&
1982 bool opRequiresDMSAAAttachment = usesAttachmentIfDMSAA && drawNeedsMSAA;
1983 bool opTriggersDMSAAAttachment =
1985 if (opTriggersDMSAAAttachment) {
1997 if (!this->setupDstProxyView(drawOp->
bounds(), drawNeedsMSAA, &dstProxyView)) {
2001 if (fCanUseDynamicMSAA && drawNeedsMSAA && !this->
caps()->msaaResolvesAutomatically()) {
2012 willAddFn(op.get(), opsTask->uniqueID());
2017 if (opUsesStencil) {
2018 this->setNeedsStencil();
2021#if GR_GPU_STATS && defined(GR_TEST_UTILS)
2022 if (fCanUseDynamicMSAA && drawNeedsMSAA) {
2023 if (!opsTask->usesMSAASurface()) {
2024 fContext->
priv().dmsaaStats().fNumMultisampleRenderPasses++;
2026 fContext->
priv().dmsaaStats().fTriggerCounts[op->name()]++;
2030 opsTask->addDrawOp(this->
drawingManager(), std::move(op), drawNeedsMSAA, analysis,
2031 std::move(appliedClip), dstProxyView,
2035 if (fCanUseDynamicMSAA && drawNeedsMSAA) {
2036 SkASSERT(opsTask->usesMSAASurface());
2041bool SurfaceDrawContext::setupDstProxyView(
const SkRect& opBounds,
2042 bool opRequiresMSAA,
2060 fCanUseDynamicMSAA && this->
getOpsTask()->usesMSAASurface() && !opRequiresMSAA) {
2069 dstSampleFlags = newFlags;
2091 if (fCanUseDynamicMSAA && opRequiresMSAA && this->
asTextureProxy() &&
2092 !this->
caps()->msaaResolvesAutomatically() &&
2093 this->
caps()->dmsaaResolveCanBeUsedAsTextureInSameRenderPass()) {
2094 this->replaceOpsTaskIfModifiesColor()->setCannotMergeBackward();
2115 conservativeDrawBounds.
outset(1, 1);
2125 dstOffset = {copyRect.
fLeft, copyRect.
fTop};
2145OpsTask* SurfaceDrawContext::replaceOpsTaskIfModifiesColor() {
static constexpr SkColor kColor
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
#define GR_CREATE_TRACE_MARKER_CONTEXT(classname, op, context)
@ kRequiresTextureBarrier
@ kBorrow_GrWrapOwnership
static constexpr bool GrAATypeIsHW(GrAAType type)
static constexpr GrClampType GrColorTypeClampType(GrColorType colorType)
static const int points[]
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kSrcOver
r = s + (1-sa)*d
#define SkColorGetA(color)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
bool SkDrawTreatAAStrokeAsHairline(SkScalar strokeWidth, const SkMatrix &matrix, SkScalar *coverage)
static float sk_float_rsqrt(float x)
SkPMColor4f SkColorToPMColor4f(SkColor c, const GrColorInfo &colorInfo)
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
#define SkScalarInvert(x)
static bool SkScalarNearlyZero(SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
static bool SkScalarNearlyEqual(SkScalar x, SkScalar y, SkScalar tolerance=SK_ScalarNearlyZero)
#define SK_ScalarNearlyZero
static bool SkScalarIsInt(SkScalar x)
@ kDirectionalLight_ShadowFlag
@ kGeometricOnly_ShadowFlag
@ kTransparentOccluder_ShadowFlag
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
static constexpr bool SkToBool(const T &x)
#define RETURN_IF_ABANDONED
#define RETURN_FALSE_IF_ABANDONED
#define ASSERT_SINGLE_OWNER
const GrCaps * caps() const
bool reducedShaderMode() const
std::tuple< GrColorType, GrBackendFormat > getFallbackColorTypeAndFormat(GrColorType, int sampleCount) const
bool performPartialClearsAsDraws() const
GrDstSampleFlags getDstSampleFlagsForProxy(const GrRenderTargetProxy *, bool drawUsesMSAA) const
const GrShaderCaps * shaderCaps() const
virtual skgpu::Swizzle getWriteSwizzle(const GrBackendFormat &, GrColorType) const =0
virtual DstCopyRestrictions getDstCopyRestrictions(const GrRenderTargetProxy *src, GrColorType ct) const
GrBackendFormat getDefaultBackendFormat(GrColorType, GrRenderable) const
bool msaaResolvesAutomatically() const
bool performStencilClearsAsDraws() const
skgpu::Swizzle getReadSwizzle(const GrBackendFormat &format, GrColorType colorType) const
static bool IsPixelAligned(const SkRect &rect)
static bool IsOutsideClip(const SkIRect &outerClipBounds, const SkRect &drawBounds, GrAA aa)
bool isLinearlyBlended() const
sk_sp< GrColorSpaceXform > refColorSpaceXformFromSRGB() const
GrColorType colorType() const
virtual GrDirectContext * asDirectContext()
GrResourceProvider * resourceProvider()
GrDirectContextPriv priv()
static const GrDisableColorXPFactory * Get()
virtual bool usesMSAA() const
virtual GrProcessorSet::Analysis finalize(const GrCaps &, const GrAppliedClip *, GrClampType)=0
virtual bool usesStencil() const
GrRecordingContext * getContext()
void newWaitRenderTask(const sk_sp< GrSurfaceProxy > &proxy, std::unique_ptr< std::unique_ptr< GrSemaphore >[]>, int numSemaphores)
PathRenderer * getTessellationPathRenderer()
PathRenderer * getSoftwarePathRenderer()
PathRenderer * getPathRenderer(const PathRenderer::CanDrawPathArgs &, bool allowSW, PathRendererChain::DrawType, PathRenderer::StencilSupport *=nullptr)
void setOffset(const SkIPoint &offset)
void setDstSampleFlags(GrDstSampleFlags dstSampleFlags)
void setProxyView(GrSurfaceProxyView view)
std::unique_ptr< GrOp > Owner
const SkRect & bounds() const
static GrOp::Owner MakeArcOp(GrRecordingContext *, GrPaint &&, const SkMatrix &, const SkRect &oval, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, const GrStyle &, const GrShaderCaps *)
static GrOp::Owner MakeOvalOp(GrRecordingContext *, GrPaint &&, const SkMatrix &, const SkRect &oval, const GrStyle &style, const GrShaderCaps *)
static GrOp::Owner MakeCircularRRectOp(GrRecordingContext *, GrPaint &&, const SkMatrix &, const SkRRect &, const SkStrokeRec &, const GrShaderCaps *)
static GrOp::Owner MakeCircleOp(GrRecordingContext *, GrPaint &&, const SkMatrix &, const SkRect &oval, const GrStyle &style, const GrShaderCaps *)
static GrOp::Owner MakeRRectOp(GrRecordingContext *, GrPaint &&, const SkMatrix &, const SkRRect &, const SkStrokeRec &, const GrShaderCaps *)
bool requiresDstTexture() const
sk_sp< GrTextureProxy > createProxy(const GrBackendFormat &, SkISize dimensions, GrRenderable, int renderTargetSampleCnt, skgpu::Mipmapped, SkBackingFit, skgpu::Budgeted, GrProtected, std::string_view label, GrInternalSurfaceFlags=GrInternalSurfaceFlags::kNone, UseAllocator useAllocator=UseAllocator::kYes)
sk_sp< GrTextureProxy > wrapRenderableBackendTexture(const GrBackendTexture &, int sampleCnt, GrWrapOwnership, GrWrapCacheable, sk_sp< skgpu::RefCntedCallback > releaseHelper)
static GrQuad MakeFromRect(const SkRect &, const SkMatrix &)
bool asRect(SkRect *rect) const
GrProxyProvider * proxyProvider()
sktext::gpu::TextBlobRedrawCoordinator * getTextBlobCache()
GrRecordingContextPriv priv()
bool abandoned() override
int maxWindowRectangles(const GrCaps &caps) const
static const GrUserStencilSettings * SetClipBitSettings(bool setToInside)
@ kPathEffectAndStrokeRec
SkPathEffect * pathEffect() const
bool hasPathEffect() const
static const GrStyle & SimpleFill()
static SkScalar MatrixToScaleFactor(const SkMatrix &matrix)
bool isSimpleFill() const
const SkStrokeRec & strokeRec() const
static GrStyledShape MakeArc(const SkArc &arc, const GrStyle &style, DoSimplify=DoSimplify::kYes)
bool asLine(SkPoint pts[2], bool *inverted) const
bool asRRect(SkRRect *rrect, bool *inverted) const
bool inverseFilled() const
const GrStyle & style() const
bool asNestedRects(SkRect rects[2]) const
GrStyledShape applyStyle(GrStyle::Apply apply, SkScalar scale) const
GrTextureProxy * asTextureProxy() const
const GrBackendFormat & backendFormat() const
SkRect getBoundsRect() const
skgpu::Budgeted isBudgeted() const
static sk_sp< GrSurfaceProxy > Copy(GrRecordingContext *, sk_sp< GrSurfaceProxy > src, GrSurfaceOrigin, skgpu::Mipmapped, SkIRect srcRect, SkBackingFit, skgpu::Budgeted, std::string_view label, RectsMustMatch=RectsMustMatch::kNo, sk_sp< GrRenderTask > *outTask=nullptr)
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 const GrXPFactory * FromBlendMode(SkBlendMode)
@ kStrict_SrcRectConstraint
sample only inside bounds; slower
static constexpr int kMScaleX
horizontal scale factor
static constexpr int kMTransY
vertical translation
SkScalar getTranslateY() const
void setScaleTranslate(SkScalar sx, SkScalar sy, SkScalar tx, SkScalar ty)
void mapPoints(SkPoint dst[], const SkPoint src[], int count) const
static SkMatrix MakeAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar pers0, SkScalar pers1, SkScalar pers2)
static SkMatrix Concat(const SkMatrix &a, const SkMatrix &b)
bool invert(SkMatrix *inverse) const
bool rectStaysRect() const
static const SkMatrix & I()
bool isScaleTranslate() const
static constexpr int kMTransX
horizontal translation
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
SkScalar getTranslateX() const
@ kTranslate_Mask
translation SkMatrix
SkMeshSpecification * spec() const
@ kMiter_Join
extends to miter limit
static SkScalar LengthSqd(const SkPoint &pt)
static SkVector GetSimpleRadii(const SkRRect &rr)
static bool IsNearlySimpleCircular(const SkRRect &rr, SkScalar tolerance=SK_ScalarNearlyZero)
SkVector getSimpleRadii() const
const SkRect & rect() const
static SkRRect MakeOval(const SkRect &oval)
bool transform(const SkMatrix &matrix, SkRRect *dst) const
static SkRRect MakeRect(const SkRect &r)
void setOval(const SkRect &oval)
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
const SkRect & getBounds() const
void setRect(const SkRect &rect)
bool getBoundaryPath(SkPath *path) const
SkScalar getWidth() const
SkPaint::Cap getCap() const
AutoCheckFlush(GrDrawingManager *drawingManager)
static GrOp::Owner MakeStencilClip(GrRecordingContext *context, const GrScissorState &scissor, bool insideMask)
static DEFINE_OP_CLASS_ID GrOp::Owner Make(GrRecordingContext *, std::unique_ptr< SkDrawable::GpuDrawHandler > drawable, const SkRect &bounds)
static GrOp::Owner Make(GrRecordingContext *, GrPaint &&, GrAAType, DrawQuad *, const GrUserStencilSettings *=nullptr, InputFlags=InputFlags::kNone)
static void AddFillRectOps(SurfaceDrawContext *, const GrClip *, GrRecordingContext *, GrPaint &&, GrAAType, const SkMatrix &viewMatrix, const GrQuadSetEntry quads[], int quadCount, const GrUserStencilSettings *=nullptr)
static GrOp::Owner MakeNonAARect(GrRecordingContext *, GrPaint &&, const SkMatrix &view, const SkRect &, const GrUserStencilSettings *=nullptr)
void setInitialStencilContent(StencilContent initialContent)
bool usesMSAASurface() const
GrSurfaceProxy * asSurfaceProxy()
GrDrawingManager * drawingManager()
SkDEBUGCODE(void validate() const ;) SkDEBUGCODE(skgpu GrRecordingContext * fContext
SkISize dimensions() const
GrRenderTargetProxy * asRenderTargetProxy()
const GrCaps * caps() const
const GrColorInfo & colorInfo() const
GrTextureProxy * asTextureProxy()
skgpu::Mipmapped mipmapped() const
GrSurfaceProxyView readSurfaceView()
skgpu::Swizzle readSwizzle() const
sk_sp< GrSurfaceProxy > asSurfaceProxyRef()
GrSurfaceOrigin origin() const
bool stencilPath(const GrHardClip *, GrAA doStencilMSAA, const SkMatrix &viewMatrix, const SkPath &)
void drawArc(const GrClip *, GrPaint &&paint, GrAA, const SkMatrix &viewMatrix, const SkArc &arc, const GrStyle &style)
bool drawFastShadow(const GrClip *, const SkMatrix &viewMatrix, const SkPath &path, const SkDrawShadowRec &rec)
void drawOval(const GrClip *, GrPaint &&paint, GrAA, const SkMatrix &viewMatrix, const SkRect &oval, const GrStyle &style)
void fillQuadWithEdgeAA(const GrClip *clip, GrPaint &&paint, GrQuadAAFlags edgeAA, const SkMatrix &viewMatrix, const SkPoint points[4], const SkPoint optionalLocalPoints[4])
SurfaceDrawContext(GrRecordingContext *, GrSurfaceProxyView readView, GrSurfaceProxyView writeView, GrColorType, sk_sp< SkColorSpace >, const SkSurfaceProps &)
bool wrapsVkSecondaryCB() const
void fillPixelsWithLocalMatrix(const GrClip *clip, GrPaint &&paint, const SkIRect &bounds, const SkMatrix &localMatrix)
void drawShape(const GrClip *, GrPaint &&, GrAA, const SkMatrix &viewMatrix, GrStyledShape &&)
void drawDrawable(std::unique_ptr< SkDrawable::GpuDrawHandler >, const SkRect &bounds)
void drawAtlas(const GrClip *, GrPaint &&paint, const SkMatrix &viewMatrix, int spriteCount, const SkRSXform xform[], const SkRect texRect[], const SkColor colors[])
int maxWindowRectangles() const
void drawTextureSet(const GrClip *, GrTextureSetEntry[], int cnt, int proxyRunCnt, GrSamplerState::Filter, GrSamplerState::MipmapMode, SkBlendMode mode, SkCanvas::SrcRectConstraint, const SkMatrix &viewMatrix, sk_sp< GrColorSpaceXform > texXform)
void setLastClip(uint32_t clipStackGenID, const SkIRect &devClipBounds, int numClipAnalyticElements)
skgpu::Budgeted isBudgeted() const
void drawMesh(const GrClip *, GrPaint &&paint, const SkMatrix &viewMatrix, const SkMesh &mesh, skia_private::TArray< std::unique_ptr< GrFragmentProcessor > > children)
bool alwaysAntialias() const
void addDrawOp(const GrClip *, GrOp::Owner, const std::function< WillAddOpFn > &=std::function< WillAddOpFn >())
bool waitOnSemaphores(int numSemaphores, const GrBackendSemaphore waitSemaphores[], bool deleteSemaphoresAfterWait)
void drawQuadSet(const GrClip *clip, GrPaint &&paint, const SkMatrix &viewMatrix, const GrQuadSetEntry[], int cnt)
void drawImageLattice(const GrClip *, GrPaint &&, const SkMatrix &viewMatrix, GrSurfaceProxyView, SkAlphaType alphaType, sk_sp< GrColorSpaceXform >, GrSamplerState::Filter, std::unique_ptr< SkLatticeIter >, const SkRect &dst)
void drawPath(const GrClip *, GrPaint &&, GrAA, const SkMatrix &viewMatrix, const SkPath &, const GrStyle &)
bool drawAndStencilPath(const GrHardClip *, const GrUserStencilSettings *, SkRegion::Op op, bool invert, GrAA doStencilMSAA, const SkMatrix &viewMatrix, const SkPath &)
bool mustRenderClip(uint32_t clipStackGenID, const SkIRect &devClipBounds, int numClipAnalyticElements)
void drawRRect(const GrClip *, GrPaint &&, GrAA, const SkMatrix &viewMatrix, const SkRRect &rrect, const GrStyle &style)
void drawPaint(const GrClip *, GrPaint &&, const SkMatrix &viewMatrix)
void drawRegion(const GrClip *, GrPaint &&paint, GrAA aa, const SkMatrix &viewMatrix, const SkRegion ®ion, const GrStyle &style, const GrUserStencilSettings *ss=nullptr)
~SurfaceDrawContext() override
static std::unique_ptr< SurfaceDrawContext > MakeFromBackendTexture(GrRecordingContext *, GrColorType, sk_sp< SkColorSpace >, const GrBackendTexture &, int sampleCnt, GrSurfaceOrigin, const SkSurfaceProps &, sk_sp< skgpu::RefCntedCallback > releaseHelper)
void stencilRect(const GrClip *clip, const GrUserStencilSettings *ss, GrPaint &&paint, GrAA doStencilMSAA, const SkMatrix &viewMatrix, const SkRect &rect, const SkMatrix *localMatrix=nullptr)
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 drawGlyphRunList(SkCanvas *, const GrClip *, const SkMatrix &viewMatrix, const sktext::GlyphRunList &glyphRunList, SkStrikeDeviceInfo strikeDeviceInfo, const SkPaint &paint)
void fillRectToRect(const GrClip *, GrPaint &&, GrAA, const SkMatrix &, const SkRect &rectToDraw, const SkRect &localRect)
void drawVertices(const GrClip *, GrPaint &&paint, const SkMatrix &viewMatrix, sk_sp< SkVertices > vertices, GrPrimitiveType *overridePrimType=nullptr, bool skipColorXform=false)
void drawTexture(const GrClip *, GrSurfaceProxyView, SkAlphaType, GrSamplerState::Filter, GrSamplerState::MipmapMode, SkBlendMode, const SkPMColor4f &, const SkRect &srcRect, const SkRect &dstRect, GrQuadAAFlags, SkCanvas::SrcRectConstraint, const SkMatrix &, sk_sp< GrColorSpaceXform >)
GrAAType chooseAAType(GrAA aa)
void drawStrokedLine(const GrClip *, GrPaint &&, GrAA, const SkMatrix &, const SkPoint[2], const SkStrokeRec &)
void clear(const SkIRect &rect, const SkRGBA4f< AlphaType > &color)
OpsTask * replaceOpsTask()
SkArenaAlloc * arenaAlloc()
static void AddTextureSetOps(skgpu::ganesh::SurfaceDrawContext *, const GrClip *, GrRecordingContext *, GrTextureSetEntry[], int cnt, int proxyRunCnt, GrSamplerState::Filter, GrSamplerState::MipmapMode, Saturate, SkBlendMode, GrAAType, SkCanvas::SrcRectConstraint, const SkMatrix &viewMatrix, sk_sp< GrColorSpaceXform > textureXform)
static GrOp::Owner Make(GrRecordingContext *, GrSurfaceProxyView, SkAlphaType srcAlphaType, sk_sp< GrColorSpaceXform >, GrSamplerState::Filter, GrSamplerState::MipmapMode, const SkPMColor4f &, Saturate, SkBlendMode, GrAAType, DrawQuad *, const SkRect *subset=nullptr)
void drawGlyphRunList(SkCanvas *canvas, const SkMatrix &viewMatrix, const GlyphRunList &glyphRunList, const SkPaint &paint, SkStrikeDeviceInfo strikeDeviceInfo, const AtlasDrawDelegate &)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
uint32_t uint32_t * format
static float max(float r, float g, float b)
bool WillUseHairline(const GrQuad &quad, GrAAType aaType, GrQuadAAFlags edgeFlags)
bool CropToRect(const SkRect &cropRect, GrAA cropAA, DrawQuad *quad, bool computeLocal)
SkScalar AmbientRecipAlpha(SkScalar height)
void GetDirectionalParams(SkScalar occluderZ, SkScalar lightX, SkScalar lightY, SkScalar lightZ, SkScalar lightRadius, SkScalar *blurRadius, SkScalar *scale, SkVector *translate)
SkScalar AmbientBlurRadius(SkScalar height)
void GetSpotParams(SkScalar occluderZ, SkScalar lightX, SkScalar lightY, SkScalar lightZ, SkScalar lightRadius, SkScalar *blurRadius, SkScalar *scale, SkVector *translate)
Optional< SkRect > bounds
ClipOpAndAA opAA SkRegion region
sk_sp< SkBlender > blender SkRect rect
PODArray< SkColor > colors
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
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
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set
static TessellatorLibtess tess
GrOp::Owner Make(GrRecordingContext *context, GrPaint &&paint, const SkMatrix &viewMatrix, GrAAType aaType, int spriteCount, const SkRSXform *xforms, const SkRect *rects, const SkColor *colors)
GrOp::Owner Make(GrRecordingContext *context, GrPaint &&paint, const SkMesh &mesh, TArray< std::unique_ptr< GrFragmentProcessor > > children, const SkMatrix &viewMatrix, GrAAType aaType, sk_sp< GrColorSpaceXform > colorSpaceXform)
GrOp::Owner Make(GrRecordingContext *ctx, SkArenaAlloc *arena, GrPaint &&paint, const SkMatrix &viewMatrix, const SkRRect &rrect, const SkRect &localRect, GrAA aa)
GrOp::Owner MakeNonAA(GrRecordingContext *context, GrPaint &&paint, const SkMatrix &viewMatrix, GrSurfaceProxyView view, SkAlphaType alphaType, sk_sp< GrColorSpaceXform > colorSpaceXform, GrSamplerState::Filter filter, std::unique_ptr< SkLatticeIter > iter, const SkRect &dst)
GrOp::Owner Make(GrRecordingContext *context, GrPaint &&paint, const SkMatrix &viewMatrix, const SkRegion ®ion, GrAAType aaType, const GrUserStencilSettings *stencilSettings)
GrOp::Owner Make(GrRecordingContext *context, GrColor color, const SkMatrix &viewMatrix, const SkRRect &rrect, SkScalar blurWidth, SkScalar insetWidth)
GrOp::Owner Make(GrRecordingContext *context, GrPaint &&paint, GrAAType aaType, const SkMatrix &viewMatrix, const SkRect &rect, const SkStrokeRec &stroke)
GrOp::Owner MakeNested(GrRecordingContext *context, GrPaint &&paint, const SkMatrix &viewMatrix, const SkRect rects[2])
static SkIRect get_clip_bounds(const SurfaceDrawContext *sdc, const GrClip *clip)
std::tuple< bool, bool > FilterAndMipmapHaveNoEffect(const GrQuad &srcQuad, const GrQuad &dstQuad)
GrSurfaceProxy::RectsMustMatch fRectsMustMatch
static const GrUserStencilSettings & kUnused
bool intersect(const SkIRect &r)
int32_t fTop
smaller y-axis bounds
static constexpr SkIRect MakeSize(const SkISize &size)
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
int32_t fLeft
smaller x-axis bounds
void outset(int32_t dx, int32_t dy)
static SkAlphaType AlphaType(const SkMeshSpecification &spec)
static SkColorSpace * ColorSpace(const SkMeshSpecification &spec)
static float Normalize(SkVector *vec)
static constexpr SkPoint Make(float x, float y)
uint32_t toBytes_RGBA() const
static SkRect Make(const SkISize &size)
SkScalar fBottom
larger y-axis bounds
bool intersect(const SkRect &r)
SkScalar fLeft
smaller x-axis bounds
SkRect makeOutset(float dx, float dy) const
SkScalar fRight
larger x-axis bounds
bool contains(SkScalar x, SkScalar y) const
void roundOut(SkIRect *dst) const
void round(SkIRect *dst) const
constexpr float height() const
constexpr float width() const
SkScalar fTop
smaller y-axis bounds
const GrStyledShape * fShape
const SkIRect * fClipConservativeBounds
bool fHasUserStencilSettings
const SkSurfaceProps * fSurfaceProps
const SkMatrix * fViewMatrix
const GrRenderTargetProxy * fProxy