pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/print/zathura-pdf-mupdf Adapt to MuPDF 1.10 API changes.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/dd3d82fc9ae6
branches:  trunk
changeset: 355336:dd3d82fc9ae6
user:      leot <leot%pkgsrc.org@localhost>
date:      Mon Nov 28 14:41:40 2016 +0000

description:
Adapt to MuPDF 1.10 API changes.

Bump PKGREVISION.

diffstat:

 print/zathura-pdf-mupdf/Makefile                 |    4 +-
 print/zathura-pdf-mupdf/distinfo                 |   17 ++-
 print/zathura-pdf-mupdf/patches/patch-document.c |   13 +-
 print/zathura-pdf-mupdf/patches/patch-image.c    |    6 +-
 print/zathura-pdf-mupdf/patches/patch-index.c    |  106 +++++++++++++++++++++++
 print/zathura-pdf-mupdf/patches/patch-links.c    |   67 ++++++++++++++
 print/zathura-pdf-mupdf/patches/patch-page.c     |   11 +-
 print/zathura-pdf-mupdf/patches/patch-plugin.h   |    4 +-
 print/zathura-pdf-mupdf/patches/patch-render.c   |   35 +++++++
 print/zathura-pdf-mupdf/patches/patch-search.c   |    4 +-
 print/zathura-pdf-mupdf/patches/patch-utils.c    |   14 ++-
 11 files changed, 252 insertions(+), 29 deletions(-)

diffs (truncated from 399 to 300 lines):

diff -r e1ff41091e8f -r dd3d82fc9ae6 print/zathura-pdf-mupdf/Makefile
--- a/print/zathura-pdf-mupdf/Makefile  Mon Nov 28 14:40:42 2016 +0000
+++ b/print/zathura-pdf-mupdf/Makefile  Mon Nov 28 14:41:40 2016 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.7 2016/10/07 18:26:09 adam Exp $
+# $NetBSD: Makefile,v 1.8 2016/11/28 14:41:40 leot Exp $
 #
 
 DISTNAME=      zathura-pdf-mupdf-0.3.0
-PKGREVISION=   4
+PKGREVISION=   5
 CATEGORIES=    print
 MASTER_SITES=  http://pwmt.org/projects/zathura/plugins/download/
 
diff -r e1ff41091e8f -r dd3d82fc9ae6 print/zathura-pdf-mupdf/distinfo
--- a/print/zathura-pdf-mupdf/distinfo  Mon Nov 28 14:40:42 2016 +0000
+++ b/print/zathura-pdf-mupdf/distinfo  Mon Nov 28 14:41:40 2016 +0000
@@ -1,12 +1,15 @@
-$NetBSD: distinfo,v 1.3 2016/04/27 12:38:45 leot Exp $
+$NetBSD: distinfo,v 1.4 2016/11/28 14:41:40 leot Exp $
 
 SHA1 (zathura-pdf-mupdf-0.3.0.tar.gz) = ae0be41ea7c75b8ddc083fe01f1366673ea9751a
 RMD160 (zathura-pdf-mupdf-0.3.0.tar.gz) = 377e7848a5ea7f43f020e131aacc24c51453bf8f
 SHA512 (zathura-pdf-mupdf-0.3.0.tar.gz) = c83eef453176c6317be338260e311c39e049b8ae1ae719445c6303725b4e993758ed3f3a61f0af31032d09f1f2f03574f862d24e36b27fa38732e0b6c7aa18ea
 Size (zathura-pdf-mupdf-0.3.0.tar.gz) = 9914 bytes
-SHA1 (patch-document.c) = a891f161ae4af2d5b3cb3b46b3c7f010fee2ee9c
-SHA1 (patch-image.c) = 1b4c178832aca195d5d1ccacd283dc52fa4d823e
-SHA1 (patch-page.c) = d60e89e0ef2c98b20d9ca02ae8cb68a2c434c8e8
-SHA1 (patch-plugin.h) = 4ec3e1510938f4bf7c10194ee7702666b1e18eb9
-SHA1 (patch-search.c) = 312d29bd2463df3bbbe4410f5f5fad07f9f04b93
-SHA1 (patch-utils.c) = 38d6717abad516ff007a7eb4f6f6d1d263385b4f
+SHA1 (patch-document.c) = ed5a34515767482b83c9cb3f3a20d1c492a80307
+SHA1 (patch-image.c) = 15e60ede84c3b9a5f4d9b927bb5572c78a4409c3
+SHA1 (patch-index.c) = 8ec60bb5965abbc9d91be63305bf6b5a5244b30c
+SHA1 (patch-links.c) = 9e133625f5c45a9dd490d15bd19ae3529999a990
+SHA1 (patch-page.c) = bc3bd7325f4005986182949c5e66b1ee3040431b
+SHA1 (patch-plugin.h) = 8b12c096d265b397ae9f3a8aee7057a23dea3def
+SHA1 (patch-render.c) = c65ec3d6e9622149d987798b69c680c886b7f970
+SHA1 (patch-search.c) = 1cbed6cc8a8cf672e6330bd2e91e0976f90bc352
+SHA1 (patch-utils.c) = 914ca7ea673be3bcb1a76661762ac7e343f57264
diff -r e1ff41091e8f -r dd3d82fc9ae6 print/zathura-pdf-mupdf/patches/patch-document.c
--- a/print/zathura-pdf-mupdf/patches/patch-document.c  Mon Nov 28 14:40:42 2016 +0000
+++ b/print/zathura-pdf-mupdf/patches/patch-document.c  Mon Nov 28 14:41:40 2016 +0000
@@ -1,12 +1,15 @@
-$NetBSD: patch-document.c,v 1.2 2016/04/27 12:38:45 leot Exp $
+$NetBSD: patch-document.c,v 1.3 2016/11/28 14:41:40 leot Exp $
 
 o Correct the glib-2.0 include header file path.
-o Update to mupdf-1.9 API
+o Update to mupdf-1.10 API
 
 --- document.c.orig    2016-02-14 22:49:46.000000000 +0000
 +++ document.c
-@@ -6,7 +6,7 @@
- #include <mupdf/xps.h>
+@@ -3,10 +3,9 @@
+ #define _POSIX_C_SOURCE 1
+ 
+ #include <mupdf/fitz.h>
+-#include <mupdf/xps.h>
  #include <mupdf/pdf.h>
  
 -#include <glib-2.0/glib.h>
@@ -14,7 +17,7 @@
  
  #include "plugin.h"
  
-@@ -109,12 +109,7 @@ pdf_document_save_as(zathura_document_t*
+@@ -109,12 +108,7 @@ pdf_document_save_as(zathura_document_t*
    }
  
    fz_try (mupdf_document->ctx) {
diff -r e1ff41091e8f -r dd3d82fc9ae6 print/zathura-pdf-mupdf/patches/patch-image.c
--- a/print/zathura-pdf-mupdf/patches/patch-image.c     Mon Nov 28 14:40:42 2016 +0000
+++ b/print/zathura-pdf-mupdf/patches/patch-image.c     Mon Nov 28 14:41:40 2016 +0000
@@ -1,6 +1,6 @@
-$NetBSD: patch-image.c,v 1.1 2016/04/27 12:38:45 leot Exp $
+$NetBSD: patch-image.c,v 1.2 2016/11/28 14:41:40 leot Exp $
 
-Update to mupdf-1.9 API.
+Update to mupdf-1.10 API.
 
 --- image.c.orig       2016-02-14 22:49:46.000000000 +0000
 +++ image.c
@@ -9,7 +9,7 @@
    cairo_surface_t* surface = NULL;
  
 -  pixmap = fz_new_pixmap_from_image(mupdf_page->ctx, mupdf_image, 0, 0);
-+  pixmap = fz_get_pixmap_from_image(mupdf_page->ctx, mupdf_image, 0, 0);
++  pixmap = fz_get_pixmap_from_image(mupdf_page->ctx, mupdf_image, NULL, NULL, NULL, NULL);
    if (pixmap == NULL) {
      goto error_free;
    }
diff -r e1ff41091e8f -r dd3d82fc9ae6 print/zathura-pdf-mupdf/patches/patch-index.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/print/zathura-pdf-mupdf/patches/patch-index.c     Mon Nov 28 14:41:40 2016 +0000
@@ -0,0 +1,106 @@
+$NetBSD: patch-index.c,v 1.1 2016/11/28 14:41:40 leot Exp $
+
+Update to mupdf-1.10 API.
+
+--- index.c.orig       2016-02-14 22:49:46.000000000 +0000
++++ index.c
+@@ -6,7 +6,7 @@
+ 
+ #include "plugin.h"
+ 
+-static void build_index(fz_outline* outline, girara_tree_node_t* root);
++static void build_index(mupdf_document_t* mupdf_document, fz_outline* outline, girara_tree_node_t* root);
+ 
+ girara_tree_node_t*
+ pdf_document_index_generate(zathura_document_t* document, mupdf_document_t* mupdf_document, zathura_error_t* error)
+@@ -29,7 +29,7 @@ pdf_document_index_generate(zathura_docu
+ 
+   /* generate index */
+   girara_tree_node_t* root = girara_node_new(zathura_index_element_new("ROOT"));
+-  build_index(outline, root);
++  build_index(mupdf_document, outline, root);
+ 
+   /* free outline */
+   fz_drop_outline(mupdf_document->ctx, outline);
+@@ -38,7 +38,7 @@ pdf_document_index_generate(zathura_docu
+ }
+ 
+ static void
+-build_index(fz_outline* outline, girara_tree_node_t* root)
++build_index(mupdf_document_t* mupdf_document, fz_outline* outline, girara_tree_node_t* root)
+ {
+   if (outline == NULL || root == NULL) {
+     return;
+@@ -50,49 +50,24 @@ build_index(fz_outline* outline, girara_
+     zathura_link_type_t type               = ZATHURA_LINK_INVALID;
+     zathura_rectangle_t rect               = { .x1 = 0, .y1 = 0, .x2 = 0, .y2 = 0 };
+ 
+-    switch (outline->dest.kind) {
+-      case FZ_LINK_NONE:
+-        type = ZATHURA_LINK_NONE;
+-        break;
+-      case FZ_LINK_URI:
++    if (fz_is_external_link(mupdf_document->ctx, outline->uri)) {
+         type         = ZATHURA_LINK_URI;
+-        target.value = outline->dest.ld.uri.uri;
+-        break;
+-      case FZ_LINK_GOTO:
++        target.value = outline->uri;
++    } else if (outline->uri) {
++        float tx, ty;
++        tx                      = 0.0;
++        ty                      = 0.0;
+         type                    = ZATHURA_LINK_GOTO_DEST;
+-        target.page_number      = outline->dest.ld.gotor.page;
++        target.page_number      = 0;
+         target.destination_type = ZATHURA_LINK_DESTINATION_XYZ;
+-        target.left             = 0;
+-        target.top              = 0;
++        target.left             = 0.0;
++        target.top              = 0.0;
+         target.scale            = 0.0;
+-        {
+-          int gflags = outline->dest.ld.gotor.flags;
+-          if (gflags & fz_link_flag_l_valid) {
+-            target.left = outline->dest.ld.gotor.lt.x;
+-          }
+-          if (gflags & fz_link_flag_t_valid) {
+-            target.top = outline->dest.ld.gotor.lt.y;
+-          }
+-          /* if (gflags & fz_link_flag_r_is_zoom) { */
+-          /*   target.scale = outline->dest.ld.gotor.rb.x; */
+-          /* } */
+-        }
+-        break;
+-      case FZ_LINK_LAUNCH:
+-        type = ZATHURA_LINK_LAUNCH;
+-        target.value = outline->dest.ld.launch.file_spec;
+-        break;
+-      case FZ_LINK_NAMED:
+-        type = ZATHURA_LINK_NAMED;
+-        target.value = outline->dest.ld.named.named;
+-        break;
+-      case FZ_LINK_GOTOR:
+-        type = ZATHURA_LINK_GOTO_REMOTE;
+-        target.value = outline->dest.ld.gotor.file_spec;
+-        break;
+-      default:
+-        outline = outline->next; // TODO: Don't skip unknown type
+-        continue;
++      target.page_number = fz_resolve_link(mupdf_document->ctx, mupdf_document->document, outline->uri, &tx, &ty);
++        target.left             = tx;
++        target.top              = ty;
++    } else {
++        type = ZATHURA_LINK_NONE;
+     }
+ 
+     index_element->link = zathura_link_new(type, rect, target);
+@@ -104,7 +79,7 @@ build_index(fz_outline* outline, girara_
+     girara_tree_node_t* node = girara_node_append_data(root, index_element);
+ 
+     if (outline->down != NULL) {
+-      build_index(outline->down, node);
++      build_index(mupdf_document, outline->down, node);
+     }
+ 
+     outline = outline->next;
diff -r e1ff41091e8f -r dd3d82fc9ae6 print/zathura-pdf-mupdf/patches/patch-links.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/print/zathura-pdf-mupdf/patches/patch-links.c     Mon Nov 28 14:41:40 2016 +0000
@@ -0,0 +1,67 @@
+$NetBSD: patch-links.c,v 1.1 2016/11/28 14:41:40 leot Exp $
+
+Update to mupdf-1.10 API.
+
+--- links.c.orig       2016-02-14 22:49:46.000000000 +0000
++++ links.c
+@@ -44,48 +44,22 @@ pdf_page_links_get(zathura_page_t* page,
+     zathura_link_target_t target = { 0 };
+ 
+     char* buffer = NULL;
+-    switch (link->dest.kind) {
+-      case FZ_LINK_NONE:
+-        type = ZATHURA_LINK_NONE;
+-        break;
+-      case FZ_LINK_URI:
++    if (fz_is_external_link(mupdf_document->ctx, link->uri)) {
+         type         = ZATHURA_LINK_URI;
+-        target.value = link->dest.ld.uri.uri;
+-        break;
+-      case FZ_LINK_GOTO:
++        target.value = link->uri;
++    } else {
++        float tx, ty;
++        tx                      = 0.0;
++        ty                      = 0.0;
+         type                    = ZATHURA_LINK_GOTO_DEST;
+-        target.page_number      = link->dest.ld.gotor.page;
++        target.page_number      = 0;
+         target.destination_type = ZATHURA_LINK_DESTINATION_XYZ;
+-        target.left             = 0;
+-        target.top              = 0;
++        target.left             = 0.0;
++        target.top              = 0.0;
+         target.scale            = 0.0;
+-        {
+-          int gflags = link->dest.ld.gotor.flags;
+-          if (gflags & fz_link_flag_l_valid) {
+-            target.left = link->dest.ld.gotor.lt.x;
+-          }
+-          if (gflags & fz_link_flag_t_valid) {
+-            target.top = link->dest.ld.gotor.lt.y;
+-          }
+-          /* if (gflags & fz_link_flag_r_is_zoom) { */
+-          /*   target.scale = link->dest.ld.gotor.rb.x; */
+-          /* } */
+-        }
+-        break;
+-      case FZ_LINK_LAUNCH:
+-        type = ZATHURA_LINK_LAUNCH;
+-        target.value = link->dest.ld.launch.file_spec;
+-        break;
+-      case FZ_LINK_NAMED:
+-        type = ZATHURA_LINK_NAMED;
+-        target.value = link->dest.ld.named.named;
+-        break;
+-      case FZ_LINK_GOTOR:
+-        type = ZATHURA_LINK_GOTO_REMOTE;
+-        target.value = link->dest.ld.gotor.file_spec;
+-        break;
+-      default:
+-        continue;
++        target.page_number = fz_resolve_link(mupdf_document->ctx, mupdf_document->document, link->uri, &tx, &ty);
++        target.left             = tx;
++        target.top              = ty;
+     }
+ 
+     zathura_link_t* zathura_link = zathura_link_new(type, position, target);
diff -r e1ff41091e8f -r dd3d82fc9ae6 print/zathura-pdf-mupdf/patches/patch-page.c
--- a/print/zathura-pdf-mupdf/patches/patch-page.c      Mon Nov 28 14:40:42 2016 +0000
+++ b/print/zathura-pdf-mupdf/patches/patch-page.c      Mon Nov 28 14:41:40 2016 +0000
@@ -1,15 +1,16 @@
-$NetBSD: patch-page.c,v 1.1 2016/04/27 12:38:45 leot Exp $
+$NetBSD: patch-page.c,v 1.2 2016/11/28 14:41:40 leot Exp $
 
-Update to mupdf-1.9 API.
+Update to mupdf-1.10 API.
 
 --- page.c.orig        2016-02-14 22:49:46.000000000 +0000
 +++ page.c
-@@ -43,12 +43,12 @@ pdf_page_init(zathura_page_t* page)
+@@ -43,12 +43,13 @@ pdf_page_init(zathura_page_t* page)
    /* setup text */
    mupdf_page->extracted_text = false;
  
 -  mupdf_page->text = fz_new_text_page(mupdf_page->ctx);
-+  mupdf_page->text = fz_new_stext_page(mupdf_page->ctx);
++  fz_rect rect;
++  mupdf_page->text = fz_new_stext_page(mupdf_page->ctx, &rect);
    if (mupdf_page->text == NULL) {
      goto error_free;
    }
@@ -19,7 +20,7 @@
    if (mupdf_page->sheet == NULL) {



Home | Main Index | Thread Index | Old Index