[cairo-bugs] [Bug 92202] New: Win32 printing surface can fail if rotation transforms are used

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Sep 30 10:30:35 PDT 2015


            Bug ID: 92202
           Summary: Win32 printing surface can fail if rotation transforms
                    are used
           Product: cairo
           Version: unspecified
          Hardware: Other
                OS: Windows (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: win32 backend
          Assignee: cairo-bugs at cairographics.org
          Reporter: lsalzman at mozilla.com
        QA Contact: cairo-bugs at cairographics.org

Created attachment 118551
  --> https://bugs.freedesktop.org/attachment.cgi?id=118551&action=edit
fix rotated strokes and images in Win32 printing surfaces

In Firefox, we noticed that when printing a PDF including rotations from pdf.js
that both images and stroked paths would fail to show up in many print drivers.

We tracked this down to two bugs in cairo-win32-printing-surface.c.

The first bug is that stroked path are both being transformed by Cairo with the
CTM, and then later again by supplying the CTM to GDI when StrokePath is
called. Some print drivers ignore the transform and appear to work, others
honor the transform and stuff fails to work, since the path is then
double-transformed. So we just removed the big about supplying the transform to
GDI and all is well again.

The second bug involves image patterns. StretchDIBits under some printing
devices is simply broken if you give it a rotation transform. As a simple
workaround that we found worked on all printer drivers we tested with, we just
swap the X and Y axes of the image before giving it to StretchDIBits, so the
rotation transform becomes a harmless scale and/or mirror that the drivers will

Between these two, pdf.js printing resumed working for us.

The upstream Firefox bug report is here:

We've attached our patch that resolves the issue and it would be nice if we
could get this upstreamed.

You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo-bugs/attachments/20150930/16175d4c/attachment-0001.html>

More information about the cairo-bugs mailing list