aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Rumney2000-09-29 21:21:54 +0000
committerJason Rumney2000-09-29 21:21:54 +0000
commitebbf77eacd2db70a073eb51ab2583f92156f828c (patch)
tree6dd34cdf1a566fdb37f2261582d5b203eaf24fbc
parent9127e20e661969ff6ab5977825a43dbf85f8802a (diff)
downloademacs-ebbf77eacd2db70a073eb51ab2583f92156f828c.tar.gz
emacs-ebbf77eacd2db70a073eb51ab2583f92156f828c.zip
(glyph_struct, cache_bitmap): Cache bitmap data, not GDI object which
is a scarce resource.
-rw-r--r--src/w32bdf.h33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/w32bdf.h b/src/w32bdf.h
index 218cc0331dc..47f3067d290 100644
--- a/src/w32bdf.h
+++ b/src/w32bdf.h
@@ -28,9 +28,29 @@ Boston, MA 02111-1307, USA. */
28#define BDF_SECOND_OFFSET_TABLE 0x80 28#define BDF_SECOND_OFFSET_TABLE 0x80
29#define BDF_SECOND_OFFSET(x) ((x) & 0x7f) 29#define BDF_SECOND_OFFSET(x) ((x) & 0x7f)
30#define BDF_FIRST_OFFSET(x) (((x) >> 8) | (((x) & 0x80) << 1)) 30#define BDF_FIRST_OFFSET(x) (((x) >> 8) | (((x) & 0x80) << 1))
31#define BDF_CODEPOINT_MAX (BDF_FIRST_OFFSET_TABLE * BDF_SECOND_OFFSET_TABLE)
32#define BDF_CODEPOINT_RANGE_COVER_P(x) (((x) >= 0) && ((x) <= BDF_CODEPOINT_MAX))
33
34#define BDF_FONT_CACHE_SIZE 3000
35#define BDF_FONT_CLEAR_SIZE 600
36
37/*
38 GLYPH METRIC (# ... character's reference point)
39 ^
40 y | (urx, ury)
41 | ^ +----------------+
42 a | b| |character | <- font bounding Box
43 x | b| | |
44 i | h| | #(bbox, bboy) |
45 s | v +----------------+
46 | (llx, lly)
47 | <---------------->
48 | bbw
49 +----------------------->
50 origin x axis
51 */
52
31 53
32#define BDF_FONT_CACHE_SIZE 5000
33#define BDF_FONT_CLEAR_SIZE 1000
34 54
35/* Structure of glyph information of one character. */ 55/* Structure of glyph information of one character. */
36typedef struct 56typedef struct
@@ -42,7 +62,8 @@ typedef struct
42typedef struct 62typedef struct
43{ 63{
44 glyph_metric metric; 64 glyph_metric metric;
45 int bitmap_size; /* byte lengh of the following slots */ 65 int row_byte_size; /* size in bytes occupied by one row of the bitmap */
66 int bitmap_size; /* size in bytes of the following slots */
46 unsigned char *bitmap; /* */ 67 unsigned char *bitmap; /* */
47} glyph_struct; 68} glyph_struct;
48 69
@@ -52,7 +73,9 @@ typedef struct
52{ 73{
53 glyph_metric metric; 74 glyph_metric metric;
54 pfont_char psrc; 75 pfont_char psrc;
55 HBITMAP hbmp; 76 int row_byte_size;
77 int bitmap_size;
78 unsigned char *pbmp;
56} cache_bitmap; 79} cache_bitmap;
57 80
58typedef struct fchar 81typedef struct fchar
@@ -69,7 +92,6 @@ typedef struct
69 unsigned char *font; 92 unsigned char *font;
70 unsigned char *seeked; 93 unsigned char *seeked;
71 DWORD size; 94 DWORD size;
72
73 font_char *chtbl[BDF_FIRST_OFFSET_TABLE]; 95 font_char *chtbl[BDF_FIRST_OFFSET_TABLE];
74 int llx, lly, urx, ury; /* Font bounding box */ 96 int llx, lly, urx, ury; /* Font bounding box */
75 97
@@ -87,7 +109,6 @@ typedef struct
87 int pixsz; 109 int pixsz;
88} bdffont; 110} bdffont;
89 111
90
91#define BDF_FILE_SIZE_MAX 256*1024*1024 /* 256Mb */ 112#define BDF_FILE_SIZE_MAX 256*1024*1024 /* 256Mb */
92#define BDF_FONT_FILE(font) (((bdffont*)(font))->filename) 113#define BDF_FONT_FILE(font) (((bdffont*)(font))->filename)
93#define MAKELENDSHORT(c1, c2) (unsigned short)((c1) | ((c2) << 8)) 114#define MAKELENDSHORT(c1, c2) (unsigned short)((c1) | ((c2) << 8))