2 * $Source: x:/prj/tech/libsrc/dev2d/RCS/mxfl8.c $
5 * $Date: 1997/01/28 16:51:07 $
7 * Routines for drawing flat8 bitmaps onto a mode X canvas.
9 * This file is part of the dev2d library.
16 #define BIG_BLIT_MINIMUM 0x4000 // 16k
17 #define PROC_DATA_CACHE 0x1000 // rough size of data cache
20 modex_memmove (uchar
*s
, uchar
*d
, int h
, int s_row
, int d_row
);
21 #pragma aux modex_memmove = \
29 parm [esi] [edi] [edx] [ebx] [ecx] \
32 __inline
modex_memmove (uchar
*s
, uchar
*d
, int h
, int s_row
, int d_row
)
52 void modex_flat8_trans_ubitmap (grs_bitmap
*bm
, short x
, short y
)
61 wlatch_start(save_wlatch
);
65 if ((h
<=0)||(w
<=0)) return;
66 p
= grd_bm
.bits
+grd_bm
.row
*y
;
71 modex_force_wlatch(1<<(x
&3));
72 for (j
=(w
+3)>>2; j
>0; j
--) {
86 wlatch_restore(save_wlatch
);
89 void modex_flat8_opaque_ubitmap (grs_bitmap
*bm
, short x
, short y
)
97 wlatch_start(save_wlatch
);
101 if ((h
<=0)||(w
<=0)) return;
102 p
= grd_bm
.bits
+grd_bm
.row
*y
;
104 if (w
* h
> BIG_BLIT_MINIMUM
) {
106 // too big to fit in cache, so draw in smaller chunks that fit
107 nh
= PROC_DATA_CACHE
/ w
;
111 for (i
=0; i
< 4; i
++) {
112 src
= bm
->bits
+i
+bm
->row
*y
;
113 dst
= p
+ ((x
+i
)>>2) + (grd_bm
.row
*y
);
114 modex_force_wlatch(1<<((x
+i
)&3));
115 // assume we're more horizontal than vertical
116 for(j
=nh
; j
> 0; j
--) {
117 modex_memmove(src
,dst
,(w
+3)>>2,4,1);
128 for (i
=0; i
<4; i
++) {
131 modex_force_wlatch(1<<(x
&3));
132 for (j
=(w
+3)>>2; j
>0; j
--) {
133 modex_memmove(src
,dst
,h
,bm
->row
,grd_bm
.row
);
142 wlatch_restore(save_wlatch
);