Merge pull request #439 from felixbuenemann/fix-minimum-required-poppler-version
Fix poppler version requirement, add loader check
This commit is contained in:
commit
8ed8515c49
@ -8,7 +8,7 @@ before_install:
|
||||
- sudo apt-get install libpng12-dev libwebp-dev libtiff4-dev libxml2-dev
|
||||
- sudo apt-get install swig libmagick++-dev bc
|
||||
- sudo apt-get install libcfitsio3-dev libgsl0-dev libmatio-dev
|
||||
- sudo apt-get install liborc-0.4-dev liblcms2-dev
|
||||
- sudo apt-get install liborc-0.4-dev liblcms2-dev libpoppler-glib-dev
|
||||
before_script:
|
||||
- ./bootstrap.sh
|
||||
- ./configure
|
||||
|
@ -563,12 +563,12 @@ AC_ARG_WITH([poppler],
|
||||
AS_HELP_STRING([--without-poppler], [build without poppler (default: test)]))
|
||||
|
||||
if test x"$with_poppler" != x"no"; then
|
||||
PKG_CHECK_MODULES(POPPLER, [poppler-glib >= 0.30.0 cairo >= 1.2],
|
||||
[AC_DEFINE(HAVE_POPPLER,1,[define if you have poppler-glib >= 0.30.0 and cairo >= 1.2 installed.])
|
||||
PKG_CHECK_MODULES(POPPLER, [poppler-glib >= 0.16.0 cairo >= 1.2],
|
||||
[AC_DEFINE(HAVE_POPPLER,1,[define if you have poppler-glib >= 0.16.0 and cairo >= 1.2 installed.])
|
||||
with_poppler=yes
|
||||
PACKAGES_USED="$PACKAGES_USED poppler-glib cairo"
|
||||
],
|
||||
[AC_MSG_WARN([poppler-glib >= 0.30.0 or cairo >= 1.2 not found; disabling PDF load via poppler])
|
||||
[AC_MSG_WARN([poppler-glib >= 0.16.0 or cairo >= 1.2 not found; disabling PDF load via poppler])
|
||||
with_poppler=no
|
||||
]
|
||||
)
|
||||
@ -968,7 +968,7 @@ file import with OpenSlide: $with_openslide
|
||||
(requires openslide-3.3.0 or later)
|
||||
file import with matio: $with_matio
|
||||
PDF import with poppler-glib: $with_poppler
|
||||
(requires poppler-glib 0.30.0 or later)
|
||||
(requires poppler-glib 0.16.0 or later)
|
||||
SVG import with librsvg-2.0: $with_rsvg
|
||||
(requires librsvg-2.0 2.40.0 or later)
|
||||
file import with cfitsio: $with_cfitsio
|
||||
|
@ -2,6 +2,7 @@ noinst_LTLIBRARIES = libforeign.la
|
||||
|
||||
libforeign_la_SOURCES = \
|
||||
gifload.c \
|
||||
cairo.c \
|
||||
pdfload.c \
|
||||
svgload.c \
|
||||
radiance.h \
|
||||
|
68
libvips/foreign/cairo.c
Normal file
68
libvips/foreign/cairo.c
Normal file
@ -0,0 +1,68 @@
|
||||
/* Shared code for cairo based loaders like svgload and pdfload.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
This file is part of VIPS.
|
||||
|
||||
VIPS is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
|
||||
#if defined(HAVE_RSVG) || defined(HAVE_POPPLER)
|
||||
|
||||
#include <vips/vips.h>
|
||||
#include <vips/internal.h>
|
||||
|
||||
/* Convert from ARGB to RGBA and undo premultiplication.
|
||||
*/
|
||||
void
|
||||
vips__cairo2rgba( guint32 * restrict buf, int n )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = 0; i < n; i++ ) {
|
||||
guint32 * restrict p = buf + i;
|
||||
guint32 x = *p;
|
||||
guint8 a = x >> 24;
|
||||
VipsPel * restrict out = (VipsPel *) p;
|
||||
|
||||
if( a == 255 )
|
||||
*p = GUINT32_TO_BE( (x << 8) | 255 );
|
||||
else if( a == 0 )
|
||||
*p = GUINT32_TO_BE( x << 8 );
|
||||
else {
|
||||
/* Undo premultiplication.
|
||||
*/
|
||||
out[0] = 255 * ((x >> 16) & 255) / a;
|
||||
out[1] = 255 * ((x >> 8) & 255) / a;
|
||||
out[2] = 255 * (x & 255) / a;
|
||||
out[3] = a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -149,34 +149,6 @@ vips_foreign_load_svg_header( VipsForeignLoad *load )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/* Convert from ARGB to RGBA and undo premultiplication.
|
||||
*/
|
||||
void
|
||||
vips__cairo2rgba( guint32 * restrict buf, int n )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = 0; i < n; i++ ) {
|
||||
guint32 * restrict p = buf + i;
|
||||
guint32 x = *p;
|
||||
guint8 a = x >> 24;
|
||||
VipsPel * restrict out = (VipsPel *) p;
|
||||
|
||||
if( a == 255 )
|
||||
*p = GUINT32_TO_BE( (x << 8) | 255 );
|
||||
else if( a == 0 )
|
||||
*p = GUINT32_TO_BE( x << 8 );
|
||||
else {
|
||||
/* Undo premultiplication.
|
||||
*/
|
||||
out[0] = 255 * ((x >> 16) & 255) / a;
|
||||
out[1] = 255 * ((x >> 8) & 255) / a;
|
||||
out[2] = 255 * (x & 255) / a;
|
||||
out[3] = a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
vips_foreign_load_svg_generate( VipsRegion *or,
|
||||
void *seq, void *a, void *b, gboolean *stop )
|
||||
|
37
test/images/blankpage.pdf
Executable file
37
test/images/blankpage.pdf
Executable file
@ -0,0 +1,37 @@
|
||||
%PDF-1.1
|
||||
%âãÏÓ
|
||||
1 0 obj
|
||||
<<
|
||||
/Pages 2 0 R
|
||||
/Type /Catalog
|
||||
>>
|
||||
endobj
|
||||
2 0 obj
|
||||
<<
|
||||
/MediaBox [0 0 595 842]
|
||||
/Kids [3 0 R]
|
||||
/Count 1
|
||||
/Type /Pages
|
||||
>>
|
||||
endobj
|
||||
3 0 obj
|
||||
<<
|
||||
/Parent 2 0 R
|
||||
/MediaBox [0 0 595 842]
|
||||
/Type /Page
|
||||
>>
|
||||
endobj xref
|
||||
0 4
|
||||
0000000000 65535 f
|
||||
0000000015 00000 n
|
||||
0000000066 00000 n
|
||||
0000000149 00000 n
|
||||
trailer
|
||||
|
||||
<<
|
||||
/Root 1 0 R
|
||||
/Size 4
|
||||
>>
|
||||
startxref
|
||||
221
|
||||
%%EOF
|
BIN
test/images/blankpage.png
Normal file
BIN
test/images/blankpage.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
@ -7,6 +7,10 @@
|
||||
|
||||
. ./variables.sh
|
||||
|
||||
# poppler / pdfload reference image
|
||||
poppler=$test_images/blankpage.pdf
|
||||
poppler_ref=$test_images/blankpage.png
|
||||
|
||||
# the matlab image and reference image
|
||||
matlab=$test_images/sample.mat
|
||||
matlab_ref=$test_images/sample.png
|
||||
@ -215,6 +219,10 @@ test_rad $rad
|
||||
test_raw $mono
|
||||
test_raw $image
|
||||
|
||||
if test_supported pdfload; then
|
||||
test_loader $poppler_ref $poppler pdfload
|
||||
fi
|
||||
|
||||
if test_supported matload; then
|
||||
test_loader $matlab_ref $matlab matlab
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user