[gimp/goat-invasion] app: don't crash GimpOperationReplaceMode is mask is NULL
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/goat-invasion] app: don't crash GimpOperationReplaceMode is mask is NULL
- Date: Tue, 24 Apr 2012 19:43:12 +0000 (UTC)
commit 6e19a0941b7f2d6b4401974b6a8bfbfa5c73710e
Author: Michael Natterer <mitch gimp org>
Date: Tue Apr 24 21:42:41 2012 +0200
app: don't crash GimpOperationReplaceMode is mask is NULL
app/gegl/gimpoperationreplacemode.c | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/app/gegl/gimpoperationreplacemode.c b/app/gegl/gimpoperationreplacemode.c
index 55c3718..caeb7cb 100644
--- a/app/gegl/gimpoperationreplacemode.c
+++ b/app/gegl/gimpoperationreplacemode.c
@@ -177,10 +177,20 @@ gimp_operation_replace_mode_process (GeglOperation *operation,
while (samples--)
{
- gint b;
- gfloat new_alpha = (layer[ALPHA] - in[ALPHA]) * (*mask) * opacity + in[ALPHA];
- gfloat ratio = *mask * opacity;
- ratio = ratio / layer[ALPHA] / new_alpha;
+ gint b;
+ gfloat new_alpha;
+ gfloat ratio;
+
+ if (mask)
+ {
+ new_alpha = (layer[ALPHA] - in[ALPHA]) * (*mask) * opacity + in[ALPHA];
+ ratio = *mask * opacity / layer[ALPHA] / new_alpha;
+ }
+ else
+ {
+ new_alpha = (layer[ALPHA] - in[ALPHA]) * opacity + in[ALPHA];
+ ratio = opacity / layer[ALPHA] / new_alpha;
+ }
for (b = RED; b < ALPHA; b++)
{
@@ -202,8 +212,10 @@ gimp_operation_replace_mode_process (GeglOperation *operation,
in += 4;
layer += 4;
- mask += 1;
out += 4;
+
+ if (mask)
+ mask += 1;
}
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]