~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to app/composite/gimp-composite.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c tab-width: 2; c-basic-indent: 2; indent-tabs-mode: nil -*-
2
 
 * The GIMP -- an image manipulation program
 
1
/* GIMP - The GNU Image Manipulation Program
3
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
3
 *
5
 
 *
6
4
 * Gimp image compositing
7
5
 * Copyright (C) 2003  Helvetix Victorinox, a pseudonym, <helvetix@gimp.org>
8
6
 *
23
21
 
24
22
#include "config.h"
25
23
 
26
 
#include <stdio.h>
27
24
#include <stdlib.h>
28
25
 
29
26
#include <glib-object.h>
33
30
#include "gimp-composite.h"
34
31
 
35
32
#include "gimp-composite-generic.h"
 
33
 
36
34
#ifdef ARCH_X86
37
35
#include "gimp-composite-mmx.h"
38
36
#include "gimp-composite-sse.h"
39
37
#endif
40
38
 
 
39
 
41
40
/*
42
41
 * Details about pixel formats, bits-per-pixel alpha and non alpha
43
42
 * versions of pixel formats.
66
65
    0, /* GIMP_PIXELFORMAT_ANY */
67
66
  };
68
67
 
69
 
const gchar *gimp_composite_pixel_name[] =
70
 
  {
71
 
    "GIMP_PIXELFORMAT_V8",
72
 
    "GIMP_PIXELFORMAT_VA8",
73
 
    "GIMP_PIXELFORMAT_RGB8",
74
 
    "GIMP_PIXELFORMAT_RGBA8",
75
 
#if GIMP_COMPOSITE_16BIT
76
 
    "GIMP_PIXELFORMAT_V16",
77
 
    "GIMP_PIXELFORMAT_VA16",
78
 
    "GIMP_PIXELFORMAT_RGB16 ",
79
 
    "GIMP_PIXELFORMAT_RGBA16 ",
80
 
#endif
81
 
#if GIMP_COMPOSITE_32BIT
82
 
    "GIMP_PIXELFORMAT_V32",
83
 
    "GIMP_PIXELFORMAT_VA32",
84
 
    "GIMP_PIXELFORMAT_RGB32 ",
85
 
    "GIMP_PIXELFORMAT_RGBA32 ",
86
 
#endif
87
 
    "GIMP_PIXELFORMAT_ANY",
88
 
  };
89
 
 
90
68
/*
91
69
 * Report true (non-zero) if a pixel format has alpha.
92
70
 */
174
152
    { FALSE, FALSE, FALSE },      /*  GIMP_CONVERT */
175
153
  };
176
154
 
177
 
struct
178
 
{
179
 
  gchar announce_function;
180
 
} gimp_composite_debug;
181
 
 
182
155
struct GimpCompositeOptions gimp_composite_options =
183
156
  {
184
157
    GIMP_COMPOSITE_OPTION_USE
185
158
  };
186
159
 
187
160
const gchar * gimp_composite_function_name[GIMP_COMPOSITE_N][GIMP_PIXELFORMAT_N][GIMP_PIXELFORMAT_N][GIMP_PIXELFORMAT_N];
188
 
void (*gimp_composite_function[GIMP_COMPOSITE_N][GIMP_PIXELFORMAT_N][GIMP_PIXELFORMAT_N][GIMP_PIXELFORMAT_N])(GimpCompositeContext *);
 
161
 
 
162
void (* gimp_composite_function[GIMP_COMPOSITE_N][GIMP_PIXELFORMAT_N][GIMP_PIXELFORMAT_N][GIMP_PIXELFORMAT_N])(GimpCompositeContext *);
189
163
 
190
164
/**
191
165
 * gimp_composite_dispatch:
198
172
void
199
173
gimp_composite_dispatch (GimpCompositeContext *ctx)
200
174
{
201
 
  void (*function) (GimpCompositeContext *);
 
175
  void (* function) (GimpCompositeContext *);
202
176
 
203
177
  function = gimp_composite_function[ctx->op][ctx->pixelformat_A][ctx->pixelformat_B][ctx->pixelformat_D];
204
178
 
206
180
    {
207
181
      if (gimp_composite_options.bits & GIMP_COMPOSITE_OPTION_VERBOSE)
208
182
        {
209
 
          printf ("%s %s %s %s = %p\n",
210
 
                  gimp_composite_mode_astext (ctx->op),
211
 
                  gimp_composite_pixelformat_astext (ctx->pixelformat_A),
212
 
                  gimp_composite_pixelformat_astext (ctx->pixelformat_B),
213
 
                  gimp_composite_pixelformat_astext (ctx->pixelformat_D),
214
 
                  function);
 
183
          g_print ("%s %s %s %s = %p\n",
 
184
                   gimp_composite_mode_astext (ctx->op),
 
185
                   gimp_composite_pixelformat_astext (ctx->pixelformat_A),
 
186
                   gimp_composite_pixelformat_astext (ctx->pixelformat_B),
 
187
                   gimp_composite_pixelformat_astext (ctx->pixelformat_D),
 
188
                   function);
215
189
        }
216
190
 
217
 
      (*function) (ctx);
 
191
      function (ctx);
218
192
    }
219
193
  else
220
194
    {
221
 
      printf ("gimp_composite: unsupported operation: %s %s %s %s\n",
 
195
      g_print ("gimp_composite: unsupported operation: %s %s %s %s\n",
222
196
              gimp_composite_mode_astext (ctx->op),
223
197
              gimp_composite_pixelformat_astext (ctx->pixelformat_A),
224
198
              gimp_composite_pixelformat_astext (ctx->pixelformat_B),
235
209
void
236
210
gimp_composite_context_print (GimpCompositeContext *ctx)
237
211
{
238
 
  printf ("%p: op=%s\n  A=%s(%d):%p\n  B=%s(%d):%p\n  D=%s(%d):%p\n  M=%s(%d):%p\n  n_pixels=%lu\n",
239
 
          ctx,
240
 
          gimp_composite_mode_astext (ctx->op),
241
 
          gimp_composite_pixelformat_astext (ctx->pixelformat_A),
242
 
          ctx->pixelformat_A, ctx->A,
243
 
          gimp_composite_pixelformat_astext (ctx->pixelformat_B),
244
 
          ctx->pixelformat_B, ctx->B,
245
 
          gimp_composite_pixelformat_astext (ctx->pixelformat_D),
246
 
          ctx->pixelformat_D, ctx->D,
247
 
          gimp_composite_pixelformat_astext (ctx->pixelformat_M),
248
 
          ctx->pixelformat_M, ctx->M,
249
 
          ctx->n_pixels);
 
212
  g_print ("%p: op=%s\n  A=%s(%d):%p\n  B=%s(%d):%p\n  D=%s(%d):%p\n  M=%s(%d):%p\n  n_pixels=%lu\n",
 
213
           ctx,
 
214
           gimp_composite_mode_astext (ctx->op),
 
215
           gimp_composite_pixelformat_astext (ctx->pixelformat_A),
 
216
           ctx->pixelformat_A, ctx->A,
 
217
           gimp_composite_pixelformat_astext (ctx->pixelformat_B),
 
218
           ctx->pixelformat_B, ctx->B,
 
219
           gimp_composite_pixelformat_astext (ctx->pixelformat_D),
 
220
           ctx->pixelformat_D, ctx->D,
 
221
           gimp_composite_pixelformat_astext (ctx->pixelformat_M),
 
222
           ctx->pixelformat_M, ctx->M,
 
223
           ctx->n_pixels);
250
224
}
251
225
 
252
226
/**
361
335
      gimp_composite_options.bits = strtoul(p, NULL, 16);
362
336
    }
363
337
 
364
 
  if (!use_cpu_accel)
365
 
    gimp_composite_options.bits |=  GIMP_COMPOSITE_OPTION_NOEXTENSIONS;
 
338
  if (! use_cpu_accel)
 
339
    gimp_composite_options.bits |= GIMP_COMPOSITE_OPTION_NOEXTENSIONS;
366
340
 
367
341
  if (be_verbose)
368
342
    g_printerr ("gimp_composite: use=%s, verbose=%s\n",
410
384
                    can_use_vis     ? '+' : '-');
411
385
    }
412
386
}
 
387
 
 
388
gboolean
 
389
gimp_composite_use_cpu_accel (void)
 
390
{
 
391
  return ! (gimp_composite_options.bits & GIMP_COMPOSITE_OPTION_NOEXTENSIONS);
 
392
}