winemac: Clip surface drawn region to new visible rect on window resize.
This prevents stale drawing from being revealed if the window later grows.
This commit is contained in:
parent
f37153ac7d
commit
c2bbdc4b86
|
@ -141,6 +141,7 @@ static inline RECT rect_from_cgrect(CGRect cgrect)
|
||||||
struct window_surface *old_surface, BOOL use_alpha) DECLSPEC_HIDDEN;
|
struct window_surface *old_surface, BOOL use_alpha) DECLSPEC_HIDDEN;
|
||||||
extern void set_window_surface(macdrv_window window, struct window_surface *window_surface) DECLSPEC_HIDDEN;
|
extern void set_window_surface(macdrv_window window, struct window_surface *window_surface) DECLSPEC_HIDDEN;
|
||||||
extern void set_surface_use_alpha(struct window_surface *window_surface, BOOL use_alpha) DECLSPEC_HIDDEN;
|
extern void set_surface_use_alpha(struct window_surface *window_surface, BOOL use_alpha) DECLSPEC_HIDDEN;
|
||||||
|
extern void surface_clip_to_visible_rect(struct window_surface *window_surface, const RECT *visible_rect) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
extern void macdrv_handle_event(const macdrv_event *event) DECLSPEC_HIDDEN;
|
extern void macdrv_handle_event(const macdrv_event *event) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
|
|
|
@ -410,3 +410,35 @@ CGImageRef create_surface_image(void *window_surface, CGRect *rect, int copy_dat
|
||||||
|
|
||||||
return cgimage;
|
return cgimage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* surface_clip_to_visible_rect
|
||||||
|
*
|
||||||
|
* Intersect the accumulated drawn region with a new visible rect,
|
||||||
|
* effectively discarding stale drawing in the surface slack area.
|
||||||
|
*/
|
||||||
|
void surface_clip_to_visible_rect(struct window_surface *window_surface, const RECT *visible_rect)
|
||||||
|
{
|
||||||
|
struct macdrv_window_surface *surface = get_mac_surface(window_surface);
|
||||||
|
|
||||||
|
window_surface->funcs->lock(window_surface);
|
||||||
|
|
||||||
|
if (surface->drawn)
|
||||||
|
{
|
||||||
|
RECT rect;
|
||||||
|
HRGN region;
|
||||||
|
|
||||||
|
rect = *visible_rect;
|
||||||
|
OffsetRect(&rect, -rect.left, -rect.top);
|
||||||
|
|
||||||
|
if ((region = CreateRectRgnIndirect(&rect)))
|
||||||
|
{
|
||||||
|
CombineRgn(surface->drawn, surface->drawn, region, RGN_AND);
|
||||||
|
DeleteObject(region);
|
||||||
|
|
||||||
|
update_blit_data(surface);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window_surface->funcs->unlock(window_surface);
|
||||||
|
}
|
||||||
|
|
|
@ -1284,6 +1284,7 @@ void CDECL macdrv_WindowPosChanging(HWND hwnd, HWND insert_after, UINT swp_flags
|
||||||
if (!memcmp(&data->surface->rect, &surface_rect, sizeof(surface_rect)))
|
if (!memcmp(&data->surface->rect, &surface_rect, sizeof(surface_rect)))
|
||||||
{
|
{
|
||||||
/* existing surface is good enough */
|
/* existing surface is good enough */
|
||||||
|
surface_clip_to_visible_rect(data->surface, visible_rect);
|
||||||
window_surface_add_ref(data->surface);
|
window_surface_add_ref(data->surface);
|
||||||
*surface = data->surface;
|
*surface = data->surface;
|
||||||
goto done;
|
goto done;
|
||||||
|
|
Loading…
Reference in New Issue