gtkcssshadowvalue: Use cairo_surface_create_similar_image

Calling this on an Xlib surface allows us to keep this in SHM memory,
giving it a potential speedup so we don't have to copy it to SHM memory
for the Composite when we mask later.
This commit is contained in:
Jasper St. Pierre 2014-09-02 11:21:02 -07:00
parent 0acad84366
commit e6a0378289

View File

@ -331,9 +331,10 @@ gtk_css_shadow_value_start_drawing (const GtkCssValue *shadow,
clip_radius = _gtk_cairo_blur_compute_pixels (radius);
/* Create a larger surface to center the blur. */
surface = cairo_image_surface_create (CAIRO_FORMAT_A8,
clip_rect.width + 2 * clip_radius,
clip_rect.height + 2 * clip_radius);
surface = cairo_surface_create_similar_image (cairo_get_target (cr),
CAIRO_FORMAT_A8,
clip_rect.width + 2 * clip_radius,
clip_rect.height + 2 * clip_radius);
cairo_surface_set_device_offset (surface, clip_radius - clip_rect.x, clip_radius - clip_rect.y);
blur_cr = cairo_create (surface);
cairo_set_user_data (blur_cr, &shadow_key, cairo_reference (cr), (cairo_destroy_func_t) cairo_destroy);