[AD] Re: CVS: allegro/demo demo.c,1.23,1.24

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


> @@ -2183,7 +2180,7 @@
>        exit(1);
>  
>     set_color_depth(8);
> -   if (set_gfx_mode(c, w, h, 0, 0) != 0) {
> +   if (set_gfx_mode(c, w, h, w, h * 2) != 0 && set_gfx_mode(c, w, h, 0, 
0) != 0) {
>        set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
>        allegro_message("Error setting 8bpp graphics mode\n%s\n", 
allegro_error);
>        exit(1);

I'm not sure I like this construction. As far as I know, the first will 
always succeed anyway, even on systems for which the video memory isn't a 
single surface. In that case, it is wasting video memory.

I want to propose the attached patch instead, which I think is the 
recommended way to handle page flipping.

Evert
--- allegro/demo/demo.c	2004-07-11 16:35:58.000000000 +0200
+++ alleg_work/demo/demo.c	2004-07-11 16:39:55.000000000 +0200
@@ -2180,7 +2180,11 @@
       exit(1);
 
    set_color_depth(8);
-   if (set_gfx_mode(c, w, h, w, h * 2) != 0 && set_gfx_mode(c, w, h, 0, 0) != 0) {
+#ifdef _ALLEGRO_VRAM_SINGLE_SURFACE
+   if (set_gfx_mode(c, w, h, w, h * 2) != 0) {
+#else
+   if (set_gfx_mode(c, w, h, 0, 0) != 0) {
+#endif
       set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
       allegro_message("Error setting 8bpp graphics mode\n%s\n", allegro_error);
       exit(1);


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