commit 7d15395
Devine Lu Linvega
·
2024-11-25 18:48:36 +0000 UTC
parent d9f987c
(screen) Cleanup
1 files changed,
+5,
-7
+5,
-7
1@@ -31,9 +31,9 @@ static Uint8 blending[4][16] = {
2 static void
3 screen_2bpp(Uint8 *layer, Uint8 *addr, Uint16 x1, Uint16 y1, Uint16 blend, int fx, int fy)
4 {
5- int x, y, ptr, opaque = (blend % 5);
6+ int x, y, ptr, opaque = (blend % 5), length = MAR2(uxn_screen.width);
7 for(y = y1, ptr = fy < 0 ? 7 : 0; y < y1 + 8; y++, ptr += fy) {
8- int ch1 = addr[ptr], ch2 = addr[ptr + 8], row = y * MAR2(uxn_screen.width);
9+ int ch1 = addr[ptr], ch2 = addr[ptr + 8], row = y * length;
10 for(x = x1; x < x1 + 8; x++) {
11 int shift = (fx > 0 ? 7 - (x - x1) : x - x1);
12 int color = ((ch1 >> shift) & 1) | (((ch2 >> shift) & 1) << 1);
13@@ -46,11 +46,9 @@ screen_2bpp(Uint8 *layer, Uint8 *addr, Uint16 x1, Uint16 y1, Uint16 blend, int f
14 static void
15 screen_1bpp(Uint8 *layer, Uint8 *addr, Uint16 x1, Uint16 y1, Uint16 blend, int fx, int fy)
16 {
17- int x, y, opaque = (blend % 5);
18- for(y = y1; y < y1 + 8; y++) {
19- int ptr = fy < 0 ? 7 - (y - y1) : y - y1;
20- int ch1 = addr[ptr];
21- int row = y * MAR2(uxn_screen.width);
22+ int x, y, ptr, opaque = (blend % 5), length = MAR2(uxn_screen.width);
23+ for(y = y1, ptr = fy < 0 ? 7 : 0; y < y1 + 8; y++, ptr += fy) {
24+ int ch1 = addr[ptr], row = y * length;
25 for(x = x1; x < x1 + 8; x++) {
26 int shift = fx > 0 ? 7 - (x - x1) : x - x1;
27 int color = (ch1 >> shift) & 1;