diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-09-13 09:29:38 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-09-13 09:29:38 +0400 |
commit | 05755d307a140934aba98e55e9c7536c0cba0947 (patch) | |
tree | adb0988fa03ea2ae11d785e78a164d4c90e82df2 /source/blender/editors/space_image | |
parent | c5310521f8d9099fc36431bae76dd0a402cc077e (diff) |
fix [#31946] Masking doesn't respect pixel ratio
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r-- | source/blender/editors/space_image/image_edit.c | 46 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 2 |
2 files changed, 11 insertions, 37 deletions
diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c index ac9883b411d..360cbc3f026 100644 --- a/source/blender/editors/space_image/image_edit.c +++ b/source/blender/editors/space_image/image_edit.c @@ -143,27 +143,6 @@ int ED_space_image_has_buffer(SpaceImage *sima) return has_buffer; } -void ED_image_get_size(Image *ima, int *width, int *height) -{ - ImBuf *ibuf = NULL; - void *lock; - - if (ima) - ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); - - if (ibuf && ibuf->x > 0 && ibuf->y > 0) { - *width = ibuf->x; - *height = ibuf->y; - } - else { - *width = IMG_SIZE_FALLBACK; - *height = IMG_SIZE_FALLBACK; - } - - if (ima) - BKE_image_release_ibuf(ima, lock); -} - void ED_space_image_get_size(SpaceImage *sima, int *width, int *height) { Scene *scene = sima->iuser.scene; @@ -205,23 +184,18 @@ void ED_space_image_get_size_fl(SpaceImage *sima, float size[2]) size[1] = size_i[1]; } -void ED_image_get_aspect(Image *ima, float *aspx, float *aspy) -{ - *aspx = *aspy = 1.0; +void ED_space_image_get_aspect(SpaceImage *sima, float *aspx, float *aspy) +{ + Image *ima = sima->image; if ((ima == NULL) || (ima->type == IMA_TYPE_R_RESULT) || (ima->type == IMA_TYPE_COMPOSITE) || (ima->aspx == 0.0f || ima->aspy == 0.0f)) { - return; + *aspx = *aspy = 1.0; + } + else { + BKE_image_get_aspect(ima, aspx, aspy); } - - /* x is always 1 */ - *aspy = ima->aspy / ima->aspx; -} - -void ED_space_image_get_aspect(SpaceImage *sima, float *aspx, float *aspy) -{ - ED_image_get_aspect(ED_space_image(sima), aspx, aspy); } void ED_space_image_get_zoom(SpaceImage *sima, ARegion *ar, float *zoomx, float *zoomy) @@ -254,12 +228,12 @@ void ED_space_image_get_uv_aspect(SpaceImage *sima, float *aspx, float *aspy) } } -void ED_image_get_uv_aspect(Image *ima, float *aspx, float *aspy) +void ED_image_get_uv_aspect(Image *ima, ImageUser *iuser, float *aspx, float *aspy) { int w, h; - ED_image_get_aspect(ima, aspx, aspy); - ED_image_get_size(ima, &w, &h); + BKE_image_get_aspect(ima, aspx, aspy); + BKE_image_get_size(ima, iuser, &w, &h); *aspx *= (float)w; *aspy *= (float)h; diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 8d9d1be61e5..86722c5158e 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -632,7 +632,7 @@ static int image_view_selected_exec(bContext *C, wmOperator *UNUSED(op)) ima = ED_space_image(sima); ED_space_image_get_size(sima, &width, &height); - ED_image_get_aspect(ima, &aspx, &aspy); + ED_space_image_get_aspect(sima, &aspx, &aspy); width = width * aspx; height = height * aspy; |