summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO6
-rw-r--r--mupdf/page.c7
-rw-r--r--render/archx86.c5
-rw-r--r--render/render.c4
-rw-r--r--tree/optimize.c79
5 files changed, 94 insertions, 7 deletions
diff --git a/TODO b/TODO
index 7e845aac..488f1fc6 100644
--- a/TODO
+++ b/TODO
@@ -1,14 +1,14 @@
immediate plan:
+ - pdf logging
- refcount resources
- - put image load/scale into rastfuncs
- altivec optimize
- gtk+pdf
- page labels + dests + outline + annots
- - global font/cmap cache
- design gui for editor
- - talk to keithp about fontconfig cid-font + cmap support
- go through spec and check all features!
+ - global font/cmap cache
- font and cmap config (where to load cmap and which cid fonts)
+ - talk to keithp about fontconfig cid-font + cmap support
---
diff --git a/mupdf/page.c b/mupdf/page.c
index 82d2ea5a..88d44a42 100644
--- a/mupdf/page.c
+++ b/mupdf/page.c
@@ -55,6 +55,13 @@ runmany(pdf_csi *csi, pdf_xref *xref, fz_obj *rdb, fz_obj *list)
error = fz_ferror(file);
goto cleanup1;
}
+
+ n = fz_printstring(file, " ");
+ if (n == -1)
+ {
+ error = fz_ferror(file);
+ goto cleanup1;
+ }
}
fz_closefile(file);
diff --git a/render/archx86.c b/render/archx86.c
index 9754214f..a4161a1f 100644
--- a/render/archx86.c
+++ b/render/archx86.c
@@ -1,6 +1,7 @@
/*
-x86 specific render optims live here
-*/
+ * x86 specific render optims live here
+ */
+
#include <fitz.h>
typedef unsigned char byte;
diff --git a/render/render.c b/render/render.c
index 424d8c1a..7ae10fb4 100644
--- a/render/render.c
+++ b/render/render.c
@@ -405,8 +405,8 @@ renderimage(fz_renderer *gc, fz_imagenode *node, fz_matrix ctm)
DEBUG("image %dx%d %d+%d %s\n{\n", image->w, image->h, image->n, image->a, image->cs?image->cs->name:"(nil)");
- bbox = fz_roundrect(fz_boundnode((fz_node*)node, ctm));
- clip = fz_intersectirects(gc->clip, bbox);
+ bbox = fz_roundrect(fz_boundnode((fz_node*)node, ctm));
+ clip = fz_intersectirects(gc->clip, bbox);
if (fz_isemptyrect(clip))
return nil;
diff --git a/tree/optimize.c b/tree/optimize.c
index cbb9ad31..9f85cdd7 100644
--- a/tree/optimize.c
+++ b/tree/optimize.c
@@ -215,6 +215,84 @@ retry:
}
/*
+ * Turn 1x1 images into rectangle fills
+ */
+
+static fz_error *clean1x1(fz_node *node)
+{
+ fz_error *error;
+ fz_node *current;
+ fz_node *color;
+ fz_pathnode *rect;
+ fz_node *mask;
+ fz_image *image;
+ fz_pixmap *pix;
+ float v[FZ_MAXCOLORS];
+ int i;
+
+ for (current = node->first; current; current = current->next)
+ {
+ if (fz_isimagenode(current))
+ {
+ image = ((fz_imagenode*)current)->image;
+ if (image->w == 1 && image->h == 1)
+ {
+ error = fz_newpathnode(&rect);
+ fz_moveto(rect, 0, 0);
+ fz_lineto(rect, 1, 0);
+ fz_lineto(rect, 1, 1);
+ fz_lineto(rect, 0, 1);
+ fz_closepath(rect);
+ fz_endpath(rect, FZ_FILL, nil, nil);
+
+ if (image->cs)
+ {
+ error = fz_newpixmap(&pix, 0, 0, 1, 1, image->n + 1);
+ if (error)
+ return error;
+
+ error = image->loadtile(image, pix);
+ if (error)
+ return error;
+
+ for (i = 0; i < image->n; i++)
+ v[i] = pix->samples[i + 1] / 255.0;
+
+ fz_droppixmap(pix);
+
+ error = fz_newcolornode(&color, image->cs, image->n, v);
+ if (error)
+ return error;
+ error = fz_newmasknode(&mask);
+ if (error)
+ return error;
+
+ fz_insertnodeafter(mask, (fz_node*)rect);
+ fz_insertnodeafter(mask, color);
+ fz_insertnodeafter(current, mask);
+ fz_removenode(current);
+ current = color;
+ }
+
+ else
+ {
+ /* pray that the 1x1 image mask is all opaque */
+ fz_insertnodeafter(current, (fz_node*)rect);
+ fz_removenode(current);
+ current = (fz_node*)rect;
+ }
+ }
+ }
+
+ error = clean1x1(current);
+ if (error)
+ return error;
+ }
+
+ return nil;
+}
+
+/*
*
*/
@@ -226,6 +304,7 @@ fz_optimizetree(fz_tree *tree)
cleanwhite(tree->root);
cleanovers(tree->root);
cleanmasks(tree->root);
+ clean1x1(tree->root);
return nil;
}