Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 920355 | Differences between
and this patch

Collapse All | Expand All

(-)a/qt5/src/CMakeLists.txt (+15 lines)
Lines 5-10 include_directories( Link Here
5
  ${CMAKE_CURRENT_BINARY_DIR}
5
  ${CMAKE_CURRENT_BINARY_DIR}
6
)
6
)
7
7
8
if (HAVE_CAIRO)
9
  include_directories(${CAIRO_INCLUDE_DIRS})
10
  add_definitions(${CAIRO_CFLAGS})
11
endif (HAVE_CAIRO)
12
8
set(CMAKE_C_VISIBILITY_PRESET hidden)
13
set(CMAKE_C_VISIBILITY_PRESET hidden)
9
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
14
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
10
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
15
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
Lines 36-41 set(poppler_qt5_SRCS Link Here
36
  QPainterOutputDev.cc
41
  QPainterOutputDev.cc
37
  poppler-version.cpp
42
  poppler-version.cpp
38
)
43
)
44
if (HAVE_CAIRO)
45
  set(poppler_qt5_SRCS ${poppler_qt5_SRCS}
46
    ${CMAKE_SOURCE_DIR}/poppler/CairoOutputDev.cc
47
    ${CMAKE_SOURCE_DIR}/poppler/CairoRescaleBox.cc
48
    ${CMAKE_SOURCE_DIR}/poppler/CairoFontEngine.cc
49
  )
50
endif(HAVE_CAIRO)
39
add_library(poppler-qt5 ${poppler_qt5_SRCS})
51
add_library(poppler-qt5 ${poppler_qt5_SRCS})
40
generate_export_header(poppler-qt5 BASE_NAME poppler-qt5 EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/poppler-export.h")
52
generate_export_header(poppler-qt5 BASE_NAME poppler-qt5 EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/poppler-export.h")
41
set_target_properties(poppler-qt5 PROPERTIES VERSION 1.32.0 SOVERSION 1)
53
set_target_properties(poppler-qt5 PROPERTIES VERSION 1.32.0 SOVERSION 1)
Lines 44-49 if(MINGW AND BUILD_SHARED_LIBS) Link Here
44
    set_target_properties(poppler-qt5 PROPERTIES SUFFIX "-${POPPLER_QT5_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
56
    set_target_properties(poppler-qt5 PROPERTIES SUFFIX "-${POPPLER_QT5_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
45
endif()
57
endif()
46
target_link_libraries(poppler-qt5 poppler Qt5::Core Qt5::Gui Qt5::Xml Freetype::Freetype)
58
target_link_libraries(poppler-qt5 poppler Qt5::Core Qt5::Gui Qt5::Xml Freetype::Freetype)
59
if (HAVE_CAIRO)
60
  target_link_libraries(poppler-qt5 ${CAIRO_LIBRARIES})
61
endif (HAVE_CAIRO)
47
if (ENABLE_NSS3)
62
if (ENABLE_NSS3)
48
    target_include_directories(poppler-qt5 SYSTEM PRIVATE ${NSS3_INCLUDE_DIRS})
63
    target_include_directories(poppler-qt5 SYSTEM PRIVATE ${NSS3_INCLUDE_DIRS})
49
endif()
64
endif()
(-)a/qt5/src/poppler-document.cc (+3 lines)
Lines 710-715 QSet<Document::RenderBackend> Document::availableRenderBackends() Link Here
710
    ret << Document::SplashBackend;
710
    ret << Document::SplashBackend;
711
    ret << Document::QPainterBackend;
711
    ret << Document::QPainterBackend;
712
    ret << Document::ArthurBackend; // For backward compatibility
712
    ret << Document::ArthurBackend; // For backward compatibility
713
#if defined(HAVE_CAIRO)
714
    ret << Document::CairoBackend;
715
#endif
713
    return ret;
716
    return ret;
714
}
717
}
715
718
(-)a/qt5/src/poppler-page.cc (+70 lines)
Lines 56-61 Link Here
56
#include <config.h>
56
#include <config.h>
57
#include <cfloat>
57
#include <cfloat>
58
#include <poppler-config.h>
58
#include <poppler-config.h>
59
#include <math.h>
59
#include <PDFDoc.h>
60
#include <PDFDoc.h>
60
#include <Catalog.h>
61
#include <Catalog.h>
61
#include <Form.h>
62
#include <Form.h>
Lines 67-72 Link Here
67
#include <Rendition.h>
68
#include <Rendition.h>
68
#include <SplashOutputDev.h>
69
#include <SplashOutputDev.h>
69
#include <splash/SplashBitmap.h>
70
#include <splash/SplashBitmap.h>
71
#if defined(HAVE_CAIRO)
72
#    include <CairoOutputDev.h>
73
#endif
70
74
71
#include "poppler-private.h"
75
#include "poppler-private.h"
72
#include "poppler-page-transition-private.h"
76
#include "poppler-page-transition-private.h"
Lines 597-602 QImage Page::renderToImage(double xres, double yres, int xPos, int yPos, int w, Link Here
597
        img = tmpimg;
601
        img = tmpimg;
598
        break;
602
        break;
599
    }
603
    }
604
    case Poppler::Document::CairoBackend: {
605
#if defined(HAVE_CAIRO)
606
        CairoOutputDev *output_dev = new CairoOutputDev();
607
        output_dev->startDoc(m_page->parentDoc->doc);
608
        int buffer_width, buffer_height, rotate;
609
        cairo_surface_t *surface;
610
        cairo_t *cairo;
611
612
        // If w or h are -1, that indicates the whole page, so we need to
613
        // calculate how many pixels that corresponds to.  Otherwise, we can use w
614
        // or h directly for our buffer size.
615
        const QSize pageSize = this->pageSize();
616
        if (w == -1) {
617
            const double xscale = xres / 72.0;
618
            const double width = pageSize.width();;
619
            buffer_width = (int) ceil(width * xscale);
620
        } else {
621
            buffer_width = w;
622
        }
623
        if (h == -1) {
624
            const double yscale = yres / 72.0;
625
            const double height = pageSize.height();
626
            buffer_height = (int) ceil(height * yscale);
627
        } else {
628
            buffer_height = h;
629
        }
630
631
        rotate = rotation + m_page->page->getRotate();
632
633
        // FIXME: Okular never provides a rotation value, so I don't have any way
634
        // of testing this right now.  The result is that subpixels are ordered
635
        // incorrectly when the page is rotated.
636
637
        //if (rotate == 90 || rotate == 270) {
638
        //    const double temp = height;
639
        //    height = width;
640
        //    width = temp;
641
        //}
642
643
        img = QImage(buffer_width, buffer_height, QImage::Format_ARGB32);
644
        img.fill(Qt::white);  // Never transparent
645
646
        surface = cairo_image_surface_create_for_data(
647
                      img.bits(),
648
                      CAIRO_FORMAT_ARGB32,
649
                      buffer_width, buffer_height,
650
                      img.bytesPerLine());
651
652
        cairo = cairo_create(surface);
653
        output_dev->setCairo(cairo);
654
655
        m_page->parentDoc->doc->displayPageSlice(
656
            output_dev, m_page->index + 1, xres, yres, rotation, false, true,
657
            false, xPos, yPos, w, h);
658
659
        // Clean up
660
        output_dev->setCairo(nullptr);
661
        cairo_destroy(cairo);
662
        cairo_surface_destroy(surface);
663
        delete output_dev;
664
#endif
665
        break;
666
    }
600
    }
667
    }
601
668
602
    if (shouldAbortRenderCallback && shouldAbortRenderCallback(payload)) {
669
    if (shouldAbortRenderCallback && shouldAbortRenderCallback(payload)) {
Lines 622-627 bool Page::renderToPainter(QPainter *painter, double xres, double yres, int x, i Link Here
622
689
623
        return renderToQPainter(&qpainter_output, painter, m_page, xres, yres, x, y, w, h, rotate, flags);
690
        return renderToQPainter(&qpainter_output, painter, m_page, xres, yres, x, y, w, h, rotate, flags);
624
    }
691
    }
692
    case Poppler::Document::CairoBackend: {
693
      return false;
694
    }
625
    }
695
    }
626
    return false;
696
    return false;
627
}
697
}
(-)a/qt5/src/poppler-qt5.h (-1 / +2 lines)
Lines 1182-1188 public: Link Here
1182
    {
1182
    {
1183
        SplashBackend, ///< Splash backend
1183
        SplashBackend, ///< Splash backend
1184
        ArthurBackend, ///< \deprecated The old name of the QPainter backend
1184
        ArthurBackend, ///< \deprecated The old name of the QPainter backend
1185
        QPainterBackend = ArthurBackend ///< @since 20.11
1185
        QPainterBackend = ArthurBackend, ///< @since 20.11
1186
        CairoBackend   ///< Cairo backend
1186
    };
1187
    };
1187
1188
1188
    /**
1189
    /**
(-)a/qt5/tests/CMakeLists.txt (-1 / +5 lines)
Lines 7-12 include_directories( Link Here
7
  ${CMAKE_CURRENT_BINARY_DIR}/../src
7
  ${CMAKE_CURRENT_BINARY_DIR}/../src
8
)
8
)
9
9
10
if (HAVE_CAIRO)
11
  include_directories(${CAIRO_INCLUDE_DIRS})
12
  add_definitions(${CAIRO_CFLAGS})
13
endif (HAVE_CAIRO)
14
10
macro(QT5_ADD_SIMPLETEST exe source)
15
macro(QT5_ADD_SIMPLETEST exe source)
11
  string(REPLACE "-" "" test_name ${exe})
16
  string(REPLACE "-" "" test_name ${exe})
12
  set(${test_name}_SOURCES
17
  set(${test_name}_SOURCES
13
- 

Return to bug 920355