diff options
Diffstat (limited to 'src-qt5/desktop-utils/lumina-pdf/Renderer-mupdf.cpp')
-rw-r--r-- | src-qt5/desktop-utils/lumina-pdf/Renderer-mupdf.cpp | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/src-qt5/desktop-utils/lumina-pdf/Renderer-mupdf.cpp b/src-qt5/desktop-utils/lumina-pdf/Renderer-mupdf.cpp index db255f02..c75a32bb 100644 --- a/src-qt5/desktop-utils/lumina-pdf/Renderer-mupdf.cpp +++ b/src-qt5/desktop-utils/lumina-pdf/Renderer-mupdf.cpp @@ -62,7 +62,7 @@ Renderer::Renderer(){ qDebug() << "Creating Context"; CTX = fz_new_context(NULL, &locks, FZ_STORE_UNLIMITED); needpass = false; - degrees = 0; + degrees = 0; } Renderer::~Renderer(){ @@ -137,7 +137,7 @@ bool Renderer::loadDocument(QString path, QString password){ void renderer(Data *data, Renderer *obj) { int pagenum = data->pagenumber; - //qDebug() << "Rendering:" << pagenum; + //qDebug() << "Rendering:" << pagenum; fz_context *ctx = data->ctx; fz_display_list *list = data->list; fz_rect bbox = data->bbox; @@ -155,45 +155,45 @@ void renderer(Data *data, Renderer *obj) fz_drop_context(ctx); - if(dataHash.find(pagenum) == dataHash.end()) - dataHash.insert(pagenum, data); - else - dataHash[pagenum] = data; + if(dataHash.find(pagenum) == dataHash.end()) + dataHash.insert(pagenum, data); + else + dataHash[pagenum] = data; emit obj->PageLoaded(pagenum); } //Consider rendering through a display list void Renderer::renderPage(int pagenum, QSize DPI, int degrees){ - qDebug() << "- Rendering Page:" << pagenum << degrees; - Data *data; - fz_matrix matrix; - fz_rect bbox; - fz_irect rbox; - fz_pixmap *pixmap; - fz_display_list *list; - - double pageDPI = 96.0; - double sf = DPI.width() / pageDPI; - fz_scale(&matrix, sf, sf); - fz_pre_rotate(&matrix, degrees); - - fz_page *PAGE = fz_load_page(CTX, DOC, pagenum); - fz_bound_page(CTX, PAGE, &bbox); - emit OrigSize(QSizeF(bbox.x1 - bbox.x0, bbox.y1 - bbox.y0)); - - fz_transform_rect(&bbox, &matrix); - list = fz_new_display_list(CTX, &bbox); - fz_device *dev = fz_new_list_device(CTX, list); - fz_run_page(CTX, PAGE, dev, &fz_identity, NULL); - - fz_close_device(CTX, dev); - fz_drop_device(CTX, dev); - fz_drop_page(CTX, PAGE); - - pixmap = fz_new_pixmap_with_bbox(CTX, fz_device_rgb(CTX), fz_round_rect(&rbox, &bbox), NULL, 0); - fz_clear_pixmap_with_value(CTX, pixmap, 0xff); - - data = new Data(pagenum, CTX, list, bbox, pixmap, matrix, sf); + //qDebug() << "- Rendering Page:" << pagenum << degrees; + Data *data; + fz_matrix matrix; + fz_rect bbox; + fz_irect rbox; + fz_pixmap *pixmap; + fz_display_list *list; + + double pageDPI = 96.0; + double sf = DPI.width() / pageDPI; + fz_scale(&matrix, sf, sf); + fz_pre_rotate(&matrix, degrees); + + fz_page *PAGE = fz_load_page(CTX, DOC, pagenum); + fz_bound_page(CTX, PAGE, &bbox); + emit OrigSize(QSizeF(bbox.x1 - bbox.x0, bbox.y1 - bbox.y0)); + + fz_transform_rect(&bbox, &matrix); + list = fz_new_display_list(CTX, &bbox); + fz_device *dev = fz_new_list_device(CTX, list); + fz_run_page(CTX, PAGE, dev, &fz_identity, NULL); + + fz_close_device(CTX, dev); + fz_drop_device(CTX, dev); + fz_drop_page(CTX, PAGE); + + pixmap = fz_new_pixmap_with_bbox(CTX, fz_device_rgb(CTX), fz_round_rect(&rbox, &bbox), NULL, 0); + fz_clear_pixmap_with_value(CTX, pixmap, 0xff); + + data = new Data(pagenum, CTX, list, bbox, pixmap, matrix, sf); data->renderThread = QtConcurrent::run(&renderer, data, this); } @@ -233,6 +233,6 @@ void Renderer::clearHash() { fz_drop_pixmap(CTX, dataHash[i]->pix); fz_drop_display_list(CTX, dataHash[i]->list); } - qDeleteAll(dataHash); - dataHash.clear(); + qDeleteAll(dataHash); + dataHash.clear(); } |