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