return similar_surface;
}
-
-/**
- * gdk_surface_create_similar_image_surface:
- * @surface: (nullable): surface to make new surface similar to, or
- * %NULL if none
- * @format: (type int): the format for the new surface
- * @width: width of the new surface
- * @height: height of the new surface
- * @scale: the scale of the new surface, or 0 to use same as @surface
- *
- * Create a new image surface that is efficient to draw on the
- * given @surface.
- *
- * Initially the surface contents are all 0 (transparent if contents
- * have transparency, black otherwise.)
- *
- * The @width and @height of the new surface are not affected by
- * the scaling factor of the @surface, or by the @scale argument; they
- * are the size of the surface in device pixels. If you wish to create
- * an image surface capable of holding the contents of @surface you can
- * use:
- *
- * |[<!-- language="C" -->
- * int scale = gdk_surface_get_scale_factor (surface);
- * int width = gdk_surface_get_width (surface) * scale;
- * int height = gdk_surface_get_height (surface) * scale;
- *
- * // format is set elsewhere
- * cairo_surface_t *surface =
- * gdk_surface_create_similar_image_surface (surface,
- * format,
- * width, height,
- * scale);
- * ]|
- *
- * Note that unlike cairo_surface_create_similar_image(), the new
- * surface's device scale is set to @scale, or to the scale factor of
- * @surface if @scale is 0.
- *
- * Returns: a pointer to the newly allocated surface. The caller
- * owns the surface and should call cairo_surface_destroy() when done
- * with it.
- *
- * This function always returns a valid pointer, but it will return a
- * pointer to a “nil” surface if @other is already in an error state
- * or any other error occurs.
- **/
-cairo_surface_t *
-gdk_surface_create_similar_image_surface (GdkSurface * surface,
- cairo_format_t format,
- int width,
- int height,
- int scale)
-{
- cairo_surface_t *cairo_surface;
-
- g_return_val_if_fail (surface == NULL || GDK_IS_SURFACE (surface), NULL);
-
- if (surface == NULL)
- {
- cairo_surface = cairo_image_surface_create (format, width, height);
- }
- else if (GDK_SURFACE_IMPL_GET_CLASS (surface->impl)->create_similar_image_surface)
- {
- cairo_surface =
- GDK_SURFACE_IMPL_GET_CLASS (surface->impl)->create_similar_image_surface (surface, format, width, height);
- }
- else
- {
- cairo_surface_t *window_surface;
-
- window_surface = gdk_surface_ref_impl_surface (surface);
- cairo_surface =
- cairo_surface_create_similar_image (window_surface,
- format,
- width,
- height);
- cairo_surface_destroy (window_surface);
- }
-
- if (scale == 0)
- scale = gdk_surface_get_scale_factor (surface);
-
- cairo_surface_set_device_scale (cairo_surface, scale, scale);
-
- return cairo_surface;
-}
-
-
/**
* gdk_surface_focus:
* @surface: a #GdkSurface
return impl->staging_cairo_surface;
}
-static cairo_surface_t *
-gdk_wayland_surface_create_similar_image_surface (GdkSurface * surface,
- cairo_format_t format,
- int width,
- int height)
-{
- return cairo_image_surface_create (format, width, height);
-}
-
static gboolean
gdk_surface_impl_wayland_begin_paint (GdkSurface *surface)
{
object_class->finalize = gdk_surface_impl_wayland_finalize;
impl_class->ref_cairo_surface = gdk_wayland_surface_ref_cairo_surface;
- impl_class->create_similar_image_surface = gdk_wayland_surface_create_similar_image_surface;
impl_class->show = gdk_wayland_surface_show;
impl_class->hide = gdk_wayland_surface_hide;
impl_class->withdraw = gdk_surface_wayland_withdraw;