Bug 953334. Clear the clip on the surface when we get a new DC. r=BenWa

Currently we can think that we have a clip set on the DC when we actually
don't. Calling _cairo_win32_surface_set_clip_region(NULL) clears this so that
when we call it with the a region we will set it properly on the new DC that
doesn't have the clip set on it.

--HG--
extra : rebase_source : c9ca3d57bbd99aacdee5c0b3f581376792cd1893
This commit is contained in:
Jeff Muizelaar 2014-01-08 16:02:22 -05:00
parent 4f0de9f668
commit ef4ed3e70e
4 changed files with 60 additions and 5 deletions

View File

@ -502,6 +502,16 @@ _cairo_win32_surface_finish (void *abstract_surface)
return CAIRO_STATUS_SUCCESS;
}
static void
get_d3d9_dc_and_clear_clip (cairo_win32_surface_t *surface)
{
IDirect3DSurface9_GetDC (surface->d3d9surface, &surface->dc);
// The DC that we get back from the surface will not have
// a clip so clear surface->clip_region so that we don't think we have
// one when we don't.
_cairo_win32_surface_set_clip_region (surface, NULL);
}
static cairo_status_t
_cairo_win32_surface_d3d9_lock_rect (cairo_win32_surface_t *surface,
int x,
@ -521,7 +531,7 @@ _cairo_win32_surface_d3d9_lock_rect (cairo_win32_surface_t *surface,
&rectout, &rectin, 0);
surface->dc = 0; // Don't use the DC when this is locked!
if (hr) {
IDirect3DSurface9_GetDC (surface->d3d9surface, &surface->dc);
get_d3d9_dc_and_clear_clip (surface);
return CAIRO_INT_STATUS_UNSUPPORTED;
}
local = cairo_image_surface_create_for_data (rectout.pBits,
@ -530,12 +540,12 @@ _cairo_win32_surface_d3d9_lock_rect (cairo_win32_surface_t *surface,
rectout.Pitch);
if (local == NULL) {
IDirect3DSurface9_UnlockRect (surface->d3d9surface);
IDirect3DSurface9_GetDC (surface->d3d9surface, &surface->dc);
get_d3d9_dc_and_clear_clip (surface);
return CAIRO_INT_STATUS_UNSUPPORTED;
}
if (local->base.status) {
IDirect3DSurface9_UnlockRect (surface->d3d9surface);
IDirect3DSurface9_GetDC (surface->d3d9surface, &surface->dc);
get_d3d9_dc_and_clear_clip (surface);
return local->base.status;
}
@ -709,7 +719,7 @@ _cairo_win32_surface_release_source_image (void *abstract_surf
if (local && local->d3d9surface) {
IDirect3DSurface9_UnlockRect (local->d3d9surface);
IDirect3DSurface9_GetDC (local->d3d9surface, &local->dc);
get_d3d9_dc_and_clear_clip (surface);
cairo_surface_destroy ((cairo_surface_t *)image);
} else {
cairo_surface_destroy ((cairo_surface_t *)local);
@ -784,7 +794,7 @@ _cairo_win32_surface_release_dest_image (void *abstract_surfa
if (local->d3d9surface) {
IDirect3DSurface9_UnlockRect (local->d3d9surface);
IDirect3DSurface9_GetDC (local->d3d9surface, &local->dc);
get_d3d9_dc_and_clear_clip (surface);
cairo_surface_destroy ((cairo_surface_t *)image);
} else {

View File

@ -0,0 +1,22 @@
<style type="text/css">
#descdiv{
overflow: hidden;
height: 60px;
border: 1px solid red;
}
#descdiv p{
height:30px;
margin:0;
/* The shadow of the text will be inside the overflow-hidden but the text it self will not.
This causes the text to be drawn even when it's outside of the clip*/
text-shadow: #fff 1px -1px 2px;
}
</style>
<div id="descdiv">
<p class="um_desc">&nbsp;</p>
<p class="um_desc">&nbsp;</p>
<p class="um_desc">&nbsp;</p>
</div>

View File

@ -0,0 +1,22 @@
<style type="text/css">
#descdiv{
overflow: hidden;
height: 60px;
border: 1px solid red;
}
#descdiv p{
height:30px;
margin:0;
/* The shadow of the text will be inside the overflow-hidden but the text it self will not.
This causes the text to be drawn even when it's outside of the clip*/
text-shadow: #fff 1px -1px 2px;
}
</style>
<div id="descdiv">
<p class="um_desc">&nbsp;</p>
<p class="um_desc">&nbsp;</p>
<p class="um_desc">sed diam nonummy nibh</p>
</div>

View File

@ -1791,5 +1791,6 @@ fuzzy-if(OSX==10.6,2,30) == 933264-1.html 933264-1-ref.html
== 941940-1.html 941940-1-ref.html
== 942017.html 942017-ref.html
== 942672-1.html 942672-1-ref.html
== 953334-win32-clipping.html 953334-win32-clipping-ref.html
== 956513-1.svg 956513-1-ref.svg
== 944291-1.html 944291-1-ref.html