[Bf-blender-cvs] [db750af9eb4] temp-gpencil-fill: GPencil: Change how processed areas cleared
Antonio Vazquez
noreply at git.blender.org
Sun Feb 7 19:14:37 CET 2021
Commit: db750af9eb42863568d1deb6b4bf357c1ee88da2
Author: Antonio Vazquez
Date: Sun Feb 7 19:14:10 2021 +0100
Branches: temp-gpencil-fill
https://developer.blender.org/rBdb750af9eb42863568d1deb6b4bf357c1ee88da2
GPencil: Change how processed areas cleared
===================================================================
M source/blender/editors/gpencil/gpencil_fill.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index 9345707a5bb..48d9134677d 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1046,21 +1046,37 @@ static void gpencil_erase_processed_area(tGPDfill *tgpf)
float rgba[4];
for (int idy = 0; idy < ibuf->y; idy++) {
- bool clear = false;
+ int init = -1;
+ int end = -1;
for (int idx = 0; idx < ibuf->x; idx++) {
int image_idx = ibuf->x * idy + idx;
get_pixel(ibuf, image_idx, rgba);
/* Blue. */
if (rgba[2] == 1.0f) {
- clear = true;
+ if (init < 0) {
+ init = image_idx;
+ }
+ else {
+ end = image_idx;
+ }
}
/* Red. */
else if (rgba[0] == 1.0f) {
- clear = false;
+ if (init > -1) {
+ for (int i = init; i <= max_ii(init, end); i++) {
+ set_pixel(ibuf, i, clear_col);
+ }
+ init = -1;
+ end = -1;
+ }
}
- if (clear) {
- set_pixel(ibuf, image_idx, clear_col);
+ }
+ /* Check last segment. */
+ if (init > -1) {
+ for (int i = init; i <= max_ii(init, end); i++) {
+ set_pixel(ibuf, i, clear_col);
}
+ set_pixel(ibuf, init, clear_col);
}
}
@@ -1286,7 +1302,6 @@ static void gpencil_get_outline_points(tGPDfill *tgpf, const bool dilate)
/* current pixel is equal to starting pixel */
if (boundary_co[0] == start_co[0] && boundary_co[1] == start_co[1]) {
BLI_stack_pop(tgpf->stack, &v);
- // boundary_found = true;
break;
}
}
More information about the Bf-blender-cvs
mailing list