Refactor view3d offscreen drawing to avoid having multiple boolean arguments
[blender-staging.git] / source / blender / editors / render / render_opengl.c
index a27026878e1cc23539efdf45f02ce2f56a6f8e24..a2d34ffefa88c689d9d268dc5019068c9778df5d 100644 (file)
@@ -353,11 +353,15 @@ static void screen_opengl_render_doit(OGLRender *oglrender, RenderResult *rr)
                ImBuf *ibuf_view;
                const int alpha_mode = (draw_sky) ? R_ADDSKY : R_ALPHAPREMUL;
 
+               unsigned int draw_flags = V3D_OFSDRAW_NONE;
+               draw_flags |= (oglrender->ofs_full_samples) ? V3D_OFSDRAW_USE_FULL_SAMPLE : 0;
+
                if (view_context) {
+                       draw_flags |= (draw_bgpic) ? V3D_OFSDRAW_USE_BACKGROUND : 0;
+
                        ibuf_view = ED_view3d_draw_offscreen_imbuf(
                               scene, v3d, ar, sizex, sizey,
-                              IB_rect, draw_bgpic,
-                              alpha_mode, oglrender->ofs_samples, oglrender->ofs_full_samples, viewname,
+                              IB_rect, draw_flags, alpha_mode, oglrender->ofs_samples, viewname,
                               oglrender->fx, oglrender->ofs, err_out);
 
                        /* for stamp only */
@@ -366,10 +370,11 @@ static void screen_opengl_render_doit(OGLRender *oglrender, RenderResult *rr)
                        }
                }
                else {
+                       draw_flags |= (V3D_OFSDRAW_USE_GPENCIL | V3D_OFSDRAW_USE_BACKGROUND);
                        ibuf_view = ED_view3d_draw_offscreen_imbuf_simple(
                                scene, scene->camera, oglrender->sizex, oglrender->sizey,
-                               IB_rect, OB_SOLID, false, true, true,
-                               alpha_mode, oglrender->ofs_samples, oglrender->ofs_full_samples, viewname,
+                               IB_rect, draw_flags, OB_SOLID,
+                               alpha_mode, oglrender->ofs_samples, viewname,
                                oglrender->fx, oglrender->ofs, err_out);
                        camera = scene->camera;
                }