[Bf-blender-cvs] [00636eb6186] greasepencil-object: Compiler warning fixes on GCC
Joshua Leung
noreply at git.blender.org
Tue Apr 17 12:57:14 CEST 2018
Commit: 00636eb61860fdf48408cb2c96c296ee448aa741
Author: Joshua Leung
Date: Tue Apr 17 12:20:36 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB00636eb61860fdf48408cb2c96c296ee448aa741
Compiler warning fixes on GCC
* gpencil_add_*_shgroup() - Removed unused parameters (gpd)
* Fix warning about rgba being uninitialised in gpencil_fill.c::get_pixel()
- The non-float case here looks like it shouldn't ever happen, but for good measure,
I've added an assert + set a value here to keep compiler happy.
* Fix uninitialised var in gp_brush_drawcursor() - paintbrush
* GPencilOffsetModifier defined an RNA vertex group name set function, but didn't use it
===================================================================
M source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M source/blender/editors/gpencil/gpencil_fill.c
M source/blender/editors/gpencil/gpencil_utils.c
M source/blender/makesrna/intern/rna_modifier.c
===================================================================
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index 4b9442da2be..1fee9dc7e50 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -312,7 +312,7 @@ static DRWShadingGroup *DRW_gpencil_shgroup_point_create(GPENCIL_e_data *e_data,
/* add fill shading group to pass */
static void gpencil_add_fill_shgroup(GpencilBatchCache *cache, DRWShadingGroup *fillgrp,
- Object *ob, bGPdata *gpd, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps,
+ Object *ob, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps,
const float tintcolor[4], const bool onion, const bool custonion)
{
if (gps->totpoints >= 3) {
@@ -345,7 +345,7 @@ static void gpencil_add_fill_shgroup(GpencilBatchCache *cache, DRWShadingGroup *
/* add stroke shading group to pass */
static void gpencil_add_stroke_shgroup(GpencilBatchCache *cache, DRWShadingGroup *strokegrp,
- Object *ob, bGPdata *gpd, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps,
+ Object *ob, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps,
const float opacity, const float tintcolor[4], const bool onion, const bool custonion)
{
float tcolor[4];
@@ -462,7 +462,7 @@ static void gpencil_draw_onion_strokes(GpencilBatchCache *cache, GPENCIL_e_data
}
/* stroke */
- gpencil_add_stroke_shgroup(cache, stl->shgroups[id].shgrps_stroke, ob, gpd, gpl, gpf, gps, opacity, tintcolor, true, custonion);
+ gpencil_add_stroke_shgroup(cache, stl->shgroups[id].shgrps_stroke, ob, gpl, gpf, gps, opacity, tintcolor, true, custonion);
stl->storage->shgroup_id++;
cache->cache_idx++;
@@ -594,11 +594,11 @@ static void gpencil_draw_strokes(GpencilBatchCache *cache, GPENCIL_e_data *e_dat
/* fill */
if ((fillgrp) && (!stl->storage->simplify_fill)) {
- gpencil_add_fill_shgroup(cache, fillgrp, ob, gpd, gpl, derived_gpf, gps, tintcolor, false, custonion);
+ gpencil_add_fill_shgroup(cache, fillgrp, ob, gpl, derived_gpf, gps, tintcolor, false, custonion);
}
/* stroke */
if (strokegrp) {
- gpencil_add_stroke_shgroup(cache, strokegrp, ob, gpd, gpl, derived_gpf, gps, opacity, tintcolor, false, custonion);
+ gpencil_add_stroke_shgroup(cache, strokegrp, ob, gpl, derived_gpf, gps, opacity, tintcolor, false, custonion);
}
}
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index 4a66ebebb30..ddf7c90a0a1 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -342,6 +342,7 @@ static void gp_render_offscreen(tGPDfill *tgpf)
GPU_offscreen_unbind(offscreen, true);
GPU_offscreen_free(offscreen);
}
+
/* return pixel data (rgba) at index */
static void get_pixel(ImBuf *ibuf, int idx, float r_col[4])
{
@@ -349,6 +350,13 @@ static void get_pixel(ImBuf *ibuf, int idx, float r_col[4])
float *frgba = &ibuf->rect_float[idx * 4];
copy_v4_v4(r_col, frgba);
}
+ else {
+ /* XXX: This case probably doesn't happen, as we only write to the float buffer,
+ * but we get compiler warnings about uninitialised vars otherwise
+ */
+ BLI_assert(!"gpencil_fill.c - get_pixel() non-float case is used!");
+ zero_v4(r_col);
+ }
}
/* set pixel data (rgba) at index */
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index e940eba78f0..b666fdbfa53 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1344,6 +1344,7 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *customdata)
GP_BrushEdit_Settings *gset = &scene->toolsettings->gp_sculpt;
bGPdata *gpd = ED_gpencil_data_get_active(C);
GP_EditBrush_Data *brush = NULL;
+ Brush *paintbrush = NULL;
int *last_mouse_position = customdata;
/* get current color */
@@ -1367,7 +1368,6 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *customdata)
else {
brush = &gset->brush[gset->brushtype];
}
- Brush *paintbrush;
/* default radius and color */
float radius = 3.0f;
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 6fe67acb4f7..5cba2e29682 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -5262,7 +5262,7 @@ static void rna_def_modifier_gpenciloffset(BlenderRNA *brna)
prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "vgname");
RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GpencilThickModifier_vgname_set");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GpencilOffsetModifier_vgname_set");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
More information about the Bf-blender-cvs
mailing list