quartz: Fix up _gdk_quartz_window_translate

This commit is contained in:
Kristian Rietveld 2010-07-24 10:52:10 +02:00 committed by Benjamin Otte
parent 6a48a042c7
commit 23c9cee274

View File

@ -22,32 +22,48 @@
#include "gdkprivate-quartz.h"
/* FIXME: Tis function has never been compiled.
* Please make it work. */
void
_gdk_quartz_window_translate (GdkWindow *window,
cairo_region_t *area,
gint dx,
gint dy)
{
cairo_region_t *invalidate, *scrolled;
GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowImplQuartz *impl = (GdkWindowImplQuartz *)private->impl;
GdkRectangle extents;
cairo_region_get_extents (area, &extents);
[window_impl->view scrollRect:NSMakeRect (extents.x, extents.y, extents.width, extents.height)
by:NSMakeSize (dx, dy)];
[impl->view scrollRect:NSMakeRect (extents.x - dx, extents.y - dy,
extents.width, extents.height)
by:NSMakeSize (dx, dy)];
if (impl->needs_display_region)
{
cairo_region_t *intersection;
/* Invalidate already invalidated area that was moved at new
* location.
*/
intersection = cairo_region_copy (impl->needs_display_region);
cairo_region_intersect_rectangle (intersection, extents);
cairo_region_intersect (intersection, area);
cairo_region_translate (intersection, dx, dy);
_gdk_quartz_window_set_needs_display_in_region (window, intersection);
cairo_region_destroy (intersection);
}
/* Calculate newly exposed area that needs invalidation */
scrolled = cairo_region_copy (area);
cairo_region_translate (scrolled, dx, dy);
invalidate = cairo_region_copy (area);
cairo_region_subtract (invalidate, scrolled);
cairo_region_destroy (scrolled);
_gdk_quartz_window_set_needs_display_in_region (window, invalidate);
cairo_region_destroy (invalidate);
}
gboolean