26#define CAIRO_WIN32_STATIC_BUILD
61 cr->current_point_x = x;
62 cr->current_point_y = y;
64 cr->current_point_x += x;
65 cr->current_point_y += y;
69#define MOCK_FN_0(func) \
70 void func(cairo_t* cr) { \
74#define MOCK_FN_1(func) \
75 void func(cairo_t* cr, double a0) { \
76 printf(#func " %.1f\n", a0); \
79#define MOCK_FN_2(func) \
80 void func(cairo_t* cr, double a0, double a1) { \
81 update_current_point(cr, #func, a0, a1); \
82 printf(#func " %.1f %.1f\n", a0, a1); \
85#define MOCK_FN_4(func) \
86 void func(cairo_t* cr, double a0, double a1, double a2, double a3) { \
87 printf(#func " %.1f %.1f %.1f %.1f\n", a0, a1, a2, a3); \
90#define MOCK_FN_5(func) \
91 void func(cairo_t* cr, double a0, double a1, double a2, double a3, double a4) { \
92 printf(#func " %.1f %.1f %.1f %.1f %.1f\n", a0, a1, a2, a3, a4); \
95#define MOCK_FN_6(func) \
96 void func(cairo_t* cr, double a0, double a1, double a2, double a3, double a4, double a5) { \
97 update_current_point(cr, #func, a4, a5); \
98 printf(#func " %.1f %.1f %.1f %.1f %.1f %.1f\n", a0, a1, a2, a3, a4, a5); \
101#define MOCK_FN_I(func, type) \
102 void func(cairo_t* cr, type i) { \
103 printf(#func " %d\n", (int)i); \
143 return CAIRO_STATUS_SUCCESS;
157 for (
int i = 0;
i < num_dashes;
i++)
167 *x =
cr->current_point_x;
168 *y =
cr->current_point_y;
174 double x0, y0, x1, y1, r0, r1;
178#define PRINT_COLOR(prefix) \
179 printf(prefix "#%02lx%02lx%02lx%02lx", lround(r*255), lround(g*255), lround(b*255), lround(a*255))
181 switch (cairo_pattern_get_type(source)) {
182 case CAIRO_PATTERN_TYPE_SOLID:
183 cairo_pattern_get_rgba(source, &
r, &
g, &
b, &
a);
187 case CAIRO_PATTERN_TYPE_LINEAR:
188 cairo_pattern_get_linear_points(source, &x0, &y0, &x1, &y1);
189 printf(
" lineargrad(%.1f %.1f %.1f %.1f)", x0, y0, x1, y1);
192 case CAIRO_PATTERN_TYPE_RADIAL:
193 cairo_pattern_get_radial_circles(source, &x0, &y0, &r0, &x1, &y1, &r1);
194 printf(
" radialgrad(%.1f %.1f %.1f %.1f %.1f %.1f)", x0, y0, r0, x1, y1, r1);
198 if (cairo_pattern_get_color_stop_count(source, &count) == CAIRO_STATUS_SUCCESS) {
199 for (
int i = 0;
i < count;
i++) {
200 cairo_pattern_get_color_stop_rgba(source,
i, &x0, &
r, &
g, &
b, &
a);
216 printf(
"%s: comparator must return 0 for item %d\n", __func__,
i);
221 printf(
"%s: entry for '%s' must appear after '%s', at index %d\n",
240 struct _cairo cairo_ctx = { 0, 0 };
249 printf(
"Failed to read %s: %d\n", source, ret);
255 printf(
"\n--- %s: %s\n", __func__, source);
274 printf(
"%s: vgs_parse = %d\n", __func__, ret);
279 state.cairo_ctx = &cairo_ctx;
285 printf(
"%s: vgs_eval = %d\n", __func__, ret);
296int main(
int argc,
const char **argv)
304 for (
int i = 1;
i < argc;
i++)
326 memset(buf, 0,
sizeof(buf));
334 memset(buf, 0,
sizeof(buf));
345 check_script(0,
"proc p0 a1 a2 a3 a4 a5 a6 a7 a8 { break }");
346 check_script(0,
"proc p0 a1 a2 { break } call p0 break");
347 check_script(0,
"proc p0 a1 a2 { break } call p0 1 2 3");
350 memset(buf, 0,
sizeof(buf));
351 strncat(buf,
"M 0 (1",
sizeof(buf) - 1);
352 for (
int i = 0;
i < 100;
i++) {
353 strncat(buf,
" + n",
sizeof(buf) - 1);
355 strncat(buf,
")",
sizeof(buf) - 1);
#define av_assert0(cond)
assert() equivalent, that is always enabled.
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
static int FUNC metadata(CodedBitstreamContext *ctx, RWContext *rw, APVRawMetadata *current)
#define i(width, name, range_min, range_max)
__device__ int printf(const char *,...)
cairo_status_t cairo_status(cairo_t *cr)
static void mock_av_log(void *ptr, int level, const char *fmt, va_list vl)
cairo_bool_t cairo_has_current_point(cairo_t *cr)
cairo_bool_t cairo_get_dash_count(cairo_t *cr)
static void check_sorted_cmds_array(void)
#define PRINT_COLOR(prefix)
#define MOCK_FN_I(func, type)
void cairo_set_source(cairo_t *cr, cairo_pattern_t *source)
static void update_current_point(cairo_t *cr, const char *func, double x, double y)
void cairo_get_current_point(cairo_t *cr, double *x, double *y)
void cairo_get_dash(cairo_t *cr, double *dashes, double *offset)
static void check_script(int is_file, const char *source)
void cairo_set_dash(cairo_t *cr, const double *dashes, int num_dashes, double offset)
static struct @346255127015250356166251341105367306144006377143 state
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
int av_dict_parse_string(AVDictionary **pm, const char *str, const char *key_val_sep, const char *pairs_sep, int flags)
Parse the key/value pairs list and add the parsed entries to a dictionary.
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
Set the logging callback.
const char * av_basename(const char *path)
Thread safe basename.
int(* func)(AVBPrint *dst, const char *in, const char *arg)
#define FF_ARRAY_ELEMS(a)
int ff_load_textfile(void *log_ctx, const char *textfile, unsigned char **text, size_t *text_size)
drawvg filter, draw vector graphics with cairo.
static void vgs_eval_state_free(struct VGSEvalState *state)
static int vgs_eval_state_init(struct VGSEvalState *state, const struct VGSProgram *program, void *log_ctx, AVFrame *frame)
#define USER_VAR_COUNT
Number of user variables that can be created with setvar.
static int vgs_eval(struct VGSEvalState *state, const struct VGSProgram *program, int stack_level)
Interpreter for VGSProgram.
static void vgs_parser_init(struct VGSParser *parser, const char *source)
static int vgs_comp_command_spec(const void *cs1, const void *cs2)
Comparator for VGSCommandDecl, to be used with bsearch(3).
static void vgs_free(struct VGSProgram *program)
Release the memory allocated by the program.
static const struct VGSCommandSpec vgs_commands[]
static void vgs_parser_free(struct VGSParser *parser)
static int vgs_parse(void *log_ctx, struct VGSParser *parser, struct VGSProgram *program, int subprogram)
Build a program by parsing a script.
#define VAR_COUNT
Total number of variables (default- and user-variables).
static double cr(void *priv, double x, double y)