Exemple #1
0
int uicolor_set_palette(struct video_canvas_s *c, const palette_t *palette)
{
    unsigned int i;

    uicolor_init_video_colors();

    for (i = 0; i < palette->num_entries; i++) {
        palette_entry_t color = palette->entries[i];
        DWORD color_pixel;
	
	unsigned char *col = (unsigned char *)&color_pixel;
	col[0] = color.red  ;
	col[1] = color.green;
	col[2] = color.blue ;
	video_render_setphysicalcolor(((video_canvas_t*)c)->videoconfig, i,
				      color_pixel, 24);
    }
    return 0;
}
Exemple #2
0
video_canvas_t *video_canvas_create(video_canvas_t *canvas, unsigned int *width, unsigned int *height, int mapped)
{
    int res;
    unsigned int new_width, new_height;
    XGCValues gc_values;

    canvas->depth = x11ui_get_display_depth();

    new_width = *width;
    new_height = *height;

    if (canvas->videoconfig->doublesizex) {
        new_width *= 2;
    }

    if (canvas->videoconfig->doublesizey) {
        new_height *= 2;
    }

#ifdef HAVE_XVIDEO
    /* Request specified video format. */
    canvas->xv_format.id = fourcc;

    if (!find_yuv_port(x11ui_get_display_ptr(), &canvas->xv_port, &canvas->xv_format)) {
        if (canvas->videoconfig->hwscale) {
            log_message(x11video_log, "HW scaling not available");
            canvas->videoconfig->hwscale = 0;
        }
        resources_set_int("HwScalePossible", 0);
    }
#else
    resources_set_int("HwScalePossible", 0);
#endif

    if (video_arch_frame_buffer_alloc(canvas, new_width, new_height) < 0) {
        return NULL;
    }

    res = ui_open_canvas_window(canvas, canvas->viewport->title, new_width, new_height, 1);
    if (res < 0) {
        return NULL;
    }

    if (!_video_gc) {
        _video_gc = video_get_gc(&gc_values);
    }

    canvas->width = new_width;
    canvas->height = new_height;

    ui_finish_canvas(canvas);

    if (canvas->depth > 8) {
        uicolor_init_video_colors();
    }

#ifdef HAVE_XVIDEO
    init_xv_settings(canvas);
#endif

#ifdef HAVE_OPENGL_SYNC
    openGL_sync_init(canvas);
#endif

    return canvas;
}