gimp r26362 - in trunk: . plug-ins/common
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26362 - in trunk: . plug-ins/common
- Date: Mon, 4 Aug 2008 14:27:38 +0000 (UTC)
Author: neo
Date: Mon Aug 4 14:27:38 2008
New Revision: 26362
URL: http://svn.gnome.org/viewvc/gimp?rev=26362&view=rev
Log:
2008-08-04 Sven Neumann <sven gimp org>
* plug-ins/common/value-propagate.c: applied patch from Liam
Quin
as attached to bug #546159. Fixes bad data access for black and
white propagation and removes unneeded calls to sqrt().
Modified:
trunk/ChangeLog
trunk/plug-ins/common/value-propagate.c
Modified: trunk/plug-ins/common/value-propagate.c
==============================================================================
--- trunk/plug-ins/common/value-propagate.c (original)
+++ trunk/plug-ins/common/value-propagate.c Mon Aug 4 14:27:38 2008
@@ -610,7 +610,7 @@
}
}
-static int
+static inline int
value_difference_check (guchar *pos1,
guchar *pos2,
gint ch)
@@ -636,11 +636,23 @@
guchar *here,
void **tmp)
{
- if (*tmp == NULL)
- *tmp = (void *) g_new (gfloat, 1);
- *(float *)*tmp = sqrt (channel_mask[0] * here[0] * here[0]
- + channel_mask[1] * here[1] * here[1]
- + channel_mask[2] * here[2] * here[2]);
+
+ switch (dtype)
+ {
+ case GIMP_RGB_IMAGE:
+ case GIMP_RGBA_IMAGE:
+ if (*tmp == NULL)
+ *tmp = (void *) g_new (gfloat, 1);
+ **(float **)tmp = channel_mask[0] * here[0] * here[0]
+ + channel_mask[1] * here[1] * here[1]
+ + channel_mask[2] * here[2] * here[2];
+ break;
+ case GIMP_GRAYA_IMAGE:
+ case GIMP_GRAY_IMAGE:
+ break;
+ default:
+ break;
+ }
}
static void
@@ -657,9 +669,9 @@
{
case GIMP_RGB_IMAGE:
case GIMP_RGBA_IMAGE:
- v_here = sqrt (channel_mask[0] * here[0] * here[0]
+ v_here = channel_mask[0] * here[0] * here[0]
+ channel_mask[1] * here[1] * here[1]
- + channel_mask[2] * here[2] * here[2]);
+ + channel_mask[2] * here[2] * here[2];
if (*(float *)tmp < v_here && value_difference_check(orig, here, 3))
{
*(float *)tmp = v_here;
@@ -683,11 +695,22 @@
guchar *here,
void **tmp)
{
- if (*tmp == NULL)
- *tmp = (void *) g_new (gfloat, 1);
- *(float *)*tmp = sqrt (channel_mask[0] * here[0] * here[0]
- + channel_mask[1] * here[1] * here[1]
- + channel_mask[2] * here[2] * here[2]);
+ switch (dtype)
+ {
+ case GIMP_RGB_IMAGE:
+ case GIMP_RGBA_IMAGE:
+ if (*tmp == NULL)
+ *tmp = (void *) g_new (gfloat, 1);
+ **(float **)tmp = (channel_mask[0] * here[0] * here[0]
+ + channel_mask[1] * here[1] * here[1]
+ + channel_mask[2] * here[2] * here[2]);
+ break;
+ case GIMP_GRAYA_IMAGE:
+ case GIMP_GRAY_IMAGE:
+ break;
+ default:
+ break;
+ }
}
static void
@@ -704,7 +727,7 @@
{
case GIMP_RGB_IMAGE:
case GIMP_RGBA_IMAGE:
- v_here = sqrt (channel_mask[0] * here[0] * here[0]
+ v_here = (channel_mask[0] * here[0] * here[0]
+ channel_mask[1] * here[1] * here[1]
+ channel_mask[2] * here[2] * here[2]);
if (v_here < *(float *)tmp && value_difference_check(orig, here, 3))
@@ -753,7 +776,7 @@
{
case GIMP_RGB_IMAGE:
case GIMP_RGBA_IMAGE:
- data->original_value = sqrt (channel_mask[0] * here[0] * here[0]
+ data->original_value = (channel_mask[0] * here[0] * here[0]
+ channel_mask[1] * here[1] * here[1]
+ channel_mask[2] * here[2] * here[2]);
break;
@@ -785,7 +808,7 @@
{
case GIMP_RGB_IMAGE:
case GIMP_RGBA_IMAGE:
- v_here = sqrt (channel_mask[0] * here[0] * here[0]
+ v_here = (channel_mask[0] * here[0] * here[0]
+ channel_mask[1] * here[1] * here[1]
+ channel_mask[2] * here[2] * here[2]);
if ((v_here <= data->minv) && value_difference_check(orig, here, 3))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]