23 return (
unsigned)(c -
min) <= (
unsigned)(
max -
min);
26static inline bool is_ws(
int c) {
35 return is_ws(c) || c ==
',';
46static const char*
skip_ws(
const char str[]) {
63 bool isRelative,
SkPoint* relative) {
66 for (
int index = 0; index <
count; index++) {
67 value[index].fX += relative->
fX;
68 value[index].fY += relative->
fY;
75 bool isRelative,
SkScalar relative) {
91static const char*
find_flag(
const char str[],
bool* value) {
95 if (str[0] !=
'1' && str[0] !=
'0') {
98 *
value = str[0] !=
'0';
110 char previousOp =
'\0';
111 bool relative =
false;
118 if (data[0] ==
'\0') {
122 if (
is_digit(ch) || ch ==
'-' || ch ==
'+' || ch ==
'.') {
123 if (op ==
'\0' || op ==
'Z') {
154 path.lineTo(
x, c.
fY);
160 path.lineTo(c.
fX,
y);
169 if (previousOp ==
'C' || previousOp ==
'S') {
180 goto quadraticCommon;
184 if (previousOp ==
'Q' || previousOp ==
'T') {
196 bool largeArc, sweep;
197 if ((data =
find_points(data, &radii, 1,
false,
nullptr))
218 path.moveTo(
args[0].fX,
args[0].fY);
219 path.lineTo(
args[1].fX,
args[1].fY);
224 if (previousOp == 0) {
239 char* stop =
buffer + len;
249 const auto append_command = [&](
char cmd,
const SkPoint pts[],
size_t count) {
251 cmd += 32 * rel_selector;
252 stream.write(&cmd, 1);
254 for (
size_t i = 0; i <
count; ++i) {
255 const auto pt = pts[i] - current_point;
257 stream.write(
" ", 1);
260 stream.write(
" ", 1);
266 current_point = pts[
count - 1] * rel_selector;
273 switch (iter.
next(pts)) {
278 for (
int i = 0; i < quadder.
countQuads(); ++i) {
279 append_command(
'Q', &quadPts[i*2 + 1], 2);
283 append_command(
'M', &pts[0], 1);
286 append_command(
'L', &pts[1], 1);
289 append_command(
'Q', &pts[1], 2);
292 append_command(
'C', &pts[1], 3);
295 stream.write(
"Z", 1);
299 str.
resize(stream.bytesWritten());
300 stream.copyTo(str.
data());
static const int points[]
static bool write_scalar(SkWStream *stream, SkScalar n, uint32_t id)
static bool is_sep(int c)
static const char * skip_sep(const char str[])
static int to_upper(int c)
static bool is_digit(int c)
static void write_scalar(SkWStream *stream, SkScalar value)
static const char * find_flag(const char str[], bool *value)
static const char * skip_ws(const char str[])
static bool is_between(int c, int min, int max)
static const char * find_scalar(const char str[], SkScalar *value, bool isRelative, SkScalar relative)
static const char * find_points(const char str[], SkPoint value[], int count, bool isRelative, SkPoint *relative)
static bool is_lower(int c)
static bool is_sep(int c)
static const char * skip_sep(const char str[])
static bool is_digit(int c)
static const char * skip_ws(const char str[])
const SkPoint * computeQuads(const SkConic &conic, SkScalar tol)
static SkString ToSVGString(const SkPath &, PathEncoding=PathEncoding::Absolute)
static bool FromSVGString(const char str[], SkPath *)
static const char * FindScalar(const char str[], SkScalar *value)
static const char * FindScalars(const char str[], SkScalar value[], int count)
Verb next(SkPoint pts[4])
SkScalar conicWeight() const
const char * data() const
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
static const uint8_t buffer[]
static float max(float r, float g, float b)
static float min(float r, float g, float b)