addec const qualifiers to GimpRGB parameters.

2007-12-28  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimpcairo-utils.[ch]: addec const qualifiers to
	GimpRGB parameters.

	* app/widgets/gimprender.[ch]: removed global variables for
	checkerboard colors and introduced functions to get the
	checkerboard colors as pointers to GimpRGB structs.

	* app/actions/view-actions.c
	* app/display/gimpdisplayshell-appearance.c
	* app/widgets/gimpviewrenderer.c
	* app/widgets/gimpcolormapeditor.c: changed accordingly.


svn path=/trunk/; revision=24451
This commit is contained in:
Sven Neumann
2007-12-28 19:14:36 +00:00
committed by Sven Neumann
parent 26f6ca6d1d
commit b194e6fb62
9 changed files with 83 additions and 79 deletions

View File

@ -23,6 +23,7 @@
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpcolor/gimpcolor.h"
#include "widgets-types.h"
@ -37,9 +38,7 @@ static void gimp_render_setup_notify (gpointer config,
Gimp *gimp);
/* accelerate transparency of image scaling */
guchar gimp_render_dark_check;
guchar gimp_render_light_check;
/* accelerate blending on the checkerboard */
guchar *gimp_render_check_buf = NULL;
guchar *gimp_render_empty_buf = NULL;
@ -50,6 +49,10 @@ guchar *gimp_render_blend_light_check = NULL;
guchar *gimp_render_blend_white = NULL;
static GimpRGB light;
static GimpRGB dark;
void
gimp_render_init (Gimp *gimp)
{
@ -108,6 +111,17 @@ gimp_render_exit (Gimp *gimp)
}
}
const GimpRGB *
gimp_render_light_check_color (void)
{
return &light;
}
const GimpRGB *
gimp_render_dark_check_color (void)
{
return &dark;
}
static void
gimp_render_setup_notify (gpointer config,
@ -115,14 +129,18 @@ gimp_render_setup_notify (gpointer config,
Gimp *gimp)
{
GimpCheckType check_type;
guchar dark_check;
guchar light_check;
gint i, j;
g_object_get (config,
"transparency-type", &check_type,
NULL);
gimp_checks_get_shades (check_type,
&gimp_render_light_check, &gimp_render_dark_check);
gimp_checks_get_shades (check_type, &light_check, &dark_check);
gimp_rgba_set_uchar (&light, light_check, light_check, light_check, 255);
gimp_rgba_set_uchar (&dark, dark_check, dark_check, dark_check, 255);
if (! gimp_render_blend_dark_check)
gimp_render_blend_dark_check = g_new (guchar, 65536);
@ -137,10 +155,10 @@ gimp_render_setup_notify (gpointer config,
for (j = 0; j < 256; j++)
{
gimp_render_blend_dark_check [(i << 8) + j] =
(guchar) ((j * i + gimp_render_dark_check * (255 - i)) / 255);
(guchar) ((j * i + dark_check * (255 - i)) / 255);
gimp_render_blend_light_check [(i << 8) + j] =
(guchar) ((j * i + gimp_render_light_check * (255 - i)) / 255);
(guchar) ((j * i + light_check * (255 - i)) / 255);
gimp_render_blend_white [(i << 8) + j] =
(guchar) ((j * i + 255 * (255 - i)) / 255);
@ -165,15 +183,15 @@ gimp_render_setup_notify (gpointer config,
{
if (i & 0x4)
{
gimp_render_check_buf[i * 3 + 0] = gimp_render_dark_check;
gimp_render_check_buf[i * 3 + 1] = gimp_render_dark_check;
gimp_render_check_buf[i * 3 + 2] = gimp_render_dark_check;
gimp_render_check_buf[i * 3 + 0] = dark_check;
gimp_render_check_buf[i * 3 + 1] = dark_check;
gimp_render_check_buf[i * 3 + 2] = dark_check;
}
else
{
gimp_render_check_buf[i * 3 + 0] = gimp_render_light_check;
gimp_render_check_buf[i * 3 + 1] = gimp_render_light_check;
gimp_render_check_buf[i * 3 + 2] = gimp_render_light_check;
gimp_render_check_buf[i * 3 + 0] = light_check;
gimp_render_check_buf[i * 3 + 1] = light_check;
gimp_render_check_buf[i * 3 + 2] = light_check;
}
}