Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2008-05-10 00:08:28 +0400
committerCampbell Barton <ideasman42@gmail.com>2008-05-10 00:08:28 +0400
commit76c13cc0f7d40db88ba08581129cf6fa4376df10 (patch)
tree8ad945dd63b16c92aff39256d56b0ec234041ca5 /source/blender/src/drawimage.c
parenta7a9c74ccb3c1f2dce29bb92c64c837c86ad7e80 (diff)
fix for [#8359] Sequencer image preview: HOME hotkey zooming at output res, not at "full view"
also made image and sequencer account for aspect ratio and added numpad 1,2,4,8 keys for zooming.
Diffstat (limited to 'source/blender/src/drawimage.c')
-rw-r--r--source/blender/src/drawimage.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c
index 6d1cd244b84..09ba518565f 100644
--- a/source/blender/src/drawimage.c
+++ b/source/blender/src/drawimage.c
@@ -2349,17 +2349,6 @@ void drawimagespace(ScrArea *sa, void *spacedata)
sa->win_swap= WIN_BACK_OK;
}
-static void image_zoom_power_of_two(void)
-{
- /* Make zoom a power of 2 */
-
- G.sima->zoom = 1 / G.sima->zoom;
- G.sima->zoom = log(G.sima->zoom) / log(2);
- G.sima->zoom = ceil(G.sima->zoom);
- G.sima->zoom = pow(2, G.sima->zoom);
- G.sima->zoom = 1 / G.sima->zoom;
-}
-
static void image_zoom_set_factor(float zoomfac)
{
SpaceImage *sima= curarea->spacedata.first;
@@ -2503,8 +2492,10 @@ void image_home(void)
imgheight = 256;
}
else {
- imgwidth = ibuf->x;
- imgheight = ibuf->y;
+ float xuser_asp, yuser_asp;
+ image_pixel_aspect(G.sima->image, &xuser_asp, &yuser_asp);
+ imgwidth = ibuf->x * xuser_asp;
+ imgheight = ibuf->y * yuser_asp;
}
/* Check if the image will fit in the image with zoom==1 */
@@ -2515,9 +2506,7 @@ void image_home(void)
/* Find the zoom value that will fit the image in the image space */
zoomX = ((float)width) / ((float)imgwidth);
zoomY = ((float)height) / ((float)imgheight);
- G.sima->zoom= MIN2(zoomX, zoomY);
-
- image_zoom_power_of_two();
+ G.sima->zoom = 1.0f / power_of_2(1/ MIN2(zoomX, zoomY) );
}
else {
G.sima->zoom= 1.0f;