Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master grimoire by Pavel Vinogradov (db85f1edaeb12eef77570bd11cc6719be6b9e3a3)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Pavel Vinogradov <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master grimoire by Pavel Vinogradov (db85f1edaeb12eef77570bd11cc6719be6b9e3a3)
  • Date: Thu, 14 Dec 2017 06:38:33 +0000

GIT changes to master grimoire by Pavel Vinogradov <public AT sourcemage.org>:

doc/zathura-pdf-mupdf/0001-Fixed-for-MuPDF-1.12.0.patch | 160
++++++++++++++++
doc/zathura-pdf-mupdf/HISTORY | 4
doc/zathura-pdf-mupdf/PRE_BUILD | 2
3 files changed, 166 insertions(+)

New commits:
commit db85f1edaeb12eef77570bd11cc6719be6b9e3a3
Author: Pavel Vinogradov <public AT sourcemage.org>
Commit: Pavel Vinogradov <public AT sourcemage.org>

doc/zathura-pdf-mupdf: added a fix for MuPDF 1.12.0

diff --git a/doc/zathura-pdf-mupdf/0001-Fixed-for-MuPDF-1.12.0.patch
b/doc/zathura-pdf-mupdf/0001-Fixed-for-MuPDF-1.12.0.patch
new file mode 100644
index 0000000..4de241b
--- /dev/null
+++ b/doc/zathura-pdf-mupdf/0001-Fixed-for-MuPDF-1.12.0.patch
@@ -0,0 +1,160 @@
+From fd2890efb2580ba970d2c7ec90e0c4dd2e64f116 Mon Sep 17 00:00:00 2001
+From: Pavel Vinogradov <public AT sourcemage.org>
+Date: Thu, 14 Dec 2017 01:06:52 -0500
+Subject: [PATCH] Fixed for MuPDF 1.12.0
+
+---
+ image.c | 18 ++++++++----------
+ page.c | 9 ---------
+ plugin.h | 3 ++-
+ render.c | 4 +++-
+ select.c | 5 +++--
+ utils.c | 6 +++---
+ 6 files changed, 19 insertions(+), 26 deletions(-)
+
+diff --git a/image.c b/image.c
+index b938e5c..853fc84 100644
+--- a/image.c
++++ b/image.c
+@@ -43,18 +43,16 @@ pdf_page_images_get(zathura_page_t* page, mupdf_page_t*
mupdf_page, zathura_erro
+ /* Extract images */
+ mupdf_page_extract_text(mupdf_document, mupdf_page);
+
+- fz_page_block* block;
+- for (block = mupdf_page->text->blocks; block < mupdf_page->text->blocks +
mupdf_page->text->len; block++) {
+- if (block->type == FZ_PAGE_BLOCK_IMAGE) {
+- fz_image_block *image_block = block->u.image;
+-
++ fz_stext_block* block;
++ for (block = mupdf_page->text->first_block; block <
mupdf_page->text->last_block; block++) {
++ if (block->type == FZ_STEXT_BLOCK_IMAGE) {
+ zathura_image_t* zathura_image = g_malloc(sizeof(zathura_image_t));
+
+- zathura_image->position.x1 = image_block->bbox.x0;
+- zathura_image->position.y1 = image_block->bbox.y0;
+- zathura_image->position.x2 = image_block->bbox.x1;
+- zathura_image->position.y2 = image_block->bbox.y1;
+- zathura_image->data = image_block->image;
++ zathura_image->position.x1 = block->bbox.x0;
++ zathura_image->position.y1 = block->bbox.y0;
++ zathura_image->position.x2 = block->bbox.x1;
++ zathura_image->position.y2 = block->bbox.y1;
++ zathura_image->data = block->u.i.image;
+
+ girara_list_append(list, zathura_image);
+ }
+diff --git a/page.c b/page.c
+index 5302cb5..bb93e09 100644
+--- a/page.c
++++ b/page.c
+@@ -50,11 +50,6 @@ pdf_page_init(zathura_page_t* page)
+ goto error_free;
+ }
+
+- mupdf_page->sheet = fz_new_stext_sheet(mupdf_page->ctx);
+- if (mupdf_page->sheet == NULL) {
+- goto error_free;
+- }
+-
+ return ZATHURA_ERROR_OK;
+
+ error_free:
+@@ -79,10 +74,6 @@ pdf_page_clear(zathura_page_t* page, mupdf_page_t*
mupdf_page)
+ fz_drop_stext_page(mupdf_page->ctx, mupdf_page->text);
+ }
+
+- if (mupdf_page->sheet != NULL) {
+- fz_drop_stext_sheet(mupdf_page->ctx, mupdf_page->sheet);
+- }
+-
+ if (mupdf_page->page != NULL) {
+ fz_drop_page(mupdf_document->ctx, mupdf_page->page);
+ }
+diff --git a/plugin.h b/plugin.h
+index 84c5e53..e44778b 100644
+--- a/plugin.h
++++ b/plugin.h
+@@ -3,6 +3,8 @@
+ #ifndef PDF_H
+ #define PDF_H
+
++#include <stdlib.h>
++#include <string.h>
+ #include <stdbool.h>
+ #include <zathura/plugin-api.h>
+ #include <mupdf/fitz.h>
+@@ -21,7 +23,6 @@ typedef struct mupdf_page_s
+ {
+ fz_page* page; /**< Reference to the mupdf page */
+ fz_context* ctx; /**< Context */
+- fz_stext_sheet* sheet; /**< Text sheet */
+ fz_stext_page* text; /**< Page text */
+ fz_rect bbox; /**< Bbox */
+ bool extracted_text; /**< If text has already been extracted */
+diff --git a/render.c b/render.c
+index 00adb83..b2fb0f8 100644
+--- a/render.c
++++ b/render.c
+@@ -37,7 +37,8 @@ pdf_page_render_to_buffer(mupdf_document_t*
mupdf_document, mupdf_page_t* mupdf_
+ fz_rect rect = { .x1 = page_width, .y1 = page_height };
+
+ fz_colorspace* colorspace = fz_device_bgr(mupdf_document->ctx);
+- fz_pixmap* pixmap = fz_new_pixmap_with_bbox_and_data(mupdf_page->ctx,
colorspace, &irect, 1, image);
++ fz_separations* seps= fz_page_separations(mupdf_page->ctx,
mupdf_page->page);
++ fz_pixmap* pixmap = fz_new_pixmap_with_bbox_and_data(mupdf_page->ctx,
colorspace, &irect, seps, 1, image);
+ fz_clear_pixmap_with_value(mupdf_page->ctx, pixmap, 0xFF);
+
+ device = fz_new_draw_device(mupdf_page->ctx, NULL, pixmap);
+@@ -46,6 +47,7 @@ pdf_page_render_to_buffer(mupdf_document_t*
mupdf_document, mupdf_page_t* mupdf_
+
+ fz_drop_pixmap(mupdf_page->ctx, pixmap);
+ fz_drop_display_list(mupdf_page->ctx, display_list);
++ fz_drop_separations(mupdf_page->ctx, seps);
+
+ return ZATHURA_ERROR_OK;
+ }
+diff --git a/select.c b/select.c
+index c1e1437..fc5d1d8 100644
+--- a/select.c
++++ b/select.c
+@@ -24,9 +24,10 @@ pdf_page_get_text(zathura_page_t* page, mupdf_page_t*
mupdf_page, zathura_rectan
+ mupdf_page_extract_text(mupdf_document, mupdf_page);
+ }
+
+- fz_rect rect = { rectangle.x1, rectangle.y1, rectangle.x2, rectangle.y2 };
++ fz_point a = { rectangle.x1, rectangle.y1 };
++ fz_point b = { rectangle.x2, rectangle.y2 };
+
+- return fz_copy_selection(mupdf_page->ctx, mupdf_page->text, rect);
++ return fz_copy_selection(mupdf_page->ctx, mupdf_page->text, a, b, 0);
+
+ error_ret:
+
+diff --git a/utils.c b/utils.c
+index 5605783..28d519c 100644
+--- a/utils.c
++++ b/utils.c
+@@ -7,17 +7,17 @@
+ void
+ mupdf_page_extract_text(mupdf_document_t* mupdf_document, mupdf_page_t*
mupdf_page) {
+ if (mupdf_document == NULL || mupdf_document->ctx == NULL || mupdf_page
== NULL ||
+- mupdf_page->sheet == NULL || mupdf_page->text == NULL) {
++ mupdf_page->text == NULL) {
+ return;
+ }
+
+ fz_device* text_device = NULL;
+
+ fz_try (mupdf_page->ctx) {
+- text_device = fz_new_stext_device(mupdf_page->ctx, mupdf_page->sheet,
mupdf_page->text, NULL);
++ text_device = fz_new_stext_device(mupdf_page->ctx, mupdf_page->text,
NULL);
+
+ /* Disable FZ_IGNORE_IMAGE to collect image blocks */
+- fz_disable_device_hints(mupdf_page->ctx, text_device, FZ_IGNORE_IMAGE);
++ fz_disable_device_hints(mupdf_page->ctx, text_device,
FZ_DONT_INTERPOLATE_IMAGES);
+
+ fz_matrix ctm;
+ fz_scale(&ctm, 1.0, 1.0);
+--
+2.15.1
+
diff --git a/doc/zathura-pdf-mupdf/HISTORY b/doc/zathura-pdf-mupdf/HISTORY
index cb4a0a3..51a22e1 100644
--- a/doc/zathura-pdf-mupdf/HISTORY
+++ b/doc/zathura-pdf-mupdf/HISTORY
@@ -1,3 +1,7 @@
+2017-12-14 Pavel Vinogradov <public AT sourcemage.org>
+ * PRE_BUILD, 0001-Fixed-for-MuPDF-1.12.0.patch:
+ added a fix for MuPDF 1.12.0
+
2017-01-12 Vlad Glagolev <stealth AT sourcemage.org>
* DETAILS: updated spell to 0.3.1
* mupdf-1.9.patch: dropped, fixed by upstream
diff --git a/doc/zathura-pdf-mupdf/PRE_BUILD b/doc/zathura-pdf-mupdf/PRE_BUILD
index e463bce..38fa746 100755
--- a/doc/zathura-pdf-mupdf/PRE_BUILD
+++ b/doc/zathura-pdf-mupdf/PRE_BUILD
@@ -1,6 +1,8 @@
default_pre_build &&
cd "${SOURCE_DIRECTORY}" &&

+patch -p1 < "${SPELL_DIRECTORY}/0001-Fixed-for-MuPDF-1.12.0.patch" &&
+
if spell_ok openjpeg && is_version_less $(installed_version openjpeg) 2.0;
then
sedit "s:openjp2:openjpeg:" config.mk
fi &&



  • [SM-Commit] GIT changes to master grimoire by Pavel Vinogradov (db85f1edaeb12eef77570bd11cc6719be6b9e3a3), Pavel Vinogradov, 12/14/2017

Archive powered by MHonArc 2.6.24.

Top of Page