[gimp/metadata-browser] app: don't crash GimpOperationReplaceMode is mask is NULL
- From: Roman Joost <romanofski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/metadata-browser] app: don't crash GimpOperationReplaceMode is mask is NULL
- Date: Wed, 12 Sep 2012 23:56:38 +0000 (UTC)
commit cca8b4cf007b16529afa6e34f6cfc1c7034fbd5c
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]