Refactor view3d offscreen drawing to avoid having multiple boolean arguments
[blender-staging.git] / source / blender / blenkernel / intern / sequencer.c
index 9b0db300e6d326e2df8be31431c56336d3784905..592091b057f1a66e605f7a55d2a71d4023baddc9 100644 (file)
@@ -3295,11 +3295,17 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq
 
        if ((sequencer_view3d_cb && do_seq_gl && camera) && is_thread_main) {
                char err_out[256] = "unknown";
-               int width = (scene->r.xsch * scene->r.size) / 100;
-               int height = (scene->r.ysch * scene->r.size) / 100;
+               const int width = (scene->r.xsch * scene->r.size) / 100;
+               const int height = (scene->r.ysch * scene->r.size) / 100;
                const bool use_background = (scene->r.alphamode == R_ADDSKY);
                const char *viewname = BKE_scene_multiview_render_view_name_get(&scene->r, context->view_id);
 
+               unsigned int draw_flags = SEQ_OFSDRAW_NONE;
+               draw_flags |= (use_gpencil) ? SEQ_OFSDRAW_USE_GPENCIL : 0;
+               draw_flags |= (use_background) ? SEQ_OFSDRAW_USE_BACKGROUND : 0;
+               draw_flags |= (context->gpu_full_samples) ? SEQ_OFSDRAW_USE_FULL_SAMPLE : 0;
+               draw_flags |= (context->scene->r.seq_flag & R_SEQ_SOLID_TEX) ? SEQ_OFSDRAW_USE_SOLID_TEX : 0;
+
                /* for old scene this can be uninitialized,
                 * should probably be added to do_versions at some point if the functionality stays */
                if (context->scene->r.seq_prev_type == 0)
@@ -3309,11 +3315,8 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq
                BKE_scene_update_for_newframe(context->eval_ctx, context->bmain, scene, scene->lay);
                ibuf = sequencer_view3d_cb(
                        /* set for OpenGL render (NULL when scrubbing) */
-                       scene, camera, width, height, IB_rect,
-                       context->scene->r.seq_prev_type,
-                       (context->scene->r.seq_flag & R_SEQ_SOLID_TEX) != 0,
-                       use_gpencil, use_background, scene->r.alphamode,
-                       context->gpu_samples, context->gpu_full_samples, viewname,
+                       scene, camera, width, height, IB_rect, draw_flags, context->scene->r.seq_prev_type,
+                       scene->r.alphamode, context->gpu_samples, viewname,
                        context->gpu_fx, context->gpu_offscreen, err_out);
                if (ibuf == NULL) {
                        fprintf(stderr, "seq_render_scene_strip failed to get opengl buffer: %s\n", err_out);