comparison src/video/x11/SDL_x11render.c @ 2967:e4a469d6ddab

Implemented SDL_SetWindowIcon(), with translucent icon support under X11.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 02 Jan 2009 17:39:48 +0000
parents 2133d2d300fd
children b36579172f27
comparison
equal deleted inserted replaced
2966:c1e3621ba959 2967:e4a469d6ddab
85 int scanline_pad; 85 int scanline_pad;
86 Window window; 86 Window window;
87 Pixmap pixmaps[3]; 87 Pixmap pixmaps[3];
88 int current_pixmap; 88 int current_pixmap;
89 Drawable drawable; 89 Drawable drawable;
90 SDL_PixelFormat *format; 90 SDL_PixelFormat format;
91 GC gc; 91 GC gc;
92 SDL_DirtyRectList dirty; 92 SDL_DirtyRectList dirty;
93 SDL_bool makedirty; 93 SDL_bool makedirty;
94 } X11_RenderData; 94 } X11_RenderData;
95 95
249 &Amask)) { 249 &Amask)) {
250 SDL_SetError("Unknown display format"); 250 SDL_SetError("Unknown display format");
251 X11_DestroyRenderer(renderer); 251 X11_DestroyRenderer(renderer);
252 return NULL; 252 return NULL;
253 } 253 }
254 data->format = SDL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask); 254 SDL_InitFormat(&data->format, bpp, Rmask, Gmask, Bmask, Amask);
255 if (!data->format) {
256 X11_DestroyRenderer(renderer);
257 return NULL;
258 }
259 255
260 /* Create the drawing context */ 256 /* Create the drawing context */
261 gcv.graphics_exposures = False; 257 gcv.graphics_exposures = False;
262 data->gc = 258 data->gc =
263 XCreateGC(data->display, data->window, GCGraphicsExposures, &gcv); 259 XCreateGC(data->display, data->window, GCGraphicsExposures, &gcv);
581 Uint8 r = renderer->r; 577 Uint8 r = renderer->r;
582 Uint8 g = renderer->g; 578 Uint8 g = renderer->g;
583 Uint8 b = renderer->b; 579 Uint8 b = renderer->b;
584 Uint8 a = renderer->a; 580 Uint8 a = renderer->a;
585 if (premult) 581 if (premult)
586 return SDL_MapRGBA(data->format, ((int) r * (int) a) / 255, 582 return SDL_MapRGBA(&data->format, ((int) r * (int) a) / 255,
587 ((int) g * (int) a) / 255, 583 ((int) g * (int) a) / 255,
588 ((int) b * (int) a) / 255, 255); 584 ((int) b * (int) a) / 255, 255);
589 else 585 else
590 return SDL_MapRGBA(data->format, r, g, b, a); 586 return SDL_MapRGBA(&data->format, r, g, b, a);
591 } 587 }
592 588
593 static int 589 static int
594 X11_RenderPoint(SDL_Renderer * renderer, int x, int y) 590 X11_RenderPoint(SDL_Renderer * renderer, int x, int y)
595 { 591 {
850 for (i = 0; i < SDL_arraysize(data->pixmaps); ++i) { 846 for (i = 0; i < SDL_arraysize(data->pixmaps); ++i) {
851 if (data->pixmaps[i] != None) { 847 if (data->pixmaps[i] != None) {
852 XFreePixmap(data->display, data->pixmaps[i]); 848 XFreePixmap(data->display, data->pixmaps[i]);
853 } 849 }
854 } 850 }
855 if (data->format) {
856 SDL_FreeFormat(data->format);
857 }
858 if (data->gc) { 851 if (data->gc) {
859 XFreeGC(data->display, data->gc); 852 XFreeGC(data->display, data->gc);
860 } 853 }
861 SDL_FreeDirtyRects(&data->dirty); 854 SDL_FreeDirtyRects(&data->dirty);
862 SDL_free(data); 855 SDL_free(data);