<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://git.reviewboard.kde.org/r/113704/">http://git.reviewboard.kde.org/r/113704/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On November 10th, 2013, 6:39 p.m. UTC, <b>David Faure</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="http://git.reviewboard.kde.org/r/113704/diff/2/?file=212428#file212428line246" style="color: black; font-weight: bold; text-decoration: underline;">tier1/kguiaddons/src/plugins/imageformats/eps.cpp</a>
<span style="font-weight: normal;">
(Diff revision 2)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">bool EPSHandler::canRead() const</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">211</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="c1">// load image</span></pre></td>
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">236</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">QImageReader</span> <span class="nf">ppmReader</span><span class="p">(</span><span class="n">tmpFile</span><span class="p">.</span><span class="n">fileName</span><span class="p">(),</span> <span class="s">"ppm"</span><span class="p">);</span></pre></td>
</tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">My suggestion was simply QImageReader ppmReader(io, "ppm"), to let it read directly from the QProcess iodevice. Then there's no need to write your own loop.
Would that not work? (I'm not sure what happens if we have to wait for more data to be available, maybe QImageReader isn't ready for that....)
</pre>
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Well, as it's set up, we feed the io device we're given (in EPS format) to gs via its stdin, and let it write to a file. Then we let QImageReader read the file (in PPM format). The buffer is used to do that first transfer, which doesn't involved QImageReader directly.
Alternatively, we could write the io device contents (in EPS format) to a file, and pass the output (read) channel of the gs process to QImageReader, but I'm not sure that actually buys us anything.
Avoiding the temporary file altogether sets us up for potential deadlocks.</pre>
<br />
<p>- Alex</p>
<br />
<p>On November 10th, 2013, 6:16 p.m. UTC, Alex Merry wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for KDE Frameworks.</div>
<div>By Alex Merry.</div>
<p style="color: grey;"><i>Updated Nov. 10, 2013, 6:16 p.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
kdelibs
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">4 commits. Previously, writing support was completely broken (it would write a PDF file instead of an EPS file). The rest of the changes mostly make it more maintainable.
Disable EPS plugin on non-UNIX systems
It depends on the gs command-line utility being in PATH, which is
unlikely on Windows, for example.
Use QProcess to run gs when reading EPS images
Fix writing EPS files
QPrinter is no longer capable of producing PostScript files, so we
output to PDF then used GhostScript (or pdftops from Poppler) to convert
the result to EPS. Note that GhostScript is already used by the reading
code.
Use qCDebug for the EPS plugin</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Successfully converted a JPG file to EPS and back again; both the final JPG and the intermediate EPS file display properly with Gwenview/Okular from KDE SC 4. This works both with pdftops present in PATH and without it (providing gs is in PATH).</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>tier1/kguiaddons/src/plugins/imageformats/CMakeLists.txt <span style="color: grey">(005859ac6fd792f2589339bc68437dd2d965cc8f)</span></li>
<li>tier1/kguiaddons/src/plugins/imageformats/eps.cpp <span style="color: grey">(cb25052a9d7a01ea7a8ed8014726b762e8a5da16)</span></li>
</ul>
<p><a href="http://git.reviewboard.kde.org/r/113704/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>