summaryrefslogtreecommitdiff
path: root/fitz/dev_null.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2011-09-14 17:36:57 +0100
committerRobin Watts <Robin.Watts@artifex.com>2011-09-15 14:50:17 +0100
commitb51ef0eea028c73b6379e832eaa34fff3fbbb927 (patch)
tree1ab685ccd356e7fdc832b2e3322c0486b2670cfb /fitz/dev_null.c
parent89ae81f651bfa112b8e07317eb6983beaf7cb212 (diff)
downloadmupdf-b51ef0eea028c73b6379e832eaa34fff3fbbb927.tar.xz
Add context to mupdf.
Huge pervasive change to lots of files, adding a context for exception handling and allocation. In time we'll move more statics into there. Also fix some for(i = 0; i < function(...); i++) calls.
Diffstat (limited to 'fitz/dev_null.c')
-rw-r--r--fitz/dev_null.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/fitz/dev_null.c b/fitz/dev_null.c
index 508be7e0..394f8374 100644
--- a/fitz/dev_null.c
+++ b/fitz/dev_null.c
@@ -1,13 +1,13 @@
#include "fitz.h"
fz_device *
-fz_new_device(void *user)
+fz_new_device(fz_context *ctx, void *user)
{
- fz_device *dev = fz_malloc(sizeof(fz_device));
- memset(dev, 0, sizeof(fz_device));
+ fz_device *dev = fz_calloc(ctx, 1, sizeof(fz_device));
dev->hints = 0;
dev->flags = 0;
dev->user = user;
+ dev->ctx = ctx;
return dev;
}
@@ -15,8 +15,8 @@ void
fz_free_device(fz_device *dev)
{
if (dev->free_user)
- dev->free_user(dev->user);
- fz_free(dev);
+ dev->free_user(dev);
+ fz_free(dev->ctx, dev);
}
void
@@ -24,7 +24,7 @@ fz_fill_path(fz_device *dev, fz_path *path, int even_odd, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
if (dev->fill_path)
- dev->fill_path(dev->user, path, even_odd, ctm, colorspace, color, alpha);
+ dev->fill_path(dev, path, even_odd, ctm, colorspace, color, alpha);
}
void
@@ -32,21 +32,21 @@ fz_stroke_path(fz_device *dev, fz_path *path, fz_stroke_state *stroke, fz_matrix
fz_colorspace *colorspace, float *color, float alpha)
{
if (dev->stroke_path)
- dev->stroke_path(dev->user, path, stroke, ctm, colorspace, color, alpha);
+ dev->stroke_path(dev, path, stroke, ctm, colorspace, color, alpha);
}
void
fz_clip_path(fz_device *dev, fz_path *path, fz_rect *rect, int even_odd, fz_matrix ctm)
{
if (dev->clip_path)
- dev->clip_path(dev->user, path, rect, even_odd, ctm);
+ dev->clip_path(dev, path, rect, even_odd, ctm);
}
void
fz_clip_stroke_path(fz_device *dev, fz_path *path, fz_rect *rect, fz_stroke_state *stroke, fz_matrix ctm)
{
if (dev->clip_stroke_path)
- dev->clip_stroke_path(dev->user, path, rect, stroke, ctm);
+ dev->clip_stroke_path(dev, path, rect, stroke, ctm);
}
void
@@ -54,7 +54,7 @@ fz_fill_text(fz_device *dev, fz_text *text, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
if (dev->fill_text)
- dev->fill_text(dev->user, text, ctm, colorspace, color, alpha);
+ dev->fill_text(dev, text, ctm, colorspace, color, alpha);
}
void
@@ -62,49 +62,49 @@ fz_stroke_text(fz_device *dev, fz_text *text, fz_stroke_state *stroke, fz_matrix
fz_colorspace *colorspace, float *color, float alpha)
{
if (dev->stroke_text)
- dev->stroke_text(dev->user, text, stroke, ctm, colorspace, color, alpha);
+ dev->stroke_text(dev, text, stroke, ctm, colorspace, color, alpha);
}
void
fz_clip_text(fz_device *dev, fz_text *text, fz_matrix ctm, int accumulate)
{
if (dev->clip_text)
- dev->clip_text(dev->user, text, ctm, accumulate);
+ dev->clip_text(dev, text, ctm, accumulate);
}
void
fz_clip_stroke_text(fz_device *dev, fz_text *text, fz_stroke_state *stroke, fz_matrix ctm)
{
if (dev->clip_stroke_text)
- dev->clip_stroke_text(dev->user, text, stroke, ctm);
+ dev->clip_stroke_text(dev, text, stroke, ctm);
}
void
fz_ignore_text(fz_device *dev, fz_text *text, fz_matrix ctm)
{
if (dev->ignore_text)
- dev->ignore_text(dev->user, text, ctm);
+ dev->ignore_text(dev, text, ctm);
}
void
fz_pop_clip(fz_device *dev)
{
if (dev->pop_clip)
- dev->pop_clip(dev->user);
+ dev->pop_clip(dev);
}
void
fz_fill_shade(fz_device *dev, fz_shade *shade, fz_matrix ctm, float alpha)
{
if (dev->fill_shade)
- dev->fill_shade(dev->user, shade, ctm, alpha);
+ dev->fill_shade(dev, shade, ctm, alpha);
}
void
fz_fill_image(fz_device *dev, fz_pixmap *image, fz_matrix ctm, float alpha)
{
if (dev->fill_image)
- dev->fill_image(dev->user, image, ctm, alpha);
+ dev->fill_image(dev, image, ctm, alpha);
}
void
@@ -112,54 +112,54 @@ fz_fill_image_mask(fz_device *dev, fz_pixmap *image, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
if (dev->fill_image_mask)
- dev->fill_image_mask(dev->user, image, ctm, colorspace, color, alpha);
+ dev->fill_image_mask(dev, image, ctm, colorspace, color, alpha);
}
void
fz_clip_image_mask(fz_device *dev, fz_pixmap *image, fz_rect *rect, fz_matrix ctm)
{
if (dev->clip_image_mask)
- dev->clip_image_mask(dev->user, image, rect, ctm);
+ dev->clip_image_mask(dev, image, rect, ctm);
}
void
fz_begin_mask(fz_device *dev, fz_rect area, int luminosity, fz_colorspace *colorspace, float *bc)
{
if (dev->begin_mask)
- dev->begin_mask(dev->user, area, luminosity, colorspace, bc);
+ dev->begin_mask(dev, area, luminosity, colorspace, bc);
}
void
fz_end_mask(fz_device *dev)
{
if (dev->end_mask)
- dev->end_mask(dev->user);
+ dev->end_mask(dev);
}
void
fz_begin_group(fz_device *dev, fz_rect area, int isolated, int knockout, int blendmode, float alpha)
{
if (dev->begin_group)
- dev->begin_group(dev->user, area, isolated, knockout, blendmode, alpha);
+ dev->begin_group(dev, area, isolated, knockout, blendmode, alpha);
}
void
fz_end_group(fz_device *dev)
{
if (dev->end_group)
- dev->end_group(dev->user);
+ dev->end_group(dev);
}
void
fz_begin_tile(fz_device *dev, fz_rect area, fz_rect view, float xstep, float ystep, fz_matrix ctm)
{
if (dev->begin_tile)
- dev->begin_tile(dev->user, area, view, xstep, ystep, ctm);
+ dev->begin_tile(dev, area, view, xstep, ystep, ctm);
}
void
fz_end_tile(fz_device *dev)
{
if (dev->end_tile)
- dev->end_tile(dev->user);
+ dev->end_tile(dev);
}