X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=e5a1738b4840f59a4b2cc3c31fac267cd4f40d71;hb=909a0a4d74f274b5c05c16cf595b235aa092fc9a;hp=bc29424e6636cc9afefffe2c1d8b35e9cb7a0243;hpb=066b410c0573fe64a1783116daf9d64883e9f03e;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index bc29424e..e5a1738b 100644 --- a/src/init.c +++ b/src/init.c @@ -180,7 +180,6 @@ void InitTileClipmasks() GC copy_clipmask_gc; XGCValues clip_gc_values; unsigned long clip_gc_valuemask; -#endif #if defined(TARGET_X11_NATIVE) static struct @@ -234,7 +233,8 @@ void InitTileClipmasks() { GFX2_SHIELD_ACTIVE, 3 }, { -1, 0 } }; -#endif +#endif /* TARGET_X11_NATIVE */ +#endif /* TARGET_X11 */ int i; @@ -248,13 +248,6 @@ void InitTileClipmasks() To prevent this, create small (tile-sized) mask Pixmaps which will then be set much faster with XSetClipOrigin() and speed things up a lot. */ - /* create graphic context structures needed for clipping */ - clip_gc_values.graphics_exposures = False; - clip_gc_valuemask = GCGraphicsExposures; - copy_clipmask_gc = - XCreateGC(display, pix[PIX_BACK]->clip_mask, - clip_gc_valuemask, &clip_gc_values); - clip_gc_values.graphics_exposures = False; clip_gc_valuemask = GCGraphicsExposures; tile_clip_gc = @@ -268,11 +261,19 @@ void InitTileClipmasks() clip_gc_values.clip_mask = pix[i]->clip_mask; clip_gc_valuemask = GCGraphicsExposures | GCClipMask; pix[i]->stored_clip_gc = XCreateGC(display, window->drawable, - clip_gc_valuemask,&clip_gc_values); + clip_gc_valuemask, &clip_gc_values); } } #if defined(TARGET_X11_NATIVE) + + /* create graphic context structures needed for clipping */ + clip_gc_values.graphics_exposures = False; + clip_gc_valuemask = GCGraphicsExposures; + copy_clipmask_gc = + XCreateGC(display, pix[PIX_BACK]->clip_mask, + clip_gc_valuemask, &clip_gc_values); + /* create only those clipping Pixmaps we really need */ for(i=0; tile_needs_clipping[i].start>=0; i++) { @@ -296,10 +297,39 @@ void InitTileClipmasks() src_x, src_y, TILEX, TILEY, 0, 0); } } -#endif /* TARGET_X11_NATIVE */ XFreeGC(display, copy_clipmask_gc); +#endif /* TARGET_X11_NATIVE */ +#endif /* TARGET_X11 */ +} + +void FreeTileClipmasks() +{ +#if defined(TARGET_X11) + int i; + + for(i=0; istored_clip_gc) + { + XFreeGC(display, pix[i]->stored_clip_gc); + pix[i]->stored_clip_gc = None; + } + } #endif /* TARGET_X11 */ } @@ -346,6 +376,7 @@ void InitGfx() } InitFontInfo(pix[PIX_BIGFONT], pix[PIX_MEDIUMFONT], pix[PIX_SMALLFONT]); + InitTileClipmasks(); } @@ -372,46 +403,19 @@ void ReloadCustomArtwork() { if (artwork.graphics_set_current != artwork.gfx_current->name) { - Bitmap *pix_new[NUM_PICTURES]; int i; ClearRectangle(window, 0, 0, WIN_XSIZE, WIN_YSIZE); - for(i=0; i