Commit 78c4d435 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

magnify: Don't display frame margin when zooming

parent 6e45a79e
......@@ -183,16 +183,16 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
for( int i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
{
const int o_yp = o_y * p_outpic->p[i_plane].i_lines / p_outpic->p[Y_PLANE].i_lines;
const int o_xp = o_x * p_outpic->p[i_plane].i_pitch / p_outpic->p[Y_PLANE].i_pitch;
const int o_yp = o_y * p_outpic->p[i_plane].i_visible_lines / p_outpic->p[Y_PLANE].i_visible_lines;
const int o_xp = o_x * p_outpic->p[i_plane].i_visible_pitch / p_outpic->p[Y_PLANE].i_visible_pitch;
p_pic->p[i_plane].p_pixels += o_yp * p_pic->p[i_plane].i_pitch + o_xp;
p_pic->p[i_plane].p_pixels += o_yp * p_pic->p[i_plane].i_visible_pitch + o_xp;
}
/* */
fmt_in = p_filter->fmt_in.video;
fmt_in.i_width = fmt_in.i_visible_width = (fmt_in.i_width * ZOOM_FACTOR / o_zoom) & ~1;
fmt_in.i_height = fmt_in.i_visible_height = (fmt_in.i_height * ZOOM_FACTOR / o_zoom) & ~1;
fmt_in.i_width = fmt_in.i_visible_width = (fmt_in.i_visible_width * ZOOM_FACTOR / o_zoom) & ~1;
fmt_in.i_height = fmt_in.i_visible_height = (fmt_in.i_visible_height * ZOOM_FACTOR / o_zoom) & ~1;
/* */
fmt_out = p_filter->fmt_out.video;
......@@ -216,8 +216,8 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
/* image visualization */
fmt_out = p_filter->fmt_out.video;
fmt_out.i_width = fmt_out.i_visible_width = (fmt_out.i_width /VIS_ZOOM) & ~1;
fmt_out.i_height = fmt_out.i_visible_height = (fmt_out.i_height/VIS_ZOOM) & ~1;
fmt_out.i_width = fmt_out.i_visible_width = (fmt_out.i_visible_width /VIS_ZOOM) & ~1;
fmt_out.i_height = fmt_out.i_visible_height = (fmt_out.i_visible_height/VIS_ZOOM) & ~1;
p_converted = image_Convert( p_sys->p_image, p_pic,
&p_pic->format, &fmt_out );
......@@ -227,16 +227,16 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
picture_Release( p_converted );
/* white rectangle on visualization */
v_w = __MIN( fmt_out.i_width * ZOOM_FACTOR / o_zoom, fmt_out.i_width - 1 );
v_h = __MIN( fmt_out.i_height * ZOOM_FACTOR / o_zoom, fmt_out.i_height - 1 );
v_w = __MIN( fmt_out.i_visible_width * ZOOM_FACTOR / o_zoom, fmt_out.i_visible_width - 1 );
v_h = __MIN( fmt_out.i_visible_height * ZOOM_FACTOR / o_zoom, fmt_out.i_visible_height - 1 );
DrawRectangle( p_oyp->p_pixels, p_oyp->i_pitch,
p_oyp->i_pitch, p_oyp->i_lines,
DrawRectangle( p_oyp->p_pixels, p_oyp->i_visible_pitch,
p_oyp->i_visible_pitch, p_oyp->i_visible_lines,
o_x/VIS_ZOOM, o_y/VIS_ZOOM,
v_w, v_h );
/* */
v_h = fmt_out.i_height + 1;
v_h = fmt_out.i_visible_height + 1;
}
else
{
......@@ -246,7 +246,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
/* print a small "VLC ZOOM" */
if( b_visible || p_sys->i_last_activity + p_sys->i_hide_timeout > mdate() )
DrawZoomStatus( p_oyp->p_pixels, p_oyp->i_pitch, p_oyp->i_pitch, p_oyp->i_lines,
DrawZoomStatus( p_oyp->p_pixels, p_oyp->i_visible_pitch, p_oyp->i_pitch, p_oyp->i_lines,
1, v_h, b_visible );
if( b_visible )
......@@ -342,8 +342,8 @@ static int Mouse( filter_t *p_filter, vlc_mouse_t *p_mouse, const vlc_mouse_t *p
/* Find the mouse position */
if( p_sys->b_visible )
{
const int i_visu_width = p_fmt->i_width / VIS_ZOOM;
const int i_visu_height = p_fmt->i_height / VIS_ZOOM;
const int i_visu_width = p_fmt->i_visible_width / VIS_ZOOM;
const int i_visu_height = p_fmt->i_visible_height / VIS_ZOOM;
if( p_new->i_x >= 0 && p_new->i_x < i_visu_width &&
p_new->i_y >= 0 && p_new->i_y < i_visu_height )
......@@ -351,13 +351,13 @@ static int Mouse( filter_t *p_filter, vlc_mouse_t *p_mouse, const vlc_mouse_t *p
/* Visualization */
if( b_pressed )
{
const int v_w = p_fmt->i_width * ZOOM_FACTOR / p_sys->i_zoom;
const int v_h = p_fmt->i_height * ZOOM_FACTOR / p_sys->i_zoom;
const int v_w = p_fmt->i_visible_width * ZOOM_FACTOR / p_sys->i_zoom;
const int v_h = p_fmt->i_visible_height * ZOOM_FACTOR / p_sys->i_zoom;
p_sys->i_x = VLC_CLIP( p_new->i_x * VIS_ZOOM - v_w/2, 0,
(int)p_fmt->i_width - v_w - 1);
(int)p_fmt->i_visible_width - v_w - 1);
p_sys->i_y = VLC_CLIP( p_new->i_y * VIS_ZOOM - v_h/2, 0,
(int)p_fmt->i_height - v_h - 1);
(int)p_fmt->i_visible_height - v_h - 1);
b_grab = true;
}
......@@ -386,10 +386,10 @@ static int Mouse( filter_t *p_filter, vlc_mouse_t *p_mouse, const vlc_mouse_t *p
(80 + i_visu_height - p_new->i_y + 2) *
ZOOM_FACTOR / 10 );
const int v_w = p_fmt->i_width * ZOOM_FACTOR / p_sys->i_zoom;
const int v_h = p_fmt->i_height * ZOOM_FACTOR / p_sys->i_zoom;
p_sys->i_x = VLC_CLIP( p_sys->i_x, 0, (int)p_fmt->i_width - v_w - 1 );
p_sys->i_y = VLC_CLIP( p_sys->i_y, 0, (int)p_fmt->i_height - v_h - 1 );
const int v_w = p_fmt->i_visible_width * ZOOM_FACTOR / p_sys->i_zoom;
const int v_h = p_fmt->i_visible_height * ZOOM_FACTOR / p_sys->i_zoom;
p_sys->i_x = VLC_CLIP( p_sys->i_x, 0, (int)p_fmt->i_visible_width - v_w - 1 );
p_sys->i_y = VLC_CLIP( p_sys->i_y, 0, (int)p_fmt->i_visible_height - v_h - 1 );
b_grab = true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment