Re: Comments on clipping fix (118317)



On Wed, 2003-08-20 at 13:00, Soeren Sandmann wrote:
> Owen Taylor <otaylor redhat com> writes:
> 
> > > > I think clipping the clear to the actual region is worthwhile - the
> > > > regions are not infrequently very sparse, for an opaque move resize,
> > > > we might frequently have a 500x500 region of which only 
> > > > two 5x500 stripes are there.
> > > 
> > > Done.
> > 
> > How? I don't see it in the new patch, though maybe I'm just
> > missing something.
> 
>  static void
>  gdk_window_clear_backing_rect (GdkWindow *window,
>  			       gint       x,
> @@ -1795,10 +1682,16 @@
>  
>    if (GDK_WINDOW_DESTROYED (window))
>      return;
> -  
> +
>    tmp_gc = gdk_window_get_bg_gc (window, paint);
> +
> +  gdk_region_offset (paint->region, paint->x_offset, paint->y_offset);
> +  gdk_gc_set_clip_region (tmp_gc, paint->region);
> +  gdk_region_offset (paint->region, - paint->x_offset, - paint->y_offset);
> +  
>    gdk_draw_rectangle (paint->pixmap, tmp_gc, TRUE,
>  		      x - paint->x_offset, y - paint->y_offset, width, height);
> +
>    g_object_unref (tmp_gc);
>  }

Oh, OK. I misread this chunk as belonging to some other function. 
Looks fine, as does the rest of the patch.
 
> (It's possible to save one line of code by using
> gdk_gc_set_clip_offset(), of course).

Maybe the best way to express all the offset arithmetic would
be to simply to gdk_draw_rectangle (window, ...)? 
gdk_region_offset() is potentially slow for complicated regions.

Regards,
					Owen





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]