50
53
extern GtkWidget *canvas;
51
54
extern GdkGC *app_gc;
53
inline void GDK_PUTIMAGE(Display *d, GdkPixmap *drawable, GdkGC *gc,
56
inline void GDK_PUTIMAGE(Display *d, GdkWindow *drawable, GdkGC *gc,
54
57
GdkImage *image, int src_x, int src_y,
55
58
int dest_x, int dest_y,
56
59
unsigned int width, unsigned int height, int b,
57
video_frame_buffer_t *fb, video_canvas_t *c)
60
void *dummy, video_canvas_t *c)
59
gdk_draw_image(drawable, gc, fb->gdk_image, src_x, src_y,
62
gdk_draw_image(drawable, gc, c->gdk_image, src_x, src_y,
60
63
dest_x, dest_y, width, height);
61
gdk_window_clear_area(c->emuwindow->window, dest_x, dest_y, width, height);
66
int video_frame_buffer_alloc(video_frame_buffer_t **ip, unsigned int width,
68
int video_arch_frame_buffer_alloc(video_canvas_t *canvas, unsigned int width,
69
int sizeofpixel = sizeof(PIXEL);
72
video_frame_buffer_t *i;
74
#ifdef VIDEO_REMOVE_2X
79
i = (video_frame_buffer_t *)xmalloc(sizeof(video_frame_buffer_t));
80
memset(i, 0, sizeof(video_frame_buffer_t));
83
if (sizeof(PIXEL2) != sizeof(PIXEL) * 2 ||
84
sizeof(PIXEL4) != sizeof(PIXEL) * 4) {
85
log_error(gnomevideo_log, "PIXEL2 / PIXEL4 typedefs have wrong size.");
74
canvas->xv_image = NULL;
76
if (canvas->videoconfig->hwscale
77
&& (canvas->videoconfig->rendermode == VIDEO_RENDER_PAL_1X1
78
|| canvas->videoconfig->rendermode == VIDEO_RENDER_PAL_2X2))
80
Display *display = x11ui_get_display_ptr();
81
XShmSegmentInfo* shminfo = use_mitshm ? &canvas->xshm_info : NULL;
83
if (!find_yuv_port(display, &canvas->xv_port, &canvas->xv_format)) {
87
if (!(canvas->xv_image = create_yuv_image(display, canvas->xv_port, canvas->xv_format, width, height, shminfo))) {
91
/* Copy data for architecture independent rendering. */
92
canvas->yuv_image.width = canvas->xv_image->width;
93
canvas->yuv_image.height = canvas->xv_image->height;
94
canvas->yuv_image.data_size = canvas->xv_image->data_size;
95
canvas->yuv_image.num_planes = canvas->xv_image->num_planes;
96
canvas->yuv_image.pitches = canvas->xv_image->pitches;
97
canvas->yuv_image.offsets = canvas->xv_image->offsets;
98
canvas->yuv_image.data = canvas->xv_image->data;
100
log_message(gnomevideo_log,
101
_("Successfully initialized using XVideo (%dx%d %.4s)."),
102
width, height, canvas->xv_format.label);
89
depth = ui_get_display_depth();
91
/* Round up to 32-bit boundary. */
92
width = (width + 3) & ~0x3;
94
#if VIDEO_DISPLAY_DEPTH == 0
95
/* sizeof(PIXEL) is not always what we are using. I guess this should
96
be checked from the XImage but I'm lazy... */
103
107
typ = GDK_IMAGE_FASTEST;
104
i->gdk_image = gdk_image_new(typ, visual, width, height);
105
i->x_image = GDK_IMAGE_XIMAGE(i->gdk_image);
108
canvas->gdk_image = gdk_image_new(typ, visual, width, height);
109
canvas->x_image = GDK_IMAGE_XIMAGE(canvas->gdk_image);
110
if (!canvas->x_image)
111
/* reusage of existing canvas, so reallocate drawable */
112
dangling_canvas->width = width;
113
dangling_canvas->height = height;
114
/* destroy the old pixmap here ?
115
e.g. gdk_window_destroy(GDK_WINDOW(i->canvas->drawable));
118
i->canvas = dangling_canvas;
119
ui_finish_canvas(dangling_canvas);
120
dangling_canvas = NULL;
125
113
video_refresh_func((void (*)(void))GDK_PUTIMAGE);
127
if (video_convert_func(i, depth, width, height) < 0)
130
115
log_message(gnomevideo_log,
131
116
_("Successfully initialized video."));
133
#ifdef USE_XF86_DGA2_EXTENSIONS
134
fullscreen_set_framebuffer(i);
139
121
GC video_get_gc(void *not_used)
144
void video_add_handlers(ui_window_t w)
126
void video_add_handlers(video_canvas_t *canvas)