| ... | ... |
@@ -38,12 +38,19 @@ screen_write(UxnScreen *p, Layer *layer, Uint16 x, Uint16 y, Uint8 color) |
| 38 | 38 |
} |
| 39 | 39 |
|
| 40 | 40 |
static void |
| 41 |
-screen_wipe(UxnScreen *p, Layer *layer, Uint16 x, Uint16 y) |
|
| 41 |
+screen_fill(UxnScreen *p, Layer *layer, Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2, Uint8 color) |
|
| 42 | 42 |
{
|
| 43 | 43 |
int v, h; |
| 44 |
- for(v = 0; v < 8; v++) |
|
| 45 |
- for(h = 0; h < 8; h++) |
|
| 46 |
- screen_write(p, layer, x + h, y + v, 0); |
|
| 44 |
+ for(v = y1; v < y2; v++) |
|
| 45 |
+ for(h = x1; h < x2; h++) |
|
| 46 |
+ screen_write(p, layer, h, v, color); |
|
| 47 |
+ layer->changed = 1; |
|
| 48 |
+} |
|
| 49 |
+ |
|
| 50 |
+static void |
|
| 51 |
+screen_wipe(UxnScreen *p, Layer *layer, Uint16 x, Uint16 y) |
|
| 52 |
+{
|
|
| 53 |
+ screen_fill(p, layer, x, y, x + 8, y + 8, 0); |
|
| 47 | 54 |
} |
| 48 | 55 |
|
| 49 | 56 |
static void |
| ... | ... |
@@ -93,20 +100,11 @@ screen_resize(UxnScreen *p, Uint16 width, Uint16 height) |
| 93 | 100 |
if(bg && fg && pixels) {
|
| 94 | 101 |
p->width = width; |
| 95 | 102 |
p->height = height; |
| 96 |
- screen_fill(p, &p->bg, 0); |
|
| 97 |
- screen_fill(p, &p->fg, 0); |
|
| 103 |
+ screen_fill(p, &p->bg, 0, 0, p->width, p->height, 0); |
|
| 104 |
+ screen_fill(p, &p->fg, 0, 0, p->width, p->height, 0); |
|
| 98 | 105 |
} |
| 99 | 106 |
} |
| 100 | 107 |
|
| 101 |
-void |
|
| 102 |
-screen_fill(UxnScreen *p, Layer *layer, Uint8 color) |
|
| 103 |
-{
|
|
| 104 |
- Uint32 i, size = p->width * p->height; |
|
| 105 |
- for(i = 0; i < size; i++) |
|
| 106 |
- layer->pixels[i] = color; |
|
| 107 |
- layer->changed = 1; |
|
| 108 |
-} |
|
| 109 |
- |
|
| 110 | 108 |
void |
| 111 | 109 |
screen_redraw(UxnScreen *p) |
| 112 | 110 |
{
|
| ... | ... |
@@ -164,10 +162,14 @@ screen_deo(Uint8 *ram, Uint8 *d, Uint8 port) |
| 164 | 162 |
break; |
| 165 | 163 |
case 0xe: {
|
| 166 | 164 |
Uint16 x = PEEK2(d + 0x8), y = PEEK2(d + 0xa); |
| 167 |
- Uint8 layer = d[0xe] & 0x40; |
|
| 168 |
- screen_write(&uxn_screen, layer ? &uxn_screen.fg : &uxn_screen.bg, x, y, d[0xe] & 0x3); |
|
| 169 |
- if(d[0x6] & 0x01) POKE2(d + 0x8, x + 1); /* auto x+1 */ |
|
| 170 |
- if(d[0x6] & 0x02) POKE2(d + 0xa, y + 1); /* auto y+1 */ |
|
| 165 |
+ Layer *layer = (d[0xf] & 0x40) ? &uxn_screen.fg : &uxn_screen.bg; |
|
| 166 |
+ if(d[0xe] & 0x80) {
|
|
| 167 |
+ screen_fill(&uxn_screen, layer, x, y, uxn_screen.width, uxn_screen.height, d[0xe] & 0x3); |
|
| 168 |
+ } else {
|
|
| 169 |
+ screen_write(&uxn_screen, layer, x, y, d[0xe] & 0x3); |
|
| 170 |
+ if(d[0x6] & 0x01) POKE2(d + 0x8, x + 1); /* auto x+1 */ |
|
| 171 |
+ if(d[0x6] & 0x02) POKE2(d + 0xa, y + 1); /* auto y+1 */ |
|
| 172 |
+ } |
|
| 171 | 173 |
break; |
| 172 | 174 |
} |
| 173 | 175 |
case 0xf: {
|
| ... | ... |
@@ -27,7 +27,6 @@ extern UxnScreen uxn_screen; |
| 27 | 27 |
|
| 28 | 28 |
void screen_palette(UxnScreen *p, Uint8 *addr); |
| 29 | 29 |
void screen_resize(UxnScreen *p, Uint16 width, Uint16 height); |
| 30 |
-void screen_fill(UxnScreen *p, Layer *layer, Uint8 color); |
|
| 31 | 30 |
void screen_redraw(UxnScreen *p); |
| 32 | 31 |
void screen_mono(UxnScreen *p); |
| 33 | 32 |
|