Thanks again for the suggestions, Carl. I'll see what I can do to get my app running close to 60fps. Also, I can confirm Soeren's comment on the bounding trapezoid issue applying to large rounded rectangles and curves, since I have experienced similar performance issues with those cases.<br>
<br>I'll look forward to these issues being resolved in the near future, since they seem to be pretty crucial for anyone planning to do basic smooth animation with Cairo.<br><br>Giles<br><br><br><div class="gmail_quote">
On Fri, Oct 31, 2008 at 1:48 PM, Carl Worth <span dir="ltr"><<a href="mailto:cworth@cworth.org">cworth@cworth.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Fri, 2008-10-31 at 13:34 -0700, Giles Westerfield wrote:<br>
> Thank you Carl and Vlad for your helpful explanations. I'm also very<br>
> impressed with the general activity on the mailing list.<br>
<br>
</div>I'm quite glad to hear that.<br>
<div class="Ih2E3d"><br>
> 1. Before doing any drawing, translate the entire surface by .5<br>
> pixels horizontally and vertically so that even integer values land on<br>
> the boundaries between pixels and not in the middle of pixels. Also,<br>
> I should use only integer values for line widths.<br>
<br>
</div>This is not a good idea. This will give you geometry that is unaligned<br>
by 0.5 device pixels in at least the following cases:<br>
<br>
* Using integer coordinates for your path and then doing cairo_fill.<br>
<br>
* Using integer coordinate paths for path and stroking with an even<br>
integer line width.<br>
<br>
Much better is to not try to do a global translation to "fix" things,<br>
but to instead provide geometry to cairo that is precisely where you<br>
want it. For example, use integer coordinates for fills, integer<br>
coordinates for strokes with even-integer line widths, and half-integer<br>
coordinates when appropriate for strokes with odd-integer line widths.<br>
<br>
Note that you'll also want to consider line caps and joins if you are<br>
stroking. The default line cap is LINE_CAP_BUTT so the stroke ends<br>
abruptly at the coordinate you specify. Meanwhile, with LINE_CAP_SQUARE<br>
the line would extend by one half the line width. So one or the other<br>
might make it easier to put the geometry exactly where you want it<br>
depending on how you organizae your code.<br>
<div class="Ih2E3d"><br>
> 2. Break long diagonal lines up into smaller diagonal lines so that<br>
> the overall needless computation is lowered.<br>
<br>
</div>This may very well help for now, yes.<br>
<div class="Ih2E3d"><br>
> Any other ideas? Should I keep antialiasing off?<br>
<br>
</div>Try it and see, I guess? One might imagine that using an A1 surface<br>
rather than an A8 surface could potentially be faster as well, (since<br>
without antialiasing you won't be using more than two values in your<br>
result anyway).<br>
<br>
But then again, it might very well not be. An A1 surface will use less<br>
memory, but there are packing and unpacking considerations, as well as<br>
the possibility of more hand-written optimized compositing paths having<br>
been written for A8 than for A1. So again, I think this is a case of try<br>
it and see.<br>
<br>
But really, the question of antialiasing or not should really be<br>
answered based on what you actually want to draw. Given that, we should<br>
then focus on fixing cairo to do that as fast as possible. This is much<br>
better than drawing something that's not what you want just because it<br>
might happen to be implemented faster for now.<br>
<div class="Ih2E3d"><br>
> Is it worth updating from 1.8.0 to the most recent 1.8.2 with<br>
> respect to these issues?<br>
<br>
</div>I wouldn't expect it to make any different for these specific issues,<br>
no. But we would still appreciate you upgrading and letting us know any<br>
feedback you might have on our new release. :-)<br>
<br>
Thanks,<br>
<font color="#888888"><br>
-Carl<br>
<br>
</font></blockquote></div><br>