<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.7600.16625"></HEAD>
<BODY>2010/9/27 oken <okenjian@163.com>: <BR>> Hi, all, <BR>> I am
using cairo 1.8.10 under wine, and i find that in some situations, <BR>>
cairo_stroke works very slow. <BR>> drawing 1000 lines on an image surface
takes only 915ms, but on a Win32 <BR>> surface it takes 10,493ms! <BR>>
the testing code is as follow: <BR><BR>This is also what I see in my app (mostly
scrolling text), the <BR>framerate using an image surface is much higher.
<BR><BR>> I run my test under both wine and win7, and i get the similar
result:drawing <BR>> on an image surface is much faster than WIN32 surface
does. <BR>> Most of the time is consumed by cairo_stroke. <BR>> I know i
can move cairo_stroke out of the for loop and call it only once, it <BR>>
improve the performance a lot. <BR><BR>The win32 surface is really basic, since
it uses the windows GDI <BR>subsystem. Pixman has a lot of fast paths using e.g.
SSE2 assembly, <BR>which makes the image surface quite fast. <BR><FONT
color=#0000ff>calling GDI'S API to draw something under wine is very
fast.<BR>But if i create a WIN32 surface using that HDC then call
cairo's API to draw lines, <BR>it becomes very
slow.<BR>Why</FONT>?<BR><BR>> I also find that drawing rectangles on a win32
surface is fast if the <BR>> parameters are integer, however using double
decrease the performance a <BR>> lot(about 10 times slower!). <BR><BR>By
double do you mean, non-integer doubles? That is expected, because <BR>the
rectangles are not pixel-aligned. <BR><BR><FONT color=#0000ff>Yes, i do mean
non-integer doubles. the rectangles are not pixel-aligned. <BR>But, why is it
that pixel-aligned affects the performance?<BR></FONT><BR>> I have a few
questions: <BR>> 1. does it make sense that drawing a single line(not
horizontal or vertical) <BR>> or a rectangle(with double parameters) on a
WIN32 surface takes about 10ms? <BR><BR>I guess so. <BR><FONT color=#0000ff>Do
you mean that drawing a single line(not horizontal or vertical) <BR>or a
rectangle(with non-integer parameters) on a WIN32 surface takes about 10ms
reasonable?<BR>It is really very slow, 10 times slower than on the image
surface.</FONT><BR><BR>> 2. is it possible to improve it ? how?
<BR><BR>Render all your lines to an image surface and when you're done, blit
<BR>the pixels to the win32 surface. <BR>it may works. but we have to modify
most of the code.<BR>besides, cairo_fill and cairo_clip suffer the same
problem.<BR><BR>> 3. what can i do the improve the performance of cairo if i
am using it under <BR>> wine? <BR>> <BR>> thanks! <BR><BR>Maarten <BR>.
<BR><BR><FONT color=#0000ff>I find it that no matter what the surface is,
cairo_stroke will call _cairo_surface_fallback_stroke.<BR>what makes the
performance 's difference between using an image surface and a win32
surface?<BR><BR>will cairo1.2 fix the
problems?<BR></FONT><BR>oken<BR></BODY></HTML>