Commit 09a266eb authored by Kan-Ru Chen's avatar Kan-Ru Chen

Use MUJS to provide JS functionality

Closes: #760480
Closes: #745247
parent 3025b8eb
......@@ -5,8 +5,7 @@ Maintainer: Kan-Ru Chen (陳侃如) <koster@debian.org>
Uploaders: Quoc-Viet Nguyen <afelion@gmail.com>
Build-Depends: debhelper (>= 7.0.50~), dpkg-dev (>= 1.16.1.1~),
libfreetype6-dev, pkg-config, libjpeg-dev, libjbig2dec-dev,
libopenjpeg-dev, libx11-dev, libxext-dev, zlib1g-dev,
libv8-dev [!powerpc !s390x !sparc]
libopenjpeg-dev, libx11-dev, libxext-dev, zlib1g-dev
Standards-Version: 3.9.5
Homepage: http://mupdf.com/
Vcs-Git: git://git.debian.org/git/users/koster/mupdf.git
......
From: =?utf-8?q?=22Kan-Ru_Chen_=28=E9=99=B3=E4=BE=83=E5=A6=82=29=22?=
<koster@debian.org>
Date: Sat, 20 Sep 2014 11:08:32 +0800
Subject: fix_libjpeg_header_mismatch
commit 674a7b563e3010d26faef86d674b246d42c8edf0
Author: Quoc-Viet Nguyen <afelion@gmail.com>
Date: Fri Apr 18 23:25:03 2014 +1000
......@@ -6,6 +11,7 @@ Date: Fri Apr 18 23:25:03 2014 +1000
---
scripts/jpeg/jconfig.h | 45 ---------------------------------------------
1 file changed, 45 deletions(-)
delete mode 100644 scripts/jpeg/jconfig.h
diff --git a/scripts/jpeg/jconfig.h b/scripts/jpeg/jconfig.h
deleted file mode 100644
......
From: =?utf-8?q?=22Kan-Ru_Chen_=28=E9=99=B3=E4=BE=83=E5=A6=82=29=22?=
<koster@debian.org>
Date: Sat, 20 Sep 2014 11:08:32 +0800
Subject: mupdf_manpage
---
docs/man/mupdf.1 | 10 ++++++++++
docs/man/mupdf.1 | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/docs/man/mupdf.1 b/docs/man/mupdf.1
index 5831c0c..d0921e4 100644
--- a/docs/man/mupdf.1
+++ b/docs/man/mupdf.1
@@ -117,6 +117,9 @@
@@ -117,6 +117,9 @@ Toggles fullscreen mode.
.B p
Toggle presentation mode.
.TP
......@@ -14,7 +21,7 @@
.B c
Toggle between color and grayscale rendering.
.TP
@@ -133,6 +136,13 @@
@@ -133,6 +136,13 @@ Quit.
Sending a \fBSIGHUP\fR signal to the mupdf process will also cause the viewed
file to be reloaded automatically, for use in e.g. build scripts.
......
---
platform/x11/pdfapp.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
--- a/platform/x11/pdfapp.c
+++ b/platform/x11/pdfapp.c
@@ -313,7 +313,12 @@
}
fz_catch(ctx)
{
- pdfapp_error(app, "cannot open document");
+ if (reload)
+ pdfapp_warn(app, "Cannot open document");
+ else
+ pdfapp_error(app, "Cannot open document");
+ app->errored = 1;
+ return;
}
if (app->pageno < 1)
@@ -1300,7 +1305,8 @@
if (app->pageno > app->pagecount)
app->pageno = app->pagecount;
- if (app->pageno != oldpage)
+ if (!app->errored &&
+ app->pageno != oldpage)
{
switch (panto)
{
---
Makethird | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--- a/Makethird
+++ b/Makethird
@@ -23,6 +23,10 @@
V8_DIR := $(wildcard thirdparty/v8*)
ifneq "$(V8_DIR)" ""
+HAVE_V8 := yes
+endif
+
+ifeq "$(HAVE_V8)" "yes"
ifeq "$(build)" "release"
V8_LIB_CHOICE := release
@@ -35,7 +39,9 @@
V8_ARCH ?= x64
# If you are building for 32bit linux use V8_ARCH=ia32
-ifeq "$(OS)" "Darwin"
+ifeq "$(OS)" "Linux"
+V8_LIBS := -lv8 -lpthread -lstdc++
+else ifeq "$(OS)" "Darwin"
V8_LIBS := -L$(V8_DIR)/out-mac/$(V8_ARCH).$(V8_LIB_CHOICE)/ -lv8_base -lv8_snapshot -lstdc++
else
V8_LIBS := -L$(V8_DIR)/out/$(V8_ARCH).$(V8_LIB_CHOICE)/obj.target/tools/gyp -lv8_base -lv8_snapshot -lpthread -ldl -lstdc++
@@ -43,7 +49,6 @@
V8_CFLAGS := -I$(V8_DIR)/include
-HAVE_V8 := yes
endif
# --- MuJS ---
Description: Fix the format of mudraw.1
manpage-has-errors-from-man 40: warning: macro `Fit'' not defined
Author: Kan-Ru Chen (陳侃如) <koster@debian.org>
---
docs/man/mudraw.1 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/docs/man/mudraw.1
+++ b/docs/man/mudraw.1
@@ -41,7 +41,7 @@
render with a maximum height).
.TP
.B \-f
-'Fit' exactly; ignore the aspect ratio when matching specified width/heights.
+\`Fit\' exactly; ignore the aspect ratio when matching specified width/heights.
.TP
.B \-R angle
Rotate clockwise by given number of degrees.
fix_libv8_linkage.patch
use_openjpeg_1.5.patch
fix_libjpeg_header_mismatch.patch
fix_mudraw_man_format.patch
mupdf_manpage.patch
0001-fix_libjpeg_header_mismatch.patch
0002-mupdf_manpage.patch
commit a7341e98ef48d6041028b7294d1acc13665b04ba
Author: Quoc-Viet Nguyen <afelion@gmail.com>
Date: Fri Apr 18 23:48:29 2014 +1000
Use openjpeg 1.5 rather than 2.0
---
source/fitz/load-jpx.c | 104 +++++++++----------------------------------------
1 file changed, 18 insertions(+), 86 deletions(-)
diff --git a/source/fitz/load-jpx.c b/source/fitz/load-jpx.c
index dfb89f4..d27b5de 100644
--- a/source/fitz/load-jpx.c
+++ b/source/fitz/load-jpx.c
@@ -27,119 +27,51 @@ static void fz_opj_info_callback(const char *msg, void *client_data)
/* fz_warn("openjpeg info: %s", msg); */
}
-typedef struct stream_block_s
-{
- unsigned char *data;
- int size;
- int pos;
-} stream_block;
-
-static OPJ_SIZE_T fz_opj_stream_read(void * p_buffer, OPJ_SIZE_T p_nb_bytes, void * p_user_data)
-{
- stream_block *sb = (stream_block *)p_user_data;
- int len;
-
- len = sb->size - sb->pos;
- if (len < 0)
- len = 0;
- if (len == 0)
- return (OPJ_SIZE_T)-1; /* End of file! */
- if ((OPJ_SIZE_T)len > p_nb_bytes)
- len = p_nb_bytes;
- memcpy(p_buffer, sb->data + sb->pos, len);
- sb->pos += len;
- return len;
-}
-
-static OPJ_OFF_T fz_opj_stream_skip(OPJ_OFF_T skip, void * p_user_data)
-{
- stream_block *sb = (stream_block *)p_user_data;
-
- if (skip > sb->size - sb->pos)
- skip = sb->size - sb->pos;
- sb->pos += skip;
- return sb->pos;
-}
-
-static OPJ_BOOL fz_opj_stream_seek(OPJ_OFF_T seek_pos, void * p_user_data)
-{
- stream_block *sb = (stream_block *)p_user_data;
-
- if (seek_pos > sb->size)
- return OPJ_FALSE;
- sb->pos = seek_pos;
- return OPJ_TRUE;
-}
-
fz_pixmap *
fz_load_jpx(fz_context *ctx, unsigned char *data, int size, fz_colorspace *defcs, int indexed)
{
fz_pixmap *img;
fz_colorspace *origcs;
+ opj_event_mgr_t evtmgr;
opj_dparameters_t params;
- opj_codec_t *codec;
+ opj_dinfo_t *codec;
opj_image_t *jpx;
- opj_stream_t *stream;
+ opj_cio_t *stream;
fz_colorspace *colorspace;
unsigned char *p;
OPJ_CODEC_FORMAT format;
int a, n, w, h, depth, sgnd;
int x, y, k, v;
- stream_block sb;
if (size < 2)
fz_throw(ctx, FZ_ERROR_GENERIC, "not enough data to determine image format");
/* Check for SOC marker -- if found we have a bare J2K stream */
if (data[0] == 0xFF && data[1] == 0x4F)
- format = OPJ_CODEC_J2K;
+ format = CODEC_J2K;
else
- format = OPJ_CODEC_JP2;
+ format = CODEC_JP2;
+
+ memset(&evtmgr, 0, sizeof(evtmgr));
+ evtmgr.error_handler = fz_opj_error_callback;
+ evtmgr.warning_handler = fz_opj_warning_callback;
+ evtmgr.info_handler = fz_opj_info_callback;
opj_set_default_decoder_parameters(&params);
if (indexed)
params.flags |= OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG;
codec = opj_create_decompress(format);
- opj_set_info_handler(codec, fz_opj_info_callback, ctx);
- opj_set_warning_handler(codec, fz_opj_warning_callback, ctx);
- opj_set_error_handler(codec, fz_opj_error_callback, ctx);
- if (!opj_setup_decoder(codec, &params))
- {
- fz_throw(ctx, FZ_ERROR_GENERIC, "j2k decode failed");
- }
-
- stream = opj_stream_default_create(OPJ_TRUE);
- sb.data = data;
- sb.pos = 0;
- sb.size = size;
+ opj_set_event_mgr((opj_common_ptr)codec, &evtmgr, ctx);
+ opj_setup_decoder(codec, &params);
- opj_stream_set_read_function(stream, fz_opj_stream_read);
- opj_stream_set_skip_function(stream, fz_opj_stream_skip);
- opj_stream_set_seek_function(stream, fz_opj_stream_seek);
- opj_stream_set_user_data(stream, &sb);
- /* Set the length to avoid an assert */
- opj_stream_set_user_data_length(stream, size);
+ stream = opj_cio_open((opj_common_ptr)codec, data, size);
- if (!opj_read_header(stream, codec, &jpx))
- {
- opj_stream_destroy(stream);
- opj_destroy_codec(codec);
- fz_throw(ctx, FZ_ERROR_GENERIC, "Failed to read JPX header");
- }
-
- if (!opj_decode(codec, stream, jpx))
- {
- opj_stream_destroy(stream);
- opj_destroy_codec(codec);
- opj_image_destroy(jpx);
- fz_throw(ctx, FZ_ERROR_GENERIC, "Failed to decode JPX image");
- }
+ jpx = opj_decode(codec, stream);
- opj_stream_destroy(stream);
- opj_destroy_codec(codec);
+ opj_cio_close(stream);
+ opj_destroy_decompress(codec);
- /* jpx should never be NULL here, but check anyway */
if (!jpx)
fz_throw(ctx, FZ_ERROR_GENERIC, "opj_decode failed");
@@ -173,8 +105,8 @@ fz_load_jpx(fz_context *ctx, unsigned char *data, int size, fz_colorspace *defcs
depth = jpx->comps[0].prec;
sgnd = jpx->comps[0].sgnd;
- if (jpx->color_space == OPJ_CLRSPC_SRGB && n == 4) { n = 3; a = 1; }
- else if (jpx->color_space == OPJ_CLRSPC_SYCC && n == 4) { n = 3; a = 1; }
+ if (jpx->color_space == CLRSPC_SRGB && n == 4) { n = 3; a = 1; }
+ else if (jpx->color_space == CLRSPC_SYCC && n == 4) { n = 3; a = 1; }
else if (n == 2) { n = 1; a = 1; }
else if (n > 4) { n = 4; a = 1; }
else { a = 0; }
......@@ -26,9 +26,6 @@ ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
endif
BUILD_FLAGS=build=release OS=Linux
ifeq (,$(strip $(foreach arch,powerpc s390x sparc,$(findstring $(arch),$(DEB_HOST_ARCH)))))
BUILD_FLAGS += HAVE_V8=yes
endif
override_dh_auto_build:
$(MAKE) $(BUILD_FLAGS)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment