aboutsummaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
Diffstat (limited to 'render.c')
-rw-r--r--render.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/render.c b/render.c
index 07af8cf..ff7670b 100644
--- a/render.c
+++ b/render.c
@@ -114,6 +114,34 @@ void ren_map(
}
}
+void ren_cmap(
+ Renderer* r,
+ int x,
+ int y,
+ const struct Rect* re,
+ const Bitmap* bm
+) {
+ Rect rect, su = *re;
+ const unsigned* data = (const unsigned*)&bm[1];
+ int i, j, sx, sy, ex, ey;
+ rect.x = x;
+ rect.y = y;
+ rect.w = re->w;
+ rect.h = re->h;
+ rect_clipsr(&rect, &su, r->clip);
+ ex = rect.x + rect.w;
+ ey = rect.y + rect.h;
+ for (j = rect.y, sy = su.y; j < ey; j++, sy++) {
+ for (i = rect.x, sx = su.x; i < ex; i++, sx++) {
+ int di = (i + j * r->w);
+ int si = (sx + sy * bm->w);
+ int bit = (1 << (si & 0x1f));
+ bit &= data[si >> 5];
+ r->t[di >> 5] &= ~((1 << (di & 0x1f)) * (bit != 0));
+ }
+ }
+}
+
void ren_rect(
Renderer* r,
const struct Rect* re