src/2d.c

changeset 175
e5544920377e
parent 173
bd57fe3f6360
equal deleted inserted replaced
174:0009b982bc7d 175:e5544920377e
177 // when we do not fill the rectangle, we need a border 177 // when we do not fill the rectangle, we need a border
178 rectangle->thickness = 1; 178 rectangle->thickness = 1;
179 } else { 179 } else {
180 rectangle->thickness = args.thickness; 180 rectangle->thickness = args.thickness;
181 } 181 }
182 if (!args.filled && asc_col4_test_zero(args.border_color)) { 182 if (!args.filled && asc_memcmpz(&args.border_color, sizeof(args.border_color))) {
183 // convenience fallback: 183 // convenience fallback:
184 // when we are drawing an outline but have no explicit border color, 184 // when we are drawing an outline but have no explicit border color,
185 // use the active ink 185 // use the active ink
186 rectangle->border_color = rectangle->color; 186 rectangle->border_color = rectangle->color;
187 } 187 }
188 188
189 AscSceneNode *node = &rectangle->node; 189 AscSceneNode *node = &rectangle->node;
190 node->position.z = ASC_SCENE_2D_DEPTH_OFFSET; 190 node->position.z = ASC_SCENE_2D_DEPTH_OFFSET;
191 node->scale = asc_vec3f_one; 191 node->scale = ASC_VEC3F_1;
192 node->render_group = asc_context.ink.alpha < 255 192 node->render_group = asc_context.ink.alpha < 255
193 ? ASC_RENDER_GROUP_2D_BLEND 193 ? ASC_RENDER_GROUP_2D_BLEND
194 : ASC_RENDER_GROUP_2D_OPAQUE; 194 : ASC_RENDER_GROUP_2D_OPAQUE;
195 node->update_func = asc_rectangle_update; 195 node->update_func = asc_rectangle_update;
196 node->destroy_func = asc_rectangle_destroy; 196 node->destroy_func = asc_rectangle_destroy;
331 // when we do not fill the ellipsis, we need a border 331 // when we do not fill the ellipsis, we need a border
332 ellipsis->thickness = 1; 332 ellipsis->thickness = 1;
333 } else { 333 } else {
334 ellipsis->thickness = args.thickness; 334 ellipsis->thickness = args.thickness;
335 } 335 }
336 if (!args.filled && asc_col4_test_zero(args.border_color)) { 336 if (!args.filled && asc_memcmpz(&args.border_color, sizeof(args.border_color))) {
337 // convenience fallback: 337 // convenience fallback:
338 // when we are drawing an outline but have no explicit border color, 338 // when we are drawing an outline but have no explicit border color,
339 // use the active ink 339 // use the active ink
340 ellipsis->border_color = ellipsis->color; 340 ellipsis->border_color = ellipsis->color;
341 } 341 }
342 342
343 AscSceneNode *node = &ellipsis->node; 343 AscSceneNode *node = &ellipsis->node;
344 node->position.z = ASC_SCENE_2D_DEPTH_OFFSET; 344 node->position.z = ASC_SCENE_2D_DEPTH_OFFSET;
345 node->scale = asc_vec3f_one; 345 node->scale = ASC_VEC3F_1;
346 node->render_group = asc_context.ink.alpha < 255 346 node->render_group = asc_context.ink.alpha < 255
347 ? ASC_RENDER_GROUP_2D_BLEND 347 ? ASC_RENDER_GROUP_2D_BLEND
348 : ASC_RENDER_GROUP_2D_OPAQUE; 348 : ASC_RENDER_GROUP_2D_OPAQUE;
349 node->update_func = asc_ellipsis_update; 349 node->update_func = asc_ellipsis_update;
350 node->destroy_func = asc_ellipsis_destroy; 350 node->destroy_func = asc_ellipsis_destroy;

mercurial