Commit c2bbdc4b authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Clip surface drawn region to new visible rect on window resize.

This prevents stale drawing from being revealed if the window later grows.
parent f37153ac
......@@ -141,6 +141,7 @@ extern struct window_surface *create_surface(macdrv_window window, const RECT *r
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_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;
......
......@@ -410,3 +410,35 @@ CGImageRef create_surface_image(void *window_surface, CGRect *rect, int copy_dat
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)))
{
/* existing surface is good enough */
surface_clip_to_visible_rect(data->surface, visible_rect);
window_surface_add_ref(data->surface);
*surface = data->surface;
goto done;
......
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