diff options
author | Denys Dmytriyenko <denis@denix.org> | 2009-03-17 14:32:59 -0400 |
---|---|---|
committer | Denys Dmytriyenko <denis@denix.org> | 2009-03-17 14:32:59 -0400 |
commit | 709c4d66e0b107ca606941b988bad717c0b45d9b (patch) | |
tree | 37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/psplash/files/psplash_grayscale.patch | |
parent | fa6cd5a3b993f16c27de4ff82b42684516d433ba (diff) |
rename packages/ to recipes/ per earlier agreement
See links below for more details:
http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326
http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816
Signed-off-by: Denys Dmytriyenko <denis@denix.org>
Acked-by: Mike Westerhof <mwester@dls.net>
Acked-by: Philip Balister <philip@balister.org>
Acked-by: Khem Raj <raj.khem@gmail.com>
Acked-by: Marcin Juszkiewicz <hrw@openembedded.org>
Acked-by: Koen Kooi <koen@openembedded.org>
Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/psplash/files/psplash_grayscale.patch')
-rw-r--r-- | recipes/psplash/files/psplash_grayscale.patch | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/recipes/psplash/files/psplash_grayscale.patch b/recipes/psplash/files/psplash_grayscale.patch new file mode 100644 index 0000000000..8f42369300 --- /dev/null +++ b/recipes/psplash/files/psplash_grayscale.patch @@ -0,0 +1,83 @@ +diff -urN psplash.orig/psplash-fb.c psplash/psplash-fb.c +--- psplash.orig/psplash-fb.c 2007-08-29 20:27:49.000000000 +0200 ++++ psplash/psplash-fb.c 2009-01-15 18:42:11.000000000 +0100 +@@ -62,7 +62,8 @@ + goto fail; + } + +- if (fb_var.bits_per_pixel < 16) ++ if (fb_var.bits_per_pixel != 1 && fb_var.bits_per_pixel != 2 ++ && fb_var.bits_per_pixel < 16) + { + fprintf(stderr, + "Error, no support currently for %i bpp frame buffers\n", +@@ -143,7 +144,18 @@ + return NULL; + } + +-#define OFFSET(fb,x,y) (((y) * (fb)->stride) + ((x) * ((fb)->bpp >> 3))) ++static inline int ++psplash_fb_offset(PSplashFB *fb, int x, int y) ++{ ++ switch (fb->bpp) ++ { ++ /* pixel offset */ ++ case 2: return (y * (fb->stride << 2)) + x; ++ case 1: return (y * (fb->stride << 3)) + x; ++ /* byte offset */ ++ default: return (y * fb->stride) + (x * (fb->bpp >> 3)); ++ } ++} + + inline void + psplash_fb_plot_pixel (PSplashFB *fb, +@@ -153,7 +165,7 @@ + uint8 green, + uint8 blue) + { +- int off; ++ int off, shift; + + if (x < 0 || x > fb->width-1 || y < 0 || y > fb->height-1) + return; +@@ -161,17 +173,17 @@ + switch (fb->angle) + { + case 270: +- off = OFFSET (fb, fb->height - y - 1, x); ++ off = psplash_fb_offset (fb, fb->height - y - 1, x); + break; + case 180: +- off = OFFSET (fb, fb->width - x - 1, fb->height - y - 1); ++ off = psplash_fb_offset (fb, fb->width - x - 1, fb->height - y - 1); + break; + case 90: +- off = OFFSET (fb, y, fb->width - x - 1); ++ off = psplash_fb_offset (fb, y, fb->width - x - 1); + break; + case 0: + default: +- off = OFFSET (fb, x, y); ++ off = psplash_fb_offset (fb, x, y); + break; + } + +@@ -188,6 +200,18 @@ + *(volatile uint16 *) (fb->data + off) + = ((red >> 3) << 11) | ((green >> 2) << 5) | (blue >> 3); + break; ++ case 2: ++ shift = (3 - (off & 3)) << 1; ++ *(fb->data + (off >> 2)) = (*(fb->data + (off >> 2)) & ~(3 << shift)) ++ | (((11*red + 16*green + 5*blue) >> 11) << shift); ++ break; ++ case 1: ++ shift = 7 - (off & 7); ++ if (((11*red + 16*green + 5*blue) >> 5) >= 128) ++ *(fb->data + (off >> 3)) |= (1 << shift); ++ else ++ *(fb->data + (off >> 3)) &= ~(1 << shift); ++ break; + default: + /* depth not supported yet */ + break; |