Re: More problems with gdk-pixbuf [UPDATE]
- From: Owen Taylor <otaylor redhat com>
- To: Loban Rahman <loban enigma caltech edu>
- Cc: gnome-devel-list gnome org
- Subject: Re: More problems with gdk-pixbuf [UPDATE]
- Date: 22 Apr 2000 00:59:44 -0400
Loban Rahman <loban@enigma.caltech.edu> writes:
> Thanx Jeff, it works now. Here is the patch for the package, if anyone
> can please commit it (unless this is the wrong solution).
[...]
> cvs server: Diffing .
> Index: gdk-pixbuf-util.c
> ===================================================================
> RCS file: /cvs/gnome/gdk-pixbuf/gdk-pixbuf/gdk-pixbuf-util.c,v
> retrieving revision 1.6
> diff -r1.6 gdk-pixbuf-util.c
> 129,130c129
> < (double) (dest_x - src_x),
> < (double) (dest_y - src_y),
> ---
> > 0, 0,
Well, it's on the right track, but not quite the right solution.
(Also note, that you should also use unified diffs (cvs diff -u)
diffs like this aren't particularly useful since there is
no context.)
The problem isn't actually in- gdk_pixbuf_copy_area() - it is
using gdk_pixbuf_scale() correctly as documented. The problem
is in gkd_pixbuf_scale() itself, which doesn't handle the
dest_x and dest_y parameters correctly.
The patch I'm going to commit is appended below - I do need to
do a bit more testing first. (The hunk for pixops.c is an
unrelated bug that I came across while looking for the real
one.)
Thanks for coming up with a good test case - it was very useful
in tracking this down.
Owen
? lines
Index: gdk-pixbuf-scale.c
===================================================================
RCS file: /cvs/gnome/gdk-pixbuf/gdk-pixbuf/gdk-pixbuf-scale.c,v
retrieving revision 1.4
diff -u -r1.4 gdk-pixbuf-scale.c
--- gdk-pixbuf-scale.c 2000/04/11 07:03:24 1.4
+++ gdk-pixbuf-scale.c 2000/04/22 04:57:18
@@ -68,7 +68,8 @@
offset_y = floor (offset_y + 0.5);
pixops_scale (dest->pixels + dest_y * dest->rowstride + dest_x * dest->n_channels,
- -offset_x, -offset_y, dest_width - offset_x, dest_height - offset_y,
+ dest_x - offset_x, dest_y - offset_y,
+ dest_x + dest_width - offset_x, dest_y + dest_height - offset_y,
dest->rowstride, dest->n_channels, dest->has_alpha,
src->pixels, src->width, src->height,
src->rowstride, src->n_channels, src->has_alpha,
@@ -118,7 +119,8 @@
offset_x = floor (offset_x + 0.5);
offset_y = floor (offset_y + 0.5);
pixops_composite (dest->pixels + dest_y * dest->rowstride + dest_x * dest->n_channels,
- -offset_x, -offset_y, dest_width - offset_x, dest_height - offset_y,
+ dest_x - offset_x, dest_y - offset_y,
+ dest_x + dest_width - offset_x, dest_y + dest_height - offset_y,
dest->rowstride, dest->n_channels, dest->has_alpha,
src->pixels, src->width, src->height,
src->rowstride, src->n_channels, src->has_alpha,
@@ -180,7 +182,8 @@
offset_y = floor (offset_y + 0.5);
pixops_composite_color (dest->pixels + dest_y * dest->rowstride + dest_x * dest->n_channels,
- -offset_x, -offset_y, dest_width - offset_x, dest_height - offset_y,
+ dest_x - offset_x, dest_y - offset_y,
+ dest_x + dest_width - offset_x, dest_y + dest_height - offset_y,
dest->rowstride, dest->n_channels, dest->has_alpha,
src->pixels, src->width, src->height,
src->rowstride, src->n_channels, src->has_alpha,
Index: pixops/pixops.c
===================================================================
RCS file: /cvs/gnome/gdk-pixbuf/gdk-pixbuf/pixops/pixops.c,v
retrieving revision 1.10
diff -u -r1.10 pixops.c
--- pixops/pixops.c 2000/04/11 07:03:25 1.10
+++ pixops/pixops.c 2000/04/22 04:57:21
@@ -93,7 +93,7 @@
for (i = 0; i < (render_y1 - render_y0); i++)
{
- const guchar *src = src_buf + ((i * y_step + y_step / 2) >> SCALE_SHIFT) * src_rowstride;
+ const guchar *src = src_buf + (((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT) * src_rowstride;
guchar *dest = dest_buf + i * dest_rowstride;
x = render_x0 * x_step + x_step / 2;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]