<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Win32 printing surface can fail if rotation transforms are used"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=92202">92202</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Win32 printing surface can fail if rotation transforms are used
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>cairo
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>win32 backend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>cairo-bugs@cairographics.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>lsalzman@mozilla.com
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>cairo-bugs@cairographics.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=118551" name="attach_118551" title="fix rotated strokes and images in Win32 printing surfaces">attachment 118551</a> <a href="attachment.cgi?id=118551&action=edit" title="fix rotated strokes and images in Win32 printing surfaces">[details]</a></span>
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
honor.

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

The upstream Firefox bug report is here:
<a href="http://bugzilla.mozilla.org/show_bug.cgi?id=1205854">http://bugzilla.mozilla.org/show_bug.cgi?id=1205854</a>

We've attached our patch that resolves the issue and it would be nice if we
could get this upstreamed.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>