From dc807edcfbd9d62f89af061f848515865c49b4c8 Mon Sep 17 00:00:00 2001 From: Martin Hatina Date: Mon, 1 Aug 2016 10:37:44 +0200 Subject: [PATCH] Update to 0.2.8 --- .gitignore | 1 + 0001-Rotate-documents-correctly.patch | 151 -------------------------- libspectre.spec | 11 +- sources | 2 +- 4 files changed, 7 insertions(+), 158 deletions(-) delete mode 100644 0001-Rotate-documents-correctly.patch diff --git a/.gitignore b/.gitignore index f459ad3..18bdbdd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ libspectre-0.2.6.tar.gz /libspectre-0.2.7.tar.gz +/libspectre-0.2.8.tar.gz diff --git a/0001-Rotate-documents-correctly.patch b/0001-Rotate-documents-correctly.patch deleted file mode 100644 index f06026c..0000000 --- a/0001-Rotate-documents-correctly.patch +++ /dev/null @@ -1,151 +0,0 @@ -From adb610d22582f0598f6e5c699c08e7495767de28 Mon Sep 17 00:00:00 2001 -From: Marek Kasik -Date: Wed, 7 Jan 2015 18:35:16 +0100 -Subject: [PATCH] Rotate documents correctly - -Rotate result of rendering given by ghostscript. - -https://bugs.freedesktop.org/show_bug.cgi?id=76450 ---- - libspectre/spectre-device.c | 97 ++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 95 insertions(+), 2 deletions(-) - -diff --git a/libspectre/spectre-device.c b/libspectre/spectre-device.c -index a527d86..537f337 100644 ---- a/libspectre/spectre-device.c -+++ b/libspectre/spectre-device.c -@@ -99,7 +99,7 @@ spectre_sync (void *handle, void *device) - } - - static int --spectre_page (void *handle, void * device, int copies, int flush) -+spectre_page (void *handle, void *device, int copies, int flush) - { - SpectreDevice *sd; - -@@ -162,6 +162,33 @@ spectre_device_new (struct document *doc) - return device; - } - -+#define PIXEL_SIZE 4 -+#define ROW_ALIGN 32 -+ -+static void -+swap_pixels (unsigned char *data, -+ size_t pixel_a_start, -+ size_t pixel_b_start) -+{ -+ unsigned char value; -+ size_t i; -+ -+ for (i = 0; i < PIXEL_SIZE; i++) { -+ value = data[pixel_a_start + i]; -+ data[pixel_a_start + i] = data[pixel_b_start + i]; -+ data[pixel_b_start + i] = value; -+ } -+} -+ -+static void -+copy_pixel (unsigned char *dest, -+ unsigned char *src, -+ size_t dest_pixel_start, -+ size_t src_pixel_start) -+{ -+ memcpy (dest + dest_pixel_start, src + src_pixel_start, PIXEL_SIZE); -+} -+ - SpectreStatus - spectre_device_render (SpectreDevice *device, - unsigned int page, -@@ -185,6 +212,10 @@ spectre_device_render (SpectreDevice *device, - char *dsp_format, *dsp_handle; - char *width_points = NULL; - char *height_points = NULL; -+ unsigned char *user_image; -+ size_t stride, padding; -+ int i, j; -+ - - gs = spectre_gs_new (); - if (!gs) -@@ -277,7 +308,7 @@ spectre_device_render (SpectreDevice *device, - } - - set = _spectre_strdup_printf ("<< /Orientation %d >> setpagedevice .locksafe", -- rc->orientation); -+ SPECTRE_ORIENTATION_PORTRAIT); - if (!spectre_gs_send_string (gs, set)) { - free (set); - spectre_gs_free (gs); -@@ -293,6 +324,68 @@ spectre_device_render (SpectreDevice *device, - *page_data = device->user_image; - *row_length = device->row_length; - -+ switch (rc->orientation) -+ { -+ default: -+ case SPECTRE_ORIENTATION_PORTRAIT: -+ break; -+ case SPECTRE_ORIENTATION_REVERSE_PORTRAIT: -+ for (j = 0; j < height / 2; ++j) { -+ for (i = 0; i < width; ++i) { -+ swap_pixels (device->user_image, -+ device->row_length * j + PIXEL_SIZE * i, -+ device->row_length * (height - 1 - j) + PIXEL_SIZE * (width - 1 - i)); -+ } -+ } -+ if (height % 2 == 1) { -+ for (i = 0; i < width / 2; ++i) { -+ swap_pixels (device->user_image, -+ device->row_length * (height / 2) + PIXEL_SIZE * i, -+ device->row_length * (height - 1 - height / 2) + PIXEL_SIZE * (width - 1 - i)); -+ } -+ } -+ break; -+ case SPECTRE_ORIENTATION_LANDSCAPE: -+ case SPECTRE_ORIENTATION_REVERSE_LANDSCAPE: -+ if (height % ROW_ALIGN > 0) { -+ padding = (ROW_ALIGN - height % ROW_ALIGN) * PIXEL_SIZE; -+ stride = height * PIXEL_SIZE + padding; -+ user_image = malloc (width * stride); -+ -+ for (j = 0; j < width; ++j) -+ memset (user_image + j * stride + stride - padding, 0, padding); -+ } -+ else { -+ stride = height * PIXEL_SIZE; -+ user_image = malloc (width * stride); -+ } -+ -+ if (rc->orientation == SPECTRE_ORIENTATION_LANDSCAPE) { -+ for (j = 0; j < height; ++j) { -+ for (i = 0; i < width; ++i) { -+ copy_pixel (user_image, -+ device->user_image, -+ stride * i + PIXEL_SIZE * (height - 1 - j), -+ device->row_length * j + PIXEL_SIZE * i); -+ } -+ } -+ } else { -+ for (j = 0; j < height; ++j) { -+ for (i = 0; i < width; ++i) { -+ copy_pixel (user_image, -+ device->user_image, -+ stride * (width - 1 - i) + PIXEL_SIZE * j, -+ device->row_length * j + PIXEL_SIZE * i); -+ } -+ } -+ } -+ -+ free (device->user_image); -+ *page_data = user_image; -+ *row_length = stride; -+ break; -+ } -+ - spectre_gs_free (gs); - - return SPECTRE_STATUS_SUCCESS; --- -2.1.0 - diff --git a/libspectre.spec b/libspectre.spec index 15ba4ab..e8ed8bf 100644 --- a/libspectre.spec +++ b/libspectre.spec @@ -1,6 +1,6 @@ Name: libspectre -Version: 0.2.7 -Release: 8%{?dist} +Version: 0.2.8 +Release: 1%{?dist} Summary: A library for rendering PostScript(TM) documents Group: System Environment/Libraries @@ -8,8 +8,6 @@ License: GPLv2+ URL: http://libspectre.freedesktop.org Source0: http://libspectre.freedesktop.org/releases/%{name}-%{version}.tar.gz -Patch0: 0001-Rotate-documents-correctly.patch - BuildRequires: ghostscript-devel >= 8.61 %description @@ -32,8 +30,6 @@ developing applications that use %{name}. %prep %setup -q -%patch0 -p1 -b .rotation - %build %configure --disable-static @@ -68,6 +64,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Tue Jul 12 2016 Martin Hatina - 0.2.8-1 +- Update to 0.2.8 + * Thu Feb 04 2016 Fedora Release Engineering - 0.2.7-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild diff --git a/sources b/sources index 4de9ff3..7c4dd59 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -8f759c0e6cd88d68fc8149130fcbc3d3 libspectre-0.2.7.tar.gz +97ad2c8188db6bdc77fd742522b0bbdf libspectre-0.2.8.tar.gz