77#define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this->drawingManager()->getContext())
78#define ASSERT_SINGLE_OWNER SKGPU_ASSERT_SINGLE_OWNER(this->singleOwner())
79#define RETURN_IF_ABANDONED if (fContext->abandoned()) { return; }
80#define RETURN_FALSE_IF_ABANDONED if (fContext->abandoned()) { return false; }
88void op_bounds(
SkRect* bounds,
const GrOp* op) {
92 bounds->outset(0.5f, 0.5f);
97 bounds->roundOut(bounds);
98 if (bounds->fLeft == before.
fLeft) {
101 if (bounds->fTop == before.
fTop) {
104 if (bounds->fRight == before.
fRight) {
107 if (bounds->fBottom == before.
fBottom) {
108 bounds->fBottom += 1;
148 return std::make_unique<SurfaceDrawContext>(rContext,
150 std::move(writeView),
152 std::move(colorSpace),
169 std::string_view label) {
195 auto sdc = std::make_unique<SurfaceDrawContext>(rContext,
197 std::move(writeView),
199 std::move(colorSpace),
211 std::string_view label,
242 std::move(colorSpace),
265 "MakeSurfaceDrawContextWithFallback", sampleCnt,
281 std::move(releaseHelper)));
302 std::move(writeView),
304 , fSurfaceProps(surfaceProps)
305 , fCanUseDynamicMSAA(
307 rContext->priv().caps()->supportsDynamicMSAA(this->asRenderTargetProxy())) {
316 if (prevTask && fNeedsStencil) {
318 prevTask->setMustPreserveStencil();
324#if GR_GPU_STATS && defined(GR_TEST_UTILS)
325 if (fCanUseDynamicMSAA) {
356 auto [drawingClip, op] = subRun->makeAtlasTextOp(
357 clip, viewMatrix, drawOrigin,
paint, std::move(subRunStorage),
this);
359 this->
addDrawOp(drawingClip, std::move(op));
364 canvas, viewMatrix, glyphRunList,
paint, strikeDeviceInfo, atlasDelegate);
372 if (!
paint.numTotalFragmentProcessors()) {
380 if (!viewMatrix.
invert(&localMatrix)) {
417 if (!stencilSettings &&
paint && !
paint->hasCoverageFragmentProcessor() &&
418 paint->isConstantBlendedColor(&paintColor)) {
420 constColor = &paintColor;
445 auto conservativeCrop = [&]() {
446 static constexpr int kLargeDrawLimit = 15000;
449 if (drawBounds.
width() > kLargeDrawLimit || drawBounds.
height() > kLargeDrawLimit) {
454 bool simpleColor = !stencilSettings && constColor;
474 if (!
result.fIsRRect || (stencilSettings &&
result.fAA != drawUsesAA) ||
475 (!
result.fRRect.isRect() && !simpleColor)) {
490 if (!drawBounds.
intersect(clippedBounds)) {
496 if (drawBounds.
width() < 1.f || drawBounds.
height() < 1.f) {
500 if (
result.fRRect.isRect()) {
510 this->
clear(*constColor);
513 drawBounds.
width() > 256 && drawBounds.
height() > 256) {
516 drawBounds.
round(&scissorRect);
517 this->
clear(scissorRect, *constColor);
546void SurfaceDrawContext::drawFilledQuad(
const GrClip*
clip,
566 }
else if (fCanUseDynamicMSAA && aa ==
GrAA::kNo) {
606 filter = GrSamplerState::Filter::kNearest;
611 std::unique_ptr<GrFragmentProcessor> fp;
619 if (colorSpaceXform) {
622 fp = GrBlendFragmentProcessor::Make<SkBlendMode::kModulate>(std::move(fp),
nullptr);
623 paint.setColorFragmentProcessor(std::move(fp));
635 this->drawTexturedQuad(
clip, std::move(view), srcAlphaType, std::move(colorSpaceXform), filter,
636 mm,
color, blendMode, &quad, subset);
639void SurfaceDrawContext::drawTexturedQuad(
const GrClip*
clip,
674 std::move(textureXform), filter, mm,
color,
675 saturate, blendMode, aaType, quad, subset));
707 !this->caps()->reducedShaderMode()) {
714 GrAAType aaType = (fCanUseDynamicMSAA &&
728 this->drawShapeUsingPathRenderer(
clip, std::move(
paint), aa, viewMatrix,
737 const SkRect& localRect) {
743 this->caps()->drawInstancedSupport() &&
754 SkRect croppedRect, croppedLocal{};
761 if (!viewMatrix.
invert(&inverse)) {
767 optimizedClip =
nullptr;
772 croppedRect = rectToDraw;
773 croppedLocal = localRect;
779 this->
addDrawOp(optimizedClip, std::move(op));
785 this->drawFilledQuad(
clip, std::move(
paint), &quad);
804#if defined(GR_TEST_UTILS)
805 if (fPreserveOpsOnFullClear_TestingOnly) {
818void SurfaceDrawContext::setNeedsStencil() {
821 bool hasInitializedStencil = fNeedsStencil;
822 fNeedsStencil =
true;
823 if (!hasInitializedStencil) {
825 if (this->
caps()->performStencilClearsAsDraws()) {
828 this->internalStencilClear(
nullptr,
false);
836void SurfaceDrawContext::internalStencilClear(
const SkIRect* scissor,
bool insideStencilMask) {
837 this->setNeedsStencil();
840 if (scissor && !scissorState.set(*scissor)) {
874 canDrawArgs.
fShape = &shape;
875 canDrawArgs.
fPaint =
nullptr;
883 SkDebugf(
"WARNING: No path renderer to stencil path.\n");
889 args.fSurfaceDrawContext =
this;
891 args.fClipConservativeBounds = &clipBounds;
892 args.fViewMatrix = &viewMatrix;
893 args.fShape = &shape;
894 args.fDoStencilMSAA = doStencilMSAA;
895 pr->stencilPath(
args);
922 saturate, mode, aaType, constraint, viewMatrix,
923 std::move(texXform));
931 bool skipColorXform) {
956 TArray<std::unique_ptr<GrFragmentProcessor>> children) {
968 this->colorInfo().colorSpace(),
969 this->colorInfo().alphaType());
999 aaType, spriteCount, xform, texRect, colors);
1033#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
1036 rrect.
transform(viewMatrix, &devRRect)) {
1067#ifndef SK_ENABLE_OPTIMIZE_SIZE
1069 !fCanUseDynamicMSAA &&
1070 !this->
caps()->reducedShaderMode() &&
1075 assert_alive(
paint);
1077 stroke, this->
caps()->shaderCaps());
1081 assert_alive(
paint);
1085#ifndef SK_ENABLE_OPTIMIZE_SIZE
1087 assert_alive(
paint);
1089 fContext, std::move(
paint), viewMatrix, rrect, stroke, this->
caps()->shaderCaps());
1097 assert_alive(
paint);
1098 this->drawShapeUsingPathRenderer(
clip, std::move(
paint), aa, viewMatrix,
1134 if (!isRRect && path.isRect(&rect)) {
1168 const SkScalar devSpaceAmbientBlur = devSpaceInsetWidth * umbraRecipAlpha;
1171 SkScalar ambientPathOutset = devSpaceInsetWidth * devToSrcScale;
1189 devSpaceInsetWidth = ambientRRect.
width();
1196 devSpaceAmbientBlur,
1197 devSpaceInsetWidth);
1209 devLightPos.
fY, devLightPos.
fZ,
1211 &spotScale, &spotOffset);
1215 &devSpaceSpotBlur, &spotScale, &spotOffset);
1218 const SkScalar srcSpaceSpotBlur = devSpaceSpotBlur * devToSrcScale;
1225 if (viewMatrix.invert(&ctmInverse)) {
1229 SkDebugf(
"Matrix is degenerate. Will not render spot shadow correctly!\n");
1237 rrect.
transform(shadowTransform, &spotShadowRRect);
1241 SkScalar blurOutset = srcSpaceSpotBlur;
1245 insetWidth += spotShadowRRect.
width();
1283 insetWidth += std::max(blurOutset, maxOffset);
1288 if (spotShadowRRect.
isOval()) {
1291 SkScalar outsetRad = spotRadius + blurOutset;
1303 2.0f * devSpaceSpotBlur,
1340 path.setIsVolatile(
true);
1342 return this->
drawPath(clip, std::move(
paint), aa, viewMatrix, path, style);
1368 this->
drawRect(clip, std::move(
paint), aa, viewMatrix, oval, &style);
1377#ifndef SK_ENABLE_OPTIMIZE_SIZE
1379 !fCanUseDynamicMSAA &&
1380 !this->
caps()->reducedShaderMode() &&
1385 assert_alive(
paint);
1387 this->
caps()->shaderCaps());
1396 assert_alive(
paint);
1400#ifndef SK_ENABLE_OPTIMIZE_SIZE
1402 assert_alive(
paint);
1404 this->
caps()->shaderCaps());
1412 assert_alive(
paint);
1413 this->drawShapeUsingPathRenderer(
clip, std::move(
paint), aa, viewMatrix,
1415 false, style, DoSimplify::kNo));
1434#ifndef SK_ENABLE_OPTIMIZE_SIZE
1451 assert_alive(
paint);
1454 this->drawShapeUsingPathRenderer(
clip, std::move(
paint), aa, viewMatrix,
1456 style, DoSimplify::kNo));
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,
nullptr,
nullptr, &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;
1952 skipDraw = !bounds.intersect(this->
asSurfaceProxy()->getBoundsRect());
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};
2131 skgpu::Mipmapped::kNo,
2145OpsTask* SurfaceDrawContext::replaceOpsTaskIfModifiesColor() {
#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
#define SkAssertResult(cond)
@ 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
static constexpr bool SkToBool(const T &x)
#define RETURN_FALSE_IF_ABANDONED
#define RETURN_IF_ABANDONED
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
bool asLine(SkPoint pts[2], bool *inverted) const
bool inverseFilled() const
const GrStyle & style() const
static GrStyledShape MakeArc(const SkRect &oval, SkScalar startAngleDegrees, SkScalar sweepAngleDegrees, bool useCenter, const GrStyle &style, DoSimplify=DoSimplify::kYes)
bool asNestedRects(SkRect rects[2]) const
GrStyledShape applyStyle(GrStyle::Apply apply, SkScalar scale) const
bool asRRect(SkRRect *rrect, SkPathDirection *dir, unsigned *start, bool *inverted) const
GrTextureProxy * asTextureProxy() 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::Join getJoin() const
SkPaint::Cap getCap() const
SkScalar getMiter() 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
void willReplaceOpsTask(OpsTask *prevTask, OpsTask *nextTask) override
bool stencilPath(const GrHardClip *, GrAA doStencilMSAA, const SkMatrix &viewMatrix, const SkPath &)
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)
void drawArc(const GrClip *, GrPaint &&paint, GrAA, const SkMatrix &viewMatrix, const SkRect &oval, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, const GrStyle &style)
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
OpsTask::CanDiscardPreviousOps canDiscardPreviousOpsOnFullClear() const override
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
#define ASSERT_SINGLE_OWNER
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)
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