Sync with changes in the cairo device-scale handling

The version of device scale that landed in upstream cairo
master already inherits the device scale in cairo_create_similar,
so no need to do that in gtk anymore.
This commit is contained in:
Alexander Larsson
2013-09-05 19:30:23 +02:00
parent a13d5aefc3
commit 854f5818f8
2 changed files with 10 additions and 20 deletions

View File

@@ -9252,21 +9252,24 @@ gdk_window_create_similar_surface (GdkWindow * window,
cairo_surface_get_device_scale (window_surface, &sx, &sy);
#endif
width = width * sx;
height = height * sy;
switch (_gdk_rendering_mode)
{
case GDK_RENDERING_MODE_RECORDING:
{
cairo_rectangle_t rect = { 0, 0, width, height };
cairo_rectangle_t rect = { 0, 0, width * sx, height *sy };
surface = cairo_recording_surface_create (content, &rect);
#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
cairo_surface_set_device_scale (surface, sx, sy);
#endif
}
break;
case GDK_RENDERING_MODE_IMAGE:
surface = cairo_image_surface_create (content == CAIRO_CONTENT_COLOR ? CAIRO_FORMAT_RGB24 :
content == CAIRO_CONTENT_ALPHA ? CAIRO_FORMAT_A8 : CAIRO_FORMAT_ARGB32,
width, height);
width * sx, height * sy);
#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
cairo_surface_set_device_scale (surface, sx, sy);
#endif
break;
case GDK_RENDERING_MODE_SIMILAR:
default:
@@ -9276,9 +9279,6 @@ gdk_window_create_similar_surface (GdkWindow * window,
break;
}
#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
cairo_surface_set_device_scale (surface, sx, sy);
#endif
cairo_surface_destroy (window_surface);

View File

@@ -398,20 +398,10 @@ _gtk_css_image_get_surface (GtkCssImage *image,
if (target)
{
#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
cairo_surface_get_device_scale (target, &sx, &sy);
#else
sx = sy = 1;
#endif
result = cairo_surface_create_similar (target,
CAIRO_CONTENT_COLOR_ALPHA,
surface_width*sx,
surface_height*sy);
#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
cairo_surface_set_device_scale (result, sx, sy);
#endif
surface_width,
surface_height);
}
else
result = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,