<div dir="ltr">On Thu, Mar 21, 2013 at 1:27 PM, Kathleen S. Biagas <span dir="ltr"><<a href="mailto:biagas2@llnl.gov" target="_blank">biagas2@llnl.gov</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I have a change to vtkTextActor.cxx that I would like to submit for<br>
consideration. It corrects an issue that crops up for us on some<br>
systems, where a portion of text is not rendered fully (top row of<br>
pixels appears cut-off). I have a small test that demonstrates the<br>
issue (at least on my RHEL6 system). I didn't want to submit the change<br>
in gerrit without understanding the procedure for providing the<br>
reproducer along side. Tips on that?<br></blockquote><div><br></div><div>Try adding another text actor to these tests that shows the problem:<div><br></div><div>VTK/Rendering/FreeType/Testing/Cxx/TestMathTextFreeTypeTextRenderer<br>
</div><div>VTK/Rendering/FreeType/Testing/Cxx/TestMathTextFreeTypeTextRendererNoMath<br></div><div><br></div><div>and the push the test to gerrit (along with the fix).</div><div><br></div><div>If this is a common problem, we may want to attack the problem in the text rendering code (rather than the actor), but let's see what we can find out.</div>
<div><br></div><div>Thanks!</div><div>Dave</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Thanks,<br>
<br>
Kathleen<br>
<br>
Here's the patch:<br>
<br>
<br>
--- /VTK-462c2c1/Rendering/FreeType/vtkTextActor.cxx 2013-03-20<br>
07:51:43.000000000<br>
+++ /vtkTextActor.cxx 2013-03-18 09:41:01.000000000<br>
@@ -635,22 +635,27 @@<br>
dims[0] = ( text_bbox[1] - text_bbox[0] + 1 );<br>
dims[1] = ( text_bbox[3] - text_bbox[2] + 1 );<br>
<br>
// compute TCoords.<br>
vtkFloatArray* tc = vtkFloatArray::SafeDownCast<br>
( this->Rectangle->GetPointData()->GetTCoords() );<br>
+ float tcXMax, tcYMax;<br>
+ // Add a fudge factor to the texture coordinates to prevent the top<br>
+ // row of pixels from being truncated on some systems.<br>
+ tcXMax = fminf(1.0, (dims[0] + 0.001) /<br>
static_cast<float>(p2dims[0]));<br>
+ tcYMax = fminf(1.0, (dims[1] + 0.001) /<br>
static_cast<float>(p2dims[1]));<br>
tc->InsertComponent(0, 0, 0.0);<br>
tc->InsertComponent(0, 1, 0.0);<br>
<br>
tc->InsertComponent(1, 0, 0.0);<br>
- tc->InsertComponent(1, 1, dims[1] / static_cast<float>(p2dims[1]));<br>
+ tc->InsertComponent(1, 1, tcYMax);<br>
<br>
- tc->InsertComponent(2, 0, dims[0] / static_cast<float>(p2dims[0]));<br>
- tc->InsertComponent(2, 1, dims[1] / static_cast<float>(p2dims[1]));<br>
+ tc->InsertComponent(2, 0, tcXMax);<br>
+ tc->InsertComponent(2, 1, tcYMax);<br>
<br>
- tc->InsertComponent(3, 0, dims[0] / static_cast<float>(p2dims[0]));<br>
+ tc->InsertComponent(3, 0, tcXMax);<br>
tc->InsertComponent(3, 1, 0.0);<br>
}<br>
else<br>
{<br>
dims[0] = dims[1] = 0;<br>
}<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
</blockquote></div><br></div></div>