summaryrefslogtreecommitdiff
path: root/src/lib/evas/common/evas_text_utils.h
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2013-01-12 08:40:46 +0000
committerCarsten Haitzler <raster@rasterman.com>2013-01-12 08:40:46 +0000
commit440bb7c23ca9bf25165041617d2d1717e0b2584a (patch)
tree55d0a7df6abd6840d1c233bb1396ff42309269bd /src/lib/evas/common/evas_text_utils.h
parent60d31170fb6f29358c0b6429682c2716eb1d07fd (diff)
cut down textprop size a bit... 72 -> 64bytes. if we can wrap
tp->start/len/text_offset/text_len read/wrtie in access funcs. so we can special case where: 1. start == text_offset == 0 && len == text_len == 1 2. start == text_offset == 0 && len == text_len < 65536 3. start == text_offset == 0 && len == text_len < 256 SVN revision: 82692
Diffstat (limited to 'src/lib/evas/common/evas_text_utils.h')
-rw-r--r--src/lib/evas/common/evas_text_utils.h96
1 files changed, 74 insertions, 22 deletions
diff --git a/src/lib/evas/common/evas_text_utils.h b/src/lib/evas/common/evas_text_utils.h
index 36a8895a37..f2f65a396b 100644
--- a/src/lib/evas/common/evas_text_utils.h
+++ b/src/lib/evas/common/evas_text_utils.h
@@ -1,7 +1,11 @@
1#ifndef _EVAS_TEXT_UTILS_H 1#ifndef _EVAS_TEXT_UTILS_H
2# define _EVAS_TEXT_UTILS_H 2# define _EVAS_TEXT_UTILS_H
3 3
4
4typedef struct _Evas_Text_Props Evas_Text_Props; 5typedef struct _Evas_Text_Props Evas_Text_Props;
6// special case props
7typedef struct _Evas_Text_Props_One Evas_Text_Props_One;
8
5typedef struct _Evas_Text_Props_Info Evas_Text_Props_Info; 9typedef struct _Evas_Text_Props_Info Evas_Text_Props_Info;
6typedef struct _Evas_Font_Glyph_Info Evas_Font_Glyph_Info; 10typedef struct _Evas_Font_Glyph_Info Evas_Font_Glyph_Info;
7 11
@@ -29,42 +33,90 @@ struct _Evas_Glyph_Array
29 33
30struct _Evas_Text_Props 34struct _Evas_Text_Props
31{ 35{
36 Evas_Text_Props_Info *info; // 8/4
37 Evas_Glyph_Array *glyphs; // 8/4
38 void *font_instance; // 8/4
32 /* Start and len represent the start offset and the length in the 39 /* Start and len represent the start offset and the length in the
33 * glyphs_info and ot_data fields, they are both internal */ 40 * glyphs_info and ot_data fields, they are both internal */
34 size_t start; 41 // i only wonder if generation needs 32bits... :)
35 size_t len; 42 int generation; // 4
36 size_t text_offset; /* The text offset from the start of the info */ 43// Evas_BiDi_Props bidi; // 4 // bidi.dir == enum
37 size_t text_len; /* The length of the original text */ 44// Evas_Script_Type script; // 4 // enum
38 Evas_BiDi_Props bidi; 45// Eina_Bool changed : 1; // 1
39 Evas_Script_Type script; 46// Eina_Bool prepare : 1;
40 Evas_Text_Props_Info *info; 47// // +3 pad
41 void *font_instance; 48// ** the below saves 8 bytes (72 -> 64 on 64bit)
42 49 Evas_BiDi_Direction bidi_dir : 2; // 2 (enough for values)
43 Evas_Glyph_Array *glyphs; 50 Evas_Script_Type script : 7; // cont (enough for values)
44 51 Eina_Bool changed : 1; // cont (bool)
45 int generation; 52 Eina_Bool prepare : 1; // cont (bool)
46 Eina_Bool changed : 1; 53 // we have space here for at LEAST 5 bits (round up to 2 bytes) but due
47 Eina_Bool prepare : 1; 54 // to common padding we actually can add 5 + 16 (21) more bits for free
55 Eina_Bool szlen_mode : 5; // use 5 of he 21 bits
56// this can go here as the above is nicely aligned....
57 // this is really big... 32 bytes. MOSt of the time the following...
58 // start == text_offset == 0 AND len == text_len == smallish value (8 or
59 // 16 bit is enough to store it most of the time).
60 size_t start; // 8/4
61 size_t len; // 8/4
62 size_t text_offset; // 8/4 /* The text offset from the start of the info */
63 size_t text_len; // 8/4 /* The length of the original text */
64};
65
66#define EVAS_TP_SZLEN_FULL 0
67#define EVAS_TP_SZLEN_ONE 1
68
69// special case textprop for ONE char! should use this for textgrid but
70// we have to modify every bit of code that usea a textprop to go thru a
71// getter or setter etc. etc.
72struct _Evas_Text_Props_One
73{
74 Evas_Text_Props_Info *info; // 8/4
75 Evas_Glyph_Array *glyphs; // 8/4
76 void *font_instance; // 8/4
77 /* Start and len represent the start offset and the length in the
78 * glyphs_info and ot_data fields, they are both internal */
79 // i only wonder if generation needs 32bits... :)
80 int generation; // 4
81// Evas_BiDi_Props bidi; // 4 // bidi.dir == enum
82// Evas_Script_Type script; // 4 // enum
83// Eina_Bool changed : 1; // 1
84// Eina_Bool prepare : 1;
85// // +3 pad
86// ** the below saves 8 bytes (72 -> 64 on 64bit)
87 Evas_BiDi_Direction bidi_dir : 2; // 2 (enough for values)
88 Evas_Script_Type script : 7; // cont (enough for values)
89 Eina_Bool changed : 1; // cont (bool)
90 Eina_Bool prepare : 1; // cont (bool)
91 // we have space here for at LEAST 5 bits (round up to 2 bytes) but due
92 // to common padding we actually can add 5 + 16 (21) more bits for free
93 Eina_Bool szlen_mode : 5; // use 5 of he 21 bits
48}; 94};
49 95
50struct _Evas_Text_Props_Info 96struct _Evas_Text_Props_Info
51{ 97{
52 unsigned int refcount; 98 Evas_Font_Glyph_Info *glyph; // 8/4
53 Evas_Font_Glyph_Info *glyph; 99 Evas_Font_OT_Info *ot; // 8/4
54 Evas_Font_OT_Info *ot; 100 unsigned int refcount; // 4
55}; 101};
56 102
57/* Sorted in visual order when created */ 103/* Sorted in visual order when created */
58struct _Evas_Font_Glyph_Info 104struct _Evas_Font_Glyph_Info
59{ 105{
60 unsigned int index; /* Should conform to FT */ 106 unsigned int index; // 4 /* Should conform to FT */
61 Evas_Coord x_bear; 107#if 1
108 // done with shorts to save space... if we need 32k or bigger glyphs and
109 // relative layout info... worry then.
110 short x_bear, y_bear, width, pen_after; // 8
111#else
112 Evas_Coord x_bear; // 4
62 /* This one is rarely used, only in draw, in which we already get the glyph 113 /* This one is rarely used, only in draw, in which we already get the glyph
63 * so it doesn't really save time. Leaving it here just so no one will 114 * so it doesn't really save time. Leaving it here just so no one will
64 * add it thinking it was accidentally skipped */ 115 * add it thinking it was accidentally skipped */
65 Evas_Coord y_bear; 116 Evas_Coord y_bear; // 4
66 Evas_Coord width; 117 Evas_Coord width; // 4
67 Evas_Coord pen_after; 118 Evas_Coord pen_after; // 4
119#endif
68}; 120};
69 121
70void 122void