[librsvg: 5/7] rsvg_cairo_surface_from_pixbuf(): Removed



commit 27d019955df7a1409ea53407d158ebf558ca597a
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Oct 1 13:33:07 2018 -0500

    rsvg_cairo_surface_from_pixbuf(): Removed

 librsvg/rsvg-pixbuf.c  | 91 --------------------------------------------------
 librsvg/rsvg-private.h |  2 --
 2 files changed, 93 deletions(-)
---
diff --git a/librsvg/rsvg-pixbuf.c b/librsvg/rsvg-pixbuf.c
index 198a5642..bc42be04 100644
--- a/librsvg/rsvg-pixbuf.c
+++ b/librsvg/rsvg-pixbuf.c
@@ -260,97 +260,6 @@ rsvg_pixbuf_from_file_at_max_size (const gchar * file_name,
     return rsvg_pixbuf_from_file_with_size_data (file_name, &data, error);
 }
 
-cairo_surface_t *
-rsvg_cairo_surface_from_pixbuf (const GdkPixbuf *pixbuf)
-{
-    gint width, height, gdk_rowstride, n_channels, cairo_rowstride;
-    guchar *gdk_pixels, *cairo_pixels;
-    cairo_format_t format;
-    cairo_surface_t *surface;
-    int j;
-
-    if (pixbuf == NULL)
-        return NULL;
-
-    width = gdk_pixbuf_get_width (pixbuf);
-    height = gdk_pixbuf_get_height (pixbuf);
-    gdk_pixels = gdk_pixbuf_get_pixels (pixbuf);
-    gdk_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
-    n_channels = gdk_pixbuf_get_n_channels (pixbuf);
-
-    if (n_channels == 3)
-        format = CAIRO_FORMAT_RGB24;
-    else
-        format = CAIRO_FORMAT_ARGB32;
-
-    surface = cairo_image_surface_create (format, width, height);
-    if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS) {
-        cairo_surface_destroy (surface);
-        return NULL;
-    }
-
-    cairo_pixels = cairo_image_surface_get_data (surface);
-    cairo_rowstride = cairo_image_surface_get_stride (surface);
-
-    if (n_channels == 3) {
-        for (j = height; j; j--) {
-            guchar *p = gdk_pixels;
-            guchar *q = cairo_pixels;
-            guchar *end = p + 3 * width;
-
-            while (p < end) {
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-                q[0] = p[2];
-                q[1] = p[1];
-                q[2] = p[0];
-#else
-                q[1] = p[0];
-                q[2] = p[1];
-                q[3] = p[2];
-#endif
-                p += 3;
-                q += 4;
-            }
-
-            gdk_pixels += gdk_rowstride;
-            cairo_pixels += cairo_rowstride;
-        }
-    } else {
-        for (j = height; j; j--) {
-            guchar *p = gdk_pixels;
-            guchar *q = cairo_pixels;
-            guchar *end = p + 4 * width;
-            guint t1, t2, t3;
-
-#define MULT(d,c,a,t) G_STMT_START { t = c * a + 0x7f; d = ((t >> 8) + t) >> 8; } G_STMT_END
-
-            while (p < end) {
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-                MULT (q[0], p[2], p[3], t1);
-                MULT (q[1], p[1], p[3], t2);
-                MULT (q[2], p[0], p[3], t3);
-                q[3] = p[3];
-#else
-                q[0] = p[3];
-                MULT (q[1], p[0], p[3], t1);
-                MULT (q[2], p[1], p[3], t2);
-                MULT (q[3], p[2], p[3], t3);
-#endif
-
-                p += 4;
-                q += 4;
-            }
-
-#undef MULT
-            gdk_pixels += gdk_rowstride;
-            cairo_pixels += cairo_rowstride;
-        }
-    }
-
-    cairo_surface_mark_dirty (surface);
-    return surface;
-}
-
 /* Copied from gtk+/gdk/gdkpixbuf-drawable.c, LGPL 2+.
  *
  * Copyright (C) 1999 Michael Zucchi
diff --git a/librsvg/rsvg-private.h b/librsvg/rsvg-private.h
index a8bdb3f0..fdc46991 100644
--- a/librsvg/rsvg-private.h
+++ b/librsvg/rsvg-private.h
@@ -255,8 +255,6 @@ gboolean rsvg_cond_check_required_extensions (const char *value);
 G_GNUC_INTERNAL
 gboolean rsvg_cond_check_system_language (const char *value);
 
-G_GNUC_INTERNAL
-cairo_surface_t *rsvg_cairo_surface_from_pixbuf (const GdkPixbuf *pixbuf);
 G_GNUC_INTERNAL
 GdkPixbuf *rsvg_cairo_surface_to_pixbuf (cairo_surface_t *surface);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]