summaryrefslogtreecommitdiff
path: root/source/pdf/js
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2013-06-24 21:01:27 +0100
committerRobin Watts <robin.watts@artifex.com>2013-06-25 10:05:25 +0100
commit07dd8540ae72b0e7be64d04c38d8c19b83d184b6 (patch)
treedfaa48e8eeeb46fac17f8eb0cb8f226da9b841ca /source/pdf/js
parent8a2b650a9d3910d9b5104b1d2560b6a34bf7583e (diff)
downloadmupdf-07dd8540ae72b0e7be64d04c38d8c19b83d184b6.tar.xz
Update pdf_obj's to have a pdf_document field.
Remove the fz_context field to avoid the structure growing.
Diffstat (limited to 'source/pdf/js')
-rw-r--r--source/pdf/js/pdf-js.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/source/pdf/js/pdf-js.c b/source/pdf/js/pdf-js.c
index 4a2313f1..5ea9872f 100644
--- a/source/pdf/js/pdf-js.c
+++ b/source/pdf/js/pdf-js.c
@@ -138,13 +138,14 @@ static pdf_jsimp_obj *app_launchURL(void *jsctx, void *obj, int argc, pdf_jsimp_
return NULL;
}
-static pdf_obj *load_color(fz_context *ctx, pdf_jsimp *imp, pdf_jsimp_obj *val)
+static pdf_obj *load_color(pdf_document *doc, pdf_jsimp *imp, pdf_jsimp_obj *val)
{
pdf_obj *col = NULL;
pdf_obj *comp = NULL;
pdf_jsimp_obj *jscomp = NULL;
int i;
int n;
+ fz_context *ctx = doc->ctx;
n = pdf_jsimp_array_len(imp, val);
@@ -154,7 +155,7 @@ static pdf_obj *load_color(fz_context *ctx, pdf_jsimp *imp, pdf_jsimp_obj *val)
if (n <= 1)
return NULL;
- col = pdf_new_array(ctx, n-1);
+ col = pdf_new_array(doc, n-1);
fz_var(comp);
fz_var(jscomp);
@@ -163,7 +164,7 @@ static pdf_obj *load_color(fz_context *ctx, pdf_jsimp *imp, pdf_jsimp_obj *val)
for (i = 0; i < n-1; i++)
{
jscomp = pdf_jsimp_array_item(imp, val, i+1);
- comp = pdf_new_real(ctx, pdf_jsimp_to_number(imp, jscomp));
+ comp = pdf_new_real(doc, pdf_jsimp_to_number(imp, jscomp));
pdf_array_push(col, comp);
pdf_jsimp_drop_obj(imp, jscomp);
jscomp = NULL;
@@ -264,7 +265,7 @@ static void field_setFillColor(void *jsctx, void *obj, pdf_jsimp_obj *val)
if (!field)
return;
- col = load_color(js->doc->ctx, js->imp, val);
+ col = load_color(js->doc, js->imp, val);
fz_try(ctx)
{
pdf_field_set_fill_color(js->doc, field, col);
@@ -294,7 +295,7 @@ static void field_setTextColor(void *jsctx, void *obj, pdf_jsimp_obj *val)
if (!field)
return;
- col = load_color(js->doc->ctx, js->imp, val);
+ col = load_color(js->doc, js->imp, val);
fz_try(ctx)
{
pdf_field_set_text_color(js->doc, field, col);