From 4189210faa66ce78e728a40b68827d3bfe3c9ff0 Mon Sep 17 00:00:00 2001
From: luxo <lharonik@gmail.com>
Date: Sun, 24 Feb 2019 18:09:51 +0100
Subject: [PATCH] Added new bitmap drawing functions

---
 include/allegro5/bitmap_draw.h |  24 +++
 src/bitmap_draw.c              | 271 ++++++++++++++++++++++++++++++++-
 2 files changed, 292 insertions(+), 3 deletions(-)

diff --git a/include/allegro5/bitmap_draw.h b/include/allegro5/bitmap_draw.h
index 83e3e1449..c57845c6b 100644
--- a/include/allegro5/bitmap_draw.h
+++ b/include/allegro5/bitmap_draw.h
@@ -34,6 +34,30 @@ AL_FUNC(void, al_draw_tinted_scaled_rotated_bitmap_region, (
    float cx, float cy, float dx, float dy, float xscale, float yscale,
    float angle, int flags));
 
+/* New blitting */
+AL_FUNC(void, al_draw_bitmap_scaled, (ALLEGRO_BITMAP *bitmap,  float dx, float dy, float xscale, float yscale, int flags));
+AL_FUNC(void, al_draw_bitmap_stretched, (ALLEGRO_BITMAP *bitmap, float dx, float dy, float dw, float dh, int flags));
+AL_FUNC(void, al_draw_bitmap_rotated, (ALLEGRO_BITMAP *bitmap, float cx, float cy, float dx, float dy, float angle, int flags));
+AL_FUNC(void, al_draw_bitmap_tinted, (ALLEGRO_BITMAP *bitmap, float dx, float dy, ALLEGRO_COLOR tint, int flags));
+AL_FUNC(void, al_draw_bitmap_scaled_rotated, (ALLEGRO_BITMAP *bitmap, float cx, float cy, float dx, float dy, float xscale, float yscale, float angle, int flags));
+AL_FUNC(void, al_draw_bitmap_stretched_rotated, (ALLEGRO_BITMAP *bitmap, float cx, float cy, float dx, float dy, float dw, float dh, float angle, int flags));
+AL_FUNC(void, al_draw_bitmap_scaled_tinted, (ALLEGRO_BITMAP *bitmap, float dx, float dy, float xscale, float yscale, ALLEGRO_COLOR tint, int flags));
+AL_FUNC(void, al_draw_bitmap_stretched_tinted, (ALLEGRO_BITMAP *bitmap, float dx, float dy, float dw, float dh, ALLEGRO_COLOR tint, int flags));
+AL_FUNC(void, al_draw_bitmap_rotated_tinted, (ALLEGRO_BITMAP *bitmap, float cx, float cy, float dx, float dy, float angle, ALLEGRO_COLOR tint, int flags));
+AL_FUNC(void, al_draw_bitmap_scaled_rotated_tinted, (ALLEGRO_BITMAP *bitmap, float cx, float cy, float dx, float dy, float xscale, float yscale, float angle, ALLEGRO_COLOR tint, int flags));
+AL_FUNC(void, al_draw_bitmap_stretched_rotated_tinted, (ALLEGRO_BITMAP *bitmap, float cx, float cy, float dx, float dy, float dw, float dh, float angle, ALLEGRO_COLOR tint, int flags));
+
+AL_FUNC(void, al_draw_bitmap_region_scaled, (ALLEGRO_BITMAP *bitmap, float sx, float sy, float sw, float sh, float dx, float dy, float xscale, float yscale, int flags));
+AL_FUNC(void, al_draw_bitmap_region_stretched, (ALLEGRO_BITMAP *bitmap, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, int flags));
+AL_FUNC(void, al_draw_bitmap_region_rotated, (ALLEGRO_BITMAP *bitmap, float sx, float sy, float sw, float sh, float cx, float cy, float dx, float dy, float angle, int flags));
+AL_FUNC(void, al_draw_bitmap_region_tinted, (ALLEGRO_BITMAP *bitmap, float sx, float sy, float sw, float sh, float dx, float dy, ALLEGRO_COLOR tint, int flags));
+AL_FUNC(void, al_draw_bitmap_region_scaled_rotated, (ALLEGRO_BITMAP *bitmap, float sx, float sy, float sw, float sh, float cx, float cy, float dx, float dy, float xscale, float yscale, float angle, int flags));
+AL_FUNC(void, al_draw_bitmap_region_stretched_rotated, (ALLEGRO_BITMAP *bitmap, float sx, float sy, float sw, float sh, float cx, float cy, float dx, float dy, float dw, float dh, float angle, int flags));
+AL_FUNC(void, al_draw_bitmap_region_scaled_tinted, (ALLEGRO_BITMAP *bitmap, float sx, float sy, float sw, float sh, float dx, float dy, float xscale, float yscale, ALLEGRO_COLOR tint, int flags));
+AL_FUNC(void, al_draw_bitmap_region_stretched_tinted, (ALLEGRO_BITMAP *bitmap, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ALLEGRO_COLOR tint, int flags));
+AL_FUNC(void, al_draw_bitmap_region_rotated_tinted, (ALLEGRO_BITMAP *bitmap, float sx, float sy, float sw, float sh, float cx, float cy, float dx, float dy, float angle, ALLEGRO_COLOR tint, int flags));
+AL_FUNC(void, al_draw_bitmap_region_scaled_rotated_tinted, (ALLEGRO_BITMAP *bitmap, float sx, float sy, float sw, float sh, float cx, float cy, float dx, float dy, float xscale, float yscale, float angle, ALLEGRO_COLOR tint, int flags));
+AL_FUNC(void, al_draw_bitmap_region_stretched_rotated_tinted, (ALLEGRO_BITMAP *bitmap, float sx, float sy, float sw, float sh, float cx, float cy, float dx, float dy, float dw, float dh, float angle, ALLEGRO_COLOR tint, int flags));
 
 #ifdef __cplusplus
    }
diff --git a/src/bitmap_draw.c b/src/bitmap_draw.c
index cd01dfd12..6731b9853 100644
--- a/src/bitmap_draw.c
+++ b/src/bitmap_draw.c
@@ -147,7 +147,10 @@ void al_draw_tinted_bitmap(ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR tint,
  */
 void al_draw_bitmap(ALLEGRO_BITMAP *bitmap, float dx, float dy, int flags)
 {
-   al_draw_tinted_bitmap(bitmap, solid_white, dx, dy, flags);
+   ASSERT(bitmap);
+
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, solid_white,
+      0, 0, 0, 1, 1, 0, 0, bitmap->w, bitmap->h, dx, dy, flags);
 }
 
 
@@ -156,8 +159,8 @@ void al_draw_bitmap(ALLEGRO_BITMAP *bitmap, float dx, float dy, int flags)
 void al_draw_bitmap_region(ALLEGRO_BITMAP *bitmap,
    float sx, float sy, float sw, float sh, float dx, float dy, int flags)
 {
-   al_draw_tinted_bitmap_region(bitmap, solid_white, sx, sy, sw, sh,
-      dx, dy, flags);
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, solid_white,
+      0, 0, 0, 1, 1, sx, sy, sw, sh, dx, dy, flags);
 }
 
 
@@ -250,4 +253,266 @@ void al_draw_scaled_rotated_bitmap(ALLEGRO_BITMAP *bitmap,
 }
 
 
+/* Function: al_draw_bitmap_scaled
+ */
+void al_draw_bitmap_scaled(ALLEGRO_BITMAP *bitmap,
+   float dx, float dy, float xscale, float yscale, int flags)
+{
+   ASSERT(bitmap);
+
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, solid_white,
+      0, 0, 0, xscale, yscale, 0, 0, bitmap->w, bitmap->h, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_stretched
+ */
+void al_draw_bitmap_stretched(ALLEGRO_BITMAP *bitmap,
+   float dx, float dy, float dw, float dh, int flags)
+{
+   ASSERT(bitmap);
+
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, solid_white,
+      0, 0, 0, dw / bitmap->w, dh / bitmap->h,
+      0, 0, bitmap->w, bitmap->h, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_rotated
+ */
+void al_draw_bitmap_rotated(ALLEGRO_BITMAP *bitmap,
+   float cx, float cy, float dx, float dy, float angle, int flags)
+{
+   ASSERT(bitmap);
+
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, solid_white,
+      cx, cy, angle, 1, 1, 0, 0, bitmap->w, bitmap->h, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_tinted
+ */
+void al_draw_bitmap_tinted(ALLEGRO_BITMAP *bitmap, float dx, float dy,
+   ALLEGRO_COLOR tint, int flags)
+{
+   ASSERT(bitmap);
+
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, tint,
+      0, 0, 0, 1, 1, 0, 0, bitmap->w, bitmap->h, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_scaled_rotated
+ */
+void al_draw_bitmap_scaled_rotated(ALLEGRO_BITMAP *bitmap,
+   float cx, float cy, float dx, float dy, float xscale, float yscale,
+   float angle, int flags)
+{
+   ASSERT(bitmap);
+
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, solid_white,
+      cx, cy, angle, xscale, yscale, 0, 0, bitmap->w, bitmap->h, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_stretched_rotated
+ */
+void al_draw_bitmap_stretched_rotated(ALLEGRO_BITMAP *bitmap,
+   float cx, float cy, float dx, float dy, float dw, float dh,
+   float angle, int flags)
+{
+   ASSERT(bitmap);
+
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, solid_white,
+      cx, cy, angle, dw / bitmap->w, dh / bitmap->h,
+      0, 0, bitmap->w, bitmap->h, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_scaled_tinted
+ */
+void al_draw_bitmap_scaled_tinted(ALLEGRO_BITMAP *bitmap, float dx, float dy,
+   float xscale, float yscale, ALLEGRO_COLOR tint, int flags)
+{
+   ASSERT(bitmap);
+
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, tint,
+      0, 0, 0, xscale, yscale, 0, 0, bitmap->w, bitmap->h, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_stretched_tinted
+ */
+void al_draw_bitmap_stretched_tinted(ALLEGRO_BITMAP *bitmap, float dx, float dy,
+   float dw, float dh, ALLEGRO_COLOR tint, int flags)
+{
+   ASSERT(bitmap);
+
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, tint,
+      0, 0, 0, dw / bitmap->w, dh / bitmap->h,
+      0, 0, bitmap->w, bitmap->h, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_rotated_tinted
+ */
+void al_draw_bitmap_rotated_tinted(ALLEGRO_BITMAP *bitmap, float cx, float cy,
+   float dx, float dy, float angle, ALLEGRO_COLOR tint, int flags)
+{
+   ASSERT(bitmap);
+
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, tint,
+      cx, cy, angle, 1, 1, 0, 0, bitmap->w, bitmap->h, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_scaled_rotated_tinted
+ */
+void al_draw_bitmap_scaled_rotated_tinted(ALLEGRO_BITMAP *bitmap,
+   float cx, float cy, float dx, float dy, float xscale, float yscale,
+   float angle, ALLEGRO_COLOR tint, int flags)
+{
+   ASSERT(bitmap);
+
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, tint,
+      cx, cy, angle, xscale, yscale, 0, 0, bitmap->w, bitmap->h, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_stretched_rotated_tinted
+ */
+void al_draw_bitmap_stretched_rotated_tinted(ALLEGRO_BITMAP *bitmap,
+   float cx, float cy, float dx, float dy, float dw, float dh, float angle,
+   ALLEGRO_COLOR tint, int flags)
+{
+   ASSERT(bitmap);
+
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, tint,
+      cx, cy, angle, dw / bitmap->w, dh / bitmap->h,
+      0, 0, bitmap->w, bitmap->h, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_region_scaled
+ */
+void al_draw_bitmap_region_scaled(ALLEGRO_BITMAP *bitmap,
+   float sx, float sy, float sw, float sh,
+   float dx, float dy, float xscale, float yscale, int flags)
+{
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, solid_white,
+      0, 0, 0, xscale, yscale, sx, sy, sw, sh, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_region_stretched
+ */
+void al_draw_bitmap_region_stretched(ALLEGRO_BITMAP *bitmap,
+   float sx, float sy, float sw, float sh,
+   float dx, float dy, float dw, float dh, int flags)
+{
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, solid_white,
+      0, 0, 0, dw / sw, dh / sh, sx, sy, sw, sh, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_region_rotated
+ */
+void al_draw_bitmap_region_rotated(ALLEGRO_BITMAP *bitmap,
+   float sx, float sy, float sw, float sh, float cx, float cy,
+   float dx, float dy, float angle, int flags)
+{
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, solid_white,
+      cx, cy, angle, 1, 1, sx, sy, sw, sh, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_region_tinted
+ */
+void al_draw_bitmap_region_tinted(ALLEGRO_BITMAP *bitmap,
+   float sx, float sy, float sw, float sh, float dx, float dy,
+   ALLEGRO_COLOR tint, int flags)
+{
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, tint,
+      0, 0, 0, 1, 1, sx, sy, sw, sh, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_region_scaled_rotated
+ */
+void al_draw_bitmap_region_scaled_rotated(ALLEGRO_BITMAP *bitmap,
+   float sx, float sy, float sw, float sh, float cx, float cy,
+   float dx, float dy, float xscale, float yscale, float angle, int flags)
+{
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, solid_white,
+      cx, cy, angle, xscale, yscale, sx, sy, sw, sh, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_region_stretched_rotated
+ */
+void al_draw_bitmap_region_stretched_rotated(ALLEGRO_BITMAP *bitmap,
+   float sx, float sy, float sw, float sh, float cx, float cy,
+   float dx, float dy, float dw, float dh, float angle, int flags)
+{
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, solid_white,
+      cx, cy, angle, dw / sw, dh / sh, sx, sy, sw, sh, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_region_scaled_tinted
+ */
+void al_draw_bitmap_region_scaled_tinted(ALLEGRO_BITMAP *bitmap,
+   float sx, float sy, float sw, float sh, float dx, float dy,
+   float xscale, float yscale, ALLEGRO_COLOR tint, int flags)
+{
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, tint,
+      0, 0, 0, xscale, yscale, sx, sy, sw, sh, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_region_stretched_tinted
+ */
+void al_draw_bitmap_region_stretched_tinted(ALLEGRO_BITMAP *bitmap,
+   float sx, float sy, float sw, float sh, float dx, float dy,
+   float dw, float dh, ALLEGRO_COLOR tint, int flags)
+{
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, tint,
+      0, 0, 0, dw / sw, dh / sh, sx, sy, sw, sh, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_region_rotated_tinted
+ */
+void al_draw_bitmap_region_rotated_tinted(ALLEGRO_BITMAP *bitmap,
+   float sx, float sy, float sw, float sh, float cx, float cy,
+   float dx, float dy, float angle, ALLEGRO_COLOR tint, int flags)
+{
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, tint,
+      cx, cy, angle, 1, 1, sx, sy, sw, sh, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_region_scaled_rotated_tinted
+ */
+void al_draw_bitmap_region_scaled_rotated_tinted(ALLEGRO_BITMAP *bitmap,
+   float sx, float sy, float sw, float sh, float cx, float cy,
+   float dx, float dy, float xscale, float yscale, float angle,
+   ALLEGRO_COLOR tint, int flags)
+{
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, tint,
+      cx, cy, angle, xscale, yscale, sx, sy, sw, sh, dx, dy, flags);
+}
+
+
+/* Function: al_draw_bitmap_region_stretched_rotated_tinted
+ */
+void al_draw_bitmap_region_stretched_rotated_tinted(ALLEGRO_BITMAP *bitmap,
+   float sx, float sy, float sw, float sh, float cx, float cy,
+   float dx, float dy, float dw, float dh, float angle,
+   ALLEGRO_COLOR tint, int flags)
+{
+   _draw_tinted_rotated_scaled_bitmap_region(bitmap, tint,
+      cx, cy, angle, dw / sw, dh / sh, sx, sy, sw, sh, dx, dy, flags);
+}
+
 /* vim: set ts=8 sts=3 sw=3 et: */
-- 
2.17.1

