comparison libmpcodecs/vf_expand.c @ 14074:dc5eaa0795d7

call draw_slice in top-down order (fixes crash with -vf expand=...,scale)
author henry
date Wed, 01 Dec 2004 09:32:48 +0000
parents 87043624b0d8
children bfb91d085f22
comparison
equal deleted inserted replaced
14073:9e81af56f554 14074:dc5eaa0795d7
255 } 255 }
256 256
257 static void draw_slice(struct vf_instance_s* vf, 257 static void draw_slice(struct vf_instance_s* vf,
258 unsigned char** src, int* stride, int w,int h, int x, int y){ 258 unsigned char** src, int* stride, int w,int h, int x, int y){
259 // printf("draw_slice() called %d at %d\n",h,y); 259 // printf("draw_slice() called %d at %d\n",h,y);
260 if(vf->priv->exp_y>0 && y == 0)
261 vf_next_draw_slice(vf, vf->dmpi->planes, vf->dmpi->stride,
262 vf->dmpi->w,vf->priv->exp_y,0,0);
260 vf_next_draw_slice(vf,src,stride,w,h,x+vf->priv->exp_x,y+vf->priv->exp_y); 263 vf_next_draw_slice(vf,src,stride,w,h,x+vf->priv->exp_x,y+vf->priv->exp_y);
264 if(vf->priv->exp_y+vf->h<vf->dmpi->h && y+h == vf->h)
265 vf_next_draw_slice(vf, vf->dmpi->planes, vf->dmpi->stride,
266 vf->dmpi->w,vf->dmpi->h-(vf->priv->exp_y+vf->h),
267 0,vf->priv->exp_y+vf->h);
261 } 268 }
262 269
263 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){ 270 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
264 if(mpi->flags&MP_IMGFLAG_DIRECT || mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){ 271 if(mpi->flags&MP_IMGFLAG_DIRECT || mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){
265 vf->dmpi=mpi->priv; 272 vf->dmpi=mpi->priv;
266 if(!vf->dmpi) { printf("Why do we get NULL \n"); return 0; } 273 if(!vf->dmpi) { printf("Why do we get NULL \n"); return 0; }
267 mpi->priv=NULL; 274 mpi->priv=NULL;
268 if(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){
269 if(vf->priv->exp_y>0)
270 vf_next_draw_slice(vf, vf->dmpi->planes, vf->dmpi->stride,
271 vf->dmpi->w,vf->priv->exp_y,0,0);
272 if(vf->priv->exp_y+mpi->h<vf->dmpi->h)
273 vf_next_draw_slice(vf, vf->dmpi->planes, vf->dmpi->stride,
274 vf->dmpi->w,vf->dmpi->h-(vf->priv->exp_y+mpi->h),
275 0,vf->priv->exp_y+mpi->h);
276 }
277 #ifdef OSD_SUPPORT 275 #ifdef OSD_SUPPORT
278 if(vf->priv->osd) draw_osd(vf,mpi->w,mpi->h); 276 if(vf->priv->osd) draw_osd(vf,mpi->w,mpi->h);
279 #endif 277 #endif
280 // we've used DR, so we're ready... 278 // we've used DR, so we're ready...
281 if(!(mpi->flags&MP_IMGFLAG_PLANAR)) 279 if(!(mpi->flags&MP_IMGFLAG_PLANAR))