summaryrefslogtreecommitdiff
path: root/tree
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2004-12-02 13:56:12 +0100
committerTor Andersson <tor@ghostscript.com>2004-12-02 13:56:12 +0100
commit1dfbba0a2142c0786714c1d476fc2736044a02ac (patch)
tree6f07352c4919407aff150d9cb89e2d7415e7f392 /tree
parent5c335f9337724f61c14af143b18f0891c58dbacd (diff)
downloadmupdf-1dfbba0a2142c0786714c1d476fc2736044a02ac.tar.xz
text fill then clip render mode
Diffstat (limited to 'tree')
-rw-r--r--tree/path.c2
-rw-r--r--tree/text.c34
2 files changed, 34 insertions, 2 deletions
diff --git a/tree/path.c b/tree/path.c
index ac070025..b623d25c 100644
--- a/tree/path.c
+++ b/tree/path.c
@@ -25,7 +25,7 @@ fz_newpathnode(fz_pathnode **pathp)
}
fz_error *
-fz_clonepath(fz_pathnode **pathp, fz_pathnode *oldpath)
+fz_clonepathnode(fz_pathnode **pathp, fz_pathnode *oldpath)
{
fz_pathnode *path;
diff --git a/tree/text.c b/tree/text.c
index b94664b5..d88e04ec 100644
--- a/tree/text.c
+++ b/tree/text.c
@@ -5,7 +5,7 @@ fz_newtextnode(fz_textnode **textp, fz_font *font)
{
fz_textnode *text;
- text = *textp = fz_malloc(sizeof(fz_textnode));
+ text = fz_malloc(sizeof(fz_textnode));
if (!text)
return fz_outofmem;
@@ -17,6 +17,38 @@ fz_newtextnode(fz_textnode **textp, fz_font *font)
text->cap = 0;
text->els = nil;
+ *textp = text;
+ return nil;
+}
+
+fz_error *
+fz_clonetextnode(fz_textnode **textp, fz_textnode *oldtext)
+{
+ fz_textnode *text;
+
+ text = *textp = fz_malloc(sizeof(fz_textnode));
+ if (!text)
+ return fz_outofmem;
+
+ fz_initnode((fz_node*)text, FZ_NTEXT);
+
+ text->font = fz_keepfont(oldtext->font);
+ text->trm = oldtext->trm;
+ text->len = oldtext->len;
+ text->cap = oldtext->len;
+ text->els = nil;
+
+ text->els = fz_malloc(sizeof(fz_textel) * text->len);
+ if (!text->els)
+ {
+ fz_dropfont(text->font);
+ fz_free(text);
+ return fz_outofmem;
+ }
+
+ memcpy(text->els, oldtext->els, sizeof(fz_textel) * text->len);
+
+ *textp = text;
return nil;
}