[vlc-devel] [PATCH 17/20] vout: win32: use the placed picture dimensions from the core
Steve Lhomme
robux4 at ycbcr.xyz
Tue Aug 25 09:30:05 CEST 2020
No need to keep our own anymore. It's always updated for us.
---
modules/video_output/win32/common.c | 8 +------
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 | 6 +++---
modules/video_output/win32/wingdi.c | 12 +++++------
6 files changed, 34 insertions(+), 42 deletions(-)
diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index e84a5498a1b..df45a5d3d83 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -95,12 +95,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_place_t before_place = area->place;
- vout_display_PlacePicture(&area->place, &vd->source, vd->cfg);
-
- /* Signal the change in size/position */
- if (!vout_display_PlaceEquals(&before_place, &area->place))
{
area->place_changed |= true;
@@ -110,7 +104,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 7aaef5701ce..d8048f6c58a 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 920b462902a..8b5d26a1b88 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 cbb6eba826f..7c58355d178 100644
--- a/modules/video_output/win32/glwin32.c
+++ b/modules/video_output/win32/glwin32.c
@@ -213,13 +213,13 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
VLC_UNUSED(date);
vout_display_sys_t *sys = vd->sys;
- const int width = sys->area.place.width;
- const int height = sys->area.place.height;
+ const int width = vd->place->width;
+ const int height = vd->place->height;
vlc_gl_Resize (sys->gl, width, height);
if (vlc_gl_MakeCurrent (sys->gl) != VLC_SUCCESS)
return;
vout_display_opengl_SetWindowAspectRatio(sys->vgl, (float)width / height);
- vout_display_opengl_Viewport(sys->vgl, sys->area.place.x, sys->area.place.y, width, height);
+ vout_display_opengl_Viewport(sys->vgl, vd->place->x, vd->place->y, width, height);
vout_display_opengl_Prepare (sys->vgl, picture, subpicture);
vlc_gl_ReleaseCurrent (sys->gl);
}
diff --git a/modules/video_output/win32/wingdi.c b/modules/video_output/win32/wingdi.c
index ff524e01f68..18170585160 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