[Mplayer-cvslog] CVS: main/libmpcodecs vf_crop.c,1.13,1.14

D Richard Felker III dalias at aerifal.cx
Mon Apr 28 03:50:27 CEST 2003


On Sun, Apr 27, 2003 at 11:12:28PM +0200, Arpi wrote:
> Hi,
> 
> > +static void draw_slice(struct vf_instance_s* vf,
> > +        unsigned char** src, int* stride, int w,int h, int x, int y){
> > +    //mp_msg(MSGT_VFILTER, MSGL_V, "crop slice %d %d %d %d ->", w,h,x,y);
> > +    if ((x -= vf->priv->crop_x) < 0) {
> > +	w += x;
> > +	x = 0;
> > +    }
> > +    if ((y -= vf->priv->crop_y) < 0) {
> > +	h += y;
> > +	y = 0;
> > +    }
> > +    if (x+w > vf->priv->crop_w) w = vf->priv->crop_w-x;
> > +    if (y+h > vf->priv->crop_h) h = vf->priv->crop_h-y;
> > +    //mp_msg(MSGT_VFILTER, MSGL_V, "%d %d %d %d\n", w,h,x,y);
> > +    if ((w < 0) || (h < 0)) return;
> > +    vf_next_draw_slice(vf,src,stride,w,h,x,y);
> > +}
> 
> imho this is broken. you should adjust src[] too (but copy it instead of
> in-place modification, it's not allowed!), changing x,y is not enough (it's
> used only as destination coordinates, src[] points is the upper left pixel
> of the area to be copied)

Doh! You're right....wonder why it works for me...?? I'll fix it...

Rich



More information about the MPlayer-cvslog mailing list