~ubuntu-branches/ubuntu/quantal/librsvg/quantal

« back to all changes in this revision

Viewing changes to debian/patches/98_revert-abi-break.patch

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2012-01-24 15:26:18 UTC
  • mfrom: (1.1.30)
  • Revision ID: package-import@ubuntu.com-20120124152618-3casq466os1cz56e
Tags: 2.35.1-0ubuntu1
* New upstream release (LP: #920796)
* debian/patches/98_revert-abi-break.patch:
  Git patch to undo ABI break

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From ebd0d1a02aeeb57c64d8e0daf5f37ff4a35f116b Mon Sep 17 00:00:00 2001
 
2
From: Christian Persch <chpe@gnome.org>
 
3
Date: Thu, 12 Jan 2012 23:17:12 +0000
 
4
Subject: Fix an ABI compat problem
 
5
 
 
6
rsvg_cairo_to_pixbuf was removed in commit 95c359713a51b02a5e6693fd741dff20d08be7ae,
 
7
but it was exported. So let's add it back, to maintain ABI compatibility.
 
8
https://bugzilla.gnome.org/show_bug.cgi?id=666868
 
9
---
 
10
diff --git a/rsvg-cairo-draw.c b/rsvg-cairo-draw.c
 
11
index 0029a03..e435479 100644
 
12
--- a/rsvg-cairo-draw.c
 
13
+++ b/rsvg-cairo-draw.c
 
14
@@ -1113,3 +1113,34 @@ rsvg_cairo_surface_to_pixbuf (cairo_surface_t *surface)
 
15
 
 
16
     return dest;
 
17
 }
 
18
+
 
19
+/* This is unused but still exists for ABI compat. See bug #666868. */
 
20
+void rsvg_cairo_to_pixbuf (guint8 * pixels, int rowstride, int height);
 
21
+
 
22
+void
 
23
+rsvg_cairo_to_pixbuf (guint8 * pixels, int rowstride, int height)
 
24
+{
 
25
+    int row;
 
26
+    /* un-premultiply data */
 
27
+    for (row = 0; row < height; row++) {
 
28
+        guint8 *row_data = (pixels + (row * rowstride));
 
29
+        int i;
 
30
+
 
31
+        for (i = 0; i < rowstride; i += 4) {
 
32
+            guint8 *b = &row_data[i];
 
33
+            guint32 pixel;
 
34
+            guint8 alpha;
 
35
+
 
36
+            memcpy (&pixel, b, sizeof (guint32));
 
37
+            alpha = (pixel & 0xff000000) >> 24;
 
38
+            if (alpha == 0) {
 
39
+                b[0] = b[1] = b[2] = b[3] = 0;
 
40
+            } else {
 
41
+                b[0] = (((pixel & 0xff0000) >> 16) * 255 + alpha / 2) / alpha;
 
42
+                b[1] = (((pixel & 0x00ff00) >> 8) * 255 + alpha / 2) / alpha;
 
43
+                b[2] = (((pixel & 0x0000ff) >> 0) * 255 + alpha / 2) / alpha;
 
44
+                b[3] = alpha;
 
45
+            }
 
46
+        }
 
47
+    }
 
48
+}