summaryrefslogtreecommitdiff
path: root/source/fitz
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-11-10 10:23:41 +0000
committerRobin Watts <robin.watts@artifex.com>2016-11-10 13:07:03 +0000
commitc88fa306d0b23403aa70ada5a2f03817b85c5d7a (patch)
tree647651a941513ef42dfada697a6fe4844d6293a0 /source/fitz
parent4e1a495e671cf423663a0c36a35fc4acc7d44754 (diff)
downloadmupdf-c88fa306d0b23403aa70ada5a2f03817b85c5d7a.tar.xz
Add minimum line width configuration option.
Diffstat (limited to 'source/fitz')
-rw-r--r--source/fitz/draw-device.c6
-rw-r--r--source/fitz/draw-edge.c19
2 files changed, 25 insertions, 0 deletions
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c
index d6d17782..d6d8c38e 100644
--- a/source/fitz/draw-device.c
+++ b/source/fitz/draw-device.c
@@ -350,10 +350,13 @@ fz_draw_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path, const
float aa_level = 2.0f/(fz_graphics_aa_level(ctx)+2);
fz_draw_state *state = &dev->stack[dev->top];
fz_colorspace *model = state->dest->colorspace;
+ float mlw = fz_graphics_min_line_width(ctx);
if (colorspace == NULL && model != NULL)
fz_throw(ctx, FZ_ERROR_GENERIC, "color destination requires source color");
+ if (mlw > aa_level)
+ aa_level = mlw;
if (linewidth * expansion < aa_level)
linewidth = aa_level / expansion;
if (flatness < 0.001f)
@@ -500,7 +503,10 @@ fz_draw_clip_stroke_path(fz_context *ctx, fz_device *devp, const fz_path *path,
fz_draw_state *state = &dev->stack[dev->top];
fz_colorspace *model;
float aa_level = 2.0f/(fz_graphics_aa_level(ctx)+2);
+ float mlw = fz_graphics_min_line_width(ctx);
+ if (mlw > aa_level)
+ aa_level = mlw;
if (linewidth * expansion < aa_level)
linewidth = aa_level / expansion;
if (flatness < 0.001f)
diff --git a/source/fitz/draw-edge.c b/source/fitz/draw-edge.c
index 0da45331..4465d90a 100644
--- a/source/fitz/draw-edge.c
+++ b/source/fitz/draw-edge.c
@@ -23,6 +23,7 @@ struct fz_aa_context_s
int scale;
int bits;
int text_bits;
+ float min_line_width;
};
void fz_new_aa_context(fz_context *ctx)
@@ -205,6 +206,24 @@ fz_set_graphics_aa_level(fz_context *ctx, int level)
#endif
}
+void
+fz_set_graphics_min_line_width(fz_context *ctx, float min_line_width)
+{
+ if (!ctx || !ctx->aa)
+ return;
+
+ ctx->aa->min_line_width = min_line_width;
+}
+
+float
+fz_graphics_min_line_width(fz_context *ctx)
+{
+ if (!ctx || !ctx->aa)
+ return 0;
+
+ return ctx->aa->min_line_width;
+}
+
/*
* Global Edge List -- list of straight path segments for scan conversion
*