Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Patch to make _al_get_bitmap_display public

This thread is locked; no one can reply to it. rss feed Print
Patch to make _al_get_bitmap_display public
Edgar Reynaldo
Major Reynaldo
May 2007
avatar

For debugging purposes I needed to make _al_get_bitmap_display public. So here's a patch to do so. It's a simple change, and it makes it possible to know which display a bitmap is currently attached to.

 docs/src/refman/graphics.txt |  4 ++++
 include/allegro5/bitmap.h    |  4 ++++
 src/bitmap.c                 | 10 ++++++++++
 3 files changed, 18 insertions(+)

diff --git a/docs/src/refman/graphics.txt b/docs/src/refman/graphics.txt
index 6ebde96..9d4b873 100644
--- a/docs/src/refman/graphics.txt
+++ b/docs/src/refman/graphics.txt
@@ -684,6 +684,10 @@ Returns the height of a bitmap in pixels.
 
 Returns the width of a bitmap in pixels.
 
+### API: al_get_bitmap_display
+
+Returns the display that the bitmap is attached to.
+
 ### API: al_get_pixel
 
 Get a pixel's color value from the specified bitmap.  This operation is slow
diff --git a/include/allegro5/bitmap.h b/include/allegro5/bitmap.h
index e93851d..042b0d0 100644
--- a/include/allegro5/bitmap.h
+++ b/include/allegro5/bitmap.h
@@ -11,6 +11,10 @@
  */
 typedef struct ALLEGRO_BITMAP ALLEGRO_BITMAP;
 
+/* Forward declaration of ALLEGRO_DISPLAY
+ */
+typedef struct ALLEGRO_DISPLAY ALLEGRO_DISPLAY;
+
 
 /*
  * Bitmap flags
diff --git a/src/bitmap.c b/src/bitmap.c
index 454e80f..82fc8a5 100644
--- a/src/bitmap.c
+++ b/src/bitmap.c
@@ -328,6 +328,16 @@ int al_get_bitmap_flags(ALLEGRO_BITMAP *bitmap)
 }
 
 
+
+/* Function: al_get_bitmap_display
+ */
+ALLEGRO_DISPLAY* al_get_bitmap_display(ALLEGRO_BITMAP* bitmap) 
+{
+   return _al_get_bitmap_display(bitmap);
+}
+
+
+
 ALLEGRO_DISPLAY *_al_get_bitmap_display(ALLEGRO_BITMAP *bitmap)
 {
    if (bitmap->parent)

Elias
Member #358
May 2000

Sounds useful to me... if nobody applies it within a few days make sure to put it on github.

--
"Either help out or stop whining" - Evert

Go to: