fix for drawing non 1:1 aspect masks, transform and selection still need support.

This commit is contained in:
Campbell Barton 2012-09-13 02:28:48 +00:00
parent ab48f2108b
commit c5310521f8
5 changed files with 15 additions and 2 deletions

View File

@ -56,7 +56,8 @@ void ED_operatormacros_mask(void);
void ED_mask_draw(const bContext *C, const char draw_flag, const char draw_type);
void ED_mask_draw_region(struct Mask *mask, struct ARegion *ar,
const char draw_flag, const char draw_type,
int width, int height,
const int width_i, const int height_i,
const float aspx, const float aspy,
const short do_scale_applied, const short do_post_draw,
float stabmat[4][4],
const bContext *C);

View File

@ -496,7 +496,8 @@ void ED_mask_draw(const bContext *C,
* width, height are to match the values from ED_mask_get_size() */
void ED_mask_draw_region(Mask *mask, ARegion *ar,
const char draw_flag, const char draw_type,
int width, int height,
const int width_i, const int height_i, /* convert directly into aspect corrected vars */
const float aspx, const float aspy,
const short do_scale_applied, const short do_post_draw,
float stabmat[4][4], /* optional - only used by clip */
const bContext *C /* optional - only used when do_post_draw is set */
@ -504,6 +505,9 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar,
{
struct View2D *v2d = &ar->v2d;
/* aspect always scales vertically in movie and image spaces */
const float width = width_i, height = (float)height_i * (aspy / aspx);
int x, y;
/* int w, h; */
float zoomx, zoomy;

View File

@ -1131,10 +1131,13 @@ static void clip_main_area_draw(const bContext *C, ARegion *ar)
if (mask) {
ScrArea *sa = CTX_wm_area(C);
int width, height;
float aspx, aspy;
ED_mask_get_size(sa, &width, &height);
ED_space_clip_get_aspect(sc, &aspx, &aspy);
ED_mask_draw_region(mask, ar,
sc->mask_info.draw_flag, sc->mask_info.draw_type,
width, height,
aspx, aspy,
TRUE, TRUE,
sc->stabmat, C);
}

View File

@ -682,10 +682,13 @@ static void image_main_area_draw(const bContext *C, ARegion *ar)
if (mask) {
int width, height;
float aspx, aspy;
ED_space_image_get_size(sima, &width, &height);
ED_space_image_get_aspect(sima, &aspx, &aspy);
ED_mask_draw_region(mask, ar,
sima->mask_info.draw_flag, sima->mask_info.draw_type,
width, height,
aspx, aspy,
TRUE, FALSE,
NULL, C);

View File

@ -1049,6 +1049,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
if (mask) {
int width, height;
float aspx = 1.0f, aspy = 1.0f;
// ED_mask_get_size(C, &width, &height);
//Scene *scene = CTX_data_scene(C);
@ -1058,6 +1059,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
ED_mask_draw_region(mask, ar,
0, 0, /* TODO */
width, height,
aspx, aspy,
FALSE, TRUE,
NULL, C);
}