aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/jpg
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-02-15 12:11:03 +0000
committerrsc <devnull@localhost>2006-02-15 12:11:03 +0000
commit846ec3d21def4cea144e9fbb1e523a5ff31fa2a6 (patch)
tree882199a3da5b710ff8dc558850b20e7013e11fd1 /src/cmd/jpg
parentdfbfbecfc6343360494b6d515ea8763f85c18f25 (diff)
downloadplan9port-846ec3d21def4cea144e9fbb1e523a5ff31fa2a6.tar.gz
plan9port-846ec3d21def4cea144e9fbb1e523a5ff31fa2a6.tar.bz2
plan9port-846ec3d21def4cea144e9fbb1e523a5ff31fa2a6.zip
resize window to fit image (Erik Quanstrom)
Diffstat (limited to 'src/cmd/jpg')
-rw-r--r--src/cmd/jpg/bmp.c8
-rw-r--r--src/cmd/jpg/gif.c8
-rw-r--r--src/cmd/jpg/jpg.c7
-rw-r--r--src/cmd/jpg/png.c7
4 files changed, 13 insertions, 17 deletions
diff --git a/src/cmd/jpg/bmp.c b/src/cmd/jpg/bmp.c
index ba1b813a..4d6ddd9c 100644
--- a/src/cmd/jpg/bmp.c
+++ b/src/cmd/jpg/bmp.c
@@ -35,11 +35,9 @@ eresized(int new)
}
if(image == nil)
return;
- r = insetrect(screen->clipr, Edge+Border);
- r.max.x = r.min.x+Dx(image->r);
- r.max.y = r.min.y+Dy(image->r);
- border(screen, r, -Border, nil, ZP);
- draw(screen, r, image, nil, image->r.min);
+ r = rectaddpt(image->r, subpt(screen->r.min, image->r.min));
+ if(!new)
+ drawresizewindow(r);
flushimage(display, 1);
}
diff --git a/src/cmd/jpg/gif.c b/src/cmd/jpg/gif.c
index f8f89de9..29675118 100644
--- a/src/cmd/jpg/gif.c
+++ b/src/cmd/jpg/gif.c
@@ -48,10 +48,10 @@ eresized(int new)
}
if(allims==nil || allims[which]==nil)
return;
- r = imager();
- border(screen, r, -Border, nil, ZP);
- r.min.x += allims[which]->r.min.x - allims[0]->r.min.x;
- r.min.y += allims[which]->r.min.y - allims[0]->r.min.y;
+ r = rectaddpt(allims[0]->r, subpt(screen->r.min, allims[0]->r.min));
+ if(!new)
+ drawresizewindow(r);
+ r = rectaddpt(r, subpt(allims[which]->r.min, allims[0]->r.min));
drawop(screen, r, allims[which], allmasks[which], allims[which]->r.min, S);
flushimage(display, 1);
}
diff --git a/src/cmd/jpg/jpg.c b/src/cmd/jpg/jpg.c
index 82dba4d7..fafa9b8c 100644
--- a/src/cmd/jpg/jpg.c
+++ b/src/cmd/jpg/jpg.c
@@ -37,10 +37,9 @@ eresized(int new)
}
if(image == nil)
return;
- r = insetrect(screen->clipr, Edge+Border);
- r.max.x = r.min.x+Dx(image->r);
- r.max.y = r.min.y+Dy(image->r);
- border(screen, r, -Border, nil, ZP);
+ r = rectaddpt(image->clipr, subpt(screen->r.min, image->clipr.min));
+ if(!new)
+ drawresizewindow(r);
draw(screen, r, image, nil, image->r.min);
flushimage(display, 1);
}
diff --git a/src/cmd/jpg/png.c b/src/cmd/jpg/png.c
index a815abfc..06cedc60 100644
--- a/src/cmd/jpg/png.c
+++ b/src/cmd/jpg/png.c
@@ -35,10 +35,9 @@ eresized(int new)
}
if(image == nil)
return;
- r = insetrect(screen->clipr, Edge+Border);
- r.max.x = r.min.x+Dx(image->r);
- r.max.y = r.min.y+Dy(image->r);
- border(screen, r, -Border, nil, ZP);
+ r = rectaddpt(image->r, subpt(screen->r.min, image->r.min));
+ if(!new)
+ drawresizewindow(r);
draw(screen, r, image, nil, image->r.min);
flushimage(display, 1);
}