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
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2019-07-21 00:01:19 +0300
committerAntonio Vazquez <blendergit@gmail.com>2019-07-30 18:11:56 +0300
commit7f29fc7415a49d5688efbe10fa0a81b174d49435 (patch)
tree5feca8d0936990eb434cd860e716fc7316773bfb /source/blender/draw
parentf69e57a53fab92d549a90a0198b86ff766ba0da2 (diff)
Fix T65691: GPencil Drawing long strokes turn invisible
There was a fixed limit to the number of points available in a buffer stroke. Now, the array is expanded as needed using a predefined number of points for each expansion, instead to add one by one. This is done to reduce the number of times the memory allocation is required. As part of the fix, some variables have been renamed to reflect better their use.
Diffstat (limited to 'source/blender/draw')
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c6
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_draw_utils.c6
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.c2
3 files changed, 7 insertions, 7 deletions
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 18950f00823..d5f8d062593 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -375,7 +375,7 @@ GPUBatch *gpencil_get_buffer_stroke_geom(bGPdata *gpd, short thickness)
Object *ob = draw_ctx->obact;
tGPspoint *points = gpd->runtime.sbuffer;
- int totpoints = gpd->runtime.sbuffer_size;
+ int totpoints = gpd->runtime.sbuffer_used;
/* if cyclic needs more vertex */
int cyclic_add = (gpd->runtime.sbuffer_sflag & GP_STROKE_CYCLIC) ? 1 : 0;
int totvertex = totpoints + cyclic_add + 2;
@@ -477,7 +477,7 @@ GPUBatch *gpencil_get_buffer_point_geom(bGPdata *gpd, short thickness)
Object *ob = draw_ctx->obact;
tGPspoint *points = gpd->runtime.sbuffer;
- int totpoints = gpd->runtime.sbuffer_size;
+ int totpoints = gpd->runtime.sbuffer_used;
static GPUVertFormat format = {0};
static uint pos_id, color_id, thickness_id, uvdata_id, prev_pos_id;
@@ -621,7 +621,7 @@ GPUBatch *gpencil_get_buffer_fill_geom(bGPdata *gpd)
}
const tGPspoint *points = gpd->runtime.sbuffer;
- int totpoints = gpd->runtime.sbuffer_size;
+ int totpoints = gpd->runtime.sbuffer_used;
if (totpoints < 3) {
return NULL;
}
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 181d2efbabb..9b755217946 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1493,7 +1493,7 @@ void gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data,
/* Check if may need to draw the active stroke cache, only if this layer is the active layer
* that is being edited. (Stroke buffer is currently stored in gp-data)
*/
- if (gpd->runtime.sbuffer_size > 0) {
+ if (gpd->runtime.sbuffer_used > 0) {
if ((gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0) {
/* It should also be noted that sbuffer contains temporary point types
* i.e. tGPspoints NOT bGPDspoints
@@ -1506,7 +1506,7 @@ void gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data,
stl->storage->alignment_mode = (gp_style) ? gp_style->alignment_mode : GP_STYLE_FOLLOW_PATH;
/* if only one point, don't need to draw buffer because the user has no time to see it */
- if (gpd->runtime.sbuffer_size > 1) {
+ if (gpd->runtime.sbuffer_used > 1) {
if ((gp_style) && (gp_style->mode == GP_STYLE_MODE_LINE)) {
stl->g_data->shgrps_drawing_stroke = gpencil_shgroup_stroke_create(
vedata,
@@ -1562,7 +1562,7 @@ void gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data,
DRW_shgroup_call(
stl->g_data->shgrps_drawing_stroke, stl->g_data->batch_buffer_stroke, NULL);
- if ((gpd->runtime.sbuffer_size >= 3) &&
+ if ((gpd->runtime.sbuffer_used >= 3) &&
(gpd->runtime.sfill[3] > GPENCIL_ALPHA_OPACITY_THRESH) &&
((gpd->runtime.sbuffer_sflag & GP_STROKE_NOFILL) == 0) &&
((brush->gpencil_settings->flag & GP_BRUSH_DISSABLE_LASSO) == 0) &&
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 5d7ec490fb6..16162645f3d 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -430,7 +430,7 @@ void GPENCIL_cache_init(void *vedata)
/* need the original to avoid cow overhead while drawing */
bGPdata *gpd_orig = (bGPdata *)DEG_get_original_id(&obact_gpd->id);
if (((gpd_orig->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0) &&
- (gpd_orig->runtime.sbuffer_size > 0) &&
+ (gpd_orig->runtime.sbuffer_used > 0) &&
((gpd_orig->flag & GP_DATA_STROKE_POLYGON) == 0) && !DRW_state_is_depth() &&
(stl->storage->background_ready == true)) {
stl->g_data->session_flag |= GP_DRW_PAINT_PAINTING;