add ED_space_image_get_size_fl, ED_space_clip_get_size_fl
authorCampbell Barton <ideasman42@gmail.com>
Thu, 26 Jul 2012 11:47:47 +0000 (11:47 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 26 Jul 2012 11:47:47 +0000 (11:47 +0000)
source/blender/editors/include/ED_clip.h
source/blender/editors/include/ED_image.h
source/blender/editors/mask/mask_edit.c
source/blender/editors/space_clip/clip_editor.c
source/blender/editors/space_image/image_edit.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/uvedit/uvedit_ops.c

index 8949eb8442da64ef58396fccc9109840bb8ae1a0..f1b405c2c3e55e43718612ed5ed4956a0c27446d 100644 (file)
@@ -53,6 +53,7 @@ int ED_space_clip_maskedit_poll(struct bContext *C);
 int ED_space_clip_maskedit_mask_poll(bContext *C);
 
 void ED_space_clip_get_size(const struct bContext *C, int *width, int *height);
+void ED_space_clip_get_size_fl(const struct bContext *C, float size[2]);
 void ED_space_clip_get_zoom(const struct bContext *C, float *zoomx, float *zoomy);
 void ED_space_clip_get_aspect(struct SpaceClip *sc, float *aspx, float *aspy);
 void ED_space_clip_get_aspect_dimension_aware(struct SpaceClip *sc, float *aspx, float *aspy);
index 6edbe33de329eda13fe8a3a16215ea7313d12e3b..830a61047709b85afeb8afafe5cda5519aa87f02 100644 (file)
@@ -52,6 +52,7 @@ void ED_space_image_release_buffer(struct SpaceImage *sima, void *lock);
 int ED_space_image_has_buffer(struct SpaceImage *sima);
 
 void ED_space_image_get_size(struct SpaceImage *sima, int *width, int *height);
+void ED_space_image_get_size_fl(struct SpaceImage *sima, float size[2]);
 void ED_space_image_get_aspect(struct SpaceImage *sima, float *aspx, float *aspy);
 void ED_space_image_get_zoom(struct SpaceImage *sima, struct ARegion *ar, float *zoomx, float *zoomy);
 void ED_space_image_get_uv_aspect(struct SpaceImage *sima, float *aspx, float *aspy);
index 0491b164fec830de57970fae007a68f5868c6f3d..5c724d9e5a3dd9200d2f8c793367464a77cdea61 100644 (file)
@@ -110,13 +110,10 @@ void ED_mask_mouse_pos(const bContext *C, wmEvent *event, float co[2])
                        }
                        case SPACE_IMAGE:
                        {
-                               int width, height;
                                float frame_size[2];
                                SpaceImage *sima = sa->spacedata.first;
                                ARegion *ar = CTX_wm_region(C);
-                               ED_space_image_get_size(sima, &width, &height);
-                               frame_size[0] = width;
-                               frame_size[1] = height;
+                               ED_space_image_get_size_fl(sima, frame_size);
                                ED_image_mouse_pos(sima, ar, event, co);
                                BKE_mask_coord_from_frame(co, co, frame_size);
                                break;
@@ -155,13 +152,10 @@ void ED_mask_point_pos(const bContext *C, float x, float y, float *xr, float *yr
                                break;
                        case SPACE_IMAGE:
                        {
-                               int width, height;
                                float frame_size[2];
                                SpaceImage *sima = sa->spacedata.first;
                                ARegion *ar = CTX_wm_region(C);
-                               ED_space_image_get_size(sima, &width, &height);
-                               frame_size[0] = width;
-                               frame_size[1] = height;
+                               ED_space_image_get_size_fl(sima, frame_size);
                                ED_image_point_pos(sima, ar, x, y, &co[0], &co[1]);
                                BKE_mask_coord_from_frame(co, co, frame_size);
                                break;
@@ -203,13 +197,10 @@ void ED_mask_point_pos__reverse(const bContext *C, float x, float y, float *xr,
                                break;
                        case SPACE_IMAGE:
                        {
-                               int width, height;
                                float frame_size[2];
                                SpaceImage *sima = sa->spacedata.first;
                                ARegion *ar = CTX_wm_region(C);
-                               ED_space_image_get_size(sima, &width, &height);
-                               frame_size[0] = width;
-                               frame_size[1] = height;
+                               ED_space_image_get_size_fl(sima, frame_size);
 
                                co[0] = x;
                                co[1] = y;
index 52f5960c55917f51f7276e23cee2e8b1d71058a1..92fcbc2964ddd6e25988c135f16576c6b8d542e2 100644 (file)
@@ -136,6 +136,14 @@ void ED_space_clip_get_size(const bContext *C, int *width, int *height)
        }
 }
 
+void ED_space_clip_get_size_fl(const bContext *C, float size[2])
+{
+       int size_i[2];
+       ED_space_clip_get_size(C, &size_i[0], &size_i[1]);
+       size[0] = size_i[0];
+       size[1] = size_i[1];
+}
+
 void ED_space_clip_get_zoom(const bContext *C, float *zoomx, float *zoomy)
 {
        ARegion *ar = CTX_wm_region(C);
index 927f65f239b0188982b5111d0ac683cc44dd4886..65df6f98efb698fe14da44ec656eb06c49b6a7af 100644 (file)
@@ -192,6 +192,14 @@ void ED_space_image_get_size(SpaceImage *sima, int *width, int *height)
        ED_space_image_release_buffer(sima, lock);
 }
 
+void ED_space_image_get_size_fl(SpaceImage *sima, float size[2])
+{
+       int size_i[2];
+       ED_space_image_get_size(sima, &size_i[0], &size_i[1]);
+       size[0] = size_i[0];
+       size[1] = size_i[1];
+}
+
 void ED_image_get_aspect(Image *ima, float *aspx, float *aspy)
 {
        *aspx = *aspy = 1.0;
index 8962174ffe2cb043eabac955095bcc962db36f3c..ff18b23dc91f1c63c09fab05663ed74b4343fc08 100644 (file)
@@ -1452,12 +1452,9 @@ void calculateCenterCursor2D(TransInfo *t)
        if (cursor) {
                if (t->options & CTX_MASK) {
                        float co[2];
-                       int width, height;
                        float frame_size[2];
                        SpaceImage *sima = (SpaceImage *)t->sa->spacedata.first;
-                       ED_space_image_get_size(sima, &width, &height);
-                       frame_size[0] = width;
-                       frame_size[1] = height;
+                       ED_space_image_get_size_fl(sima, frame_size);
 
                        BKE_mask_coord_from_frame(co, cursor, frame_size);
 
index eea316920d30b0b8199153663c520984afa68518..0e129cb4dcbe2d85daeb8afc22558efc5c4432e2 100644 (file)
@@ -295,8 +295,8 @@ static void uvedit_pixel_to_float(SpaceImage *sima, float *dist, float pixeldist
                ED_space_image_get_size(sima, &width, &height);
        }
        else {
-               width = 256;
-               height = 256;
+               width =  IMG_SIZE_FALLBACK;
+               height = IMG_SIZE_FALLBACK;
        }
 
        dist[0] = pixeldist / width;