summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-06-29 11:06:04 +0200
committerTor Andersson <tor.andersson@artifex.com>2016-06-29 11:10:08 +0200
commitc161c5d5864384f42e540e8dcaed1c2cada63da7 (patch)
treebfb8e220e02f5b624f089c0b725b0210b38a6580
parent954e3bb173c3302bf458875e86c49c712f0789d4 (diff)
downloadmupdf-c161c5d5864384f42e540e8dcaed1c2cada63da7.tar.xz
Update examples.
-rw-r--r--docs/example.c6
-rw-r--r--docs/multi-threaded.c8
2 files changed, 7 insertions, 7 deletions
diff --git a/docs/example.c b/docs/example.c
index 231bbaeb..1bf67635 100644
--- a/docs/example.c
+++ b/docs/example.c
@@ -95,7 +95,7 @@ int main(int argc, char **argv)
/* Render page to an RGB pixmap. */
fz_try(ctx)
- pix = fz_new_pixmap_from_page_number(ctx, doc, page_number, &ctm, fz_device_rgb(ctx));
+ pix = fz_new_pixmap_from_page_number(ctx, doc, page_number, &ctm, fz_device_rgb(ctx), 0);
fz_catch(ctx)
{
fprintf(stderr, "cannot render page: %s\n", fz_caught_message(ctx));
@@ -110,13 +110,13 @@ int main(int argc, char **argv)
printf("255\n");
for (y = 0; y < pix->h; ++y)
{
- unsigned char *p = &pix->samples[y * pix->w * pix->n];
+ unsigned char *p = &pix->samples[y * pix->stride];
for (x = 0; x < pix->w; ++x)
{
if (x > 0)
printf(" ");
printf("%3d %3d %3d", p[0], p[1], p[2]);
- p += 4;
+ p += pix->n;
}
printf("\n");
}
diff --git a/docs/multi-threaded.c b/docs/multi-threaded.c
index a8e2d204..6f07b543 100644
--- a/docs/multi-threaded.c
+++ b/docs/multi-threaded.c
@@ -94,7 +94,7 @@ renderer(void *data)
// will render the request area of the page to the pixmap.
fprintf(stderr, "thread at page %d rendering!\n", pagenumber);
- dev = fz_new_draw_device(ctx, pix);
+ dev = fz_new_draw_device(ctx, &fz_identity, pix);
fz_run_display_list(ctx, list, dev, &fz_identity, &bbox, NULL);
fz_drop_device(ctx, dev);
@@ -205,7 +205,7 @@ int main(int argc, char **argv)
// this can safely be used on any other thread as it is
// not bound to a given context.
- list = fz_new_display_list(ctx);
+ list = fz_new_display_list(ctx, &bbox);
// Run the loaded page through a display list device
// to populate the page's display list.
@@ -221,7 +221,7 @@ int main(int argc, char **argv)
// Create a white pixmap using the correct dimensions.
- pix = fz_new_pixmap_with_bbox(ctx, fz_device_rgb(ctx), fz_round_rect(&rbox, &bbox));
+ pix = fz_new_pixmap_with_bbox(ctx, fz_device_rgb(ctx), fz_round_rect(&rbox, &bbox), 0);
fz_clear_pixmap_with_value(ctx, pix, 0xff);
// Populate the data structure to be sent to the
@@ -258,7 +258,7 @@ int main(int argc, char **argv)
// Write the rendered image to a PNG file
- fz_save_pixmap_as_png(ctx, data->pix, filename, 0);
+ fz_save_pixmap_as_png(ctx, data->pix, filename);
// Free the thread's pixmap and display list since
// they were allocated by the main thread above.