mirror of https://github.com/GNOME/gimp.git
removed ... ... and readded under a new name.
2003-07-09 Sven Neumann <sven@gimp.org> * app/composite/tester.c: removed ... * app/composite/test-composite.c: ... and readded under a new name. * app/composite/Makefile.am: added a check target that builds and runs the test program. * app/composite/gimp-composite-generic.c * app/composite/gimp-composite-mmx.c * app/composite/gimp-composite-util.h * app/composite/gimp-composite.[ch] * app/composite/make-gimp-composite-dispatch.py: made it fit better into the GIMP source tree: - do not include any files from headers - don't use types from <sys/types.h> but use what glib provides - coding style ...
This commit is contained in:
parent
e3b560f0a9
commit
9bad7d216b
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
2003-07-09 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/composite/tester.c: removed ...
|
||||
* app/composite/test-composite.c: ... and readded under a new name.
|
||||
|
||||
* app/composite/Makefile.am: added a check target that builds and
|
||||
runs the test program.
|
||||
|
||||
* app/composite/gimp-composite-generic.c
|
||||
* app/composite/gimp-composite-mmx.c
|
||||
* app/composite/gimp-composite-util.h
|
||||
* app/composite/gimp-composite.[ch]
|
||||
* app/composite/make-gimp-composite-dispatch.py: made it fit
|
||||
better into the GIMP source tree:
|
||||
- do not include any files from headers
|
||||
- don't use types from <sys/types.h> but use what glib provides
|
||||
- coding style ...
|
||||
|
||||
2003-07-09 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/Makefile.am
|
||||
|
|
|
@ -31,9 +31,32 @@ libappcomposite_a_built_sources = gimp-composite-dispatch.c
|
|||
|
||||
libappcomposite_a_SOURCES = $(libappcomposite_a_built_sources) $(libappcomposite_a_sources)
|
||||
|
||||
EXTRA_DIST = make-gimp-composite-dispatch.py
|
||||
|
||||
gimp-composite.c: gimp-composite-dispatch.c
|
||||
|
||||
gimp-composite-dispatch.c: gimp-composite-generic.o make-gimp-composite-dispatch.py
|
||||
./make-gimp-composite-dispatch.py gimp-composite-generic.o > gimp-composite-dispatch.c
|
||||
|
||||
|
||||
EXTRA_DIST = \
|
||||
make-gimp-composite-dispatch.py \
|
||||
ns
|
||||
|
||||
EXTRA_PROGRAMS = test-composite
|
||||
|
||||
|
||||
#
|
||||
# unit tests for GimpComposite
|
||||
#
|
||||
|
||||
TESTS = test-composite
|
||||
|
||||
test_composite_DEPENDENCIES = $(gimpcomposite_dependencies)
|
||||
|
||||
test_composite_LDADD = \
|
||||
libappcomposite.a \
|
||||
$(top_builddir)/libgimpcolor/libgimpcolor-$(LT_RELEASE).la \
|
||||
$(GLIB_LIBS)
|
||||
|
||||
|
||||
CLEANFILES = $(EXTRA_PROGRAMS)
|
||||
|
|
|
@ -24,18 +24,22 @@
|
|||
* of the pixelfiddeling paint-functions.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "glib/grand.h"
|
||||
#include "glib/gtypes.h"
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "libgimpcolor/gimpcolortypes.h"
|
||||
#include "libgimpcolor/gimpcolorspace.h"
|
||||
#include "base/base-types.h"
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
|
||||
#include "gimp-composite.h"
|
||||
|
||||
#define OPAQUE_OPACITY 255
|
||||
#define TRANSPARENT_OPACITY 0
|
||||
|
||||
#define OPAQUE_OPACITY 255
|
||||
#define TRANSPARENT_OPACITY 0
|
||||
|
||||
|
||||
#define INT_MULT(a,b,t) ((t) = (a) * (b) + 0x80, ((((t) >> 8) + (t)) >> 8))
|
||||
|
||||
|
|
|
@ -1,30 +1,33 @@
|
|||
#ifndef gimp_composite_util
|
||||
#define gimp_composite_util
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned char r;
|
||||
unsigned char g;
|
||||
unsigned char b;
|
||||
unsigned char a;
|
||||
#ifndef __GIMP_COMPOSITE_UTIL_H__
|
||||
#define __GIMP_COMPOSITE_UTIL_H__
|
||||
|
||||
typedef struct
|
||||
{
|
||||
guchar r;
|
||||
guchar g;
|
||||
guchar b;
|
||||
guchar a;
|
||||
} rgba8_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char r;
|
||||
unsigned char g;
|
||||
unsigned char b;
|
||||
typedef struct
|
||||
{
|
||||
guchar r;
|
||||
guchar g;
|
||||
guchar b;
|
||||
} rgb8_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char v;
|
||||
typedef struct
|
||||
{
|
||||
guchar v;
|
||||
} v8_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char v;
|
||||
unsigned char a;
|
||||
typedef struct
|
||||
{
|
||||
guchar v;
|
||||
guchar a;
|
||||
} va8_t;
|
||||
|
||||
extern int gimp_composite_bpp[];
|
||||
#endif
|
||||
|
||||
#endif /* __GIMP_COMPOSITE_UTIL_H__ */
|
||||
|
|
|
@ -18,11 +18,15 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "base/base-types.h"
|
||||
|
||||
#include "gimp-composite.h"
|
||||
|
||||
/*
|
||||
|
@ -32,7 +36,8 @@
|
|||
/*
|
||||
* Report on the number of bytes a particular pixel format consumes per pixel.
|
||||
*/
|
||||
unsigned char gimp_composite_pixel_bpp[] = {
|
||||
const guchar gimp_composite_pixel_bpp[] =
|
||||
{
|
||||
1, /* GIMP_PIXELFORMAT_V8 */
|
||||
2, /* GIMP_PIXELFORMAT_VA8 */
|
||||
3, /* GIMP_PIXELFORMAT_RGB8 */
|
||||
|
@ -46,7 +51,8 @@ unsigned char gimp_composite_pixel_bpp[] = {
|
|||
0, /* GIMP_PIXELFORMAT_ANY */
|
||||
};
|
||||
|
||||
char *gimp_composite_pixel_name[] = {
|
||||
const gchar *gimp_composite_pixel_name[] =
|
||||
{
|
||||
"GIMP_PIXELFORMAT_V8",
|
||||
"GIMP_PIXELFORMAT_VA8",
|
||||
"GIMP_PIXELFORMAT_RGB8",
|
||||
|
@ -59,10 +65,12 @@ char *gimp_composite_pixel_name[] = {
|
|||
#endif
|
||||
"GIMP_PIXELFORMAT_ANY",
|
||||
};
|
||||
|
||||
/*
|
||||
* Report true (non-zero) if a pixel format has alpha.
|
||||
*/
|
||||
unsigned char gimp_composite_pixel_alphap[] = {
|
||||
const guchar gimp_composite_pixel_alphap[] =
|
||||
{
|
||||
0, /* GIMP_PIXELFORMAT_V8 */
|
||||
1, /* GIMP_PIXELFORMAT_VA8 */
|
||||
0, /* GIMP_PIXELFORMAT_RGB8 */
|
||||
|
@ -79,7 +87,8 @@ unsigned char gimp_composite_pixel_alphap[] = {
|
|||
/*
|
||||
* Convert to/from pixel formats with/without alpha.
|
||||
*/
|
||||
GimpPixelFormat gimp_composite_pixel_alpha[] = {
|
||||
const GimpPixelFormat gimp_composite_pixel_alpha[] =
|
||||
{
|
||||
GIMP_PIXELFORMAT_VA8, /* GIMP_PIXELFORMAT_V8 */
|
||||
GIMP_PIXELFORMAT_V8, /* GIMP_PIXELFORMAT_VA8 */
|
||||
GIMP_PIXELFORMAT_RGBA8, /* GIMP_PIXELFORMAT_RGB8 */
|
||||
|
@ -98,7 +107,8 @@ GimpPixelFormat gimp_composite_pixel_alpha[] = {
|
|||
* XXX I don't like to put this here. I think this information,
|
||||
* specific to the functions, ought to be with the function.
|
||||
*/
|
||||
struct GimpCompositeOperationEffects gimp_composite_operation_effects[] = {
|
||||
struct GimpCompositeOperationEffects gimp_composite_operation_effects[] =
|
||||
{
|
||||
{ TRUE, TRUE, FALSE, }, /* GIMP_NORMAL_MODE */
|
||||
{ TRUE, TRUE, FALSE, }, /* GIMP_DISSOLVE_MODE */
|
||||
{ TRUE, TRUE, FALSE, }, /* GIMP_BEHIND_MODE */
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* Gimp Image Compositing
|
||||
* Copyright (C) 2003 Helvetix Victorinox, a pseudonym, <helvetix@gimp.org>
|
||||
* $Id$
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,19 +19,12 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef gimp_composite_h
|
||||
#define gimp_composite_h
|
||||
#ifndef __GIMP_COMPOSITE_H__
|
||||
#define __GIMP_COMPOSITE_H__
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <glib-object.h>
|
||||
#include "base/base-enums.h"
|
||||
#include "paint-funcs/paint-funcs-types.h"
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((void) 0)
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
GIMP_PIXELFORMAT_V8,
|
||||
GIMP_PIXELFORMAT_VA8,
|
||||
GIMP_PIXELFORMAT_RGB8,
|
||||
|
@ -47,58 +39,73 @@ typedef enum {
|
|||
GIMP_PIXELFORMAT_N
|
||||
} GimpPixelFormat;
|
||||
|
||||
typedef struct {
|
||||
u_int8_t v;
|
||||
typedef struct
|
||||
{
|
||||
guint8 v;
|
||||
} gimp_v8_t;
|
||||
|
||||
typedef struct {
|
||||
u_int8_t v;
|
||||
u_int8_t a;
|
||||
typedef struct
|
||||
{
|
||||
guint8 v;
|
||||
guint8 a;
|
||||
} gimp_va8_t;
|
||||
|
||||
typedef struct {
|
||||
u_int8_t r;
|
||||
u_int8_t g;
|
||||
u_int8_t b;
|
||||
typedef struct
|
||||
{
|
||||
guint8 r;
|
||||
guint8 g;
|
||||
guint8 b;
|
||||
} gimp_rgb8_t;
|
||||
|
||||
typedef struct {
|
||||
u_int8_t r;
|
||||
u_int8_t g;
|
||||
u_int8_t b;
|
||||
u_int8_t a;
|
||||
typedef struct
|
||||
{
|
||||
guint8 r;
|
||||
guint8 g;
|
||||
guint8 b;
|
||||
guint8 a;
|
||||
} gimp_rgba8_t;
|
||||
|
||||
#ifdef GIMP_16BITCOLOUR
|
||||
typedef struct {
|
||||
u_int16_t v;
|
||||
typedef struct
|
||||
{
|
||||
guint16 v;
|
||||
} gimp_v16_t;
|
||||
|
||||
typedef struct {
|
||||
u_int16_t v;
|
||||
u_int16_t a;
|
||||
typedef struct
|
||||
{
|
||||
guint16 v;
|
||||
guint16 a;
|
||||
} gimp_va16_t;
|
||||
|
||||
typedef struct {
|
||||
u_int16_t r;
|
||||
u_int16_t g;
|
||||
u_int16_t b;
|
||||
typedef struct
|
||||
{
|
||||
guint16 r;
|
||||
guint16 g;
|
||||
guint16 b;
|
||||
} gimp_rgb16_t;
|
||||
|
||||
typedef struct {
|
||||
u_int16_t r;
|
||||
u_int16_t g;
|
||||
u_int16_t b;
|
||||
u_int16_t a;
|
||||
typedef struct
|
||||
{
|
||||
guint16 r;
|
||||
guint16 g;
|
||||
guint16 b;
|
||||
guint16 a;
|
||||
} gimp_rgba16_t;
|
||||
#endif
|
||||
|
||||
extern unsigned char gimp_composite_pixel_bpp[]; /* bytes per-pixel for each of the pixel formats */
|
||||
extern unsigned char gimp_composite_pixel_alphap[]; /* does pixel format have alpha? */
|
||||
extern GimpPixelFormat gimp_composite_pixel_alpha[]; /* converter between alpha and non-alpha pixel formats */
|
||||
/* bytes per-pixel for each of the pixel formats */
|
||||
extern const guchar gimp_composite_pixel_bpp[];
|
||||
|
||||
#define GIMP_COMPOSITE_ALPHA_OPAQUE (-1)
|
||||
/* does pixel format have alpha? */
|
||||
extern const guchar gimp_composite_pixel_alphap[];
|
||||
|
||||
/* converter between alpha and non-alpha pixel formats */
|
||||
extern const GimpPixelFormat gimp_composite_pixel_alpha[];
|
||||
|
||||
|
||||
#define GIMP_COMPOSITE_ALPHA_OPAQUE (-1)
|
||||
#define GIMP_COMPOSITE_ALPHA_TRANSPARENT (0)
|
||||
|
||||
/*
|
||||
* This is the enumeration of all the supported compositing
|
||||
* operations. Many of them are taken from the GimpLayerModeEffect
|
||||
|
@ -107,7 +114,8 @@ extern GimpPixelFormat gimp_composite_pixel_alpha[]; /* converter between alpha
|
|||
*
|
||||
* Nota Bene: Unfortunately, the order here is important!
|
||||
*/
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
GIMP_COMPOSITE_NORMAL = GIMP_NORMAL_MODE,
|
||||
GIMP_COMPOSITE_DISSOLVE = GIMP_DISSOLVE_MODE,
|
||||
GIMP_COMPOSITE_BEHIND = GIMP_BEHIND_MODE,
|
||||
|
@ -142,10 +150,11 @@ typedef enum {
|
|||
GIMP_COMPOSITE_N
|
||||
} GimpCompositeOperation;
|
||||
|
||||
struct GimpCompositeOperationEffects {
|
||||
unsigned char affect_opacity;
|
||||
unsigned char increase_opacity;
|
||||
unsigned char decrease_opacity;
|
||||
struct GimpCompositeOperationEffects
|
||||
{
|
||||
guchar affect_opacity;
|
||||
guchar increase_opacity;
|
||||
guchar decrease_opacity;
|
||||
};
|
||||
|
||||
extern struct GimpCompositeOperationEffects gimp_composite_operation_effects[];
|
||||
|
@ -154,24 +163,25 @@ extern struct GimpCompositeOperationEffects gimp_composite_operation_effects[];
|
|||
* This is structure for communicating all that is necessary to a
|
||||
* compositing operation.
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char *A; /* Source A */
|
||||
unsigned char *B; /* Source B */
|
||||
unsigned char *D; /* Destination */
|
||||
unsigned char *M; /* Mask */
|
||||
unsigned long n_pixels;
|
||||
typedef struct
|
||||
{
|
||||
guchar *A; /* Source A */
|
||||
guchar *B; /* Source B */
|
||||
guchar *D; /* Destination */
|
||||
guchar *M; /* Mask */
|
||||
gulong n_pixels;
|
||||
|
||||
GimpPixelFormat pixelformat_A;
|
||||
GimpPixelFormat pixelformat_B;
|
||||
GimpPixelFormat pixelformat_D;
|
||||
GimpPixelFormat pixelformat_M;
|
||||
|
||||
struct { int opacity; char affect; } replace;
|
||||
struct { int scale; } scale;
|
||||
struct { int blend; } blend;
|
||||
struct { int x; int y; int opacity; } dissolve;
|
||||
struct { gint opacity; gchar affect; } replace;
|
||||
struct { gint scale; } scale;
|
||||
struct { gint blend; } blend;
|
||||
struct { gint x; gint y; gint opacity; } dissolve;
|
||||
|
||||
CombinationMode combine;
|
||||
CombinationMode combine;
|
||||
GimpCompositeOperation op;
|
||||
} GimpCompositeContext;
|
||||
|
||||
|
@ -179,4 +189,6 @@ typedef struct {
|
|||
extern void gimp_composite_dispatch(GimpCompositeContext *);
|
||||
extern void gimp_composite_init();
|
||||
extern void gimp_composite_context_print(GimpCompositeContext *);
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __GIMP_COMPOSITE_H__ */
|
||||
|
|
|
@ -436,7 +436,9 @@ gimp_composite_init()
|
|||
|
||||
|
||||
print "/* THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT */"
|
||||
print "/* $Id$ */"
|
||||
print '#include "config.h"'
|
||||
print '#include <glib-object.h>'
|
||||
print '#include "base/base-types.h"'
|
||||
print '#include "gimp-composite.h"'
|
||||
print "extern void %s(GimpCompositeContext *);" % ("gimp_composite_unsupported")
|
||||
print ""
|
||||
|
|
|
@ -1,17 +1,139 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "base/base-types.h"
|
||||
|
||||
#include "gimp-composite.h"
|
||||
#include "gimp-composite-util.h"
|
||||
|
||||
|
||||
#undef use_oldmmx
|
||||
|
||||
extern void xxx_3a(rgba8_t *, rgba8_t *, rgba8_t *, u_long);
|
||||
|
||||
main(int argc, char *argv[])
|
||||
|
||||
static void
|
||||
print_rgba8(rgba8_t *p)
|
||||
{
|
||||
printf("#%02x%02x%02x,%02X", p->r, p->g, p->b, p->a);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
static void
|
||||
print_va8(va8_t *va8)
|
||||
{
|
||||
printf("#%02x,%02X", va8->v, va8->a);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
static int
|
||||
comp_rgba8(char *str, rgba8_t *rgba8A, rgba8_t *rgba8B, rgba8_t *expected, rgba8_t *got, u_long length)
|
||||
{
|
||||
int i;
|
||||
int failed;
|
||||
int fail_count;
|
||||
|
||||
fail_count = 0;
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
failed = 0;
|
||||
|
||||
if (expected[i].r != got[i].r) { failed = 1; }
|
||||
if (expected[i].g != got[i].g) { failed = 1; }
|
||||
if (expected[i].b != got[i].b) { failed = 1; }
|
||||
if (expected[i].a != got[i].a) { failed = 1; }
|
||||
if (failed) {
|
||||
fail_count++;
|
||||
printf("%s %8d A=", str, i); print_rgba8(&rgba8A[i]);
|
||||
if (rgba8B != (rgba8_t *) 0) {
|
||||
printf(" B="); print_rgba8(&rgba8B[i]);
|
||||
}
|
||||
printf(" ");
|
||||
printf("exp=");
|
||||
print_rgba8(&expected[i]);
|
||||
printf(" got=");
|
||||
print_rgba8(&got[i]);
|
||||
printf("\n");
|
||||
}
|
||||
if (fail_count > 5)
|
||||
break;
|
||||
}
|
||||
|
||||
return fail_count;
|
||||
}
|
||||
|
||||
static int
|
||||
comp_va8(char *str, va8_t *va8A, va8_t *va8B, va8_t *expected, va8_t *got, u_long length)
|
||||
{
|
||||
int i;
|
||||
int failed;
|
||||
int fail_count;
|
||||
|
||||
fail_count = 0;
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
failed = 0;
|
||||
|
||||
if (expected[i].v != got[i].v) { failed = 1; }
|
||||
if (expected[i].a != got[i].a) { failed = 1; }
|
||||
if (failed) {
|
||||
fail_count++;
|
||||
printf("%s %8d A=", str, i); print_va8(&va8A[i]);
|
||||
if (va8B != (va8_t *) 0) { printf(" B="); print_va8(&va8B[i]); }
|
||||
printf(" ");
|
||||
printf("exp=");
|
||||
print_va8(&expected[i]);
|
||||
printf(" got=");
|
||||
print_va8(&got[i]);
|
||||
printf("\n");
|
||||
}
|
||||
if (fail_count > 5)
|
||||
break;
|
||||
}
|
||||
|
||||
return fail_count;
|
||||
}
|
||||
|
||||
static void
|
||||
dump_rgba8(char *str, rgba8_t *rgba, u_long length)
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("%s\n", str);
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
printf("%5d: ", i);
|
||||
print_rgba8(&rgba[i]);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xxx_3a(rgba8_t *a, rgba8_t *b, rgba8_t *c, u_long length)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
printf("%5d: ", i);
|
||||
print_rgba8(&a[i]);
|
||||
printf(" ");
|
||||
print_rgba8(&b[i]);
|
||||
printf(" ");
|
||||
print_rgba8(&c[i]);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
double f;
|
||||
GimpCompositeContext ctx;
|
||||
GimpCompositeContext ctx_generic;
|
||||
GimpCompositeContext ctx_va8;
|
||||
|
@ -310,7 +432,7 @@ main(int argc, char *argv[])
|
|||
comp_rgba8("multiply", ctx.A, ctx.B, ctx_generic.D, ctx.D, ctx.n_pixels);
|
||||
timer_report("multiply", old_elapsed, new_elapsed);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef do_subtract
|
||||
gettimeofday(&t0, NULL);
|
||||
ctx.op = GIMP_COMPOSITE_SUBTRACT;
|
||||
|
@ -354,113 +476,5 @@ main(int argc, char *argv[])
|
|||
timer_report("swap", old_elapsed, new_elapsed);
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
print_rgba8(rgba8_t *p)
|
||||
{
|
||||
printf("#%02x%02x%02x,%02X", p->r, p->g, p->b, p->a);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
print_va8(va8_t *va8)
|
||||
{
|
||||
printf("#%02x,%02X", va8->v, va8->a);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
comp_rgba8(char *str, rgba8_t *rgba8A, rgba8_t *rgba8B, rgba8_t *expected, rgba8_t *got, u_long length)
|
||||
{
|
||||
int i;
|
||||
int failed;
|
||||
int fail_count;
|
||||
|
||||
fail_count = 0;
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
failed = 0;
|
||||
|
||||
if (expected[i].r != got[i].r) { failed = 1; }
|
||||
if (expected[i].g != got[i].g) { failed = 1; }
|
||||
if (expected[i].b != got[i].b) { failed = 1; }
|
||||
if (expected[i].a != got[i].a) { failed = 1; }
|
||||
if (failed) {
|
||||
fail_count++;
|
||||
printf("%s %8d A=", str, i); print_rgba8(&rgba8A[i]);
|
||||
if (rgba8B != (rgba8_t *) 0) {
|
||||
printf(" B="); print_rgba8(&rgba8B[i]);
|
||||
}
|
||||
printf(" ");
|
||||
printf("exp=");
|
||||
print_rgba8(&expected[i]);
|
||||
printf(" got=");
|
||||
print_rgba8(&got[i]);
|
||||
printf("\n");
|
||||
}
|
||||
if (fail_count > 5)
|
||||
break;
|
||||
}
|
||||
|
||||
return (fail_count);
|
||||
}
|
||||
|
||||
comp_va8(char *str, va8_t *va8A, va8_t *va8B, va8_t *expected, va8_t *got, u_long length)
|
||||
{
|
||||
int i;
|
||||
int failed;
|
||||
int fail_count;
|
||||
|
||||
fail_count = 0;
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
failed = 0;
|
||||
|
||||
if (expected[i].v != got[i].v) { failed = 1; }
|
||||
if (expected[i].a != got[i].a) { failed = 1; }
|
||||
if (failed) {
|
||||
fail_count++;
|
||||
printf("%s %8d A=", str, i); print_va8(&va8A[i]);
|
||||
if (va8B != (va8_t *) 0) { printf(" B="); print_va8(&va8B[i]); }
|
||||
printf(" ");
|
||||
printf("exp=");
|
||||
print_va8(&expected[i]);
|
||||
printf(" got=");
|
||||
print_va8(&got[i]);
|
||||
printf("\n");
|
||||
}
|
||||
if (fail_count > 5)
|
||||
break;
|
||||
}
|
||||
|
||||
return (fail_count);
|
||||
}
|
||||
|
||||
|
||||
dump_rgba8(char *str, rgba8_t *rgba, u_long length)
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("%s\n", str);
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
printf("%5d: ", i);
|
||||
print_rgba8(&rgba[i]);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xxx_3a(rgba8_t *a, rgba8_t *b, rgba8_t *c, u_long length)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
printf("%5d: ", i);
|
||||
print_rgba8(&a[i]);
|
||||
printf(" ");
|
||||
print_rgba8(&b[i]);
|
||||
printf(" ");
|
||||
print_rgba8(&c[i]);
|
||||
printf("\n");
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Loading…
Reference in New Issue