summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/libmatchbox/files/16bppfixes.patch
blob: 284318c94890e8d6164fd98086cc5b2f9f90a550 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Upstream-Status: Pending

Index: libmb/mbpixbuf.c
===================================================================
--- libmatchbox/libmb.orig/mbpixbuf.c	2006-02-01 12:45:55.000000000 +0000
+++ libmatchbox/libmb/mbpixbuf.c	2006-03-11 15:20:47.000000000 +0000
@@ -716,7 +716,13 @@
 	case 15:
 	  return ((r & 0xf8) << 7) | ((g & 0xf8) << 2) | ((b & 0xf8) >> 3);
 	case 16:
-	  return ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | ((b & 0xf8) >> 3);
+	  switch (pb->byte_order)
+	    {
+	    case BYTE_ORD_24_RGB:
+	      return ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | ((b & 0xf8) >> 3);
+	    case BYTE_ORD_24_BGR:
+	      return ((b & 0xf8) << 8) | ((g & 0xfc) << 3) | ((r & 0xf8) >> 3);
+	    }
 	case 24:
 	case 32:
 	  switch (pb->byte_order)
@@ -1880,12 +1886,11 @@
 	  for(y=0; y<img->height; y++)
 	    for(x=0; x<img->width; x++)
 	      {
-		/* Below is potentially dangerous.  
-		 */
-		pixel =  ( *p | (*(p+1) << 8)); 
+		internal_16bpp_pixel_to_rgb(p, r, g, b);
+		internal_16bpp_pixel_next(p);
+		a = ((img->has_alpha) ?  *p++ : 0xff);
 
-		p +=  ((img->has_alpha) ?  3 : 2);
-		
+		pixel = mb_pixbuf_get_pixel(pb, r, g, b, a);
 		XPutPixel(img->ximg, x, y, pixel);
 	      }
 	}