mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-13 03:03:15 +00:00
- Update to 0.2.8
- While I'm here, fix LOCALBASE usage Changes: https://git.pwmt.org/pwmt/zathura-pdf-mupdf/commits/master PR: 205094 Submitted by: Zsolt Udvari <udvzsolt@gmail.com> (maintainer)
This commit is contained in:
parent
ea9d3a330c
commit
90de1b1a25
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=403512
@ -2,8 +2,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PORTNAME= zathura-pdf-mupdf
|
||||
PORTVERSION= 0.2.7
|
||||
PORTREVISION= 4
|
||||
PORTVERSION= 0.2.8
|
||||
CATEGORIES= graphics
|
||||
MASTER_SITES= http://pwmt.org/projects/zathura-pdf-mupdf/download/
|
||||
|
||||
@ -16,7 +15,7 @@ LICENSE_FILE= ${WRKSRC}/LICENSE
|
||||
LICENSE_PERMS= dist-mirror pkg-mirror auto-accept
|
||||
|
||||
BUILD_DEPENDS= zathura:${PORTSDIR}/graphics/zathura \
|
||||
mupdf>=1.7,1:${PORTSDIR}/graphics/mupdf
|
||||
mupdf>=1.8,1:${PORTSDIR}/graphics/mupdf
|
||||
RUN_DEPENDS= zathura:${PORTSDIR}/graphics/zathura
|
||||
LIB_DEPENDS= libjbig2dec.so:${PORTSDIR}/graphics/jbig2dec \
|
||||
libopenjp2.so:${PORTSDIR}/graphics/openjpeg
|
||||
@ -32,6 +31,6 @@ USE_OPENSSL= yes
|
||||
CONFLICTS_INSTALL= zathura-pdf-poppler-[0-9]*
|
||||
|
||||
post-install:
|
||||
${STRIP_CMD} ${STAGEDIR}${LOCALBASE}/lib/zathura/pdf.so
|
||||
${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/zathura/pdf.so
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
@ -1,2 +1,2 @@
|
||||
SHA256 (zathura-pdf-mupdf-0.2.7.tar.gz) = b1343f35940ebcf463b868b557be4eaba7d61884d6ff3ad3d7c7c272e69c253f
|
||||
SIZE (zathura-pdf-mupdf-0.2.7.tar.gz) = 9357
|
||||
SHA256 (zathura-pdf-mupdf-0.2.8.tar.gz) = 9f8b92762cdad14a2a587744c758edc0e1003be6a0c1511486065bdc91a66910
|
||||
SIZE (zathura-pdf-mupdf-0.2.8.tar.gz) = 9930
|
||||
|
@ -1,308 +0,0 @@
|
||||
Description: Update for 1.7 API changes
|
||||
Origin: https://git.pwmt.org/?p=zathura-pdf-mupdf.git;a=commitdiff;h=f96dd48
|
||||
|
||||
--- document.c.orig 2014-10-16 22:21:41 UTC
|
||||
+++ document.c
|
||||
@@ -51,14 +51,14 @@ pdf_document_open(zathura_document_t* do
|
||||
}
|
||||
|
||||
/* authenticate if password is required and given */
|
||||
- if (fz_needs_password(mupdf_document->document) != 0) {
|
||||
- if (password == NULL || fz_authenticate_password(mupdf_document->document, (char*) password) == 0) {
|
||||
+ if (fz_needs_password(mupdf_document->ctx, mupdf_document->document) != 0) {
|
||||
+ if (password == NULL || fz_authenticate_password(mupdf_document->ctx, mupdf_document->document, (char*) password) == 0) {
|
||||
error = ZATHURA_ERROR_INVALID_PASSWORD;
|
||||
goto error_free;
|
||||
}
|
||||
}
|
||||
|
||||
- zathura_document_set_number_of_pages(document, fz_count_pages(mupdf_document->document));
|
||||
+ zathura_document_set_number_of_pages(document, fz_count_pages(mupdf_document->ctx, mupdf_document->document));
|
||||
zathura_document_set_data(document, mupdf_document);
|
||||
|
||||
return error;
|
||||
@@ -67,10 +67,10 @@ error_free:
|
||||
|
||||
if (mupdf_document != NULL) {
|
||||
if (mupdf_document->document != NULL) {
|
||||
- fz_close_document(mupdf_document->document);
|
||||
+ fz_drop_document(mupdf_document->ctx, mupdf_document->document);
|
||||
}
|
||||
if (mupdf_document->ctx != NULL) {
|
||||
- fz_free_context(mupdf_document->ctx);
|
||||
+ fz_drop_context(mupdf_document->ctx);
|
||||
}
|
||||
|
||||
free(mupdf_document);
|
||||
@@ -90,8 +90,8 @@ pdf_document_free(zathura_document_t* do
|
||||
return ZATHURA_ERROR_INVALID_ARGUMENTS;
|
||||
}
|
||||
|
||||
- fz_close_document(mupdf_document->document);
|
||||
- fz_free_context(mupdf_document->ctx);
|
||||
+ fz_drop_document(mupdf_document->ctx, mupdf_document->document);
|
||||
+ fz_drop_context(mupdf_document->ctx);
|
||||
free(mupdf_document);
|
||||
zathura_document_set_data(document, NULL);
|
||||
|
||||
@@ -112,7 +112,7 @@ pdf_document_save_as(zathura_document_t*
|
||||
* options. */
|
||||
|
||||
fz_write_options opts = { 0 }; /* just use the default options */
|
||||
- fz_write_document(mupdf_document->document, (char*) path, &opts);
|
||||
+ fz_write_document(mupdf_document->ctx, mupdf_document->document, (char*) path, &opts);
|
||||
} fz_catch (mupdf_document->ctx) {
|
||||
return ZATHURA_ERROR_UNKNOWN;
|
||||
}
|
||||
--- image.c.orig 2014-10-16 22:21:41 UTC
|
||||
+++ image.c
|
||||
@@ -9,8 +9,8 @@
|
||||
#include "plugin.h"
|
||||
|
||||
static void pdf_zathura_image_free(zathura_image_t* image);
|
||||
-static void get_images(pdf_obj* dict, girara_list_t* list);
|
||||
-static void get_resources(pdf_obj* resource, girara_list_t* list);
|
||||
+static void get_images(zathura_page_t* page, pdf_obj* dict, girara_list_t* list);
|
||||
+static void get_resources(zathura_page_t* page, pdf_obj* resource, girara_list_t* list);
|
||||
|
||||
girara_list_t*
|
||||
pdf_page_images_get(zathura_page_t* page, mupdf_page_t* mupdf_page, zathura_error_t* error)
|
||||
@@ -30,12 +30,12 @@ pdf_page_images_get(zathura_page_t* page
|
||||
|
||||
mupdf_document_t* mupdf_document = zathura_document_get_data(document);
|
||||
|
||||
- pdf_obj* page_object = pdf_load_object((pdf_document*) mupdf_document->document, zathura_page_get_index(page), 0);
|
||||
+ pdf_obj* page_object = pdf_load_object(mupdf_document->ctx, (pdf_document*) mupdf_document->document, zathura_page_get_index(page), 0);
|
||||
if (page_object == NULL) {
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
- pdf_obj* resource = pdf_dict_gets(page_object, "Resources");
|
||||
+ pdf_obj* resource = pdf_dict_gets(mupdf_document->ctx, page_object, "Resources");
|
||||
if (resource == NULL) {
|
||||
goto error_free;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ pdf_page_images_get(zathura_page_t* page
|
||||
|
||||
girara_list_set_free_function(list, (girara_free_function_t) pdf_zathura_image_free);
|
||||
|
||||
- get_resources(resource, list);
|
||||
+ get_resources(page, resource, list);
|
||||
|
||||
return list;
|
||||
|
||||
@@ -81,20 +81,32 @@ pdf_zathura_image_free(zathura_image_t*
|
||||
}
|
||||
|
||||
static void
|
||||
-get_images(pdf_obj* dict, girara_list_t* list)
|
||||
+get_images(zathura_page_t* page, pdf_obj* dict, girara_list_t* list)
|
||||
{
|
||||
if (dict == NULL || list == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
- for (int i = 0; i < pdf_dict_len(dict); i++) {
|
||||
- pdf_obj* image_dict = pdf_dict_get_val(dict, i);
|
||||
- if (pdf_is_dict(image_dict) == 0) {
|
||||
+ if (page == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ zathura_document_t* document = zathura_page_get_document(page);
|
||||
+
|
||||
+ if (document == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ mupdf_document_t* mupdf_document = zathura_document_get_data(document);
|
||||
+
|
||||
+ for (int i = 0; i < pdf_dict_len(mupdf_document->ctx, dict); i++) {
|
||||
+ pdf_obj* image_dict = pdf_dict_get_val(mupdf_document->ctx, dict, i);
|
||||
+ if (pdf_is_dict(mupdf_document->ctx, image_dict) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
- pdf_obj* type = pdf_dict_gets(image_dict, "Subtype");
|
||||
- if (strcmp(pdf_to_name(type), "Image") != 0) {
|
||||
+ pdf_obj* type = pdf_dict_gets(mupdf_document->ctx, image_dict, "Subtype");
|
||||
+ if (strcmp(pdf_to_name(mupdf_document->ctx, type), "Image") != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -110,8 +122,8 @@ get_images(pdf_obj* dict, girara_list_t*
|
||||
continue;
|
||||
}
|
||||
|
||||
- pdf_obj* width = pdf_dict_gets(image_dict, "Width");
|
||||
- pdf_obj* height = pdf_dict_gets(image_dict, "Height");
|
||||
+ pdf_obj* width = pdf_dict_gets(mupdf_document->ctx, image_dict, "Width");
|
||||
+ pdf_obj* height = pdf_dict_gets(mupdf_document->ctx, image_dict, "Height");
|
||||
|
||||
zathura_image_t* zathura_image = g_malloc(sizeof(zathura_image_t));
|
||||
|
||||
@@ -120,33 +132,45 @@ get_images(pdf_obj* dict, girara_list_t*
|
||||
// FIXME: Get correct image coordinates
|
||||
zathura_image->data = image_dict;
|
||||
zathura_image->position.x1 = 0;
|
||||
- zathura_image->position.x2 = pdf_to_int(width);
|
||||
+ zathura_image->position.x2 = pdf_to_int(mupdf_document->ctx, width);
|
||||
zathura_image->position.y1 = 0;
|
||||
- zathura_image->position.y2 = pdf_to_int(height);
|
||||
+ zathura_image->position.y2 = pdf_to_int(mupdf_document->ctx, height);
|
||||
|
||||
girara_list_append(list, zathura_image);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
-get_resources(pdf_obj* resource, girara_list_t* list)
|
||||
+get_resources(zathura_page_t* page, pdf_obj* resource, girara_list_t* list)
|
||||
{
|
||||
if (resource == NULL || list == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
- pdf_obj* x_object = pdf_dict_gets(resource, "XObject");
|
||||
+ if (page == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ zathura_document_t* document = zathura_page_get_document(page);
|
||||
+
|
||||
+ if (document == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ mupdf_document_t* mupdf_document = zathura_document_get_data(document);
|
||||
+
|
||||
+ pdf_obj* x_object = pdf_dict_gets(mupdf_document->ctx, resource, "XObject");
|
||||
if (x_object == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
- get_images(x_object, list);
|
||||
+ get_images(page, x_object, list);
|
||||
|
||||
- for (int i = 0; i < pdf_dict_len(x_object); i++) {
|
||||
- pdf_obj* obj = pdf_dict_get_val(x_object, i);
|
||||
- pdf_obj* subsrc = pdf_dict_gets(obj, "Resources");
|
||||
- if (subsrc != NULL && pdf_objcmp(resource, subsrc)) {
|
||||
- get_resources(subsrc, list);
|
||||
+ for (int i = 0; i < pdf_dict_len(mupdf_document->ctx, x_object); i++) {
|
||||
+ pdf_obj* obj = pdf_dict_get_val(mupdf_document->ctx, x_object, i);
|
||||
+ pdf_obj* subsrc = pdf_dict_gets(mupdf_document->ctx, obj, "Resources");
|
||||
+ if (subsrc != NULL && pdf_objcmp(mupdf_document->ctx, resource, subsrc)) {
|
||||
+ get_resources(page, subsrc, list);
|
||||
}
|
||||
}
|
||||
}
|
||||
--- index.c.orig 2014-10-16 22:21:41 UTC
|
||||
+++ index.c
|
||||
@@ -19,7 +19,7 @@ pdf_document_index_generate(zathura_docu
|
||||
}
|
||||
|
||||
/* get outline */
|
||||
- fz_outline* outline = fz_load_outline(mupdf_document->document);
|
||||
+ fz_outline* outline = fz_load_outline(mupdf_document->ctx, mupdf_document->document);
|
||||
if (outline == NULL) {
|
||||
if (error != NULL) {
|
||||
*error = ZATHURA_ERROR_UNKNOWN;
|
||||
@@ -32,7 +32,7 @@ pdf_document_index_generate(zathura_docu
|
||||
build_index(outline, root);
|
||||
|
||||
/* free outline */
|
||||
- fz_free_outline(mupdf_document->ctx, outline);
|
||||
+ fz_drop_outline(mupdf_document->ctx, outline);
|
||||
|
||||
return root;
|
||||
}
|
||||
--- links.c.orig 2014-10-16 22:21:41 UTC
|
||||
+++ links.c
|
||||
@@ -31,7 +31,7 @@ pdf_page_links_get(zathura_page_t* page,
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
- fz_link* link = fz_load_links(mupdf_document->document, mupdf_page->page);
|
||||
+ fz_link* link = fz_load_links(mupdf_document->ctx, mupdf_page->page);
|
||||
for (; link != NULL; link = link->next) {
|
||||
/* extract position */
|
||||
zathura_rectangle_t position;
|
||||
--- page.c.orig 2014-10-16 22:21:41 UTC
|
||||
+++ page.c
|
||||
@@ -29,12 +29,12 @@ pdf_page_init(zathura_page_t* page)
|
||||
|
||||
/* load page */
|
||||
fz_try (mupdf_page->ctx) {
|
||||
- mupdf_page->page = fz_load_page(mupdf_document->document, index);
|
||||
+ mupdf_page->page = fz_load_page(mupdf_document->ctx, mupdf_document->document, index);
|
||||
} fz_catch (mupdf_page->ctx) {
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
- fz_bound_page(mupdf_document->document, (fz_page*) mupdf_page->page, &mupdf_page->bbox);
|
||||
+ fz_bound_page(mupdf_document->ctx, (fz_page*) mupdf_page->page, &mupdf_page->bbox);
|
||||
|
||||
/* get page dimensions */
|
||||
zathura_page_set_width(page, mupdf_page->bbox.x1 - mupdf_page->bbox.x0);
|
||||
@@ -74,15 +74,15 @@ pdf_page_clear(zathura_page_t* page, mup
|
||||
|
||||
if (mupdf_page != NULL) {
|
||||
if (mupdf_page->text != NULL) {
|
||||
- fz_free_text_page(mupdf_page->ctx, mupdf_page->text);
|
||||
+ fz_drop_text_page(mupdf_page->ctx, mupdf_page->text);
|
||||
}
|
||||
|
||||
if (mupdf_page->sheet != NULL) {
|
||||
- fz_free_text_sheet(mupdf_page->ctx, mupdf_page->sheet);
|
||||
+ fz_drop_text_sheet(mupdf_page->ctx, mupdf_page->sheet);
|
||||
}
|
||||
|
||||
if (mupdf_page->page != NULL) {
|
||||
- fz_free_page(mupdf_document->document, mupdf_page->page);
|
||||
+ fz_drop_page(mupdf_document->ctx, mupdf_page->page);
|
||||
}
|
||||
|
||||
free(mupdf_page);
|
||||
--- render.c.orig 2014-10-16 22:21:41 UTC
|
||||
+++ render.c
|
||||
@@ -26,12 +26,12 @@ pdf_page_render_to_buffer(mupdf_document
|
||||
fz_try (mupdf_document->ctx) {
|
||||
fz_matrix m;
|
||||
fz_scale(&m, scalex, scaley);
|
||||
- fz_run_page(mupdf_document->document, mupdf_page->page, device, &m, NULL);
|
||||
+ fz_run_page(mupdf_document->ctx, mupdf_page->page, device, &m, NULL);
|
||||
} fz_catch (mupdf_document->ctx) {
|
||||
return ZATHURA_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
- fz_free_device(device);
|
||||
+ fz_drop_device(mupdf_page->ctx, device);
|
||||
|
||||
fz_irect irect = { .x1 = page_width, .y1 = page_height };
|
||||
fz_rect rect = { .x1 = page_width, .y1 = page_height };
|
||||
@@ -41,8 +41,8 @@ pdf_page_render_to_buffer(mupdf_document
|
||||
fz_clear_pixmap_with_value(mupdf_page->ctx, pixmap, 0xFF);
|
||||
|
||||
device = fz_new_draw_device(mupdf_page->ctx, pixmap);
|
||||
- fz_run_display_list(display_list, device, &fz_identity, &rect, NULL);
|
||||
- fz_free_device(device);
|
||||
+ fz_run_display_list(mupdf_page->ctx, display_list, device, &fz_identity, &rect, NULL);
|
||||
+ fz_drop_device(mupdf_page->ctx, device);
|
||||
|
||||
unsigned char* s = fz_pixmap_samples(mupdf_page->ctx, pixmap);
|
||||
unsigned int n = fz_pixmap_components(mupdf_page->ctx, pixmap);
|
||||
--- utils.c.orig 2014-10-16 22:21:41 UTC
|
||||
+++ utils.c
|
||||
@@ -17,9 +17,9 @@ mupdf_page_extract_text(mupdf_document_t
|
||||
text_device = fz_new_text_device(mupdf_page->ctx, mupdf_page->sheet, mupdf_page->text);
|
||||
fz_matrix ctm;
|
||||
fz_scale(&ctm, 1.0, 1.0);
|
||||
- fz_run_page(mupdf_document->document, mupdf_page->page, text_device, &ctm, NULL);
|
||||
+ fz_run_page(mupdf_page->ctx, mupdf_page->page, text_device, &ctm, NULL);
|
||||
} fz_always (mupdf_document->ctx) {
|
||||
- fz_free_device(text_device);
|
||||
+ fz_drop_device(mupdf_page->ctx, text_device);
|
||||
} fz_catch(mupdf_document->ctx) {
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user