Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-09-13 17:18:18 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-09-13 17:51:51 +0300
commit6b0d1ef7e118f679fb5dacac184a7e72fef6142e (patch)
treec514f73902d4b533104ff182047ffe2373691c4c /source
parent27b82bbb75c5fd527b6b22682f8d173f6040644a (diff)
Cleanup: compiler warnings
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenfont/intern/blf_font.c7
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c23
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c14
3 files changed, 29 insertions, 15 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 1369240f0e2..d75da6a126f 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -312,6 +312,9 @@ static void blf_font_ensure_ascii_kerning(FontBLF *font, const FT_UInt kern_mode
_g = blf_glyph_add(_font, FT_Get_Char_Index((_font)->face, _c), _c); \
} \
} \
+ else { \
+ _g = NULL; \
+ } \
(void)0
#define BLF_KERNING_VARS(_font, _has_kerning, _kern_mode) \
@@ -677,7 +680,7 @@ static bool blf_font_width_to_strlen_glyph_process(FontBLF *font,
size_t blf_font_width_to_strlen(
FontBLF *font, const char *str, size_t len, float width, float *r_width)
{
- unsigned int c, c_prev;
+ unsigned int c, c_prev = BLI_UTF8_ERR;
GlyphBLF *g, *g_prev;
int pen_x, width_new;
size_t i, i_prev;
@@ -711,7 +714,7 @@ size_t blf_font_width_to_strlen(
size_t blf_font_width_to_rstrlen(
FontBLF *font, const char *str, size_t len, float width, float *r_width)
{
- unsigned int c, c_prev;
+ unsigned int c, c_prev = BLI_UTF8_ERR;
GlyphBLF *g, *g_prev;
int pen_x, width_new;
size_t i, i_prev, i_tmp;
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index d2173ed0d96..c764933fcf0 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -775,17 +775,19 @@ static int paint_space_stroke(bContext *C,
Brush *brush = BKE_paint_brush(paint);
int cnt = 0;
- float pressure, dpressure;
- float mouse[2], dmouse[2];
- float world_space_position[3], d_world_space_position[3], final_world_space_position[3];
- float length;
+ const bool use_scene_spacing = paint_stroke_use_scene_spacing(brush, mode);
+ float d_world_space_position[3] = {0.0f};
+
float no_pressure_spacing = paint_space_stroke_spacing(C, scene, stroke, 1.0f, 1.0f);
- pressure = stroke->last_pressure;
- dpressure = final_pressure - stroke->last_pressure;
+ float pressure = stroke->last_pressure;
+ float dpressure = final_pressure - stroke->last_pressure;
+
+ float dmouse[2];
sub_v2_v2v2(dmouse, final_mouse, stroke->last_mouse_position);
- length = normalize_v2(dmouse);
+ float length = normalize_v2(dmouse);
- if (paint_stroke_use_scene_spacing(brush, mode)) {
+ if (use_scene_spacing) {
+ float world_space_position[3];
bool hit = sculpt_stroke_get_location(C, world_space_position, final_mouse);
mul_m4_v3(stroke->vc.obact->obmat, world_space_position);
if (hit && stroke->stroke_over_mesh) {
@@ -795,6 +797,7 @@ static int paint_space_stroke(bContext *C,
}
else {
length = 0.0f;
+ zero_v3(d_world_space_position);
stroke->stroke_over_mesh = hit;
if (stroke->stroke_over_mesh) {
copy_v3_v3(stroke->last_world_space_position, world_space_position);
@@ -805,9 +808,11 @@ static int paint_space_stroke(bContext *C,
while (length > 0.0f) {
float spacing = paint_space_stroke_spacing_variable(
C, scene, stroke, pressure, dpressure, length);
+ float mouse[2];
if (length >= spacing) {
- if (paint_stroke_use_scene_spacing(brush, mode)) {
+ if (use_scene_spacing) {
+ float final_world_space_position[3];
normalize_v3(d_world_space_position);
mul_v3_v3fl(final_world_space_position, d_world_space_position, spacing);
add_v3_v3v3(final_world_space_position,
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index add3a154c93..12ed8d4de70 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -452,7 +452,10 @@ static void gpu_pbvh_grid_fill_index_buffers(
}
grid_visible = true;
}
- GPU_indexbuf_add_line_verts(&elb_lines, v1, v2);
+
+ if (grid_visible) {
+ GPU_indexbuf_add_line_verts(&elb_lines, v1, v2);
+ }
}
if (grid_visible) {
@@ -504,7 +507,10 @@ static void gpu_pbvh_grid_fill_index_buffers(
}
grid_visible = true;
}
- GPU_indexbuf_add_line_verts(&elb_lines, v1, v2);
+
+ if (grid_visible) {
+ GPU_indexbuf_add_line_verts(&elb_lines, v1, v2);
+ }
}
if (grid_visible) {
@@ -803,7 +809,7 @@ void GPU_pbvh_bmesh_buffers_update(GPU_PBVH_Buffers *buffers,
const bool show_vcol = (update_flags & GPU_PBVH_BUFFERS_SHOW_VCOL) != 0;
int tottri, totvert, maxvert = 0;
bool empty_mask = true;
- BMFace *f;
+ BMFace *f = NULL;
/* Count visible triangles */
tottri = gpu_bmesh_face_visible_count(bm_faces);
@@ -972,7 +978,7 @@ void GPU_pbvh_bmesh_buffers_update(GPU_PBVH_Buffers *buffers,
}
/* Get material index from the last face we iterated on. */
- buffers->material_index = f->mat_nr;
+ buffers->material_index = (f) ? f->mat_nr : 0;
buffers->show_mask = !empty_mask;