more code

This commit is contained in:
Vincent Wei
2019-03-22 18:33:37 +08:00
parent 452edfa831
commit af8a04570d
9 changed files with 766 additions and 43 deletions

View File

@@ -2495,7 +2495,7 @@ else
fi
if test "$ac_cv_prog_gcc" = "yes"; then
CFLAGS="$CFLAGS -O2 -Wstrict-prototypes -pipe"
CFLAGS="$CFLAGS -O2 -fmax-errors=10 -Wstrict-prototypes -pipe"
fi
if test "x$runtime_mode" = "xths"; then

View File

@@ -9034,12 +9034,11 @@ typedef enum _UCharVOP {
/* same as HarfBuzz */
typedef enum {
GLYPH_RUN_DIR_INVALID = 0,
GLYPH_RUN_DIR_NEUTRAL,
GLYPH_RUN_DIR_WEAK_LTR,
GLYPH_RUN_DIR_WEAK_RTL,
GLYPH_RUN_DIR_LTR = 4,
GLYPH_RUN_DIR_LTR,
GLYPH_RUN_DIR_RTL,
GLYPH_RUN_DIR_TTB,
GLYPH_RUN_DIR_BTT
} GlyphRunDir;
#define GLYPH_GRAVITY_SOUTH 0

View File

@@ -140,7 +140,7 @@ static inline void list_del_init(struct list_head *entry)
* list_empty - tests whether a list is empty
* @head: the list to test.
*/
static inline int list_empty(struct list_head *head)
static inline int list_empty(const struct list_head *head)
{
return head->next == head;
}

View File

@@ -19,7 +19,7 @@ SRC_FILES = gdi.c attr.c clip.c map.c coor.c rect.c \
simple-glyph-renderer.c glyph-shaped.c \
textrunsinfo.c \
shape-glyphs-basic.c shape-glyphs-complex.c \
layout-utils.c layoutinfo.c
layout-utils.c layout-ellipsize.c layoutinfo.c
endif
HDR_FILES = glyph.h drawtext.h mi.h midc.h mistruct.h miwideline.h \

View File

@@ -115,14 +115,14 @@ int __mg_glyph_string_get_width(const GLYPHSTRING *glyphs)
return width;
}
#define LTR(glyph_item) (((glyph_item)->item->el & 1) == 0)
#define LTR(glyph_item) (((glyph_item)->trun->el & 1) == 0)
BOOL __mg_glyph_item_iter_next_cluster (GlyphItemIter *iter)
{
int glyph_index = iter->end_glyph;
GLYPHSTRING *glyphs = iter->glyph_item->glyphs;
GLYPHSTRING *glyphs = iter->glyph_item->gs;
int cluster;
TEXTRUN *item = iter->glyph_item->item;
TEXTRUN *item = iter->glyph_item->trun;
if (LTR (iter->glyph_item)) {
if (glyph_index == glyphs->nr_glyphs)
@@ -184,9 +184,9 @@ BOOL __mg_glyph_item_iter_next_cluster (GlyphItemIter *iter)
BOOL __mg_glyph_item_iter_prev_cluster (GlyphItemIter *iter)
{
int glyph_index = iter->start_glyph;
GLYPHSTRING *glyphs = iter->glyph_item->glyphs;
GLYPHSTRING *glyphs = iter->glyph_item->gs;
int cluster;
TEXTRUN *item = iter->glyph_item->item;
TEXTRUN *item = iter->glyph_item->trun;
if (LTR (iter->glyph_item)) {
if (glyph_index == 0)
@@ -259,9 +259,9 @@ BOOL __mg_glyph_item_iter_init_start (GlyphItemIter *iter,
if (LTR (glyph_item))
iter->end_glyph = 0;
else
iter->end_glyph = glyph_item->glyphs->nr_glyphs - 1;
iter->end_glyph = glyph_item->gs->nr_glyphs - 1;
iter->end_index = glyph_item->item->si;
iter->end_index = glyph_item->trun->si;
iter->end_char = 0;
iter->start_glyph = iter->end_glyph;
@@ -279,12 +279,12 @@ BOOL __mg_glyph_item_iter_init_end (GlyphItemIter *iter,
iter->text = text;
if (LTR (glyph_item))
iter->start_glyph = glyph_item->glyphs->nr_glyphs;
iter->start_glyph = glyph_item->gs->nr_glyphs;
else
iter->start_glyph = -1;
iter->start_index = glyph_item->item->si + glyph_item->item->len;
iter->start_char = glyph_item->item->len;
iter->start_index = glyph_item->trun->si + glyph_item->trun->len;
iter->start_char = glyph_item->trun->len;
iter->end_glyph = iter->start_glyph;
iter->end_index = iter->start_index;
@@ -301,7 +301,7 @@ void __mg_glyph_item_get_logical_widths (const GlyphItem *glyph_item,
BOOL has_cluster;
int dir;
dir = glyph_item->item->el % 2 == 0 ? +1 : -1;
dir = glyph_item->trun->el % 2 == 0 ? +1 : -1;
for (has_cluster = __mg_glyph_item_iter_init_start (&iter, glyph_item, text);
has_cluster;
has_cluster = __mg_glyph_item_iter_next_cluster (&iter))
@@ -311,7 +311,7 @@ void __mg_glyph_item_get_logical_widths (const GlyphItem *glyph_item,
for (glyph_index = iter.start_glyph;
glyph_index != iter.end_glyph;
glyph_index += dir) {
cluster_width += glyph_item->glyphs->glyphs[glyph_index].width;
cluster_width += glyph_item->gs->glyphs[glyph_index].width;
}
num_chars = iter.end_char - iter.start_char;

File diff suppressed because it is too large Load Diff

View File

@@ -82,10 +82,9 @@ struct _LAYOUTLINE {
int si; // the start index in the uchar string
int len; // the length of line (number of uchars)
Uint8 first_line:1; // is first line of the paragraph?
int nr_runs;
Uint8 is_paragraph_start:1;// is first line of the paragraph?
Uint8 resolved_dir:3; // resolved direction of the line
Uint8 all_even:1; // flag indicating all level is even
Uint8 all_odd:1; // flag indicating all level is odd
};
struct _LAYOUTINFO {
@@ -99,19 +98,18 @@ struct _LAYOUTINFO {
struct list_head lines; // the list head of lines
int nr_left_ucs;// the number of chars not laied out.
int nr_left_ucs;// the number of chars not laied out
int nr_lines; // the number of lines
Uint32 persist:1; // persist lines?
Uint32 single_paragraph:1;
Uint32 is_wrapped:1;
Uint32 is_ellipsized:1;
};
typedef struct _GlyphItem GlyphItem;
typedef GLYPHRUN GlyphItem;
typedef struct _GlyphItemIter GlyphItemIter;
struct _GlyphItem {
TEXTRUN *item;
GLYPHSTRING *glyphs;
};
struct _GlyphItemIter {
const GlyphItem *glyph_item;
const Uchar32 *text;
@@ -129,6 +127,8 @@ struct _GlyphItemIter {
extern "C" {
#endif /* __cplusplus */
void __mg_text_run_free(TEXTRUN* trun);
GLYPHSTRING* __mg_glyph_string_new(void);
void __mg_glyph_string_free(GLYPHSTRING* string);
void __mg_glyph_string_set_size(GLYPHSTRING* string, int new_len);
@@ -144,10 +144,15 @@ BOOL __mg_glyph_item_iter_prev_cluster (GlyphItemIter *iter);
BOOL __mg_glyph_item_iter_next_cluster (GlyphItemIter *iter);
void __mg_glyph_item_get_logical_widths(const GlyphItem* glyph_item,
const Uchar32* ucs, int* log_widths);
const Uchar32* ucs, int* log_widths);
void __mg_glyph_item_letter_space (const GlyphItem* glyph_item,
const Uchar32* ucs, const BreakOppo* bos, int letter_spacing);
const Uchar32* ucs, const BreakOppo* bos, int letter_spacing);
BOOL __mg_layout_line_ellipsize(LAYOUTLINE *line, int goal_width);
void __mg_shape_utf8 (const char* text, int len,
const TEXTRUN* trun, GLYPHSTRING* gs);
#ifdef __cplusplus
}

View File

@@ -293,7 +293,7 @@ static void state_add_character(TEXTRUNSTATE *state,
}
state->run->flags = state->centered_baseline ?
GLYPH_FLAG_CENTERED_BASELINE : 0;
TEXTRUN_FLAG_CENTERED_BASELINE : 0;
list_add_tail(&state->run->list, &state->runinfo->truns);
state->runinfo->nr_runs++;

View File

@@ -67,7 +67,8 @@ struct _SHAPINGENGINEINFO {
CB_DESTROY_INSTANCE free;
};
#define GLYPH_FLAG_CENTERED_BASELINE 1
#define TEXTRUN_FLAG_CENTERED_BASELINE 0x01
#define TEXTRUN_FLAG_IS_ELLIPSIS 0x02
struct _TEXTRUN {
struct list_head list;