Rev 1891 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1891 | Rev 3931 | ||
---|---|---|---|
Line 24... | Line 24... | ||
24 | #ifdef HAVE_CONFIG_H |
24 | #ifdef HAVE_CONFIG_H |
25 | #include |
25 | #include |
26 | #endif |
26 | #endif |
27 | #include "pixman-private.h" |
27 | #include "pixman-private.h" |
Line 28... | Line -... | ||
28 | - | ||
29 | static void |
- | |
30 | solid_fill_get_scanline_32 (pixman_image_t *image, |
- | |
31 | int x, |
- | |
32 | int y, |
- | |
33 | int width, |
- | |
34 | uint32_t * buffer, |
- | |
35 | const uint32_t *mask) |
- | |
36 | { |
- | |
37 | uint32_t *end = buffer + width; |
- | |
38 | uint32_t color = image->solid.color_32; |
- | |
39 | - | ||
40 | while (buffer < end) |
- | |
41 | *(buffer++) = color; |
- | |
42 | - | ||
43 | return; |
- | |
44 | } |
- | |
45 | - | ||
46 | static void |
- | |
47 | solid_fill_get_scanline_64 (pixman_image_t *image, |
- | |
48 | int x, |
- | |
49 | int y, |
- | |
50 | int width, |
- | |
51 | uint32_t * buffer, |
- | |
52 | const uint32_t *mask) |
- | |
53 | { |
- | |
54 | uint64_t *b = (uint64_t *)buffer; |
- | |
55 | uint64_t *e = b + width; |
- | |
56 | uint64_t color = image->solid.color_64; |
- | |
57 | - | ||
58 | while (b < e) |
- | |
59 | *(b++) = color; |
- | |
60 | } |
- | |
61 | - | ||
62 | static source_image_class_t |
- | |
63 | solid_fill_classify (pixman_image_t *image, |
- | |
64 | int x, |
- | |
65 | int y, |
- | |
66 | int width, |
- | |
67 | int height) |
- | |
68 | { |
- | |
69 | return SOURCE_IMAGE_CLASS_HORIZONTAL; |
- | |
70 | } |
- | |
71 | - | ||
72 | static void |
- | |
73 | solid_fill_property_changed (pixman_image_t *image) |
- | |
74 | { |
- | |
75 | image->common.get_scanline_32 = solid_fill_get_scanline_32; |
- | |
76 | image->common.get_scanline_64 = solid_fill_get_scanline_64; |
- | |
77 | } |
- | |
78 | 28 | ||
79 | static uint32_t |
29 | static uint32_t |
80 | color_to_uint32 (const pixman_color_t *color) |
30 | color_to_uint32 (const pixman_color_t *color) |
81 | { |
31 | { |
82 | return |
32 | return |
83 | (color->alpha >> 8 << 24) | |
33 | (color->alpha >> 8 << 24) | |
84 | (color->red >> 8 << 16) | |
34 | (color->red >> 8 << 16) | |
85 | (color->green & 0xff00) | |
35 | (color->green & 0xff00) | |
86 | (color->blue >> 8); |
36 | (color->blue >> 8); |
Line 87... | Line 37... | ||
87 | } |
37 | } |
88 | 38 | ||
89 | static uint64_t |
39 | static argb_t |
90 | color_to_uint64 (const pixman_color_t *color) |
40 | color_to_float (const pixman_color_t *color) |
- | 41 | { |
|
91 | { |
42 | argb_t result; |
92 | return |
43 | |
93 | ((uint64_t)color->alpha << 48) | |
44 | result.a = pixman_unorm_to_float (color->alpha, 16); |
94 | ((uint64_t)color->red << 32) | |
45 | result.r = pixman_unorm_to_float (color->red, 16); |
- | 46 | result.g = pixman_unorm_to_float (color->green, 16); |
|
- | 47 | result.b = pixman_unorm_to_float (color->blue, 16); |
|
95 | ((uint64_t)color->green << 16) | |
48 | |
Line 96... | Line 49... | ||
96 | ((uint64_t)color->blue); |
49 | return result; |
97 | } |
50 | } |
98 | 51 | ||
99 | PIXMAN_EXPORT pixman_image_t * |
52 | PIXMAN_EXPORT pixman_image_t * |
Line 100... | Line 53... | ||
100 | pixman_image_create_solid_fill (pixman_color_t *color) |
53 | pixman_image_create_solid_fill (const pixman_color_t *color) |
101 | { |
54 | { |
Line 102... | Line 55... | ||
102 | pixman_image_t *img = _pixman_image_allocate (); |
55 | pixman_image_t *img = _pixman_image_allocate (); |
103 | 56 | ||
104 | if (!img) |
57 | if (!img) |
105 | return NULL; |
58 | return NULL; |
106 | - | ||
107 | img->type = SOLID; |
- | |
108 | img->solid.color = *color; |
- | |
Line 109... | Line 59... | ||
109 | img->solid.color_32 = color_to_uint32 (color); |
59 | |
110 | img->solid.color_64 = color_to_uint64 (color); |
60 | img->type = SOLID; |