Merge branch 'master' into blender2.8
[blender.git] / source / blender / editors / space_sequencer / sequencer_view.c
index deb37f8..88dcc3a 100644 (file)
@@ -70,7 +70,7 @@ typedef struct ImageSampleInfo {
        float linearcol[4];
 
        unsigned char *colp;
-       float *colfp;
+       const float *colfp;
 
        int draw;
 int color_manage;
@@ -82,7 +82,7 @@ static void sample_draw(const bContext *C, ARegion *ar, void *arg_info)
        ImageSampleInfo *info = arg_info;
 
        if (info->draw) {
-               ED_image_draw_info(scene, ar, info->color_manage, FALSE, info->channels,
+               ED_image_draw_info(scene, ar, info->color_manage, false, info->channels,
                                   info->x, info->y, info->colp, info->colfp,
                                   info->linearcol, NULL, NULL);
        }
@@ -91,13 +91,14 @@ static void sample_draw(const bContext *C, ARegion *ar, void *arg_info)
 static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
 {
        Main *bmain = CTX_data_main(C);
+       struct Depsgraph *depsgraph = CTX_data_depsgraph(C);
        Scene *scene = CTX_data_scene(C);
        SpaceSeq *sseq = (SpaceSeq *) CTX_wm_space_data(C);
        ARegion *ar = CTX_wm_region(C);
-       ImBuf *ibuf = sequencer_ibuf_get(bmain, scene, sseq, CFRA, 0);
+       ImBuf *ibuf = sequencer_ibuf_get(bmain, depsgraph, scene, sseq, CFRA, 0, NULL);
        ImageSampleInfo *info = op->customdata;
        float fx, fy;
-       
+
        if (ibuf == NULL) {
                IMB_freeImBuf(ibuf);
                info->draw = 0;
@@ -110,7 +111,7 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
        fy += (float) ibuf->y / 2.0f;
 
        if (fx >= 0.0f && fy >= 0.0f && fx < ibuf->x && fy < ibuf->y) {
-               float *fp;
+               const float *fp;
                unsigned char *cp;
                int x = (int) fx, y = (int) fy;
 
@@ -121,7 +122,7 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
 
                info->colp = NULL;
                info->colfp = NULL;
-               
+
                if (ibuf->rect) {
                        cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x);
 
@@ -140,7 +141,7 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
                        copy_v4_v4(info->linearcol, info->colf);
                        IMB_colormanagement_colorspace_to_scene_linear_v4(info->linearcol, false, ibuf->rect_colorspace);
 
-                       info->color_manage = TRUE;
+                       info->color_manage = true;
                }
                if (ibuf->rect_float) {
                        fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));
@@ -155,7 +156,7 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
                        copy_v4_v4(info->linearcol, info->colf);
                        BKE_sequencer_pixel_from_sequencer_space_v4(scene, info->linearcol);
 
-                       info->color_manage = TRUE;
+                       info->color_manage = true;
                }
        }
        else {
@@ -201,8 +202,11 @@ static int sample_modal(bContext *C, wmOperator *op, const wmEvent *event)
        switch (event->type) {
                case LEFTMOUSE:
                case RIGHTMOUSE: /* XXX hardcoded */
-                       sample_exit(C, op);
-                       return OPERATOR_CANCELLED;
+                       if (event->val == KM_RELEASE) {
+                               sample_exit(C, op);
+                               return OPERATOR_CANCELLED;
+                       }
+                       break;
                case MOUSEMOVE:
                        sample_apply(C, op, event);
                        break;
@@ -211,17 +215,15 @@ static int sample_modal(bContext *C, wmOperator *op, const wmEvent *event)
        return OPERATOR_RUNNING_MODAL;
 }
 
-static int sample_cancel(bContext *C, wmOperator *op)
+static void sample_cancel(bContext *C, wmOperator *op)
 {
        sample_exit(C, op);
-
-       return OPERATOR_CANCELLED;
 }
 
 static int sample_poll(bContext *C)
 {
        SpaceSeq *sseq = CTX_wm_space_seq(C);
-       return sseq && BKE_sequencer_editing_get(CTX_data_scene(C), FALSE) != NULL;
+       return sseq && BKE_sequencer_editing_get(CTX_data_scene(C), false) != NULL;
 }
 
 void SEQUENCER_OT_sample(wmOperatorType *ot)