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:
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 04ba04c51f1..547de85e856 100644
--- a/source/blender/src/drawimage.c
+++ b/source/blender/src/drawimage.c
@@ -2356,17 +2356,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;
@@ -2510,8 +2499,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 */
@@ -2522,9 +2513,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;