1048
1049 fRoundCaps = false;
1050
1054
1055 bool isStrokeOnly =
1058
1062 if (hasStroke) {
1065 } else {
1067 }
1068
1069 outerRadius += halfWidth;
1070 if (isStrokeOnly) {
1071 innerRadius = radius - halfWidth;
1072 }
1073 }
1074
1075
1076
1077
1078
1081 bool stroked = isStrokeOnly && innerRadius > 0.0f;
1082 fViewMatrixIfUsingLocalCoords = viewMatrix;
1083
1084
1085 static constexpr SkScalar kUnusedIsectPlane[] = {0.f, 0.f, 1.f};
1086
1087 static constexpr SkScalar kUnusedUnionPlane[] = {0.f, 0.f, 0.f};
1088 static constexpr SkPoint kUnusedRoundCaps[] = {{1e10f, 1e10f}, {1e10f, 1e10f}};
1091 if (arcParams) {
1092
1093
1094 SkPoint startPoint, stopPoint;
1097 SkScalar endAngle = arcParams->fStartAngleRadians + arcParams->fSweepAngleRadians;
1100
1101
1102 startPoint = viewMatrix.
mapVector(startPoint.
fX, startPoint.
fY);
1103 stopPoint = viewMatrix.
mapVector(stopPoint.
fX, stopPoint.
fY);
1106
1107
1108
1112 if (upperLeftDet < 0) {
1114 }
1115
1119 if (fRoundCaps) {
1120
1121 SkScalar midRadius = (innerRadius + outerRadius) / (2 * outerRadius);
1122 roundCaps[0] = startPoint * midRadius;
1123 roundCaps[1] = stopPoint * midRadius;
1124 } else {
1125 roundCaps[0] = kUnusedRoundCaps[0];
1126 roundCaps[1] = kUnusedRoundCaps[1];
1127 }
1128
1129
1130
1131
1132
1133
1134
1135
1136 auto absSweep =
SkScalarAbs(arcParams->fSweepAngleRadians);
1137 bool useCenter = (arcParams->fUseCenter || isStrokeOnly) &&
1139 if (useCenter) {
1142
1143 if (arcParams->fSweepAngleRadians < 0) {
1145 }
1147 fClipPlane = true;
1151 innerRadius,
1152 outerRadius,
1153 {norm0.
fX, norm0.
fY, 0.5f},
1154 {kUnusedIsectPlane[0], kUnusedIsectPlane[1], kUnusedIsectPlane[2]},
1155 {norm1.
fX, norm1.
fY, 0.5f},
1156 {roundCaps[0], roundCaps[1]},
1157 devBounds,
1158 stroked});
1159 fClipPlaneIsect = false;
1160 fClipPlaneUnion = true;
1161 } else {
1164 innerRadius,
1165 outerRadius,
1166 {norm0.
fX, norm0.
fY, 0.5f},
1167 {norm1.
fX, norm1.
fY, 0.5f},
1168 {kUnusedUnionPlane[0], kUnusedUnionPlane[1], kUnusedUnionPlane[2]},
1169 {roundCaps[0], roundCaps[1]},
1170 devBounds,
1171 stroked});
1172 fClipPlaneIsect = true;
1173 fClipPlaneUnion = false;
1174 }
1175 } else {
1176
1177 startPoint.
scale(radius);
1178 stopPoint.
scale(radius);
1179 SkVector norm = {startPoint.
fY - stopPoint.
fY, stopPoint.
fX - startPoint.
fX};
1181 if (arcParams->fSweepAngleRadians > 0) {
1183 }
1185
1188 innerRadius,
1189 outerRadius,
1190 {norm.
fX, norm.
fY,
d},
1191 {kUnusedIsectPlane[0], kUnusedIsectPlane[1], kUnusedIsectPlane[2]},
1192 {kUnusedUnionPlane[0], kUnusedUnionPlane[1], kUnusedUnionPlane[2]},
1193 {roundCaps[0], roundCaps[1]},
1194 devBounds,
1195 stroked});
1196 fClipPlane = true;
1197 fClipPlaneIsect = false;
1198 fClipPlaneUnion = false;
1199 }
1200 } else {
1203 innerRadius,
1204 outerRadius,
1205 {kUnusedIsectPlane[0], kUnusedIsectPlane[1], kUnusedIsectPlane[2]},
1206 {kUnusedIsectPlane[0], kUnusedIsectPlane[1], kUnusedIsectPlane[2]},
1207 {kUnusedUnionPlane[0], kUnusedUnionPlane[1], kUnusedUnionPlane[2]},
1208 {kUnusedRoundCaps[0], kUnusedRoundCaps[1]},
1209 devBounds,
1210 stroked});
1211 fClipPlane = false;
1212 fClipPlaneIsect = false;
1213 fClipPlaneUnion = false;
1214 }
1215
1216
1217 radius += halfWidth;
1223 fAllFill = !stroked;
1224 }
static const int strokeWidth
static int circle_type_to_index_count(bool stroked)
static int circle_type_to_vert_count(bool stroked)
void swap(sk_sp< T > &a, sk_sp< T > &b)
static bool SkScalarNearlyZero(SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
#define SkScalarSin(radians)
static bool SkScalarNearlyEqual(SkScalar x, SkScalar y, SkScalar tolerance=SK_ScalarNearlyZero)
#define SkScalarCos(radians)
static SkScalar center(float pos0, float pos1)
GrMeshDrawOp(uint32_t classID)
void setBounds(const SkRect &newBounds, HasAABloat aabloat, IsHairline zeroArea)
const SkStrokeRec & strokeRec() const
SkScalar mapRadius(SkScalar radius) const
SkScalar getSkewY() const
void mapPoints(SkPoint dst[], const SkPoint src[], int count) const
SkScalar getSkewX() const
SkScalar getScaleX() const
SkScalar getScaleY() const
bool isSimilarity(SkScalar tol=SK_ScalarNearlyZero) const
void mapVector(SkScalar dx, SkScalar dy, SkVector *result) const
SkScalar getWidth() const
SkPaint::Cap getCap() const
T & emplace_back(Args &&... args)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
float dot(const SkVector &vec) const
void scale(float scale, SkPoint *dst) const
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)