- fixed an horrible FT_LOAD_RENDER bug that returned empty bitmaps !! - tested and fixed the image cache object. I'm performing a few more checks though, and we'll call the cache sub-system completed !!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index a9c9344..582a0a5 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1019,31 +1019,34 @@
slot->advance.y = 0;
}
- /* now, transform the glyph image when needed */
- if ( face->transform_flags && !( load_flags & FT_LOAD_NO_RECURSE ) )
+ if ((load_flags & FT_LOAD_NO_RECURSE)==0)
{
- /* get renderer */
- FT_Renderer renderer = ft_lookup_glyph_renderer( slot );
+ /* now, transform the glyph image when needed */
+ if ( face->transform_flags )
+ {
+ /* get renderer */
+ FT_Renderer renderer = ft_lookup_glyph_renderer( slot );
- if ( renderer )
- error = renderer->clazz->transform_glyph( renderer, slot,
- &face->transform_matrix,
- &face->transform_delta );
- /* transform advance */
- FT_Vector_Transform( &slot->advance, &face->transform_matrix );
- }
+ if ( renderer )
+ error = renderer->clazz->transform_glyph( renderer, slot,
+ &face->transform_matrix,
+ &face->transform_delta );
+ /* transform advance */
+ FT_Vector_Transform( &slot->advance, &face->transform_matrix );
+ }
- /* do we need to render the image now? */
- if ( !error &&
- slot->format != ft_glyph_format_bitmap &&
- slot->format != ft_glyph_format_composite &&
- load_flags & FT_LOAD_RENDER )
- {
- error = FT_Render_Glyph( slot,
- ( load_flags & FT_LOAD_MONOCHROME )
- ? ft_render_mode_mono
- : ft_render_mode_normal );
+ /* do we need to render the image now? */
+ if ( !error &&
+ slot->format != ft_glyph_format_bitmap &&
+ slot->format != ft_glyph_format_composite &&
+ load_flags & FT_LOAD_RENDER )
+ {
+ error = FT_Render_Glyph( slot,
+ ( load_flags & FT_LOAD_MONOCHROME )
+ ? ft_render_mode_mono
+ : ft_render_mode_normal );
+ }
}
Exit:
diff --git a/src/cache/ftcimage.c b/src/cache/ftcimage.c
index 217b11c..a27ed33 100644
--- a/src/cache/ftcimage.c
+++ b/src/cache/ftcimage.c
@@ -2,7 +2,7 @@
/* */
/* ftcimage.c */
/* */
-/* XXX */
+/* FreeType Image Cache */
/* */
/* Copyright 2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
@@ -448,6 +448,9 @@
error = FTC_ImageNode_New( queue->cache, &inode );
if (error)
goto Exit;
+
+ /* set the glyph and queue indices in the image node */
+ FTC_IMAGENODE_SET_INDICES( inode, glyph_index, queue->index );
error = queue->clazz->init_image( queue, inode );
if (error)
@@ -456,9 +459,6 @@
goto Exit;
}
- /* set the glyph and queue indices in the image node */
- FTC_IMAGENODE_SET_INDICES( inode, glyph_index, queue->index );
-
/* insert the node at the start of our bucket list */
FT_List_Insert( bucket, (FT_ListNode)inode );
@@ -606,6 +606,7 @@
goto Exit;
cache->manager = manager;
+ cache->memory = manager->library->memory;
cache->max_bytes = max_bytes;
error = FT_Lru_New( &ftc_image_queue_lru_class,
@@ -653,11 +654,20 @@
FTC_ImageNode inode;
*aglyph = 0;
- error = FT_Lru_Lookup( cache->queues_lru,
- (FT_LruKey)desc,
- (FT_Pointer*)&queue );
- if (error)
- goto Exit;
+ queue = cache->last_queue;
+ if ( !queue ||
+ queue->descriptor.size.face_id != desc->size.face_id ||
+ queue->descriptor.size.pix_width != desc->size.pix_width ||
+ queue->descriptor.size.pix_height != desc->size.pix_height ||
+ queue->descriptor.image_type != desc->image_type )
+ {
+ error = FT_Lru_Lookup( cache->queues_lru,
+ (FT_LruKey)desc,
+ (FT_Pointer*)&queue );
+ cache->last_queue = queue;
+ if (error)
+ goto Exit;
+ }
error = FTC_Image_Queue_Lookup_Node( queue, gindex, &inode );
if (error)
diff --git a/src/cache/ftcimage.h b/src/cache/ftcimage.h
index 11eb96e..5ebc79f 100644
--- a/src/cache/ftcimage.h
+++ b/src/cache/ftcimage.h
@@ -2,7 +2,7 @@
/* */
/* ftcimage.h */
/* */
-/* XXX */
+/* FreeType Image Cache */
/* */
/* Copyright 2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
@@ -82,8 +82,10 @@
FT_ULong max_bytes; /* maximum size of cache in bytes */
FT_ULong num_bytes; /* current size of cache in bytes */
- FT_Lru queues_lru; /* static queues lru list */
+ FT_Lru queues_lru; /* static queues lru list */
FT_ListRec glyphs_lru; /* global lru list of glyph images */
+
+ FTC_Image_Queue last_queue; /* small cache */
} FTC_Image_CacheRec;
diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c
index d0c4399..03ee3b8 100644
--- a/src/cache/ftcmanag.c
+++ b/src/cache/ftcmanag.c
@@ -2,7 +2,7 @@
/* */
/* ftcmanag.h */
/* */
-/* XXX */
+/* FreeType Cache Manager */
/* */
/* Copyright 2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
@@ -317,7 +317,7 @@
if ( !error )
{
/* select the size as the current one for this face */
- face->size = *asize;
+ face->size = size;
if (asize)
*asize = size;
diff --git a/src/cache/ftcmanag.h b/src/cache/ftcmanag.h
index fa28eb6..c2f68af 100644
--- a/src/cache/ftcmanag.h
+++ b/src/cache/ftcmanag.h
@@ -2,7 +2,7 @@
/* */
/* ftcmanag.h */
/* */
-/* XXX */
+/* FreeType Cache Manager */
/* */
/* Copyright 2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
diff --git a/src/cache/ftlru.c b/src/cache/ftlru.c
index 1c1cc61..3302bc1 100644
--- a/src/cache/ftlru.c
+++ b/src/cache/ftlru.c
@@ -2,7 +2,7 @@
/* */
/* ftlru.c */
/* */
-/* XXX */
+/* simple LRU list-cache */
/* */
/* Copyright 2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
diff --git a/src/cache/ftlru.h b/src/cache/ftlru.h
index 300b72a..175136b 100644
--- a/src/cache/ftlru.h
+++ b/src/cache/ftlru.h
@@ -2,7 +2,7 @@
/* */
/* ftlru.h */
/* */
-/* XXX */
+/* simple LRU list-cache */
/* */
/* Copyright 2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */