From 1308c8ee4d410c26fd2391496761742bf300bfbe Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Sat, 25 Oct 2003 01:44:23 +0000 Subject: [PATCH] use gr_linear_rep_movsd_2x instead of almost identical gr_linear_movsd_double. Better since we have assembly versions. --- 2d/bitblt.c | 17 ++++++++--------- 2d/ibitblt.c | 19 ++++++++++++------- ChangeLog | 6 ++++++ include/gr.h | 4 ++-- include/grdef.h | 3 ++- 5 files changed, 30 insertions(+), 19 deletions(-) diff --git a/2d/bitblt.c b/2d/bitblt.c index 875d76e4..03a9f66e 100644 --- a/2d/bitblt.c +++ b/2d/bitblt.c @@ -1,4 +1,4 @@ -/* $Id: bitblt.c,v 1.11 2003-10-04 02:58:23 btb Exp $ */ +/* $Id: bitblt.c,v 1.12 2003-10-25 01:44:23 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -426,7 +426,7 @@ static void gr_linear_rep_movsdm_faded(ubyte * src, ubyte * dest, unsigned int n #endif -static void gr_linear_rep_movsd_2x(ubyte * src, ubyte * dest, unsigned int num_dest_pixels ); +void gr_linear_rep_movsd_2x(ubyte *src, ubyte *dest, unsigned int num_dest_pixels); #if !defined(NO_ASM) && defined(__WATCOMC__) @@ -452,7 +452,8 @@ static void gr_linear_rep_movsd_2x(ubyte * src, ubyte * dest, unsigned int num_d #elif !defined(NO_ASM) && defined (__GNUC__) -static inline void gr_linear_rep_movsd_2x(ubyte * src, ubyte * dest, unsigned int num_dest_pixels ) { +inline void gr_linear_rep_movsd_2x(ubyte *src, ubyte *dest, unsigned int num_dest_pixels) +{ /* #pragma aux gr_linear_rep_movsd_2x parm [esi] [edi] [ecx] modify exact [ecx esi edi eax ebx] */ int dummy[3]; __asm__ __volatile__ ( @@ -481,7 +482,7 @@ static inline void gr_linear_rep_movsd_2x(ubyte * src, ubyte * dest, unsigned in #elif !defined(NO_ASM) && defined(_MSC_VER) -__inline void gr_linear_rep_movsd_2x(ubyte * src, ubyte * dest, unsigned int num_dest_pixels ) +__inline void gr_linear_rep_movsd_2x(ubyte *src, ubyte *dest, unsigned int num_dest_pixels) { __asm { mov esi, [src] @@ -510,7 +511,7 @@ done: #else -static void gr_linear_rep_movsd_2x(ubyte *src, ubyte *dest, unsigned int num_pixels) +void gr_linear_rep_movsd_2x(ubyte *src, ubyte *dest, unsigned int num_pixels) { double *d = (double *)dest; uint *s = (uint *)src; @@ -1347,7 +1348,7 @@ void gr_bm_ubitblt00m(int w, int h, int dx, int dy, int sx, int sy, grs_bitmap * extern void gr_lbitblt( grs_bitmap * source, grs_bitmap * dest, int height, int width ); -#if 1 //def MACINTOSH +#ifdef MACINTOSH // width == number of destination pixels @@ -1387,7 +1388,6 @@ void gr_linear_movsd_double(ubyte *src, ubyte *dest, int width) //extern void BlitLargeAlign(ubyte *draw_buffer, int dstRowBytes, ubyte *dstPtr, int w, int h, int modulus); -#ifdef MACINTOSH asm void BlitLargeAlign(ubyte *rSrcPtr, int rDblDStrd, ubyte *rDst1Ptr, int rWidth, int rHeight, int rModulus) { stw r31,-4(SP) // store non-volatile reg in red zone @@ -1465,7 +1465,6 @@ void gr_bm_ubitblt_double(int w, int h, int dx, int dy, int sx, int sy, grs_bitm Assert( !((int)dbits & 0x7) ); // assert to check double word alignment BlitLargeAlign(sbits, dstep, dbits, src->bm_w, src->bm_h, src->bm_rowsize); } -#endif // w and h are the doubled width and height @@ -1488,7 +1487,7 @@ void gr_bm_ubitblt_double_slow(int w, int h, int dx, int dy, int sx, int sy, grs } } -#endif +#endif /* MACINTOSH */ // Clipped bitmap ... diff --git a/2d/ibitblt.c b/2d/ibitblt.c index ba3bc439..f4252874 100644 --- a/2d/ibitblt.c +++ b/2d/ibitblt.c @@ -1,4 +1,4 @@ -/* $Id: ibitblt.c,v 1.6 2002-09-04 22:18:43 btb Exp $ */ +/* $Id: ibitblt.c,v 1.7 2003-10-25 01:44:23 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -14,11 +14,16 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. /* * - * Mac Version: + * "PC" Version: + * Rountines to copy a bitmap on top of another bitmap, but + * only copying to pixels that are transparent. + * "Mac" Version: * Routines to to inverse bitblitting -- well not really. * We don't inverse bitblt like in the PC, but this code * does set up a structure that blits around the cockpit * + * d2x uses the "Mac" version for everything except __MSDOS__ + * * Old Log: ibitblt.c * Revision 1.3 1995/09/13 11:43:22 allender * start on optimizing cockpit copy code @@ -62,10 +67,10 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #endif #ifdef RCS -static char rcsid[] = "$Id: ibitblt.c,v 1.6 2002-09-04 22:18:43 btb Exp $"; +static char rcsid[] = "$Id: ibitblt.c,v 1.7 2003-10-25 01:44:23 btb Exp $"; #endif -#ifdef __MSDOS__ +#ifdef __MSDOS__ //ndef MACINTOSH #include #include @@ -652,7 +657,7 @@ void gr_ibitblt_find_hole_size( grs_bitmap * mask_bmp, int *minx, int *miny, } } -#else // ifdef __MSDOS__ +#else /* __MSDOS__ */ // was: /* !MACINTOSH */ #include "pa_enabl.h" #include "pstypes.h" @@ -708,7 +713,7 @@ void gr_ibitblt(grs_bitmap *src_bmp, grs_bitmap *dest_bmp, ubyte pixel_double) dy = sy; for (y = sy; y < sy + sh; y++) { - gr_linear_movsd_double(src, scan, sw*2); + gr_linear_rep_movsd_2x(src, scan, sw); // was: gr_linear_movsd_double(src, scan, sw*2); current_hole = start_points[dy]; current_hole_length = hole_length[dy]; for (x = 0; x < MAX_HOLES; x++) { @@ -915,4 +920,4 @@ void gr_ibitblt_find_hole_size(grs_bitmap *mask_bmp, int *minx, int *miny, int * Assert (count); } -#endif // ifdef __MSDOS__ +#endif /* __MSDOS__ */ // was: /* !MACINTOSH */ diff --git a/ChangeLog b/ChangeLog index 5191454e..0555d49e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-10-24 Bradley Bell + + * 2d/bitblt.c, 2d/ibitblt.c, include/gr.h, include/grdef.h: use + gr_linear_rep_movsd_2x instead of almost identical + gr_linear_movsd_double. Better since we have assembly versions. + 2003-10-22 Martin Schaffner * main/gamemine.c, main/piggy.c: fix "psychedelic" walls diff --git a/include/gr.h b/include/gr.h index 554922b3..b8f27e85 100644 --- a/include/gr.h +++ b/include/gr.h @@ -1,4 +1,4 @@ -/* $Id: gr.h,v 1.21 2003-10-04 03:14:47 btb Exp $ */ +/* $Id: gr.h,v 1.22 2003-10-25 01:44:23 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -431,7 +431,7 @@ void gr_bm_bitblt(int w, int h, int dx, int dy, int sx, int sy, grs_bitmap * src void gr_bm_ubitblt( int w, int h, int dx, int dy, int sx, int sy, grs_bitmap * src, grs_bitmap * dest); void gr_bm_ubitbltm(int w, int h, int dx, int dy, int sx, int sy, grs_bitmap * src, grs_bitmap * dest); -#ifndef __MSDOS__ +#ifdef MACINTOSH void gr_bm_ubitblt_double(int w, int h, int dx, int dy, int sx, int sy, grs_bitmap *src, grs_bitmap *dest); void gr_linear_movsd_double(ubyte *src, ubyte *dest, int num_pixels); #endif diff --git a/include/grdef.h b/include/grdef.h index 6ffdaf73..b33762fe 100644 --- a/include/grdef.h +++ b/include/grdef.h @@ -1,4 +1,4 @@ -/* $Id: grdef.h,v 1.8 2002-09-05 01:30:00 btb Exp $ */ +/* $Id: grdef.h,v 1.9 2003-10-25 01:44:23 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -79,6 +79,7 @@ extern unsigned int gr_var_bwidth; extern unsigned char * gr_var_bitmap; void gr_linear_movsd( ubyte * source, ubyte * dest, unsigned int nbytes); +void gr_linear_rep_movsd_2x(ubyte *source, ubyte *dest, unsigned int nbytes); void gr_linear_line( int x0, int y0, int x1, int y1); -- 2.39.2