summaryrefslogtreecommitdiff
path: root/apps/plugins/pacbox/arcade.c
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2006-03-15 01:41:54 +0000
committerDave Chapman <dave@dchapman.com>2006-03-15 01:41:54 +0000
commit67760ded3352839925c6ff39f922d3a801b6144a (patch)
tree42a03524221b2ace66fc61f2af4fab57e63b9109 /apps/plugins/pacbox/arcade.c
parentec855445b3438f9b9e849472f0abc2d79bbf6d09 (diff)
downloadrockbox-67760ded3352839925c6ff39f922d3a801b6144a.tar.gz
rockbox-67760ded3352839925c6ff39f922d3a801b6144a.zip
Patch #4830 from Dave Hooper - improved grayscale for the H1x0
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9041 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pacbox/arcade.c')
-rw-r--r--apps/plugins/pacbox/arcade.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/apps/plugins/pacbox/arcade.c b/apps/plugins/pacbox/arcade.c
index 625ff6e8f1..e7fc0244de 100644
--- a/apps/plugins/pacbox/arcade.c
+++ b/apps/plugins/pacbox/arcade.c
@@ -33,8 +33,13 @@ extern struct plugin_api* rb;
33/* Convert RGB888 to 2-bit greyscale - logic taken from bmp2rb.c */ 33/* Convert RGB888 to 2-bit greyscale - logic taken from bmp2rb.c */
34static fb_data rgb_to_gray(unsigned int r, unsigned int g, unsigned int b) 34static fb_data rgb_to_gray(unsigned int r, unsigned int g, unsigned int b)
35{ 35{
36 int brightness = ((3*r + 6*g + b) / 10); 36 int brightness = ( 2*r + 4*g + b );
37 return ((brightness & 0xc0) >> 6); 37 if( r == 0 && g == 0 && b == 0 )
38 return 3;
39
40 brightness = (brightness/450);
41 if( brightness > 2 ) return 0;
42 else return 2-brightness;
38} 43}
39#endif 44#endif
40 45
@@ -294,7 +299,9 @@ void decodeROMs(void)
294 (unsigned char) (c >> 8), 299 (unsigned char) (c >> 8),
295 (unsigned char) (c >> 16)); 300 (unsigned char) (c >> 16));
296#else 301#else
297 palette[i] = rgb_to_gray(c, c >> 8, c >> 16); 302 palette[i] = rgb_to_gray((unsigned char) (c),
303 (unsigned char) (c >> 8),
304 (unsigned char) (c >> 16) );
298#endif 305#endif
299 } 306 }
300} 307}