[AD] get_color_depth

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



Here's a patch to add a get_color_depth function. This just returns _color_depth. I needed it for AllegroGL, before the screen gets initialized (which rules out bitmap_color_depth(screen)).

If there are no objections, then I will apply it.

--
- Robert J Ohannessian
"Microsoft code is probably O(n^20)" (my CS prof)
http://pages.infinit.net/voidstar/
? get_color_depth.diff
Index: docs/src/allegro._tx
===================================================================
RCS file: /cvsroot/alleg/allegro/docs/src/allegro._tx,v
retrieving revision 1.39
diff -u -b -r1.39 allegro._tx
--- docs/src/allegro._tx	28 Mar 2002 09:40:46 -0000	1.39
+++ docs/src/allegro._tx	31 Mar 2002 03:22:06 -0000
@@ -2172,10 +2172,14 @@
 Graphics modes
 
 @@void @set_color_depth(int depth);
-@domain.hid set_gfx_mode, set_color_conversion, makecol, getr
+@xref get_color_depth, set_gfx_mode, set_color_conversion, makecol, getr
    Sets the pixel format to be used by subsequent calls to set_gfx_mode() 
    and create_bitmap(). Valid depths are 8 (the default), 15, 16, 24, and 32 
    bits.
+
+@@int @det_color_depth(int depth);
+@xref set_color_depth
+   Returns the last color depth set by set_color_depth().
 
 @@void @request_refresh_rate(int rate);
 @xref set_gfx_mode, get_refresh_rate
Index: include/allegro/gfx.h
===================================================================
RCS file: /cvsroot/alleg/allegro/include/allegro/gfx.h,v
retrieving revision 1.5
diff -u -b -r1.5 gfx.h
--- include/allegro/gfx.h	9 Jan 2002 01:37:25 -0000	1.5
+++ include/allegro/gfx.h	31 Mar 2002 03:22:07 -0000
@@ -343,6 +343,7 @@
 AL_FUNC(GFX_MODE_LIST *, get_gfx_mode_list, (int card));
 AL_FUNC(void, destroy_gfx_mode_list, (GFX_MODE_LIST *gfx_mode_list));
 AL_FUNC(void, set_color_depth, (int depth));
+AL_FUNC(int,  get_color_depth, ());
 AL_FUNC(void, set_color_conversion, (int mode));
 AL_FUNC(void, request_refresh_rate, (int rate));
 AL_FUNC(int, get_refresh_rate, (void));
Index: src/graphics.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/graphics.c,v
retrieving revision 1.35
diff -u -b -r1.35 graphics.c
--- src/graphics.c	25 Mar 2002 12:41:40 -0000	1.35
+++ src/graphics.c	31 Mar 2002 03:22:12 -0000
@@ -291,6 +291,17 @@
 
 
 
+/* get_color_depth:
+ *  Returns the last color depth set by set_color_depth.
+ */
+int get_color_depth()
+{
+   return _color_depth;
+}
+
+
+
+
 /* set_color_conversion:
  *  Sets a bit mask specifying which types of color format conversions are
  *  valid when loading data from disk.


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