Flutter Engine
The Flutter Engine
Classes | Typedefs | Functions | Variables
TriangulatingPathRendererTests.cpp File Reference
#include "include/core/SkAlphaType.h"
#include "include/core/SkBlendMode.h"
#include "include/core/SkColor.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPath.h"
#include "include/core/SkPathTypes.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkScalar.h"
#include "include/core/SkString.h"
#include "include/core/SkStrokeRec.h"
#include "include/core/SkSurfaceProps.h"
#include "include/core/SkTileMode.h"
#include "include/core/SkTypes.h"
#include "include/effects/SkGradientShader.h"
#include "include/gpu/GpuTypes.h"
#include "include/gpu/GrDirectContext.h"
#include "include/gpu/GrTypes.h"
#include "include/private/base/SkTemplates.h"
#include "include/private/gpu/ganesh/GrTypesPriv.h"
#include "src/base/SkArenaAlloc.h"
#include "src/base/SkFloatBits.h"
#include "src/base/SkRandom.h"
#include "src/core/SkPathPriv.h"
#include "src/gpu/SkBackingFit.h"
#include "src/gpu/ganesh/GrColorInfo.h"
#include "src/gpu/ganesh/GrEagerVertexAllocator.h"
#include "src/gpu/ganesh/GrFPArgs.h"
#include "src/gpu/ganesh/GrFragmentProcessor.h"
#include "src/gpu/ganesh/GrFragmentProcessors.h"
#include "src/gpu/ganesh/GrPaint.h"
#include "src/gpu/ganesh/GrStyle.h"
#include "src/gpu/ganesh/GrUserStencilSettings.h"
#include "src/gpu/ganesh/PathRenderer.h"
#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/effects/GrPorterDuffXferProcessor.h"
#include "src/gpu/ganesh/geometry/GrAATriangulator.h"
#include "src/gpu/ganesh/geometry/GrInnerFanTriangulator.h"
#include "src/gpu/ganesh/geometry/GrPathUtils.h"
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
#include "src/gpu/ganesh/geometry/GrTriangulator.h"
#include "src/gpu/ganesh/ops/TriangulatingPathRenderer.h"
#include "tests/CtsEnforcement.h"
#include "tests/Test.h"
#include "tools/ToolUtils.h"
#include <cmath>
#include <cstddef>
#include <initializer_list>
#include <map>
#include <memory>
#include <utility>

Go to the source code of this file.

Classes

struct  Edge
 

Typedefs

using CreatePathFn = SkPath(*)()
 
using EdgeMap = std::map< Edge, int >
 

Functions

static bool operator< (const Edge &a, const Edge &b)
 
static void add_edge (EdgeMap &edgeMap, SkPoint p0, SkPoint p1)
 
static void add_tri_edges (skiatest::Reporter *r, EdgeMap &edgeMap, const SkPoint pts[3])
 
static EdgeMap simplify (const EdgeMap &edges, SkPathFillType fillType)
 
static void verify_simple_inner_polygons (skiatest::Reporter *r, const char *shapeName, SkPath path)
 
 DEF_TEST (GrInnerFanTriangulator, r)
 
 DEF_TEST (Triangulator_Crbug1262444, r)
 
 DEF_TEST (Triangulator_Crbug337080025, r)
 

Variables

CreatePathFn kNonEdgeAAPaths []
 

Typedef Documentation

◆ CreatePathFn

using CreatePathFn = SkPath(*)()

Definition at line 75 of file TriangulatingPathRendererTests.cpp.

◆ EdgeMap

using EdgeMap = std::map<Edge, int>

Definition at line 971 of file TriangulatingPathRendererTests.cpp.

Function Documentation

◆ add_edge()

static void add_edge ( EdgeMap edgeMap,
SkPoint  p0,
SkPoint  p1 
)
static

Definition at line 973 of file TriangulatingPathRendererTests.cpp.

973 {
974 Edge edge{p0, p1};
975 // First check if this edge already exists in reverse.
976 auto reverseIter = edgeMap.find(edge.reverse());
977 if (reverseIter != edgeMap.end()) {
978 --reverseIter->second;
979 } else {
980 ++edgeMap[edge];
981 }
982}

◆ add_tri_edges()

static void add_tri_edges ( skiatest::Reporter r,
EdgeMap edgeMap,
const SkPoint  pts[3] 
)
static

Definition at line 984 of file TriangulatingPathRendererTests.cpp.

984 {
985 for (int i = 0; i < 3; ++i) {
986 SkPoint p0=pts[i], p1=pts[(i+1)%3];
987 // The triangulator shouldn't output degenerate triangles.
988 REPORTER_ASSERT(r, p0 != p1);
989 add_edge(edgeMap, p0, p1);
990 }
991}
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
static void add_edge(EdgeMap &edgeMap, SkPoint p0, SkPoint p1)

◆ DEF_TEST() [1/3]

DEF_TEST ( GrInnerFanTriangulator  ,
 
)

Definition at line 1123 of file TriangulatingPathRendererTests.cpp.

1123 {
1124 verify_simple_inner_polygons(r, "simple triangle", SkPath().lineTo(1,0).lineTo(0,1));
1125 verify_simple_inner_polygons(r, "simple square", SkPath().lineTo(1,0).lineTo(1,1).lineTo(0,1));
1126 verify_simple_inner_polygons(r, "concave polygon", SkPath()
1127 .lineTo(1,0).lineTo(.5f,.5f).lineTo(1,1).lineTo(0,1));
1128 verify_simple_inner_polygons(r, "double wound triangle", SkPath()
1129 .lineTo(1,0).lineTo(0,1).lineTo(0,0).lineTo(1,0).lineTo(0,1));
1130 verify_simple_inner_polygons(r, "self-intersecting bowtie", SkPath()
1131 .lineTo(1,0).lineTo(0,1).lineTo(1,1));
1132 verify_simple_inner_polygons(r, "asymmetrical bowtie", SkPath()
1133 .lineTo(1,0).lineTo(0,1).lineTo(.1f,-.1f));
1134 verify_simple_inner_polygons(r, "bowtie with extremely small section", SkPath()
1135 .lineTo(1,0).lineTo(0,1).lineTo(1e-6f,-1e-6f));
1136 verify_simple_inner_polygons(r, "intersecting squares", SkPath()
1137 .lineTo(1,0).lineTo(1,1).lineTo(0,1)
1138 .moveTo(.5f,.5f).lineTo(1.5f,.5f).lineTo(1.5f,1.5f).lineTo(.5f,1.5f).close());
1139 verify_simple_inner_polygons(r, "6-point \"Star of David\"", SkPath()
1140 .moveTo(cosf(-SK_ScalarPI/3), sinf(-SK_ScalarPI/3))
1141 .lineTo(cosf(SK_ScalarPI/3), sinf(SK_ScalarPI/3))
1142 .lineTo(cosf(SK_ScalarPI), sinf(SK_ScalarPI))
1143 .moveTo(cosf(0), sinf(0))
1144 .lineTo(cosf(2*SK_ScalarPI/3), sinf(2*SK_ScalarPI/3))
1145 .lineTo(cosf(-2*SK_ScalarPI/3), sinf(-2*SK_ScalarPI/3)));
1146 verify_simple_inner_polygons(r, "double wound \"Star of David\"", SkPath()
1147 .moveTo(cosf(-SK_ScalarPI/3), sinf(-SK_ScalarPI/3))
1148 .lineTo(cosf(SK_ScalarPI/3), sinf(SK_ScalarPI/3))
1149 .lineTo(cosf(SK_ScalarPI), sinf(SK_ScalarPI))
1150 .lineTo(cosf(-SK_ScalarPI/3), sinf(-SK_ScalarPI/3))
1151 .lineTo(cosf(SK_ScalarPI/3), sinf(SK_ScalarPI/3))
1152 .lineTo(cosf(SK_ScalarPI), sinf(SK_ScalarPI))
1153 .moveTo(cosf(0), sinf(0))
1154 .lineTo(cosf(2*SK_ScalarPI/3), sinf(2*SK_ScalarPI/3))
1155 .lineTo(cosf(-2*SK_ScalarPI/3), sinf(-2*SK_ScalarPI/3)));
1157 verify_simple_inner_polygons(r, "\"pointy\" intersecting triangles", SkPath()
1158 .moveTo(0,-100).lineTo(-1e-6f,100).lineTo(1e-6f,100)
1159 .moveTo(-100,0).lineTo(100,1e-6f).lineTo(100,-1e-6f));
1160 verify_simple_inner_polygons(r, "overlapping rects with vertical collinear edges", SkPath()
1161 .moveTo(0,0).lineTo(0,2).lineTo(1,2).lineTo(1,0)
1162 .moveTo(0,1).lineTo(0,3).lineTo(1,3).lineTo(1,1));
1163 verify_simple_inner_polygons(r, "overlapping rects with horizontal collinear edges", SkPath()
1164 .lineTo(2,0).lineTo(2,1).lineTo(0,1)
1165 .moveTo(1,0).lineTo(3,0).lineTo(3,1).lineTo(1,1).close());
1166 for (int i = 0; i < (int)std::size(kNonEdgeAAPaths); ++i) {
1167 verify_simple_inner_polygons(r, SkStringPrintf("kNonEdgeAAPaths[%i]", i).c_str(),
1168 kNonEdgeAAPaths[i]());
1169 }
1170 SkRandom rand;
1171 for (int i = 0; i < 50; ++i) {
1172 auto randomPath = SkPath().moveTo(rand.nextF(), rand.nextF());
1173 for (int j = 0; j < i; ++j) {
1174 randomPath.lineTo(rand.nextF(), rand.nextF());
1175 }
1176 verify_simple_inner_polygons(r, SkStringPrintf("random_path_%i", i).c_str(), randomPath);
1177 }
1178}
#define SK_ScalarPI
Definition: SkScalar.h:21
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
CreatePathFn kNonEdgeAAPaths[]
static void verify_simple_inner_polygons(skiatest::Reporter *r, const char *shapeName, SkPath path)
Definition: SkPath.h:59
SkPath & moveTo(SkScalar x, SkScalar y)
Definition: SkPath.cpp:688
SkPath & lineTo(SkScalar x, SkScalar y)
Definition: SkPath.cpp:728
float nextF()
Definition: SkRandom.h:55
SkPath make_star(const SkRect &bounds, int numPts, int step)
Definition: ToolUtils.cpp:269
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
Definition: switches.h:259
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609

◆ DEF_TEST() [2/3]

DEF_TEST ( Triangulator_Crbug1262444  ,
 
)

Definition at line 1180 of file TriangulatingPathRendererTests.cpp.

1180 {
1181 SkPath path;
1182
1183 path.setFillType(SkPathFillType::kWinding);
1184 path.moveTo(SkBits2Float(0x3fe0633f), SkBits2Float(0x3d04a60d)); // 1.75303f, 0.0323849f
1185 path.cubicTo(SkBits2Float(0x3fe27540), SkBits2Float(0x3dff593f), SkBits2Float(0x3fe45241),
1186 SkBits2Float(0x3e5e2fbb), SkBits2Float(0x3fe55b41), SkBits2Float(
1187 0x3e9e596d)); // 1.7692f, 0.124682f, 1.78376f, 0.216979f, 1.79185f, 0.309276f
1188 path.cubicTo(SkBits2Float(0x3fe5fa41), SkBits2Float(0x3eb3e79c), SkBits2Float(0x3fe62f41),
1189 SkBits2Float(0x3ec975cb), SkBits2Float(0x3fe69941), SkBits2Float(
1190 0x3edfd837)); // 1.7967f, 0.351376f, 1.79832f, 0.393477f, 1.80155f, 0.437196f
1191 path.cubicTo(SkBits2Float(0x3fe70341), SkBits2Float(0x3f064e87), SkBits2Float(0x3fe6ce41),
1192 SkBits2Float(0x3f1cb0f2), SkBits2Float(0x3fe59041), SkBits2Float(
1193 0x3f33135e)); // 1.80479f, 0.524636f, 1.80317f, 0.612075f, 1.79346f, 0.699514f
1194 path.cubicTo(SkBits2Float(0x3fe48740), SkBits2Float(0x3f468ef5), SkBits2Float(0x3fe2df40),
1195 SkBits2Float(0x3f59a06d), SkBits2Float(0x3fe02e3f), SkBits2Float(
1196 0x3f6cb1e6)); // 1.78538f, 0.775619f, 1.77244f, 0.850104f, 1.75141f, 0.92459f
1197 path.cubicTo(SkBits2Float(0x3fde863f), SkBits2Float(0x3f78b759), SkBits2Float(0x3fdc743e),
1198 SkBits2Float(0x3f822957), SkBits2Float(0x3fd9c33e), SkBits2Float(
1199 0x3f87f701)); // 1.73847f, 0.971548f, 1.7223f, 1.01689f, 1.70127f, 1.06223f
1200 path.cubicTo(SkBits2Float(0x3fd98e3e), SkBits2Float(0x3f88611f), SkBits2Float(0x3fd9593e),
1201 SkBits2Float(0x3f88cb3e), SkBits2Float(0x3fd9243d), SkBits2Float(
1202 0x3f896a6b)); // 1.69965f, 1.06546f, 1.69804f, 1.0687f, 1.69642f, 1.07356f
1203 path.cubicTo(SkBits2Float(0x3fd63e3c), SkBits2Float(0x3f8fa234), SkBits2Float(0x3fd2ee3b),
1204 SkBits2Float(0x3f95d9fd), SkBits2Float(0x3fd2ee3b), SkBits2Float(
1205 0x3f9ce602)); // 1.67377f, 1.12214f, 1.6479f, 1.17071f, 1.6479f, 1.22577f
1206 path.cubicTo(SkBits2Float(0x3fd3233b), SkBits2Float(0x3f9cb0f3), SkBits2Float(0x3fd3583b),
1207 SkBits2Float(0x3f9cb0f3), SkBits2Float(0x3fd3c23c), SkBits2Float(
1208 0x3f9c7be4)); // 1.64951f, 1.22415f, 1.65113f, 1.22415f, 1.65437f, 1.22253f
1209 path.cubicTo(SkBits2Float(0x3fd3c23c), SkBits2Float(0x3f9cb0f3), SkBits2Float(0x3fd3c23c),
1210 SkBits2Float(0x3f9cb0f3), SkBits2Float(0x3fd3c23c), SkBits2Float(
1211 0x3f9ce602)); // 1.65437f, 1.22415f, 1.65437f, 1.22415f, 1.65437f, 1.22577f
1212 path.cubicTo(SkBits2Float(0x3fd5353c), SkBits2Float(0x3f9c46d4), SkBits2Float(0x3fd6dd3d),
1213 SkBits2Float(0x3f9bdcb6), SkBits2Float(0x3fd7b13d), SkBits2Float(
1214 0x3f9ad36a)); // 1.66569f, 1.22091f, 1.67863f, 1.21767f, 1.6851f, 1.20958f
1215 path.cubicTo(SkBits2Float(0x3fda623e), SkBits2Float(0x3f96ae3a), SkBits2Float(0x3fdca93f),
1216 SkBits2Float(0x3f921eeb), SkBits2Float(0x3fdf253f), SkBits2Float(
1217 0x3f8dc4ab)); // 1.70612f, 1.17719f, 1.72391f, 1.14157f, 1.74332f, 1.10756f
1218 path.cubicTo(SkBits2Float(0x3fe0983f), SkBits2Float(0x3f8b12e5), SkBits2Float(0x3fe1d640),
1219 SkBits2Float(0x3f87f700), SkBits2Float(0x3fe3b340), SkBits2Float(
1220 0x3f857a4a)); // 1.75465f, 1.08651f, 1.76435f, 1.06223f, 1.77891f, 1.04279f
1221 path.cubicTo(SkBits2Float(0x3fe48740), SkBits2Float(0x3f8470fe), SkBits2Float(0x3fe62f40),
1222 SkBits2Float(0x3f8470fe), SkBits2Float(0x3fe7d741), SkBits2Float(
1223 0x3f843bef)); // 1.78538f, 1.0347f, 1.79832f, 1.0347f, 1.81126f, 1.03308f
1224 path.cubicTo(SkBits2Float(0x3fe2aa40), SkBits2Float(0x3f943182), SkBits2Float(0x3fda623d),
1225 SkBits2Float(0x3fa2498e), SkBits2Float(0x3fceff3a), SkBits2Float(
1226 0x3fae4f01)); // 1.77082f, 1.15776f, 1.70612f, 1.26787f, 1.61716f, 1.36179f
1227 path.cubicTo(SkBits2Float(0x3fce6039), SkBits2Float(0x3faf233e), SkBits2Float(0x3fcd2239),
1228 SkBits2Float(0x3faf584d), SkBits2Float(0x3fcc1939), SkBits2Float(
1229 0x3fafc26b)); // 1.61231f, 1.36826f, 1.60261f, 1.36988f, 1.59452f, 1.37312f
1230 path.cubicTo(SkBits2Float(0x3fcc1939), SkBits2Float(0x3faff77a), SkBits2Float(0x3fcc1939),
1231 SkBits2Float(0x3faff77a), SkBits2Float(0x3fcc4e39), SkBits2Float(
1232 0x3fb02c89)); // 1.59452f, 1.37474f, 1.59452f, 1.37474f, 1.59614f, 1.37636f
1233 path.cubicTo(SkBits2Float(0x3fcc1939), SkBits2Float(0x3fb02c89), SkBits2Float(0x3fcc1939),
1234 SkBits2Float(0x3fb02c89), SkBits2Float(0x3fcbe439), SkBits2Float(
1235 0x3fb02c89)); // 1.59452f, 1.37636f, 1.59452f, 1.37636f, 1.5929f, 1.37636f
1236 path.cubicTo(SkBits2Float(0x3fcbe439), SkBits2Float(0x3fb20a12), SkBits2Float(0x3fcb4539),
1237 SkBits2Float(0x3fb37d7d), SkBits2Float(0x3fc99d39), SkBits2Float(
1238 0x3fb3b28c)); // 1.5929f, 1.39093f, 1.58805f, 1.40227f, 1.57511f, 1.40389f
1239 path.cubicTo(SkBits2Float(0x3fc93339), SkBits2Float(0x3fb3e79b), SkBits2Float(0x3fc8c938),
1240 SkBits2Float(0x3fb41caa), SkBits2Float(0x3fc7f538), SkBits2Float(
1241 0x3fb41caa)); // 1.57188f, 1.40551f, 1.56864f, 1.40712f, 1.56217f, 1.40712f
1242 path.cubicTo(SkBits2Float(0x3fc7f538), SkBits2Float(0x3fb3e79b), SkBits2Float(0x3fc7f538),
1243 SkBits2Float(0x3fb3e79b), SkBits2Float(0x3fc7f538), SkBits2Float(
1244 0x3fb3b28c)); // 1.56217f, 1.40551f, 1.56217f, 1.40551f, 1.56217f, 1.40389f
1245 path.lineTo(SkBits2Float(0x3fc7c038), SkBits2Float(0x3fb3b28c)); // 1.56055f, 1.40389f
1246 path.cubicTo(SkBits2Float(0x3fc7c038), SkBits2Float(0x3fb4f0e7), SkBits2Float(0x3fc7f538),
1247 SkBits2Float(0x3fb66452), SkBits2Float(0x3fc78b38), SkBits2Float(
1248 0x3fb76d9e)); // 1.56055f, 1.4136f, 1.56217f, 1.42494f, 1.55894f, 1.43303f
1249 path.cubicTo(SkBits2Float(0x3fc3d137), SkBits2Float(0x3fbe4495), SkBits2Float(0x3fbf4336),
1250 SkBits2Float(0x3fc4123e), SkBits2Float(0x3fb80434), SkBits2Float(
1251 0x3fc76331)); // 1.52982f, 1.48647f, 1.49424f, 1.53181f, 1.43763f, 1.55771f
1252 path.cubicTo(SkBits2Float(0x3fb47f33), SkBits2Float(0x3fc90bac), SkBits2Float(0x3fb19932),
1253 SkBits2Float(0x3fcb5353), SkBits2Float(0x3faf1d31), SkBits2Float(
1254 0x3fce6f37)); // 1.41013f, 1.57067f, 1.38749f, 1.58848f, 1.36808f, 1.61277f
1255 path.cubicTo(SkBits2Float(0x3fa4592e), SkBits2Float(0x3fdb13d7), SkBits2Float(0x3f974e2a),
1256 SkBits2Float(0x3fe53bc1), SkBits2Float(0x3f896f25), SkBits2Float(
1257 0x3fee5a5f)); // 1.28397f, 1.71154f, 1.18207f, 1.79089f, 1.0737f, 1.86213f
1258 path.cubicTo(SkBits2Float(0x3f6b883f), SkBits2Float(0x3ffb691f), SkBits2Float(0x3f42f434),
1259 SkBits2Float(0x400367b2), SkBits2Float(0x3f184e28), SkBits2Float(
1260 0x4008611f)); // 0.920048f, 1.96415f, 0.761539f, 2.0532f, 0.594943f, 2.13093f
1261 path.cubicTo(SkBits2Float(0x3f184e28), SkBits2Float(0x4008611f), SkBits2Float(0x3f17e428),
1262 SkBits2Float(0x4008611f), SkBits2Float(0x3f17e428), SkBits2Float(
1263 0x40087ba7)); // 0.594943f, 2.13093f, 0.593325f, 2.13093f, 0.593325f, 2.13255f
1264 path.cubicTo(SkBits2Float(0x3effc044), SkBits2Float(0x400b47f5), SkBits2Float(0x3ed08c36),
1265 SkBits2Float(0x400e2eca), SkBits2Float(0x3e9edc28), SkBits2Float(
1266 0x401090f9)); // 0.499514f, 2.17627f, 0.40732f, 2.22161f, 0.310273f, 2.25885f
1267 path.cubicTo(SkBits2Float(0x3e5a5832), SkBits2Float(0x4012f328), SkBits2Float(0x3de40030),
1268 SkBits2Float(0x4014811a), SkBits2Float(0x3c1a7f9e), SkBits2Float(
1269 0x40158a66)); // 0.213227f, 2.29609f, 0.111328f, 2.32038f, 0.00942984f, 2.33657f
1270 path.lineTo(SkBits2Float(0x3c1a7f9e), SkBits2Float(0x401bf73d)); // 0.00942984f, 2.43697f
1271 path.cubicTo(SkBits2Float(0x3dc98028), SkBits2Float(0x401b580f), SkBits2Float(0x3e3fd82e),
1272 SkBits2Float(0x401a694b), SkBits2Float(0x3e8ca424), SkBits2Float(
1273 0x40191068)); // 0.098389f, 2.42725f, 0.187348f, 2.41268f, 0.27469f, 2.39163f
1274 path.cubicTo(SkBits2Float(0x3e94ec27), SkBits2Float(0x4018db59), SkBits2Float(0x3e9d3429),
1275 SkBits2Float(0x40188bc2), SkBits2Float(0x3ea4a82b), SkBits2Float(
1276 0x401856b3)); // 0.290864f, 2.38839f, 0.307039f, 2.38353f, 0.321596f, 2.38029f
1277 path.cubicTo(SkBits2Float(0x3eae982e), SkBits2Float(0x4018071c), SkBits2Float(0x3eb95c31),
1278 SkBits2Float(0x40179cfe), SkBits2Float(0x3ec34c34), SkBits2Float(
1279 0x40174d67)); // 0.341005f, 2.37543f, 0.362031f, 2.36896f, 0.381441f, 2.3641f
1280 path.cubicTo(SkBits2Float(0x3ec9ec36), SkBits2Float(0x40171858), SkBits2Float(0x3ed08c38),
1281 SkBits2Float(0x4016c8c1), SkBits2Float(0x3ed8003a), SkBits2Float(
1282 0x401693b2)); // 0.39438f, 2.36086f, 0.40732f, 2.356f, 0.421877f, 2.35276f
1283 path.cubicTo(SkBits2Float(0x3eda7c3a), SkBits2Float(0x4016792a), SkBits2Float(0x3eddcc3c),
1284 SkBits2Float(0x40165ea3), SkBits2Float(0x3ee0483c), SkBits2Float(
1285 0x4016441b)); // 0.426729f, 2.35115f, 0.433199f, 2.34953f, 0.438051f, 2.34791f
1286 path.cubicTo(SkBits2Float(0x3ee2c43d), SkBits2Float(0x40162993), SkBits2Float(0x3ee5403e),
1287 SkBits2Float(0x40160f0c), SkBits2Float(0x3ee8903f), SkBits2Float(
1288 0x4015f484)); // 0.442903f, 2.34629f, 0.447756f, 2.34467f, 0.454226f, 2.34305f
1289 path.cubicTo(SkBits2Float(0x3f1c082a), SkBits2Float(0x4012be17), SkBits2Float(0x3f422036),
1290 SkBits2Float(0x400e63d8), SkBits2Float(0x3f66fa40), SkBits2Float(
1291 0x40096a6a)); // 0.6095f, 2.29285f, 0.758304f, 2.22484f, 0.902256f, 2.14712f
1292 path.cubicTo(SkBits2Float(0x3f6a4a41), SkBits2Float(0x4009004c), SkBits2Float(0x3f6d3042),
1293 SkBits2Float(0x4008962d), SkBits2Float(0x3f708043), SkBits2Float(
1294 0x40081187)); // 0.915196f, 2.14064f, 0.926518f, 2.13417f, 0.939457f, 2.12607f
1295 path.cubicTo(SkBits2Float(0x3f7efe47), SkBits2Float(0x4005feef), SkBits2Float(0x3f868925),
1296 SkBits2Float(0x4003b748), SkBits2Float(0x3f8d5e28), SkBits2Float(
1297 0x40015519)); // 0.996067f, 2.09368f, 1.05106f, 2.05806f, 1.10444f, 2.02082f
1298 path.cubicTo(SkBits2Float(0x3f97b82b), SkBits2Float(0x3ffb691d), SkBits2Float(0x3fa1a82e),
1299 SkBits2Float(0x3ff388da), SkBits2Float(0x3fab9830), SkBits2Float(
1300 0x3feb7389)); // 1.18531f, 1.96415f, 1.26294f, 1.90261f, 1.34058f, 1.83946f
1301 path.cubicTo(SkBits2Float(0x3fb20332), SkBits2Float(0x3fe6450c), SkBits2Float(0x3fb80434),
1302 SkBits2Float(0x3fe0e181), SkBits2Float(0x3fbd6635), SkBits2Float(
1303 0x3fda3f99)); // 1.39072f, 1.79898f, 1.43763f, 1.75688f, 1.47968f, 1.70507f
1304 path.cubicTo(SkBits2Float(0x3fbf4336), SkBits2Float(0x3fd7f7f2), SkBits2Float(0x3fc12037),
1305 SkBits2Float(0x3fd5b04b), SkBits2Float(0x3fc2fd36), SkBits2Float(
1306 0x3fd33394)); // 1.49424f, 1.68725f, 1.5088f, 1.66944f, 1.52335f, 1.65001f
1307 path.cubicTo(SkBits2Float(0x3fc5e337), SkBits2Float(0x3fcf7881), SkBits2Float(0x3fc8c938),
1308 SkBits2Float(0x3fcbbd70), SkBits2Float(0x3fcbaf38), SkBits2Float(
1309 0x3fc8025d)); // 1.546f, 1.62086f, 1.56864f, 1.59172f, 1.59128f, 1.56257f
1310 path.cubicTo(SkBits2Float(0x3fceff39), SkBits2Float(0x3fc3a81e), SkBits2Float(0x3fd2843b),
1311 SkBits2Float(0x3fbf18cf), SkBits2Float(0x3fd5d43b), SkBits2Float(
1312 0x3fbabe8f)); // 1.61716f, 1.52857f, 1.64466f, 1.49294f, 1.67054f, 1.45894f
1313 path.cubicTo(SkBits2Float(0x3fd8503c), SkBits2Float(0x3fb7a2ab), SkBits2Float(0x3fda973d),
1314 SkBits2Float(0x3fb486c7), SkBits2Float(0x3fdca93e), SkBits2Float(
1315 0x3fb135d3)); // 1.68995f, 1.43465f, 1.70774f, 1.41036f, 1.72391f, 1.38446f
1316 path.cubicTo(SkBits2Float(0x3fe5c541), SkBits2Float(0x3fa2b3aa), SkBits2Float(0x3feb5c42),
1317 SkBits2Float(0x3f92be16), SkBits2Float(0x3ff15d44), SkBits2Float(
1318 0x3f82c882)); // 1.79508f, 1.27111f, 1.83875f, 1.14643f, 1.88566f, 1.02174f
1319 path.cubicTo(SkBits2Float(0x3ff1fc44), SkBits2Float(0x3f812008), SkBits2Float(0x3ff23144),
1320 SkBits2Float(0x3f7e1adf), SkBits2Float(0x3ff29b44), SkBits2Float(
1321 0x3f7a5fcc)); // 1.89051f, 1.00879f, 1.89213f, 0.992598f, 1.89536f, 0.978024f
1322 path.cubicTo(SkBits2Float(0x3ff47845), SkBits2Float(0x3f5fd830), SkBits2Float(0x3ff65545),
1323 SkBits2Float(0x3f455094), SkBits2Float(0x3ff6bf45), SkBits2Float(
1324 0x3f2a5ed9)); // 1.90992f, 0.874393f, 1.92448f, 0.770761f, 1.92771f, 0.66551f
1325 path.cubicTo(SkBits2Float(0x3ff33a44), SkBits2Float(0x3f0d5a87), SkBits2Float(0x3ff08943),
1326 SkBits2Float(0x3edf03ee), SkBits2Float(0x3fee7743), SkBits2Float(
1327 0x3ea352cf)); // 1.90022f, 0.552163f, 1.87919f, 0.435577f, 1.86301f, 0.318991f
1328 path.cubicTo(SkBits2Float(0x3feccf42), SkBits2Float(0x3e5c872d), SkBits2Float(0x3feb9142),
1329 SkBits2Float(0x3de4d179), SkBits2Float(0x3feaf242), SkBits2Float(
1330 0x3c04a4ae)); // 1.85008f, 0.215359f, 1.84037f, 0.111728f, 1.83552f, 0.0080959f
1331 path.lineTo(SkBits2Float(0x3fe02e3f), SkBits2Float(0x3c04a4ae)); // 1.75141f, 0.0080959f
1332 path.cubicTo(SkBits2Float(0x3fdff93f), SkBits2Float(0x3c6ec47e), SkBits2Float(0x3fe02e3f),
1333 SkBits2Float(0x3cb9b545), SkBits2Float(0x3fe0633f), SkBits2Float(
1334 0x3d04a60d)); // 1.74979f, 0.0145732f, 1.75141f, 0.0226694f, 1.75303f, 0.0323849f
1335 path.close();
1336 path.moveTo(SkBits2Float(0x3fe97f42), SkBits2Float(0x3f7b9e2e)); // 1.8242f, 0.982882f
1337 path.cubicTo(SkBits2Float(0x3fe91542), SkBits2Float(0x3f7eef21), SkBits2Float(0x3fe87642),
1338 SkBits2Float(0x3f81551a), SkBits2Float(0x3fe7d741), SkBits2Float(
1339 0x3f82fd94)); // 1.82096f, 0.995836f, 1.81611f, 1.01041f, 1.81126f, 1.02336f
1340 path.cubicTo(SkBits2Float(0x3fe6ce41), SkBits2Float(0x3f81bf39), SkBits2Float(0x3fe66441),
1341 SkBits2Float(0x3f8080dd), SkBits2Float(0x3fe66441), SkBits2Float(
1342 0x3f7e1ae4)); // 1.80317f, 1.01365f, 1.79993f, 1.00393f, 1.79993f, 0.992598f
1343 path.cubicTo(SkBits2Float(0x3fe66441), SkBits2Float(0x3f7c726a), SkBits2Float(0x3fe69941),
1344 SkBits2Float(0x3f7b340e), SkBits2Float(0x3fe6ce41), SkBits2Float(
1345 0x3f798b95)); // 1.79993f, 0.986121f, 1.80155f, 0.981263f, 1.80317f, 0.974786f
1346 path.cubicTo(SkBits2Float(0x3fe70341), SkBits2Float(0x3f78b758), SkBits2Float(0x3fe76d41),
1347 SkBits2Float(0x3f770edf), SkBits2Float(0x3fe7d741), SkBits2Float(
1348 0x3f770edf)); // 1.80479f, 0.971548f, 1.80802f, 0.965071f, 1.81126f, 0.965071f
1349 path.cubicTo(SkBits2Float(0x3fe84141), SkBits2Float(0x3f770edf), SkBits2Float(0x3fe8ab42),
1350 SkBits2Float(0x3f770edf), SkBits2Float(0x3fe8e041), SkBits2Float(
1351 0x3f7778fd)); // 1.81449f, 0.965071f, 1.81773f, 0.965071f, 1.81934f, 0.96669f
1352 path.cubicTo(SkBits2Float(0x3fe97f42), SkBits2Float(0x3f77e31b), SkBits2Float(0x3fe9e942),
1353 SkBits2Float(0x3f798b95), SkBits2Float(0x3fe97f42), SkBits2Float(
1354 0x3f7b9e2e)); // 1.8242f, 0.968309f, 1.82743f, 0.974786f, 1.8242f, 0.982882f
1355 path.close();
1356
1357 float kTol = 0.25f;
1358 SkRect clipBounds = SkRect::MakeLTRB(0, 0, 14, 14);
1359 SimplerVertexAllocator alloc;
1360
1361 int vertexCount = GrAATriangulator::PathToAATriangles(path, kTol, clipBounds, &alloc);
1362 REPORTER_ASSERT(r, vertexCount == 0);
1363}
static float SkBits2Float(uint32_t bits)
Definition: SkFloatBits.h:48
static int PathToAATriangles(const SkPath &path, SkScalar tolerance, const SkRect &clipBounds, GrEagerVertexAllocator *vertexAllocator)
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
Definition: switches.h:57
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition: SkRect.h:646

◆ DEF_TEST() [3/3]

DEF_TEST ( Triangulator_Crbug337080025  ,
 
)

Definition at line 1365 of file TriangulatingPathRendererTests.cpp.

1365 {
1366 SkPath path;
1367
1368 path.setFillType(SkPathFillType::kWinding);
1369 path.moveTo(SkBits2Float(0x71ec7478),
1370 SkBits2Float(0xe18cc1ac)); // 2.34173646e+30f, -3.24562462e+20f
1371 path.lineTo(SkBits2Float(0x71ec7478),
1372 SkBits2Float(0xe189ac7b)); // 2.34173646e+30f, -3.17454058e+20f
1373 path.lineTo(SkBits2Float(0x71ec7478),
1374 SkBits2Float(0x618fd6dd)); // 2.34173646e+30f, 3.31670867e+20f
1375 path.lineTo(SkBits2Float(0x71ec7478),
1376 SkBits2Float(0x6192ec0e)); // 2.34173646e+30f, 3.38779271e+20f
1377 path.conicTo(SkBits2Float(0x71ec7478),
1378 SkBits2Float(0x71ec7478),
1379 SkBits2Float(0xe18cc1ac),
1380 SkBits2Float(0x71ec7478),
1381 SkBits2Float(0x3f3504f3)); // 2.34173646e+30f, 2.34173646e+30f,
1382 // -3.24562462e+20f, 2.34173646e+30f, 0.707106769f
1383 path.conicTo(SkBits2Float(0xf1ec7478),
1384 SkBits2Float(0x71ec7478),
1385 SkBits2Float(0xf1ec7478),
1386 SkBits2Float(0x6192ec0e),
1387 SkBits2Float(0x3f3504f3)); // -2.34173646e+30f, 2.34173646e+30f,
1388 // -2.34173646e+30f, 3.38779271e+20f, 0.707106769f
1389 path.lineTo(SkBits2Float(0xf1ec7478),
1390 SkBits2Float(0x618fd6dd)); // -2.34173646e+30f, 3.31670867e+20f
1391 path.lineTo(SkBits2Float(0xf1ec7478),
1392 SkBits2Float(0xe189ac7b)); // -2.34173646e+30f, -3.17454058e+20f
1393 path.lineTo(SkBits2Float(0xf1ec7478),
1394 SkBits2Float(0xe18cc1ac)); // -2.34173646e+30f, -3.24562462e+20f
1395 path.conicTo(SkBits2Float(0xf1ec7478),
1396 SkBits2Float(0xf1ec7478),
1397 SkBits2Float(0x4e775b1f),
1398 SkBits2Float(0xf1ec7478),
1399 SkBits2Float(0x3f3504f3)); // -2.34173646e+30f, -2.34173646e+30f, 1.03748602e+09f,
1400 // -2.34173646e+30f, 0.707106769f
1401 path.lineTo(SkBits2Float(0x4e775b20),
1402 SkBits2Float(0xf1ec7478)); // 1.03748608e+09f, -2.34173646e+30f
1403 path.lineTo(SkBits2Float(0x71ec7478),
1404 SkBits2Float(0xe18cc1ac)); // 2.34173646e+30f, -3.24562462e+20f
1405 path.close();
1406 path.moveTo(SkBits2Float(0xf1ec7478),
1407 SkBits2Float(0x618cc1ac)); // -2.34173646e+30f, 3.24562462e+20f
1408 path.lineTo(SkBits2Float(0x4e775b20),
1409 SkBits2Float(0x02230001)); // 1.03748608e+09f, 1.19753498e-37f
1410 path.lineTo(SkBits2Float(0x4e775b20),
1411 SkBits2Float(0x71ec7478)); // 1.03748608e+09f, 2.34173646e+30f
1412 path.lineTo(SkBits2Float(0x4e775b1f),
1413 SkBits2Float(0x71ec7478)); // 1.03748602e+09f, 2.34173646e+30f
1414 path.lineTo(SkBits2Float(0x4e775b1f), SkBits2Float(0x00000000)); // 1.03748602e+09f, 0
1415 path.lineTo(SkBits2Float(0x71ec7478),
1416 SkBits2Float(0x618cc1ac)); // 2.34173646e+30f, 3.24562462e+20f
1417 path.lineTo(SkBits2Float(0x71ec7478),
1418 SkBits2Float(0x618fd6dd)); // 2.34173646e+30f, 3.31670867e+20f
1419 path.lineTo(SkBits2Float(0x4c476265), SkBits2Float(0x5ec54c47)); // 52267412, 7.10840809e+18f
1420 path.lineTo(SkBits2Float(0x71ec7478),
1421 SkBits2Float(0xe189ac7b)); // 2.34173646e+30f, -3.17454058e+20f
1422 path.lineTo(SkBits2Float(0x71ec7478),
1423 SkBits2Float(0xe186974a)); // 2.34173646e+30f, -3.10345654e+20f
1424 path.lineTo(SkBits2Float(0x4e775b20),
1425 SkBits2Float(0x5f454c47)); // 1.03748608e+09f, 1.42168162e+19f
1426 path.lineTo(SkBits2Float(0xf1ec7478),
1427 SkBits2Float(0xe186974a)); // -2.34173646e+30f, -3.10345654e+20f
1428 path.lineTo(SkBits2Float(0xf1ec7478),
1429 SkBits2Float(0xe189ac7b)); // -2.34173646e+30f, -3.17454058e+20f
1430 path.lineTo(SkBits2Float(0x4ef1200d),
1431 SkBits2Float(0x5ec54c47)); // 2.02270477e+09f, 7.10840809e+18f
1432 path.lineTo(SkBits2Float(0xf1ec7478),
1433 SkBits2Float(0x618fd6dd)); // -2.34173646e+30f, 3.31670867e+20f
1434 path.lineTo(SkBits2Float(0xf1ec7478),
1435 SkBits2Float(0x618cc1ac)); // -2.34173646e+30f, 3.24562462e+20f
1436 path.close();
1437 path.moveTo(SkBits2Float(0x4e775b20),
1438 SkBits2Float(0x02230001)); // 1.03748608e+09f, 1.19753498e-37f
1439 path.conicTo(SkBits2Float(0x4ef1200d),
1440 SkBits2Float(0x02230001),
1441 SkBits2Float(0x4ef1200d),
1442 SkBits2Float(0x5ec54c47),
1443 SkBits2Float(0x3f3504f3)); // 2.02270477e+09f, 1.19753498e-37f, 2.02270477e+09f,
1444 // 7.10840809e+18f, 0.707106769f
1445 path.conicTo(SkBits2Float(0x4ef1200d),
1446 SkBits2Float(0x5f454c47),
1447 SkBits2Float(0x4e775b20),
1448 SkBits2Float(0x5f454c47),
1449 SkBits2Float(0x3f3504f3)); // 2.02270477e+09f, 1.42168162e+19f, 1.03748608e+09f,
1450 // 1.42168162e+19f,0.707106769f
1451 path.conicTo(SkBits2Float(0x4c476265),
1452 SkBits2Float(0x5f454c47),
1453 SkBits2Float(0x4c476265),
1454 SkBits2Float(0x5ec54c47),
1455 SkBits2Float(0x3f3504f3)); // 52267412, 1.42168162e+19f, 52267412,
1456 // 7.10840809e+18f, 0.707106769f
1457 path.conicTo(SkBits2Float(0x4c476265),
1458 SkBits2Float(0x02230001),
1459 SkBits2Float(0x4e775b20),
1460 SkBits2Float(0x02230001),
1461 SkBits2Float(0x3f3504f3)); // 52267412, 1.19753498e-37f, 1.03748608e+09f,
1462 // 1.19753498e-37f, 0.707106769f
1463 path.close();
1464
1465 SkRect clipBounds = SkRect::MakeLTRB(0, 0, 256, 256);
1466 SimplerVertexAllocator alloc;
1467
1468 int vertexCount = GrAATriangulator::PathToAATriangles(
1469 path, GrPathUtils::kDefaultTolerance, clipBounds, &alloc);
1470 REPORTER_ASSERT(r, vertexCount == 0);
1471}
static const SkScalar kDefaultTolerance
Definition: GrPathUtils.h:32

◆ operator<()

static bool operator< ( const Edge a,
const Edge b 
)
static

Definition at line 955 of file TriangulatingPathRendererTests.cpp.

955 {
956 if (a.fP0.fX != b.fP0.fX) {
957 return a.fP0.fX < b.fP0.fX;
958 }
959 if (a.fP0.fY != b.fP0.fY) {
960 return a.fP0.fY < b.fP0.fY;
961 }
962 if (a.fP1.fX != b.fP1.fX) {
963 return a.fP1.fX < b.fP1.fX;
964 }
965 if (a.fP1.fY != b.fP1.fY) {
966 return a.fP1.fY < b.fP1.fY;
967 }
968 return false;
969}
static bool b
struct MyStruct a[10]

◆ simplify()

static EdgeMap simplify ( const EdgeMap edges,
SkPathFillType  fillType 
)
static

Definition at line 993 of file TriangulatingPathRendererTests.cpp.

993 {
994 // Prune out the edges whose count went to zero, and reverse the edges whose count is negative.
995 EdgeMap simplifiedEdges;
996 for (auto [edge, count] : edges) {
997 // We should only have one ordering of any given edge.
998 SkASSERT(edges.find(edge.reverse()) == edges.end());
999 if (fillType == SkPathFillType::kEvenOdd) {
1000 count = abs(count) & 1;
1001 }
1002 if (count > 0) {
1003 simplifiedEdges[edge] = count;
1004 } else if (count < 0) {
1005 simplifiedEdges[edge.reverse()] = -count;
1006 }
1007 }
1008 return simplifiedEdges;
1009}
int count
Definition: FontMgrTest.cpp:50
#define SkASSERT(cond)
Definition: SkAssert.h:116
std::map< Edge, int > EdgeMap
SIN Vec< N, float > abs(const Vec< N, float > &x)
Definition: SkVx.h:707

◆ verify_simple_inner_polygons()

static void verify_simple_inner_polygons ( skiatest::Reporter r,
const char *  shapeName,
SkPath  path 
)
static

Definition at line 1011 of file TriangulatingPathRendererTests.cpp.

1012 {
1013 for (auto fillType : {SkPathFillType::kWinding}) {
1014 path.setFillType(fillType);
1017 SimpleVertexAllocator vertexAlloc;
1018 int vertexCount;
1019 {
1020 bool isLinear;
1021 GrInnerFanTriangulator triangulator(path, &arena);
1022 vertexCount = triangulator.pathToTriangles(&vertexAlloc, &breadcrumbs, &isLinear);
1023 }
1024
1025 // Count up all the triangulated edges.
1026 EdgeMap trianglePlusBreadcrumbEdges;
1027 for (int i = 0; i < vertexCount; i += 3) {
1028 add_tri_edges(r, trianglePlusBreadcrumbEdges, vertexAlloc.fPoints.data() + i);
1029 }
1030 // Count up all the breadcrumb edges.
1031 int breadcrumbCount = 0;
1032 for (const auto* node = breadcrumbs.head(); node; node = node->fNext) {
1033 add_tri_edges(r, trianglePlusBreadcrumbEdges, node->fPts);
1034 ++breadcrumbCount;
1035 }
1036 REPORTER_ASSERT(r, breadcrumbCount == breadcrumbs.count());
1037 // The triangulated + breadcrumb edges should cancel out to the inner polygon edges.
1038 trianglePlusBreadcrumbEdges = simplify(trianglePlusBreadcrumbEdges, path.getFillType());
1039
1040 // Build the inner polygon edges.
1041 EdgeMap innerFanEdges;
1042 SkPoint startPoint{}, lastPoint{};
1043 for (auto [verb, pts, w] : SkPathPriv::Iterate(path)) {
1044 switch (verb) {
1045 case SkPathVerb::kMove:
1046 if (lastPoint != startPoint) {
1047 add_edge(innerFanEdges, lastPoint, startPoint);
1048 }
1049 lastPoint = startPoint = pts[0];
1050 continue;
1051 case SkPathVerb::kClose:
1052 lastPoint = startPoint;
1053 break;
1054 case SkPathVerb::kLine:
1055 lastPoint = pts[1];
1056 break;
1057 case SkPathVerb::kQuad:
1058 case SkPathVerb::kConic:
1059 lastPoint = pts[2];
1060 break;
1061 case SkPathVerb::kCubic:
1062 lastPoint = pts[3];
1063 break;
1064 }
1065 if (pts[0] != lastPoint) {
1066 add_edge(innerFanEdges, pts[0], lastPoint);
1067 }
1068 }
1069 if (lastPoint != startPoint) {
1070 add_edge(innerFanEdges, lastPoint, startPoint);
1071 }
1072 innerFanEdges = simplify(innerFanEdges, path.getFillType());
1073
1074 // The triangulated + breadcrumb edges should cancel out to the inner polygon edges. First
1075 // verify that every inner polygon edge can be found in the triangulation.
1076 for (auto [edge, count] : innerFanEdges) {
1077 auto it = trianglePlusBreadcrumbEdges.find(edge);
1078 if (it != trianglePlusBreadcrumbEdges.end()) {
1079 it->second -= count;
1080 if (it->second == 0) {
1081 trianglePlusBreadcrumbEdges.erase(it);
1082 }
1083 continue;
1084 }
1085 it = trianglePlusBreadcrumbEdges.find(edge.reverse());
1086 if (it != trianglePlusBreadcrumbEdges.end()) {
1087 it->second += count;
1088 if (it->second == 0) {
1089 trianglePlusBreadcrumbEdges.erase(it);
1090 }
1091 continue;
1092 }
1093 ERRORF(r, "error: %s: edge [%g,%g]:[%g,%g] not found in triangulation.",
1094 shapeName, edge.fP0.fX, edge.fP0.fY, edge.fP1.fX, edge.fP1.fY);
1095 return;
1096 }
1097 // Now verify that there are no spurious edges in the triangulation.
1098 //
1099 // NOTE: The triangulator's definition of wind isn't always correct for edges that run
1100 // exactly parallel to the sweep (either vertical or horizontal edges). This doesn't
1101 // actually matter though because T-junction artifacts don't happen on axis-aligned edges.
1102 // Tolerate spurious edges that (1) come in pairs of 2, and (2) are either exactly
1103 // horizontal or exactly vertical exclusively.
1104 bool hasSpuriousHorz=false, hasSpuriousVert=false;
1105 for (auto [edge, count] : trianglePlusBreadcrumbEdges) {
1106 if (count % 2 == 0) {
1107 if (edge.fP0.fX == edge.fP1.fX && !hasSpuriousVert) {
1108 hasSpuriousHorz = true;
1109 continue;
1110 }
1111 if (edge.fP0.fY == edge.fP1.fY && !hasSpuriousHorz) {
1112 hasSpuriousVert = true;
1113 continue;
1114 }
1115 }
1116 ERRORF(r, "error: %s: spurious edge [%g,%g]:[%g,%g] found in triangulation.",
1117 shapeName, edge.fP0.fX, edge.fP0.fY, edge.fP1.fX, edge.fP1.fY);
1118 return;
1119 }
1120 }
1121}
@ kClose
SkPath::RawIter returns 0 points.
@ kCubic
SkPath::RawIter returns 4 points.
@ kConic
SkPath::RawIter returns 3 points + 1 weight.
@ kQuad
SkPath::RawIter returns 3 points.
@ kMove
SkPath::RawIter returns 1 point.
@ kLine
SkPath::RawIter returns 2 points.
#define ERRORF(r,...)
Definition: Test.h:293
static EdgeMap simplify(const EdgeMap &edges, SkPathFillType fillType)
static void add_tri_edges(skiatest::Reporter *r, EdgeMap &edgeMap, const SkPoint pts[3])
static constexpr int kArenaDefaultChunkSize
SkScalar w

Variable Documentation

◆ kNonEdgeAAPaths

CreatePathFn kNonEdgeAAPaths[]

Definition at line 77 of file TriangulatingPathRendererTests.cpp.