[vlc-devel] [PATCH v3 16/20] vout: win32: use the placed picture dimensions from the core
Steve Lhomme
robux4 at ycbcr.xyz
Wed Aug 26 13:55:43 CEST 2020
Only the glwin32 module needs to compute a different placement than the core.
No need to keep our own anymore. It's always updated for us.
---
modules/video_output/win32/common.c | 9 +-------
modules/video_output/win32/common.h | 2 --
modules/video_output/win32/direct3d11.c | 28 ++++++++++++-------------
modules/video_output/win32/direct3d9.c | 20 +++++++++---------
modules/video_output/win32/glwin32.c | 2 +-
modules/video_output/win32/wingdi.c | 12 +++++------
6 files changed, 32 insertions(+), 41 deletions(-)
diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index 0d8a161fcdc..64f635cb578 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -96,13 +96,6 @@ int CommonWindowInit(vout_display_t *vd, display_win32_area_t *area,
void CommonPlacePicture(vout_display_t *vd, display_win32_area_t *area)
{
/* Update the window position and size */
- vout_display_cfg_t place_cfg = *vd->cfg;
-
- vout_display_place_t before_place = area->place;
- vout_display_PlacePicture(&area->place, &vd->source, &place_cfg);
-
- /* Signal the change in size/position */
- if (!vout_display_PlaceEquals(&before_place, &area->place))
{
area->place_changed |= true;
@@ -112,7 +105,7 @@ void CommonPlacePicture(vout_display_t *vd, display_win32_area_t *area)
vd->source.i_visible_width, vd->source.i_visible_height,
vd->source.i_width, vd->source.i_height);
msg_Dbg(vd, "UpdateRects image_dst coords: %i,%i %ix%i",
- area->place.x, area->place.y, area->place.width, area->place.height);
+ vd->place->x, vd->place->y, vd->place->width, vd->place->height);
#endif
}
}
diff --git a/modules/video_output/win32/common.h b/modules/video_output/win32/common.h
index 4df23573c2d..c741bdecf83 100644
--- a/modules/video_output/win32/common.h
+++ b/modules/video_output/win32/common.h
@@ -32,8 +32,6 @@ typedef struct event_thread_t event_thread_t;
typedef struct display_win32_area_t
{
- /* Coordinates of dest images (used when blitting to display) */
- vout_display_place_t place;
bool place_changed;
} display_win32_area_t;
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 3ce14bb3681..3eae603ded8 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -264,8 +264,8 @@ static int QueryDisplayFormat(vout_display_t *vd, const video_format_t *fmt)
static void UpdateSize(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
- msg_Dbg(vd, "Detected size change %dx%d", sys->area.place.width,
- sys->area.place.height);
+ msg_Dbg(vd, "Detected size change %dx%d", vd->place->width,
+ vd->place->height);
QueryDisplayFormat(vd, &vd->fmt);
@@ -979,10 +979,10 @@ static void UpdatePicQuadPosition(vout_display_t *vd)
vout_display_sys_t *sys = vd->sys;
RECT rect_dst = {
- .left = sys->area.place.x,
- .right = sys->area.place.x + sys->area.place.width,
- .top = sys->area.place.y,
- .bottom = sys->area.place.y + sys->area.place.height
+ .left = vd->place->x,
+ .right = vd->place->x + vd->place->width,
+ .top = vd->place->y,
+ .bottom = vd->place->y + vd->place->height
};
D3D11_UpdateViewport( &sys->picQuad, &rect_dst, sys->display.pixelFormat );
@@ -1388,10 +1388,10 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
d3d_quad_t *quad = (d3d_quad_t *) quad_picture->p_sys;
RECT spuViewport;
- spuViewport.left = (FLOAT) r->i_x * sys->area.place.width / subpicture->i_original_picture_width;
- spuViewport.top = (FLOAT) r->i_y * sys->area.place.height / subpicture->i_original_picture_height;
- spuViewport.right = (FLOAT) (r->i_x + r->fmt.i_visible_width) * sys->area.place.width / subpicture->i_original_picture_width;
- spuViewport.bottom = (FLOAT) (r->i_y + r->fmt.i_visible_height) * sys->area.place.height / subpicture->i_original_picture_height;
+ spuViewport.left = (FLOAT) r->i_x * vd->place->width / subpicture->i_original_picture_width;
+ spuViewport.top = (FLOAT) r->i_y * vd->place->height / subpicture->i_original_picture_height;
+ spuViewport.right = (FLOAT) (r->i_x + r->fmt.i_visible_width) * vd->place->width / subpicture->i_original_picture_width;
+ spuViewport.bottom = (FLOAT) (r->i_y + r->fmt.i_visible_height) * vd->place->height / subpicture->i_original_picture_height;
if (r->zoom_h.num != 0 && r->zoom_h.den != 0)
{
@@ -1405,10 +1405,10 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
}
/* move the SPU inside the video area */
- spuViewport.left += sys->area.place.x;
- spuViewport.right += sys->area.place.x;
- spuViewport.top += sys->area.place.y;
- spuViewport.bottom += sys->area.place.y;
+ spuViewport.left += vd->place->x;
+ spuViewport.right += vd->place->x;
+ spuViewport.top += vd->place->y;
+ spuViewport.bottom += vd->place->y;
D3D11_UpdateViewport( quad, &spuViewport, sys->display.pixelFormat );
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 1b2ba2ff152..7ee3c24fe04 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -416,10 +416,10 @@ static int Direct3D9ImportPicture(vout_display_t *vd,
.bottom = vd->source.i_height,
};
RECT rect_in_display = {
- .left = sys->area.place.x,
- .right = sys->area.place.x + sys->area.place.width,
- .top = sys->area.place.y,
- .bottom = sys->area.place.y + sys->area.place.height,
+ .left = vd->place->x,
+ .right = vd->place->x + vd->place->width,
+ .top = vd->place->y,
+ .bottom = vd->place->y + vd->place->height,
};
RECT texture_visible_rect = {
.left = 0,
@@ -980,8 +980,8 @@ static void Direct3D9ImportSubpicture(vout_display_t *vd,
}
/* Map the subpicture to sys->sys.sys.place */
- const float scale_w = (float)(sys->area.place.width) / subpicture->i_original_picture_width;
- const float scale_h = (float)(sys->area.place.height) / subpicture->i_original_picture_height;
+ const float scale_w = (float)(vd->place->width) / subpicture->i_original_picture_width;
+ const float scale_h = (float)(vd->place->height) / subpicture->i_original_picture_height;
RECT rect_in_display;
rect_in_display.left = scale_w * r->i_x,
@@ -989,10 +989,10 @@ static void Direct3D9ImportSubpicture(vout_display_t *vd,
rect_in_display.top = scale_h * r->i_y,
rect_in_display.bottom = rect_in_display.top + scale_h * r->fmt.i_visible_height;
- rect_in_display.left += sys->area.place.x;
- rect_in_display.right += sys->area.place.x;
- rect_in_display.top += sys->area.place.y;
- rect_in_display.bottom += sys->area.place.y;
+ rect_in_display.left += vd->place->x;
+ rect_in_display.right += vd->place->x;
+ rect_in_display.top += vd->place->y;
+ rect_in_display.bottom += vd->place->y;
RECT texture_rect;
texture_rect.left = 0;
diff --git a/modules/video_output/win32/glwin32.c b/modules/video_output/win32/glwin32.c
index b9bb0b40d4f..9002db5af50 100644
--- a/modules/video_output/win32/glwin32.c
+++ b/modules/video_output/win32/glwin32.c
@@ -211,7 +211,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
return;
if (sys->area.place_changed)
{
- vout_display_place_t place = sys->area.place;
+ vout_display_place_t place = *vd->place;
/* Reverse vertical alignment as the GL tex are Y inverted */
vout_display_PlaceFlipVertical(vd->cfg, &place);
diff --git a/modules/video_output/win32/wingdi.c b/modules/video_output/win32/wingdi.c
index ef7655571b7..38cefe0de59 100644
--- a/modules/video_output/win32/wingdi.c
+++ b/modules/video_output/win32/wingdi.c
@@ -172,20 +172,20 @@ 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) {
+ if (vd->place->width != vd->source.i_visible_width ||
+ vd->place->height != vd->source.i_visible_height) {
SetStretchBltMode(hdc, COLORONCOLOR);
- StretchBlt(hdc, sys->area.place.x, sys->area.place.y,
- sys->area.place.width, sys->area.place.height,
+ StretchBlt(hdc, vd->place->x, vd->place->y,
+ vd->place->width, vd->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,
SRCCOPY);
} else {
- BitBlt(hdc, sys->area.place.x, sys->area.place.y,
- sys->area.place.width, sys->area.place.height,
+ BitBlt(hdc, vd->place->x, vd->place->y,
+ vd->place->width, vd->place->height,
sys->off_dc,
vd->source.i_x_offset, vd->source.i_y_offset,
SRCCOPY);
--
2.26.2
More information about the vlc-devel
mailing list