[AD] Color depth selection in grabber

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hi,

On SourceForge, I have submitted a patch (also available below) which
slightly changes the way the grabber chooses a color depth. It had
recently been changed to first set a mode use GFX_SAFE, and if that
failed, to try specific color depths.

On DJGPP, at least, this results in a 640x480x8-bit mode, which is not
good when the graphics card can support 640x480x32-bit, for instance.
The patch I have submitted changes this behaviour so that the grabber
first tries GFX_AUTODETECT with 32,24,16,15, then 8 bpp, and then tries
GFX_SAFE, which seems more logical to me.

If there is any reason to keep it the other way around, let me know;
however, we will need to do something to ensure grabber gets the best
color depth (32bpp is more useful than 8bpp for a tool which manipulates
different palettes...)

Here is the patch:
------------------------------------------------------------------------

--- c:/home/cvs/allegro/tools/grabber.c Wed Dec 13 04:25:00 2000
+++ /allegro/tools/grabber.c    Thu Dec 21 09:33:58 2000
@@ -3037,16 +3037,15 @@
       ret = set_gfx_mode(GFX_AUTODETECT, w, h, 0, 0);
    }
    else {
-      ret = set_gfx_mode(GFX_SAFE, w, h, 0, 0);
-      if (ret != 0) {
-        for (i=0; color_depths[i]; i++) {
-          bpp = color_depths[i];
-          set_color_depth(bpp);
-          ret = set_gfx_mode(GFX_AUTODETECT, w, h, 0, 0);
-          if (ret == 0)
-             break;
-        }
+      for(i=0; color_depths[i]; i++) {
+     bpp = color_depths[i];
+     set_color_depth(bpp);
+     ret = set_gfx_mode(GFX_AUTODETECT, w, h, 0, 0);
+     if (ret == 0)
+       break;
       }
+      if(ret)
+     ret = set_gfx_mode(GFX_SAFE, w, h, 0, 0);
    }
 
    if (ret != 0) {

------------------------------------------------------------------------

Hope I got the formatting right.

Bye for now,
-- 
Laurence Withers, lwithers@xxxxxxxxxx
                http://www.lwithers.demon.co.uk/

Attachment: signature.asc
Description: PGP signature



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/