> Now, if that's _still_ too slow, then the next thing to address is<br>> perhaps in the X server itself, (ideally, it would be able to use the <br>> video hardware for the rotation, and not require much CPU at all). So,
<br>> it's a question of how good the support is for rotated images in your<br>> server's implementation of the Render extension.<br><br> Switching to use an Xlib surface didn't really help. So you're saying that it's a problem with my X server setup? Cairo itself should be using the Render extension already? Sorry for the simple questions, I'm still new to cairo.
<br><br>> Are you using a cairo snapshot between 1.3.2 and 1.3.12?<br><br>Yep, that was the problem. Thanks a lot for the help.<br><br><br><div><span class="gmail_quote">On 2/20/07, <b class="gmail_sendername">Carl Worth
</b> <<a href="mailto:cworth@cworth.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">cworth@cworth.org </a>> wrote:</span><blockquote class="gmail_quote" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: 0.80ex; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; padding-left: 1ex">
On Tue, 20 Feb 2007 16:03:05 -0600, "Glenn Murphy" wrote:<br>> When I added the rotation is when I first hit this problem. I was rendering<br>> everything on each refresh, so the application was sucking up a lot of CPU
<br>> time. I changed it to draw everything to a ImageSurface the one time and<br>> then paint that to the screen when the expose-event was signaled. Whenever<br>> the expose-event signal is received, all it does is create a cairo context
<br>> (using gtk.gdk.Window.cairo_create()), translate to the center, rotate 1<br>> degree and paints the ImageSurface. However, after doing all that, it still<br>> sucks up a lot of CPU time from redrawing the DrawingArea all the time.
<br>> expose-event is getting signaled a lot (about 30 times a second) and each<br>> time it has to redraw the entire DrawingArea.<br><br>If you're painting an image surface every time, then you will be<br>transferring all of the image data from your application to the X
<br>server every time.<br><br>So, better would be to have your intermediate surface as an xlib<br>surface, (or whatever surface type your destination is). You can<br>create one of those with cairo_surface_create_similar. Given a
<br>cairo_t* cr from gdk_cairo_create that would be something like:<br><br>surface = cairo_surface_create_similar (cairo_get_target (cr),<br> CAIRO_CONTENT_COLOR[_ALPHA],<br>
width, height); <br><br>Hopefully it's obvious to you how to translate that from C to python.<br><br>Now, if that's _still_ too slow, then the next thing to address is<br>perhaps in the X server itself, (ideally, it would be able to use the
<br>video hardware for the rotation, and not require much CPU at all). So,<br>it's a question of how good the support is for rotated images in your<br>server's implementation of the Render extension.<br><br>> Another problem I've been having is from rotating the ImageSurface. Whenever
<br>> I rotate it, the image created is moved outside of the clipping region.<br>> Every 90 degrees, it moves back to the correct position. I haven't been able<br>> to find anything about this problem. I have three images showing this
<br>> problem:<br><br>Are you using a cairo snapshot between 1.3.2 and 1.3.12? That looks an<br>awful lot like a bug that was fixed in the 1.3.14 snapshot which was<br>described as follows in the release notes:<br><br>
Fix corrupted results when rendering a transformed source image<br> surface to an xlib surface. This was a regression that had been<br> present since the 1.3.2 snapshot.<br><br> [<a href="http://cairographics.org/news/cairo-1.3.14" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://cairographics.org/news/cairo-1.3.14</a>]<br><br>I hope that helps. And have fun with cairo,<br><br>-Carl<br><br></blockquote></div><br>