Commit 11b68749 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

app/display/gimpdisplayshell-render.c

2005-07-31  Sven Neumann  <sven@gimp.org>

	* app/display/gimpdisplayshell-render.c

	* app/display/gimpdisplayshell.[ch]: removed the overlay again.
	This needs to be done differently.

	* app/tools/gimpforegroundselecttool.c: changed accordingly.
parent d53a10c0
2005-07-31 Sven Neumann <sven@gimp.org>
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell.[ch]: removed the overlay again.
This needs to be done differently.
* app/tools/gimpforegroundselecttool.c: changed accordingly.
2005-07-30 Sven Neumann <sven@gimp.org>
* app/display/gimpdisplayshell-render.c
......
......@@ -200,9 +200,6 @@ static void gimp_display_shell_render_highlight (GimpDisplayShell *shell,
GdkRectangle *highlight);
static void gimp_display_shell_render_mask (GimpDisplayShell *shell,
RenderInfo *info);
static void gimp_display_shell_render_overlay (GimpDisplayShell *shell,
RenderInfo *info,
const guchar *color);
/*****************************************************************/
......@@ -253,24 +250,12 @@ gimp_display_shell_render (GimpDisplayShell *shell,
{
gimp_display_shell_render_highlight (shell, x, y, w, h, highlight);
}
else
else if (shell->mask)
{
if (shell->mask)
{
render_image_init_info (&info, shell, x, y,
gimp_drawable_data (shell->mask));
gimp_display_shell_render_mask (shell, &info);
}
render_image_init_info (&info, shell, x, y,
gimp_drawable_data (shell->mask));
if (shell->overlay)
{
render_image_init_info (&info, shell, x, y,
gimp_drawable_data (shell->overlay));
gimp_display_shell_render_overlay (shell, &info,
shell->overlay_color);
}
gimp_display_shell_render_mask (shell, &info);
}
/* put it to the screen */
......@@ -409,64 +394,6 @@ gimp_display_shell_render_mask (GimpDisplayShell *shell,
}
}
static void
gimp_display_shell_render_overlay (GimpDisplayShell *shell,
RenderInfo *info,
const guchar *color)
{
gint y, ye;
gint x, xe;
gboolean initial = TRUE;
y = info->y;
ye = info->y + info->h;
xe = info->x + info->w;
info->src = render_image_tile_fault (info);
while (TRUE)
{
gint error =
RINT (floor ((y + 1) / info->scaley) - floor (y / info->scaley));
if (!initial && (error == 0))
{
memcpy (info->dest, info->dest - info->dest_bpl, info->dest_width);
}
else
{
const guchar *src = info->src;
guchar *dest = info->dest;
for (x = info->x; x < xe; x++, src++, dest += 3)
{
if (*src & 0x80)
{
dest[0] = color[0];
dest[1] = color[1];
dest[2] = color[2];
}
}
}
if (++y == ye)
break;
info->dest += info->dest_bpl;
if (error)
{
info->src_y += error;
info->src = render_image_tile_fault (info);
initial = TRUE;
}
else
{
initial = FALSE;
}
}
}
/*************************/
/* 8 Bit functions */
......
......@@ -320,7 +320,6 @@ gimp_display_shell_init (GimpDisplayShell *shell)
shell->highlight = NULL;
shell->mask = NULL;
shell->overlay = NULL;
gtk_window_set_role (GTK_WINDOW (shell), "gimp-image-window");
gtk_window_set_resizable (GTK_WINDOW (shell), TRUE);
......@@ -416,12 +415,6 @@ gimp_display_shell_destroy (GtkObject *object)
shell->mask = NULL;
}
if (shell->overlay)
{
g_object_unref (shell->overlay);
shell->overlay = NULL;
}
if (shell->title_idle_id)
{
g_source_remove (shell->title_idle_id);
......@@ -1617,57 +1610,16 @@ gimp_display_shell_set_mask (GimpDisplayShell *shell,
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (mask == NULL ||
(GIMP_IS_DRAWABLE (mask) && gimp_drawable_bytes (mask) == 1));
(GIMP_IS_DRAWABLE (mask) &&
gimp_drawable_bytes (mask) == 1));
if (shell->mask == mask)
return;
if (mask)
g_object_ref (mask);
if (shell->mask)
g_object_unref (shell->mask);
shell->mask = mask;
gimp_display_shell_expose_full (shell);
}
/**
* gimp_display_shell_set_overlay:
* @shell: a #GimpDisplayShell
* @mask: a #GimpDrawable (1 byte per pixel)
* @color: the color to use for the overlay (or %NULL to not change color)
*
* Allows to mark areas in a given color (used by the foreground
* selection tool). Pixels that are selected (> 127) in the mask are
* drawn in the given color.
**/
void
gimp_display_shell_set_overlay (GimpDisplayShell *shell,
GimpDrawable *mask,
const GimpRGB *color)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (mask == NULL ||
(GIMP_IS_DRAWABLE (mask) && gimp_drawable_bytes (mask) == 1));
if (shell->overlay == mask && ! color)
return;
if (color)
gimp_rgb_get_uchar (color,
shell->overlay_color + 0,
shell->overlay_color + 1,
shell->overlay_color + 2);
if (mask)
g_object_ref (mask);
if (shell->overlay)
g_object_unref (shell->overlay);
shell->overlay = mask;
shell->mask = mask ? g_object_ref (mask) : NULL;
gimp_display_shell_expose_full (shell);
}
......@@ -165,10 +165,7 @@ struct _GimpDisplayShell
guint32 last_motion_time;
GdkRectangle *highlight; /* in image coordinates, can be NULL */
GimpDrawable *mask;
GimpDrawable *overlay;
guchar overlay_color[3];
gpointer scroll_info;
};
......@@ -241,8 +238,6 @@ void gimp_display_shell_set_highlight (GimpDisplayShell *shell,
const GdkRectangle *highlight);
void gimp_display_shell_set_mask (GimpDisplayShell *shell,
GimpDrawable *mask);
void gimp_display_shell_set_overlay (GimpDisplayShell *shell,
GimpDrawable *mask,
const GimpRGB *color);
#endif /* __GIMP_DISPLAY_SHELL_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment