X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Flibgame%2Ftext.c;h=48974eb74bb67ef34865e4cd0bccd71bee8ef379;hb=a19647f4f265bb23bc249aa28a10d1d47a6179e1;hp=1a5dcefe2a543122fef6521c260b0d863065ff2f;hpb=14089dac2cbe56e563863e1e5adb8847944fd262;p=rocksndiamonds.git diff --git a/src/libgame/text.c b/src/libgame/text.c index 1a5dcefe..48974eb7 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -25,6 +25,7 @@ #define NUM_FONT_COLORS 4 #define NUM_FONT_CHARS (FONT_LINES_PER_FONT * FONT_CHARS_PER_LINE) +#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND) static GC tile_clip_gc = None; static Pixmap tile_clipmask[NUM_FONTS][NUM_FONT_COLORS][NUM_FONT_CHARS]; @@ -40,7 +41,6 @@ static struct static void InitFontClipmasks() { -#if defined(TARGET_X11_NATIVE) static boolean clipmasks_initialized = FALSE; boolean fonts_initialized = TRUE; XGCValues clip_gc_values; @@ -105,9 +105,8 @@ static void InitFontClipmasks() XFreeGC(display, copy_clipmask_gc); clipmasks_initialized = TRUE; - -#endif /* TARGET_X11_NATIVE */ } +#endif /* TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND */ void InitFontInfo(Bitmap *bitmap_initial, Bitmap *bitmap_big, Bitmap *bitmap_medium, @@ -119,7 +118,9 @@ void InitFontInfo(Bitmap *bitmap_initial, font.bitmap_small = bitmap_small; font.bitmap_tile = bitmap_tile; +#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND) InitFontClipmasks(); +#endif } int getFontWidth(int font_size, int font_type) @@ -291,10 +292,10 @@ void DrawTextExt(DrawBuffer *bitmap, int x, int y, char *text, else if (mask_mode == FONT_MASKED) { /* clear font character background */ - BlitBitmap(gfx.background_bitmap, bitmap, - dest_x - gfx.real_sx, dest_y - gfx.real_sy, - font_width, font_height, dest_x, dest_y); + ClearRectangleOnBackground(bitmap, dest_x, dest_y, + font_width, font_height); +#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND) /* use special font tile clipmasks, if available */ if (font_size == FS_BIG || font_size == FS_MEDIUM) { @@ -310,6 +311,10 @@ void DrawTextExt(DrawBuffer *bitmap, int x, int y, char *text, SetClipOrigin(font_bitmap, font_bitmap->stored_clip_gc, dest_x - src_x, dest_y - src_y); } +#else + SetClipOrigin(font_bitmap, font_bitmap->stored_clip_gc, + dest_x - src_x, dest_y - src_y); +#endif BlitBitmapMasked(font_bitmap, bitmap, src_x, src_y, font_width, font_height, dest_x, dest_y);