Skip to content

Commit 56b0d63

Browse files
committed
fix "scale" in displaybar
1 parent b025242 commit 56b0d63

File tree

2 files changed

+30
-48
lines changed

2 files changed

+30
-48
lines changed

TODO

Lines changed: 17 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,38 @@
1-
- try:
2-
3-
nip4 k2.jpg
4-
alt-R
5-
segv in infobar_status_update()
6-
7-
81
- try:
92

103
nip4 ~/pics/S000_t000002_V000_R0000_X000_Y000_C02_I1_D0_P00101.tif
114

12-
incredibly slow, in fact does not draw at all, and it's not clear why
13-
14-
this takes under 2s to draw the image:
5+
switch to multipage, go to page 72, enable falsecolour, set scale 6,
6+
close window
157

16-
image = pyvips.Image.new_from_file(sys.argv[1], n=-1);
8+
thumbnail gets falsecolour and scale, but not multipage or page number
179

18-
page_width = image.width
19-
page_height = image.get("page-height")
10+
- "reset" in display bar resets the position of scale/offset widgets, but does
11+
not reset the menu items (eg. tick on falsecolour)
2012

21-
pages = [image.crop(0, y * page_height, page_width, page_height)
22-
for y in range(3)]
13+
I forget how menu items are linked to actions, reread this
2314

24-
rgb = pages[0].bandjoin(pages[1:])
15+
gaction bound to a gsetting? do we need to add to the settings
16+
schema?
2517

26-
rgb = rgb.copy(interpretation="rgb16")
18+
likewise, load ws with locked tab, rightclick menu on locked tab does not
19+
have tick selected
2720

28-
rgb.write_to_file(sys.argv[2])
21+
- the "new tab" icon is still broken in the windows build
2922

23+
- change "Merge into ..."
3024

25+
split to "Merge from file ..." and "Merge column >" with a
26+
pullright listing all columns
3127

28+
Same for merge in tab menu, except "Merge tab >"
3229

30+
Just does save/load for you
3331

34-
- alt-L and R for a while, coredump
32+
# menu redesign
3533

3634
- maxpos, then create mark from coordinate should be two clicks
3735

38-
3936
- try:
4037

4138
minpair image constant
@@ -57,30 +54,6 @@ image = pyvips.Image.new_from_file(sys.argv[1], n=-1);
5754

5855
we'll need to do constant expansion in minpair
5956

60-
- the "new tab" icon is still broken in the windows build
61-
62-
- "reset" in display bar resets the position of scale/offset widgets, but does
63-
not reset the menu items (eg. tick on falsecolour)
64-
65-
I forget how menu items are linked to actions, reread this
66-
67-
gaction bound to a gsetting? do we need to add to the settings
68-
schema?
69-
70-
likewise, load ws with locked tab, rightclick menu on locked tab does not
71-
have tick selected
72-
73-
- change "Merge into ..."
74-
75-
split to "Merge from file ..." and "Merge column >" with a
76-
pullright listing all columns
77-
78-
Same for merge in tab menu, except "Merge tab >"
79-
80-
Just does save/load for you
81-
82-
# menu redesign
83-
8457
- implement Menuseparator?
8558

8659
we've implemented #separator

src/imageui.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -888,21 +888,30 @@ imageui_scale(Imageui *imageui)
888888
VipsImage *image;
889889

890890
if ((image = tilesource_get_image(imageui->tilesource))) {
891-
double image_zoom;
891+
/* Get the view rect in level0 coordinates.
892+
*/
893+
double image_zoom = imageui_get_zoom(imageui);
892894
int left, top, width, height;
893-
double scale, offset;
894-
895-
image_zoom = imageui_get_zoom(imageui);
896895
imageui_get_position(imageui, &left, &top, &width, &height);
896+
897897
left /= image_zoom;
898898
top /= image_zoom;
899899
width /= image_zoom;
900900
height /= image_zoom;
901901

902+
/* image is scaled down by current_z, so we must scale the rect by
903+
* that.
904+
*/
905+
left /= 1 << imageui->tilesource->current_z;
906+
top /= 1 << imageui->tilesource->current_z;
907+
width /= 1 << imageui->tilesource->current_z;
908+
height /= 1 << imageui->tilesource->current_z;
909+
902910
/* FIXME ... this will be incredibly slow, esp. for large
903911
* images. Instead, it would be better to just search the
904912
* cached tiles we have.
905913
*/
914+
double scale, offset;
906915
if (imageui_find_scale(image,
907916
left, top, width, height, &scale, &offset))
908917
return FALSE;

0 commit comments

Comments
 (0)