Go to the documentation of this file.
52 cr->current_point_x = x;
53 cr->current_point_y = y;
55 cr->current_point_x += x;
56 cr->current_point_y += y;
60 #define MOCK_FN_0(func) \
61 void func(cairo_t* cr) { \
65 #define MOCK_FN_1(func) \
66 void func(cairo_t* cr, double a0) { \
67 printf(#func " %.1f\n", a0); \
70 #define MOCK_FN_2(func) \
71 void func(cairo_t* cr, double a0, double a1) { \
72 update_current_point(cr, #func, a0, a1); \
73 printf(#func " %.1f %.1f\n", a0, a1); \
76 #define MOCK_FN_4(func) \
77 void func(cairo_t* cr, double a0, double a1, double a2, double a3) { \
78 printf(#func " %.1f %.1f %.1f %.1f\n", a0, a1, a2, a3); \
81 #define MOCK_FN_5(func) \
82 void func(cairo_t* cr, double a0, double a1, double a2, double a3, double a4) { \
83 printf(#func " %.1f %.1f %.1f %.1f %.1f\n", a0, a1, a2, a3, a4); \
86 #define MOCK_FN_6(func) \
87 void func(cairo_t* cr, double a0, double a1, double a2, double a3, double a4, double a5) { \
88 update_current_point(cr, #func, a4, a5); \
89 printf(#func " %.1f %.1f %.1f %.1f %.1f %.1f\n", a0, a1, a2, a3, a4, a5); \
92 #define MOCK_FN_I(func, type) \
93 void func(cairo_t* cr, type i) { \
94 printf(#func " %d\n", (int)i); \
118 MOCK_FN_I(cairo_set_fill_rule, cairo_fill_rule_t);
120 MOCK_FN_I(cairo_set_line_cap, cairo_line_cap_t);
121 MOCK_FN_I(cairo_set_line_join, cairo_line_join_t);
134 return CAIRO_STATUS_SUCCESS;
148 for (
int i = 0;
i < num_dashes;
i++)
158 *x =
cr->current_point_x;
159 *y =
cr->current_point_y;
165 double x0, y0, x1, y1, r0, r1;
169 #define PRINT_COLOR(prefix) \
170 printf(prefix "#%02x%02x%02x%02x", (int)(r*255), (int)(g*255), (int)(b*255), (int)(a*255))
172 switch (cairo_pattern_get_type(
source)) {
173 case CAIRO_PATTERN_TYPE_SOLID:
174 cairo_pattern_get_rgba(
source, &
r, &
g, &
b, &
a);
178 case CAIRO_PATTERN_TYPE_LINEAR:
179 cairo_pattern_get_linear_points(
source, &x0, &y0, &x1, &y1);
180 printf(
" lineargrad(%.1f %.1f %.1f %.1f)", x0, y0, x1, y1);
183 case CAIRO_PATTERN_TYPE_RADIAL:
184 cairo_pattern_get_radial_circles(
source, &x0, &y0, &r0, &x1, &y1, &r1);
185 printf(
" radialgrad(%.1f %.1f %.1f %.1f %.1f %.1f)", x0, y0, r0, x1, y1, r1);
189 if (cairo_pattern_get_color_stop_count(
source, &count) == CAIRO_STATUS_SUCCESS) {
190 for (
int i = 0;
i < count;
i++) {
191 cairo_pattern_get_color_stop_rgba(
source,
i, &x0, &
r, &
g, &
b, &
a);
207 printf(
"%s: comparator must return 0 for item %d\n", __func__,
i);
212 printf(
"%s: entry for '%s' must appear after '%s', at index %d\n",
231 struct _cairo cairo_ctx = { 0, 0 };
265 printf(
"%s: vgs_parse = %d\n", __func__,
ret);
270 state.cairo_ctx = &cairo_ctx;
276 printf(
"%s: vgs_eval = %d\n", __func__,
ret);
287 int main(
int argc,
const char **argv)
295 for (
int i = 1;
i < argc;
i++)
317 memset(buf, 0,
sizeof(buf));
325 memset(buf, 0,
sizeof(buf));
336 check_script(0,
"proc p0 a1 a2 a3 a4 a5 a6 a7 a8 { break }");
337 check_script(0,
"proc p0 a1 a2 { break } call p0 break");
338 check_script(0,
"proc p0 a1 a2 { break } call p0 1 2 3");
341 memset(buf, 0,
sizeof(buf));
342 strncat(buf,
"M 0 (1",
sizeof(buf) - 1);
343 for (
int i = 0;
i < 100;
i++) {
344 strncat(buf,
" + n",
sizeof(buf) - 1);
346 strncat(buf,
")",
sizeof(buf) - 1);
int(* func)(AVBPrint *dst, const char *in, const char *arg)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C program
__device__ int printf(const char *,...)
void cairo_set_dash(cairo_t *cr, const double *dashes, int num_dashes, double offset)
static int vgs_eval(struct VGSEvalState *state, const struct VGSProgram *program)
Interpreter for VGSProgram.
static int vgs_comp_command_spec(const void *cs1, const void *cs2)
Comparator for VGSCommandDecl, to be used with bsearch(3).
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
const char * av_basename(const char *path)
Thread safe basename.
static void vgs_parser_free(struct VGSParser *parser)
cairo_bool_t cairo_get_dash_count(cairo_t *cr)
#define VAR_COUNT
Total number of variables (default- and user-variables).
#define FF_ARRAY_ELEMS(a)
int ff_load_textfile(void *log_ctx, const char *textfile, unsigned char **text, size_t *text_size)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static void update_current_point(cairo_t *cr, const char *func, double x, double y)
void cairo_set_source(cairo_t *cr, cairo_pattern_t *source)
static void vgs_free(struct VGSProgram *program)
Release the memory allocated by the program.
#define PRINT_COLOR(prefix)
int main(int argc, const char **argv)
cairo_bool_t cairo_has_current_point(cairo_t *cr)
void cairo_get_dash(cairo_t *cr, double *dashes, double *offset)
static int vgs_parse(void *log_ctx, struct VGSParser *parser, struct VGSProgram *program, int subprogram)
Build a program by parsing a script.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a source
void cairo_get_current_point(cairo_t *cr, double *x, double *y)
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
Set the logging callback.
static int vgs_eval_state_init(struct VGSEvalState *state, const struct VGSProgram *program, void *log_ctx, AVFrame *frame)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
#define i(width, name, range_min, range_max)
static void check_sorted_cmds_array(void)
#define USER_VAR_COUNT
Number of user variables that can be created with setvar.
static void vgs_eval_state_free(struct VGSEvalState *state)
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.
cairo_status_t cairo_status(cairo_t *cr)
static void mock_av_log(void *ptr, int level, const char *fmt, va_list vl)
static const struct VGSCommandSpec vgs_commands[]
static double cr(void *priv, double x, double y)
static void check_script(int is_file, const char *source)
#define MOCK_FN_I(func, type)
static void vgs_parser_init(struct VGSParser *parser, const char *source)