Don't emit tessellated curves that only need one segment
A 1-segment curve is degenerate. Bug: skia:10419 Change-Id: I111625e43505b474a280885f726f0283c976879e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/416077 Reviewed-by: Jim Van Verth <jvanverth@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
parent
9aa5c2c860
commit
d4e19ac8c7
@ -34,34 +34,43 @@ public:
|
||||
}
|
||||
|
||||
SK_ALWAYS_INLINE void writeQuadratic(GrVertexChunkBuilder* chunker, const SkPoint p[3]) {
|
||||
if (GrWangsFormula::quadratic_pow4(kPrecision, p, fVectorXform) > fMaxSegments_pow4) {
|
||||
float numSegments_pow4 = GrWangsFormula::quadratic_pow4(kPrecision, p, fVectorXform);
|
||||
if (numSegments_pow4 > fMaxSegments_pow4) {
|
||||
this->chopAndWriteQuadratic(chunker, p);
|
||||
return;
|
||||
}
|
||||
if (numSegments_pow4 > 1) {
|
||||
if (GrVertexWriter vertexWriter = chunker->appendVertex()) {
|
||||
GrPathUtils::writeQuadAsCubic(p, &vertexWriter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SK_ALWAYS_INLINE void writeConic(GrVertexChunkBuilder* chunker, const SkPoint p[3], float w) {
|
||||
if (GrWangsFormula::conic_pow2(kPrecision, p, w, fVectorXform) > fMaxSegments_pow2) {
|
||||
float numSegments_pow2 = GrWangsFormula::conic_pow2(kPrecision, p, w, fVectorXform);
|
||||
if (numSegments_pow2 > fMaxSegments_pow2) {
|
||||
this->chopAndWriteConic(chunker, {p, w});
|
||||
return;
|
||||
}
|
||||
if (numSegments_pow2 > 1) {
|
||||
if (GrVertexWriter vertexWriter = chunker->appendVertex()) {
|
||||
GrTessellationShader::WriteConicPatch(p, w, &vertexWriter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SK_ALWAYS_INLINE void writeCubic(GrVertexChunkBuilder* chunker, const SkPoint p[4]) {
|
||||
if (GrWangsFormula::cubic_pow4(kPrecision, p, fVectorXform) > fMaxSegments_pow4) {
|
||||
float numSegments_pow4 = GrWangsFormula::cubic_pow4(kPrecision, p, fVectorXform);
|
||||
if (numSegments_pow4 > fMaxSegments_pow4) {
|
||||
this->chopAndWriteCubic(chunker, p);
|
||||
return;
|
||||
}
|
||||
if (numSegments_pow4 > 1) {
|
||||
if (GrVertexWriter vertexWriter = chunker->appendVertex()) {
|
||||
vertexWriter.writeArray(p, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void chopAndWriteQuadratic(GrVertexChunkBuilder* chunker, const SkPoint p[3]) {
|
||||
|
Loading…
Reference in New Issue
Block a user