mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Issue #123: Blend2D painting implementation
This commit is contained in:
@ -21,13 +21,12 @@
|
||||
#include "pdfexecutionpolicy.h"
|
||||
#include "pdfprogress.h"
|
||||
#include "pdfannotation.h"
|
||||
#include "pdfblpainter.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QElapsedTimer>
|
||||
#include <QtMath>
|
||||
|
||||
#include <Blend2d.h>
|
||||
|
||||
#include "pdfdbgheap.h"
|
||||
|
||||
namespace pdf
|
||||
@ -250,26 +249,16 @@ QImage PDFRasterizer::render(PDFInteger pageIndex,
|
||||
|
||||
if (m_rendererEngine == RendererEngine::Blend2D)
|
||||
{
|
||||
BLContext blContext;
|
||||
BLImage blImage;
|
||||
PDFBLPaintDevice blPaintDevice(image, false);
|
||||
|
||||
blContext.setHint(BL_CONTEXT_HINT_RENDERING_QUALITY, BL_RENDERING_QUALITY_MAX_VALUE);
|
||||
QPainter painter(&blPaintDevice);
|
||||
compiledPage->draw(&painter, page->getCropBox(), matrix, features, 1.0);
|
||||
|
||||
blImage.createFromData(image.width(), image.height(), BL_FORMAT_PRGB32, image.bits(), image.bytesPerLine());
|
||||
if (blContext.begin(blImage) == BL_SUCCESS)
|
||||
if (annotationManager)
|
||||
{
|
||||
blContext.clearAll();
|
||||
|
||||
compiledPage->draw(blContext, page->getCropBox(), matrix, features, 1.0);
|
||||
|
||||
if (annotationManager)
|
||||
{
|
||||
QList<PDFRenderError> errors;
|
||||
PDFTextLayoutGetter textLayoutGetter(nullptr, pageIndex);
|
||||
annotationManager->drawPage(blContext, pageIndex, compiledPage, textLayoutGetter, matrix, errors);
|
||||
}
|
||||
|
||||
blContext.end();
|
||||
QList<PDFRenderError> errors;
|
||||
PDFTextLayoutGetter textLayoutGetter(nullptr, pageIndex);
|
||||
annotationManager->drawPage(&painter, pageIndex, compiledPage, textLayoutGetter, matrix, errors);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user