diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-24 23:29:24 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-24 23:29:24 +0400 |
commit | 8509e94d3ad69aaa2bb3b14c5669ea9d596e3fd0 (patch) | |
tree | f0d901361b5f0572c33a2520fca65a2be204903b /source/blender/editors/space_sequencer | |
parent | 72a106d56f4a224054aad911222a8206fd86b51d (diff) |
initial commit for supporting masks in the image view, currently active seq strip is used as the mask source.
also unify mask drawing code for clip/sequencer/image
Diffstat (limited to 'source/blender/editors/space_sequencer')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_draw.c | 67 |
1 files changed, 11 insertions, 56 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 09bfa384db0..ac2f8a7a34c 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -798,61 +798,6 @@ static void UNUSED_FUNCTION(set_special_seq_update) (int val) else special_seq_update = NULL; } -static void sequencer_main_area_draw_mask(const bContext *C, Scene *scene, ARegion *ar) -{ - Mask *mask = BKE_sequencer_mask_get(scene); - - if (mask) { - struct View2D *v2d = &ar->v2d; - - int x, y; - int width, height; - float zoomx, zoomy; - - /* frame image */ - float maxdim; - float xofs, yofs; - - /* find window pixel coordinates of origin */ - UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x, &y); - - width = v2d->tot.xmax - v2d->tot.xmin; - height = v2d->tot.ymax - v2d->tot.ymin; - - zoomx = (float)(ar->winrct.xmax - ar->winrct.xmin + 1) / (float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin)); - zoomy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1) / (float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin)); - - x += v2d->tot.xmin * zoomx; - y += v2d->tot.ymin * zoomy; - - /* frame the image */ - maxdim = maxf(width, height); - if (width == height) { - xofs = yofs = 0; - } - else if (width < height) { - xofs = ((height - width) / -2.0f) * zoomx; - yofs = 0.0f; - } - else { /* (width > height) */ - xofs = 0.0f; - yofs = ((width - height) / -2.0f) * zoomy; - } - - /* apply transformation so mask editing tools will assume drawing from the origin in normalized space */ - glPushMatrix(); - glTranslatef(x + xofs, y + yofs, 0); - glScalef(maxdim * zoomx, maxdim * zoomy, 0); - - ED_mask_draw((bContext *)C, 0, 0); // sc->mask_draw_flag, sc->mask_draw_type - - ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); - - glPopMatrix(); - } -} - - void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs) { struct Main *bmain = CTX_data_main(C); @@ -1047,7 +992,17 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq //if (sc->mode == SC_MODE_MASKEDIT) { if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) { - sequencer_main_area_draw_mask(C, scene, ar); + Mask *mask = BKE_sequencer_mask_get(scene); + + if (mask) { + int width, height; + ED_mask_size(C, &width, &height); + ED_mask_draw_region(mask, ar, + 0, 0, /* TODO */ + width, height, + FALSE, TRUE, + NULL, C); + } } } |