Flutter Engine
The Flutter Engine
Functions
SkParsePath.cpp File Reference
#include "include/core/SkPath.h"
#include "include/core/SkPoint.h"
#include "include/core/SkScalar.h"
#include "include/core/SkStream.h"
#include "include/core/SkString.h"
#include "include/core/SkTypes.h"
#include "include/utils/SkParse.h"
#include "include/utils/SkParsePath.h"
#include "src/core/SkGeometry.h"
#include <cstdio>

Go to the source code of this file.

Functions

static bool is_between (int c, int min, int max)
 
static bool is_ws (int c)
 
static bool is_digit (int c)
 
static bool is_sep (int c)
 
static bool is_lower (int c)
 
static int to_upper (int c)
 
static const char * skip_ws (const char str[])
 
static const char * skip_sep (const char str[])
 
static const char * find_points (const char str[], SkPoint value[], int count, bool isRelative, SkPoint *relative)
 
static const char * find_scalar (const char str[], SkScalar *value, bool isRelative, SkScalar relative)
 
static const char * find_flag (const char str[], bool *value)
 

Function Documentation

◆ find_flag()

static const char * find_flag ( const char  str[],
bool *  value 
)
static

Definition at line 95 of file SkParsePath.cpp.

95 {
96 if (!str) {
97 return nullptr;
98 }
99 if (str[0] != '1' && str[0] != '0') {
100 return nullptr;
101 }
102 *value = str[0] != '0';
103 str = skip_sep(str + 1);
104 return str;
105}
static const char * skip_sep(const char str[])
Definition: SkParsePath.cpp:53
uint8_t value

◆ find_points()

static const char * find_points ( const char  str[],
SkPoint  value[],
int  count,
bool  isRelative,
SkPoint relative 
)
static

Definition at line 64 of file SkParsePath.cpp.

65 {
66 str = SkParse::FindScalars(str, &value[0].fX, count * 2);
67 if (isRelative) {
68 for (int index = 0; index < count; index++) {
69 value[index].fX += relative->fX;
70 value[index].fY += relative->fY;
71 }
72 }
73 return str;
74}
int count
Definition: FontMgrTest.cpp:50
static const char * FindScalars(const char str[], SkScalar value[], int count)
Definition: SkParse.cpp:231
float fX
x-axis value
Definition: SkPoint_impl.h:164
float fY
y-axis value
Definition: SkPoint_impl.h:165

◆ find_scalar()

static const char * find_scalar ( const char  str[],
SkScalar value,
bool  isRelative,
SkScalar  relative 
)
static

Definition at line 78 of file SkParsePath.cpp.

79 {
80 str = SkParse::FindScalar(str, value);
81 if (!str) {
82 return nullptr;
83 }
84 if (isRelative) {
85 *value += relative;
86 }
87 str = skip_sep(str);
88 return str;
89}
static const char * FindScalar(const char str[], SkScalar *value)
Definition: SkParse.cpp:216

◆ is_between()

static bool is_between ( int  c,
int  min,
int  max 
)
inlinestatic

Definition at line 22 of file SkParsePath.cpp.

22 {
23 return (unsigned)(c - min) <= (unsigned)(max - min);
24}
static float max(float r, float g, float b)
Definition: hsl.cpp:49
static float min(float r, float g, float b)
Definition: hsl.cpp:48

◆ is_digit()

static bool is_digit ( int  c)
inlinestatic

Definition at line 30 of file SkParsePath.cpp.

30 {
31 return is_between(c, '0', '9');
32}
static bool is_between(int c, int min, int max)
Definition: SkParsePath.cpp:22

◆ is_lower()

static bool is_lower ( int  c)
inlinestatic

Definition at line 38 of file SkParsePath.cpp.

38 {
39 return is_between(c, 'a', 'z');
40}

◆ is_sep()

static bool is_sep ( int  c)
inlinestatic

Definition at line 34 of file SkParsePath.cpp.

34 {
35 return is_ws(c) || c == ',';
36}
static bool is_ws(int c)
Definition: SkParsePath.cpp:26

◆ is_ws()

static bool is_ws ( int  c)
inlinestatic

Definition at line 26 of file SkParsePath.cpp.

26 {
27 return is_between(c, 1, 32);
28}

◆ skip_sep()

static const char * skip_sep ( const char  str[])
static

Definition at line 53 of file SkParsePath.cpp.

53 {
54 if (!str) {
55 return nullptr;
56 }
57 while (is_sep(*str))
58 str++;
59 return str;
60}
static bool is_sep(int c)
Definition: SkParsePath.cpp:34

◆ skip_ws()

static const char * skip_ws ( const char  str[])
static

Definition at line 46 of file SkParsePath.cpp.

46 {
47 SkASSERT(str);
48 while (is_ws(*str))
49 str++;
50 return str;
51}
#define SkASSERT(cond)
Definition: SkAssert.h:116

◆ to_upper()

static int to_upper ( int  c)
inlinestatic

Definition at line 42 of file SkParsePath.cpp.

42 {
43 return c - 'a' + 'A';
44}