summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/libmatchbox/files/16bppfixes-2.patch
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2012-12-11 21:54:29 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-12-13 15:18:45 +0000
commitd7bca38b11f537405341c890526adf4891f23df4 (patch)
treed4ab57e23ee6360a309f1c3079a6f3fd79a01275 /meta/recipes-graphics/libmatchbox/files/16bppfixes-2.patch
parentebd508d88164da6ddb0bb978374fddaf321f0c65 (diff)
downloadpoky-d7bca38b11f537405341c890526adf4891f23df4.tar.gz
libmatchbox: upgrade to 1.10, drop git
All patches have been upstreamed so drop them, and as upstream isn't heavily developed drop the git recipe. (From OE-Core rev: 3465570601480d2e476e82b8b7254e94f87d2682) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-graphics/libmatchbox/files/16bppfixes-2.patch')
-rw-r--r--meta/recipes-graphics/libmatchbox/files/16bppfixes-2.patch260
1 files changed, 0 insertions, 260 deletions
diff --git a/meta/recipes-graphics/libmatchbox/files/16bppfixes-2.patch b/meta/recipes-graphics/libmatchbox/files/16bppfixes-2.patch
deleted file mode 100644
index 9bcd582e27..0000000000
--- a/meta/recipes-graphics/libmatchbox/files/16bppfixes-2.patch
+++ /dev/null
@@ -1,260 +0,0 @@
1Upstream-Status: Pending
2
3--- libmatchbox/libmb/mbpixbuf.c.orig 2007-05-04 14:41:55.000000000 +0100
4+++ libmatchbox/libmb/mbpixbuf.c 2007-05-04 14:41:55.000000000 +0100
5@@ -710,46 +710,19 @@
6 return colnum;
7 }
8
9-
10-static unsigned long
11-mb_pixbuf_get_pixel(MBPixbuf *pb, int r, int g, int b, int a)
12+/*
13+ * Split the mb_pixbuf_get_pixel() function into several specialized
14+ * functions which we will inline; this allows us to optimize
15+ * mb_pixbuf_img_render_to_drawable_with_gc () by taking some of the
16+ * decision taking outside of the double loop
17+ */
18+
19+/*
20+ * Get pixel value for rgb values and pixel depth <= 8
21+ */
22+static inline unsigned long
23+mb_pixbuf_get_pixel_le8_rgb (MBPixbuf *pb, int r, int g, int b)
24 {
25- if (pb->depth > 8)
26- {
27- switch (pb->depth)
28- {
29- case 15:
30- return ((r & 0xf8) << 7) | ((g & 0xf8) << 2) | ((b & 0xf8) >> 3);
31- case 16:
32- return ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | ((b & 0xf8) >> 3);
33- case 24:
34- case 32:
35- switch (pb->byte_order)
36- {
37- case BYTE_ORD_24_RGB:
38- return ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff);
39- case BYTE_ORD_24_RBG:
40- return ((r & 0xff) << 16) | ((b & 0xff) << 8) | (g & 0xff);
41- case BYTE_ORD_24_BRG:
42- return ((b & 0xff) << 16) | ((r & 0xff) << 8) | (g & 0xff);
43- case BYTE_ORD_24_BGR:
44- return ((b & 0xff) << 16) | ((g & 0xff) << 8) | (r & 0xff);
45- case BYTE_ORD_24_GRB:
46- return ((g & 0xff) << 16) | ((r & 0xff) << 8) | (b & 0xff);
47- case BYTE_ORD_24_GBR:
48- return ((g & 0xff) << 16) | ((b & 0xff) << 8) | (r & 0xff);
49- case BYTE_ORD_32_ARGB:
50- return (a << 24) | (r << 16) | (g << 8) | b;
51- default:
52- return 0;
53- }
54- default:
55- return 0;
56- }
57- return 0;
58- }
59-
60- /* pb->depth <= 8 */
61 switch(pb->vis->class)
62 {
63 case PseudoColor:
64@@ -794,6 +767,111 @@
65 return 0;
66 }
67
68+/*
69+ * Get pixel value from a pointer to 16bbp value for pixel depth <= 8
70+ * and advance the pointer
71+ */
72+static inline unsigned long
73+mb_pixbuf_get_pixel_le8_16bpp_advance (MBPixbuf *pb, unsigned char ** p)
74+{
75+ unsigned short s = SHORT_FROM_2BYTES(*p);
76+ int r, b, g;
77+
78+ r = (s & 0xf800) >> 8;
79+ g = (s & 0x07e0) >> 3;
80+ b = (s & 0x001f) << 3;
81+
82+ *p += 2;
83+
84+ return mb_pixbuf_get_pixel_le8_rgb (pb, r, g, b);
85+}
86+
87+/*
88+ * Get pixel value for rgba values and pixel depth > 8
89+ *
90+ */
91+static inline unsigned long
92+mb_pixbuf_get_pixel_gt8_rgba (MBPixbuf *pb, int r, int g, int b, int a)
93+{
94+ switch (pb->depth)
95+ {
96+ case 15:
97+ switch (pb->byte_order)
98+ {
99+ case BYTE_ORD_24_RGB:
100+ return ((r & 0xf8) << 7) | ((g & 0xf8) << 2) | ((b & 0xf8) >> 3);
101+ case BYTE_ORD_24_BGR:
102+ return ((b & 0xf8) << 7) | ((g & 0xf8) << 2) | ((r & 0xf8) >> 3);
103+ }
104+ case 16:
105+ switch (pb->byte_order)
106+ {
107+ case BYTE_ORD_24_RGB:
108+ return ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | ((b & 0xf8) >> 3);
109+ case BYTE_ORD_24_BGR:
110+ return ((b & 0xf8) << 8) | ((g & 0xfc) << 3) | ((r & 0xf8) >> 3);
111+ }
112+ case 24:
113+ case 32:
114+ switch (pb->byte_order)
115+ {
116+ case BYTE_ORD_24_RGB:
117+ return ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff);
118+ case BYTE_ORD_24_RBG:
119+ return ((r & 0xff) << 16) | ((b & 0xff) << 8) | (g & 0xff);
120+ case BYTE_ORD_24_BRG:
121+ return ((b & 0xff) << 16) | ((r & 0xff) << 8) | (g & 0xff);
122+ case BYTE_ORD_24_BGR:
123+ return ((b & 0xff) << 16) | ((g & 0xff) << 8) | (r & 0xff);
124+ case BYTE_ORD_24_GRB:
125+ return ((g & 0xff) << 16) | ((r & 0xff) << 8) | (b & 0xff);
126+ case BYTE_ORD_24_GBR:
127+ return ((g & 0xff) << 16) | ((b & 0xff) << 8) | (r & 0xff);
128+ case BYTE_ORD_32_ARGB:
129+ return (a << 24) | (r << 16) | (g << 8) | b;
130+ default:
131+ return 0;
132+ }
133+ default:
134+ return 0;
135+ }
136+}
137+
138+/*
139+ * Get pixel value from pointer to 16bpp data for pixel depth > 8
140+ * and advance the pointer
141+ *
142+ * TODO ? We could take the 32bit case out of here, which would allow
143+ * to ignore the alpha value for <15, 24>, but we might not gain that
144+ * much by this on arm due to the conditional execution.
145+ */
146+static inline unsigned long
147+mb_pixbuf_get_pixel_gt8_16bpp_advance (MBPixbuf *pb, unsigned char ** p,
148+ int has_alpha)
149+{
150+ unsigned short s = SHORT_FROM_2BYTES(*p);
151+ int r, b, g, a;
152+
153+ r = (s & 0xf800) >> 8;
154+ g = (s & 0x07e0) >> 3;
155+ b = (s & 0x001f) << 3;
156+
157+ *p += 2;
158+
159+ a = has_alpha ? *(*p)++ : 0xff;
160+
161+ return mb_pixbuf_get_pixel_gt8_rgba (pb, r, g, b, a);
162+}
163+
164+static inline unsigned long
165+mb_pixbuf_get_pixel(MBPixbuf *pb, int r, int g, int b, int a)
166+{
167+ if (pb->depth > 8)
168+ return mb_pixbuf_get_pixel_gt8_rgba (pb, r, g, b, a);
169+
170+ return mb_pixbuf_get_pixel_le8_rgb (pb, r, g, b);
171+}
172+
173 unsigned long
174 mb_pixbuf_lookup_x_pixel(MBPixbuf *pb, int r, int g, int b, int a)
175 {
176@@ -1825,7 +1903,6 @@
177 mb_pixbuf_img_render_to_drawable_with_gc(pb, img, drw, drw_x, drw_y, pb->gc);
178 }
179
180-
181 void
182 mb_pixbuf_img_render_to_drawable_with_gc(MBPixbuf *pb,
183 MBPixbufImage *img,
184@@ -1883,31 +1960,57 @@
185
186 if (pb->internal_bytespp == 2)
187 {
188- for(y=0; y<img->height; y++)
189- for(x=0; x<img->width; x++)
190- {
191- /* Below is potentially dangerous.
192- */
193- pixel = ( *p | (*(p+1) << 8));
194-
195- p += ((img->has_alpha) ? 3 : 2);
196-
197- XPutPixel(img->ximg, x, y, pixel);
198- }
199+ if (pb->depth > 8)
200+ {
201+ for(y=0; y<img->height; y++)
202+ for(x=0; x<img->width; x++)
203+ {
204+ pixel = mb_pixbuf_get_pixel_gt8_16bpp_advance(pb, &p,
205+ img->has_alpha);
206+ XPutPixel(img->ximg, x, y, pixel);
207+ }
208+ }
209+ else
210+ {
211+ for(y=0; y<img->height; y++)
212+ for(x=0; x<img->width; x++)
213+ {
214+ pixel = mb_pixbuf_get_pixel_le8_16bpp_advance(pb, &p);
215+ XPutPixel(img->ximg, x, y, pixel);
216+ }
217+ }
218 }
219 else
220 {
221- for(y=0; y<img->height; y++)
222+ if (pb->depth > 8)
223 {
224- for(x=0; x<img->width; x++)
225+ for(y=0; y<img->height; y++)
226 {
227- r = ( *p++ );
228- g = ( *p++ );
229- b = ( *p++ );
230- a = ((img->has_alpha) ? *p++ : 0xff);
231+ for(x=0; x<img->width; x++)
232+ {
233+ r = ( *p++ );
234+ g = ( *p++ );
235+ b = ( *p++ );
236+ a = ((img->has_alpha) ? *p++ : 0xff);
237
238- pixel = mb_pixbuf_get_pixel(pb, r, g, b, a);
239- XPutPixel(img->ximg, x, y, pixel);
240+ pixel = mb_pixbuf_get_pixel_gt8_rgba(pb, r, g, b, a);
241+ XPutPixel(img->ximg, x, y, pixel);
242+ }
243+ }
244+ }
245+ else
246+ {
247+ for(y=0; y<img->height; y++)
248+ {
249+ for(x=0; x<img->width; x++)
250+ {
251+ r = ( *p++ );
252+ g = ( *p++ );
253+ b = ( *p++ );
254+
255+ pixel = mb_pixbuf_get_pixel_le8_rgb(pb, r, g, b);
256+ XPutPixel(img->ximg, x, y, pixel);
257+ }
258 }
259 }
260 }