Gitweb links:
...log
http://git.netsurf-browser.org/libnspdf.git/shortlog/d2d566cf50835d728f1c65ebeccf914b43d81867
...commit
http://git.netsurf-browser.org/libnspdf.git/commit/d2d566cf50835d728f1c65ebeccf914b43d81867
...tree
http://git.netsurf-browser.org/libnspdf.git/tree/d2d566cf50835d728f1c65ebeccf914b43d81867
The branch, master has been updated
via d2d566cf50835d728f1c65ebeccf914b43d81867 (commit)
from d8835327fcc498795ac66bed330e741cef12ce29 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/libnspdf.git/commit/?id=d2d566cf50835d728f1c65ebeccf914b43d81867
commit d2d566cf50835d728f1c65ebeccf914b43d81867
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
extend path operations in render
diff --git a/src/page.c b/src/page.c
index 984228b..3b2371b 100644
--- a/src/page.c
+++ b/src/page.c
@@ -330,6 +330,13 @@ render_operation_h(struct graphics_state *gs)
}
static inline nspdferror
+render_operation_n(struct graphics_state *gs)
+{
+ gs->path_idx = 0;
+ return NSPDFERROR_OK;
+}
+
+static inline nspdferror
gsc_to_device(struct graphics_state_color * gsc, uint32_t *c_out)
{
uint32_t c;
@@ -402,6 +409,50 @@ render_operation_f(struct graphics_state *gs, struct
nspdf_render_ctx* render_ct
return NSPDFERROR_OK;
}
+static inline nspdferror
+render_operation_b(struct graphics_state *gs, struct nspdf_render_ctx*
render_ctx)
+{
+ struct nspdf_style style;
+ style.stroke_type = NSPDF_OP_TYPE_SOLID;
+ style.stroke_width = gs->param_stack[gs->param_stack_idx].line_width;
+ gsc_to_device(&gs->param_stack[gs->param_stack_idx].stroke.colour,
&style.stroke_colour);
+
+ style.fill_type = NSPDF_OP_TYPE_SOLID;
+ gsc_to_device(&gs->param_stack[gs->param_stack_idx].other.colour,
&style.fill_colour);
+
+ gs->path[gs->path_idx++] = NSPDF_PATH_CLOSE;
+
+ render_ctx->path(&style,
+ gs->path,
+ gs->path_idx,
+ gs->param_stack[gs->param_stack_idx].ctm,
+ render_ctx->ctx);
+ gs->path_idx = 0;
+
+ return NSPDFERROR_OK;
+}
+
+static inline nspdferror
+render_operation_B(struct graphics_state *gs, struct nspdf_render_ctx*
render_ctx)
+{
+ struct nspdf_style style;
+ style.stroke_type = NSPDF_OP_TYPE_SOLID;
+ style.stroke_width = gs->param_stack[gs->param_stack_idx].line_width;
+ gsc_to_device(&gs->param_stack[gs->param_stack_idx].stroke.colour,
&style.stroke_colour);
+
+ style.fill_type = NSPDF_OP_TYPE_SOLID;
+ gsc_to_device(&gs->param_stack[gs->param_stack_idx].other.colour,
&style.fill_colour);
+
+ render_ctx->path(&style,
+ gs->path,
+ gs->path_idx,
+ gs->param_stack[gs->param_stack_idx].ctm,
+ render_ctx->ctx);
+ gs->path_idx = 0;
+
+ return NSPDFERROR_OK;
+}
+
static inline nspdferror
render_operation_S(struct graphics_state *gs, struct nspdf_render_ctx*
render_ctx)
@@ -762,11 +813,17 @@ nspdf_page_render(struct nspdf_doc *doc,
case CONTENT_OP_f:
case CONTENT_OP_f_:
+ res = render_operation_f(&gs, render_ctx);
+ break;
+
case CONTENT_OP_B:
case CONTENT_OP_B_:
+ res = render_operation_B(&gs, render_ctx);
+ break;
+
case CONTENT_OP_b:
case CONTENT_OP_b_:
- res = render_operation_f(&gs, render_ctx);
+ res = render_operation_b(&gs, render_ctx);
break;
case CONTENT_OP_s:
@@ -778,6 +835,10 @@ nspdf_page_render(struct nspdf_doc *doc,
res = render_operation_S(&gs, render_ctx);
break;
+ case CONTENT_OP_n: /* end path */
+ res = render_operation_n(&gs);
+ break;
+
/* graphics state operations */
case CONTENT_OP_w: /* line width */
res = render_operation_w(operation, &gs);
-----------------------------------------------------------------------
Summary of changes:
src/page.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 62 insertions(+), 1 deletion(-)
diff --git a/src/page.c b/src/page.c
index 984228b..3b2371b 100644
--- a/src/page.c
+++ b/src/page.c
@@ -330,6 +330,13 @@ render_operation_h(struct graphics_state *gs)
}
static inline nspdferror
+render_operation_n(struct graphics_state *gs)
+{
+ gs->path_idx = 0;
+ return NSPDFERROR_OK;
+}
+
+static inline nspdferror
gsc_to_device(struct graphics_state_color * gsc, uint32_t *c_out)
{
uint32_t c;
@@ -402,6 +409,50 @@ render_operation_f(struct graphics_state *gs, struct
nspdf_render_ctx* render_ct
return NSPDFERROR_OK;
}
+static inline nspdferror
+render_operation_b(struct graphics_state *gs, struct nspdf_render_ctx*
render_ctx)
+{
+ struct nspdf_style style;
+ style.stroke_type = NSPDF_OP_TYPE_SOLID;
+ style.stroke_width = gs->param_stack[gs->param_stack_idx].line_width;
+ gsc_to_device(&gs->param_stack[gs->param_stack_idx].stroke.colour,
&style.stroke_colour);
+
+ style.fill_type = NSPDF_OP_TYPE_SOLID;
+ gsc_to_device(&gs->param_stack[gs->param_stack_idx].other.colour,
&style.fill_colour);
+
+ gs->path[gs->path_idx++] = NSPDF_PATH_CLOSE;
+
+ render_ctx->path(&style,
+ gs->path,
+ gs->path_idx,
+ gs->param_stack[gs->param_stack_idx].ctm,
+ render_ctx->ctx);
+ gs->path_idx = 0;
+
+ return NSPDFERROR_OK;
+}
+
+static inline nspdferror
+render_operation_B(struct graphics_state *gs, struct nspdf_render_ctx*
render_ctx)
+{
+ struct nspdf_style style;
+ style.stroke_type = NSPDF_OP_TYPE_SOLID;
+ style.stroke_width = gs->param_stack[gs->param_stack_idx].line_width;
+ gsc_to_device(&gs->param_stack[gs->param_stack_idx].stroke.colour,
&style.stroke_colour);
+
+ style.fill_type = NSPDF_OP_TYPE_SOLID;
+ gsc_to_device(&gs->param_stack[gs->param_stack_idx].other.colour,
&style.fill_colour);
+
+ render_ctx->path(&style,
+ gs->path,
+ gs->path_idx,
+ gs->param_stack[gs->param_stack_idx].ctm,
+ render_ctx->ctx);
+ gs->path_idx = 0;
+
+ return NSPDFERROR_OK;
+}
+
static inline nspdferror
render_operation_S(struct graphics_state *gs, struct nspdf_render_ctx*
render_ctx)
@@ -762,11 +813,17 @@ nspdf_page_render(struct nspdf_doc *doc,
case CONTENT_OP_f:
case CONTENT_OP_f_:
+ res = render_operation_f(&gs, render_ctx);
+ break;
+
case CONTENT_OP_B:
case CONTENT_OP_B_:
+ res = render_operation_B(&gs, render_ctx);
+ break;
+
case CONTENT_OP_b:
case CONTENT_OP_b_:
- res = render_operation_f(&gs, render_ctx);
+ res = render_operation_b(&gs, render_ctx);
break;
case CONTENT_OP_s:
@@ -778,6 +835,10 @@ nspdf_page_render(struct nspdf_doc *doc,
res = render_operation_S(&gs, render_ctx);
break;
+ case CONTENT_OP_n: /* end path */
+ res = render_operation_n(&gs);
+ break;
+
/* graphics state operations */
case CONTENT_OP_w: /* line width */
res = render_operation_w(operation, &gs);
--
PDF Manipulation Library
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org