app/display/Makefile.am removed. It was a wrapper around nothing since we
2001-11-30 Michael Natterer <mitch@gimp.org> * 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.
This commit is contained in:

committed by
Michael Natterer

parent
bf860fd1af
commit
57157b4041
20
ChangeLog
20
ChangeLog
@ -1,3 +1,23 @@
|
|||||||
|
2001-11-30 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
* 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 <bex@gimp.org>
|
2001-11-30 Rebecca Walter <bex@gimp.org>
|
||||||
|
|
||||||
* app/gui/gradient-select.c
|
* app/gui/gradient-select.c
|
||||||
|
@ -31,9 +31,6 @@ libappdisplay_a_SOURCES = @STRIP_BEGIN@ \
|
|||||||
gimpdisplayshell-scroll.h \
|
gimpdisplayshell-scroll.h \
|
||||||
gimpdisplayshell-selection.c \
|
gimpdisplayshell-selection.c \
|
||||||
gimpdisplayshell-selection.h \
|
gimpdisplayshell-selection.h \
|
||||||
\
|
|
||||||
gximage.c \
|
|
||||||
gximage.h \
|
|
||||||
@STRIP_END@
|
@STRIP_END@
|
||||||
|
|
||||||
AM_CPPFLAGS = @STRIP_BEGIN@ \
|
AM_CPPFLAGS = @STRIP_BEGIN@ \
|
||||||
|
@ -173,9 +173,9 @@ gimp_display_shell_canvas_realize (GtkWidget *canvas,
|
|||||||
shell->disp_width = canvas->allocation.width;
|
shell->disp_width = canvas->allocation.width;
|
||||||
shell->disp_height = canvas->allocation.height;
|
shell->disp_height = canvas->allocation.height;
|
||||||
|
|
||||||
/* create GC for scrolling */
|
/* create GC for rendering */
|
||||||
shell->scroll_gc = gdk_gc_new (shell->canvas->window);
|
shell->render_gc = gdk_gc_new (shell->canvas->window);
|
||||||
gdk_gc_set_exposures (shell->scroll_gc, TRUE);
|
gdk_gc_set_exposures (shell->render_gc, TRUE);
|
||||||
|
|
||||||
/* set up the scrollbar observers */
|
/* set up the scrollbar observers */
|
||||||
g_signal_connect (G_OBJECT (shell->hsbdata), "value_changed",
|
g_signal_connect (G_OBJECT (shell->hsbdata), "value_changed",
|
||||||
|
@ -60,7 +60,6 @@
|
|||||||
#include "gimpdisplayshell-handlers.h"
|
#include "gimpdisplayshell-handlers.h"
|
||||||
#include "gimpdisplayshell-render.h"
|
#include "gimpdisplayshell-render.h"
|
||||||
#include "gimpdisplayshell-selection.h"
|
#include "gimpdisplayshell-selection.h"
|
||||||
#include "gximage.h"
|
|
||||||
|
|
||||||
#include "gimprc.h"
|
#include "gimprc.h"
|
||||||
#include "nav_window.h"
|
#include "nav_window.h"
|
||||||
@ -207,7 +206,10 @@ gimp_display_shell_init (GimpDisplayShell *shell)
|
|||||||
shell->cursor_format_str[0] = '\0';
|
shell->cursor_format_str[0] = '\0';
|
||||||
shell->cancelbutton = NULL;
|
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_size = 32;
|
||||||
shell->icon_idle_id = 0;
|
shell->icon_idle_id = 0;
|
||||||
@ -264,10 +266,16 @@ gimp_display_shell_destroy (GtkObject *object)
|
|||||||
gdisplay_color_detach_all (gdisp);
|
gdisplay_color_detach_all (gdisp);
|
||||||
#endif /* DISPLAY_FILTERS */
|
#endif /* DISPLAY_FILTERS */
|
||||||
|
|
||||||
if (shell->scroll_gc)
|
if (shell->render_buf)
|
||||||
{
|
{
|
||||||
gdk_gc_unref (shell->scroll_gc);
|
g_free (shell->render_buf);
|
||||||
shell->scroll_gc = NULL;
|
shell->render_buf = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shell->render_gc)
|
||||||
|
{
|
||||||
|
gdk_gc_unref (shell->render_gc);
|
||||||
|
shell->render_gc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shell->icon_idle_id)
|
if (shell->icon_idle_id)
|
||||||
@ -1983,16 +1991,6 @@ gimp_display_shell_display_area (GimpDisplayShell *shell,
|
|||||||
gint dx, dy;
|
gint dx, dy;
|
||||||
gint i, j;
|
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);
|
sx = SCALEX (shell->gdisp, shell->gdisp->gimage->width);
|
||||||
sy = SCALEY (shell->gdisp, shell->gdisp->gimage->height);
|
sy = SCALEY (shell->gdisp, shell->gdisp->gimage->height);
|
||||||
|
|
||||||
@ -2058,17 +2056,18 @@ gimp_display_shell_display_area (GimpDisplayShell *shell,
|
|||||||
y2 = shell->disp_yoffset + sy;
|
y2 = shell->disp_yoffset + sy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* display the image in GXIMAGE_WIDTH x GXIMAGE_HEIGHT sized chunks */
|
/* display the image in RENDER_BUF_WIDTH x RENDER_BUF_HEIGHT sized chunks */
|
||||||
for (i = y1; i < y2; i += GXIMAGE_HEIGHT)
|
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);
|
dx = MIN (x2 - j, GIMP_DISPLAY_SHELL_RENDER_BUF_WIDTH);
|
||||||
dy = MIN (y2 - i, GXIMAGE_HEIGHT);
|
dy = MIN (y2 - i, GIMP_DISPLAY_SHELL_RENDER_BUF_HEIGHT);
|
||||||
|
|
||||||
render_image (shell->gdisp,
|
gimp_display_shell_render (shell,
|
||||||
j - shell->disp_xoffset, i - shell->disp_yoffset,
|
j - shell->disp_xoffset,
|
||||||
dx, dy);
|
i - shell->disp_yoffset,
|
||||||
|
dx, dy);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Invalidate the projection just after we render it! */
|
/* Invalidate the projection just after we render it! */
|
||||||
@ -2078,20 +2077,6 @@ gimp_display_shell_display_area (GimpDisplayShell *shell,
|
|||||||
dx, dy,
|
dx, dy,
|
||||||
0, 0, 0, 0);
|
0, 0, 0, 0);
|
||||||
#endif
|
#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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,8 @@ struct _GimpDisplayShell
|
|||||||
gchar cursor_format_str[CURSOR_FORMAT_LENGTH];
|
gchar cursor_format_str[CURSOR_FORMAT_LENGTH];
|
||||||
GtkWidget *cancelbutton; /* cancel button */
|
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 */
|
gint icon_size; /* size of the icon pixmap */
|
||||||
guint icon_idle_id; /* ID of the idle-function */
|
guint icon_idle_id; /* ID of the idle-function */
|
||||||
|
@ -34,36 +34,32 @@
|
|||||||
#include "gimpdisplay.h"
|
#include "gimpdisplay.h"
|
||||||
#include "gimpdisplayshell.h"
|
#include "gimpdisplayshell.h"
|
||||||
#include "gimpdisplayshell-render.h"
|
#include "gimpdisplayshell-render.h"
|
||||||
#include "gximage.h"
|
|
||||||
|
|
||||||
#include "gimprc.h"
|
#include "gimprc.h"
|
||||||
|
|
||||||
|
|
||||||
#define MAX_PREVIEW_SIZE 256 /* EEK */
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _RenderInfo RenderInfo;
|
typedef struct _RenderInfo RenderInfo;
|
||||||
|
|
||||||
typedef void (* RenderFunc) (RenderInfo *info);
|
typedef void (* RenderFunc) (RenderInfo *info);
|
||||||
|
|
||||||
struct _RenderInfo
|
struct _RenderInfo
|
||||||
{
|
{
|
||||||
GimpDisplay *gdisp;
|
GimpDisplayShell *shell;
|
||||||
TileManager *src_tiles;
|
TileManager *src_tiles;
|
||||||
guint *alpha;
|
guint *alpha;
|
||||||
guchar *scale;
|
guchar *scale;
|
||||||
guchar *src;
|
guchar *src;
|
||||||
guchar *dest;
|
guchar *dest;
|
||||||
gint x, y;
|
gint x, y;
|
||||||
gint w, h;
|
gint w, h;
|
||||||
gfloat scalex;
|
gfloat scalex;
|
||||||
gfloat scaley;
|
gfloat scaley;
|
||||||
gint src_x, src_y;
|
gint src_x, src_y;
|
||||||
gint src_bpp;
|
gint src_bpp;
|
||||||
gint dest_bpp;
|
gint dest_bpp;
|
||||||
gint dest_bpl;
|
gint dest_bpl;
|
||||||
gint dest_width;
|
gint dest_width;
|
||||||
gint byte_order;
|
gint byte_order;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -110,7 +106,7 @@ render_setup (GimpCheckType check_type,
|
|||||||
|
|
||||||
/* allocate a buffer for arranging information from a row of tiles */
|
/* allocate a buffer for arranging information from a row of tiles */
|
||||||
if (! tile_buf)
|
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)
|
if (! render_blend_dark_check)
|
||||||
render_blend_dark_check = g_new (guchar, 65536);
|
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_empty_buf);
|
||||||
g_free (render_temp_buf);
|
g_free (render_temp_buf);
|
||||||
|
|
||||||
|
#define MAX_PREVIEW_SIZE 256 /* EEK */
|
||||||
|
|
||||||
/* calculate check buffer for previews */
|
/* calculate check buffer for previews */
|
||||||
if (TRUE /* preview_size */)
|
if (TRUE /* preview_size */)
|
||||||
{
|
{
|
||||||
@ -188,24 +186,24 @@ render_free (void)
|
|||||||
|
|
||||||
/* Render Image functions */
|
/* Render Image functions */
|
||||||
|
|
||||||
static void render_image_rgb (RenderInfo *info);
|
static void render_image_rgb (RenderInfo *info);
|
||||||
static void render_image_rgb_a (RenderInfo *info);
|
static void render_image_rgb_a (RenderInfo *info);
|
||||||
static void render_image_gray (RenderInfo *info);
|
static void render_image_gray (RenderInfo *info);
|
||||||
static void render_image_gray_a (RenderInfo *info);
|
static void render_image_gray_a (RenderInfo *info);
|
||||||
static void render_image_indexed (RenderInfo *info);
|
static void render_image_indexed (RenderInfo *info);
|
||||||
static void render_image_indexed_a (RenderInfo *info);
|
static void render_image_indexed_a (RenderInfo *info);
|
||||||
|
|
||||||
static void render_image_init_info (RenderInfo *info,
|
static void render_image_init_info (RenderInfo *info,
|
||||||
GimpDisplay *gdisp,
|
GimpDisplayShell *shell,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
gint w,
|
gint w,
|
||||||
gint h);
|
gint h);
|
||||||
static guint * render_image_init_alpha (gint mult);
|
static guint * render_image_init_alpha (gint mult);
|
||||||
static guchar * render_image_accelerate_scaling (gint width,
|
static guchar * render_image_accelerate_scaling (gint width,
|
||||||
gint start,
|
gint start,
|
||||||
gfloat scalex);
|
gfloat scalex);
|
||||||
static guchar * render_image_tile_fault (RenderInfo *info);
|
static guchar * render_image_tile_fault (RenderInfo *info);
|
||||||
|
|
||||||
|
|
||||||
static RenderFunc render_funcs[6] =
|
static RenderFunc render_funcs[6] =
|
||||||
@ -227,23 +225,27 @@ static RenderFunc render_funcs[6] =
|
|||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
render_image (GimpDisplay *gdisp,
|
gimp_display_shell_render (GimpDisplayShell *shell,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
gint w,
|
gint w,
|
||||||
gint h)
|
gint h)
|
||||||
{
|
{
|
||||||
RenderInfo info;
|
RenderInfo info;
|
||||||
gint image_type;
|
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))
|
if ((image_type < 0) || (image_type > 5))
|
||||||
{
|
{
|
||||||
g_message ("unknown gimage projection type: %d",
|
g_message ("unknown gimage projection type: %d",
|
||||||
gimp_image_projection_type (gdisp->gimage));
|
gimp_image_projection_type (shell->gdisp->gimage));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,9 +259,37 @@ render_image (GimpDisplay *gdisp,
|
|||||||
* are in case of future need. -- austin, 28th Nov 1998.
|
* are in case of future need. -- austin, 28th Nov 1998.
|
||||||
*/
|
*/
|
||||||
if (image_type != RGBA_GIMAGE && image_type != GRAYA_GIMAGE)
|
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);
|
(* 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 error;
|
||||||
gfloat step;
|
gfloat step;
|
||||||
|
|
||||||
cmap = gimp_image_get_colormap (info->gdisp->gimage);
|
cmap = gimp_image_get_colormap (info->shell->gdisp->gimage);
|
||||||
|
|
||||||
y = info->y;
|
y = info->y;
|
||||||
ye = info->y + info->h;
|
ye = info->y + info->h;
|
||||||
@ -355,7 +385,7 @@ render_image_indexed_a (RenderInfo *info)
|
|||||||
gfloat error;
|
gfloat error;
|
||||||
gfloat step;
|
gfloat step;
|
||||||
|
|
||||||
cmap = gimp_image_get_colormap (info->gdisp->gimage);
|
cmap = gimp_image_get_colormap (info->shell->gdisp->gimage);
|
||||||
alpha = info->alpha;
|
alpha = info->alpha;
|
||||||
|
|
||||||
y = info->y;
|
y = info->y;
|
||||||
@ -736,39 +766,39 @@ render_image_rgb_a (RenderInfo *info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
render_image_init_info (RenderInfo *info,
|
render_image_init_info (RenderInfo *info,
|
||||||
GimpDisplay *gdisp,
|
GimpDisplayShell *shell,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
gint w,
|
gint w,
|
||||||
gint h)
|
gint h)
|
||||||
{
|
{
|
||||||
info->gdisp = gdisp;
|
info->shell = shell;
|
||||||
info->src_tiles = gimp_image_projection (gdisp->gimage);
|
info->src_tiles = gimp_image_projection (shell->gdisp->gimage);
|
||||||
info->x = x + GIMP_DISPLAY_SHELL (gdisp->shell)->offset_x;
|
info->x = x + shell->offset_x;
|
||||||
info->y = y + GIMP_DISPLAY_SHELL (gdisp->shell)->offset_y;
|
info->y = y + shell->offset_y;
|
||||||
info->w = w;
|
info->w = w;
|
||||||
info->h = h;
|
info->h = h;
|
||||||
info->scalex = SCALEFACTOR_X (gdisp);
|
info->scalex = SCALEFACTOR_X (shell->gdisp);
|
||||||
info->scaley = SCALEFACTOR_Y (gdisp);
|
info->scaley = SCALEFACTOR_Y (shell->gdisp);
|
||||||
info->src_x = UNSCALEX (gdisp, info->x);
|
info->src_x = UNSCALEX (shell->gdisp, info->x);
|
||||||
info->src_y = UNSCALEY (gdisp, info->y);
|
info->src_y = UNSCALEY (shell->gdisp, info->y);
|
||||||
info->src_bpp = gimp_image_projection_bytes (gdisp->gimage);
|
info->src_bpp = gimp_image_projection_bytes (shell->gdisp->gimage);
|
||||||
info->dest = gximage_get_data ();
|
info->dest = shell->render_buf;
|
||||||
info->dest_bpp = gximage_get_bpp ();
|
info->dest_bpp = 3;
|
||||||
info->dest_bpl = gximage_get_bpl ();
|
info->dest_bpl = info->dest_bpp * GIMP_DISPLAY_SHELL_RENDER_BUF_WIDTH;
|
||||||
info->dest_width = info->w * info->dest_bpp;
|
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->scale = render_image_accelerate_scaling (w, info->x, info->scalex);
|
||||||
info->alpha = NULL;
|
info->alpha = NULL;
|
||||||
|
|
||||||
switch (gimp_image_projection_type (gdisp->gimage))
|
switch (gimp_image_projection_type (shell->gdisp->gimage))
|
||||||
{
|
{
|
||||||
case RGBA_GIMAGE:
|
case RGBA_GIMAGE:
|
||||||
case GRAYA_GIMAGE:
|
case GRAYA_GIMAGE:
|
||||||
case INDEXEDA_GIMAGE:
|
case INDEXEDA_GIMAGE:
|
||||||
info->alpha =
|
info->alpha =
|
||||||
render_image_init_alpha (gimp_image_projection_opacity (gdisp->gimage));
|
render_image_init_alpha (gimp_image_projection_opacity (shell->gdisp->gimage));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* nothing special needs doing */
|
/* nothing special needs doing */
|
||||||
@ -797,7 +827,7 @@ render_image_init_alpha (gint mult)
|
|||||||
return alpha_mult;
|
return alpha_mult;
|
||||||
}
|
}
|
||||||
|
|
||||||
static guchar*
|
static guchar *
|
||||||
render_image_accelerate_scaling (gint width,
|
render_image_accelerate_scaling (gint width,
|
||||||
gint start,
|
gint start,
|
||||||
gfloat scalex)
|
gfloat scalex)
|
||||||
@ -808,19 +838,19 @@ render_image_accelerate_scaling (gint width,
|
|||||||
gfloat step;
|
gfloat step;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
if (!scale)
|
if (! scale)
|
||||||
scale = g_new (guchar, GXIMAGE_WIDTH + 1);
|
scale = g_new (guchar, GIMP_DISPLAY_SHELL_RENDER_BUF_WIDTH + 1);
|
||||||
|
|
||||||
step = 1.0 / scalex;
|
step = 1.0 / scalex;
|
||||||
|
|
||||||
error = start * step;
|
error = start * step;
|
||||||
error -= ((int)error) - step;
|
error -= ((gint) error) - step;
|
||||||
|
|
||||||
for (i = 0; i <= width; i++)
|
for (i = 0; i <= width; i++)
|
||||||
{
|
{
|
||||||
scale[i] = ((int)error);
|
scale[i] = ((gint) error);
|
||||||
error += step - (int)error;
|
error += step - (gint) error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return scale;
|
return scale;
|
||||||
}
|
}
|
||||||
|
@ -16,19 +16,24 @@
|
|||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __GIMP_DISPLAY_RENDER_H__
|
#ifndef __GIMP_DISPLAY_SHELL_RENDER_H__
|
||||||
#define __GIMP_DISPLAY_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 */
|
/* Functions */
|
||||||
void render_setup (GimpCheckType check_type,
|
void render_setup (GimpCheckType check_type,
|
||||||
GimpCheckSize check_size);
|
GimpCheckSize check_size);
|
||||||
void render_free (void);
|
void render_free (void);
|
||||||
void render_image (GimpDisplay *gdisp,
|
|
||||||
gint x,
|
void gimp_display_shell_render (GimpDisplayShell *shell,
|
||||||
gint y,
|
gint x,
|
||||||
gint w,
|
gint y,
|
||||||
gint h);
|
gint w,
|
||||||
|
gint h);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Extern variables
|
* Extern variables
|
||||||
@ -40,4 +45,4 @@ extern guchar *render_blend_dark_check;
|
|||||||
extern guchar *render_blend_light_check;
|
extern guchar *render_blend_light_check;
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_DISPLAY_RENDER_H__ */
|
#endif /* __GIMP_DISPLAY_SHELL_RENDER_H__ */
|
||||||
|
@ -88,7 +88,7 @@ gimp_display_shell_scroll (GimpDisplayShell *shell,
|
|||||||
shell->offset_y += y_offset;
|
shell->offset_y += y_offset;
|
||||||
|
|
||||||
gdk_draw_drawable (shell->canvas->window,
|
gdk_draw_drawable (shell->canvas->window,
|
||||||
shell->scroll_gc,
|
shell->render_gc,
|
||||||
shell->canvas->window,
|
shell->canvas->window,
|
||||||
src_x, src_y,
|
src_x, src_y,
|
||||||
dest_x, dest_y,
|
dest_x, dest_y,
|
||||||
|
@ -60,7 +60,6 @@
|
|||||||
#include "gimpdisplayshell-handlers.h"
|
#include "gimpdisplayshell-handlers.h"
|
||||||
#include "gimpdisplayshell-render.h"
|
#include "gimpdisplayshell-render.h"
|
||||||
#include "gimpdisplayshell-selection.h"
|
#include "gimpdisplayshell-selection.h"
|
||||||
#include "gximage.h"
|
|
||||||
|
|
||||||
#include "gimprc.h"
|
#include "gimprc.h"
|
||||||
#include "nav_window.h"
|
#include "nav_window.h"
|
||||||
@ -207,7 +206,10 @@ gimp_display_shell_init (GimpDisplayShell *shell)
|
|||||||
shell->cursor_format_str[0] = '\0';
|
shell->cursor_format_str[0] = '\0';
|
||||||
shell->cancelbutton = NULL;
|
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_size = 32;
|
||||||
shell->icon_idle_id = 0;
|
shell->icon_idle_id = 0;
|
||||||
@ -264,10 +266,16 @@ gimp_display_shell_destroy (GtkObject *object)
|
|||||||
gdisplay_color_detach_all (gdisp);
|
gdisplay_color_detach_all (gdisp);
|
||||||
#endif /* DISPLAY_FILTERS */
|
#endif /* DISPLAY_FILTERS */
|
||||||
|
|
||||||
if (shell->scroll_gc)
|
if (shell->render_buf)
|
||||||
{
|
{
|
||||||
gdk_gc_unref (shell->scroll_gc);
|
g_free (shell->render_buf);
|
||||||
shell->scroll_gc = NULL;
|
shell->render_buf = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shell->render_gc)
|
||||||
|
{
|
||||||
|
gdk_gc_unref (shell->render_gc);
|
||||||
|
shell->render_gc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shell->icon_idle_id)
|
if (shell->icon_idle_id)
|
||||||
@ -1983,16 +1991,6 @@ gimp_display_shell_display_area (GimpDisplayShell *shell,
|
|||||||
gint dx, dy;
|
gint dx, dy;
|
||||||
gint i, j;
|
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);
|
sx = SCALEX (shell->gdisp, shell->gdisp->gimage->width);
|
||||||
sy = SCALEY (shell->gdisp, shell->gdisp->gimage->height);
|
sy = SCALEY (shell->gdisp, shell->gdisp->gimage->height);
|
||||||
|
|
||||||
@ -2058,17 +2056,18 @@ gimp_display_shell_display_area (GimpDisplayShell *shell,
|
|||||||
y2 = shell->disp_yoffset + sy;
|
y2 = shell->disp_yoffset + sy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* display the image in GXIMAGE_WIDTH x GXIMAGE_HEIGHT sized chunks */
|
/* display the image in RENDER_BUF_WIDTH x RENDER_BUF_HEIGHT sized chunks */
|
||||||
for (i = y1; i < y2; i += GXIMAGE_HEIGHT)
|
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);
|
dx = MIN (x2 - j, GIMP_DISPLAY_SHELL_RENDER_BUF_WIDTH);
|
||||||
dy = MIN (y2 - i, GXIMAGE_HEIGHT);
|
dy = MIN (y2 - i, GIMP_DISPLAY_SHELL_RENDER_BUF_HEIGHT);
|
||||||
|
|
||||||
render_image (shell->gdisp,
|
gimp_display_shell_render (shell,
|
||||||
j - shell->disp_xoffset, i - shell->disp_yoffset,
|
j - shell->disp_xoffset,
|
||||||
dx, dy);
|
i - shell->disp_yoffset,
|
||||||
|
dx, dy);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Invalidate the projection just after we render it! */
|
/* Invalidate the projection just after we render it! */
|
||||||
@ -2078,20 +2077,6 @@ gimp_display_shell_display_area (GimpDisplayShell *shell,
|
|||||||
dx, dy,
|
dx, dy,
|
||||||
0, 0, 0, 0);
|
0, 0, 0, 0);
|
||||||
#endif
|
#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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,8 @@ struct _GimpDisplayShell
|
|||||||
gchar cursor_format_str[CURSOR_FORMAT_LENGTH];
|
gchar cursor_format_str[CURSOR_FORMAT_LENGTH];
|
||||||
GtkWidget *cancelbutton; /* cancel button */
|
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 */
|
gint icon_size; /* size of the icon pixmap */
|
||||||
guint icon_idle_id; /* ID of the idle-function */
|
guint icon_idle_id; /* ID of the idle-function */
|
||||||
|
@ -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 <gtk/gtk.h>
|
|
||||||
|
|
||||||
#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);
|
|
||||||
}
|
|
@ -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__ */
|
|
@ -38,7 +38,6 @@
|
|||||||
#include "display/gimpdisplay-foreach.h"
|
#include "display/gimpdisplay-foreach.h"
|
||||||
#include "display/gimpdisplayshell.h"
|
#include "display/gimpdisplayshell.h"
|
||||||
#include "display/gimpdisplayshell-render.h"
|
#include "display/gimpdisplayshell-render.h"
|
||||||
#include "display/gximage.h"
|
|
||||||
|
|
||||||
#include "widgets/gimpdialogfactory.h"
|
#include "widgets/gimpdialogfactory.h"
|
||||||
#include "widgets/gimpitemfactory.h"
|
#include "widgets/gimpitemfactory.h"
|
||||||
@ -249,7 +248,6 @@ gui_init (Gimp *gimp)
|
|||||||
color_display_init ();
|
color_display_init ();
|
||||||
#endif /* DISPLAY_FILTERS */
|
#endif /* DISPLAY_FILTERS */
|
||||||
|
|
||||||
gximage_init ();
|
|
||||||
render_setup (gimprc.transparency_type, gimprc.transparency_size);
|
render_setup (gimprc.transparency_type, gimprc.transparency_size);
|
||||||
|
|
||||||
dialogs_init (gimp);
|
dialogs_init (gimp);
|
||||||
@ -314,7 +312,6 @@ gui_exit (Gimp *gimp)
|
|||||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||||
|
|
||||||
menus_exit (gimp);
|
menus_exit (gimp);
|
||||||
gximage_free ();
|
|
||||||
render_free ();
|
render_free ();
|
||||||
|
|
||||||
dialogs_exit (gimp);
|
dialogs_exit (gimp);
|
||||||
|
Reference in New Issue
Block a user