app/core/cpercep.[ch] app/core/gimpimage-convert.c removed C++ style

2002-05-24  Sven Neumann  <sven@gimp.org>

	* app/core/cpercep.[ch]
	* app/core/gimpimage-convert.c
	* app/paint-funcs/paint-funcs.c: removed C++ style comments and
	compiler warnings.
This commit is contained in:
Sven Neumann 2002-05-24 10:48:08 +00:00 committed by Sven Neumann
parent b10ade1a35
commit 14066a6e8d
7 changed files with 57 additions and 56 deletions

View File

@ -1,3 +1,10 @@
2002-05-24 Sven Neumann <sven@gimp.org>
* app/core/cpercep.[ch]
* app/core/gimpimage-convert.c
* app/paint-funcs/paint-funcs.c: removed C++ style comments and
compiler warnings.
2002-05-24 Michael Natterer <mitch@gimp.org>
* app/config/gimpconfig.[ch]

View File

@ -80,21 +80,15 @@ from the Author.
-- if you change this then you'll probably want to change ASSUMED_GAMMA,
the phosphor colours and the white point definition.
*/
/*#define SANITY*/
/* #define SANITY */
#define APPROX
#define SRGB
#ifdef SANITY
/* for fprintf */
#include <stdio.h>
#endif
#include "cpercep.h"
#ifdef SRGB
#define ASSUMED_GAMMA (2.2F)
#else
@ -196,7 +190,7 @@ typedef double CVector[3];
static CMatrix Mrgb_to_xyz, Mxyz_to_rgb;
static int
Minvert (const CMatrix src, CMatrix dest)
Minvert (CMatrix src, CMatrix dest)
{
double det;
@ -218,7 +212,7 @@ Minvert (const CMatrix src, CMatrix dest)
if (det <= 0.0F)
{
#ifdef SANITY
fprintf(stderr, "\n\007 XXXX det: %f\n", det);
g_printerr ("\n\007 XXXX det: %f\n", det);
#endif
return 0;
}
@ -259,10 +253,13 @@ rgbxyzrgb_init(void)
MRC[2][0] = 1.0F - (pxr + pyr);
MRC[2][1] = 1.0F - (pxg + pyg);
MRC[2][2] = 1.0F - (pxb + pyb);
Minvert (MRC, MRCi);
C1 = MRCi[0][0]*xnn + MRCi[0][1] + MRCi[0][2]*znn;
C2 = MRCi[1][0]*xnn + MRCi[1][1] + MRCi[1][2]*znn;
C3 = MRCi[2][0]*xnn + MRCi[2][1] + MRCi[2][2]*znn;
Mrgb_to_xyz[0][0] = MRC[0][0] * C1;
Mrgb_to_xyz[0][1] = MRC[0][1] * C2;
Mrgb_to_xyz[0][2] = MRC[0][2] * C3;
@ -272,12 +269,12 @@ rgbxyzrgb_init(void)
Mrgb_to_xyz[2][0] = MRC[2][0] * C1;
Mrgb_to_xyz[2][1] = MRC[2][1] * C2;
Mrgb_to_xyz[2][2] = MRC[2][2] * C3;
Minvert (Mrgb_to_xyz, Mxyz_to_rgb);
}
}
static void
xyz_to_rgb (double *inx_outr,
double *iny_outg,
@ -370,12 +367,12 @@ xyz_to_lab (double *inx,
#ifdef SANITY
if (L < 0.0F)
{
fprintf(stderr, " <eek1>%f \007",(float)L);
g_printerr (" <eek1>%f \007",(float)L);
}
if (L > 100.0F)
{
fprintf(stderr, " <eek2>%f \007",(float)L);
g_printerr (" <eek2>%f \007",(float)L);
}
#endif
}
@ -425,19 +422,19 @@ lab_to_xyz (double *inl,
if (X<-0.00000F)
{
if (X<-0.0001F)
fprintf(stderr,"{badX %f {%f,%f,%f}}",X,L,a,b);
g_printerr ("{badX %f {%f,%f,%f}}",X,L,a,b);
X = 0.0F;
}
if (Y<-0.00000F)
{
if (Y<-0.0001F)
fprintf(stderr,"{badY %f}",Y);
g_printerr ("{badY %f}",Y);
Y = 0.0F;
}
if (Z<-0.00000F)
{
if (Z<-0.1F)
fprintf(stderr,"{badZ %f}",Z);
g_printerr ("{badZ %f}",Z);
Z = 0.0F;
}
#endif
@ -504,7 +501,7 @@ cpercep_rgb_to_space (double inr, double ing, double inb,
(inb) < 0.0F
)
{
fprintf(stderr, "%%");
g_printerr ("%%");
/* abort(); */
}
#endif /* SANITY */
@ -514,7 +511,7 @@ cpercep_rgb_to_space (double inr, double ing, double inb,
#ifdef SANITY
if (inr < 0.0F || ing < 0.0F || inb < 0.0F)
{
fprintf(stderr," [BAD2 XYZ: %f,%f,%f]\007 ",
g_printerr (" [BAD2 XYZ: %f,%f,%f]\007 ",
inr,ing,inb);
}
#endif /* SANITY */
@ -536,7 +533,7 @@ cpercep_space_to_rgb (double inr, double ing, double inb,
#ifdef SANITY
if (inr<-0.0F || ing<-0.0F || inb<-0.0F)
{
fprintf(stderr," [BAD1 XYZ: %f,%f,%f]\007 ",
g_printerr (" [BAD1 XYZ: %f,%f,%f]\007 ",
inr,ing,inb);
}
#endif
@ -616,7 +613,7 @@ mix_colours (const double L1, const double a1, const double b1,
*rtna =
*rtnb = 0.0;
#ifdef SANITY
/* fprintf(stderr, "\007OUCH. "); */
/* g_printerr ("\007OUCH. "); */
#endif
}
else

View File

@ -44,7 +44,7 @@ void
cpercep_space_to_rgb (double inr, double ing, double inb,
double* outr, double* outg, double* outb);
#if 0
/* This is in the header so that it can potentially be inlined. */
static const double
cpercep_distance_space (const double L1, const double a1, const double b1,
@ -55,7 +55,7 @@ cpercep_distance_space (const double L1, const double a1, const double b1,
const double bd = b1 - b2;
return (Ld*Ld + ad*ad + bd*bd);
}
#endif
/* EXPERIMENTAL */

View File

@ -80,21 +80,15 @@ from the Author.
-- if you change this then you'll probably want to change ASSUMED_GAMMA,
the phosphor colours and the white point definition.
*/
/*#define SANITY*/
/* #define SANITY */
#define APPROX
#define SRGB
#ifdef SANITY
/* for fprintf */
#include <stdio.h>
#endif
#include "cpercep.h"
#ifdef SRGB
#define ASSUMED_GAMMA (2.2F)
#else
@ -196,7 +190,7 @@ typedef double CVector[3];
static CMatrix Mrgb_to_xyz, Mxyz_to_rgb;
static int
Minvert (const CMatrix src, CMatrix dest)
Minvert (CMatrix src, CMatrix dest)
{
double det;
@ -218,7 +212,7 @@ Minvert (const CMatrix src, CMatrix dest)
if (det <= 0.0F)
{
#ifdef SANITY
fprintf(stderr, "\n\007 XXXX det: %f\n", det);
g_printerr ("\n\007 XXXX det: %f\n", det);
#endif
return 0;
}
@ -259,10 +253,13 @@ rgbxyzrgb_init(void)
MRC[2][0] = 1.0F - (pxr + pyr);
MRC[2][1] = 1.0F - (pxg + pyg);
MRC[2][2] = 1.0F - (pxb + pyb);
Minvert (MRC, MRCi);
C1 = MRCi[0][0]*xnn + MRCi[0][1] + MRCi[0][2]*znn;
C2 = MRCi[1][0]*xnn + MRCi[1][1] + MRCi[1][2]*znn;
C3 = MRCi[2][0]*xnn + MRCi[2][1] + MRCi[2][2]*znn;
Mrgb_to_xyz[0][0] = MRC[0][0] * C1;
Mrgb_to_xyz[0][1] = MRC[0][1] * C2;
Mrgb_to_xyz[0][2] = MRC[0][2] * C3;
@ -272,12 +269,12 @@ rgbxyzrgb_init(void)
Mrgb_to_xyz[2][0] = MRC[2][0] * C1;
Mrgb_to_xyz[2][1] = MRC[2][1] * C2;
Mrgb_to_xyz[2][2] = MRC[2][2] * C3;
Minvert (Mrgb_to_xyz, Mxyz_to_rgb);
}
}
static void
xyz_to_rgb (double *inx_outr,
double *iny_outg,
@ -370,12 +367,12 @@ xyz_to_lab (double *inx,
#ifdef SANITY
if (L < 0.0F)
{
fprintf(stderr, " <eek1>%f \007",(float)L);
g_printerr (" <eek1>%f \007",(float)L);
}
if (L > 100.0F)
{
fprintf(stderr, " <eek2>%f \007",(float)L);
g_printerr (" <eek2>%f \007",(float)L);
}
#endif
}
@ -425,19 +422,19 @@ lab_to_xyz (double *inl,
if (X<-0.00000F)
{
if (X<-0.0001F)
fprintf(stderr,"{badX %f {%f,%f,%f}}",X,L,a,b);
g_printerr ("{badX %f {%f,%f,%f}}",X,L,a,b);
X = 0.0F;
}
if (Y<-0.00000F)
{
if (Y<-0.0001F)
fprintf(stderr,"{badY %f}",Y);
g_printerr ("{badY %f}",Y);
Y = 0.0F;
}
if (Z<-0.00000F)
{
if (Z<-0.1F)
fprintf(stderr,"{badZ %f}",Z);
g_printerr ("{badZ %f}",Z);
Z = 0.0F;
}
#endif
@ -504,7 +501,7 @@ cpercep_rgb_to_space (double inr, double ing, double inb,
(inb) < 0.0F
)
{
fprintf(stderr, "%%");
g_printerr ("%%");
/* abort(); */
}
#endif /* SANITY */
@ -514,7 +511,7 @@ cpercep_rgb_to_space (double inr, double ing, double inb,
#ifdef SANITY
if (inr < 0.0F || ing < 0.0F || inb < 0.0F)
{
fprintf(stderr," [BAD2 XYZ: %f,%f,%f]\007 ",
g_printerr (" [BAD2 XYZ: %f,%f,%f]\007 ",
inr,ing,inb);
}
#endif /* SANITY */
@ -536,7 +533,7 @@ cpercep_space_to_rgb (double inr, double ing, double inb,
#ifdef SANITY
if (inr<-0.0F || ing<-0.0F || inb<-0.0F)
{
fprintf(stderr," [BAD1 XYZ: %f,%f,%f]\007 ",
g_printerr (" [BAD1 XYZ: %f,%f,%f]\007 ",
inr,ing,inb);
}
#endif
@ -616,7 +613,7 @@ mix_colours (const double L1, const double a1, const double b1,
*rtna =
*rtnb = 0.0;
#ifdef SANITY
/* fprintf(stderr, "\007OUCH. "); */
/* g_printerr ("\007OUCH. "); */
#endif
}
else

View File

@ -44,7 +44,7 @@ void
cpercep_space_to_rgb (double inr, double ing, double inb,
double* outr, double* outg, double* outb);
#if 0
/* This is in the header so that it can potentially be inlined. */
static const double
cpercep_distance_space (const double L1, const double a1, const double b1,
@ -55,7 +55,7 @@ cpercep_distance_space (const double L1, const double a1, const double b1,
const double bd = b1 - b2;
return (Ld*Ld + ad*ad + bd*bd);
}
#endif
/* EXPERIMENTAL */

View File

@ -3722,20 +3722,20 @@ median_cut_pass2_fs_dither_rgb (QuantizeObj *quantobj,
}
#if 0
hmm.
// r = range_limiter[src[red_pix] + error_limiter[*rpr]];
// g = range_limiter[src[green_pix] + error_limiter[*gpr]];
// b = range_limiter[src[blue_pix] + error_limiter[*bpr]];
/* hmm. */
//// re = r >> R_SHIFT;
//// ge = g >> G_SHIFT;
//// be = b >> B_SHIFT;
r = range_limiter[src[red_pix] + error_limiter[*rpr]];
g = range_limiter[src[green_pix] + error_limiter[*gpr]];
b = range_limiter[src[blue_pix] + error_limiter[*bpr]];
// rgb_to_lin(r, g, b,
// &re, &ge, &be);
re = r >> R_SHIFT;
ge = g >> G_SHIFT;
be = b >> B_SHIFT;
rgb_to_lin (r, g, b, &re, &ge, &be);
#endif
rgb_to_unshifted_lin(src[red_pix], src[green_pix], src[blue_pix],
&re, &ge, &be);
rgb_to_unshifted_lin (src[red_pix], src[green_pix], src[blue_pix],
&re, &ge, &be);
/*
re = CLAMP(re, global_rmin, global_rmax);

View File

@ -1394,7 +1394,7 @@ behind_inten_pixels (const guchar *src1,
guint bytes1,
guint bytes2)
{
// FIXME: Is this supposed to be different than in the other functions?
/* FIXME: Is this supposed to be different than in the other functions? */
const guint alpha = bytes1 - 1;
guint b;
guchar src1_alpha;