[AD] Patch for two new entries to GFX_VTABLE |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Hi!
Here's a patch that adds two new entries to GFX_VTABLE:
blit_between_formats(), for drivers that can do their own color conversion
(AllegroGL) and pivot_scaled_flip_sprite(), for drivers that can accelerate
these (and do the color conversion needed).
Hopefully, I didn't forget to change anything.
--
- Robert J Ohannessian
"Microsoft code is probably O(n^20)" (my CS prof)
http://pages.infinit.net/voidstar/
Index: include/allegro/gfx.h
===================================================================
RCS file: /cvsroot/alleg/allegro/include/allegro/gfx.h,v
retrieving revision 1.1
diff -u -b -r1.1 gfx.h
--- include/allegro/gfx.h 2001/11/06 16:06:47 1.1
+++ include/allegro/gfx.h 2001/11/08 03:57:26
@@ -169,8 +169,10 @@
AL_METHOD(void, blit_to_self_forward, (struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
AL_METHOD(void, blit_to_self_backward, (struct BITMAP *source, struct BITMAP
*dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
+ AL_METHOD(void, blit_between_formats, (struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
AL_METHOD(void, masked_blit, (struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
AL_METHOD(void, clear_to_color, (struct BITMAP *bitmap, int color));
+ AL_METHOD(void, pivot_scaled_sprite_flip, (struct BITMAP *dest, struct BITMAP *source, int x, int y, int center_x, int center_y, int angle, int scale, int v_flip));
AL_METHOD(void, draw_sprite_end, (void));
AL_METHOD(void, blit_end, (void));
} GFX_VTABLE;
Index: src/blit.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/blit.c,v
retrieving revision 1.9
diff -u -b -r1.9 blit.c
--- src/blit.c 2001/11/06 15:30:46 1.9
+++ src/blit.c 2001/11/08 03:57:29
@@ -785,9 +785,11 @@
{
BLIT_CLIP();
- if (!(is_video_bitmap(dest) && is_video_bitmap(src)) &&
- (src->vtable->color_depth != dest->vtable->color_depth)) {
+ if (src->vtable->color_depth != dest->vtable->color_depth) {
/* need to do a color conversion */
+ if (dest->vtable->blit_between_formats)
+ dest->vtable->blit_between_formats(src, dest, s_x, s_y, d_x, d_y, w, h);
+ else
blit_between_formats(src, dest, s_x, s_y, d_x, d_y, w, h);
}
else if (is_same_bitmap(src, dest)) {
Index: src/rotate.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/rotate.c,v
retrieving revision 1.9
diff -u -b -r1.9 rotate.c
--- src/rotate.c 2001/11/06 15:30:46 1.9
+++ src/rotate.c 2001/11/08 03:57:31
@@ -795,10 +795,15 @@
{
fixed xs[4], ys[4];
+ if (bmp->vtable->pivot_scaled_sprite_flip) {
+ bmp->vtable->pivot_scaled_sprite_flip(bmp, sprite, x, y, cx, cy, angle, scale, v_flip);
+ }
+ else {
_rotate_scale_flip_coordinates(sprite->w << 16, sprite->h << 16,
x, y, cx, cy, angle, scale, scale,
FALSE, v_flip, xs, ys);
_parallelogram_map_standard(bmp, sprite, xs, ys);
+ }
}
Index: src/vtable15.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/vtable15.c,v
retrieving revision 1.3
diff -u -b -r1.3 vtable15.c
--- src/vtable15.c 2001/11/06 15:30:46 1.3
+++ src/vtable15.c 2001/11/08 03:57:32
@@ -67,8 +67,10 @@
_linear_blit16,
_linear_blit16,
_linear_blit_backward16,
+ NULL, /* AL_METHOD(void, blit_between_formats, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height)) */
_linear_masked_blit16,
_linear_clear_to_color16,
+ NULL, /* AL_METHOD(void, pivot_scaled_sprite_flip(BITMAP *dest, BITMAP *source, fixed x, fixed y, fixed center_x, fixed center_y, fixed angle, fixed scale, int v_flip)) */
_linear_draw_sprite16_end,
_linear_blit16_end
};
Index: src/vtable16.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/vtable16.c,v
retrieving revision 1.3
diff -u -b -r1.3 vtable16.c
--- src/vtable16.c 2001/11/06 15:30:46 1.3
+++ src/vtable16.c 2001/11/08 03:57:32
@@ -67,8 +67,10 @@
_linear_blit16,
_linear_blit16,
_linear_blit_backward16,
+ NULL, /* AL_METHOD(void, blit_between_formats, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height)) */
_linear_masked_blit16,
_linear_clear_to_color16,
+ NULL, /* AL_METHOD(void, pivot_scaled_sprite_flip(BITMAP *dest, BITMAP *source, fixed x, fixed y, fixed center_x, fixed center_y, fixed angle, fixed scale, int v_flip)) */
_linear_draw_sprite16_end,
_linear_blit16_end
};
Index: src/vtable24.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/vtable24.c,v
retrieving revision 1.3
diff -u -b -r1.3 vtable24.c
--- src/vtable24.c 2001/11/06 15:30:46 1.3
+++ src/vtable24.c 2001/11/08 03:57:32
@@ -67,8 +67,10 @@
_linear_blit24,
_linear_blit24,
_linear_blit_backward24,
+ NULL, /* AL_METHOD(void, blit_between_formats, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height)) */
_linear_masked_blit24,
_linear_clear_to_color24,
+ NULL, /* AL_METHOD(void, pivot_scaled_sprite_flip(BITMAP *dest, BITMAP *source, fixed x, fixed y, fixed center_x, fixed center_y, fixed angle, fixed scale, int v_flip)) */
_linear_draw_sprite24_end,
_linear_blit24_end
};
Index: src/vtable32.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/vtable32.c,v
retrieving revision 1.3
diff -u -b -r1.3 vtable32.c
--- src/vtable32.c 2001/11/06 15:30:46 1.3
+++ src/vtable32.c 2001/11/08 03:57:32
@@ -67,8 +67,10 @@
_linear_blit32,
_linear_blit32,
_linear_blit_backward32,
+ NULL, /* AL_METHOD(void, blit_between_formats, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height)) */
_linear_masked_blit32,
_linear_clear_to_color32,
+ NULL, /* AL_METHOD(void, pivot_scaled_sprite_flip(BITMAP *dest, BITMAP *source, fixed x, fixed y, fixed center_x, fixed center_y, fixed angle, fixed scale, int v_flip)) */
_linear_draw_sprite32_end,
_linear_blit32_end
};
Index: src/vtable8.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/vtable8.c,v
retrieving revision 1.3
diff -u -b -r1.3 vtable8.c
--- src/vtable8.c 2001/11/06 15:30:46 1.3
+++ src/vtable8.c 2001/11/08 03:57:32
@@ -67,8 +67,10 @@
_linear_blit8,
_linear_blit8,
_linear_blit_backward8,
+ NULL, /* AL_METHOD(void, blit_between_formats, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height)) */
_linear_masked_blit8,
_linear_clear_to_color8,
+ NULL, /* AL_METHOD(void, pivot_scaled_sprite_flip(BITMAP *dest, BITMAP *source, fixed x, fixed y, fixed center_x, fixed center_y, fixed angle, fixed scale, int v_flip)) */
_linear_draw_sprite8_end,
_linear_blit8_end
};
Index: src/misc/modex.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/misc/modex.c,v
retrieving revision 1.18
diff -u -b -r1.18 modex.c
--- src/misc/modex.c 2001/11/06 17:16:40 1.18
+++ src/misc/modex.c 2001/11/08 03:57:36
@@ -83,8 +83,10 @@
_x_blit,
_x_blit_forward,
_x_blit_backward,
+ NULL, /* AL_METHOD(void, blit_between_formats, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height)) */
_x_masked_blit,
_x_clear_to_color,
+ NULL, /* AL_METHOD(void, pivot_scaled_sprite_flip(BITMAP *dest, BITMAP *source, fixed x, fixed y, fixed center_x, fixed center_y, fixed angle, fixed scale, int v_flip)) */
_x_draw_sprite_end,
_x_blit_from_memory_end
};