From 4aab8e970bd99ff6eb5f92843eff1bac6998a7e8 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 12 Apr 2018 01:42:21 +0200 Subject: [PATCH] gdk: Remove gdk_surface_create_similar_image_surface() It's unused. --- docs/reference/gdk/gdk4-sections.txt | 1 - gdk/gdksurface.c | 89 ---------------------------- gdk/gdksurface.h | 7 --- gdk/gdksurfaceimpl.h | 5 -- gdk/wayland/gdksurface-wayland.c | 10 ---- 5 files changed, 112 deletions(-) diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt index af17b4c9e7..a6bcd8b82a 100644 --- a/docs/reference/gdk/gdk4-sections.txt +++ b/docs/reference/gdk/gdk4-sections.txt @@ -408,7 +408,6 @@ gdk_pango_layout_line_get_clip_region Cairo Interaction cairo_interaction gdk_surface_create_similar_surface -gdk_surface_create_similar_image_surface gdk_cairo_get_clip_rectangle gdk_cairo_set_source_rgba gdk_cairo_set_source_pixbuf diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c index 57dd82fab3..ed769e215e 100644 --- a/gdk/gdksurface.c +++ b/gdk/gdksurface.c @@ -4768,95 +4768,6 @@ gdk_surface_create_similar_surface (GdkSurface * surface, 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: - * - * |[ - * 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 diff --git a/gdk/gdksurface.h b/gdk/gdksurface.h index bed9bb04e3..e333608a99 100644 --- a/gdk/gdksurface.h +++ b/gdk/gdksurface.h @@ -725,13 +725,6 @@ cairo_surface_t * cairo_content_t content, int width, int height); -GDK_AVAILABLE_IN_ALL -cairo_surface_t * - gdk_surface_create_similar_image_surface (GdkSurface *surface, - cairo_format_t format, - int width, - int height, - int scale); GDK_AVAILABLE_IN_ALL void gdk_surface_beep (GdkSurface *surface); diff --git a/gdk/gdksurfaceimpl.h b/gdk/gdksurfaceimpl.h index 88d185bb9a..0e33f254a4 100644 --- a/gdk/gdksurfaceimpl.h +++ b/gdk/gdksurfaceimpl.h @@ -51,11 +51,6 @@ struct _GdkSurfaceImplClass cairo_surface_t * (* ref_cairo_surface) (GdkSurface *surface); - cairo_surface_t * - (* create_similar_image_surface) (GdkSurface * surface, - cairo_format_t format, - int width, - int height); void (* show) (GdkSurface *surface, gboolean already_mapped); diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index cfa8319178..28e4df2919 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -818,15 +818,6 @@ gdk_wayland_surface_ref_cairo_surface (GdkSurface *surface) 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) { @@ -3608,7 +3599,6 @@ _gdk_surface_impl_wayland_class_init (GdkSurfaceImplWaylandClass *klass) 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;