[poppler] splash/SplashFont.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Wed Feb 13 11:58:25 PST 2008
splash/SplashFont.cc | 48 ++++++++++++++++++++++++++++--------------------
1 file changed, 28 insertions(+), 20 deletions(-)
New commits:
commit ce17383e0ed21770b471e88f25046a64a23e7e45
Author: Albert Astals Cid <aacid at kde.org>
Date: Wed Feb 13 20:56:39 2008 +0100
Yet another fix for buggy documents, do not use the cache if the cache could not be created because it ought to be too big
Fixes http://bugs.kde.org/show_bug.cgi?id=157777
diff --git a/splash/SplashFont.cc b/splash/SplashFont.cc
index 9c34599..490de3b 100644
--- a/splash/SplashFont.cc
+++ b/splash/SplashFont.cc
@@ -167,27 +167,35 @@ GBool SplashFont::getGlyph(int c, int xFrac, int yFrac,
size = ((bitmap2.w + 7) >> 3) * bitmap2.h;
}
p = NULL; // make gcc happy
- for (j = 0; j < cacheAssoc; ++j) {
- if ((cacheTags[i+j].mru & 0x7fffffff) == cacheAssoc - 1) {
- cacheTags[i+j].mru = 0x80000000;
- cacheTags[i+j].c = c;
- cacheTags[i+j].xFrac = (short)xFrac;
- cacheTags[i+j].yFrac = (short)yFrac;
- cacheTags[i+j].x = bitmap2.x;
- cacheTags[i+j].y = bitmap2.y;
- cacheTags[i+j].w = bitmap2.w;
- cacheTags[i+j].h = bitmap2.h;
- p = cache + (i+j) * glyphSize;
- memcpy(p, bitmap2.data, size);
- } else {
- ++cacheTags[i+j].mru;
- }
+ if (cacheAssoc == 0)
+ {
+ // we had problems on the malloc of the cache, so ignore it
+ *bitmap = bitmap2;
}
- *bitmap = bitmap2;
- bitmap->data = p;
- bitmap->freeData = gFalse;
- if (bitmap2.freeData) {
- gfree(bitmap2.data);
+ else
+ {
+ for (j = 0; j < cacheAssoc; ++j) {
+ if ((cacheTags[i+j].mru & 0x7fffffff) == cacheAssoc - 1) {
+ cacheTags[i+j].mru = 0x80000000;
+ cacheTags[i+j].c = c;
+ cacheTags[i+j].xFrac = (short)xFrac;
+ cacheTags[i+j].yFrac = (short)yFrac;
+ cacheTags[i+j].x = bitmap2.x;
+ cacheTags[i+j].y = bitmap2.y;
+ cacheTags[i+j].w = bitmap2.w;
+ cacheTags[i+j].h = bitmap2.h;
+ p = cache + (i+j) * glyphSize;
+ memcpy(p, bitmap2.data, size);
+ } else {
+ ++cacheTags[i+j].mru;
+ }
+ }
+ *bitmap = bitmap2;
+ bitmap->data = p;
+ bitmap->freeData = gFalse;
+ if (bitmap2.freeData) {
+ gfree(bitmap2.data);
+ }
}
return gTrue;
}
More information about the poppler
mailing list