gimp r27485 - in trunk: . app/gegl
- From: martinn svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r27485 - in trunk: . app/gegl
- Date: Thu, 30 Oct 2008 23:18:35 +0000 (UTC)
Author: martinn
Date: Thu Oct 30 23:18:35 2008
New Revision: 27485
URL: http://svn.gnome.org/viewvc/gimp?rev=27485&view=rev
Log:
* app/gegl/gimpoperationpointlayermode.c
(gimp_operation_point_layer_mode_process): The GEGL API actually
allows us to handle the Dissolve layer mode as a point op. The
GEGL implementation of Dissolve uses a faster implementation for
deterministic behavior than the legacy Dissolve implementation.
The end result should be identical (although not on the
pixel-level).
Completely works the same:
o Dissolve
Modified:
trunk/ChangeLog
trunk/app/gegl/gimpoperationpointlayermode.c
Modified: trunk/app/gegl/gimpoperationpointlayermode.c
==============================================================================
--- trunk/app/gegl/gimpoperationpointlayermode.c (original)
+++ trunk/app/gegl/gimpoperationpointlayermode.c Thu Oct 30 23:18:35 2008
@@ -1,7 +1,7 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
- * gimpoperationpointcomposer.c
+ * gimpoperationpointlayermode.c
* Copyright (C) 2008 Michael Natterer <mitch gimp org>
* Copyright (C) 2008 Martin Nordholts <martinn svn gnome org>
*
@@ -280,13 +280,18 @@
{
GimpOperationPointLayerMode *self = GIMP_OPERATION_POINT_LAYER_MODE (operation);
- gfloat *in = in_buf; /* composite of layers below */
- gfloat *lay = aux_buf; /* layer */
- gfloat *out = out_buf; /* resulting composite */
- gint c = 0;
- gfloat new[3] = { 0.0, 0.0, 0.0 };
+ gfloat *in = in_buf; /* composite of layers below */
+ gfloat *lay = aux_buf; /* layer */
+ gfloat *out = out_buf; /* resulting composite */
+ GRand *rand = NULL;
+ glong sample = samples;
+ gint c = 0;
+ gfloat new[3] = { 0.0, 0.0, 0.0 };
- while (samples--)
+ if (self->blend_mode == GIMP_DISSOLVE_MODE)
+ rand = g_rand_new ();
+
+ while (sample--)
{
switch (self->blend_mode)
{
@@ -499,8 +504,29 @@
break;
case GIMP_DISSOLVE_MODE:
- /* Not a point filter and cannot be implemented here */
- /* g_assert_not_reached (); */
+ /* We need a deterministic result from Dissolve so let the
+ * seed depend on the pixel position (modulo 1024)
+ */
+ g_rand_set_seed (rand,
+ (roi->x + sample - (sample / roi->width) * roi->width) % 1024 *
+ (roi->y + sample / roi->width) % 1024);
+
+ if (layA * G_MAXUINT32 >= g_rand_int (rand))
+ {
+ EACH_CHANNEL(
+ outC = layC / layA);
+
+ /* Use general outA calculation */
+ layA = 1.0;
+ }
+ else
+ {
+ EACH_CHANNEL(
+ outC = inC);
+
+ /* Use general outA calculation */
+ layA = 0.0;
+ }
break;
default:
@@ -516,5 +542,8 @@
out += 4;
}
+ if (rand)
+ g_rand_free (rand);
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]