154 const float maxInset = strokeRadius + 2.f * aaRadius;
168 return any(
rect.size() <= 2.f * (strokeRadius + aaRadius));
196 return strokeRadius <= aaRadius;
197 }
else if (shape.
isRect()) {
217 float winding = (xs[0] - xs[3])*(ys[1] - ys[0]) - (ys[0] - ys[3])*(xs[1] - xs[0]);
218 if (winding == 0.f) {
220 winding = (xs[2] - xs[1])*(ys[3] - ys[2]) - (ys[2] - ys[1])*(xs[3] - xs[2]);
226 return winding >= 0.f;
295 static constexpr float kOutset = 1.0;
296 static constexpr float kInset = -1.0;
298 static constexpr float kCenter = 1.f;
301 static constexpr float _______ = 0.f;
311 { {1.0f, 0.0f}, {1.0f, 0.0f}, kOutset, _______ },
312 { {1.0f, 0.0f}, {
kHR2,
kHR2}, kOutset, _______ },
313 { {0.0f, 1.0f}, {
kHR2,
kHR2}, kOutset, _______ },
314 { {0.0f, 1.0f}, {0.0f, 1.0f}, kOutset, _______ },
317 { {1.0f, 0.0f}, {
kHR2,
kHR2}, _______, _______ },
318 { {0.0f, 1.0f}, {
kHR2,
kHR2}, _______, _______ },
321 { {1.0f, 0.0f}, {1.0f, 0.0f},
kInset, _______ },
322 { {0.0f, 1.0f}, {0.0f, 1.0f},
kInset, _______ },
329 { {1.0f, 0.0f}, {1.0f, 0.0f},
kInset, kCenter },
343 Flags::kPerformsShading |
Flags::kEmitsCoverage |
Flags::kOutsetBoundsForAA,
434 return "float4 devPosition = analytic_rrect_vertex_fn("
436 "position, normal, normalScale, centerWeight, "
438 "xRadiiOrFlags, radiiOrQuadXs, ltrbOrQuadYs, center, depth, "
439 "float3x3(mat0, mat1, mat2), "
441 "jacobian, edgeDistances, xRadii, yRadii, strokeParams, perPixelControl, "
443 "stepLocalCoords);\n";
449 return "outputCoverage = analytic_rrect_coverage_fn(sk_FragCoord, "
471 float aaRadius =
params.transform().localAARadius(
bounds);
472 float strokeInset = 0.f;
484 float strokeRadius =
params.strokeStyle().halfWidth();
490 if (
any(innerGap <= 0.f) && strokeRadius > 0.f) {
492 strokeInset = -strokeRadius;
496 strokeInset = strokeRadius;
500 if (strokeRadius > 0.f || shape.
isLine()) {
503 float joinStyle =
params.strokeStyle().joinLimit();
504 float lineFlag = shape.
isLine() ? 1.f : 0.f;
513 switch(
params.strokeStyle().cap()) {
518 }
else if (
params.strokeStyle().isMiterJoin()) {
532 vw << -2.f << lineFlag << strokeRadius << joinStyle << xRadii
539 vw << (-2.f - xRadii) << yRadii <<
bounds.ltrb();
545 if (
params.geometry().isEdgeAAQuad()) {
566 vw << edgeSigns << quad.
xs() << quad.
ys();
568 vw << skvx::shuffle<2,1,0,3>(edgeSigns)
569 << skvx::shuffle<1,0,3,2>(quad.
xs())
570 << skvx::shuffle<1,0,3,2>(quad.
ys());
582 << skvx::shuffle<0,2,2,0>(ltrb)
583 << skvx::shuffle<1,1,3,3>(ltrb);
605 vw << center << centerWeight << aaRadius
606 <<
params.order().depthAsFloat()
608 <<
m.rc(0,0) <<
m.rc(1,0) <<
m.rc(3,0)
609 <<
m.rc(0,1) <<
m.rc(1,1) <<
m.rc(3,1)
610 <<
m.rc(0,3) <<
m.rc(1,3) <<
m.rc(3,3);
static const uint16_t kTL
static const uint16_t kBL
static const uint16_t kIndices[]
static const uint16_t kBR
static constexpr LocalCornerVert kCornerTemplate[19]
static const uint16_t kTR
static constexpr float kHR2
constexpr float SK_FloatSqrt2
sk_sp< const GrBuffer > fIndexBuffer
sk_sp< const GrBuffer > fVertexBuffer
@ kButt_Cap
no stroke extension
static bool AllCornersCircular(const SkRRect &rr, SkScalar tolerance=SK_ScalarNearlyZero)
SkVector radii(Corner corner) 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
std::string vertexSkSL() const override
~AnalyticRRectRenderStep() override
void writeVertices(DrawWriter *, const DrawParams &, skvx::ushort2 ssboIndices) const override
void writeUniformsAndTextures(const DrawParams &, PipelineDataGatherer *) const override
const char * fragmentCoverageSkSL() const override
AnalyticRRectRenderStep(StaticBufferManager *bufferManager)
const skvx::float4 & ys() const
const skvx::float4 & xs() const
SkEnumBitMask< Flags > edgeFlags() const
const EdgeAAQuad & edgeAAQuad() const
const Shape & shape() const
bool isEdgeAAQuad() const
skvx::float4 line() const
const SkRRect & rrect() const
const Rect & rect() const
const EmbeddedViewParams * params
EMSCRIPTEN_KEEPALIVE void empty()
Optional< SkRect > bounds
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 keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
static bool opposite_insets_intersect(const SkRRect &rrect, float strokeRadius, float aaRadius)
static constexpr float kComplexAAInsets
static constexpr float kFilledStrokeInterior
static void write_index_buffer(VertexWriter writer)
static bool is_clockwise(const EdgeAAQuad &quad)
static constexpr DepthStencilSettings kDirectDepthGreaterPass
static constexpr int kIndexCount
static skvx::float4 load_x_radii(const SkRRect &rrect)
static constexpr int kCornerVertexCount
static constexpr int kVertexCount
static constexpr float kSolidInterior
static constexpr float kStrokeInterior
static void write_vertex_buffer(VertexWriter writer)
static skvx::float4 load_y_radii(const SkRRect &rrect)
static skvx::float2 quad_center(const EdgeAAQuad &quad)
SINT T dot(const Vec< N, T > &a, const Vec< N, T > &b)
SIT bool all(const Vec< 1, T > &x)
SIT bool any(const Vec< 1, T > &x)