[vlc-commits] [Git][videolan/vlc][master] 3 commits: wingdi: fix handling of input orientation
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sat Aug 19 15:04:06 UTC 2023
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
d99b83a2 by Steve Lhomme at 2023-08-19T14:31:07+00:00
wingdi: fix handling of input orientation
We can't handle rotation, so we should tell the core to do it for us.
And we need to use the dimensions after the rotation. We can't use
vd->source for that.
- - - - -
70bef480 by Steve Lhomme at 2023-08-19T14:31:07+00:00
flaschen: force normal orientation on input
We can't handle rotation, so we should tell the core to do it for us.
We control the width/height locally so we don't need to rotate the source.
And we don't use vd->source, so we won't get side effects.
- - - - -
2da81597 by Steve Lhomme at 2023-08-19T14:31:07+00:00
splitter: force normal orientation on input
We can't handle rotation, so we should tell the core to do it for us.
We control the width/height locally so we don't need to rotate the source.
And we don't use vd->source, so we won't get side effects.
- - - - -
3 changed files:
- modules/video_output/flaschen.c
- modules/video_output/splitter.c
- modules/video_output/win32/wingdi.c
Changes:
=====================================
modules/video_output/flaschen.c
=====================================
@@ -124,6 +124,7 @@ static int Open(vout_display_t *vd,
fmt.i_height = var_InheritInteger(vd, "flaschen-height");
fmt.i_visible_width = fmt.i_width;
fmt.i_visible_height = fmt.i_height;
+ fmt.orientation = ORIENT_NORMAL;
/* p_vd->info is not modified */
=====================================
modules/video_output/splitter.c
=====================================
@@ -256,6 +256,8 @@ static int vlc_vidsplit_Open(vout_display_t *vd,
vlc_mutex_init(&sys->lock);
video_format_Copy(&splitter->fmt, vd->source);
+ splitter->fmt.orientation = ORIENT_NORMAL;
+ fmtp->orientation = ORIENT_NORMAL;
splitter->p_module = module_need(splitter, "video splitter", name, true);
free(name);
@@ -324,7 +326,6 @@ static int vlc_vidsplit_Open(vout_display_t *vd,
}
vd->ops = &ops;
- (void) fmtp;
return VLC_SUCCESS;
}
=====================================
modules/video_output/win32/wingdi.c
=====================================
@@ -97,15 +97,18 @@ static int ChangeSize(vout_display_t *vd, HDC hdc)
};
FillRect(hdc, &display, GetStockObject(BLACK_BRUSH));
+ video_format_t fmt_rot;
+ video_format_ApplyRotation(&fmt_rot, vd->source);
+
BITMAPINFOHEADER *bih = &sys->bi_rgb.bmiHeader;
- if (bih->biWidth != (LONG)sys->area.src_fmt->i_visible_width ||
- bih->biHeight != -(LONG)sys->area.src_fmt->i_visible_height)
+ if (bih->biWidth != (LONG)fmt_rot.i_visible_width ||
+ bih->biHeight != -(LONG)fmt_rot.i_visible_height)
{
if (sys->off_bitmap)
DeleteObject(sys->off_bitmap);
- bih->biWidth = sys->area.src_fmt->i_visible_width;
- bih->biHeight = -(LONG)sys->area.src_fmt->i_visible_height;
+ bih->biWidth = fmt_rot.i_visible_width;
+ bih->biHeight = -(LONG)fmt_rot.i_visible_height;
void *p_pic_buffer;
sys->off_bitmap = CreateDIBSection(hdc,
&sys->bmiInfo,
@@ -116,9 +119,9 @@ static int ChangeSize(vout_display_t *vd, HDC hdc)
sys->pic_buf.p_pixels = p_pic_buffer;
sys->pic_buf.i_pixel_pitch = (bih->biBitCount + 7) / 8;
sys->pic_buf.i_pitch = sys->pic_buf.i_visible_pitch =
- sys->area.src_fmt->i_visible_width * sys->pic_buf.i_pixel_pitch;
+ fmt_rot.i_visible_width * sys->pic_buf.i_pixel_pitch;
sys->pic_buf.i_lines = sys->pic_buf.i_visible_lines =
- sys->area.src_fmt->i_visible_height;
+ fmt_rot.i_visible_height;
}
return VLC_SUCCESS;
}
@@ -217,22 +220,25 @@ static void Display(vout_display_t *vd, picture_t *picture)
SelectObject(sys->off_dc, sys->off_bitmap);
- if (sys->area.place.width != vd->source->i_visible_width ||
- sys->area.place.height != vd->source->i_visible_height) {
+ video_format_t fmt_rot;
+ video_format_ApplyRotation(&fmt_rot, vd->source);
+
+ if (sys->area.place.width != fmt_rot.i_visible_width ||
+ sys->area.place.height != fmt_rot.i_visible_height) {
SetStretchBltMode(hdc, COLORONCOLOR);
StretchBlt(hdc, sys->area.place.x, sys->area.place.y,
sys->area.place.width, sys->area.place.height,
sys->off_dc,
- vd->source->i_x_offset, vd->source->i_y_offset,
- vd->source->i_x_offset + vd->source->i_visible_width,
- vd->source->i_y_offset + vd->source->i_visible_height,
+ fmt_rot.i_x_offset, fmt_rot.i_y_offset,
+ fmt_rot.i_x_offset + fmt_rot.i_visible_width,
+ fmt_rot.i_y_offset + fmt_rot.i_visible_height,
SRCCOPY);
} else {
BitBlt(hdc, sys->area.place.x, sys->area.place.y,
sys->area.place.width, sys->area.place.height,
sys->off_dc,
- vd->source->i_x_offset, vd->source->i_y_offset,
+ fmt_rot.i_x_offset, fmt_rot.i_y_offset,
SRCCOPY);
}
@@ -252,6 +258,8 @@ static int Init(vout_display_t *vd, video_format_t *fmt)
int i_depth = GetDeviceCaps(window_dc, PLANES) *
GetDeviceCaps(window_dc, BITSPIXEL);
+ video_format_TransformTo(fmt, ORIENT_NORMAL);
+
/* */
msg_Dbg(vd, "GDI depth is %i", i_depth);
switch (i_depth) {
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/82cb2290b132defbfe31bba271ca78003ec436d7...2da81597c0caa4200ba45dd638f60933441cc4ef
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/82cb2290b132defbfe31bba271ca78003ec436d7...2da81597c0caa4200ba45dd638f60933441cc4ef
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list