Accepting request 406684 from X11:common:Factory
1 OBS-URL: https://build.opensuse.org/request/show/406684 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libspectre?expand=0&rev=24
This commit is contained in:
commit
ba887e080c
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:e81b822a106beed14cf0fec70f1b890c690c2ffa150fa2eee41dc26518a6c3ec
|
|
||||||
size 387947
|
|
3
libspectre-0.2.8.tar.gz
Normal file
3
libspectre-0.2.8.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:65256af389823bbc4ee4d25bfd1cc19023ffc29ae9f9677f2d200fa6e98bc7a8
|
||||||
|
size 421791
|
@ -1,40 +0,0 @@
|
|||||||
Index: libspectre-0.2.7/libspectre/spectre-gs.c
|
|
||||||
===================================================================
|
|
||||||
--- libspectre-0.2.7.orig/libspectre/spectre-gs.c
|
|
||||||
+++ libspectre-0.2.7/libspectre/spectre-gs.c
|
|
||||||
@@ -43,12 +43,12 @@ critic_error_code (int code)
|
|
||||||
|
|
||||||
if (code <= -100) {
|
|
||||||
switch (code) {
|
|
||||||
- case e_Fatal:
|
|
||||||
+ case gs_error_Fatal:
|
|
||||||
fprintf (stderr, "fatal internal error %d", code);
|
|
||||||
return TRUE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
- case e_ExecStackUnderflow:
|
|
||||||
+ case gs_error_ExecStackUnderflow:
|
|
||||||
fprintf (stderr, "stack overflow %d", code);
|
|
||||||
return TRUE;
|
|
||||||
break;
|
|
||||||
@@ -109,9 +109,9 @@ spectre_gs_process (SpectreGS *gs,
|
|
||||||
set = _spectre_strdup_printf ("%d %d translate\n", -x, -y);
|
|
||||||
error = gsapi_run_string_continue (ghostscript_instance, set, strlen (set),
|
|
||||||
0, &exit_code);
|
|
||||||
- error = error == e_NeedInput ? 0 : error;
|
|
||||||
+ error = error == gs_error_NeedInput ? 0 : error;
|
|
||||||
free (set);
|
|
||||||
- if (error != e_NeedInput && critic_error_code (error)) {
|
|
||||||
+ if (error != gs_error_NeedInput && critic_error_code (error)) {
|
|
||||||
fclose (fd);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
@@ -126,7 +126,7 @@ spectre_gs_process (SpectreGS *gs,
|
|
||||||
read = fread (buf, sizeof (char), to_read, fd);
|
|
||||||
error = gsapi_run_string_continue (ghostscript_instance,
|
|
||||||
buf, read, 0, &exit_code);
|
|
||||||
- error = error == e_NeedInput ? 0 : error;
|
|
||||||
+ error = error == gs_error_NeedInput ? 0 : error;
|
|
||||||
left -= read;
|
|
||||||
}
|
|
||||||
|
|
@ -1,150 +0,0 @@
|
|||||||
From adb610d22582f0598f6e5c699c08e7495767de28 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Marek Kasik <mkasik@redhat.com>
|
|
||||||
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
|
|
@ -1,3 +1,19 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Jul 2 13:32:33 UTC 2016 - zaitor@opensuse.org
|
||||||
|
|
||||||
|
- Update to version to version 0.2.8:
|
||||||
|
+ Fixed the document rotation with newer versions of Ghostscript
|
||||||
|
(fdo#76450).
|
||||||
|
+ Build was also broken with Ghostscript >= 9.18 and has been
|
||||||
|
fixed.
|
||||||
|
+ Fixed a compile warning due to a comparison of integers of
|
||||||
|
different signs when building on OS X (fdo#56476).
|
||||||
|
+ Makefiles were updated to properly use CPPFLAGS instead of
|
||||||
|
CFLAGS (fdo#56481).
|
||||||
|
- Drop libspectre-gs-9.18.patch and
|
||||||
|
libspectre-rotate-documents-correctly.patch: Fixed upstream.
|
||||||
|
- Drop zypper BuildRequires: It was only needed for above patches.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sun Nov 8 06:46:01 UTC 2015 - badshah400@gmail.com
|
Sun Nov 8 06:46:01 UTC 2015 - badshah400@gmail.com
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package libspectre
|
# spec file for package libspectre
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
|
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -19,23 +19,16 @@
|
|||||||
Url: http://libspectre.freedesktop.org/
|
Url: http://libspectre.freedesktop.org/
|
||||||
|
|
||||||
Name: libspectre
|
Name: libspectre
|
||||||
Version: 0.2.7
|
Version: 0.2.8
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Library for Rendering PostScript Documents
|
Summary: Library for Rendering PostScript Documents
|
||||||
License: GPL-2.0+
|
License: GPL-2.0+
|
||||||
Group: Development/Libraries/C and C++
|
Group: Development/Libraries/C and C++
|
||||||
Source0: http://libspectre.freedesktop.org/releases/%{name}-%{version}.tar.gz
|
Source0: http://libspectre.freedesktop.org/releases/%{name}-%{version}.tar.gz
|
||||||
# PATCH-FIX-UPSTREAM libspectre-gs-9.18.patch boo#953149 dimstar@opensuse.org -- Fix build with Ghostscript 9.18: e_* is renamed to gs_error_*
|
|
||||||
Patch0: libspectre-gs-9.18.patch
|
|
||||||
%define debug_package_requires libspectre1 = %{version}-%{release}
|
%define debug_package_requires libspectre1 = %{version}-%{release}
|
||||||
# Need ghostscript-devel >= 9.18 due to libspectre-gs-9.18 patch
|
|
||||||
# PATCH-FIX-UPSTREAM libspectre-rotate-documents-correctly.patch fdo#76450 boo#898327 badshah400@gmail.com -- Fix documents not rotated correctly
|
|
||||||
Patch1: libspectre-rotate-documents-correctly.patch
|
|
||||||
BuildRequires: ghostscript-devel
|
BuildRequires: ghostscript-devel
|
||||||
BuildRequires: ghostscript-library
|
BuildRequires: ghostscript-library
|
||||||
BuildRequires: pkg-config
|
BuildRequires: pkg-config
|
||||||
# Zypper is just needed as a helper to properly compare versions, to decide if patch0 needs to be applied or not
|
|
||||||
BuildRequires: zypper
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -65,11 +58,6 @@ Postscript documents.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
# Apply the patch only for ghostscript >= 9.18
|
|
||||||
if zypper vcmp $(rpm -q --qf '%%{version}' ghostscript-devel) 9.18 | grep -e "\(newer\|matches\)"; then
|
|
||||||
%patch0 -p1
|
|
||||||
fi
|
|
||||||
%patch1 -p1
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%configure --disable-static --enable-shared
|
%configure --disable-static --enable-shared
|
||||||
|
Loading…
x
Reference in New Issue
Block a user