ref: 66eabf3368847f5c6c5a266c4f07214ba3472572
parent: f48eac8988cf8ce8b18f49a97b26695c7b44ee52
author: jmq <jmq@jmq.sh>
date: Fri Aug 22 23:15:30 EDT 2025
pain: resize scale works one way
--- a/pill/pill.c
+++ b/pill/pill.c
@@ -74,16 +74,16 @@
scale = ((float)Dx(sr))/((float)Dx(tr));
p = ZP;
r.min = tr.min;
- r.max.y = s->r.max.y;
+ r.max.y = tr.max.y;
i = 0;
while (i < Dx(tr)) {+ p.x = (int)(((float)i)*scale);
drawop(c, c->r, s, nil, p, S);
- p.x = s->r.min.x + (int)(((float)i)*scale);
r.min.x = i + tr.min.x;
r.max.x = r.min.x + 1;
- draw(screen, r, c, nil, ZP);
+ draw(t, r, c, nil, ZP);
i+=1;
}
@@ -96,29 +96,25 @@
return -1;
}
- scale = ((float)Dy(sr))/((float)Dy(tr));
+ scale = ((float)Dy(tr))/((float)Dy(dr));
- p = dr.min;
- r.min = tr.min;
- r.max.x = tr.max.x;
+ p = ZP;
+ r.min = d->r.min;
+ r.max.x = d->r.max.x;
-// i = 0;
-// while (r.min.y < dr.max.y) {-// draw(c, c->r, t, nil, p);
-// p.y = (int)(((float)i)*scale);
-//
-// // Move the draw rectangle for the temporary image scale
-// // rectangles to the right
-// r.min.y = i + tr.min.x;
-// r.max.y =i + tr.min.x + 1;
-// Rectangle fr = rectaddpt(r, d->r.min);
-// draw(d, fr, c, nil, ZP);
-// i+=1;
-// }
+ i = 0;
+ while (i < Dy(dr)) {+ p.y = (int)(((float)i)*scale);
+ drawop(c, c->r, t, nil, p, S);
+
+ // Move the draw rectangle for the temporary image scale
+ // rectangles to the right
+ r.min.y = i + d->r.min.y;
+ r.max.y = r.min.y + 1;
+ draw(d, r, c, nil, ZP);
+ i+=1;
+ }
- draw(d, d->r, t, nil, d->r.min);
-
-
freeimage(t);
freeimage(c);
@@ -299,14 +295,8 @@
static void
drawcanvas(void)
{- Rectangle vwr = VirtualWindow->r;
- //print("VirtualWindow: %R\n", VirtualWindow->r);- //print("screen: %R\n", screen->r);- VirtualWindow->r.min = screen->r.min;
- VirtualWindow->r.max.x = VirtualWindow->r.min.x + Dx(vwr);
- VirtualWindow->r.max.y = VirtualWindow->r.min.y + Dy(vwr);
- //draw(screen, screen->r, Background, nil, ZP);
- //draw(screen, screen->r, VirtualWindow, nil, ZP);
+ draw(screen, screen->r, Background, nil, ZP);
+ draw(screen, screen->r, VirtualWindow, nil, screen->r.min);
}
void
@@ -334,7 +324,6 @@
sysfatal("initcanvas: %r");}
- draw(screen, screen->r, Background, nil, ZP);
rc = resizeimage(VirtualWindow, HuePicker);
if (rc < 0) { sysfatal("resizeimage: %r");--
⑨