comparison tools/mb_c_source.m4 @ 69:a6150b4e0667

Fix bug of newing linear & radial paints
author Thinker K.F. Li <thinker@branda.to>
date Wed, 13 Aug 2008 08:21:06 +0800
parents 018546012798
children 9ab15ebc9061
comparison
equal deleted inserted replaced
68:018546012798 69:a6150b4e0667
41 define([FILL_SHAPE_WITH_PAINT]) 41 define([FILL_SHAPE_WITH_PAINT])
42 define([STROKE_SHAPE_WITH_PAINT]) 42 define([STROKE_SHAPE_WITH_PAINT])
43 divert[]]) 43 divert[]])
44 44
45 define([S_ADD_LINEAR_PAINT],[ 45 define([S_ADD_LINEAR_PAINT],[
46 obj->$1 = mb_linear_new(rdman, $2, $3, $4, $5); 46 obj->$1 = paint_linear_new(rdman, $2, $3, $4, $5);
47 ifelse(COUNT($6),0,,[dnl 47 ifelse(COUNT($6),0,,[dnl
48 stops = (grad_stop_t *)malloc(sizeof(grad_stop_t) * n_$1_stops); 48 stops = (grad_stop_t *)malloc(sizeof(grad_stop_t) * n_$1_stops);
49 memcpy(stops, $1_stops, sizeof(grad_stop_t) * n_$1_stops); 49 memcpy(stops, $1_stops, sizeof(grad_stop_t) * n_$1_stops);
50 paint_linear_stops(obj->$1, n_$1_stops, stops); 50 paint_linear_stops(obj->$1, n_$1_stops, stops);
51 ])dnl 51 ])dnl
52 ]) 52 ])
53 53
54 define([S_ADD_RADIAL_PAINT],[ 54 define([S_ADD_RADIAL_PAINT],[
55 obj->$1 = mb_radial_new(rdman, $2, $3, $4); 55 obj->$1 = paint_radial_new(rdman, $2, $3, $4);
56 ifelse(COUNT($5),0,,[ 56 ifelse(COUNT($5),0,,[
57 stops = (grad_stop_t *)malloc(sizeof(grad_stop_t) * n_$1_stops); 57 stops = (grad_stop_t *)malloc(sizeof(grad_stop_t) * n_$1_stops);
58 memcpy(stops, $1_stops, sizeof(grad_stop_t) * n_$1_stops); 58 memcpy(stops, $1_stops, sizeof(grad_stop_t) * n_$1_stops);
59 paint_radial_stops(obj->$1, n_$1_stops, stops); 59 paint_radial_stops(obj->$1, n_$1_stops, stops);
60 ])dnl 60 ])dnl
133 define([F_ADD_RECT],[[ 133 define([F_ADD_RECT],[[
134 sh_rect_free(obj->$1); 134 sh_rect_free(obj->$1);
135 ]]); 135 ]]);
136 136
137 define([F_FILL_SHAPE],[[ 137 define([F_FILL_SHAPE],[[
138 obj->$1->free(obj->$1); 138 obj->$1_fill->free(obj->$1_fill);
139 ]]) 139 ]])
140 140
141 define([F_STROKE_SHAPE],[[ 141 define([F_STROKE_SHAPE],[[
142 obj->$1->free(obj->$1); 142 obj->$1_stroke->free(obj->$1_stroke);
143 ]]) 143 ]])
144 144
145 define([CLEAR_VARS],[divert([-1]) 145 define([CLEAR_VARS],[divert([-1])
146 define([FIMPORT],[IMPORT(]QUOTE($[]1)[,[F_])]) 146 define([FIMPORT],[IMPORT(]QUOTE($[]1)[,[F_])])
147 FIMPORT([ADD_LINEAR_PAINT]) 147 FIMPORT([ADD_LINEAR_PAINT])
157 define([STROKE_SHAPE_WITH_PAINT]) 157 define([STROKE_SHAPE_WITH_PAINT])
158 divert[]]) 158 divert[]])
159 159
160 define([MADBUTTERFLY],[dnl 160 define([MADBUTTERFLY],[dnl
161 [#include <stdio.h> 161 [#include <stdio.h>
162 #include <stdlib.h>
163 #include <string.h>
162 #include "mb_types.h" 164 #include "mb_types.h"
163 #include "redraw_man.h" 165 #include "redraw_man.h"
164 #include "shapes.h" 166 #include "shapes.h"
165 #include "paint.h" 167 #include "paint.h"
166 #include "$1.h" 168 #include "$1.h"
167 169
168 $1_t *$1_new(redraw_mant_t *rdman) { 170 $1_t *$1_new(redraw_man_t *rdman) {
169 $1_t *obj; 171 $1_t *obj;
170 grad_stop_t *stops = NULL;]DECLARE_VARS 172 grad_stop_t *stops = NULL;]DECLARE_VARS
171 $2[]dnl 173 $2[]dnl
172 [ 174 [
173 obj = ($1_t *)malloc(sizeof($1_t)); 175 obj = ($1_t *)malloc(sizeof($1_t));