示例#1
0
static unsigned int
ewl_text_context_hash_key(const void *ctx)
{
        unsigned int key;
        const Ewl_Text_Context *tx = ctx;

        DENTER_FUNCTION(DLEVEL_STABLE);

        key = 0;
        if (tx->font)
                key ^= ecore_str_hash(tx->font);
        if (tx->font_source)
                key ^= ecore_str_hash(tx->font_source);
        key ^= (tx->size << 5);
        key ^= (tx->styles << 7);
        /* FIXME: we need to add align and wrap, to prevent degenerate
         * hash values */

#define COLOR_HASH(c) (c.r << 24 | c.g << 16 | c.b << 8 | c.a)
        key ^= COLOR_HASH(tx->color);
        key ^= (COLOR_HASH(tx->style_colors.bg) << 1);
        key ^= (COLOR_HASH(tx->style_colors.glow) >> 1);
        key ^= (COLOR_HASH(tx->style_colors.outline) << 3);
        key ^= (COLOR_HASH(tx->style_colors.shadow) >> 3);
        key ^= (COLOR_HASH(tx->style_colors.strikethrough) << 5);
        key ^= (COLOR_HASH(tx->style_colors.underline) >> 5);
        key ^= (COLOR_HASH(tx->style_colors.double_underline) << 7);

        DRETURN_INT(key, DLEVEL_STABLE);
}
示例#2
0
文件: sngd.cpp 项目: mew-cx/osgtoy
static int hash_by_rgb(color_item *cp)
/* hash by color's RGB value */
{
    return(COLOR_HASH(cp->r, cp->g, cp->b));
}