[gimp/goat-invasion: 369/608] app: gegl dissolve layer-mode pedantic indentation
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/goat-invasion: 369/608] app: gegl dissolve layer-mode pedantic indentation
- Date: Fri, 27 Apr 2012 20:56:24 +0000 (UTC)
commit b95d5542823d38e311d6b69160717a891ce41a18
Author: Ãyvind KolÃs <pippin gimp org>
Date: Sat Mar 31 22:53:23 2012 +0100
app: gegl dissolve layer-mode pedantic indentation
app/gegl/gimpoperationdissolvemode.c | 69 +++++++++++++---------------------
1 files changed, 26 insertions(+), 43 deletions(-)
---
diff --git a/app/gegl/gimpoperationdissolvemode.c b/app/gegl/gimpoperationdissolvemode.c
index 9ca3ccd..67e3878 100644
--- a/app/gegl/gimpoperationdissolvemode.c
+++ b/app/gegl/gimpoperationdissolvemode.c
@@ -28,23 +28,23 @@
#include "gimpoperationdissolvemode.h"
-
-#define RANDOM_TABLE_SIZE 4096
-
-static void gimp_operation_dissolve_mode_prepare (GeglOperation *operation);
-static gboolean gimp_operation_dissolve_mode_process (GeglOperation *operation,
- void *in_buf,
- void *aux_buf,
- void *out_buf,
- glong samples,
- const GeglRectangle *result,
- gint level);
-
G_DEFINE_TYPE (GimpOperationDissolveMode, gimp_operation_dissolve_mode,
GIMP_TYPE_OPERATION_POINT_LAYER_MODE)
+#define RANDOM_TABLE_SIZE 4096
static gint32 random_table[RANDOM_TABLE_SIZE];
+static void gimp_operation_dissolve_mode_prepare (
+ GeglOperation *operation);
+static gboolean gimp_operation_dissolve_mode_process (
+ GeglOperation *operation,
+ void *in_buf,
+ void *aux_buf,
+ void *out_buf,
+ glong samples,
+ const GeglRectangle *result,
+ gint level);
+
static void
gimp_operation_dissolve_mode_class_init (GimpOperationDissolveModeClass *klass)
@@ -53,9 +53,8 @@ gimp_operation_dissolve_mode_class_init (GimpOperationDissolveModeClass *klass)
GeglOperationPointComposerClass *point_composer_class;
GRand *gr;
gint i;
- static gboolean table_initialized = FALSE;
- operation_class = GEGL_OPERATION_CLASS (klass);
+ operation_class = GEGL_OPERATION_CLASS (klass);
point_composer_class = GEGL_OPERATION_POINT_COMPOSER_CLASS (klass);
gegl_operation_class_set_keys (operation_class,
@@ -67,21 +66,12 @@ gimp_operation_dissolve_mode_class_init (GimpOperationDissolveModeClass *klass)
operation_class->prepare = gimp_operation_dissolve_mode_prepare;
point_composer_class->process = gimp_operation_dissolve_mode_process;
-#define RANDOM_SEED 314159265
-
- if (!table_initialized)
- {
- /* generate a table of random seeds */
- gr = g_rand_new_with_seed (RANDOM_SEED);
-
- for (i = 0; i < RANDOM_TABLE_SIZE; i++)
- {
- random_table[i] = g_rand_int (gr);
- }
+ /* generate a table of random seeds */
+ gr = g_rand_new_with_seed (314159265);
+ for (i = 0; i < RANDOM_TABLE_SIZE; i++)
+ random_table[i] = g_rand_int (gr);
- g_rand_free (gr);
- table_initialized = TRUE;
- }
+ g_rand_free (gr);
}
static void
@@ -92,12 +82,10 @@ gimp_operation_dissolve_mode_init (GimpOperationDissolveMode *self)
static void
gimp_operation_dissolve_mode_prepare (GeglOperation *operation)
{
- const Babl *format;
-
- format = babl_format ("R'G'B'A float");
+ const Babl *format = babl_format ("R'G'B'A float");
- gegl_operation_set_format (operation, "input", format);
- gegl_operation_set_format (operation, "aux", format);
+ gegl_operation_set_format (operation, "input", format);
+ gegl_operation_set_format (operation, "aux", format);
gegl_operation_set_format (operation, "output", format);
}
@@ -119,17 +107,13 @@ gimp_operation_dissolve_mode_process (GeglOperation *operation,
{
GRand *gr = g_rand_new_with_seed (random_table[y % RANDOM_TABLE_SIZE]);
- /* fast forward through this rows pseudo random sequence */
+ /* fast forward through the rows pseudo random sequence */
for (x = 0; x < result->x; x++)
g_rand_int (gr);
for (x = result->x; x < result->x + result->width; x++, i++)
{
- int rand_val;
- /* dissolve if random value is >= opacity */
- rand_val = g_rand_int_range (gr, 0, 255);
-
- if (rand_val >= aux[3] * 255)
+ if (g_rand_int_range (gr, 0, 255) >= aux[3] * 255)
{
out[0] = in[0];
out[1] = in[1];
@@ -143,10 +127,9 @@ gimp_operation_dissolve_mode_process (GeglOperation *operation,
out[2] = aux[2];
out[3] = 1.0;
}
-
- in+=4;
- out+=4;
- aux+=4;
+ in += 4;
+ out += 4;
+ aux += 4;
}
g_rand_free (gr);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]