Merge branch 'master' into blender2.8
[blender.git] / source / blender / editors / space_sequencer / sequencer_view.c
index cad2566..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;
@@ -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);
 
@@ -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;