mirror of https://github.com/GNOME/gimp.git
plug-ins/common/flarefx.c plug-ins/common/glasstile.c ditched the 4-byte
2000-05-23 Sven Neumann <sven@gimp.org> * plug-ins/common/flarefx.c * plug-ins/common/glasstile.c * plug-ins/common/grid.c: ditched the 4-byte alignment of the preview_data since it was only causing trouble. Now the previews work even for the ugly cases like width|height == 1.
This commit is contained in:
parent
49ca711775
commit
9667b85edf
|
@ -1,3 +1,11 @@
|
|||
2000-05-23 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/common/flarefx.c
|
||||
* plug-ins/common/glasstile.c
|
||||
* plug-ins/common/grid.c: ditched the 4-byte alignment of the
|
||||
preview_data since it was only causing trouble. Now the previews
|
||||
work even for the ugly cases like width|height == 1.
|
||||
|
||||
2000-05-22 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/common/flarefx.c: fixed a bug in the new
|
||||
|
|
|
@ -190,7 +190,8 @@ static RGBfloat color, glow, inner, outer, halo;
|
|||
static Reflect ref1[19];
|
||||
static guchar *preview_bits;
|
||||
static GtkWidget *preview;
|
||||
static gdouble preview_scale;
|
||||
static gdouble preview_scale_x;
|
||||
static gdouble preview_scale_y;
|
||||
static gboolean show_cursor = 0;
|
||||
|
||||
/* --- Functions --- */
|
||||
|
@ -418,8 +419,8 @@ FlareFX (GDrawable *drawable,
|
|||
bytes = GTK_PREVIEW (preview)->bpp;
|
||||
gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
|
||||
|
||||
xs = (gdouble)fvals.posx * preview_scale;
|
||||
ys = (gdouble)fvals.posy * preview_scale;
|
||||
xs = (gdouble)fvals.posx * preview_scale_x;
|
||||
ys = (gdouble)fvals.posy * preview_scale_y;
|
||||
|
||||
/* now, we clobber the x1 x2 y1 y2 with the real sizes */
|
||||
x1 = y1 = 0;
|
||||
|
@ -847,7 +848,7 @@ flare_center_create (GDrawable *drawable)
|
|||
gtk_widget_set_events (GTK_WIDGET (preview), PREVIEW_MASK);
|
||||
gtk_signal_connect_after (GTK_OBJECT (preview), "expose_event",
|
||||
(GtkSignalFunc) flare_center_preview_expose,
|
||||
center );
|
||||
center);
|
||||
gtk_signal_connect (GTK_OBJECT (preview), "event",
|
||||
(GtkSignalFunc) flare_center_preview_events,
|
||||
center);
|
||||
|
@ -909,26 +910,23 @@ fill_preview_with_thumb (GtkWidget *widget,
|
|||
gint x,y;
|
||||
gint width = PREVIEW_SIZE;
|
||||
gint height = PREVIEW_SIZE;
|
||||
gint realwidth;
|
||||
guchar *src;
|
||||
gdouble r, g, b, a;
|
||||
gdouble c0, c1;
|
||||
guchar *p0, *p1, *even, *odd;
|
||||
guchar *p0, *p1;
|
||||
guchar *even, *odd;
|
||||
|
||||
bpp = 0; /* Only returned */
|
||||
|
||||
drawable_data =
|
||||
gimp_drawable_get_thumbnail_data (drawable_ID, &width, &height, &bpp);
|
||||
|
||||
realwidth = width;
|
||||
|
||||
if (width % 2)
|
||||
width = width - 1;
|
||||
if ((width / 2) % 2)
|
||||
width = width - 2;
|
||||
if (width < 1 || height < 1)
|
||||
return;
|
||||
|
||||
gtk_preview_size (GTK_PREVIEW (widget), width, height);
|
||||
preview_scale = (gdouble)realwidth / (gdouble)gimp_drawable_width (drawable_ID);
|
||||
preview_scale_x = (gdouble)width / (gdouble)gimp_drawable_width (drawable_ID);
|
||||
preview_scale_y = (gdouble)height / (gdouble)gimp_drawable_height (drawable_ID);
|
||||
|
||||
even = g_malloc (width * 3);
|
||||
odd = g_malloc (width * 3);
|
||||
|
@ -994,7 +992,7 @@ fill_preview_with_thumb (GtkWidget *widget,
|
|||
{
|
||||
gtk_preview_draw_row (GTK_PREVIEW (widget), (guchar *)even, 0, y, width);
|
||||
}
|
||||
src += realwidth * bpp;
|
||||
src += width * bpp;
|
||||
}
|
||||
|
||||
g_free (even);
|
||||
|
|
|
@ -104,7 +104,8 @@ static GlassInterface gt_int =
|
|||
/* preview */
|
||||
static guchar *preview_bits;
|
||||
static GtkWidget *preview;
|
||||
static gdouble preview_scale;
|
||||
static gdouble preview_scale_x;
|
||||
static gdouble preview_scale_y;
|
||||
|
||||
/* --- Functions --- */
|
||||
|
||||
|
@ -373,26 +374,23 @@ fill_preview_with_thumb (GtkWidget *widget,
|
|||
gint x,y;
|
||||
gint width = PREVIEW_SIZE;
|
||||
gint height = PREVIEW_SIZE;
|
||||
gint realwidth;
|
||||
guchar *src;
|
||||
gdouble r, g, b, a;
|
||||
gdouble c0, c1;
|
||||
guchar *p0, *p1, *even, *odd;
|
||||
guchar *p0, *p1;
|
||||
guchar *even, *odd;
|
||||
|
||||
bpp = 0; /* Only returned */
|
||||
|
||||
drawable_data =
|
||||
gimp_drawable_get_thumbnail_data (drawable_ID, &width, &height, &bpp);
|
||||
|
||||
realwidth = width;
|
||||
|
||||
if (width % 2)
|
||||
width = width - 1;
|
||||
if ((width / 2) % 2)
|
||||
width = width - 2;
|
||||
if (width < 1 || height < 1)
|
||||
return;
|
||||
|
||||
gtk_preview_size (GTK_PREVIEW (widget), width, height);
|
||||
preview_scale = (gdouble)realwidth / (gdouble)gimp_drawable_width (drawable_ID);
|
||||
preview_scale_x = (gdouble)width / (gdouble)gimp_drawable_width (drawable_ID);
|
||||
preview_scale_y = (gdouble)height / (gdouble)gimp_drawable_height (drawable_ID);
|
||||
|
||||
even = g_malloc (width * 3);
|
||||
odd = g_malloc (width * 3);
|
||||
|
@ -454,7 +452,8 @@ fill_preview_with_thumb (GtkWidget *widget,
|
|||
gtk_preview_draw_row (GTK_PREVIEW (widget), (guchar *)odd, 0, y, width);
|
||||
else
|
||||
gtk_preview_draw_row (GTK_PREVIEW (widget), (guchar *)even, 0, y, width);
|
||||
src += realwidth * bpp;
|
||||
|
||||
src += width * bpp;
|
||||
}
|
||||
|
||||
g_free (even);
|
||||
|
@ -505,8 +504,8 @@ glasstile (GDrawable *drawable,
|
|||
/* initialize the pixel regions */
|
||||
if (preview_mode)
|
||||
{
|
||||
rutbredd = gtvals.xblock * preview_scale;
|
||||
ruthojd = gtvals.yblock * preview_scale;
|
||||
rutbredd = gtvals.xblock * preview_scale_x;
|
||||
ruthojd = gtvals.yblock * preview_scale_y;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1005,16 +1005,15 @@ fill_preview (GtkWidget *widget,
|
|||
guchar *src;
|
||||
gdouble r, g, b, a;
|
||||
gdouble c0, c1;
|
||||
guchar *p0, *p1, *even, *odd;
|
||||
guchar *p0, *p1;
|
||||
guchar *even, *odd;
|
||||
|
||||
width = MIN (gimp_drawable_width (drawable->id), PREVIEW_SIZE);
|
||||
height = MIN (gimp_drawable_height (drawable->id), PREVIEW_SIZE);
|
||||
bpp = gimp_drawable_bpp (drawable->id);
|
||||
|
||||
if (width % 2)
|
||||
width = width - 1;
|
||||
if ((width / 2) % 2)
|
||||
width = width - 2;
|
||||
if (width < 1 || height < 1)
|
||||
return;
|
||||
|
||||
gtk_preview_size (GTK_PREVIEW (widget), width, height);
|
||||
|
||||
|
|
Loading…
Reference in New Issue