static int internal_prepare_rendering(CustomCellRendererFlexi *cr)
{
    if (cr->rendered_type!=RENDER_NONE) return cr->rendered_type;

    if (cr->is_raw)
    {
        internal_format(cr, cr->raw_value, 65536);
    }
    else
    {
        if (a_strlen(cr->mime_type)>2)
        {
            if (strstr(a_strval(cr->mime_type)+2,"image/")!=NULL)
            {
                internal_load_image(cr,a_strval(cr->raw_value),a_strval(cr->mime_type)+2);
            }
            else
            {
                internal_render_error(cr,"Unrecognized mime-type");
            }
        }
        else
        {
            if (a_strlen(cr->alt_text)>0)
            {
                internal_format(cr, cr->alt_text,65536);
            }
            else if (a_strlen(cr->raw_value)>0)
            {
                internal_format(cr, cr->raw_value,256);
            }
        }
    }
    return cr->rendered_type;
}
Esempio n. 2
0
void GraphicsHandler::init(const std::vector<std::string>& graphic_paths) {
    for (auto path : graphic_paths) {
        game_graphics_[path] = internal_load_image(path);
    }
}