summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2004-12-06 18:08:20 +0100
committerTor Andersson <tor@ghostscript.com>2004-12-06 18:08:20 +0100
commitf04ff9cf7f22f9a34f6e9ed1d8159fe67eb2c79d (patch)
treedd43cdef26db51a5ee7edc232b7406721cce2edf /render
parent6162dc43d376fce8906160d51e3ab076d83632aa (diff)
downloadmupdf-f04ff9cf7f22f9a34f6e9ed1d8159fe67eb2c79d.tar.xz
xref parse workaround. font config messing. shade cleanup.
Diffstat (limited to 'render')
-rw-r--r--render/glyphcache.c11
-rw-r--r--render/optunpack.c4
-rw-r--r--render/render.c21
3 files changed, 16 insertions, 20 deletions
diff --git a/render/glyphcache.c b/render/glyphcache.c
index 93b25b4c..9fd4a5a7 100644
--- a/render/glyphcache.c
+++ b/render/glyphcache.c
@@ -1,8 +1,5 @@
#include <fitz.h>
-#define HSUBPIX 5.0
-#define VSUBPIX 5.0
-
typedef struct fz_hash_s fz_hash;
typedef struct fz_key_s fz_key;
typedef struct fz_val_s fz_val;
@@ -321,8 +318,8 @@ fz_renderglyph(fz_glyphcache *arena, fz_glyph *glyph, fz_font *font, int cid, fz
key.b = ctm.b * 65536;
key.c = ctm.c * 65536;
key.d = ctm.d * 65536;
- key.e = (ctm.e - fz_floor(ctm.e)) * HSUBPIX;
- key.f = (ctm.f - fz_floor(ctm.f)) * VSUBPIX;
+ key.e = (ctm.e - fz_floor(ctm.e)) * 256;
+ key.f = (ctm.f - fz_floor(ctm.f)) * 256;
val = hashfind(arena, &key);
if (val)
@@ -339,8 +336,8 @@ fz_renderglyph(fz_glyphcache *arena, fz_glyph *glyph, fz_font *font, int cid, fz
return nil;
}
- ctm.e = fz_floor(ctm.e) + key.e / HSUBPIX;
- ctm.f = fz_floor(ctm.f) + key.f / VSUBPIX;
+ ctm.e = fz_floor(ctm.e) + key.e / 256.0;
+ ctm.f = fz_floor(ctm.f) + key.f / 256.0;
error = font->render(glyph, font, cid, ctm);
if (error)
diff --git a/render/optunpack.c b/render/optunpack.c
index 1c77a787..0885c293 100644
--- a/render/optunpack.c
+++ b/render/optunpack.c
@@ -8,8 +8,8 @@ typedef unsigned char byte;
static void decodetile(fz_pixmap *pix, int skip, float *decode)
{
- int min[FZ_MAXCOLORS];
- int max[FZ_MAXCOLORS];
+ int min[FZ_MAXCOLORS];
+ int max[FZ_MAXCOLORS];
int sub[FZ_MAXCOLORS];
int useless = 1;
byte *p = pix->samples;
diff --git a/render/render.c b/render/render.c
index 41c0d3c1..0b08e158 100644
--- a/render/render.c
+++ b/render/render.c
@@ -5,6 +5,10 @@
#define DEBUG(args...)
#endif
+#define QUANT(x,a) (((int)((x) * (a))) / (a))
+#define HSUBPIX 5.0
+#define VSUBPIX 5.0
+
#define FNONE 0
#define FOVER 1
#define FRGB 4
@@ -227,12 +231,12 @@ static void drawglyph(fz_renderer *gc, fz_pixmap *dst, fz_glyph *src, int xorig,
int sx1 = src->w;
int sy1 = src->h;
- if (x1 < dx0 || x0 >= dx1) return;
- if (y1 < dy0 || y0 >= dy1) return;
+ if (x1 <= dx0 || x0 >= dx1) return;
+ if (y1 <= dy0 || y0 >= dy1) return;
if (x0 < dx0) { sx0 += dx0 - x0; x0 = dx0; }
if (y0 < dy0) { sy0 += dy0 - y0; y0 = dy0; }
- if (x1 >= dx1) { sx1 += dx1 - x1; x1 = dx1; }
- if (y1 >= dy1) { sy1 += dy1 - y1; y1 = dy1; }
+ if (x1 > dx1) { sx1 += dx1 - x1; x1 = dx1; }
+ if (y1 > dy1) { sy1 += dy1 - y1; y1 = dy1; }
sp = src->samples + (sy0 * src->w + sx0);
dp = dst->samples + ((y0 - dst->y) * dst->w + (x0 - dst->x)) * dst->n;
@@ -282,11 +286,6 @@ text->trm.a, text->trm.b, text->trm.c, text->trm.d);
if (fz_isemptyrect(clip))
return nil;
- clip.min.x ++;
- clip.min.y ++;
- clip.max.x ++;
- clip.max.y ++;
-
if (!(gc->flag & FOVER))
{
error = fz_newpixmapwithrect(&gc->dest, clip, 1);
@@ -305,8 +304,8 @@ text->trm.a, text->trm.b, text->trm.c, text->trm.d);
trm = fz_concat(tm, ctm);
x = fz_floor(trm.e);
y = fz_floor(trm.f);
- trm.e = (trm.e - fz_floor(trm.e));
- trm.f = (trm.f - fz_floor(trm.f));
+ trm.e = QUANT(trm.e - fz_floor(trm.e), HSUBPIX);
+ trm.f = QUANT(trm.f - fz_floor(trm.f), VSUBPIX);
error = fz_renderglyph(gc->cache, &glyph, text->font, cid, trm);
if (error)