[AD] update bitmap drawing after addition of transformations

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


The attached patch removes the following four functions from the bitmap
interface. They are instead implemented with transformations.

vt->draw_bitmap 
vt->draw_scaled_bitmap
vt->draw_rotated_bitmap
vt->draw_rotated_scaled_bitmap

This simplifies the OpenGL and D3D drivers somewhat since they have
fewer functions to implement now. In practice both already cheated by
simply calling the same function from each vtable entry so it's not a
big gain.

The patch also removes the memory versions corresponding to those vtable
entries, using only transformed version instead. This simplifies the
higher level code a lot since with neither specialized vtable entries
not memory implementations the only remaining vtable entry and memory
function is:

vt->draw_bitmap_region

Likely in the case of the mem functions that means reduced performance -
so not sure if we should apply that latter part. This is what simplifies
the code most though so I think it would be worth it.

-- 
Elias Pschernig <elias.pschernig@xxxxxxxxxx>
diff --git a/include/allegro5/internal/aintern_bitmap.h b/include/allegro5/internal/aintern_bitmap.h
index a5bffef..8a61582 100644
--- a/include/allegro5/internal/aintern_bitmap.h
+++ b/include/allegro5/internal/aintern_bitmap.h
@@ -73,21 +73,11 @@ struct ALLEGRO_BITMAP
 struct ALLEGRO_BITMAP_INTERFACE
 {
    int id;
-   void (*draw_bitmap)(struct ALLEGRO_BITMAP *bitmap,
-      ALLEGRO_COLOR tint, float x, float y, int flags);
+
    void (*draw_bitmap_region)(ALLEGRO_BITMAP *bitmap,
       ALLEGRO_COLOR tint,float sx, float sy,
       float sw, float sh, float dx, float dy, int flags);
-   void (*draw_scaled_bitmap)(ALLEGRO_BITMAP *bitmap,
-      ALLEGRO_COLOR tint, float sx, float sy,
-      float sw, float sh, float dx, float dy, float dw, float dh, int flags);
-   void (*draw_rotated_bitmap)(ALLEGRO_BITMAP *bitmap,
-      ALLEGRO_COLOR tint, float cx, float cy,
-      float angle, float dx, float dy, int flags);
-   void (*draw_rotated_scaled_bitmap)(ALLEGRO_BITMAP *bitmap,
-      ALLEGRO_COLOR tint, float cx, float cy,
-      float angle, float dx, float dy, float xscale, float yscale,
-      int flags);
+
    /* After the memory-copy of the bitmap has been modified, need to call this
     * to update the display-specific copy. E.g. with an OpenGL driver, this
     * might create/update a texture. Returns false on failure.
@@ -131,37 +121,13 @@ void _al_draw_bitmap_region_memory(ALLEGRO_BITMAP *bitmap,
    ALLEGRO_COLOR tint,
    int sx, int sy, int sw, int sh,
    int dx, int dy, int flags);
-void _al_draw_bitmap_memory(ALLEGRO_BITMAP *bitmap,
-   ALLEGRO_COLOR tint,
-   int dx, int dy, int flags);
-void _al_draw_scaled_bitmap_memory(ALLEGRO_BITMAP *bitmap,
-   ALLEGRO_COLOR tint,
-   int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int flags);
-void _al_draw_rotated_bitmap_memory(ALLEGRO_BITMAP *bitmap,
-   ALLEGRO_COLOR tint,
-   int center_x, int center_y, int dx, int dy, float angle, int flags);
-void _al_draw_rotated_bitmap_memory(ALLEGRO_BITMAP *bitmap,
-   ALLEGRO_COLOR tint,
-   int center_x, int center_y, int dx, int dy,
-   float angle, int flags);
-void _al_draw_rotated_scaled_bitmap_memory(ALLEGRO_BITMAP *bitmap,
-   ALLEGRO_COLOR tint,
-   int center_x, int center_y, int dx, int dy,
-   float xscale, float yscale, float angle, int flags);
 
 void _al_draw_bitmap_region_memory_fast(ALLEGRO_BITMAP *bitmap,
    int sx, int sy, int sw, int sh,
    int dx, int dy, int flags);
+
 void _al_draw_bitmap_memory_fast(ALLEGRO_BITMAP *bitmap,
   int dx, int dy, int flags);
-void _al_draw_scaled_bitmap_memory_fast(ALLEGRO_BITMAP *bitmap,
-   int sx, int sy, int sw, int sh,
-   int dx, int dy, int dw, int dh, int flags);
-void _al_draw_rotated_scaled_bitmap_memory_fast(ALLEGRO_BITMAP *bitmap,
-   int cx, int cy, int dx, int dy, float xscale, float yscale,
-   float angle, int flags);
-void _al_draw_rotated_bitmap_memory_fast(ALLEGRO_BITMAP *bitmap,
-   int cx, int cy, int dx, int dy, float angle, int flags);
 
 
 /* For blending memory bitmaps */
diff --git a/src/bitmap.c b/src/bitmap.c
index ecc3b0e..e034149 100644
--- a/src/bitmap.c
+++ b/src/bitmap.c
@@ -180,31 +180,8 @@ void al_destroy_bitmap(ALLEGRO_BITMAP *bitmap)
 void al_draw_tinted_bitmap(ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR tint,
    float dx, float dy, int flags)
 {
-   ALLEGRO_BITMAP *dest = al_get_target_bitmap();
-   ALLEGRO_DISPLAY *display = dest->display;
-   
-   /* If destination is memory, do a memory bitmap */
-   if (dest->flags & ALLEGRO_MEMORY_BITMAP) {
-      _al_draw_bitmap_memory(bitmap, tint, dx, dy, flags);
-   }
-   else {
-      /* if source is memory or incompatible */
-      if ((bitmap->flags & ALLEGRO_MEMORY_BITMAP) ||
-          (!al_is_compatible_bitmap(bitmap)))
-      {
-         if (display && display->vt->draw_memory_bitmap_region) {
-            display->vt->draw_memory_bitmap_region(display, bitmap,
-               0, 0, bitmap->w, bitmap->h, dx, dy, flags);
-         }
-         else {
-            _al_draw_bitmap_memory(bitmap, tint, dx, dy, flags);
-         }
-      }
-      else {
-         /* Compatible display bitmap, use full acceleration */
-         bitmap->vt->draw_bitmap(bitmap, tint, dx, dy, flags);
-      }
-   }
+   al_draw_tinted_bitmap_region(bitmap, tint, 0, 0,
+      bitmap->w, bitmap->h, dx, dy, flags);
 }
 
 
@@ -251,6 +228,40 @@ void al_draw_tinted_bitmap_region(ALLEGRO_BITMAP *bitmap,
    }
 }
 
+void al_draw_tinted_rotated_scaled_bitmap_region(ALLEGRO_BITMAP *bitmap,
+   ALLEGRO_COLOR tint, float cx, float cy, float angle,
+   float xscale, float yscale,
+   float sx, float sy, float sw, float sh, float dx, float dy, int flags)
+{
+   ALLEGRO_TRANSFORM backup;
+	ALLEGRO_TRANSFORM t;
+   al_copy_transform(&backup, al_get_current_transform());
+	al_copy_transform(&t, &backup);
+
+   if (flags & ALLEGRO_FLIP_HORIZONTAL)
+	{
+      al_translate_transform(&t, sw, 0);
+      al_scale_transform(&t, -1, 1);
+      flags &= ~ALLEGRO_FLIP_HORIZONTAL;
+	}
+
+   if (flags & ALLEGRO_FLIP_VERTICAL)
+	{
+      al_translate_transform(&t, 0, sh);
+      al_scale_transform(&t, 1, -1);
+      flags &= ~ALLEGRO_FLIP_VERTICAL;
+	}
+
+	al_translate_transform(&t, -cx, -cy);
+   al_scale_transform(&t, xscale, yscale);
+	al_rotate_transform(&t, angle);
+   al_translate_transform(&t, dx, dy);
+
+	al_use_transform(&t);
+   al_draw_tinted_bitmap_region(bitmap, tint, sx, sy, sw, sh, 0, 0, flags);
+	al_use_transform(&backup);
+}
+
 
 /* Function: al_draw_bitmap_region
  */
@@ -269,21 +280,10 @@ void al_draw_tinted_scaled_bitmap(ALLEGRO_BITMAP *bitmap,
    float sx, float sy, float sw, float sh,
    float dx, float dy, float dw, float dh, int flags)
 {
-   ALLEGRO_BITMAP *dest = al_get_target_bitmap();
-   ALLEGRO_BITMAP *back = al_get_backbuffer(al_get_current_display());
-
-   if ((bitmap->flags & ALLEGRO_MEMORY_BITMAP) ||
-       (dest->flags & ALLEGRO_MEMORY_BITMAP) ||
-       (!al_is_compatible_bitmap(bitmap)) ||
-       (bitmap == back) || (bitmap->parent == back))
-   {
-      _al_draw_scaled_bitmap_memory(bitmap, tint, sx, sy, sw, sh,
-         dx, dy, dw, dh, flags);
-   }
-   else {
-      bitmap->vt->draw_scaled_bitmap(bitmap, tint, sx, sy, sw, sh,
-         dx, dy, dw, dh, flags);
-   }
+   al_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_scaled_bitmap
@@ -307,22 +307,8 @@ void al_draw_tinted_rotated_bitmap(ALLEGRO_BITMAP *bitmap,
    ALLEGRO_COLOR tint,
    float cx, float cy, float dx, float dy, float angle, int flags)
 {
-   ALLEGRO_BITMAP *dest = al_get_target_bitmap();
-   ALLEGRO_BITMAP *back = al_get_backbuffer(al_get_current_display());
-
-   /* If one is a memory bitmap, do memory blit */
-   if ((bitmap->flags & ALLEGRO_MEMORY_BITMAP) ||
-       (dest->flags & ALLEGRO_MEMORY_BITMAP) ||
-       (!al_is_compatible_bitmap(bitmap)) ||
-       (bitmap == back) || (bitmap->parent == back))
-   {
-      _al_draw_rotated_bitmap_memory(bitmap, tint, cx, cy,
-         dx, dy, angle, flags);
-   }
-   else {
-      bitmap->vt->draw_rotated_bitmap(bitmap, tint, cx, cy, dx, dy,
-         angle, flags);
-   }
+   al_draw_tinted_rotated_scaled_bitmap(bitmap, tint, cx, cy, dx, dy,
+      1, 1, angle, flags);
 }
 
 /* Function: al_draw_rotated_bitmap
@@ -342,22 +328,10 @@ void al_draw_tinted_rotated_scaled_bitmap(ALLEGRO_BITMAP *bitmap,
    float cx, float cy, float dx, float dy, float xscale, float yscale,
    float angle, int flags)
 {
-   ALLEGRO_BITMAP *dest = al_get_target_bitmap();
-   ALLEGRO_BITMAP *back = al_get_backbuffer(al_get_current_display());
-
-   /* If one is a memory bitmap, do memory blit */
-    if ((bitmap->flags & ALLEGRO_MEMORY_BITMAP) ||
-       (dest->flags & ALLEGRO_MEMORY_BITMAP) ||
-       (!al_is_compatible_bitmap(bitmap)) ||
-       (bitmap == back) || (bitmap->parent == back))
-   {
-      _al_draw_rotated_scaled_bitmap_memory(bitmap, tint, cx, cy,
-         dx, dy, xscale, yscale, angle, flags);
-   }
-   else {
-      bitmap->vt->draw_rotated_scaled_bitmap(bitmap, tint, cx, cy,
-         dx, dy, xscale, yscale, angle, flags);
-   }
+    al_draw_tinted_rotated_scaled_bitmap_region(bitmap, tint,
+      cx, cy, angle,
+      xscale, yscale,
+      0, 0, bitmap->w, bitmap->h, dx, dy, flags);
 }
 
 
diff --git a/src/memblit.c b/src/memblit.c
index b1e59ea..b29f3f5 100644
--- a/src/memblit.c
+++ b/src/memblit.c
@@ -26,11 +26,6 @@
 #define MIN _ALLEGRO_MIN
 #define MAX _ALLEGRO_MAX
 
-static void _al_draw_transformed_rotated_bitmap_memory(
-   ALLEGRO_BITMAP *src, ALLEGRO_COLOR tint,
-   int cx, int cy, int dx, int dy, float xscale, float yscale,
-   float angle, int flags);
-
 static void _al_draw_transformed_scaled_bitmap_memory(
    ALLEGRO_BITMAP *src, ALLEGRO_COLOR tint,
    int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh,
@@ -481,159 +476,6 @@ void _al_draw_bitmap_region_memory(ALLEGRO_BITMAP *src,
    al_unlock_bitmap(dest);
 }
 
-
-
-void _al_draw_bitmap_memory(ALLEGRO_BITMAP *bitmap,
-   ALLEGRO_COLOR tint, int dx, int dy, int flags)
-{
-   _al_draw_bitmap_region_memory(bitmap, tint, 0, 0,
-      bitmap->w, bitmap->h, dx, dy, flags);
-}
-
-void _al_draw_scaled_bitmap_memory(ALLEGRO_BITMAP *src,
-   ALLEGRO_COLOR tint,
-   int sx, int sy, int sw, int sh,
-   int dx, int dy, int dw, int dh, int flags)
-{
-   ALLEGRO_BITMAP *dest = al_get_target_bitmap();
-   ALLEGRO_LOCKED_REGION *src_region;
-   ALLEGRO_LOCKED_REGION *dst_region;
-   int op, src_mode, dst_mode;
-   int op_alpha, src_alpha, dst_alpha;
-
-   float sxinc;
-   float syinc;
-   float _sx;
-   float _sy;
-   float dxinc;
-   float dyinc;
-   float _dy;
-   int x, y;
-   int xend;
-   int yend;
-
-   if(!is_identity(al_get_current_transform()))
-   {
-      _al_draw_transformed_scaled_bitmap_memory(src, tint, sx, sy,
-         sw, sh, dx, dy, dw, dh, flags);
-      return;
-   }
-
-   al_get_separate_blender(&op, &src_mode, &dst_mode,
-      &op_alpha, &src_alpha, &dst_alpha);
-
-   if (DEST_IS_ZERO && SRC_NOT_MODIFIED) {
-      _al_draw_scaled_bitmap_memory_fast(src,
-            sx, sy, sw, sh, dx, dy, dw, dh, flags);
-      return;
-   }
-
-   if ((sw <= 0) || (sh <= 0))
-      return;
-
-   /* This must be calculated before clipping dw, dh. */
-   sxinc = fabs((float)sw / dw);
-   syinc = fabs((float)sh / dh);
-
-   CLIPPER(src, sx, sy, sw, sh, dest, dx, dy, dw, dh, sxinc, syinc, flags)
-
-   if (!(src_region = al_lock_bitmap(src, ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_READONLY))) {
-      return;
-   }
-   /* XXX we should be able to lock less of the destination */
-   if (!(dst_region = al_lock_bitmap(dest, ALLEGRO_PIXEL_FORMAT_ANY, 0))) {
-      al_unlock_bitmap(src);
-      return;
-   }
-
-   dxinc = dw < 0 ? -1 : 1;
-   dyinc = dh < 0 ? -1 : 1;
-   xend = abs(dw);
-   yend = abs(dh);
-
-   if (flags & ALLEGRO_FLIP_HORIZONTAL) {
-      sxinc = -sxinc;
-      sx = sx + sw - 1;
-   }
-
-   if (flags & ALLEGRO_FLIP_VERTICAL) {
-      syinc = -syinc;
-      _sy = sy + sh - 1;
-   }
-   else {
-      _sy = sy;
-   }
-
-   _dy = dy;
-
-   {
-      const int src_size = al_get_pixel_size(src->format);
-      const int dst_size = al_get_pixel_size(dest->format);
-      const int dst_inc = dst_size * (int)dxinc;
-
-      ALLEGRO_COLOR src_color = {0, 0, 0, 0};   /* avoid bogus warnings */
-      ALLEGRO_COLOR dst_color = {0, 0, 0, 0};
-
-      for (y = 0; y < yend; y++) {
-         const char *src_row =
-            (((char *) src->locked_region.data)
-             + _al_fast_float_to_int(_sy) * src->locked_region.pitch);
-
-         char *dst_data =
-            (((char *) dest->locked_region.data)
-             + _al_fast_float_to_int(_dy) * dest->locked_region.pitch
-             + dst_size * dx);
-
-         ALLEGRO_COLOR result;
-
-         _sx = sx;
-
-         if (DEST_IS_ZERO) {
-            for (x = 0; x < xend; x++) {
-               const char *src_data = src_row
-                  + src_size * _al_fast_float_to_int(_sx);
-               _AL_INLINE_GET_PIXEL(src->format, src_data, src_color, false);
-               src_color.r *= tint.r;
-               src_color.g *= tint.g;
-               src_color.b *= tint.b;
-               src_color.a *= tint.a;
-               _al_blend_inline_dest_zero_add(&src_color, src_mode, src_alpha,
-                  &result);
-               _AL_INLINE_PUT_PIXEL(dest->format, dst_data, result, false);
-
-               _sx += sxinc;
-               dst_data += dst_inc;
-            }
-         }
-         else {
-            for (x = 0; x < xend; x++) {
-               const char * src_data = src_row
-                  + src_size * _al_fast_float_to_int(_sx);
-               _AL_INLINE_GET_PIXEL(src->format, src_data, src_color, false);
-               _AL_INLINE_GET_PIXEL(dest->format, dst_data, dst_color, false);
-               src_color.r *= tint.r;
-               src_color.g *= tint.g;
-               src_color.b *= tint.b;
-               src_color.a *= tint.a;
-               _al_blend_inline(&src_color, &dst_color,
-                  op, src_mode, dst_mode, op_alpha, src_alpha, dst_alpha, &result);
-               _AL_INLINE_PUT_PIXEL(dest->format, dst_data, result, false);
-
-               _sx += sxinc;
-               dst_data += dst_inc;
-            }
-         }
-
-         _sy += syinc;
-         _dy += dyinc;
-      }
-   }
-
-   al_unlock_bitmap(src);
-   al_unlock_bitmap(dest);
-}
-
-
 /*
 * Get scanline starts, ends and deltas, and clipping coordinates.
 */
@@ -1183,52 +1025,6 @@ do {                                                                         \
 } while (0)
 
 
-void _al_draw_rotated_scaled_bitmap_memory(ALLEGRO_BITMAP *src,
-   ALLEGRO_COLOR tint,
-   int cx, int cy, int dx, int dy, float xscale, float yscale,
-   float angle, int flags)
-{
-   ALLEGRO_BITMAP *dst = al_get_target_bitmap();
-   int op, src_mode, dst_mode;
-   int op_alpha, src_alpha, dst_alpha;
-
-   if(!is_identity(al_get_current_transform()))
-   {
-      _al_draw_transformed_rotated_bitmap_memory(src, tint,
-         cx, cy, dx, dy, xscale, yscale, angle,
-          flags);
-      return;
-   }
-
-   al_get_separate_blender(&op, &src_mode, &dst_mode,
-      &op_alpha, &src_alpha, &dst_alpha);
-
-   if (src_mode == ALLEGRO_ONE && dst_mode == ALLEGRO_ZERO &&
-      tint.r == 1.0f && tint.g == 1.0f && tint.b == 1.0f && tint.a == 1.0f &&
-      (src->format == dst->format)) {
-      _al_draw_rotated_scaled_bitmap_memory_fast(src,
-         cx, cy, dx, dy, xscale, yscale, angle, flags);
-      return;
-   }
-
-   angle = -angle;
-
-   ASSERT(_al_pixel_format_is_real(src->format));
-   ASSERT(_al_pixel_format_is_real(dst->format));
-
-   DO_DRAW_ROTATED_SCALED(src, dst,
-      cx, cy, dx, dy, xscale, yscale, -angle, flags);
-}
-
-
-void _al_draw_rotated_bitmap_memory(ALLEGRO_BITMAP *src,
-   ALLEGRO_COLOR tint,
-   int cx, int cy, int dx, int dy, float angle, int flags)
-{
-   _al_draw_rotated_scaled_bitmap_memory(src, tint,
-      cx, cy, dx, dy, 1.0f, 1.0f, angle, flags);
-}
-
 static void _al_draw_transformed_bitmap_memory(ALLEGRO_BITMAP *src,
    ALLEGRO_COLOR tint,
    int sx, int sy, int sw, int sh, int dw, int dh,
@@ -1303,28 +1099,6 @@ static void _al_draw_transformed_bitmap_memory(ALLEGRO_BITMAP *src,
    DO_PARALLELOGRAM_MAP(true, flags);
 }
 
-static void _al_draw_transformed_rotated_bitmap_memory(
-   ALLEGRO_BITMAP *src, ALLEGRO_COLOR tint,
-   int cx, int cy, int dx, int dy, float xscale, float yscale,
-   float angle, int flags)
-{
-   ALLEGRO_TRANSFORM local_trans;
-   int w, h;
-
-   al_identity_transform(&local_trans);
-   al_translate_transform(&local_trans, -cx, -cy);
-   al_scale_transform(&local_trans, xscale, yscale);
-   al_rotate_transform(&local_trans, angle);
-   al_translate_transform(&local_trans, dx, dy);
-   al_compose_transform(&local_trans, al_get_current_transform());
-
-   w = al_get_bitmap_width(src);
-   h = al_get_bitmap_height(src);
-
-   _al_draw_transformed_bitmap_memory(src, tint, 0, 0, w, h, w, h,
-      &local_trans, flags);
-}
-
 static void _al_draw_transformed_scaled_bitmap_memory(
    ALLEGRO_BITMAP *src, ALLEGRO_COLOR tint,
    int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int flags)
@@ -1439,114 +1213,6 @@ void _al_draw_bitmap_region_memory_fast(ALLEGRO_BITMAP *bitmap,
 }
 
 
-void _al_draw_scaled_bitmap_memory_fast(ALLEGRO_BITMAP *src,
-   int sx, int sy, int sw, int sh,
-   int dx, int dy, int dw, int dh, int flags)
-{
-   ALLEGRO_BITMAP *dest = al_get_target_bitmap();
-   ALLEGRO_LOCKED_REGION *src_region;
-   ALLEGRO_LOCKED_REGION *dst_region;
-
-   float sxinc;
-   float syinc;
-   float _sx;
-   float _sy;
-   float dxinc;
-   float dyinc;
-   float _dx;
-   float _dy;
-   int x, y;
-   int xend;
-   int yend;
-   int size;
-
-   if ((sw <= 0) || (sh <= 0))
-      return;
-
-   /* This must be calculated before clipping dw, dh. */
-   sxinc = fabs((float)sw / dw);
-   syinc = fabs((float)sh / dh);
-
-   CLIPPER(src, sx, sy, sw, sh, dest, dx, dy, dw, dh, sxinc, syinc, flags)
-
-   if (src->format == dest->format) {
-      if (!(src_region = al_lock_bitmap(src, ALLEGRO_PIXEL_FORMAT_ANY,
-            ALLEGRO_LOCK_READONLY))) {
-         return;
-      }
-      /* XXX we should be able to lock less of the destination and use
-       * ALLEGRO_LOCK_WRITEONLY
-       */
-      if (!(dst_region = al_lock_bitmap(dest, ALLEGRO_PIXEL_FORMAT_ANY, 0))) {
-         al_unlock_bitmap(src);
-         return;
-      }
-      size = al_get_pixel_size(src->format);
-   }
-   else {
-      if (!(src_region = al_lock_bitmap(src, ALLEGRO_PIXEL_FORMAT_ARGB_8888,
-            ALLEGRO_LOCK_READONLY))) {
-         return;
-      }
-      /* XXX we should be able to lock less of the destination and use
-       * ALLEGRO_LOCK_WRITEONLY
-       */
-      if (!(dst_region = al_lock_bitmap(dest, ALLEGRO_PIXEL_FORMAT_ARGB_8888, 0))) {
-         al_unlock_bitmap(src);
-         return;
-      }
-      size = 4;
-   }
-
-   dxinc = dw < 0 ? -1 : 1;
-   dyinc = dh < 0 ? -1 : 1;
-   xend = abs(dw);
-   yend = abs(dh);
-
-   if (flags & ALLEGRO_FLIP_HORIZONTAL) {
-      sxinc = -sxinc;
-      sx = sx + sw - 1;
-   }
-
-   if (flags & ALLEGRO_FLIP_VERTICAL) {
-      syinc = -syinc;
-      _sy = sy + sh - 1;
-   }
-   else {
-      _sy = sy;
-   }
-
-   #define INNER(t, s, r, w) \
-      for (x = 0; x < xend; x++) { \
-         t pix = r((char *)src_region->data+(int)_sy*src_region->pitch+(int)_sx*s); \
-         w((char *)dst_region->data+(int)_dy*dst_region->pitch+(int)_dx*s, pix); \
-	_sx += sxinc; \
-	_dx += dxinc; \
-      } \
-
-   _dy = dy;
-   for (y = 0; y < yend; y++) {
-      _sx = sx;
-      _dx = dx;
-      switch (size) {
-         case 2:
-            INNER(uint16_t, size, bmp_read16, bmp_write16)
-            break;
-         case 3:
-            INNER(uint32_t, size, READ3BYTES, WRITE3BYTES)
-            break;
-         default:
-            INNER(uint32_t, size, bmp_read32, bmp_write32)
-            break;
-      }
-      _sy += syinc;
-      _dy += dyinc;
-   }
-
-   al_unlock_bitmap(src);
-   al_unlock_bitmap(dest);
-}
-
 /*
 * Get scanline starts, ends and deltas, and clipping coordinates.
 */
@@ -2040,34 +1706,4 @@ static void _al_parallelogram_map_fast(ALLEGRO_BITMAP *src, al_fixed xs[4],
    al_unlock_bitmap(dst);
 }
 
-void _al_draw_rotated_scaled_bitmap_memory_fast(ALLEGRO_BITMAP *src,
-   int cx, int cy, int dx, int dy, float xscale, float yscale,
-   float angle, int flags)
-{
-   al_fixed xs[4], ys[4];
-   al_fixed fix_dx;
-   al_fixed fix_dy;
-   al_fixed fix_cx;
-   al_fixed fix_cy;
-   al_fixed fix_angle;
-   al_fixed fix_xscale;
-   al_fixed fix_yscale;
-
-   angle = -angle;
-
-   fix_dx = al_ftofix(dx);
-   fix_dy = al_ftofix(dy);
-   fix_cx = al_ftofix(cx);
-   fix_cy = al_ftofix(cy);
-   fix_angle = al_ftofix(-angle*256/(ALLEGRO_PI*2));
-   fix_xscale = al_ftofix(xscale);
-   fix_yscale = al_ftofix(yscale);
-
-   _al_rotate_scale_flip_coordinates(src->w << 16, src->h << 16,
-      fix_dx, fix_dy, fix_cx, fix_cy, fix_angle, fix_xscale, fix_yscale,
-      flags & ALLEGRO_FLIP_HORIZONTAL, flags & ALLEGRO_FLIP_VERTICAL, xs, ys);
-
-   _al_parallelogram_map_fast(src, xs, ys, 0, 0, src->w, src->h);
-}
-
 /* vim: set sts=3 sw=3 et: */
diff --git a/src/opengl/ogl_bitmap.c b/src/opengl/ogl_bitmap.c
index 1ea1f8c..c55b5a8 100644
--- a/src/opengl/ogl_bitmap.c
+++ b/src/opengl/ogl_bitmap.c
@@ -354,33 +354,6 @@ static void draw_quad(ALLEGRO_BITMAP *bitmap,
 #undef SWAP
 
 
-
-static void ogl_draw_scaled_bitmap(ALLEGRO_BITMAP *bitmap,
-   ALLEGRO_COLOR tint, float sx, float sy,
-   float sw, float sh, float dx, float dy, float dw, float dh, int flags)
-{
-   // FIXME: hack
-   // FIXME: need format conversion if they don't match
-   ALLEGRO_BITMAP *target = al_get_target_bitmap();
-   ALLEGRO_BITMAP_OGL *ogl_target = (ALLEGRO_BITMAP_OGL *)target;
-   ALLEGRO_DISPLAY *disp = al_get_current_display();
-   
-   if (target->parent) {
-      ogl_target = (ALLEGRO_BITMAP_OGL *)target->parent;
-   }
-      
-   if (disp->ogl_extras->opengl_target != ogl_target ||
-         !setup_blending(disp) || target->locked) {
-      _al_draw_scaled_bitmap_memory(bitmap, tint, sx, sy, sw, sh,
-         dx, dy, dw, dh, flags);
-      return;
-   }
-
-   draw_quad(bitmap, tint, sx, sy, sw, sh, 0, 0, dx, dy, dw, dh, 1, 1, 0, flags);
-}
-
-
-
 static void ogl_draw_bitmap_region(ALLEGRO_BITMAP *bitmap,
    ALLEGRO_COLOR tint, float sx, float sy,
    float sw, float sh, float dx, float dy, int flags)
@@ -483,71 +456,6 @@ static void ogl_draw_bitmap_region(ALLEGRO_BITMAP *bitmap,
 }
 
 
-
-/* Draw the bitmap at the specified position. */
-static void ogl_draw_bitmap(ALLEGRO_BITMAP *bitmap,
-   ALLEGRO_COLOR tint, float x, float y,
-   int flags)
-{
-   ogl_draw_bitmap_region(bitmap, tint, 0, 0, bitmap->w, bitmap->h, x, y, flags);
-}
-
-
-
-static void ogl_draw_rotated_bitmap(ALLEGRO_BITMAP *bitmap,
-   ALLEGRO_COLOR tint, float cx, float cy,
-   float dx, float dy, float angle, int flags)
-{
-   // FIXME: hack
-   // FIXME: need format conversion if they don't match
-   ALLEGRO_BITMAP *target = al_get_target_bitmap();
-   ALLEGRO_BITMAP_OGL *ogl_target = (ALLEGRO_BITMAP_OGL *)target;
-   ALLEGRO_DISPLAY *disp = target->display;
-   
-   if (target->parent) {
-       ogl_target = (ALLEGRO_BITMAP_OGL *)target->parent;
-   }
-   
-   if (disp->ogl_extras->opengl_target != ogl_target ||
-      !setup_blending(disp) || target->locked) {
-      _al_draw_rotated_bitmap_memory(bitmap, tint, cx, cy, dx, dy, angle, flags);
-      return;
-   }
-
-   draw_quad(bitmap, tint, 0, 0, bitmap->w, bitmap->h, cx, cy,
-      dx, dy, bitmap->w, bitmap->h, 1, 1, angle, flags);
-}
-
-
-
-static void ogl_draw_rotated_scaled_bitmap(ALLEGRO_BITMAP *bitmap,
-   ALLEGRO_COLOR tint, 
-   float cx, float cy, float dx, float dy, float xscale, float yscale,
-   float angle, int flags)
-{
-   // FIXME: hack
-   // FIXME: need format conversion if they don't match
-   ALLEGRO_BITMAP *target = al_get_target_bitmap();
-   ALLEGRO_BITMAP_OGL *ogl_target = (ALLEGRO_BITMAP_OGL *)target;
-   ALLEGRO_DISPLAY *disp = target->display;
-   
-   if (target->parent) {
-       ogl_target = (ALLEGRO_BITMAP_OGL *)target->parent;
-   }
-   
-   if (disp->ogl_extras->opengl_target != ogl_target ||
-      !setup_blending(disp) || target->locked) {
-      _al_draw_rotated_scaled_bitmap_memory(bitmap, tint, cx, cy,
-         dx, dy, xscale, yscale, angle, flags);
-      return;
-   }
-
-   draw_quad(bitmap, tint, 0, 0, bitmap->w, bitmap->h, cx, cy, dx, dy,
-      bitmap->w, bitmap->h, xscale, yscale, angle, flags);
-}
-
-
-
 /* Helper to get smallest fitting power of two. */
 static int pot(int x)
 {
@@ -557,7 +465,6 @@ static int pot(int x)
 }
 
 
-
 // FIXME: need to do all the logic AllegroGL does, checking extensions,
 // proxy textures, formats, limits ...
 static bool ogl_upload_bitmap(ALLEGRO_BITMAP *bitmap)
@@ -1026,11 +933,7 @@ static ALLEGRO_BITMAP_INTERFACE *ogl_bitmap_driver(void)
    glbmp_vt = al_malloc(sizeof *glbmp_vt);
    memset(glbmp_vt, 0, sizeof *glbmp_vt);
 
-   glbmp_vt->draw_bitmap = ogl_draw_bitmap;
    glbmp_vt->draw_bitmap_region = ogl_draw_bitmap_region;
-   glbmp_vt->draw_scaled_bitmap = ogl_draw_scaled_bitmap;
-   glbmp_vt->draw_rotated_bitmap = ogl_draw_rotated_bitmap;
-   glbmp_vt->draw_rotated_scaled_bitmap = ogl_draw_rotated_scaled_bitmap;
    glbmp_vt->upload_bitmap = ogl_upload_bitmap;
    glbmp_vt->update_clipping_rectangle = ogl_update_clipping_rectangle;
    glbmp_vt->destroy_bitmap = ogl_destroy_bitmap;
diff --git a/src/win/d3d_bmp.cpp b/src/win/d3d_bmp.cpp
index 9adc62c..892e59c 100644
--- a/src/win/d3d_bmp.cpp
+++ b/src/win/d3d_bmp.cpp
@@ -794,21 +794,6 @@ static void d3d_blit_real(ALLEGRO_BITMAP *src,
 
 /* Blitting functions */
 
-static void d3d_draw_bitmap(ALLEGRO_BITMAP *bitmap,
-   ALLEGRO_COLOR tint,
-   float dx, float dy, int flags)
-{
-   if (!_al_d3d_render_to_texture_supported() || !_al_d3d_supports_separate_alpha_blend(al_get_current_display())) {
-      _al_draw_bitmap_memory(bitmap, tint, (int) dx, (int) dy, flags);
-      return;
-   }
-
-   d3d_blit_real(bitmap, tint, 0, 0, bitmap->w, bitmap->h,
-      bitmap->w/2, bitmap->h/2,
-      dx, dy, bitmap->w, bitmap->h,
-      0.0f, flags, false);
-}
-
 static void d3d_draw_bitmap_region(ALLEGRO_BITMAP *bitmap,
    ALLEGRO_COLOR tint,
    float sx, float sy, float sw, float sh, float dx, float dy, int flags)
@@ -827,60 +812,6 @@ static void d3d_draw_bitmap_region(ALLEGRO_BITMAP *bitmap,
       0.0f, flags, false);
 }
 
-static void d3d_draw_scaled_bitmap(ALLEGRO_BITMAP *bitmap,
-   ALLEGRO_COLOR tint, float sx, float sy,
-   float sw, float sh, float dx, float dy, float dw, float dh, int flags)
-{
-   if (!_al_d3d_render_to_texture_supported() || !_al_d3d_supports_separate_alpha_blend(al_get_current_display())) {
-      _al_draw_scaled_bitmap_memory(bitmap, tint,
-         (int) sx, (int) sy, (int) sw, (int) sh,
-         (int) dx, (int) dy, (int) dw, (int) dh, flags);
-      return;
-   }
-
-   d3d_blit_real(bitmap, tint,
-      sx, sy, sw, sh, (sw-sx)/2, (sh-sy)/2,
-      dx, dy, dw, dh, 0.0f,
-      flags, false);
-}
-
-static void d3d_draw_rotated_bitmap(ALLEGRO_BITMAP *bitmap,
-   ALLEGRO_COLOR tint,
-   float cx, float cy,
-   float dx, float dy, float angle, int flags)
-{
-   if (!_al_d3d_render_to_texture_supported() || !_al_d3d_supports_separate_alpha_blend(al_get_current_display())) {
-      _al_draw_rotated_bitmap_memory(bitmap, tint, (int) cx, (int) cy,
-         (int) dx, (int) dy, angle, flags);
-      return;
-   }
-
-   d3d_blit_real(bitmap, tint,
-      0, 0, bitmap->w, bitmap->h,
-      cx, cy,
-      dx, dy, bitmap->w, bitmap->h,
-      angle, flags, true);
-}
-
-static void d3d_draw_rotated_scaled_bitmap(ALLEGRO_BITMAP *bitmap,
-   ALLEGRO_COLOR tint, float cx, float cy,
-   float dx, float dy, float xscale, float yscale, float angle,
-   int flags)
-{
-   if (!_al_d3d_render_to_texture_supported() || !_al_d3d_supports_separate_alpha_blend(al_get_current_display())) {
-      _al_draw_rotated_scaled_bitmap_memory(bitmap, tint,
-         (int) cx, (int) cy,
-         (int) dx, (int) dy, xscale, yscale, angle, flags);
-      return;
-   }
-
-   d3d_blit_real(bitmap, tint,
-      0, 0, bitmap->w, bitmap->h,
-      cx, cy,
-      dx, dy, bitmap->w*xscale, bitmap->h*yscale,
-      angle, flags, true);
-}
-
 static void d3d_destroy_bitmap(ALLEGRO_BITMAP *bitmap)
 {
    ALLEGRO_BITMAP_D3D *d3d_bmp = (ALLEGRO_BITMAP_D3D *)bitmap;
@@ -1025,11 +956,7 @@ ALLEGRO_BITMAP_INTERFACE *_al_bitmap_d3d_driver(void)
    vt = (ALLEGRO_BITMAP_INTERFACE *)al_malloc(sizeof *vt);
    memset(vt, 0, sizeof *vt);
 
-   vt->draw_bitmap = d3d_draw_bitmap;
    vt->draw_bitmap_region = d3d_draw_bitmap_region;
-   vt->draw_scaled_bitmap = d3d_draw_scaled_bitmap;
-   vt->draw_rotated_bitmap = d3d_draw_rotated_bitmap;
-   vt->draw_rotated_scaled_bitmap = d3d_draw_rotated_scaled_bitmap;
    vt->upload_bitmap = d3d_upload_bitmap;
    vt->update_clipping_rectangle = NULL;
    vt->destroy_bitmap = d3d_destroy_bitmap;


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