<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - [EMF] RestoreDC shoud read and use 'SavedDC' value"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=142567">142567</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[EMF] RestoreDC shoud read and use 'SavedDC' value
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>LibreOffice
          </td>
        </tr>

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

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

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

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

        <tr>
          <th>Component</th>
          <td>graphics stack
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>libreoffice-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>frob@df.ru
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Description:
[MS-EMF] 2.3.1.16 says:
"SavedDC (4 bytes): A signed integer that specifies the saved state to restore
relative to the current state. This value MUST be negative; –1 represents the
state that was most recently saved on the stack, –2 the one before that, etc."

LO simply pops the context once.
<a href="https://github.com/LibreOffice/core/blob/master/emfio/source/reader/emfreader.cxx#L1103:L1107">https://github.com/LibreOffice/core/blob/master/emfio/source/reader/emfreader.cxx#L1103:L1107</a>


Steps to Reproduce:
Open attached EMF sample.

Actual Results:
It shows empty object.

Expected Results:
It should show red rectangle.


Reproducible: Always


User Profile Reset: No



Additional Info:
The issue is isolated from <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - FILEOPEN EMF+ images in PPT and PPTX are narrower"
   href="show_bug.cgi?id=59814">tdf#59814</a>.
LO doesn't handle the stack of the context properly, as a result the
combination of ModifyWorldTransform records places the rectangle outside of the
visible area.

In the original bug that leads to shifts of some shape positions.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>