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>2012-09-13 09:29:38 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-09-13 09:29:38 +0400
commit05755d307a140934aba98e55e9c7536c0cba0947 (patch)
treeadb0988fa03ea2ae11d785e78a164d4c90e82df2 /source/blender/blenkernel/intern/mask.c
parentc5310521f8d9099fc36431bae76dd0a402cc077e (diff)
fix [#31946] Masking doesn't respect pixel ratio
Diffstat (limited to 'source/blender/blenkernel/intern/mask.c')
-rw-r--r--source/blender/blenkernel/intern/mask.c42
1 files changed, 34 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index f73fb3879b8..06d063574a5 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -55,6 +55,7 @@
#include "BKE_sequencer.h"
#include "BKE_tracking.h"
#include "BKE_movieclip.h"
+#include "BKE_image.h"
static MaskSplinePoint *mask_spline_point_next(MaskSpline *spline, MaskSplinePoint *points_array, MaskSplinePoint *point)
{
@@ -1010,14 +1011,26 @@ void BKE_mask_coord_from_frame(float r_co[2], const float co[2], const float fra
}
void BKE_mask_coord_from_movieclip(MovieClip *clip, MovieClipUser *user, float r_co[2], const float co[2])
{
- int width, height;
+ float aspx, aspy;
float frame_size[2];
/* scaling for the clip */
- BKE_movieclip_get_size(clip, user, &width, &height);
+ BKE_movieclip_get_size_fl(clip, user, frame_size);
+ BKE_movieclip_get_aspect(clip, &aspx, &aspy);
- frame_size[0] = (float)width;
- frame_size[1] = (float)height;
+ frame_size[1] *= (aspy / aspx);
+
+ BKE_mask_coord_from_frame(r_co, co, frame_size);
+}
+void BKE_mask_coord_from_image(Image *image, ImageUser *iuser, float r_co[2], const float co[2])
+{
+ float aspx, aspy;
+ float frame_size[2];
+
+ BKE_image_get_size_fl(image, iuser, frame_size);
+ BKE_image_get_aspect(image, &aspx, &aspy);
+
+ frame_size[1] *= (aspy / aspx);
BKE_mask_coord_from_frame(r_co, co, frame_size);
}
@@ -1040,14 +1053,27 @@ void BKE_mask_coord_to_frame(float r_co[2], const float co[2], const float frame
}
void BKE_mask_coord_to_movieclip(MovieClip *clip, MovieClipUser *user, float r_co[2], const float co[2])
{
- int width, height;
+ float aspx, aspy;
+ float frame_size[2];
+
+ /* scaling for the clip */
+ BKE_movieclip_get_size_fl(clip, user, frame_size);
+ BKE_movieclip_get_aspect(clip, &aspx, &aspy);
+
+ frame_size[1] /= (aspy / aspx);
+
+ BKE_mask_coord_to_frame(r_co, co, frame_size);
+}
+void BKE_mask_coord_to_image(Image *image, ImageUser *iuser, float r_co[2], const float co[2])
+{
+ float aspx, aspy;
float frame_size[2];
/* scaling for the clip */
- BKE_movieclip_get_size(clip, user, &width, &height);
+ BKE_image_get_size_fl(image, iuser, frame_size);
+ BKE_image_get_aspect(image, &aspx, &aspy);
- frame_size[0] = (float)width;
- frame_size[1] = (float)height;
+ frame_size[1] /= (aspy / aspx);
BKE_mask_coord_to_frame(r_co, co, frame_size);
}