summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2012-09-30 22:03:06 +0200
committerRobin Watts <robin.watts@artifex.com>2012-10-01 16:57:12 +0100
commit3f97526e5b340300a3e16214f9109615f521e7fc (patch)
treef4196473b54802324b0943ef65703c5fa2773211
parent4b0a8e2a428e38b5084e1f8d678495adbbc61504 (diff)
downloadmupdf-3f97526e5b340300a3e16214f9109615f521e7fc.tar.xz
Use malformed shading entries as far as possible
The rest of the shading code and source code for other cases already handles malformed entries in the same way.
-rw-r--r--pdf/pdf_shade.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/pdf/pdf_shade.c b/pdf/pdf_shade.c
index 24ccde6e..989925a7 100644
--- a/pdf/pdf_shade.c
+++ b/pdf/pdf_shade.c
@@ -61,7 +61,7 @@ pdf_load_function_based_shading(fz_shade *shade, pdf_document *xref, pdf_obj *di
x0 = y0 = 0;
x1 = y1 = 1;
obj = pdf_dict_gets(dict, "Domain");
- if (pdf_array_len(obj) == 4)
+ if (obj)
{
x0 = pdf_to_real(pdf_array_get(obj, 0));
x1 = pdf_to_real(pdf_array_get(obj, 1));
@@ -71,7 +71,7 @@ pdf_load_function_based_shading(fz_shade *shade, pdf_document *xref, pdf_obj *di
matrix = fz_identity;
obj = pdf_dict_gets(dict, "Matrix");
- if (pdf_array_len(obj) == 6)
+ if (obj)
matrix = pdf_to_matrix(ctx, obj);
shade->u.f.matrix = matrix;
shade->u.f.xdivs = FUNSEGS;
@@ -114,7 +114,7 @@ pdf_load_axial_shading(fz_shade *shade, pdf_document *xref, pdf_obj *dict, int f
d0 = 0;
d1 = 1;
obj = pdf_dict_gets(dict, "Domain");
- if (pdf_array_len(obj) == 2)
+ if (obj)
{
d0 = pdf_to_real(pdf_array_get(obj, 0));
d1 = pdf_to_real(pdf_array_get(obj, 1));
@@ -122,7 +122,7 @@ pdf_load_axial_shading(fz_shade *shade, pdf_document *xref, pdf_obj *dict, int f
e0 = e1 = 0;
obj = pdf_dict_gets(dict, "Extend");
- if (pdf_array_len(obj) == 2)
+ if (obj)
{
e0 = pdf_to_bool(pdf_array_get(obj, 0));
e1 = pdf_to_bool(pdf_array_get(obj, 1));
@@ -153,7 +153,7 @@ pdf_load_radial_shading(fz_shade *shade, pdf_document *xref, pdf_obj *dict, int
d0 = 0;
d1 = 1;
obj = pdf_dict_gets(dict, "Domain");
- if (pdf_array_len(obj) == 2)
+ if (obj)
{
d0 = pdf_to_real(pdf_array_get(obj, 0));
d1 = pdf_to_real(pdf_array_get(obj, 1));
@@ -161,7 +161,7 @@ pdf_load_radial_shading(fz_shade *shade, pdf_document *xref, pdf_obj *dict, int
e0 = e1 = 0;
obj = pdf_dict_gets(dict, "Extend");
- if (pdf_array_len(obj) == 2)
+ if (obj)
{
e0 = pdf_to_bool(pdf_array_get(obj, 0));
e1 = pdf_to_bool(pdf_array_get(obj, 1));