Cleanup: use const pointer for view access API
authorCampbell Barton <ideasman42@gmail.com>
Wed, 12 Apr 2017 02:10:01 +0000 (12:10 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 12 Apr 2017 02:10:01 +0000 (12:10 +1000)
source/blender/draw/engines/clay/clay.c
source/blender/draw/engines/eevee/eevee.c
source/blender/draw/intern/DRW_render.h
source/blender/draw/intern/draw_manager.c
source/blender/draw/modes/edit_mesh_mode.c
source/blender/draw/modes/object_mode.c

index 2bed03270647a80a8fb93b41666fe95e36816e7b..512ed7dfe73a399a1488bc8f3dea9c0aa9a04b8e 100644 (file)
@@ -340,7 +340,7 @@ static void CLAY_engine_init(void *vedata)
        }
 
        {
-               float *viewport_size = DRW_viewport_size_get();
+               const float *viewport_size = DRW_viewport_size_get();
                DRWFboTexture tex = {&txl->depth_dup, DRW_BUF_DEPTH_24, 0};
                DRW_framebuffer_init(&fbl->dupli_depth,
                                     (int)viewport_size[0], (int)viewport_size[1],
@@ -360,7 +360,7 @@ static void CLAY_engine_init(void *vedata)
                    {-1.0f, 1.0f, -1.0f, 1.0f}
                };
                int i;
-               float *size = DRW_viewport_size_get();
+               const float *size = DRW_viewport_size_get();
 
                DRW_get_dfdy_factors(dfdyfacs);
 
index 2013df35deb0a07efea26fa76a1bac2189343035..3b03d00e88285419bc034274126157e937c0017d 100644 (file)
@@ -65,7 +65,7 @@ static void EEVEE_engine_init(void *vedata)
 
        DRWFboTexture tex = {&txl->color, DRW_BUF_RGBA_16, DRW_TEX_FILTER};
 
-       float *viewport_size = DRW_viewport_size_get();
+       const float *viewport_size = DRW_viewport_size_get();
        DRW_framebuffer_init(&fbl->main,
                            (int)viewport_size[0], (int)viewport_size[1],
                            &tex, 1);
index a19e0c71155b995e7959207058464c06bfd2b9c4..0a7d4dcbfec64face5659588dca214ed6dfad5e1 100644 (file)
@@ -248,9 +248,9 @@ typedef enum {
 
 void DRW_viewport_init(const bContext *C);
 void DRW_viewport_matrix_get(float mat[4][4], DRWViewportMatrixType type);
-float *DRW_viewport_size_get(void);
-float *DRW_viewport_screenvecs_get(void);
-float *DRW_viewport_pixelsize_get(void);
+const float *DRW_viewport_size_get(void);
+const float *DRW_viewport_screenvecs_get(void);
+const float *DRW_viewport_pixelsize_get(void);
 bool DRW_viewport_is_persp_get(void);
 bool DRW_viewport_cache_is_dirty(void);
 
index fdf99f906c65ed29554236a959e6faf5b9a3fec7..5ad46a75da1ba60b6c452ef77ed7f39fbb39830f 100644 (file)
@@ -1318,17 +1318,17 @@ static void *DRW_viewport_engine_data_get(void *engine_type)
        return data;
 }
 
-float *DRW_viewport_size_get(void)
+const float *DRW_viewport_size_get(void)
 {
        return &DST.size[0];
 }
 
-float *DRW_viewport_screenvecs_get(void)
+const float *DRW_viewport_screenvecs_get(void)
 {
        return &DST.screenvecs[0][0];
 }
 
-float *DRW_viewport_pixelsize_get(void)
+const float *DRW_viewport_pixelsize_get(void)
 {
        return &DST.pixsize;
 }
index 1e4c58361199ce884e84a6a75af6235cd0fe80ce..dd3f7083b799a24efe19c7a58975b1073da5fdb3 100644 (file)
@@ -133,7 +133,7 @@ static void EDIT_MESH_engine_init(void *vedata)
        EDIT_MESH_TextureList *txl = ((EDIT_MESH_Data *)vedata)->txl;
        EDIT_MESH_FramebufferList *fbl = ((EDIT_MESH_Data *)vedata)->fbl;
 
-       float *viewport_size = DRW_viewport_size_get();
+       const float *viewport_size = DRW_viewport_size_get();
 
        DRWFboTexture tex[2] = {{
            &txl->occlude_wire_depth_tx, DRW_BUF_DEPTH_24, 0},
index 52c8878855713a1f88dfdb7092eb77e0fa91df79..fc1710421d9357c2a93db03cb3df840a711cab3e 100644 (file)
@@ -209,7 +209,7 @@ static void OBJECT_engine_init(void *vedata)
        OBJECT_TextureList *txl = ((OBJECT_Data *)vedata)->txl;
        OBJECT_FramebufferList *fbl = ((OBJECT_Data *)vedata)->fbl;
 
-       float *viewport_size = DRW_viewport_size_get();
+       const float *viewport_size = DRW_viewport_size_get();
 
        DRWFboTexture tex[2] = {{&txl->outlines_depth_tx, DRW_BUF_DEPTH_24, 0},
                                {&txl->outlines_color_tx, DRW_BUF_RGBA_8, DRW_TEX_FILTER}};