[cairo] clipping

Chris Wilson chris at chris-wilson.co.uk
Fri Feb 8 07:25:37 PST 2013

On Fri, Feb 08, 2013 at 03:48:58PM +0100, Theo Veenker wrote:
> Hi all,
> Since 1.12.0 I have noticed a problem with drawing text (using pango) onto
> an xlib surface or similar surface when there is global scaling applied and
> the text drawing involves some clipping.
> My purpose is as follows. Let's say I have some graphics (containing text)
> which is normally displayed in a fullscreen window, but in some situations
> I want to show a scaled down version of the window, so the user can see a
> mock-up of the fullscreen version. It's nothing special. It works as expected
> with cairo 1.10.2 and earlier. It also works fine when drawing onto an image
> surface.
> I have created a test case which demonstrates the bug. See attached images
> for the 1.10.2 (OK) and for 1.12.x (not OK). The drawing routine for the
> test case is this:

Thank you, the error was in applying the destination window offset
multiple times - every time we need to adjust the glyph for kerning, we
need to break the glyph string sent over xlib and specifying the
relative starting coordinate for the next string. That starting
coordinate was being munged to include the destination window offset,
under the misapprehension that it was an absolute coordinate.

commit 2d7ac9e737f37daf8490c27e6a04c65bba642645
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Feb 8 15:19:14 2013 +0000

    xlib: Only apply the dst offset to the glyph strings once
    The elts offset is a delta from the previous glyph coordinate. So by
    subtracting the dst origin everytime, we were accumulating a glyph
    position error. Instead we just want to offset the starting coordinate
    and then always use relative positions.

Chris Wilson, Intel Open Source Technology Centre

More information about the cairo mailing list