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:
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_fill.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_fill.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index 8be34a35ca9..069493025dc 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1097,7 +1097,7 @@ static void gpencil_erase_processed_area(tGPDfill *tgpf)
/**
* Naive dilate
*
- * Expand green areas into enclosing red areas.
+ * Expand green areas into enclosing red or transparent areas.
* Using stack prevents creep when replacing colors directly.
* <pre>
* -----------
@@ -1110,8 +1110,8 @@ static void gpencil_erase_processed_area(tGPDfill *tgpf)
*/
static bool dilate_shape(ImBuf *ibuf)
{
-#define IS_RED (color[0] == 1.0f)
#define IS_GREEN (color[1] == 1.0f)
+#define IS_NOT_GREEN (color[1] != 1.0f)
bool done = false;
@@ -1140,7 +1140,7 @@ static bool dilate_shape(ImBuf *ibuf)
if (v - 1 >= 0) {
index = v - 1;
get_pixel(ibuf, index, color);
- if (IS_RED) {
+ if (IS_NOT_GREEN) {
BLI_stack_push(stack, &index);
lt = index;
}
@@ -1149,7 +1149,7 @@ static bool dilate_shape(ImBuf *ibuf)
if (v + 1 <= maxpixel) {
index = v + 1;
get_pixel(ibuf, index, color);
- if (IS_RED) {
+ if (IS_NOT_GREEN) {
BLI_stack_push(stack, &index);
rt = index;
}
@@ -1158,7 +1158,7 @@ static bool dilate_shape(ImBuf *ibuf)
if (v + ibuf->x <= max_size) {
index = v + ibuf->x;
get_pixel(ibuf, index, color);
- if (IS_RED) {
+ if (IS_NOT_GREEN) {
BLI_stack_push(stack, &index);
tp = index;
}
@@ -1167,7 +1167,7 @@ static bool dilate_shape(ImBuf *ibuf)
if (v - ibuf->x >= 0) {
index = v - ibuf->x;
get_pixel(ibuf, index, color);
- if (IS_RED) {
+ if (IS_NOT_GREEN) {
BLI_stack_push(stack, &index);
bm = index;
}
@@ -1176,7 +1176,7 @@ static bool dilate_shape(ImBuf *ibuf)
if (tp && lt) {
index = tp - 1;
get_pixel(ibuf, index, color);
- if (IS_RED) {
+ if (IS_NOT_GREEN) {
BLI_stack_push(stack, &index);
}
}
@@ -1184,7 +1184,7 @@ static bool dilate_shape(ImBuf *ibuf)
if (tp && rt) {
index = tp + 1;
get_pixel(ibuf, index, color);
- if (IS_RED) {
+ if (IS_NOT_GREEN) {
BLI_stack_push(stack, &index);
}
}
@@ -1192,7 +1192,7 @@ static bool dilate_shape(ImBuf *ibuf)
if (bm && lt) {
index = bm - 1;
get_pixel(ibuf, index, color);
- if (IS_RED) {
+ if (IS_NOT_GREEN) {
BLI_stack_push(stack, &index);
}
}
@@ -1200,7 +1200,7 @@ static bool dilate_shape(ImBuf *ibuf)
if (bm && rt) {
index = bm + 1;
get_pixel(ibuf, index, color);
- if (IS_RED) {
+ if (IS_NOT_GREEN) {
BLI_stack_push(stack, &index);
}
}
@@ -1218,8 +1218,8 @@ static bool dilate_shape(ImBuf *ibuf)
return done;
-#undef IS_RED
#undef IS_GREEN
+#undef IS_NOT_GREEN
}
/**
@@ -1239,7 +1239,7 @@ static bool contract_shape(ImBuf *ibuf)
const float clear[4] = {0.0f, 0.0f, 0.0f, 0.0f};
const int max_size = (ibuf->x * ibuf->y) - 1;
- /* Detect if pixel is near of no green pixels and mark green to be cleared. */
+ /* Detect if pixel is near of no green pixels and mark green pixel to be cleared. */
for (int row = 0; row < ibuf->y; row++) {
if (!is_row_filled(ibuf, row)) {
continue;
@@ -2172,7 +2172,8 @@ static int gpencil_fill_modal(bContext *C, wmOperator *op, const wmEvent *event)
tgpf->on_back = RNA_boolean_get(op->ptr, "on_back");
const bool is_brush_inv = brush_settings->fill_direction == BRUSH_DIR_IN;
- const bool is_inverted = (is_brush_inv && !event->ctrl) || (!is_brush_inv && event->ctrl);
+ const bool is_inverted = (is_brush_inv && (event->modifier & KM_CTRL) == 0) ||
+ (!is_brush_inv && (event->modifier & KM_CTRL) != 0);
const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(tgpf->gpd);
const bool do_extend = (tgpf->fill_extend_fac > 0.0f);
const bool help_lines = ((tgpf->flag & GP_BRUSH_FILL_SHOW_HELPLINES) ||
@@ -2313,7 +2314,7 @@ static int gpencil_fill_modal(bContext *C, wmOperator *op, const wmEvent *event)
case EVT_PAGEUPKEY:
case WHEELUPMOUSE:
if (tgpf->oldkey == 1) {
- tgpf->fill_extend_fac -= (event->shift) ? 0.01f : 0.1f;
+ tgpf->fill_extend_fac -= (event->modifier & KM_SHIFT) ? 0.01f : 0.1f;
CLAMP_MIN(tgpf->fill_extend_fac, 0.0f);
gpencil_update_extend(tgpf);
}
@@ -2321,7 +2322,7 @@ static int gpencil_fill_modal(bContext *C, wmOperator *op, const wmEvent *event)
case EVT_PAGEDOWNKEY:
case WHEELDOWNMOUSE:
if (tgpf->oldkey == 1) {
- tgpf->fill_extend_fac += (event->shift) ? 0.01f : 0.1f;
+ tgpf->fill_extend_fac += (event->modifier & KM_SHIFT) ? 0.01f : 0.1f;
CLAMP_MAX(tgpf->fill_extend_fac, 100.0f);
gpencil_update_extend(tgpf);
}