Go to the documentation of this file.
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); \
127 MOCK_FN_I(cairo_set_fill_rule, cairo_fill_rule_t);
129 MOCK_FN_I(cairo_set_line_cap, cairo_line_cap_t);
130 MOCK_FN_I(cairo_set_line_join, cairo_line_join_t);
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 };
274 printf(
"%s: vgs_parse = %d\n", __func__,
ret);
279 state.cairo_ctx = &cairo_ctx;
285 printf(
"%s: vgs_eval = %d\n", __func__,
ret);
296 int 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);
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)