forked from tonioni/WinUAE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathp96_blit.cpp
141 lines (138 loc) · 2.93 KB
/
p96_blit.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#if BLT_SIZE == 3
static void NOINLINE BLT_NAME (unsigned int w, unsigned int h, uae_u8 *src, uae_u8 *dst, int srcpitch, int dstpitch)
{
uae_u8 *src2 = src;
uae_u8 *dst2 = dst;
uae_u32 *src2_32 = (uae_u32*)src;
uae_u32 *dst2_32 = (uae_u32*)dst;
unsigned int y, x, ww, xxd;
#ifdef BLT_TEMP
uae_u32 tmp;
#endif
w *= BLT_SIZE;
ww = w / 4;
xxd = w - (ww * 4);
for(y = 0; y < h; y++) {
uae_u8 *src_8;
uae_u8 *dst_8;
uae_u32 *src_32 = (uae_u32*)src2;
uae_u32 *dst_32 = (uae_u32*)dst2;
for (x = 0; x < ww; x++) {
BLT_FUNC (src_32, dst_32);
src_32++; dst_32++;
}
src_8 = (uae_u8*)src_32;
dst_8 = (uae_u8*)dst_32;
for (x = 0; x < xxd; x++) {
BLT_FUNC (src_8, dst_8);
src_8++;
dst_8++;
}
dst2 += dstpitch;
src2 += srcpitch;
}
}
#else
static void NOINLINE BLT_NAME (unsigned int w, unsigned int h, uae_u8 *src, uae_u8 *dst, int srcpitch, int dstpitch)
{
uae_u8 *src2 = src;
uae_u8 *dst2 = dst;
uae_u32 *src2_32 = (uae_u32*)src;
uae_u32 *dst2_32 = (uae_u32*)dst;
unsigned int y, x, ww, xxd;
#ifdef BLT_TEMP
#if BLT_SIZE == 4
uae_u32 tmp;
#elif BLT_SIZE == 2
uae_u16 tmp;
#else
uae_u8 tmp;
#endif
#endif
if (w < 8 * BLT_MULT) {
ww = w / BLT_MULT;
for(y = 0; y < h; y++) {
uae_u32 *src_32 = (uae_u32*)src2;
uae_u32 *dst_32 = (uae_u32*)dst2;
for (x = 0; x < ww; x++) {
BLT_FUNC (src_32, dst_32);
src_32++; dst_32++;
}
#if BLT_SIZE == 2
if (w & 1) {
uae_u16 *src_16 = (uae_u16*)src_32;
uae_u16 *dst_16 = (uae_u16*)dst_32;
BLT_FUNC (src_16, dst_16);
}
#elif BLT_SIZE == 1
{
int wb = w & 3;
uae_u8 *src_8 = (uae_u8*)src_32;
uae_u8 *dst_8 = (uae_u8*)dst_32;
while (wb--) {
BLT_FUNC (src_8, dst_8);
src_8++;
dst_8++;
}
}
#endif
dst2 += dstpitch;
src2 += srcpitch;
}
return;
}
ww = w / (8 * BLT_MULT);
xxd = (w - ww * (8 * BLT_MULT)) / BLT_MULT;
for(y = 0; y < h; y++) {
uae_u32 *src_32 = (uae_u32*)src2;
uae_u32 *dst_32 = (uae_u32*)dst2;
for (x = 0; x < ww; x++) {
BLT_FUNC (src_32, dst_32);
src_32++; dst_32++;
BLT_FUNC (src_32, dst_32);
src_32++; dst_32++;
BLT_FUNC (src_32, dst_32);
src_32++; dst_32++;
BLT_FUNC (src_32, dst_32);
src_32++; dst_32++;
BLT_FUNC (src_32, dst_32);
src_32++; dst_32++;
BLT_FUNC (src_32, dst_32);
src_32++; dst_32++;
BLT_FUNC (src_32, dst_32);
src_32++; dst_32++;
BLT_FUNC (src_32, dst_32);
src_32++; dst_32++;
}
for (x = 0; x < xxd; x++) {
BLT_FUNC (src_32, dst_32);
src_32++; dst_32++;
}
#if BLT_SIZE == 2
if (w & 1) {
uae_u16 *src_16 = (uae_u16*)src_32;
uae_u16 *dst_16 = (uae_u16*)dst_32;
BLT_FUNC (src_16, dst_16);
}
#elif BLT_SIZE == 1
{
int wb = w & 3;
uae_u8 *src_8 = (uae_u8*)src_32;
uae_u8 *dst_8 = (uae_u8*)dst_32;
while (wb--) {
BLT_FUNC (src_8, dst_8);
src_8++;
dst_8++;
}
}
#endif
dst2 += dstpitch;
src2 += srcpitch;
}
}
#endif
#undef BLT_NAME
#undef BLT_FUNC
#ifdef BLT_TEMP
#undef BLT_TEMP
#endif