aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-10-01 19:02:58 +1000
committerquou <quou@disroot.org>2024-10-01 19:02:58 +1000
commit1c5b6a90d0515d7070a628c1c2d71649b9da2ec1 (patch)
treec601d510a0c3906e4102686a4251813ac223cf2c
parent7af26595c1d32eb8519b6d864a991dbd377f5ffa (diff)
ren_clear respects clip
-rw-r--r--render.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/render.c b/render.c
index 34416c0..dc9962f 100644
--- a/render.c
+++ b/render.c
@@ -32,9 +32,14 @@ void ren_end(Renderer* r) {
}
void ren_clear(Renderer* r) {
- int e = r->w * r->h >> 5, i;
- for (i = 0; i < e; i++)
- r->t[i] = 0;
+ int i, j;
+ for (j = r->clip[1]; j < r->clip[3]; j++)
+ for (i = r->clip[0]; i < r->clip[2]; i++) {
+ int idx = i + j * r->w;
+ int bit = 1 << (idx & 0x1f);
+ bit = ~bit;
+ r->t[idx >> 5] &= bit;
+ }
}
void ren_char(Renderer* r, int x, int y, char ch) {