app: gegl dissolve layer-mode pedantic indentation
This commit is contained in:

committed by
Michael Natterer

parent
3b043a1597
commit
671164a0fe
@ -28,23 +28,23 @@
|
|||||||
|
|
||||||
#include "gimpoperationdissolvemode.h"
|
#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,
|
G_DEFINE_TYPE (GimpOperationDissolveMode, gimp_operation_dissolve_mode,
|
||||||
GIMP_TYPE_OPERATION_POINT_LAYER_MODE)
|
GIMP_TYPE_OPERATION_POINT_LAYER_MODE)
|
||||||
|
|
||||||
|
#define RANDOM_TABLE_SIZE 4096
|
||||||
static gint32 random_table[RANDOM_TABLE_SIZE];
|
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
|
static void
|
||||||
gimp_operation_dissolve_mode_class_init (GimpOperationDissolveModeClass *klass)
|
gimp_operation_dissolve_mode_class_init (GimpOperationDissolveModeClass *klass)
|
||||||
@ -53,9 +53,8 @@ gimp_operation_dissolve_mode_class_init (GimpOperationDissolveModeClass *klass)
|
|||||||
GeglOperationPointComposerClass *point_composer_class;
|
GeglOperationPointComposerClass *point_composer_class;
|
||||||
GRand *gr;
|
GRand *gr;
|
||||||
gint i;
|
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);
|
point_composer_class = GEGL_OPERATION_POINT_COMPOSER_CLASS (klass);
|
||||||
|
|
||||||
gegl_operation_class_set_keys (operation_class,
|
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;
|
operation_class->prepare = gimp_operation_dissolve_mode_prepare;
|
||||||
point_composer_class->process = gimp_operation_dissolve_mode_process;
|
point_composer_class->process = gimp_operation_dissolve_mode_process;
|
||||||
|
|
||||||
#define RANDOM_SEED 314159265
|
/* 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);
|
||||||
|
|
||||||
if (!table_initialized)
|
g_rand_free (gr);
|
||||||
{
|
|
||||||
/* 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_rand_free (gr);
|
|
||||||
table_initialized = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -92,12 +82,10 @@ gimp_operation_dissolve_mode_init (GimpOperationDissolveMode *self)
|
|||||||
static void
|
static void
|
||||||
gimp_operation_dissolve_mode_prepare (GeglOperation *operation)
|
gimp_operation_dissolve_mode_prepare (GeglOperation *operation)
|
||||||
{
|
{
|
||||||
const Babl *format;
|
const Babl *format = babl_format ("R'G'B'A float");
|
||||||
|
|
||||||
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);
|
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]);
|
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++)
|
for (x = 0; x < result->x; x++)
|
||||||
g_rand_int (gr);
|
g_rand_int (gr);
|
||||||
|
|
||||||
for (x = result->x; x < result->x + result->width; x++, i++)
|
for (x = result->x; x < result->x + result->width; x++, i++)
|
||||||
{
|
{
|
||||||
int rand_val;
|
if (g_rand_int_range (gr, 0, 255) >= aux[3] * 255)
|
||||||
/* dissolve if random value is >= opacity */
|
|
||||||
rand_val = g_rand_int_range (gr, 0, 255);
|
|
||||||
|
|
||||||
if (rand_val >= aux[3] * 255)
|
|
||||||
{
|
{
|
||||||
out[0] = in[0];
|
out[0] = in[0];
|
||||||
out[1] = in[1];
|
out[1] = in[1];
|
||||||
@ -143,10 +127,9 @@ gimp_operation_dissolve_mode_process (GeglOperation *operation,
|
|||||||
out[2] = aux[2];
|
out[2] = aux[2];
|
||||||
out[3] = 1.0;
|
out[3] = 1.0;
|
||||||
}
|
}
|
||||||
|
in += 4;
|
||||||
in+=4;
|
out += 4;
|
||||||
out+=4;
|
aux += 4;
|
||||||
aux+=4;
|
|
||||||
}
|
}
|
||||||
g_rand_free (gr);
|
g_rand_free (gr);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user