Commit: 5814de65f9a074a65d4cb5e28787f644f268ee75 Author: Aaron Carlisle Date: Sun Dec 26 16:32:57 2021 -0500 Branches: master https://developer.blender.org/rB5814de65f9a074a65d4cb5e28787f644f268ee75
Cleanup: Store cursor location in tGPspoint as an array Fixes many instances of `-Wstringop-overread` warning on GCC 11 Differential Revision: https://developer.blender.org/D13672 =================================================================== M source/blender/draw/intern/draw_cache_impl_gpencil.c M source/blender/editors/gpencil/annotate_draw.c M source/blender/editors/gpencil/annotate_paint.c M source/blender/editors/gpencil/gpencil_fill.c M source/blender/editors/gpencil/gpencil_paint.c M source/blender/editors/gpencil/gpencil_primitive.c M source/blender/editors/gpencil/gpencil_utils.c M source/blender/editors/include/ED_gpencil.h =================================================================== diff --git a/source/blender/draw/intern/draw_cache_impl_gpencil.c b/source/blender/draw/intern/draw_cache_impl_gpencil.c index 483e52ed547..ddad07a7476 100644 --- a/source/blender/draw/intern/draw_cache_impl_gpencil.c +++ b/source/blender/draw/intern/draw_cache_impl_gpencil.c @@ -642,7 +642,7 @@ static void gpencil_sbuffer_stroke_ensure(bGPdata *gpd, bool do_stroke, bool do_ float(*tpoints2d)[2] = MEM_mallocN(sizeof(*tpoints2d) * vert_len, __func__); /* Triangulate in 2D. */ for (int i = 0; i < vert_len; i++) { - copy_v2_v2(tpoints2d[i], &tpoints[i].x); + copy_v2_v2(tpoints2d[i], tpoints[i].m_xy); } /* Compute directly inside the IBO data buffer. */ /* OPTI: This is a bottleneck if the stroke is very long. */ diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c index 3705ea38e11..ae00fc41f40 100644 --- a/source/blender/editors/gpencil/annotate_draw.c +++ b/source/blender/editors/gpencil/annotate_draw.c @@ -165,7 +165,7 @@ static void annotation_draw_stroke_buffer(bGPdata *gps, immBindBuiltinProgram(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA); immUniformColor3fvAlpha(ink, ink[3]); immBegin(GPU_PRIM_POINTS, 1); - immVertex2fv(pos, &pt->x); + immVertex2fv(pos, pt->m_xy); } else { float oldpressure = points[0].pressure; @@ -191,7 +191,7 @@ static void annotation_draw_stroke_buffer(bGPdata *gps, if (fabsf(pt->pressure - oldpressure) > 0.2f) { /* need to have 2 points to avoid immEnd assert error */ if (draw_points < 2) { - immVertex2fv(pos, &(pt - 1)->x); + immVertex2fv(pos, (pt - 1)->m_xy); } immEnd(); @@ -202,7 +202,7 @@ static void annotation_draw_stroke_buffer(bGPdata *gps, /* need to roll-back one point to ensure that there are no gaps in the stroke */ if (i != 0) { - immVertex2fv(pos, &(pt - 1)->x); + immVertex2fv(pos, (pt - 1)->m_xy); draw_points++; } @@ -210,12 +210,12 @@ static void annotation_draw_stroke_buffer(bGPdata *gps, } /* now the point we want */ - immVertex2fv(pos, &pt->x); + immVertex2fv(pos, pt->m_xy); draw_points++; } /* need to have 2 points to avoid immEnd assert error */ if (draw_points < 2) { - immVertex2fv(pos, &(pt - 1)->x); + immVertex2fv(pos, (pt - 1)->m_xy); } } @@ -227,14 +227,14 @@ static void annotation_draw_stroke_buffer(bGPdata *gps, if ((sflag & GP_STROKE_USE_ARROW_END) && (runtime.arrow_end_style != GP_STROKE_ARROWSTYLE_NONE)) { float end[2]; - copy_v2_fl2(end, points[1].x, points[1].y); + copy_v2_v2(end, points[1].m_xy); annotation_draw_stroke_arrow_buffer(pos, end, runtime.arrow_end, runtime.arrow_end_style); } /* Draw starting arrow stroke. */ if ((sflag & GP_STROKE_USE_ARROW_START) && (runtime.arrow_start_style != GP_STROKE_ARROWSTYLE_NONE)) { float start[2]; - copy_v2_fl2(start, points[0].x, points[0].y); + copy_v2_v2(start, points[0].m_xy); annotation_draw_stroke_arrow_buffer( pos, start, runtime.arrow_start, runtime.arrow_start_style); } diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index 8d7fd295c8d..196cd1028ea 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -426,25 +426,25 @@ static void annotation_smooth_buffer(tGPsdata *p, float inf, int idx) /* Compute smoothed coordinate by taking the ones nearby */ if (pta) { - copy_v2_v2(a, &pta->x); + copy_v2_v2(a, pta->m_xy); madd_v2_v2fl(sco, a, average_fac); } if (ptb) { - copy_v2_v2(b, &ptb->x); + copy_v2_v2(b, ptb->m_xy); madd_v2_v2fl(sco, b, average_fac); } if (ptc) { - copy_v2_v2(c, &ptc->x); + copy_v2_v2(c, ptc->m_xy); madd_v2_v2fl(sco, c, average_fac); } if (ptd) { - copy_v2_v2(d, &ptd->x); + copy_v2_v2(d, ptd->m_xy); madd_v2_v2fl(sco, d, average_fac); } /* Based on influence factor, blend between original and optimal smoothed coordinate */ interp_v2_v2v2(c, c, sco, inf); - copy_v2_v2(&ptc->x, c); + copy_v2_v2(ptc->m_xy, c); } static void annotation_stroke_arrow_calc_points_segment(float stroke_points[8], @@ -492,8 +492,8 @@ static void annotation_stroke_arrow_calc_points(tGPspoint *point, case GP_STROKE_ARROWSTYLE_CLOSED: mul_v2_fl(norm_dir, arrow_length); if (point != NULL) { - add_v2_v2(&point->x, norm_dir); - copy_v2_v2(corner, &point->x); + add_v2_v2(point->m_xy, norm_dir); + copy_v2_v2(corner, point->m_xy); } annotation_stroke_arrow_calc_points_segment(stroke_points, corner, @@ -507,8 +507,8 @@ static void annotation_stroke_arrow_calc_points(tGPspoint *point, case GP_STROKE_ARROWSTYLE_SQUARE: mul_v2_fl(norm_dir, arrow_length * 1.5f); if (point != NULL) { - add_v2_v2(&point->x, norm_dir); - copy_v2_v2(corner, &point->x); + add_v2_v2(point->m_xy, norm_dir); + copy_v2_v2(corner, point->m_xy); } annotation_stroke_arrow_calc_points_segment(stroke_points, corner, @@ -544,7 +544,7 @@ static short annotation_stroke_addpoint(tGPsdata *p, pt = (tGPspoint *)(gpd->runtime.sbuffer); /* store settings */ - copy_v2_v2(&pt->x, mval); + copy_v2_v2(pt->m_xy, mval); /* T44932 - Pressure vals are unreliable, so ignore for now */ pt->pressure = 1.0f; pt->strength = 1.0f; @@ -560,7 +560,7 @@ static short annotation_stroke_addpoint(tGPsdata *p, pt = ((tGPspoint *)(gpd->runtime.sbuffer) + 1); /* store settings */ - copy_v2_v2(&pt->x, mval); + copy_v2_v2(pt->m_xy, mval); /* T44932 - Pressure vals are unreliable, so ignore for now */ pt->pressure = 1.0f; pt->strength = 1.0f; @@ -573,10 +573,10 @@ static short annotation_stroke_addpoint(tGPsdata *p, if (gpd->runtime.sbuffer_sflag & (GP_STROKE_USE_ARROW_START | GP_STROKE_USE_ARROW_END)) { /* Store start and end point coords for arrows. */ float end[2]; - copy_v2_v2(end, &pt->x); + copy_v2_v2(end, pt->m_xy); pt = ((tGPspoint *)(gpd->runtime.sbuffer)); float start[2]; - copy_v2_v2(start, &pt->x); + copy_v2_v2(start, pt->m_xy); /* Arrow end corner. */ if (gpd->runtime.sbuffer_sflag & GP_STROKE_USE_ARROW_END) { @@ -609,7 +609,7 @@ static short annotation_stroke_addpoint(tGPsdata *p, pt = ((tGPspoint *)(gpd->runtime.sbuffer) + gpd->runtime.sbuffer_used); /* store settings */ - copy_v2_v2(&pt->x, mval); + copy_v2_v2(pt->m_xy, mval); pt->pressure = pressure; /* Unused for annotations, but initialize for easier conversions to GP Object. */ pt->strength = 1.0f; @@ -636,7 +636,7 @@ static short annotation_stroke_addpoint(tGPsdata *p, pt = (tGPspoint *)gpd->runtime.sbuffer; /* store settings */ - copy_v2_v2(&pt->x, mval); + copy_v2_v2(pt->m_xy, mval); /* T44932 - Pressure vals are unreliable, so ignore for now */ pt->pressure = 1.0f; pt->strength = 1.0f; @@ -678,7 +678,7 @@ static short annotation_stroke_addpoint(tGPsdata *p, } /* convert screen-coordinates to appropriate coordinates (and store them) */ - annotation_stroke_convertcoords(p, &pt->x, &pts->x, NULL); + annotation_stroke_convertcoords(p, pt->m_xy, &pts->x, NULL); /* copy pressure and time */ pts->pressure = pt->pressure; @@ -717,8 +717,8 @@ static void annotation_stroke_arrow_init_point( { /* NOTE: provided co_idx should be always pair number as it's [x1, y1, x2, y2, x3, y3]. */ const float real_co[2] = {co[co_idx], co[co_idx + 1]}; - copy_v2_v2(&ptc->x, real_co); - annotation_stroke_convertcoords(p, &ptc->x, &pt->x, NULL); + copy_v2_v2(ptc->m_xy, real_co); + annotation_stroke_convertcoords(p, ptc->m_xy, &pt->x, NULL); annotation_stroke_arrow_init_point_default(pt); } @@ -885,7 +885,7 @@ static void annotation_stroke_newfrombuffer(tGPsdata *p) ptc = gpd->runtime.sbuffer; /* convert screen-coordinates to appropriate coordinates (and store them) */ - annotation_stroke_convertcoords(p, &ptc->x, &pt->x, NULL); + annotation_stroke_convertcoords(p, ptc->m_xy, &pt->x, NULL); /* copy pressure and time */ pt->pressure = ptc->pressure; @@ -903,7 +903,7 @@ static void annotation_stroke_newfrombuffer(tGPsdata *p) ptc = ((tGPspoint *)runtime.sbuffer) + (runtime.sbuffer_used - 1); /* Convert screen-coordinates to appropriate coordinates (and store them). */ - annotation_stroke_convertcoords(p, &ptc->x, &pt->x, NULL); + annotation_stroke_convertcoords(p, ptc->m_xy, &pt->x, NULL); /* Copy pressure and time. */ pt->pressure = ptc->pressure; @@ -926,7 +926,7 @@ static void annotation_stroke_newfrombuffer(tGPsdata *p) /* End point. */ ptc = ((tGPspoint *)runtime.sbuffer) + (runtime.sbuffer_used - 1); - annotation_stroke_convertcoords(p, &ptc->x, &pt->x, NULL); + annotation_stroke_convertcoords(p, ptc->m_xy, &pt->x, NULL); annotation_stroke_arrow_init_point_default(pt); /* Fill and convert arrow points to create arrow shape. */ @@ -947,7 +947,7 @@ static void annotation_stroke_newfrombuffer(tGPsdata *p) /* Start point. */ ptc = runtime.sbuffer; - annotation_stroke_convertcoords(p, &ptc->x, &pt->x, NULL); + annotation_stroke_convertcoords(p, ptc->m_xy, &pt->x, NULL); annotation_stroke_arrow_init_point_default(pt); /* Fill and convert arrow points to create arrow shape. */ @@ -961,7 +961,7 @@ static void annotation_stroke_newfrombuffer(tGPsdata *p) ptc = gpd->runtime.sbuffer; /* convert screen-coordinates to appropriate coordinates (and store them) */ - annotation_stroke_convertcoords(p, &ptc->x, &pt->x, NULL); + @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list [email protected] List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
