shithub: rd

Download patch

ref: f7df554e50eb80101ef34c4b8614748de6a38d7c
parent: daada088acefc2be3da7a40baec513032dd72b80
author: Yaroslav Kolomiiets <yarikos@gmail.com>
date: Tue Aug 9 12:02:28 EDT 2016

replace Imgupd.clipr with a set of ints

--- a/dat.h
+++ b/dat.h
@@ -252,7 +252,10 @@
 	int	sx;
 	int	sy;
 	int	clipped;
-	Rectangle	clipr;
+	int	cx;
+	int	cy;
+	int	cxsz;
+	int	cysz;
 	int	nbytes;
 	uchar*	bytes;
 };
--- a/draw.c
+++ b/draw.c
@@ -96,7 +96,7 @@
 memblt(Rdp*, Imgupd* up)
 {
 	Image* img;
-	Rectangle r;
+	Rectangle clipr, r;
 	Point pt;
 
 	if(up->cid >= nelem(icache) || up->coff >= nelem(*icache)){
@@ -109,8 +109,10 @@
 		return;
 	}
 
-	if(up->clipped)
-		replclipr(screen, screen->repl, rectaddpt(up->clipr, screen->r.min));
+	if(up->clipped){
+		clipr = Rect(up->cx, up->cy, up->cx+up->cxsz, up->cy+up->cysz);
+		replclipr(screen, screen->repl, rectaddpt(clipr, screen->r.min));
+	}
 
 	r = Rect(up->x, up->y, up->xm+1, up->ym+1);
 	r = rectaddpt(r, screen->r.min);
--- a/egdi.c
+++ b/egdi.c
@@ -373,7 +373,10 @@
 	up->clipped = 0;
 	if(ctl&Clipped){
 		up->clipped = 1;
-		up->clipr = gc.clipr;
+		up->cx = gc.clipr.min.x;
+		up->cy = gc.clipr.min.y;
+		up->cxsz = Dx(gc.clipr);
+		up->cysz = Dy(gc.clipr);
 	}
 
 	return p-a;