<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Cairo 1.15.2: Crash in cairo_fill if target surface is created with cairo_win32_surface_create"
href="https://bugs.freedesktop.org/show_bug.cgi?id=96482">96482</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Cairo 1.15.2: Crash in cairo_fill if target surface is created with cairo_win32_surface_create
</td>
</tr>
<tr>
<th>Product</th>
<td>cairo
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>x86-64 (AMD64)
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows (All)
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>win32 backend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>cairo-bugs@cairographics.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>artwik@wp.pl
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>cairo-bugs@cairographics.org
</td>
</tr></table>
<p>
<div>
<pre>Environment: Cairo 1.15.2, Windows 7 x64.
When DC passed to cairo_win32_surface_create() has device origin (x or y
coordinate) > 0 (set with SetViewportOrgEx Win API) then there is raised an
"access violation" error when cairo_fill() is invoked.
If x and y coordinates of DC origin <= 0 then everything works fine.
You can find below a code snippet to reproduce the issue:
const int devX = 10;
const int devY = 0;
HDC hdc = ::CreateCompatibleDC(NULL);
HBITMAP hbmp = CreateCompatibleBitmap(hdc, 100, 100);
HGDIOBJ hObjPrev = ::SelectObject(hdc, hbmp);
::SetViewportOrgEx(hdc, devX, devY, NULL);
cairo_surface_t* surface = cairo_win32_surface_create(hdc);
cairo_t* context = cairo_create(surface);
cairo_rectangle(context, 0, 0, 90, 90);
cairo_set_source_rgba(context, 0, 1, 0, 0.5);
cairo_set_fill_rule(context, CAIRO_FILL_RULE_EVEN_ODD);
cairo_fill(context);
cairo_destroy(context);
cairo_surface_write_to_png(surface, "test.png");
cairo_surface_destroy(surface);
::SelectObject(hdc, hObjPrev);
::DeleteObject(hbmp);
::DeleteDC(hdc);</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>