1 /**************************************************************************
3 * Copyright 2009 VMware, Inc. All Rights Reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 **************************************************************************/
31 #include "st_inlines.h"
33 #include "pipe/p_compiler.h"
34 #include "util/u_inlines.h"
36 #include "util/u_memory.h"
37 #include "util/u_math.h"
38 #include "util/u_sampler.h"
40 #include "cso_cache/cso_context.h"
43 struct vg_object base
;
53 VGColorRampSpreadMode spread
;
54 VGuint color_data
[1024];
63 struct pipe_sampler_view
*sampler_view
;
64 struct pipe_sampler_state sampler
;
70 VGboolean color_ramps_premultiplied
;
74 struct pipe_sampler_view
*sampler_view
;
75 VGTilingMode tiling_mode
;
76 struct pipe_sampler_state sampler
;
79 /* XXX next 3 all unneded? */
80 struct pipe_resource
*cbuf
;
81 struct pipe_shader_state fs_state
;
85 static INLINE VGuint
mix_pixels(VGuint p1
, VGuint a
, VGuint p2
, VGuint b
)
87 VGuint t
= (p1
& 0xff00ff) * a
+ (p2
& 0xff00ff) * b
;
88 t
>>= 8; t
&= 0xff00ff;
90 p1
= ((p1
>> 8) & 0xff00ff) * a
+ ((p2
>> 8) & 0xff00ff) * b
;
91 p1
&= 0xff00ff00; p1
|= t
;
96 static INLINE VGuint
float4_to_argb(const VGfloat
*clr
)
98 return float_to_ubyte(clr
[3]) << 24 |
99 float_to_ubyte(clr
[0]) << 16 |
100 float_to_ubyte(clr
[1]) << 8 |
101 float_to_ubyte(clr
[2]) << 0;
104 static INLINE
void create_gradient_data(const VGfloat
*ramp_stops
,
111 VGfloat fpos
= 0, incr
= 1.f
/ size
;
114 while (fpos
< ramp_stops
[0]) {
115 data
[pos
] = float4_to_argb(ramp_stops
+ 1);
120 for (i
= 0; i
< num
- 1; ++i
) {
122 VGint rnext
= 5 * (i
+ 1);
123 VGfloat delta
= 1.f
/(ramp_stops
[rnext
] - ramp_stops
[rcur
]);
124 while (fpos
< ramp_stops
[rnext
] && pos
< size
) {
125 VGint dist
= 256 * ((fpos
- ramp_stops
[rcur
]) * delta
);
126 VGint idist
= 256 - dist
;
127 VGuint current_color
= float4_to_argb(ramp_stops
+ rcur
+ 1);
128 VGuint next_color
= float4_to_argb(ramp_stops
+ rnext
+ 1);
129 data
[pos
] = mix_pixels(current_color
, idist
,
136 last_color
= float4_to_argb(ramp_stops
+ ((num
- 1) * 5 + 1));
138 data
[pos
] = last_color
;
141 data
[size
-1] = last_color
;
144 static INLINE
struct pipe_resource
*create_gradient_texture(struct vg_paint
*p
)
146 struct pipe_context
*pipe
= p
->base
.ctx
->pipe
;
147 struct pipe_screen
*screen
= pipe
->screen
;
148 struct pipe_resource
*tex
= 0;
149 struct pipe_resource templ
;
151 memset(&templ
, 0, sizeof(templ
));
152 templ
.target
= PIPE_TEXTURE_1D
;
153 templ
.format
= PIPE_FORMAT_B8G8R8A8_UNORM
;
154 templ
.last_level
= 0;
158 templ
.bind
= PIPE_BIND_SAMPLER_VIEW
;
160 tex
= screen
->resource_create(screen
, &templ
);
162 { /* upload color_data */
163 struct pipe_transfer
*transfer
=
164 st_no_flush_get_transfer(p
->base
.ctx
, tex
, 0, 0, 0,
165 PIPE_TRANSFER_WRITE
, 0, 0, 1024, 1);
166 void *map
= pipe
->transfer_map(pipe
, transfer
);
167 memcpy(map
, p
->gradient
.color_data
, sizeof(VGint
)*1024);
168 pipe
->transfer_unmap(pipe
, transfer
);
169 pipe
->transfer_destroy(pipe
, transfer
);
175 static INLINE
struct pipe_sampler_view
*create_gradient_sampler_view(struct vg_paint
*p
)
177 struct pipe_context
*pipe
= p
->base
.ctx
->pipe
;
178 struct pipe_resource
*texture
;
179 struct pipe_sampler_view view_templ
;
180 struct pipe_sampler_view
*view
;
182 texture
= create_gradient_texture(p
);
187 u_sampler_view_default_template(&view_templ
, texture
, texture
->format
);
188 view
= pipe
->create_sampler_view(pipe
, texture
, &view_templ
);
189 /* want the texture to go away if the view is freed */
190 pipe_resource_reference(&texture
, NULL
);
195 struct vg_paint
* paint_create(struct vg_context
*ctx
)
197 struct vg_paint
*paint
= CALLOC_STRUCT(vg_paint
);
198 const VGfloat default_color
[] = {0.0f
, 0.0f
, 0.0f
, 1.0f
};
199 const VGfloat def_ling
[] = {0.0f
, 0.0f
, 1.0f
, 0.0f
};
200 const VGfloat def_radg
[] = {0.0f
, 0.0f
, 0.0f
, 0.0f
, 1.0f
};
201 vg_init_object(&paint
->base
, ctx
, VG_OBJECT_PAINT
);
202 vg_context_add_object(ctx
, VG_OBJECT_PAINT
, paint
);
204 paint
->type
= VG_PAINT_TYPE_COLOR
;
205 memcpy(paint
->solid
.color
, default_color
,
206 4 * sizeof(VGfloat
));
207 paint
->gradient
.spread
= VG_COLOR_RAMP_SPREAD_PAD
;
208 memcpy(paint
->gradient
.linear
.coords
, def_ling
,
209 4 * sizeof(VGfloat
));
210 memcpy(paint
->gradient
.radial
.vals
, def_radg
,
211 5 * sizeof(VGfloat
));
213 paint
->gradient
.sampler
.wrap_s
= PIPE_TEX_WRAP_CLAMP_TO_EDGE
;
214 paint
->gradient
.sampler
.wrap_t
= PIPE_TEX_WRAP_CLAMP_TO_EDGE
;
215 paint
->gradient
.sampler
.min_img_filter
= PIPE_TEX_MIPFILTER_NEAREST
;
216 paint
->gradient
.sampler
.mag_img_filter
= PIPE_TEX_MIPFILTER_NEAREST
;
217 paint
->gradient
.sampler
.normalized_coords
= 1;
219 memcpy(&paint
->pattern
.sampler
,
220 &paint
->gradient
.sampler
,
221 sizeof(struct pipe_sampler_state
));
226 void paint_destroy(struct vg_paint
*paint
)
228 struct vg_context
*ctx
= paint
->base
.ctx
;
229 pipe_sampler_view_reference(&paint
->gradient
.sampler_view
, NULL
);
230 if (paint
->pattern
.sampler_view
)
231 pipe_sampler_view_reference(&paint
->pattern
.sampler_view
, NULL
);
233 vg_context_remove_object(ctx
, VG_OBJECT_PAINT
, paint
);
235 free(paint
->gradient
.ramp_stopsi
);
236 free(paint
->gradient
.ramp_stops
);
240 void paint_set_color(struct vg_paint
*paint
,
241 const VGfloat
*color
)
243 paint
->solid
.color
[0] = color
[0];
244 paint
->solid
.color
[1] = color
[1];
245 paint
->solid
.color
[2] = color
[2];
246 paint
->solid
.color
[3] = color
[3];
248 paint
->solid
.colori
[0] = FLT_TO_INT(color
[0]);
249 paint
->solid
.colori
[1] = FLT_TO_INT(color
[1]);
250 paint
->solid
.colori
[2] = FLT_TO_INT(color
[2]);
251 paint
->solid
.colori
[3] = FLT_TO_INT(color
[3]);
254 static INLINE
void paint_color_buffer(struct vg_paint
*paint
, void *buffer
)
256 VGfloat
*map
= (VGfloat
*)buffer
;
257 memcpy(buffer
, paint
->solid
.color
, 4 * sizeof(VGfloat
));
264 static INLINE
void paint_linear_gradient_buffer(struct vg_paint
*paint
, void *buffer
)
266 struct vg_context
*ctx
= paint
->base
.ctx
;
267 VGfloat
*map
= (VGfloat
*)buffer
;
269 map
[0] = paint
->gradient
.linear
.coords
[2] - paint
->gradient
.linear
.coords
[0];
270 map
[1] = paint
->gradient
.linear
.coords
[3] - paint
->gradient
.linear
.coords
[1];
271 map
[2] = 1.f
/ (map
[0] * map
[0] + map
[1] * map
[1]);
281 matrix_load_identity(&mat
);
282 matrix_translate(&mat
, -paint
->gradient
.linear
.coords
[0], -paint
->gradient
.linear
.coords
[1]);
283 memcpy(&inv
, &ctx
->state
.vg
.fill_paint_to_user_matrix
,
284 sizeof(struct matrix
));
286 matrix_mult(&inv
, &mat
);
288 sizeof(struct matrix
));
290 map
[8] = mat
.m
[0]; map
[9] = mat
.m
[3]; map
[10] = mat
.m
[6]; map
[11] = 0.f
;
291 map
[12] = mat
.m
[1]; map
[13] = mat
.m
[4]; map
[14] = mat
.m
[7]; map
[15] = 0.f
;
292 map
[16] = mat
.m
[2]; map
[17] = mat
.m
[5]; map
[18] = mat
.m
[8]; map
[19] = 0.f
;
295 debug_printf("Coords (%f, %f, %f, %f)\n",
296 map
[0], map
[1], map
[2], map
[3]);
301 static INLINE
void paint_radial_gradient_buffer(struct vg_paint
*paint
, void *buffer
)
303 VGfloat
*radialCoords
= paint
->gradient
.radial
.vals
;
304 struct vg_context
*ctx
= paint
->base
.ctx
;
306 VGfloat
*map
= (VGfloat
*)buffer
;
308 map
[0] = radialCoords
[0] - radialCoords
[2];
309 map
[1] = radialCoords
[1] - radialCoords
[3];
310 map
[2] = -map
[0] * map
[0] - map
[1] * map
[1] +
311 radialCoords
[4] * radialCoords
[4];
322 matrix_load_identity(&mat
);
323 matrix_translate(&mat
, -radialCoords
[2], -radialCoords
[3]);
324 memcpy(&inv
, &ctx
->state
.vg
.fill_paint_to_user_matrix
,
325 sizeof(struct matrix
));
327 matrix_mult(&inv
, &mat
);
329 sizeof(struct matrix
));
331 map
[8] = mat
.m
[0]; map
[9] = mat
.m
[3]; map
[10] = mat
.m
[6]; map
[11] = 0.f
;
332 map
[12] = mat
.m
[1]; map
[13] = mat
.m
[4]; map
[14] = mat
.m
[7]; map
[15] = 0.f
;
333 map
[16] = mat
.m
[2]; map
[17] = mat
.m
[5]; map
[18] = mat
.m
[8]; map
[19] = 0.f
;
337 debug_printf("Coords (%f, %f, %f, %f)\n",
338 map
[0], map
[1], map
[2], map
[3]);
343 static INLINE
void paint_pattern_buffer(struct vg_paint
*paint
, void *buffer
)
345 struct vg_context
*ctx
= paint
->base
.ctx
;
347 VGfloat
*map
= (VGfloat
*)buffer
;
348 memcpy(map
, paint
->solid
.color
, 4 * sizeof(VGfloat
));
352 map
[6] = paint
->pattern
.sampler_view
->texture
->width0
;
353 map
[7] = paint
->pattern
.sampler_view
->texture
->height0
;
356 memcpy(&mat
, &ctx
->state
.vg
.fill_paint_to_user_matrix
,
357 sizeof(struct matrix
));
361 memcpy(&pm
, &ctx
->state
.vg
.path_user_to_surface_matrix
,
362 sizeof(struct matrix
));
364 matrix_mult(&pm
, &mat
);
365 memcpy(&mat
, &pm
, sizeof(struct matrix
));
368 map
[8] = mat
.m
[0]; map
[9] = mat
.m
[3]; map
[10] = mat
.m
[6]; map
[11] = 0.f
;
369 map
[12] = mat
.m
[1]; map
[13] = mat
.m
[4]; map
[14] = mat
.m
[7]; map
[15] = 0.f
;
370 map
[16] = mat
.m
[2]; map
[17] = mat
.m
[5]; map
[18] = mat
.m
[8]; map
[19] = 0.f
;
374 void paint_set_type(struct vg_paint
*paint
, VGPaintType type
)
379 void paint_set_ramp_stops(struct vg_paint
*paint
, const VGfloat
*stops
,
382 const VGfloat default_stops
[] = {0.0f
, 0.0f
, 0.0f
, 0.0f
, 1.0f
,
383 1.0f
, 1.0f
, 1.0f
, 1.0f
, 1.0f
};
385 const VGint num_stops
= num
/ 5;
388 paint
->gradient
.num_stops
= num
;
390 free(paint
->gradient
.ramp_stops
);
391 paint
->gradient
.ramp_stops
= malloc(sizeof(VGfloat
)*num
);
392 memcpy(paint
->gradient
.ramp_stops
, stops
, sizeof(VGfloat
)*num
);
396 /* stops must be in increasing order. the last stop is 1.0. if the
397 * first one is bigger than 1 then the whole sequence is invalid*/
399 stops
= default_stops
;
402 last_coord
= stops
[0];
403 for (i
= 1; i
< num_stops
; ++i
) {
405 VGfloat coord
= stops
[idx
];
406 if (!floatsEqual(last_coord
, coord
) && coord
< last_coord
) {
407 stops
= default_stops
;
414 create_gradient_data(stops
, num
/ 5, paint
->gradient
.color_data
,
417 if (paint
->gradient
.sampler_view
) {
418 pipe_sampler_view_reference(&paint
->gradient
.sampler_view
, NULL
);
419 paint
->gradient
.sampler_view
= NULL
;
422 paint
->gradient
.sampler_view
= create_gradient_sampler_view(paint
);
425 void paint_set_colori(struct vg_paint
*p
,
428 p
->solid
.color
[0] = ((rgba
>> 24) & 0xff) / 255.f
;
429 p
->solid
.color
[1] = ((rgba
>> 16) & 0xff) / 255.f
;
430 p
->solid
.color
[2] = ((rgba
>> 8) & 0xff) / 255.f
;
431 p
->solid
.color
[3] = ((rgba
>> 0) & 0xff) / 255.f
;
434 VGuint
paint_colori(struct vg_paint
*p
)
436 #define F2B(f) (float_to_ubyte(f))
438 return ((F2B(p
->solid
.color
[0]) << 24) |
439 (F2B(p
->solid
.color
[1]) << 16) |
440 (F2B(p
->solid
.color
[2]) << 8) |
441 (F2B(p
->solid
.color
[3]) << 0));
445 void paint_set_linear_gradient(struct vg_paint
*paint
,
446 const VGfloat
*coords
)
448 memcpy(paint
->gradient
.linear
.coords
, coords
, sizeof(VGfloat
) * 4);
451 void paint_set_spread_mode(struct vg_paint
*paint
,
454 paint
->gradient
.spread
= mode
;
456 case VG_COLOR_RAMP_SPREAD_PAD
:
457 paint
->gradient
.sampler
.wrap_s
= PIPE_TEX_WRAP_CLAMP_TO_EDGE
;
459 case VG_COLOR_RAMP_SPREAD_REPEAT
:
460 paint
->gradient
.sampler
.wrap_s
= PIPE_TEX_WRAP_REPEAT
;
462 case VG_COLOR_RAMP_SPREAD_REFLECT
:
463 paint
->gradient
.sampler
.wrap_s
= PIPE_TEX_WRAP_MIRROR_REPEAT
;
468 VGColorRampSpreadMode
paint_spread_mode(struct vg_paint
*paint
)
470 return paint
->gradient
.spread
;
473 void paint_set_radial_gradient(struct vg_paint
*paint
,
474 const VGfloat
*values
)
476 memcpy(paint
->gradient
.radial
.vals
, values
, sizeof(VGfloat
) * 5);
479 void paint_set_pattern(struct vg_paint
*paint
,
480 struct vg_image
*img
)
482 if (paint
->pattern
.sampler_view
)
483 pipe_sampler_view_reference(&paint
->pattern
.sampler_view
, NULL
);
485 paint
->pattern
.sampler_view
= NULL
;
486 pipe_sampler_view_reference(&paint
->pattern
.sampler_view
,
490 void paint_set_pattern_tiling(struct vg_paint
*paint
,
493 paint
->pattern
.tiling_mode
= mode
;
497 paint
->pattern
.sampler
.wrap_s
= PIPE_TEX_WRAP_CLAMP_TO_BORDER
;
498 paint
->pattern
.sampler
.wrap_t
= PIPE_TEX_WRAP_CLAMP_TO_BORDER
;
501 paint
->pattern
.sampler
.wrap_s
= PIPE_TEX_WRAP_CLAMP_TO_EDGE
;
502 paint
->pattern
.sampler
.wrap_t
= PIPE_TEX_WRAP_CLAMP_TO_EDGE
;
505 paint
->pattern
.sampler
.wrap_s
= PIPE_TEX_WRAP_REPEAT
;
506 paint
->pattern
.sampler
.wrap_t
= PIPE_TEX_WRAP_REPEAT
;
508 case VG_TILE_REFLECT
:
509 paint
->pattern
.sampler
.wrap_s
= PIPE_TEX_WRAP_MIRROR_REPEAT
;
510 paint
->pattern
.sampler
.wrap_t
= PIPE_TEX_WRAP_MIRROR_REPEAT
;
513 debug_assert("!Unknown tiling mode");
517 void paint_get_color(struct vg_paint
*paint
,
520 color
[0] = paint
->solid
.color
[0];
521 color
[1] = paint
->solid
.color
[1];
522 color
[2] = paint
->solid
.color
[2];
523 color
[3] = paint
->solid
.color
[3];
526 void paint_ramp_stops(struct vg_paint
*paint
, VGfloat
*stops
,
529 memcpy(stops
, paint
->gradient
.ramp_stops
, sizeof(VGfloat
)*num
);
532 void paint_linear_gradient(struct vg_paint
*paint
,
535 memcpy(coords
, paint
->gradient
.linear
.coords
, sizeof(VGfloat
)*4);
538 void paint_radial_gradient(struct vg_paint
*paint
,
541 memcpy(coords
, paint
->gradient
.radial
.vals
, sizeof(VGfloat
)*5);
544 int paint_num_ramp_stops(struct vg_paint
*paint
)
546 return paint
->gradient
.num_stops
;
549 VGPaintType
paint_type(struct vg_paint
*paint
)
554 void paint_set_coloriv(struct vg_paint
*paint
,
557 paint
->solid
.color
[0] = color
[0];
558 paint
->solid
.color
[1] = color
[1];
559 paint
->solid
.color
[2] = color
[2];
560 paint
->solid
.color
[3] = color
[3];
562 paint
->solid
.colori
[0] = color
[0];
563 paint
->solid
.colori
[1] = color
[1];
564 paint
->solid
.colori
[2] = color
[2];
565 paint
->solid
.colori
[3] = color
[3];
568 void paint_get_coloriv(struct vg_paint
*paint
,
571 color
[0] = paint
->solid
.colori
[0];
572 color
[1] = paint
->solid
.colori
[1];
573 color
[2] = paint
->solid
.colori
[2];
574 color
[3] = paint
->solid
.colori
[3];
577 void paint_set_color_ramp_premultiplied(struct vg_paint
*paint
,
580 paint
->gradient
.color_ramps_premultiplied
= set
;
583 VGboolean
paint_color_ramp_premultiplied(struct vg_paint
*paint
)
585 return paint
->gradient
.color_ramps_premultiplied
;
588 void paint_set_ramp_stopsi(struct vg_paint
*paint
, const VGint
*stops
,
592 free(paint
->gradient
.ramp_stopsi
);
593 paint
->gradient
.ramp_stopsi
= malloc(sizeof(VGint
)*num
);
594 memcpy(paint
->gradient
.ramp_stopsi
, stops
, sizeof(VGint
)*num
);
598 void paint_ramp_stopsi(struct vg_paint
*paint
, VGint
*stops
,
601 memcpy(stops
, paint
->gradient
.ramp_stopsi
, sizeof(VGint
)*num
);
604 void paint_set_linear_gradienti(struct vg_paint
*paint
,
607 memcpy(paint
->gradient
.linear
.coordsi
, coords
, sizeof(VGint
) * 4);
610 void paint_linear_gradienti(struct vg_paint
*paint
,
613 memcpy(coords
, paint
->gradient
.linear
.coordsi
, sizeof(VGint
)*4);
616 void paint_set_radial_gradienti(struct vg_paint
*paint
,
619 memcpy(paint
->gradient
.radial
.valsi
, values
, sizeof(VGint
) * 5);
622 void paint_radial_gradienti(struct vg_paint
*paint
,
625 memcpy(coords
, paint
->gradient
.radial
.valsi
, sizeof(VGint
)*5);
628 VGTilingMode
paint_pattern_tiling(struct vg_paint
*paint
)
630 return paint
->pattern
.tiling_mode
;
633 VGint
paint_bind_samplers(struct vg_paint
*paint
, struct pipe_sampler_state
**samplers
,
634 struct pipe_sampler_view
**sampler_views
)
636 struct vg_context
*ctx
= vg_current_context();
638 switch(paint
->type
) {
639 case VG_PAINT_TYPE_LINEAR_GRADIENT
:
640 case VG_PAINT_TYPE_RADIAL_GRADIENT
: {
641 if (paint
->gradient
.sampler_view
) {
642 paint
->gradient
.sampler
.min_img_filter
= image_sampler_filter(ctx
);
643 paint
->gradient
.sampler
.mag_img_filter
= image_sampler_filter(ctx
);
644 samplers
[0] = &paint
->gradient
.sampler
;
645 sampler_views
[0] = paint
->gradient
.sampler_view
;
650 case VG_PAINT_TYPE_PATTERN
: {
651 memcpy(paint
->pattern
.sampler
.border_color
,
652 ctx
->state
.vg
.tile_fill_color
,
653 sizeof(VGfloat
) * 4);
654 paint
->pattern
.sampler
.min_img_filter
= image_sampler_filter(ctx
);
655 paint
->pattern
.sampler
.mag_img_filter
= image_sampler_filter(ctx
);
656 samplers
[0] = &paint
->pattern
.sampler
;
657 sampler_views
[0] = paint
->pattern
.sampler_view
;
667 void paint_resolve_type(struct vg_paint
*paint
)
669 if (paint
->type
== VG_PAINT_TYPE_PATTERN
&&
670 !paint
->pattern
.sampler_view
) {
671 paint
->type
= VG_PAINT_TYPE_COLOR
;
675 VGint
paint_constant_buffer_size(struct vg_paint
*paint
)
677 switch(paint
->type
) {
678 case VG_PAINT_TYPE_COLOR
:
679 return 8 * sizeof(VGfloat
);/*4 color + 4 constants (0.f,1.f,2.f,4.f)*/
681 case VG_PAINT_TYPE_LINEAR_GRADIENT
:
682 return 20 * sizeof(VGfloat
);
684 case VG_PAINT_TYPE_RADIAL_GRADIENT
:
685 return 20 * sizeof(VGfloat
);
687 case VG_PAINT_TYPE_PATTERN
:
688 return 20 * sizeof(VGfloat
);
691 debug_printf("Uknown paint type: %d\n", paint
->type
);
697 void paint_fill_constant_buffer(struct vg_paint
*paint
,
700 switch(paint
->type
) {
701 case VG_PAINT_TYPE_COLOR
:
702 paint_color_buffer(paint
, buffer
);
704 case VG_PAINT_TYPE_LINEAR_GRADIENT
:
705 paint_linear_gradient_buffer(paint
, buffer
);
707 case VG_PAINT_TYPE_RADIAL_GRADIENT
:
708 paint_radial_gradient_buffer(paint
, buffer
);
710 case VG_PAINT_TYPE_PATTERN
:
711 paint_pattern_buffer(paint
, buffer
);