<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>Hi All,</DIV>
<DIV>&nbsp;</DIV>
<DIV>I am new to Cairo and today i encounter a dash line problem on Win32.</DIV>
<DIV>&nbsp;</DIV>
<DIV>I had some testing code for it:</DIV>
<DIV>&nbsp;</DIV>
<DIV>void TestBug(cairo_t *ct)<BR>{<BR>&nbsp;cairo_new_path(ct);&nbsp;</DIV>
<DIV>&nbsp;double dashes[] = {5.0 /*ink*/,1.0/*skip */};<BR>&nbsp;int&nbsp;&nbsp;&nbsp; ndash&nbsp; = sizeof (dashes)/sizeof(dashes[0]);<BR>&nbsp;double offset = 0;</DIV>
<DIV>&nbsp;cairo_set_dash (ct, dashes, ndash, offset);<BR>&nbsp;cairo_set_source_rgb(ct,0,1.0,0);</DIV>
<DIV>&nbsp;cairo_set_line_width(ct,1);</DIV>
<DIV>&nbsp;cairo_move_to(ct, 808, 384);<BR>&nbsp;cairo_line_to(ct, 1283, 384);<BR>&nbsp;cairo_line_to(ct, 1283, 576);<BR>&nbsp;cairo_line_to(ct, 808, 576);<BR>&nbsp;cairo_close_path(ct);</DIV>
<DIV>&nbsp;cairo_stroke(ct);<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>I ran the test application and tried to resize the window slowly so that the retangle can be cut-off.&nbsp;During the resizing,&nbsp;at some position the&nbsp;rendering&nbsp;showed this&nbsp;bug: it&nbsp;filled a huge polygon with the color that was set for the stroke and covered part of the rectangle. You can see this in the attachment.</DIV>
<DIV>&nbsp;</DIV>
<DIV>I guess this is a cairo dash line bug? Any idea is appreciated.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Here is the test application:</DIV>
<DIV>&nbsp;</DIV>
<DIV>#include "stdafx.h"<BR>#include &lt;cairo.h&gt;<BR>#include &lt;cairo-win32.h&gt;<BR>#include &lt;windowsx.h&gt;</DIV>
<DIV>HINSTANCE hInst;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// current instance<BR>ATOM&nbsp;&nbsp;&nbsp;&nbsp;MyRegisterClass(HINSTANCE hInstance);<BR>BOOL&nbsp;&nbsp;&nbsp;&nbsp;InitInstance(HINSTANCE, int);<BR>LRESULT CALLBACK&nbsp;WndProc(HWND, UINT, WPARAM, LPARAM);<BR>LRESULT CALLBACK&nbsp;About(HWND, UINT, WPARAM, LPARAM);</DIV>
<DIV>int APIENTRY _tWinMain(HINSTANCE hInstance,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HINSTANCE hPrevInstance,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LPTSTR&nbsp;&nbsp;&nbsp; lpCmdLine,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nCmdShow)<BR>{<BR>&nbsp;MSG msg;<BR>&nbsp;MyRegisterClass(hInstance);</DIV>
<DIV>&nbsp;if (!InitInstance (hInstance, nCmdShow)) <BR>&nbsp;{<BR>&nbsp;&nbsp;return FALSE;<BR>&nbsp;}</DIV>
<DIV>&nbsp;while (GetMessage(&amp;msg, NULL, 0, 0)) <BR>&nbsp;{<BR>&nbsp;&nbsp;TranslateMessage(&amp;msg);<BR>&nbsp;&nbsp;DispatchMessage(&amp;msg);<BR>&nbsp;}</DIV>
<DIV>&nbsp;return (int) msg.wParam;<BR>}</DIV>
<DIV>ATOM MyRegisterClass(HINSTANCE hInstance)<BR>{<BR>&nbsp;WNDCLASSEX wcex;</DIV>
<DIV>&nbsp;wcex.cbSize = sizeof(WNDCLASSEX); <BR>&nbsp;wcex.style&nbsp;&nbsp;&nbsp;= CS_HREDRAW | CS_VREDRAW;<BR>&nbsp;wcex.lpfnWndProc&nbsp;= (WNDPROC)WndProc;<BR>&nbsp;wcex.cbClsExtra&nbsp;&nbsp;= 0;<BR>&nbsp;wcex.cbWndExtra&nbsp;&nbsp;= 0;<BR>&nbsp;wcex.hInstance&nbsp;&nbsp;= hInstance;<BR>&nbsp;wcex.hIcon&nbsp;&nbsp;&nbsp;= 0;//LoadIcon(hInstance, (LPCTSTR)IDI_TESTVTUNE);<BR>&nbsp;wcex.hCursor&nbsp;&nbsp;= LoadCursor(NULL, IDC_ARROW);<BR>&nbsp;wcex.hbrBackground&nbsp;= (HBRUSH)(COLOR_WINDOW+1);<BR>&nbsp;wcex.lpszMenuName&nbsp;= 0;//(LPCTSTR)IDC_TESTVTUNE;<BR>&nbsp;wcex.lpszClassName&nbsp;= "Test cairo";//szWindowClass;<BR>&nbsp;wcex.hIconSm&nbsp;&nbsp;= 0;//LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);</DIV>
<DIV>&nbsp;return RegisterClassEx(&amp;wcex);<BR>}</DIV>
<DIV>BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)<BR>{<BR>&nbsp;&nbsp; HWND hWnd;</DIV>
<DIV>&nbsp;&nbsp; hInst = hInstance; // Store instance handle in our global variable</DIV>
<DIV>&nbsp;&nbsp; hWnd = CreateWindow("Test cairo", "test cairo", WS_OVERLAPPEDWINDOW,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);</DIV>
<DIV>&nbsp;&nbsp; if (!hWnd)<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return FALSE;<BR>&nbsp;&nbsp; }</DIV>
<DIV>&nbsp;&nbsp; ShowWindow(hWnd, nCmdShow);<BR>&nbsp;&nbsp; UpdateWindow(hWnd);</DIV>
<DIV>&nbsp;&nbsp; return TRUE;<BR>}</DIV>
<DIV>void TestBug(cairo_t *ct)<BR>{<BR>&nbsp;cairo_new_path(ct);&nbsp;</DIV>
<DIV>&nbsp;double dashes[] = {5.0 /*ink*/,1.0/*skip */};<BR>&nbsp;int&nbsp;&nbsp;&nbsp; ndash&nbsp; = sizeof (dashes)/sizeof(dashes[0]);<BR>&nbsp;double offset = 0;</DIV>
<DIV>&nbsp;cairo_set_dash (ct, dashes, ndash, offset);<BR>&nbsp;cairo_set_source_rgb(ct,0,1.0,0);</DIV>
<DIV>&nbsp;cairo_set_line_width(ct,1);</DIV>
<DIV>&nbsp;cairo_move_to(ct, 808, 384);<BR>&nbsp;cairo_line_to(ct, 1283, 384);<BR>&nbsp;cairo_line_to(ct, 1283, 576);<BR>&nbsp;cairo_line_to(ct, 808, 576);<BR>&nbsp;cairo_close_path(ct);</DIV>
<DIV>&nbsp;cairo_stroke(ct);<BR>}</DIV>
<DIV>LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)<BR>{<BR>&nbsp;int wmId, wmEvent;<BR>&nbsp;PAINTSTRUCT ps;<BR>&nbsp;HDC hdc;</DIV>
<DIV>&nbsp;switch (message) <BR>&nbsp;{<BR>&nbsp;case WM_COMMAND:<BR>&nbsp;&nbsp;wmId&nbsp;&nbsp;&nbsp; = LOWORD(wParam); <BR>&nbsp;&nbsp;wmEvent = HIWORD(wParam); <BR>&nbsp;&nbsp;// Parse the menu selections:<BR>&nbsp;&nbsp;switch (wmId)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;default:<BR>&nbsp;&nbsp;&nbsp;return DefWindowProc(hWnd, message, wParam, lParam);<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;break;<BR>&nbsp;case WM_PAINT:<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;hdc = BeginPaint(hWnd, &amp;ps);<BR>&nbsp;&nbsp;cairo_surface_t *surface = cairo_win32_surface_create(hdc);<BR>&nbsp;&nbsp;cairo_t *cr = cairo_create(surface);<BR>&nbsp;&nbsp;TestBug(cr);<BR>&nbsp;&nbsp;cairo_destroy(cr);<BR>&nbsp;&nbsp;cairo_surface_destroy(surface);<BR>&nbsp;&nbsp;EndPaint(hWnd, &amp;ps);<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;break;<BR>&nbsp;case WM_DESTROY:<BR>&nbsp;&nbsp;PostQuitMessage(0);<BR>&nbsp;&nbsp;break;<BR>&nbsp;default:<BR>&nbsp;&nbsp;return DefWindowProc(hWnd, message, wParam,
 lParam);<BR>&nbsp;}<BR>&nbsp;return 0;<BR>}<BR></DIV>
<DIV>Thanks in advance!!!</DIV>
<DIV>Nick Wu</DIV>
<DIV>&nbsp;</DIV></td></tr></table><br>