From 57157b404110ce569b3ee0a04541dce6b051a696 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Fri, 30 Nov 2001 18:23:49 +0000 Subject: [PATCH] app/display/Makefile.am removed. It was a wrapper around nothing since we 2001-11-30 Michael Natterer * app/display/Makefile.am * app/display/gximage.[ch]: removed. It was a wrapper around nothing since we use GdkRGB. * app/display/gimpdisplayshell-render.[ch]: added the render buf size defines here, added the #if 0'ed display filter stuff and the actual GdkRGB render stuff here too. * app/display/gimpdisplayshell.[ch]: added shell->render_buf as replacement for the global gximage buffer, renamed shell->scroll_gc to shell->render_gc and use it all over the place when rendering image data. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-scroll.c: changed accordingly. * app/gui/gui.c: don't call gximage init/exit stuff. --- ChangeLog | 20 +++ app/display/Makefile.am | 3 - app/display/gimpdisplayshell-callbacks.c | 6 +- app/display/gimpdisplayshell-draw.c | 59 +++---- app/display/gimpdisplayshell-draw.h | 3 +- app/display/gimpdisplayshell-render.c | 186 +++++++++++++---------- app/display/gimpdisplayshell-render.h | 21 ++- app/display/gimpdisplayshell-scroll.c | 2 +- app/display/gimpdisplayshell.c | 59 +++---- app/display/gimpdisplayshell.h | 3 +- app/display/gximage.c | 137 ----------------- app/display/gximage.h | 34 ----- app/gui/gui.c | 3 - 13 files changed, 193 insertions(+), 343 deletions(-) delete mode 100644 app/display/gximage.c delete mode 100644 app/display/gximage.h diff --git a/ChangeLog b/ChangeLog index df7a9914db..9ca3a83e42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2001-11-30 Michael Natterer + + * app/display/Makefile.am + * app/display/gximage.[ch]: removed. It was a wrapper around + nothing since we use GdkRGB. + + * app/display/gimpdisplayshell-render.[ch]: added the render + buf size defines here, added the #if 0'ed display filter stuff + and the actual GdkRGB render stuff here too. + + * app/display/gimpdisplayshell.[ch]: added shell->render_buf as + replacement for the global gximage buffer, renamed shell->scroll_gc + to shell->render_gc and use it all over the place when rendering + image data. + + * app/display/gimpdisplayshell-callbacks.c + * app/display/gimpdisplayshell-scroll.c: changed accordingly. + + * app/gui/gui.c: don't call gximage init/exit stuff. + 2001-11-30 Rebecca Walter * app/gui/gradient-select.c diff --git a/app/display/Makefile.am b/app/display/Makefile.am index 92c67f810d..96dd7bf5f1 100644 --- a/app/display/Makefile.am +++ b/app/display/Makefile.am @@ -31,9 +31,6 @@ libappdisplay_a_SOURCES = @STRIP_BEGIN@ \ gimpdisplayshell-scroll.h \ gimpdisplayshell-selection.c \ gimpdisplayshell-selection.h \ - \ - gximage.c \ - gximage.h \ @STRIP_END@ AM_CPPFLAGS = @STRIP_BEGIN@ \ diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c index d8ed37827a..f63412d8da 100644 --- a/app/display/gimpdisplayshell-callbacks.c +++ b/app/display/gimpdisplayshell-callbacks.c @@ -173,9 +173,9 @@ gimp_display_shell_canvas_realize (GtkWidget *canvas, shell->disp_width = canvas->allocation.width; shell->disp_height = canvas->allocation.height; - /* create GC for scrolling */ - shell->scroll_gc = gdk_gc_new (shell->canvas->window); - gdk_gc_set_exposures (shell->scroll_gc, TRUE); + /* create GC for rendering */ + shell->render_gc = gdk_gc_new (shell->canvas->window); + gdk_gc_set_exposures (shell->render_gc, TRUE); /* set up the scrollbar observers */ g_signal_connect (G_OBJECT (shell->hsbdata), "value_changed", diff --git a/app/display/gimpdisplayshell-draw.c b/app/display/gimpdisplayshell-draw.c index 41f5e50c98..53a83eb4a2 100644 --- a/app/display/gimpdisplayshell-draw.c +++ b/app/display/gimpdisplayshell-draw.c @@ -60,7 +60,6 @@ #include "gimpdisplayshell-handlers.h" #include "gimpdisplayshell-render.h" #include "gimpdisplayshell-selection.h" -#include "gximage.h" #include "gimprc.h" #include "nav_window.h" @@ -207,7 +206,10 @@ gimp_display_shell_init (GimpDisplayShell *shell) shell->cursor_format_str[0] = '\0'; shell->cancelbutton = NULL; - shell->scroll_gc = NULL; + shell->render_buf = g_malloc (GIMP_DISPLAY_SHELL_RENDER_BUF_WIDTH * + GIMP_DISPLAY_SHELL_RENDER_BUF_HEIGHT * + 3); + shell->render_gc = NULL; shell->icon_size = 32; shell->icon_idle_id = 0; @@ -264,10 +266,16 @@ gimp_display_shell_destroy (GtkObject *object) gdisplay_color_detach_all (gdisp); #endif /* DISPLAY_FILTERS */ - if (shell->scroll_gc) + if (shell->render_buf) { - gdk_gc_unref (shell->scroll_gc); - shell->scroll_gc = NULL; + g_free (shell->render_buf); + shell->render_buf = NULL; + } + + if (shell->render_gc) + { + gdk_gc_unref (shell->render_gc); + shell->render_gc = NULL; } if (shell->icon_idle_id) @@ -1983,16 +1991,6 @@ gimp_display_shell_display_area (GimpDisplayShell *shell, gint dx, dy; gint i, j; -#ifdef DISPLAY_FILTERS - guchar *buf; - gint bpp, bpl; - GList *list; - - buf = gximage_get_data (); - bpp = gximage_get_bpp (); - bpl = gximage_get_bpl (); -#endif /* DISPLAY_FILTERS */ - sx = SCALEX (shell->gdisp, shell->gdisp->gimage->width); sy = SCALEY (shell->gdisp, shell->gdisp->gimage->height); @@ -2058,17 +2056,18 @@ gimp_display_shell_display_area (GimpDisplayShell *shell, y2 = shell->disp_yoffset + sy; } - /* display the image in GXIMAGE_WIDTH x GXIMAGE_HEIGHT sized chunks */ - for (i = y1; i < y2; i += GXIMAGE_HEIGHT) + /* display the image in RENDER_BUF_WIDTH x RENDER_BUF_HEIGHT sized chunks */ + for (i = y1; i < y2; i += GIMP_DISPLAY_SHELL_RENDER_BUF_HEIGHT) { - for (j = x1; j < x2; j += GXIMAGE_WIDTH) + for (j = x1; j < x2; j += GIMP_DISPLAY_SHELL_RENDER_BUF_WIDTH) { - dx = MIN (x2 - j, GXIMAGE_WIDTH); - dy = MIN (y2 - i, GXIMAGE_HEIGHT); + dx = MIN (x2 - j, GIMP_DISPLAY_SHELL_RENDER_BUF_WIDTH); + dy = MIN (y2 - i, GIMP_DISPLAY_SHELL_RENDER_BUF_HEIGHT); - render_image (shell->gdisp, - j - shell->disp_xoffset, i - shell->disp_yoffset, - dx, dy); + gimp_display_shell_render (shell, + j - shell->disp_xoffset, + i - shell->disp_yoffset, + dx, dy); #if 0 /* Invalidate the projection just after we render it! */ @@ -2078,20 +2077,6 @@ gimp_display_shell_display_area (GimpDisplayShell *shell, dx, dy, 0, 0, 0, 0); #endif - -#ifdef DISPLAY_FILTERS - for (list = shell->cd_list; list; list = g_list_next (list)) - { - ColorDisplayNode *node = (ColorDisplayNode *) list->data; - - node->cd_convert (node->cd_ID, buf, dx, dy, bpp, bpl); - } -#endif /* DISPLAY_FILTERS */ - - gximage_put (shell->canvas->window, - j, i, dx, dy, - shell->offset_x, - shell->offset_y); } } } diff --git a/app/display/gimpdisplayshell-draw.h b/app/display/gimpdisplayshell-draw.h index e5b8be8416..3f66914eaf 100644 --- a/app/display/gimpdisplayshell-draw.h +++ b/app/display/gimpdisplayshell-draw.h @@ -88,7 +88,8 @@ struct _GimpDisplayShell gchar cursor_format_str[CURSOR_FORMAT_LENGTH]; GtkWidget *cancelbutton; /* cancel button */ - GdkGC *scroll_gc; /* GC for scrolling */ + guchar *render_buf; /* buffer for rendering the image */ + GdkGC *render_gc; /* GC for rendering the image */ gint icon_size; /* size of the icon pixmap */ guint icon_idle_id; /* ID of the idle-function */ diff --git a/app/display/gimpdisplayshell-render.c b/app/display/gimpdisplayshell-render.c index 055d7703b7..68a33840d9 100644 --- a/app/display/gimpdisplayshell-render.c +++ b/app/display/gimpdisplayshell-render.c @@ -34,36 +34,32 @@ #include "gimpdisplay.h" #include "gimpdisplayshell.h" #include "gimpdisplayshell-render.h" -#include "gximage.h" #include "gimprc.h" -#define MAX_PREVIEW_SIZE 256 /* EEK */ - - typedef struct _RenderInfo RenderInfo; typedef void (* RenderFunc) (RenderInfo *info); struct _RenderInfo { - GimpDisplay *gdisp; - TileManager *src_tiles; - guint *alpha; - guchar *scale; - guchar *src; - guchar *dest; - gint x, y; - gint w, h; - gfloat scalex; - gfloat scaley; - gint src_x, src_y; - gint src_bpp; - gint dest_bpp; - gint dest_bpl; - gint dest_width; - gint byte_order; + GimpDisplayShell *shell; + TileManager *src_tiles; + guint *alpha; + guchar *scale; + guchar *src; + guchar *dest; + gint x, y; + gint w, h; + gfloat scalex; + gfloat scaley; + gint src_x, src_y; + gint src_bpp; + gint dest_bpp; + gint dest_bpl; + gint dest_width; + gint byte_order; }; @@ -110,7 +106,7 @@ render_setup (GimpCheckType check_type, /* allocate a buffer for arranging information from a row of tiles */ if (! tile_buf) - tile_buf = g_new (guchar, GXIMAGE_WIDTH * MAX_CHANNELS); + tile_buf = g_new (guchar, GIMP_DISPLAY_SHELL_RENDER_BUF_WIDTH * MAX_CHANNELS); if (! render_blend_dark_check) render_blend_dark_check = g_new (guchar, 65536); @@ -146,6 +142,8 @@ render_setup (GimpCheckType check_type, g_free (render_empty_buf); g_free (render_temp_buf); +#define MAX_PREVIEW_SIZE 256 /* EEK */ + /* calculate check buffer for previews */ if (TRUE /* preview_size */) { @@ -188,24 +186,24 @@ render_free (void) /* Render Image functions */ -static void render_image_rgb (RenderInfo *info); -static void render_image_rgb_a (RenderInfo *info); -static void render_image_gray (RenderInfo *info); -static void render_image_gray_a (RenderInfo *info); -static void render_image_indexed (RenderInfo *info); -static void render_image_indexed_a (RenderInfo *info); +static void render_image_rgb (RenderInfo *info); +static void render_image_rgb_a (RenderInfo *info); +static void render_image_gray (RenderInfo *info); +static void render_image_gray_a (RenderInfo *info); +static void render_image_indexed (RenderInfo *info); +static void render_image_indexed_a (RenderInfo *info); -static void render_image_init_info (RenderInfo *info, - GimpDisplay *gdisp, - gint x, - gint y, - gint w, - gint h); -static guint * render_image_init_alpha (gint mult); -static guchar * render_image_accelerate_scaling (gint width, - gint start, - gfloat scalex); -static guchar * render_image_tile_fault (RenderInfo *info); +static void render_image_init_info (RenderInfo *info, + GimpDisplayShell *shell, + gint x, + gint y, + gint w, + gint h); +static guint * render_image_init_alpha (gint mult); +static guchar * render_image_accelerate_scaling (gint width, + gint start, + gfloat scalex); +static guchar * render_image_tile_fault (RenderInfo *info); static RenderFunc render_funcs[6] = @@ -227,23 +225,27 @@ static RenderFunc render_funcs[6] = /*****************************************************************/ void -render_image (GimpDisplay *gdisp, - gint x, - gint y, - gint w, - gint h) +gimp_display_shell_render (GimpDisplayShell *shell, + gint x, + gint y, + gint w, + gint h) { RenderInfo info; gint image_type; - render_image_init_info (&info, gdisp, x, y, w, h); +#ifdef DISPLAY_FILTERS + GList *list; +#endif - image_type = gimp_image_projection_type (gdisp->gimage); + render_image_init_info (&info, shell, x, y, w, h); + + image_type = gimp_image_projection_type (shell->gdisp->gimage); if ((image_type < 0) || (image_type > 5)) { g_message ("unknown gimage projection type: %d", - gimp_image_projection_type (gdisp->gimage)); + gimp_image_projection_type (shell->gdisp->gimage)); return; } @@ -257,9 +259,37 @@ render_image (GimpDisplay *gdisp, * are in case of future need. -- austin, 28th Nov 1998. */ if (image_type != RGBA_GIMAGE && image_type != GRAYA_GIMAGE) - g_warning ("using untested projection type %d", image_type); + g_warning ("using untested projection type %d", image_type); (* render_funcs[image_type]) (&info); + +#if 0 +#ifdef DISPLAY_FILTERS + /* apply filters to the rendered projection */ + for (list = shell->cd_list; list; list = g_list_next (list)) + { + ColorDisplayNode *node = (ColorDisplayNode *) list->data; + + node->cd_convert (node->cd_ID, + shell->render_buf, + w, h, + 3, + 3 * GIMP_DISPLAY_SHELL_RENDER_BUF_WIDTH); + } +#endif /* DISPLAY_FILTERS */ +#endif + + /* put it to the screen */ + gdk_draw_rgb_image_dithalign (shell->canvas->window, + shell->render_gc, + x + shell->disp_xoffset, + y + shell->disp_yoffset, + w, h, + GDK_RGB_DITHER_MAX, + shell->render_buf, + 3 * GIMP_DISPLAY_SHELL_RENDER_BUF_WIDTH, + shell->offset_x, + shell->offset_y); } @@ -281,7 +311,7 @@ render_image_indexed (RenderInfo *info) gfloat error; gfloat step; - cmap = gimp_image_get_colormap (info->gdisp->gimage); + cmap = gimp_image_get_colormap (info->shell->gdisp->gimage); y = info->y; ye = info->y + info->h; @@ -355,7 +385,7 @@ render_image_indexed_a (RenderInfo *info) gfloat error; gfloat step; - cmap = gimp_image_get_colormap (info->gdisp->gimage); + cmap = gimp_image_get_colormap (info->shell->gdisp->gimage); alpha = info->alpha; y = info->y; @@ -736,39 +766,39 @@ render_image_rgb_a (RenderInfo *info) } static void -render_image_init_info (RenderInfo *info, - GimpDisplay *gdisp, - gint x, - gint y, - gint w, - gint h) +render_image_init_info (RenderInfo *info, + GimpDisplayShell *shell, + gint x, + gint y, + gint w, + gint h) { - info->gdisp = gdisp; - info->src_tiles = gimp_image_projection (gdisp->gimage); - info->x = x + GIMP_DISPLAY_SHELL (gdisp->shell)->offset_x; - info->y = y + GIMP_DISPLAY_SHELL (gdisp->shell)->offset_y; + info->shell = shell; + info->src_tiles = gimp_image_projection (shell->gdisp->gimage); + info->x = x + shell->offset_x; + info->y = y + shell->offset_y; info->w = w; info->h = h; - info->scalex = SCALEFACTOR_X (gdisp); - info->scaley = SCALEFACTOR_Y (gdisp); - info->src_x = UNSCALEX (gdisp, info->x); - info->src_y = UNSCALEY (gdisp, info->y); - info->src_bpp = gimp_image_projection_bytes (gdisp->gimage); - info->dest = gximage_get_data (); - info->dest_bpp = gximage_get_bpp (); - info->dest_bpl = gximage_get_bpl (); + info->scalex = SCALEFACTOR_X (shell->gdisp); + info->scaley = SCALEFACTOR_Y (shell->gdisp); + info->src_x = UNSCALEX (shell->gdisp, info->x); + info->src_y = UNSCALEY (shell->gdisp, info->y); + info->src_bpp = gimp_image_projection_bytes (shell->gdisp->gimage); + info->dest = shell->render_buf; + info->dest_bpp = 3; + info->dest_bpl = info->dest_bpp * GIMP_DISPLAY_SHELL_RENDER_BUF_WIDTH; info->dest_width = info->w * info->dest_bpp; - info->byte_order = gximage_get_byte_order (); + info->byte_order = GDK_MSB_FIRST; info->scale = render_image_accelerate_scaling (w, info->x, info->scalex); info->alpha = NULL; - switch (gimp_image_projection_type (gdisp->gimage)) + switch (gimp_image_projection_type (shell->gdisp->gimage)) { case RGBA_GIMAGE: case GRAYA_GIMAGE: case INDEXEDA_GIMAGE: info->alpha = - render_image_init_alpha (gimp_image_projection_opacity (gdisp->gimage)); + render_image_init_alpha (gimp_image_projection_opacity (shell->gdisp->gimage)); break; default: /* nothing special needs doing */ @@ -797,7 +827,7 @@ render_image_init_alpha (gint mult) return alpha_mult; } -static guchar* +static guchar * render_image_accelerate_scaling (gint width, gint start, gfloat scalex) @@ -808,19 +838,19 @@ render_image_accelerate_scaling (gint width, gfloat step; gint i; - if (!scale) - scale = g_new (guchar, GXIMAGE_WIDTH + 1); + if (! scale) + scale = g_new (guchar, GIMP_DISPLAY_SHELL_RENDER_BUF_WIDTH + 1); step = 1.0 / scalex; error = start * step; - error -= ((int)error) - step; + error -= ((gint) error) - step; for (i = 0; i <= width; i++) - { - scale[i] = ((int)error); - error += step - (int)error; - } + { + scale[i] = ((gint) error); + error += step - (gint) error; + } return scale; } diff --git a/app/display/gimpdisplayshell-render.h b/app/display/gimpdisplayshell-render.h index c2cc4100c3..02fbdbe662 100644 --- a/app/display/gimpdisplayshell-render.h +++ b/app/display/gimpdisplayshell-render.h @@ -16,19 +16,24 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __GIMP_DISPLAY_RENDER_H__ -#define __GIMP_DISPLAY_RENDER_H__ +#ifndef __GIMP_DISPLAY_SHELL_RENDER_H__ +#define __GIMP_DISPLAY_SHELL_RENDER_H__ + + +#define GIMP_DISPLAY_SHELL_RENDER_BUF_WIDTH 256 +#define GIMP_DISPLAY_SHELL_RENDER_BUF_HEIGHT 256 /* Functions */ void render_setup (GimpCheckType check_type, GimpCheckSize check_size); void render_free (void); -void render_image (GimpDisplay *gdisp, - gint x, - gint y, - gint w, - gint h); + +void gimp_display_shell_render (GimpDisplayShell *shell, + gint x, + gint y, + gint w, + gint h); /* * Extern variables @@ -40,4 +45,4 @@ extern guchar *render_blend_dark_check; extern guchar *render_blend_light_check; -#endif /* __GIMP_DISPLAY_RENDER_H__ */ +#endif /* __GIMP_DISPLAY_SHELL_RENDER_H__ */ diff --git a/app/display/gimpdisplayshell-scroll.c b/app/display/gimpdisplayshell-scroll.c index 1e5d506950..3aa7d46651 100644 --- a/app/display/gimpdisplayshell-scroll.c +++ b/app/display/gimpdisplayshell-scroll.c @@ -88,7 +88,7 @@ gimp_display_shell_scroll (GimpDisplayShell *shell, shell->offset_y += y_offset; gdk_draw_drawable (shell->canvas->window, - shell->scroll_gc, + shell->render_gc, shell->canvas->window, src_x, src_y, dest_x, dest_y, diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c index 41f5e50c98..53a83eb4a2 100644 --- a/app/display/gimpdisplayshell.c +++ b/app/display/gimpdisplayshell.c @@ -60,7 +60,6 @@ #include "gimpdisplayshell-handlers.h" #include "gimpdisplayshell-render.h" #include "gimpdisplayshell-selection.h" -#include "gximage.h" #include "gimprc.h" #include "nav_window.h" @@ -207,7 +206,10 @@ gimp_display_shell_init (GimpDisplayShell *shell) shell->cursor_format_str[0] = '\0'; shell->cancelbutton = NULL; - shell->scroll_gc = NULL; + shell->render_buf = g_malloc (GIMP_DISPLAY_SHELL_RENDER_BUF_WIDTH * + GIMP_DISPLAY_SHELL_RENDER_BUF_HEIGHT * + 3); + shell->render_gc = NULL; shell->icon_size = 32; shell->icon_idle_id = 0; @@ -264,10 +266,16 @@ gimp_display_shell_destroy (GtkObject *object) gdisplay_color_detach_all (gdisp); #endif /* DISPLAY_FILTERS */ - if (shell->scroll_gc) + if (shell->render_buf) { - gdk_gc_unref (shell->scroll_gc); - shell->scroll_gc = NULL; + g_free (shell->render_buf); + shell->render_buf = NULL; + } + + if (shell->render_gc) + { + gdk_gc_unref (shell->render_gc); + shell->render_gc = NULL; } if (shell->icon_idle_id) @@ -1983,16 +1991,6 @@ gimp_display_shell_display_area (GimpDisplayShell *shell, gint dx, dy; gint i, j; -#ifdef DISPLAY_FILTERS - guchar *buf; - gint bpp, bpl; - GList *list; - - buf = gximage_get_data (); - bpp = gximage_get_bpp (); - bpl = gximage_get_bpl (); -#endif /* DISPLAY_FILTERS */ - sx = SCALEX (shell->gdisp, shell->gdisp->gimage->width); sy = SCALEY (shell->gdisp, shell->gdisp->gimage->height); @@ -2058,17 +2056,18 @@ gimp_display_shell_display_area (GimpDisplayShell *shell, y2 = shell->disp_yoffset + sy; } - /* display the image in GXIMAGE_WIDTH x GXIMAGE_HEIGHT sized chunks */ - for (i = y1; i < y2; i += GXIMAGE_HEIGHT) + /* display the image in RENDER_BUF_WIDTH x RENDER_BUF_HEIGHT sized chunks */ + for (i = y1; i < y2; i += GIMP_DISPLAY_SHELL_RENDER_BUF_HEIGHT) { - for (j = x1; j < x2; j += GXIMAGE_WIDTH) + for (j = x1; j < x2; j += GIMP_DISPLAY_SHELL_RENDER_BUF_WIDTH) { - dx = MIN (x2 - j, GXIMAGE_WIDTH); - dy = MIN (y2 - i, GXIMAGE_HEIGHT); + dx = MIN (x2 - j, GIMP_DISPLAY_SHELL_RENDER_BUF_WIDTH); + dy = MIN (y2 - i, GIMP_DISPLAY_SHELL_RENDER_BUF_HEIGHT); - render_image (shell->gdisp, - j - shell->disp_xoffset, i - shell->disp_yoffset, - dx, dy); + gimp_display_shell_render (shell, + j - shell->disp_xoffset, + i - shell->disp_yoffset, + dx, dy); #if 0 /* Invalidate the projection just after we render it! */ @@ -2078,20 +2077,6 @@ gimp_display_shell_display_area (GimpDisplayShell *shell, dx, dy, 0, 0, 0, 0); #endif - -#ifdef DISPLAY_FILTERS - for (list = shell->cd_list; list; list = g_list_next (list)) - { - ColorDisplayNode *node = (ColorDisplayNode *) list->data; - - node->cd_convert (node->cd_ID, buf, dx, dy, bpp, bpl); - } -#endif /* DISPLAY_FILTERS */ - - gximage_put (shell->canvas->window, - j, i, dx, dy, - shell->offset_x, - shell->offset_y); } } } diff --git a/app/display/gimpdisplayshell.h b/app/display/gimpdisplayshell.h index e5b8be8416..3f66914eaf 100644 --- a/app/display/gimpdisplayshell.h +++ b/app/display/gimpdisplayshell.h @@ -88,7 +88,8 @@ struct _GimpDisplayShell gchar cursor_format_str[CURSOR_FORMAT_LENGTH]; GtkWidget *cancelbutton; /* cancel button */ - GdkGC *scroll_gc; /* GC for scrolling */ + guchar *render_buf; /* buffer for rendering the image */ + GdkGC *render_gc; /* GC for rendering the image */ gint icon_size; /* size of the icon pixmap */ guint icon_idle_id; /* ID of the idle-function */ diff --git a/app/display/gximage.c b/app/display/gximage.c deleted file mode 100644 index 5c5bf3b9d5..0000000000 --- a/app/display/gximage.c +++ /dev/null @@ -1,137 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "display-types.h" - -#include "gximage.h" - - -typedef struct _GXImage GXImage; - -struct _GXImage -{ - long width, height; /* width and height of ximage structure */ - - GdkVisual *visual; /* visual appropriate to our depth */ - GdkGC *gc; /* graphics context */ - - guchar *data; -}; - - -/* The static gximages for drawing to windows */ -static GXImage *gximage = NULL; - -#define QUANTUM 32 - -/* STATIC functions */ - -static GXImage * -create_gximage (GdkVisual *visual, - gint width, - gint height) -{ - GXImage * gximage; - - gximage = g_new (GXImage, 1); - - gximage->visual = visual; - gximage->gc = NULL; - - gximage->data = g_malloc (width * height * 3); - - return gximage; -} - -static void -delete_gximage (GXImage *gximage) -{ - g_free (gximage->data); - if (gximage->gc) - gdk_gc_unref (gximage->gc); - g_free (gximage); -} - -/****************************************************************/ - - -/* Function definitions */ - -void -gximage_init (void) -{ - gximage = create_gximage (gdk_rgb_get_visual (), - GXIMAGE_WIDTH, GXIMAGE_HEIGHT); -} - -void -gximage_free (void) -{ - delete_gximage (gximage); -} - -guchar* -gximage_get_data (void) -{ - return gximage->data; -} - -int -gximage_get_bpp (void) -{ - return 3; -} - -int -gximage_get_bpl (void) -{ - return 3 * GXIMAGE_WIDTH; -} - -int -gximage_get_byte_order (void) -{ - return GDK_MSB_FIRST; -} - -void -gximage_put (GdkWindow *win, int x, int y, int w, int h, int xdith, int ydith) -{ - /* create the GC if it doesn't yet exist */ - if (!gximage->gc) - { - gximage->gc = gdk_gc_new (win); - gdk_gc_set_exposures (gximage->gc, TRUE); - } - - gdk_draw_rgb_image_dithalign (win, - gximage->gc, - x, - y, - w, - h, - /* todo: make configurable */ - GDK_RGB_DITHER_MAX, - gximage->data, - GXIMAGE_WIDTH * 3, - xdith, ydith); -} diff --git a/app/display/gximage.h b/app/display/gximage.h deleted file mode 100644 index 5f9fb1c39d..0000000000 --- a/app/display/gximage.h +++ /dev/null @@ -1,34 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ -#ifndef __GXIMAGE_H__ -#define __GXIMAGE_H__ - -#define GXIMAGE_WIDTH 256 -#define GXIMAGE_HEIGHT 256 - -void gximage_init (void); -void gximage_free (void); - -void -gximage_put (GdkWindow *win, int x, int y, int w, int h, int xdith, int ydith); -guchar* gximage_get_data (void); -int gximage_get_bpp (void); -int gximage_get_bpl (void); -int gximage_get_byte_order (void); - -#endif /* __GXIMAGE_H__ */ diff --git a/app/gui/gui.c b/app/gui/gui.c index 3d9da9c1ca..8f5a095e6e 100644 --- a/app/gui/gui.c +++ b/app/gui/gui.c @@ -38,7 +38,6 @@ #include "display/gimpdisplay-foreach.h" #include "display/gimpdisplayshell.h" #include "display/gimpdisplayshell-render.h" -#include "display/gximage.h" #include "widgets/gimpdialogfactory.h" #include "widgets/gimpitemfactory.h" @@ -249,7 +248,6 @@ gui_init (Gimp *gimp) color_display_init (); #endif /* DISPLAY_FILTERS */ - gximage_init (); render_setup (gimprc.transparency_type, gimprc.transparency_size); dialogs_init (gimp); @@ -314,7 +312,6 @@ gui_exit (Gimp *gimp) g_return_if_fail (GIMP_IS_GIMP (gimp)); menus_exit (gimp); - gximage_free (); render_free (); dialogs_exit (gimp);