Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Graphics
Okular
Commits
bcd36d63
Commit
bcd36d63
authored
Sep 13, 2020
by
Albert Astals Cid
Browse files
Remove poppler 0.63 ifdefs since we require 0.86 now
parent
c17127b0
Changes
3
Hide whitespace changes
Inline
Side-by-side
generators/poppler/CMakeLists.txt
View file @
bcd36d63
...
...
@@ -5,17 +5,6 @@ add_subdirectory( conf )
set
(
CMAKE_REQUIRED_LIBRARIES Poppler::Qt5 Qt5::Core Qt5::Gui
)
check_cxx_source_compiles
(
"
#include <poppler-qt5.h>
#include <QImage>
int main()
{
Poppler::Page *p = nullptr;
p->renderToImage(0, 0, 0, 0, 0, 0, Poppler::Page::Rotate0, nullptr, nullptr, nullptr, QVariant());
return 0;
}
"
HAVE_POPPLER_0_63
)
check_cxx_source_compiles
(
"
#include <poppler-qt5.h>
#include <poppler-form.h>
...
...
generators/poppler/config-okular-poppler.h.cmake
View file @
bcd36d63
/* Defined if we have the 0.63 version of the Poppler library */
#cmakedefine HAVE_POPPLER_0_63 1
/* Defined if we have the 0.64 version of the Poppler library */
#cmakedefine HAVE_POPPLER_0_64 1
...
...
generators/poppler/generator_pdf.cpp
View file @
bcd36d63
...
...
@@ -569,9 +569,7 @@ PDFGenerator::PDFGenerator(QObject *parent, const QVariantList &args)
setFeature
(
ReadRawData
);
setFeature
(
TiledRendering
);
setFeature
(
SwapBackingFile
);
#ifdef HAVE_POPPLER_0_63
setFeature
(
SupportsCancelling
);
#endif
// You only need to do it once not for each of the documents but it is cheap enough
// so doing it all the time won't hurt either
...
...
@@ -1066,13 +1064,11 @@ static void partialUpdateCallback(const QImage &image, const QVariant &vPayload)
// clang-format on
}
#ifdef HAVE_POPPLER_0_63
static
bool
shouldAbortRenderCallback
(
const
QVariant
&
vPayload
)
{
auto
payload
=
vPayload
.
value
<
RenderImagePayload
*>
();
return
payload
->
request
->
shouldAbortRender
();
}
#endif
QImage
PDFGenerator
::
image
(
Okular
::
PixmapRequest
*
request
)
{
...
...
@@ -1108,7 +1104,6 @@ QImage PDFGenerator::image(Okular::PixmapRequest *request)
// 2. Take data from outputdev and attach it to the Page
QImage
img
;
if
(
p
)
{
#ifdef HAVE_POPPLER_0_63
if
(
request
->
isTile
())
{
const
QRect
rect
=
request
->
normalizedRect
().
geometry
(
request
->
width
(),
request
->
height
());
if
(
request
->
partialUpdatesWanted
())
{
...
...
@@ -1128,24 +1123,6 @@ QImage PDFGenerator::image(Okular::PixmapRequest *request)
img
=
p
->
renderToImage
(
fakeDpiX
,
fakeDpiY
,
-
1
,
-
1
,
-
1
,
-
1
,
Poppler
::
Page
::
Rotate0
,
nullptr
,
nullptr
,
shouldAbortRenderCallback
,
QVariant
::
fromValue
(
&
payload
));
}
}
#else
if
(
request
->
isTile
())
{
const
QRect
rect
=
request
->
normalizedRect
().
geometry
(
request
->
width
(),
request
->
height
());
if
(
request
->
partialUpdatesWanted
())
{
RenderImagePayload
payload
(
this
,
request
);
img
=
p
->
renderToImage
(
fakeDpiX
,
fakeDpiY
,
rect
.
x
(),
rect
.
y
(),
rect
.
width
(),
rect
.
height
(),
Poppler
::
Page
::
Rotate0
,
partialUpdateCallback
,
shouldDoPartialUpdateCallback
,
QVariant
::
fromValue
(
&
payload
));
}
else
{
img
=
p
->
renderToImage
(
fakeDpiX
,
fakeDpiY
,
rect
.
x
(),
rect
.
y
(),
rect
.
width
(),
rect
.
height
(),
Poppler
::
Page
::
Rotate0
);
}
}
else
{
if
(
request
->
partialUpdatesWanted
())
{
RenderImagePayload
payload
(
this
,
request
);
img
=
p
->
renderToImage
(
fakeDpiX
,
fakeDpiY
,
-
1
,
-
1
,
-
1
,
-
1
,
Poppler
::
Page
::
Rotate0
,
partialUpdateCallback
,
shouldDoPartialUpdateCallback
,
QVariant
::
fromValue
(
&
payload
));
}
else
{
img
=
p
->
renderToImage
(
fakeDpiX
,
fakeDpiY
,
-
1
,
-
1
,
-
1
,
-
1
,
Poppler
::
Page
::
Rotate0
);
}
}
#endif
}
else
{
img
=
QImage
(
request
->
width
(),
request
->
height
(),
QImage
::
Format_Mono
);
img
.
fill
(
Qt
::
white
);
...
...
@@ -1231,7 +1208,6 @@ void PDFGenerator::resolveMediaLinkReferences(Okular::Page *page)
}
}
#ifdef HAVE_POPPLER_0_63
struct
TextExtractionPayload
{
TextExtractionPayload
(
Okular
::
TextRequest
*
r
)
:
request
(
r
)
...
...
@@ -1247,7 +1223,6 @@ static bool shouldAbortTextExtractionCallback(const QVariant &vPayload)
auto
payload
=
vPayload
.
value
<
TextExtractionPayload
*>
();
return
payload
->
request
->
shouldAbortExtraction
();
}
#endif
Okular
::
TextPage
*
PDFGenerator
::
textPage
(
Okular
::
TextRequest
*
request
)
{
...
...
@@ -1261,12 +1236,8 @@ Okular::TextPage *PDFGenerator::textPage(Okular::TextRequest *request)
userMutex
()
->
lock
();
Poppler
::
Page
*
pp
=
pdfdoc
->
page
(
page
->
number
());
if
(
pp
)
{
#ifdef HAVE_POPPLER_0_63
TextExtractionPayload
payload
(
request
);
textList
=
pp
->
textList
(
Poppler
::
Page
::
Rotate0
,
shouldAbortTextExtractionCallback
,
QVariant
::
fromValue
(
&
payload
));
#else
textList
=
pp
->
textList
();
#endif
const
QSizeF
s
=
pp
->
pageSizeF
();
pageWidth
=
s
.
width
();
pageHeight
=
s
.
height
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment