mirror of
https://github.com/moparisthebest/hexchat
synced 2024-11-22 09:12:22 -05:00
Remove XFT, SHM, and MMX
This commit is contained in:
parent
61b58fd5be
commit
ef73a89139
100
configure.ac
100
configure.ac
@ -41,17 +41,14 @@ AH_VERBATIM([HEXCHATSHAREDIR],[#undef HEXCHATSHAREDIR])
|
||||
AH_VERBATIM([SOCKS],[#undef SOCKS])
|
||||
AH_VERBATIM([USE_MSPROXY],[#undef USE_MSPROXY])
|
||||
AH_VERBATIM([USE_LIBPROXY],[#undef USE_LIBPROXY])
|
||||
AH_VERBATIM([USE_SHM],[#undef USE_SHM])
|
||||
AH_VERBATIM([USE_GTKSPELL],[#undef USE_GTKSPELL])
|
||||
AH_VERBATIM([USE_LIBSEXY],[#undef USE_LIBSEXY])
|
||||
AH_VERBATIM([HAVE_ISO_CODES],[#undef HAVE_ISO_CODES])
|
||||
AH_VERBATIM([USE_LIBNOTIFY],[#undef USE_LIBNOTIFY])
|
||||
AH_VERBATIM([USE_LIBCANBERRA],[#undef USE_LIBCANBERRA])
|
||||
AH_VERBATIM([USE_IPV6],[#undef USE_IPV6])
|
||||
AH_VERBATIM([USE_MMX],[#undef USE_MMX])
|
||||
AH_VERBATIM([USE_OPENSSL],[#undef USE_OPENSSL])
|
||||
AH_VERBATIM([USE_PLUGIN],[#undef USE_PLUGIN])
|
||||
AH_VERBATIM([USE_XFT],[#undef USE_XFT])
|
||||
AH_VERBATIM([USE_XLIB],[#undef USE_XLIB])
|
||||
AH_VERBATIM([USE_SIGACTION],[#undef USE_SIGACTION])
|
||||
AH_VERBATIM([USING_FREEBSD],[#undef USING_FREEBSD])
|
||||
@ -91,10 +88,6 @@ AC_ARG_ENABLE(ipv6,
|
||||
[AS_HELP_STRING([--disable-ipv6],[disable IPv6])],
|
||||
ipv6=$enableval, ipv6=yes)
|
||||
|
||||
AC_ARG_ENABLE(xft,
|
||||
[AS_HELP_STRING([--enable-xft],[enable use of Xft directly (default: no)])],
|
||||
xft=$enableval, xft=no)
|
||||
|
||||
AC_ARG_ENABLE(openssl,
|
||||
[AS_HELP_STRING([--enable-openssl[=PATH]],[enable use of openSSL])],
|
||||
openssl=$enableval, openssl=yes)
|
||||
@ -156,15 +149,6 @@ AC_ARG_ENABLE(libcanberra,
|
||||
[AS_HELP_STRING([--disable-libcanberra],[disable libcanberra support])],
|
||||
libcanberra=$enableval, libcanberra=yes)
|
||||
|
||||
|
||||
AC_ARG_ENABLE(mmx,
|
||||
[AS_HELP_STRING([--disable-mmx],[disable MMX assembly routines])],
|
||||
mmx=$enableval, mmx=yes)
|
||||
|
||||
AC_ARG_ENABLE(shm,
|
||||
[AS_HELP_STRING([--enable-shm],[enable use of XShm for fast tinting (default: no)])],
|
||||
shm=$enableval, shm=no)
|
||||
|
||||
AC_ARG_ENABLE(spell,
|
||||
[AS_HELP_STRING([--enable-spell=type],[enable spelling type: none static libsexy gtkspell])],
|
||||
spell=$enableval, spell=libsexy)
|
||||
@ -230,26 +214,6 @@ fi
|
||||
GUI_LIBS="$GUI_LIBS $GTK_LIBS"
|
||||
GUI_CFLAGS="$GUI_CFLAGS $GTK_CFLAGS -DG_DISABLE_SINGLE_INCLUDES -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES"
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** XFT **************************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
if test "$xft" = yes; then
|
||||
if $PKG_CONFIG xft --exists; then
|
||||
GUI_CFLAGS="$GUI_CFLAGS `$PKG_CONFIG xft --cflags`"
|
||||
GUI_LIBS="$GUI_LIBS `$PKG_CONFIG xft --libs`"
|
||||
else
|
||||
xft=no
|
||||
oldCPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $GTK_CFLAGS"
|
||||
AC_CHECK_HEADERS(X11/Xft/Xft.h, xft=yes)
|
||||
CPPFLAGS=$oldCPPFLAGS
|
||||
fi
|
||||
if test "$xft" = yes; then
|
||||
AC_DEFINE(USE_XFT)
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** XLIB *************************************************************
|
||||
dnl *********************************************************************
|
||||
@ -261,8 +225,6 @@ if test "$xlib" = yes; then
|
||||
else
|
||||
AC_CHECK_LIB(X11, XSetWMHints)
|
||||
fi
|
||||
else
|
||||
shm=no
|
||||
fi
|
||||
|
||||
dnl *********************************************************************
|
||||
@ -681,61 +643,6 @@ if test "x$ntlm" = "xyes" ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** XShm *************************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
if test "$shm" = yes; then
|
||||
oldl=$LIBS
|
||||
oldc=$CPPFLAGS
|
||||
LIBS="$LIBS `$PKG_CONFIG --libs-only-L xft`"
|
||||
CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags-only-I xft`"
|
||||
shm=no
|
||||
AC_CHECK_LIB(Xext, XShmAttach, shm=yes)
|
||||
if test "$shm" = yes; then
|
||||
shm=no
|
||||
AC_CHECK_HEADERS(sys/ipc.h, shm=yes)
|
||||
if test "$shm" = yes; then
|
||||
shm=no
|
||||
AC_CHECK_HEADERS(sys/shm.h, shm=yes)
|
||||
fi
|
||||
fi
|
||||
|
||||
LIBS=$oldl
|
||||
if test "$shm" = yes; then
|
||||
GUI_LIBS="$GUI_LIBS `$PKG_CONFIG --libs-only-L xft` -lX11 -lXext"
|
||||
AC_DEFINE(USE_SHM)
|
||||
else
|
||||
CPPFLAGS=$oldc
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** MMX **************************************************************
|
||||
dnl *********************************************************************
|
||||
|
||||
dnl we don't need mmx on *this* machine, just i386, because
|
||||
dnl it's checked at runtime.
|
||||
if test "$mmx" = "yes"; then
|
||||
case $host_cpu in
|
||||
i386|i486|i586|i686|i786|k6|k7)
|
||||
mmx=yes
|
||||
;;
|
||||
*)
|
||||
mmx=no
|
||||
esac
|
||||
if test "$system" = "OpenBSD"; then
|
||||
dnl openbsd fails because mmx_cmod doesn't prefix its symbols with underscore.
|
||||
dnl xtext.o: Undefined symbol `_shade_ximage_15_mmx' referenced from text segment
|
||||
mmx=no
|
||||
fi
|
||||
if test "$mmx" = "yes"; then
|
||||
AC_DEFINE(USE_MMX)
|
||||
fi
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(USE_MMX, test "$mmx" = "yes")
|
||||
|
||||
dnl *********************************************************************
|
||||
dnl ** GCC FLAGS ********************************************************
|
||||
dnl *********************************************************************
|
||||
@ -956,13 +863,6 @@ echo GTK+ interface ........ : $gtkfe
|
||||
echo Text interface ........ : $textfe
|
||||
echo Theme manager ......... : $theme_manager
|
||||
echo
|
||||
echo MMX tinting ........... : $mmx
|
||||
echo XShm tinting .......... : $shm
|
||||
if test "$xft" = no; then
|
||||
echo Text backend .......... : Pango
|
||||
else
|
||||
echo Text backend .......... : Xft
|
||||
fi
|
||||
echo OpenSSL support ....... : $openssl
|
||||
echo D-Bus support ......... : $dbus
|
||||
echo libnotify support ..... : $libnotify
|
||||
|
@ -9,14 +9,10 @@ hexchat_LDADD = ../common/libhexchatcommon.a $(GUI_LIBS)
|
||||
EXTRA_DIST = \
|
||||
ascii.h banlist.h chanlist.h chanview.h chanview-tabs.c \
|
||||
chanview-tree.c custom-list.h editlist.h fe-gtk.h fkeys.h gtkutil.h joind.h \
|
||||
maingui.h menu.h mmx_cmod.S mmx_cmod.h notifygui.h palette.h pixmaps.h \
|
||||
maingui.h menu.h notifygui.h palette.h pixmaps.h \
|
||||
plugin-tray.h plugingui.c plugingui.h rawlog.h sexy-iso-codes.h \
|
||||
sexy-spell-entry.h sexy-marshal.h textgui.h urlgrab.h userlistgui.h xtext.h
|
||||
|
||||
if USE_MMX
|
||||
mmx_cmod_S = mmx_cmod.S
|
||||
endif
|
||||
|
||||
if DO_PLUGIN
|
||||
plugingui_c = plugingui.c
|
||||
endif
|
||||
@ -28,6 +24,6 @@ endif
|
||||
|
||||
hexchat_SOURCES = ascii.c banlist.c chanlist.c chanview.c custom-list.c \
|
||||
dccgui.c editlist.c fe-gtk.c fkeys.c gtkutil.c ignoregui.c joind.c menu.c \
|
||||
maingui.c $(mmx_cmod_S) notifygui.c palette.c pixmaps.c plugin-tray.c $(plugingui_c) \
|
||||
maingui.c notifygui.c palette.c pixmaps.c plugin-tray.c $(plugingui_c) \
|
||||
rawlog.c servlistgui.c setup.c $(sexy_spell) textgui.c \
|
||||
urlgrab.c userlistgui.c xtext.c
|
||||
|
@ -110,7 +110,6 @@
|
||||
<ClInclude Include="joind.h" />
|
||||
<ClInclude Include="maingui.h" />
|
||||
<ClInclude Include="menu.h" />
|
||||
<ClInclude Include="mmx_cmod.h" />
|
||||
<ClInclude Include="notifygui.h" />
|
||||
<ClInclude Include="palette.h" />
|
||||
<ClInclude Include="pixmaps.h" />
|
||||
|
@ -51,9 +51,6 @@
|
||||
<ClInclude Include="menu.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="mmx_cmod.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="notifygui.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -1,530 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 1997-2001, Michael Jennings
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies of the Software, its documentation and marketing & publicity
|
||||
* materials, and acknowledgment shall be given in the documentation, materials
|
||||
* and software packages that this Software was used.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* MMX routines for tinting XImages written by Willem Monsuwe <willem@stack.nl> */
|
||||
|
||||
/* Function calling conventions:
|
||||
* shade_ximage_xx(void *data, int bpl, int w, int h, int rm, int gm, int bm);
|
||||
*/
|
||||
|
||||
#define data 8(%ebp)
|
||||
#define bpl 12(%ebp)
|
||||
#define w 16(%ebp)
|
||||
#define h 20(%ebp)
|
||||
#define rm 24(%ebp)
|
||||
#define gm 28(%ebp)
|
||||
#define bm 32(%ebp)
|
||||
|
||||
#ifdef UNDERSCORE_SYMBOLS /* need this to link with msvc */
|
||||
#define SHADE_XIMAGE_15 _shade_ximage_15_mmx
|
||||
#define SHADE_XIMAGE_16 _shade_ximage_16_mmx
|
||||
#define SHADE_XIMAGE_32 _shade_ximage_32_mmx
|
||||
#define HAVE_MMX _have_mmx
|
||||
#else
|
||||
#define SHADE_XIMAGE_15 shade_ximage_15_mmx
|
||||
#define SHADE_XIMAGE_16 shade_ximage_16_mmx
|
||||
#define SHADE_XIMAGE_32 shade_ximage_32_mmx
|
||||
#define HAVE_MMX have_mmx
|
||||
#endif
|
||||
|
||||
.globl SHADE_XIMAGE_15
|
||||
.globl SHADE_XIMAGE_16
|
||||
.globl SHADE_XIMAGE_32
|
||||
.globl HAVE_MMX
|
||||
|
||||
.bss
|
||||
.text
|
||||
.align 8
|
||||
|
||||
#define ENTER \
|
||||
pushl %ebp ;\
|
||||
movl %esp, %ebp ;\
|
||||
pushl %ebx ;\
|
||||
pushl %ecx ;\
|
||||
pushl %edx ;\
|
||||
pushl %edi ;\
|
||||
pushl %esi ;\
|
||||
movl data, %esi ;\
|
||||
movl w, %ebx ;\
|
||||
movl h, %edx
|
||||
|
||||
#define LEAVE \
|
||||
4: ;\
|
||||
emms ;\
|
||||
popl %esi ;\
|
||||
popl %edi ;\
|
||||
popl %edx ;\
|
||||
popl %ecx ;\
|
||||
popl %ebx ;\
|
||||
movl %ebp, %esp ;\
|
||||
popl %ebp ;\
|
||||
ret
|
||||
|
||||
|
||||
SHADE_XIMAGE_15:
|
||||
ENTER
|
||||
|
||||
leal -6(%esi, %ebx, 2), %esi
|
||||
negl %ebx
|
||||
jz 5f
|
||||
|
||||
/* Setup multipliers */
|
||||
movd rm, %mm5
|
||||
movd gm, %mm6
|
||||
movd bm, %mm7
|
||||
punpcklwd %mm5, %mm5 /* 00 00 00 00 rm rm rm rm */
|
||||
punpcklwd %mm6, %mm6 /* 00 00 00 00 gm gm gm gm */
|
||||
punpcklwd %mm7, %mm7 /* 00 00 00 00 bm bm bm bm */
|
||||
punpckldq %mm5, %mm5 /* rm rm rm rm rm rm rm rm */
|
||||
punpckldq %mm6, %mm6 /* gm gm gm gm gm gm gm gm */
|
||||
punpckldq %mm7, %mm7 /* bm bm bm bm bm bm bm bm */
|
||||
|
||||
cmpl $256, rm
|
||||
jg shade_ximage_15_mmx_saturate
|
||||
cmpl $256, gm
|
||||
jg shade_ximage_15_mmx_saturate
|
||||
cmpl $256, bm
|
||||
jg shade_ximage_15_mmx_saturate
|
||||
|
||||
1: movl %ebx, %ecx
|
||||
addl $3, %ecx
|
||||
jns 3f
|
||||
2:
|
||||
movq (%esi, %ecx, 2), %mm0
|
||||
|
||||
movq %mm0, %mm1 /* rg gb */
|
||||
movq %mm0, %mm2 /* rg gb */
|
||||
psrlw $5, %mm1 /* 0r rg */
|
||||
psrlw $10, %mm0 /* 00 0r */
|
||||
psllw $11, %mm2 /* b0 00 */
|
||||
psllw $11, %mm1 /* g0 00 */
|
||||
psllw $8, %mm0 /* 0r 00 */
|
||||
psrlw $3, %mm1 /* 0g 00 */
|
||||
psrlw $3, %mm2 /* 0b 00 */
|
||||
|
||||
pmulhw %mm5, %mm0 /* 00 0r */
|
||||
pmulhw %mm6, %mm1 /* 00 0g */
|
||||
pmulhw %mm7, %mm2 /* 00 0b */
|
||||
|
||||
psllw $10, %mm0 /* r0 00 */
|
||||
psllw $5, %mm1 /* 0g g0 */
|
||||
por %mm2, %mm0 /* r0 0b */
|
||||
por %mm1, %mm0 /* rg gb */
|
||||
|
||||
movq %mm0, (%esi, %ecx, 2)
|
||||
|
||||
addl $4, %ecx
|
||||
js 2b
|
||||
jmp 4f
|
||||
3:
|
||||
movw (%esi, %ecx, 2), %ax
|
||||
movd %eax, %mm0
|
||||
|
||||
movq %mm0, %mm1 /* rg gb */
|
||||
movq %mm0, %mm2 /* rg gb */
|
||||
psrlw $5, %mm1 /* 0r rg */
|
||||
psrlw $10, %mm0 /* 00 0r */
|
||||
psllw $11, %mm2 /* b0 00 */
|
||||
psllw $11, %mm1 /* g0 00 */
|
||||
psllw $8, %mm0 /* 0r 00 */
|
||||
psrlw $3, %mm1 /* 0g 00 */
|
||||
psrlw $3, %mm2 /* 0b 00 */
|
||||
|
||||
pmulhw %mm5, %mm0 /* 00 0r */
|
||||
pmulhw %mm6, %mm1 /* 00 0g */
|
||||
pmulhw %mm7, %mm2 /* 00 0b */
|
||||
|
||||
psllw $10, %mm0 /* r0 00 */
|
||||
psllw $5, %mm1 /* 0g g0 */
|
||||
por %mm2, %mm0 /* r0 0b */
|
||||
por %mm1, %mm0 /* rg gb */
|
||||
|
||||
movd %mm0, %eax
|
||||
movw %ax, (%esi, %ecx, 2)
|
||||
|
||||
incl %ecx
|
||||
4:
|
||||
cmpl $2, %ecx
|
||||
jng 3b
|
||||
|
||||
addl bpl, %esi
|
||||
decl %edx
|
||||
jnz 1b
|
||||
5:
|
||||
LEAVE
|
||||
|
||||
|
||||
shade_ximage_15_mmx_saturate:
|
||||
|
||||
pcmpeqw %mm3, %mm3
|
||||
psllw $5, %mm3 /* ff e0 ff e0 ff e0 ff e0 */
|
||||
|
||||
1: movl %ebx, %ecx
|
||||
addl $3, %ecx
|
||||
jns 3f
|
||||
2:
|
||||
movq (%esi, %ecx, 2), %mm0
|
||||
|
||||
movq %mm0, %mm1 /* rg gb */
|
||||
movq %mm0, %mm2 /* rg gb */
|
||||
psrlw $5, %mm1 /* 0r rg */
|
||||
psrlw $10, %mm0 /* 00 0r */
|
||||
psllw $11, %mm2 /* b0 00 */
|
||||
psllw $11, %mm1 /* g0 00 */
|
||||
psllw $8, %mm0 /* 0r 00 */
|
||||
psrlw $3, %mm1 /* 0g 00 */
|
||||
psrlw $3, %mm2 /* 0b 00 */
|
||||
|
||||
pmulhw %mm5, %mm0 /* xx xr */
|
||||
pmulhw %mm6, %mm1 /* xx xg */
|
||||
pmulhw %mm7, %mm2 /* xx xb */
|
||||
|
||||
/* Saturate upper */
|
||||
paddusw %mm3, %mm0 /* ff er */
|
||||
paddusw %mm3, %mm1 /* ff eg */
|
||||
paddusw %mm3, %mm2 /* ff eb */
|
||||
|
||||
psubw %mm3, %mm0 /* 00 0r */
|
||||
psubw %mm3, %mm1 /* 00 0g */
|
||||
psubw %mm3, %mm2 /* 00 0b */
|
||||
|
||||
psllw $10, %mm0 /* r0 00 */
|
||||
psllw $5, %mm1 /* 0g g0 */
|
||||
por %mm2, %mm0 /* r0 0b */
|
||||
por %mm1, %mm0 /* rg gb */
|
||||
|
||||
movq %mm0, (%esi, %ecx, 2)
|
||||
|
||||
addl $4, %ecx
|
||||
js 2b
|
||||
jmp 4f
|
||||
3:
|
||||
movw (%esi, %ecx, 2), %ax
|
||||
movd %eax, %mm0
|
||||
|
||||
movq %mm0, %mm1 /* rg gb */
|
||||
movq %mm0, %mm2 /* rg gb */
|
||||
psrlw $5, %mm1 /* 0r rg */
|
||||
psrlw $10, %mm0 /* 00 0r */
|
||||
psllw $11, %mm2 /* b0 00 */
|
||||
psllw $11, %mm1 /* g0 00 */
|
||||
psllw $8, %mm0 /* 0r 00 */
|
||||
psrlw $3, %mm1 /* 0g 00 */
|
||||
psrlw $3, %mm2 /* 0b 00 */
|
||||
|
||||
pmulhw %mm5, %mm0 /* xx xr */
|
||||
pmulhw %mm6, %mm1 /* xx xg */
|
||||
pmulhw %mm7, %mm2 /* xx xb */
|
||||
|
||||
/* Saturate upper */
|
||||
paddusw %mm3, %mm0 /* ff er */
|
||||
paddusw %mm3, %mm1 /* ff eg */
|
||||
paddusw %mm3, %mm2 /* ff eb */
|
||||
|
||||
psubw %mm3, %mm0 /* 00 0r */
|
||||
psubw %mm3, %mm1 /* 00 0g */
|
||||
psubw %mm3, %mm2 /* 00 0b */
|
||||
|
||||
psllw $10, %mm0 /* r0 00 */
|
||||
psllw $5, %mm1 /* 0g g0 */
|
||||
por %mm2, %mm0 /* r0 0b */
|
||||
por %mm1, %mm0 /* rg gb */
|
||||
|
||||
movd %mm0, %eax
|
||||
movw %ax, (%esi, %ecx, 2)
|
||||
|
||||
incl %ecx
|
||||
4:
|
||||
cmpl $2, %ecx
|
||||
jng 3b
|
||||
|
||||
addl bpl, %esi
|
||||
decl %edx
|
||||
jnz 1b
|
||||
5:
|
||||
LEAVE
|
||||
|
||||
|
||||
SHADE_XIMAGE_16:
|
||||
ENTER
|
||||
|
||||
leal -6(%esi, %ebx, 2), %esi
|
||||
negl %ebx
|
||||
jz 5f
|
||||
|
||||
/* Setup multipliers */
|
||||
movd rm, %mm5
|
||||
movd gm, %mm6
|
||||
movd bm, %mm7
|
||||
punpcklwd %mm5, %mm5 /* 00 00 00 00 rm rm rm rm */
|
||||
punpcklwd %mm6, %mm6 /* 00 00 00 00 gm gm gm gm */
|
||||
punpcklwd %mm7, %mm7 /* 00 00 00 00 bm bm bm bm */
|
||||
punpckldq %mm5, %mm5 /* rm rm rm rm rm rm rm rm */
|
||||
punpckldq %mm6, %mm6 /* gm gm gm gm gm gm gm gm */
|
||||
punpckldq %mm7, %mm7 /* bm bm bm bm bm bm bm bm */
|
||||
|
||||
cmpl $256, rm
|
||||
jg shade_ximage_16_mmx_saturate
|
||||
cmpl $256, gm
|
||||
jg shade_ximage_16_mmx_saturate
|
||||
cmpl $256, bm
|
||||
jg shade_ximage_16_mmx_saturate
|
||||
|
||||
1: movl %ebx, %ecx
|
||||
addl $3, %ecx
|
||||
jns 3f
|
||||
2:
|
||||
movq (%esi, %ecx, 2), %mm0
|
||||
|
||||
movq %mm0, %mm1 /* rg gb */
|
||||
movq %mm0, %mm2 /* rg gb */
|
||||
psrlw $5, %mm1 /* 0r rg */
|
||||
psrlw $11, %mm0 /* 00 0r */
|
||||
psllw $11, %mm2 /* b0 00 */
|
||||
psllw $10, %mm1 /* g0 00 */
|
||||
psllw $8, %mm0 /* 0r 00 */
|
||||
psrlw $2, %mm1 /* 0g 00 */
|
||||
psrlw $3, %mm2 /* 0b 00 */
|
||||
|
||||
pmulhw %mm5, %mm0 /* 00 0r */
|
||||
pmulhw %mm6, %mm1 /* 00 0g */
|
||||
pmulhw %mm7, %mm2 /* 00 0b */
|
||||
|
||||
psllw $11, %mm0 /* r0 00 */
|
||||
psllw $5, %mm1 /* 0g g0 */
|
||||
por %mm2, %mm0 /* r0 0b */
|
||||
por %mm1, %mm0 /* rg gb */
|
||||
|
||||
movq %mm0, (%esi, %ecx, 2)
|
||||
|
||||
addl $4, %ecx
|
||||
js 2b
|
||||
jmp 4f
|
||||
3:
|
||||
movw (%esi, %ecx, 2), %ax
|
||||
movd %eax, %mm0
|
||||
|
||||
movq %mm0, %mm1 /* rg gb */
|
||||
movq %mm0, %mm2 /* rg gb */
|
||||
psrlw $5, %mm1 /* 0r rg */
|
||||
psrlw $11, %mm0 /* 00 0r */
|
||||
psllw $11, %mm2 /* b0 00 */
|
||||
psllw $10, %mm1 /* g0 00 */
|
||||
psllw $8, %mm0 /* 0r 00 */
|
||||
psrlw $2, %mm1 /* 0g 00 */
|
||||
psrlw $3, %mm2 /* 0b 00 */
|
||||
|
||||
pmulhw %mm5, %mm0 /* 00 0r */
|
||||
pmulhw %mm6, %mm1 /* 00 0g */
|
||||
pmulhw %mm7, %mm2 /* 00 0b */
|
||||
|
||||
psllw $11, %mm0 /* r0 00 */
|
||||
psllw $5, %mm1 /* 0g g0 */
|
||||
por %mm2, %mm0 /* r0 0b */
|
||||
por %mm1, %mm0 /* rg gb */
|
||||
|
||||
movd %mm0, %eax
|
||||
movw %ax, (%esi, %ecx, 2)
|
||||
|
||||
incl %ecx
|
||||
4:
|
||||
cmpl $2, %ecx
|
||||
jng 3b
|
||||
|
||||
addl bpl, %esi
|
||||
decl %edx
|
||||
jnz 1b
|
||||
5:
|
||||
LEAVE
|
||||
|
||||
|
||||
shade_ximage_16_mmx_saturate:
|
||||
|
||||
pcmpeqw %mm3, %mm3
|
||||
movq %mm3, %mm4
|
||||
psllw $5, %mm3 /* ff e0 ff e0 ff e0 ff e0 */
|
||||
psllw $6, %mm4 /* ff c0 ff c0 ff c0 ff c0 */
|
||||
|
||||
1: movl %ebx, %ecx
|
||||
addl $3, %ecx
|
||||
jns 3f
|
||||
2:
|
||||
movq (%esi, %ecx, 2), %mm0
|
||||
|
||||
movq %mm0, %mm1 /* rg gb */
|
||||
movq %mm0, %mm2 /* rg gb */
|
||||
psrlw $5, %mm1 /* 0r rg */
|
||||
psrlw $11, %mm0 /* 00 0r */
|
||||
psllw $11, %mm2 /* b0 00 */
|
||||
psllw $10, %mm1 /* g0 00 */
|
||||
psllw $8, %mm0 /* 0r 00 */
|
||||
psrlw $2, %mm1 /* 0g 00 */
|
||||
psrlw $3, %mm2 /* 0b 00 */
|
||||
|
||||
pmulhw %mm5, %mm0 /* xx xr */
|
||||
pmulhw %mm6, %mm1 /* xx xg */
|
||||
pmulhw %mm7, %mm2 /* xx xb */
|
||||
|
||||
/* Saturate upper */
|
||||
paddusw %mm3, %mm0 /* ff er */
|
||||
paddusw %mm4, %mm1 /* ff cg */
|
||||
paddusw %mm3, %mm2 /* ff eb */
|
||||
|
||||
psubw %mm4, %mm1 /* 00 0g */
|
||||
psubw %mm3, %mm2 /* 00 0b */
|
||||
|
||||
psllw $11, %mm0 /* r0 00 */
|
||||
psllw $5, %mm1 /* 0g g0 */
|
||||
por %mm2, %mm0 /* r0 0b */
|
||||
por %mm1, %mm0 /* rg gb */
|
||||
|
||||
movq %mm0, (%esi, %ecx, 2)
|
||||
|
||||
addl $4, %ecx
|
||||
js 2b
|
||||
jmp 4f
|
||||
3:
|
||||
movw (%esi, %ecx, 2), %ax
|
||||
movd %eax, %mm0
|
||||
|
||||
movq %mm0, %mm1 /* rg gb */
|
||||
movq %mm0, %mm2 /* rg gb */
|
||||
psrlw $5, %mm1 /* 0r rg */
|
||||
psrlw $11, %mm0 /* 00 0r */
|
||||
psllw $11, %mm2 /* b0 00 */
|
||||
psllw $10, %mm1 /* g0 00 */
|
||||
psllw $8, %mm0 /* 0r 00 */
|
||||
psrlw $2, %mm1 /* 0g 00 */
|
||||
psrlw $3, %mm2 /* 0b 00 */
|
||||
|
||||
pmulhw %mm5, %mm0 /* xx xr */
|
||||
pmulhw %mm6, %mm1 /* xx xg */
|
||||
pmulhw %mm7, %mm2 /* xx xb */
|
||||
|
||||
/* Saturate upper */
|
||||
paddusw %mm3, %mm0 /* ff er */
|
||||
paddusw %mm4, %mm1 /* ff cg */
|
||||
paddusw %mm3, %mm2 /* ff eb */
|
||||
|
||||
psubw %mm4, %mm1 /* 00 0g */
|
||||
psubw %mm3, %mm2 /* 00 0b */
|
||||
|
||||
psllw $11, %mm0 /* r0 00 */
|
||||
psllw $5, %mm1 /* 0g g0 */
|
||||
por %mm2, %mm0 /* r0 0b */
|
||||
por %mm1, %mm0 /* rg gb */
|
||||
|
||||
movd %mm0, %eax
|
||||
movw %ax, (%esi, %ecx, 2)
|
||||
|
||||
incl %ecx
|
||||
4:
|
||||
cmpl $2, %ecx
|
||||
jng 3b
|
||||
|
||||
addl bpl, %esi
|
||||
decl %edx
|
||||
jnz 1b
|
||||
5:
|
||||
LEAVE
|
||||
|
||||
|
||||
SHADE_XIMAGE_32:
|
||||
ENTER
|
||||
|
||||
leal (%esi, %ebx, 4), %esi
|
||||
negl %ebx
|
||||
jz 3f
|
||||
|
||||
movd rm, %mm4
|
||||
movd gm, %mm5
|
||||
movd bm, %mm6
|
||||
psllq $32, %mm4
|
||||
psllq $16, %mm5
|
||||
por %mm6, %mm4
|
||||
por %mm5, %mm4
|
||||
|
||||
pcmpeqw %mm6, %mm6
|
||||
psllw $15, %mm6 /* 80 00 80 00 80 00 80 00 */
|
||||
movq %mm6, %mm5
|
||||
pmulhw %mm4, %mm5 /* Get correction factor */
|
||||
1:
|
||||
movl %ebx, %ecx
|
||||
2:
|
||||
movd (%esi, %ecx, 4), %mm1 /* 00 rr gg bb */
|
||||
pxor %mm0, %mm0
|
||||
punpcklbw %mm1, %mm0 /* 00 00 rr 00 gg 00 bb 00 */
|
||||
pxor %mm6, %mm0 /* Flip sign */
|
||||
|
||||
pmulhw %mm4, %mm0 /* 00 00 xx rr xx gg xx bb */
|
||||
psubw %mm5, %mm0 /* Correct range */
|
||||
packuswb %mm0, %mm0 /* 00 rr gg bb 00 rr gg bb */
|
||||
|
||||
movd %mm0, (%esi, %ecx, 4)
|
||||
|
||||
incl %ecx
|
||||
jnz 2b
|
||||
|
||||
addl bpl, %esi
|
||||
decl %edx
|
||||
jnz 1b
|
||||
3:
|
||||
LEAVE
|
||||
|
||||
|
||||
HAVE_MMX:
|
||||
push %ebx
|
||||
/* Check if bit 21 in flags word is writeable */
|
||||
pushfl
|
||||
popl %eax
|
||||
movl %eax,%ebx
|
||||
xorl $0x00200000, %eax
|
||||
pushl %eax
|
||||
popfl
|
||||
pushfl
|
||||
popl %eax
|
||||
|
||||
cmpl %eax, %ebx
|
||||
je 8f
|
||||
|
||||
/* OK, we have CPUID */
|
||||
|
||||
movl $1, %eax
|
||||
cpuid
|
||||
|
||||
test $0x00800000, %edx
|
||||
jz 8f
|
||||
|
||||
movl $1, %eax /* success, have mmx */
|
||||
popl %ebx
|
||||
ret
|
||||
|
||||
8:
|
||||
xorl %eax,%eax /* failed, no mmx */
|
||||
popl %ebx
|
||||
ret
|
||||
|
||||
#if defined(__GNUC__) && !defined(_WIN32)
|
||||
.section .note.GNU-stack, "", @progbits
|
||||
.previous
|
||||
#endif
|
@ -1,28 +0,0 @@
|
||||
/* HexChat
|
||||
* Copyright (C) 1998-2010 Peter Zelezny.
|
||||
* Copyright (C) 2009-2013 Berke Viktor.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef HEXCHAT_MMX_CMOD_H
|
||||
#define HEXCHAT_MMX_CMOD_H
|
||||
|
||||
void shade_ximage_15_mmx(void *data, int bpl, int w, int h, int rm, int gm, int bm);
|
||||
void shade_ximage_16_mmx(void *data, int bpl, int w, int h, int rm, int gm, int bm);
|
||||
void shade_ximage_32_mmx(void *data, int bpl, int w, int h, int rm, int gm, int bm);
|
||||
int have_mmx (void);
|
||||
|
||||
#endif
|
@ -43,25 +43,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef HEXCHAT
|
||||
#ifdef WIN32
|
||||
#include "../../config-win32.h"
|
||||
#else
|
||||
#include "../../config.h" /* can define USE_XLIB here */
|
||||
#endif
|
||||
#else
|
||||
#define USE_XLIB
|
||||
#endif
|
||||
|
||||
#ifdef USE_XLIB
|
||||
#include <gdk/gdkx.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_MMX
|
||||
#include "mmx_cmod.h"
|
||||
#endif
|
||||
|
||||
#include "../common/hexchat.h"
|
||||
#include "../common/fe.h"
|
||||
@ -256,216 +242,6 @@ xtext_draw_bg (GtkXText *xtext, int x, int y, int width, int height)
|
||||
|
||||
#endif
|
||||
|
||||
/* ========================================= */
|
||||
/* ========== XFT 1 and 2 BACKEND ========== */
|
||||
/* ========================================= */
|
||||
|
||||
#ifdef USE_XFT
|
||||
|
||||
static void
|
||||
backend_font_close (GtkXText *xtext)
|
||||
{
|
||||
XftFontClose (GDK_WINDOW_XDISPLAY (xtext->draw_buf), xtext->font);
|
||||
#ifdef ITALIC
|
||||
XftFontClose (GDK_WINDOW_XDISPLAY (xtext->draw_buf), xtext->ifont);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
backend_init (GtkXText *xtext)
|
||||
{
|
||||
if (xtext->xftdraw == NULL)
|
||||
{
|
||||
xtext->xftdraw = XftDrawCreate (
|
||||
GDK_WINDOW_XDISPLAY (xtext->draw_buf),
|
||||
GDK_WINDOW_XWINDOW (xtext->draw_buf),
|
||||
GDK_VISUAL_XVISUAL (gdk_drawable_get_visual (xtext->draw_buf)),
|
||||
GDK_COLORMAP_XCOLORMAP (gdk_drawable_get_colormap (xtext->draw_buf)));
|
||||
XftDrawSetSubwindowMode (xtext->xftdraw, IncludeInferiors);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
backend_deinit (GtkXText *xtext)
|
||||
{
|
||||
if (xtext->xftdraw)
|
||||
{
|
||||
XftDrawDestroy (xtext->xftdraw);
|
||||
xtext->xftdraw = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static XftFont *
|
||||
backend_font_open_real (Display *xdisplay, char *name, gboolean italics)
|
||||
{
|
||||
XftFont *font = NULL;
|
||||
PangoFontDescription *fontd;
|
||||
int weight, slant, screen = DefaultScreen (xdisplay);
|
||||
|
||||
fontd = pango_font_description_from_string (name);
|
||||
|
||||
if (pango_font_description_get_size (fontd) != 0)
|
||||
{
|
||||
weight = pango_font_description_get_weight (fontd);
|
||||
/* from pangoft2-fontmap.c */
|
||||
if (weight < (PANGO_WEIGHT_NORMAL + PANGO_WEIGHT_LIGHT) / 2)
|
||||
weight = XFT_WEIGHT_LIGHT;
|
||||
else if (weight < (PANGO_WEIGHT_NORMAL + 600) / 2)
|
||||
weight = XFT_WEIGHT_MEDIUM;
|
||||
else if (weight < (600 + PANGO_WEIGHT_BOLD) / 2)
|
||||
weight = XFT_WEIGHT_DEMIBOLD;
|
||||
else if (weight < (PANGO_WEIGHT_BOLD + PANGO_WEIGHT_ULTRABOLD) / 2)
|
||||
weight = XFT_WEIGHT_BOLD;
|
||||
else
|
||||
weight = XFT_WEIGHT_BLACK;
|
||||
|
||||
slant = pango_font_description_get_style (fontd);
|
||||
if (slant == PANGO_STYLE_ITALIC)
|
||||
slant = XFT_SLANT_ITALIC;
|
||||
else if (slant == PANGO_STYLE_OBLIQUE)
|
||||
slant = XFT_SLANT_OBLIQUE;
|
||||
else
|
||||
slant = XFT_SLANT_ROMAN;
|
||||
|
||||
font = XftFontOpen (xdisplay, screen,
|
||||
XFT_FAMILY, XftTypeString, pango_font_description_get_family (fontd),
|
||||
XFT_CORE, XftTypeBool, False,
|
||||
XFT_SIZE, XftTypeDouble, (double)pango_font_description_get_size (fontd)/PANGO_SCALE,
|
||||
XFT_WEIGHT, XftTypeInteger, weight,
|
||||
XFT_SLANT, XftTypeInteger, italics ? XFT_SLANT_ITALIC : slant,
|
||||
NULL);
|
||||
}
|
||||
pango_font_description_free (fontd);
|
||||
|
||||
if (font == NULL)
|
||||
{
|
||||
font = XftFontOpenName (xdisplay, screen, name);
|
||||
if (font == NULL)
|
||||
font = XftFontOpenName (xdisplay, screen, "sans-11");
|
||||
}
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
static void
|
||||
backend_font_open (GtkXText *xtext, char *name)
|
||||
{
|
||||
Display *dis = GDK_WINDOW_XDISPLAY (xtext->draw_buf);
|
||||
|
||||
xtext->font = backend_font_open_real (dis, name, FALSE);
|
||||
#ifdef ITALIC
|
||||
xtext->ifont = backend_font_open_real (dis, name, TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline static int
|
||||
backend_get_char_width (GtkXText *xtext, unsigned char *str, int *mbl_ret)
|
||||
{
|
||||
XGlyphInfo ext;
|
||||
|
||||
if (*str < 128)
|
||||
{
|
||||
*mbl_ret = 1;
|
||||
return xtext->fontwidth[*str];
|
||||
}
|
||||
|
||||
*mbl_ret = charlen (str);
|
||||
XftTextExtentsUtf8 (GDK_WINDOW_XDISPLAY (xtext->draw_buf), xtext->font, str, *mbl_ret, &ext);
|
||||
|
||||
return ext.xOff;
|
||||
}
|
||||
|
||||
static int
|
||||
backend_get_text_width (GtkXText *xtext, guchar *str, int len, int is_mb)
|
||||
{
|
||||
XGlyphInfo ext;
|
||||
|
||||
if (!is_mb)
|
||||
return gtk_xtext_text_width_8bit (xtext, str, len);
|
||||
|
||||
XftTextExtentsUtf8 (GDK_WINDOW_XDISPLAY (xtext->draw_buf), xtext->font, str, len, &ext);
|
||||
return ext.xOff;
|
||||
}
|
||||
|
||||
static void
|
||||
backend_draw_text (GtkXText *xtext, int dofill, GdkGC *gc, int x, int y,
|
||||
char *str, int len, int str_width, int is_mb)
|
||||
{
|
||||
/*Display *xdisplay = GDK_WINDOW_XDISPLAY (xtext->draw_buf);*/
|
||||
void (*draw_func) (XftDraw *, XftColor *, XftFont *, int, int, XftChar8 *, int) = (void *)XftDrawString8;
|
||||
XftFont *font;
|
||||
|
||||
/* if all ascii, use String8 to avoid the conversion penalty */
|
||||
if (is_mb)
|
||||
draw_func = (void *)XftDrawStringUtf8;
|
||||
|
||||
if (dofill)
|
||||
{
|
||||
/* register GC xgc = GDK_GC_XGC (gc);
|
||||
XSetForeground (xdisplay, xgc, xtext->xft_bg->pixel);
|
||||
XFillRectangle (xdisplay, GDK_WINDOW_XWINDOW (xtext->draw_buf), xgc, x,
|
||||
y - xtext->font->ascent, str_width, xtext->fontsize);*/
|
||||
XftDrawRect (xtext->xftdraw, xtext->xft_bg, x,
|
||||
y - xtext->font->ascent, str_width, xtext->fontsize);
|
||||
}
|
||||
|
||||
font = xtext->font;
|
||||
#ifdef ITALIC
|
||||
if (xtext->italics)
|
||||
font = xtext->ifont;
|
||||
#endif
|
||||
|
||||
draw_func (xtext->xftdraw, xtext->xft_fg, font, x, y, str, len);
|
||||
|
||||
if (xtext->overdraw)
|
||||
draw_func (xtext->xftdraw, xtext->xft_fg, font, x, y, str, len);
|
||||
|
||||
if (xtext->bold)
|
||||
draw_func (xtext->xftdraw, xtext->xft_fg, font, x + 1, y, str, len);
|
||||
}
|
||||
|
||||
/*static void
|
||||
backend_set_clip (GtkXText *xtext, GdkRectangle *area)
|
||||
{
|
||||
gdk_gc_set_clip_rectangle (xtext->fgc, area);
|
||||
gdk_gc_set_clip_rectangle (xtext->bgc, area);
|
||||
}
|
||||
|
||||
static void
|
||||
backend_clear_clip (GtkXText *xtext)
|
||||
{
|
||||
gdk_gc_set_clip_rectangle (xtext->fgc, NULL);
|
||||
gdk_gc_set_clip_rectangle (xtext->bgc, NULL);
|
||||
}*/
|
||||
|
||||
/*static void
|
||||
backend_set_clip (GtkXText *xtext, GdkRectangle *area)
|
||||
{
|
||||
Region reg;
|
||||
XRectangle rect;
|
||||
|
||||
rect.x = area->x;
|
||||
rect.y = area->y;
|
||||
rect.width = area->width;
|
||||
rect.height = area->height;
|
||||
|
||||
reg = XCreateRegion ();
|
||||
XUnionRectWithRegion (&rect, reg, reg);
|
||||
XftDrawSetClip (xtext->xftdraw, reg);
|
||||
XDestroyRegion (reg);
|
||||
|
||||
gdk_gc_set_clip_rectangle (xtext->fgc, area);
|
||||
}
|
||||
|
||||
static void
|
||||
backend_clear_clip (GtkXText *xtext)
|
||||
{
|
||||
XftDrawSetClip (xtext->xftdraw, NULL);
|
||||
gdk_gc_set_clip_rectangle (xtext->fgc, NULL);
|
||||
}
|
||||
*/
|
||||
#else /* !USE_XFT */
|
||||
|
||||
/* ======================================= */
|
||||
/* ============ PANGO BACKEND ============ */
|
||||
/* ======================================= */
|
||||
@ -675,7 +451,6 @@ backend_clear_clip (GtkXText *xtext)
|
||||
gdk_gc_set_clip_rectangle (xtext->bgc, NULL);
|
||||
}*/
|
||||
|
||||
#endif /* !USE_PANGO */
|
||||
|
||||
static void
|
||||
xtext_set_fg (GtkXText *xtext, GdkGC *gc, int index)
|
||||
@ -684,21 +459,8 @@ xtext_set_fg (GtkXText *xtext, GdkGC *gc, int index)
|
||||
|
||||
col.pixel = xtext->palette[index];
|
||||
gdk_gc_set_foreground (gc, &col);
|
||||
|
||||
#ifdef USE_XFT
|
||||
if (gc == xtext->fgc)
|
||||
xtext->xft_fg = &xtext->color[index];
|
||||
else
|
||||
xtext->xft_bg = &xtext->color[index];
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef USE_XFT
|
||||
|
||||
#define xtext_set_bg(xt,gc,index) xt->xft_bg = &xt->color[index]
|
||||
|
||||
#else
|
||||
|
||||
static void
|
||||
xtext_set_bg (GtkXText *xtext, GdkGC *gc, int index)
|
||||
{
|
||||
@ -727,11 +489,7 @@ gtk_xtext_init (GtkXText * xtext)
|
||||
xtext->italics = FALSE;
|
||||
xtext->hidden = FALSE;
|
||||
xtext->font = NULL;
|
||||
#ifdef USE_XFT
|
||||
xtext->xftdraw = NULL;
|
||||
#else
|
||||
xtext->layout = NULL;
|
||||
#endif
|
||||
xtext->jump_out_offset = 0;
|
||||
xtext->jump_in_offset = 0;
|
||||
xtext->ts_x = 0;
|
||||
@ -1353,24 +1111,6 @@ gtk_xtext_draw_marker (GtkXText * xtext, textentry * ent, int y)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_SHM
|
||||
static int
|
||||
have_shm_pixmaps(Display *dpy)
|
||||
{
|
||||
int major, minor;
|
||||
static int checked = 0;
|
||||
static int have = FALSE;
|
||||
|
||||
if (!checked)
|
||||
{
|
||||
XShmQueryVersion (dpy, &major, &minor, &have);
|
||||
checked = 1;
|
||||
}
|
||||
|
||||
return have;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
gtk_xtext_paint (GtkWidget *widget, GdkRectangle *area)
|
||||
{
|
||||
@ -1388,11 +1128,7 @@ gtk_xtext_paint (GtkWidget *widget, GdkRectangle *area)
|
||||
xtext->last_win_x = x;
|
||||
xtext->last_win_y = y;
|
||||
#ifndef WIN32
|
||||
#ifdef USE_SHM
|
||||
if (xtext->shaded && !have_shm_pixmaps(GDK_WINDOW_XDISPLAY (xtext->draw_buf)))
|
||||
#else
|
||||
if (xtext->shaded)
|
||||
#endif
|
||||
{
|
||||
xtext->recycle = TRUE;
|
||||
gtk_xtext_load_trans (xtext);
|
||||
@ -2931,9 +2667,6 @@ gtk_xtext_render_flush (GtkXText * xtext, int x, int y, unsigned char *str,
|
||||
pix = gdk_pixmap_new (xtext->draw_buf, str_width, xtext->fontsize, xtext->depth);
|
||||
if (pix)
|
||||
{
|
||||
#ifdef USE_XFT
|
||||
XftDrawChange (xtext->xftdraw, GDK_WINDOW_XWINDOW (pix));
|
||||
#endif
|
||||
dest_x = x;
|
||||
dest_y = y - xtext->font->ascent;
|
||||
|
||||
@ -2967,13 +2700,6 @@ gtk_xtext_render_flush (GtkXText * xtext, int x, int y, unsigned char *str,
|
||||
|
||||
gdk_gc_set_ts_origin (xtext->bgc, xtext->ts_x, xtext->ts_y);
|
||||
xtext->draw_buf = GTK_WIDGET (xtext)->window;
|
||||
#ifdef USE_XFT
|
||||
XftDrawChange (xtext->xftdraw, GDK_WINDOW_XWINDOW (xtext->draw_buf));
|
||||
#endif
|
||||
#if 0
|
||||
gdk_draw_drawable (xtext->draw_buf, xtext->bgc, pix, 0, 0, dest_x,
|
||||
dest_y, str_width, xtext->fontsize);
|
||||
#else
|
||||
clip.x = xtext->clip_x;
|
||||
clip.y = xtext->clip_y;
|
||||
clip.width = xtext->clip_x2 - xtext->clip_x;
|
||||
@ -2996,18 +2722,10 @@ gtk_xtext_render_flush (GtkXText * xtext, int x, int y, unsigned char *str,
|
||||
|
||||
if (xtext->underline)
|
||||
{
|
||||
#ifdef USE_XFT
|
||||
GdkColor col;
|
||||
#endif
|
||||
|
||||
#ifndef COLOR_HILIGHT
|
||||
dounder:
|
||||
#endif
|
||||
|
||||
#ifdef USE_XFT
|
||||
col.pixel = xtext->xft_fg->pixel;
|
||||
gdk_gc_set_foreground (gc, &col);
|
||||
#endif
|
||||
if (pix)
|
||||
y = dest_y + xtext->font->ascent + 1;
|
||||
else
|
||||
@ -3732,120 +3450,27 @@ static void
|
||||
shade_image (GdkVisual *visual, void *data, int bpl, int bpp, int w, int h,
|
||||
int rm, int gm, int bm, int bg, int depth)
|
||||
{
|
||||
#ifdef USE_MMX
|
||||
int bg_r, bg_g, bg_b;
|
||||
|
||||
bg_r = bg & visual->red_mask;
|
||||
bg_g = bg & visual->green_mask;
|
||||
bg_b = bg & visual->blue_mask;
|
||||
|
||||
/* the MMX routines are about 50% faster at 16-bit. */
|
||||
/* only use MMX routines with a pure black background */
|
||||
if (bg_r == 0 && bg_g == 0 && bg_b == 0 && have_mmx ()) /* do a runtime check too! */
|
||||
switch (depth)
|
||||
{
|
||||
switch (depth)
|
||||
case 15:
|
||||
shade_ximage_15 (data, bpl, w, h, rm, gm, bm, bg);
|
||||
break;
|
||||
case 16:
|
||||
shade_ximage_16 (data, bpl, w, h, rm, gm, bm, bg);
|
||||
break;
|
||||
case 24:
|
||||
if (bpp != 32)
|
||||
{
|
||||
case 15:
|
||||
shade_ximage_15_mmx (data, bpl, w, h, rm, gm, bm);
|
||||
shade_ximage_24 (data, bpl, w, h, rm, gm, bm, bg);
|
||||
break;
|
||||
case 16:
|
||||
shade_ximage_16_mmx (data, bpl, w, h, rm, gm, bm);
|
||||
break;
|
||||
case 24:
|
||||
if (bpp != 32)
|
||||
goto generic;
|
||||
case 32:
|
||||
shade_ximage_32_mmx (data, bpl, w, h, rm, gm, bm);
|
||||
break;
|
||||
default:
|
||||
goto generic;
|
||||
}
|
||||
} else
|
||||
{
|
||||
generic:
|
||||
#endif
|
||||
switch (depth)
|
||||
{
|
||||
case 15:
|
||||
shade_ximage_15 (data, bpl, w, h, rm, gm, bm, bg);
|
||||
break;
|
||||
case 16:
|
||||
shade_ximage_16 (data, bpl, w, h, rm, gm, bm, bg);
|
||||
break;
|
||||
case 24:
|
||||
if (bpp != 32)
|
||||
{
|
||||
shade_ximage_24 (data, bpl, w, h, rm, gm, bm, bg);
|
||||
break;
|
||||
}
|
||||
case 32:
|
||||
shade_ximage_32 (data, bpl, w, h, rm, gm, bm, bg);
|
||||
}
|
||||
#ifdef USE_MMX
|
||||
case 32:
|
||||
shade_ximage_32 (data, bpl, w, h, rm, gm, bm, bg);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef USE_XLIB
|
||||
|
||||
#ifdef USE_SHM
|
||||
|
||||
static XImage *
|
||||
get_shm_image (Display *xdisplay, XShmSegmentInfo *shminfo, int x, int y,
|
||||
int w, int h, int depth, Pixmap pix)
|
||||
{
|
||||
XImage *ximg;
|
||||
|
||||
shminfo->shmid = -1;
|
||||
shminfo->shmaddr = (char*) -1;
|
||||
ximg = XShmCreateImage (xdisplay, 0, depth, ZPixmap, 0, shminfo, w, h);
|
||||
if (!ximg)
|
||||
return NULL;
|
||||
|
||||
shminfo->shmid = shmget (IPC_PRIVATE, ximg->bytes_per_line * ximg->height,
|
||||
IPC_CREAT|0600);
|
||||
if (shminfo->shmid == -1)
|
||||
{
|
||||
XDestroyImage (ximg);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
shminfo->readOnly = False;
|
||||
ximg->data = shminfo->shmaddr = (char *)shmat (shminfo->shmid, 0, 0);
|
||||
if (shminfo->shmaddr == ((char *)-1))
|
||||
{
|
||||
shmctl (shminfo->shmid, IPC_RMID, 0);
|
||||
XDestroyImage (ximg);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
XShmAttach (xdisplay, shminfo);
|
||||
XSync (xdisplay, False);
|
||||
shmctl (shminfo->shmid, IPC_RMID, 0);
|
||||
XShmGetImage (xdisplay, pix, ximg, x, y, AllPlanes);
|
||||
|
||||
return ximg;
|
||||
}
|
||||
|
||||
static XImage *
|
||||
get_image (GtkXText *xtext, Display *xdisplay, XShmSegmentInfo *shminfo,
|
||||
int x, int y, int w, int h, int depth, Pixmap pix)
|
||||
{
|
||||
XImage *ximg;
|
||||
|
||||
xtext->shm = 1;
|
||||
ximg = get_shm_image (xdisplay, shminfo, x, y, w, h, depth, pix);
|
||||
if (!ximg)
|
||||
{
|
||||
xtext->shm = 0;
|
||||
ximg = XGetImage (xdisplay, pix, x, y, w, h, -1, ZPixmap);
|
||||
}
|
||||
|
||||
return ximg;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static GdkPixmap *
|
||||
shade_pixmap (GtkXText * xtext, Pixmap p, int x, int y, int w, int h)
|
||||
{
|
||||
@ -3857,12 +3482,6 @@ shade_pixmap (GtkXText * xtext, Pixmap p, int x, int y, int w, int h)
|
||||
XGCValues gcv;
|
||||
GC tgc;
|
||||
Display *xdisplay = GDK_WINDOW_XDISPLAY (xtext->draw_buf);
|
||||
|
||||
#ifdef USE_SHM
|
||||
int shm_pixmaps;
|
||||
shm_pixmaps = have_shm_pixmaps(xdisplay);
|
||||
#endif
|
||||
|
||||
XGetGeometry (xdisplay, p, &root, &dummy, &dummy, &width, &height,
|
||||
&dummy, &depth);
|
||||
|
||||
@ -3879,21 +3498,11 @@ shade_pixmap (GtkXText * xtext, Pixmap p, int x, int y, int w, int h)
|
||||
XFillRectangle (xdisplay, tmp, tgc, 0, 0, w, h);
|
||||
XFreeGC (xdisplay, tgc);
|
||||
|
||||
#ifdef USE_SHM
|
||||
if (shm_pixmaps)
|
||||
ximg = get_image (xtext, xdisplay, &xtext->shminfo, 0, 0, w, h, depth, tmp);
|
||||
else
|
||||
#endif
|
||||
ximg = XGetImage (xdisplay, tmp, 0, 0, w, h, -1, ZPixmap);
|
||||
ximg = XGetImage (xdisplay, tmp, 0, 0, w, h, -1, ZPixmap);
|
||||
XFreePixmap (xdisplay, tmp);
|
||||
} else
|
||||
{
|
||||
#ifdef USE_SHM
|
||||
if (shm_pixmaps)
|
||||
ximg = get_image (xtext, xdisplay, &xtext->shminfo, x, y, w, h, depth, p);
|
||||
else
|
||||
#endif
|
||||
ximg = XGetImage (xdisplay, p, x, y, w, h, -1, ZPixmap);
|
||||
ximg = XGetImage (xdisplay, p, x, y, w, h, -1, ZPixmap);
|
||||
}
|
||||
|
||||
if (!ximg)
|
||||
@ -3917,23 +3526,12 @@ shade_pixmap (GtkXText * xtext, Pixmap p, int x, int y, int w, int h)
|
||||
shaded_pix = xtext->pixmap;
|
||||
else
|
||||
{
|
||||
#ifdef USE_SHM
|
||||
if (xtext->shm && shm_pixmaps)
|
||||
{
|
||||
shaded_pix = gdk_pixmap_foreign_new_for_display (
|
||||
gdk_drawable_get_display (xtext->draw_buf),
|
||||
XShmCreatePixmap (xdisplay, p, ximg->data, &xtext->shminfo, w, h, depth));
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
shaded_pix = gdk_pixmap_new (GTK_WIDGET (xtext)->window, w, h, depth);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_SHM
|
||||
if (!xtext->shm || !shm_pixmaps)
|
||||
#endif
|
||||
XPutImage (xdisplay, GDK_WINDOW_XWINDOW (shaded_pix),
|
||||
XPutImage (xdisplay, GDK_WINDOW_XWINDOW (shaded_pix),
|
||||
GDK_GC_XGC (xtext->fgc), ximg, 0, 0, 0, 0, w, h);
|
||||
XDestroyImage (ximg);
|
||||
|
||||
@ -3950,18 +3548,8 @@ gtk_xtext_free_trans (GtkXText * xtext)
|
||||
{
|
||||
if (xtext->pixmap)
|
||||
{
|
||||
#ifdef USE_SHM
|
||||
if (xtext->shm && have_shm_pixmaps(GDK_WINDOW_XDISPLAY (xtext->draw_buf)))
|
||||
{
|
||||
XFreePixmap (GDK_WINDOW_XDISPLAY (xtext->pixmap),
|
||||
GDK_WINDOW_XWINDOW (xtext->pixmap));
|
||||
XShmDetach (GDK_WINDOW_XDISPLAY (xtext->draw_buf), &xtext->shminfo);
|
||||
shmdt (xtext->shminfo.shmaddr);
|
||||
}
|
||||
#endif
|
||||
g_object_unref (xtext->pixmap);
|
||||
xtext->pixmap = NULL;
|
||||
xtext->shm = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4468,13 +4056,6 @@ gtk_xtext_set_palette (GtkXText * xtext, GdkColor palette[])
|
||||
|
||||
for (i = (XTEXT_COLS-1); i >= 0; i--)
|
||||
{
|
||||
#ifdef USE_XFT
|
||||
xtext->color[i].color.red = palette[i].red;
|
||||
xtext->color[i].color.green = palette[i].green;
|
||||
xtext->color[i].color.blue = palette[i].blue;
|
||||
xtext->color[i].color.alpha = 0xffff;
|
||||
xtext->color[i].pixel = palette[i].pixel;
|
||||
#endif
|
||||
xtext->palette[i] = palette[i].pixel;
|
||||
}
|
||||
|
||||
|
@ -21,16 +21,6 @@
|
||||
#define HEXCHAT_XTEXT_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#ifdef USE_XFT
|
||||
#include <X11/Xft/Xft.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_SHM
|
||||
#include <X11/Xlib.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <X11/extensions/XShm.h>
|
||||
#endif
|
||||
|
||||
#define GTK_TYPE_XTEXT (gtk_xtext_get_type ())
|
||||
#define GTK_XTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_XTEXT, GtkXText))
|
||||
@ -132,10 +122,6 @@ struct _GtkXText
|
||||
xtext_buffer *orig_buffer;
|
||||
xtext_buffer *selection_buffer;
|
||||
|
||||
#ifdef USE_SHM
|
||||
XShmSegmentInfo shminfo;
|
||||
#endif
|
||||
|
||||
GtkAdjustment *adj;
|
||||
GdkPixmap *pixmap; /* 0 = use palette[19] */
|
||||
GdkDrawable *draw_buf; /* points to ->window */
|
||||
@ -188,14 +174,6 @@ struct _GtkXText
|
||||
|
||||
guint16 fontwidth[128]; /* each char's width, only the ASCII ones */
|
||||
|
||||
#ifdef USE_XFT
|
||||
XftColor color[XTEXT_COLS];
|
||||
XftColor *xft_fg;
|
||||
XftColor *xft_bg; /* both point into color[20] */
|
||||
XftDraw *xftdraw;
|
||||
XftFont *font;
|
||||
XftFont *ifont; /* italics */
|
||||
#else
|
||||
struct pangofont
|
||||
{
|
||||
PangoFontDescription *font;
|
||||
@ -204,7 +182,6 @@ struct _GtkXText
|
||||
int descent;
|
||||
} *font, pango_font;
|
||||
PangoLayout *layout;
|
||||
#endif
|
||||
|
||||
int fontsize;
|
||||
int space_width; /* width (pixels) of the space " " character */
|
||||
@ -258,7 +235,6 @@ struct _GtkXText
|
||||
unsigned int recycle:1;
|
||||
unsigned int avoid_trans:1;
|
||||
unsigned int force_render:1;
|
||||
unsigned int shm:1;
|
||||
unsigned int color_paste:1; /* CTRL was pressed when selection finished */
|
||||
|
||||
/* settings/prefs */
|
||||
|
Loading…
Reference in New Issue
Block a user