micro-optimisation

This commit is contained in:
Chris Young 2015-02-28 12:41:50 +00:00
parent 5f72dd2f0f
commit df25135a4d
2 changed files with 11 additions and 10 deletions

View File

@ -549,7 +549,7 @@ static struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle
return NULL;
}
static int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp,
static inline int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp,
uint16 *char1, uint16 *char2, uint32 x, uint32 y, uint32 emwidth, bool aa)
{
struct GlyphMap *glyph;
@ -562,12 +562,12 @@ static int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp,
struct BulletBase *BulletBase = ofont->BulletBase;
#endif
if ((*char1 >= 0xD800) && (*char1 <= 0xDBFF)) {
if (__builtin_expect(((*char1 >= 0xD800) && (*char1 <= 0xDBFF)), 0)) {
/* We don't support UTF-16 surrogates yet, so just return. */
return 0;
}
if ((*char2 >= 0xD800) && (*char2 <= 0xDBFF)) {
if (__builtin_expect(((*char2 >= 0xD800) && (*char2 <= 0xDBFF)), 0)) {
/* Don't attempt to kern a UTF-16 surrogate */
*char2 = 0;
}
@ -640,7 +640,7 @@ static int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp,
return char_advance;
}
static int32 ami_font_width_glyph(struct OutlineFont *ofont,
static inline int32 ami_font_width_glyph(struct OutlineFont *ofont,
const uint16 *char1, const uint16 *char2, uint32 emwidth)
{
int32 char_advance = 0;
@ -653,12 +653,12 @@ static int32 ami_font_width_glyph(struct OutlineFont *ofont,
struct BulletBase *BulletBase = ofont->BulletBase;
#endif
if ((*char1 >= 0xD800) && (*char1 <= 0xDBFF)) {
if (__builtin_expect(((*char1 >= 0xD800) && (*char1 <= 0xDBFF)), 0)) {
/* We don't support UTF-16 surrogates yet, so just return. */
return 0;
}
if ((*char2 >= 0xD800) && (*char2 <= 0xDBFF)) {
if (__builtin_expect(((*char2 >= 0xD800) && (*char2 <= 0xDBFF)), 0)) {
/* Don't attempt to kern a UTF-16 surrogate */
skip_c2 = true;
}

View File

@ -202,11 +202,12 @@ bool amiga_bm_nsfont_split(const plot_font_style_t *fstyle,
co--;
}
*char_offset = co;
if(string && co) {
if(co > 0) {
*actual_x = TextLength(glob->rp, string, co);
*char_offset = co;
} else {
*actual_x = 0;
*actual_x = x;
*char_offset = length;
}
ami_font_bm_close(bmfont);