mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-05-05 12:26:52 +02:00
main/epdfview: apply poppler color fix and rebuild against cups-1.6
This commit is contained in:
parent
cb3b943a4d
commit
2b46d7f7ae
@ -1,7 +1,7 @@
|
||||
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
|
||||
pkgname=epdfview
|
||||
pkgver=0.1.8
|
||||
pkgrel=4
|
||||
pkgrel=5
|
||||
pkgdesc="A free lightweight PDF document viewer."
|
||||
url="http://www.emma-soft.com/projects/epdfview/"
|
||||
arch="all"
|
||||
@ -12,6 +12,8 @@ subpackages="$pkgname-lang"
|
||||
source="http://www.emma-soft.com/projects/$pkgname/chrome/site/releases/$pkgname-$pkgver.tar.bz2
|
||||
$pkgname.desktop.patch
|
||||
epdfview-0.1.8-glib-2.31-build-fix.patch
|
||||
epdfview-0.1.8-swap-colors-with-poppler-0.18.patch
|
||||
epdfview-0.1.8-cups-1.6.patch
|
||||
"
|
||||
|
||||
_builddir="$srcdir"/$pkgname-$pkgver
|
||||
@ -56,4 +58,6 @@ package() {
|
||||
|
||||
md5sums="e50285b01612169b2594fea375f53ae4 epdfview-0.1.8.tar.bz2
|
||||
c87ed492dcf64a0b41476989c9282f8b epdfview.desktop.patch
|
||||
6e52b4bd6996530443eb4477c6f21e3f epdfview-0.1.8-glib-2.31-build-fix.patch"
|
||||
6e52b4bd6996530443eb4477c6f21e3f epdfview-0.1.8-glib-2.31-build-fix.patch
|
||||
c823d279a77a983fe29290c6db2e1881 epdfview-0.1.8-swap-colors-with-poppler-0.18.patch
|
||||
113bdf270dec17a7bd59ee990e7c0491 epdfview-0.1.8-cups-1.6.patch"
|
||||
|
||||
73
main/epdfview/epdfview-0.1.8-cups-1.6.patch
Normal file
73
main/epdfview/epdfview-0.1.8-cups-1.6.patch
Normal file
@ -0,0 +1,73 @@
|
||||
diff -Naur epdfview-0.1.8.orig/src/PrintPter.cxx epdfview-0.1.8/src/PrintPter.cxx
|
||||
--- epdfview-0.1.8.orig/src/PrintPter.cxx 2011-05-28 11:25:01.000000000 +0100
|
||||
+++ epdfview-0.1.8/src/PrintPter.cxx 2012-08-22 20:11:46.362436859 +0100
|
||||
@@ -22,6 +22,40 @@
|
||||
#include <locale.h>
|
||||
#include "epdfview.h"
|
||||
|
||||
+#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5)
|
||||
+#define HAVE_CUPS_1_6 1
|
||||
+#endif
|
||||
+
|
||||
+#ifndef HAVE_CUPS_1_6
|
||||
+inline int ippGetInteger (ipp_attribute_t *attr, int element)
|
||||
+{
|
||||
+ return (attr->values[element].integer);
|
||||
+}
|
||||
+
|
||||
+inline const char * ippGetString (ipp_attribute_t *attr,
|
||||
+ int element,
|
||||
+ const char **language /*UNUSED*/)
|
||||
+{
|
||||
+ return (attr->values[element].string.text);
|
||||
+}
|
||||
+
|
||||
+inline int ippSetOperation (ipp_t *ipp, ipp_op_t op)
|
||||
+{
|
||||
+ if (!ipp)
|
||||
+ return (0);
|
||||
+ ipp->request.op.operation_id = op;
|
||||
+ return (1);
|
||||
+}
|
||||
+
|
||||
+inline int ippSetRequestId (ipp_t *ipp, int request_id)
|
||||
+{
|
||||
+ if (!ipp)
|
||||
+ return (0);
|
||||
+ ipp->request.any.request_id = request_id;
|
||||
+ return (1);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
using namespace ePDFView;
|
||||
|
||||
// Structures
|
||||
@@ -380,8 +414,8 @@
|
||||
|
||||
ipp_t *request = ippNew ();
|
||||
|
||||
- request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
|
||||
- request->request.op.request_id = 1;
|
||||
+ ippSetOperation(request, IPP_GET_PRINTER_ATTRIBUTES);
|
||||
+ ippSetRequestId(request, 1);
|
||||
|
||||
ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
|
||||
"attributes-charset", NULL, "utf-8");
|
||||
@@ -403,7 +437,7 @@
|
||||
ippFindAttribute (answer, "printer-state", IPP_TAG_ZERO);
|
||||
if ( NULL != state )
|
||||
{
|
||||
- switch (state->values[0].integer)
|
||||
+ switch (ippGetInteger (state, 0))
|
||||
{
|
||||
case IPP_PRINTER_IDLE:
|
||||
attributes->state = g_strdup (_("Idle"));
|
||||
@@ -425,7 +459,7 @@
|
||||
ippFindAttribute (answer, "printer-location", IPP_TAG_ZERO);
|
||||
if ( NULL != location )
|
||||
{
|
||||
- attributes->location = g_strdup (location->values[0].string.text);
|
||||
+ attributes->location = g_strdup (ippGetString (location, 0, NULL));
|
||||
}
|
||||
|
||||
ippDelete (answer);
|
||||
@ -0,0 +1,50 @@
|
||||
Swap color channels to fix pictures with poppler 0.18
|
||||
|
||||
Upstream: http://trac.emma-soft.com/epdfview/changeset/367/trunk
|
||||
Fixes bug: https://bugzilla.redhat.com/show_bug.cgi?id=745483
|
||||
|
||||
Index: src/PDFDocument.cxx
|
||||
===================================================================
|
||||
--- ./src/PDFDocument.cxx (revision 366)
|
||||
+++ ./src/PDFDocument.cxx (revision 367)
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <time.h>
|
||||
#include <poppler.h>
|
||||
#include <unistd.h>
|
||||
+#include <algorithm>
|
||||
#include "epdfview.h"
|
||||
|
||||
using namespace ePDFView;
|
||||
@@ -33,6 +34,24 @@
|
||||
static PageMode convertPageMode (gint pageMode);
|
||||
static gchar *getAbsoluteFileName (const gchar *fileName);
|
||||
|
||||
+namespace
|
||||
+{
|
||||
+ void
|
||||
+ convert_bgra_to_rgba (guint8 *data, int width, int height)
|
||||
+ {
|
||||
+ using std::swap;
|
||||
+
|
||||
+ for (int y = 0; y < height; y++)
|
||||
+ {
|
||||
+ for (int x = 0; x < width; x++)
|
||||
+ {
|
||||
+ swap(data[0], data[2]);
|
||||
+ data += 4;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
///
|
||||
/// @brief Constructs a new PDFDocument object.
|
||||
///
|
||||
@@ -650,6 +669,7 @@
|
||||
poppler_page_render (page, context);
|
||||
cairo_destroy(context);
|
||||
cairo_surface_destroy (surface);
|
||||
+ convert_bgra_to_rgba(renderedPage->getData (), width, height);
|
||||
#else // !HAVE_POPPLER_0_17_0
|
||||
// Create the pixbuf from the data and render to it.
|
||||
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_data (renderedPage->getData (),
|
||||
Loading…
x
Reference in New Issue
Block a user