aboutsummaryrefslogtreecommitdiff
path: root/modules/libblit
diff options
context:
space:
mode:
Diffstat (limited to 'modules/libblit')
-rw-r--r--modules/libblit/Makefile626
-rw-r--r--modules/libblit/Makefile.am14
-rw-r--r--modules/libblit/Makefile.in626
-rw-r--r--modules/libblit/g_blit.c2959
-rw-r--r--modules/libblit/g_blit.h62
-rw-r--r--modules/libblit/g_pixel.c271
-rw-r--r--modules/libblit/g_pixel.h67
-rw-r--r--modules/libblit/libblit.c37
-rw-r--r--modules/libblit/libblit.h37
-rw-r--r--modules/libblit/libblit_exports.h61
10 files changed, 4760 insertions, 0 deletions
diff --git a/modules/libblit/Makefile b/modules/libblit/Makefile
new file mode 100644
index 0000000..cfc55f5
--- /dev/null
+++ b/modules/libblit/Makefile
@@ -0,0 +1,626 @@
+# Makefile.in generated by automake 1.12.1 from Makefile.am.
+# libblit/Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+
+#AUTOMAKE_OPTIONS = no-dependencies foreign
+
+
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/bennu
+pkgincludedir = $(includedir)/bennu
+pkglibdir = $(libdir)/bennu
+pkglibexecdir = $(libexecdir)/bennu
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = x86_64-pc-none
+host_triplet = arm-unknown-linux-gnu
+target_triplet = arm-unknown-linux-gnu
+subdir = libblit
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(libdir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libblit_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_libblit_la_OBJECTS = libblit_la-libblit.lo libblit_la-g_blit.lo \
+ libblit_la-g_pixel.lo
+libblit_la_OBJECTS = $(am_libblit_la_OBJECTS)
+libblit_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libblit_la_CFLAGS) \
+ $(CFLAGS) $(libblit_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libblit_la_SOURCES)
+DIST_SOURCES = $(libblit_la_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = ${SHELL} /home/steward/Github/miyoo_src/bennugd/modules/missing --run aclocal-1.12
+AMTAR = $${TAR-tar}
+AR = /opt/miyoo/usr/bin/arm-linux-ar
+AS = as
+AUTOCONF = ${SHELL} /home/steward/Github/miyoo_src/bennugd/modules/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/steward/Github/miyoo_src/bennugd/modules/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/steward/Github/miyoo_src/bennugd/modules/missing --run automake-1.12
+AWK = mawk
+BGD_PATH = /home/steward/Github/miyoo_src/bennugd/modules/../core
+CC = /opt/miyoo/usr/bin/arm-linux-gcc
+CCDEPMODE = depmode=gcc3
+CFLAGS = -DTARGET_MIYOO -mcpu=arm926ej-s -mtune=arm926ej-s -O3 -DARM -D_ARM_ASSEM_ -I/opt/miyoo/arm-miyoo-linux-uclibcgnueabi/sysroot/usr/include/SDL -O2 -finline-functions -fno-strict-aliasing -Wall -DTARGET_LINUX -DUSE_LIBDES -DTARGET_MIYOO -mcpu=arm926ej-s -mtune=arm926ej-s -O3 -DARM -D_ARM_ASSEM_ -I/opt/miyoo/arm-miyoo-linux-uclibcgnueabi/sysroot/usr/include/SDL -I/home/steward/Github/miyoo_src/bennugd/modules/../3rdparty/des-4.04b
+COMMON_CFLAGS = -Wall -DTARGET_LINUX -DUSE_LIBDES -DTARGET_MIYOO -mcpu=arm926ej-s -mtune=arm926ej-s -O3 -DARM -D_ARM_ASSEM_ -I/opt/miyoo/arm-miyoo-linux-uclibcgnueabi/sysroot/usr/include/SDL -I/home/steward/Github/miyoo_src/bennugd/modules/../3rdparty/des-4.04b
+COMMON_LDFLAGS = -lc -ldl -D_REENTRANT -L/home/steward/Github/miyoo_src/bennugd/modules/../3rdparty/des-4.04b -ldes
+CPP = /opt/miyoo/usr/bin/arm-linux-gcc -E
+CPPFLAGS =
+CYGPATH_W = echo
+DEFS = -DPACKAGE_NAME=\"bennu\" -DPACKAGE_TARNAME=\"bennu\" -DPACKAGE_VERSION=\"1.0.0\" -DPACKAGE_STRING=\"bennu\ 1.0.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DPACKAGE=\"bennu\" -DVERSION=\"1.0.0\" -DHAVE_LIBM=1
+DEPDIR = .deps
+DESLIBS =
+DLLTOOL = false
+DSYMUTIL =
+DUMPBIN =
+ECHO_C =
+ECHO_N = -n
+ECHO_T =
+EGREP = /bin/grep -E
+EXEEXT =
+FGREP = /bin/grep -F
+GREP = /bin/grep
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
+LD = /opt/miyoo/usr/bin/arm-linux-ld
+LDFLAGS = -D_REENTRANT
+LIBOBJS =
+LIBS = -lm
+LIBTOOL = $(SHELL) $(top_builddir)/libtool
+LIPO =
+LN_S = ln -s
+LTLIBOBJS =
+MAINT = #
+MAKEINFO = ${SHELL} /home/steward/Github/miyoo_src/bennugd/modules/missing --run makeinfo
+MANIFEST_TOOL = :
+MKDIR_P = /bin/mkdir -p
+NM = /opt/miyoo/bin//arm-linux-nm -B
+NMEDIT =
+OBJDUMP = arm-linux-objdump
+OBJEXT = o
+OTOOL =
+OTOOL64 =
+PACKAGE = bennu
+PACKAGE_BUGREPORT =
+PACKAGE_NAME = bennu
+PACKAGE_STRING = bennu 1.0.0
+PACKAGE_TARNAME = bennu
+PACKAGE_URL =
+PACKAGE_VERSION = 1.0.0
+PATH_SEPARATOR = :
+PKG_CONFIG = /usr/bin/pkg-config
+PKG_CONFIG_LIBDIR = /opt/miyoo/arm-miyoo-linux-uclibcgnueabi/sysroot/usr/lib/pkgconfig
+PKG_CONFIG_PATH = /opt/miyoo/arm-miyoo-linux-uclibcgnueabi/sysroot/usr/lib/pkgconfig
+PNGLIBS =
+PNG_CFLAGS = -I/usr/include/libpng16
+PNG_LIBS = -lpng16 -lz
+RANLIB = /opt/miyoo/usr/bin/arm-linux-ranlib
+SDL_CFLAGS = -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT
+SDL_LIBS = -lSDL -lpthread
+SDL_mixer_CFLAGS = -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT
+SDL_mixer_LIBS = -lSDL_mixer -lSDL -lpthread
+SED = /bin/sed
+SET_MAKE =
+SHELL = /bin/bash
+STRIP = /opt/miyoo/usr/bin/arm-linux-strip
+VERSION = 1.0.0
+WINDRES =
+X11LIBS = -lX11
+ZLIBS =
+ZLIB_CFLAGS =
+ZLIB_LIBS = -lz
+abs_builddir = /home/steward/Github/miyoo_src/bennugd/modules/libblit
+abs_srcdir = /home/steward/Github/miyoo_src/bennugd/modules/libblit
+abs_top_builddir = /home/steward/Github/miyoo_src/bennugd/modules
+abs_top_srcdir = /home/steward/Github/miyoo_src/bennugd/modules
+ac_ct_AR =
+ac_ct_CC =
+ac_ct_DUMPBIN =
+am__include = include
+am__leading_dot = .
+am__quote =
+am__tar = $${TAR-tar} chof - "$$tardir"
+am__untar = $${TAR-tar} xf -
+bindir = ${exec_prefix}/bin
+build = x86_64-pc-none
+build_alias = x86_64
+build_cpu = x86_64
+build_os = none
+build_vendor = pc
+builddir = .
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
+dvidir = ${docdir}
+exec_prefix = ${prefix}
+host = arm-unknown-linux-gnu
+host_alias = arm-linux
+host_cpu = arm
+host_os = linux-gnu
+host_vendor = unknown
+htmldir = ${docdir}
+includedir = ${prefix}/include
+infodir = ${datarootdir}/info
+install_sh = ${SHELL} /home/steward/Github/miyoo_src/bennugd/modules/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localedir = ${datarootdir}/locale
+localstatedir = ${prefix}/var
+mandir = ${datarootdir}/man
+mkdir_p = /bin/mkdir -p
+oldincludedir = /usr/include
+pdfdir = ${docdir}
+prefix = /opt/miyoo/usr
+program_transform_name = s&^&arm-linux-&
+psdir = ${docdir}
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+srcdir = .
+sysconfdir = ${prefix}/etc
+target = arm-unknown-linux-gnu
+target_alias = arm-linux
+target_cpu = arm
+target_os = linux-gnu
+target_vendor = unknown
+top_build_prefix = ../
+top_builddir = ..
+top_srcdir = ..
+lib_LTLIBRARIES = libblit.la
+libblit_la_SOURCES = libblit.c g_blit.c g_pixel.c
+libblit_la_CFLAGS = $(COMMON_CFLAGS) $(SDL_CFLAGS) -I$(BGD_PATH)/include -I$(BGD_PATH)/bgdrtm/include -I. -I../libgrbase/
+libblit_la_LDFLAGS = -s -module -no-undefined -avoid-version
+libblit_la_LIBADD = $(COMMON_LDFLAGS) $(SDL_LIBS) -L$(BGD_PATH)/bgdrtm/src/.libs -lbgdrtm -L../libgrbase/.libs -lgrbase
+CLEANFILES = libblit.la
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libblit/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu libblit/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: # $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): # $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+ }
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+libblit.la: $(libblit_la_OBJECTS) $(libblit_la_DEPENDENCIES) $(EXTRA_libblit_la_DEPENDENCIES)
+ $(libblit_la_LINK) -rpath $(libdir) $(libblit_la_OBJECTS) $(libblit_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+include ./$(DEPDIR)/libblit_la-g_blit.Plo
+include ./$(DEPDIR)/libblit_la-g_pixel.Plo
+include ./$(DEPDIR)/libblit_la-libblit.Plo
+
+.c.o:
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c $<
+
+.c.obj:
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+# source='$<' object='$@' libtool=yes \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(LTCOMPILE) -c -o $@ $<
+
+libblit_la-libblit.lo: libblit.c
+ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblit_la_CFLAGS) $(CFLAGS) -MT libblit_la-libblit.lo -MD -MP -MF $(DEPDIR)/libblit_la-libblit.Tpo -c -o libblit_la-libblit.lo `test -f 'libblit.c' || echo '$(srcdir)/'`libblit.c
+ $(am__mv) $(DEPDIR)/libblit_la-libblit.Tpo $(DEPDIR)/libblit_la-libblit.Plo
+# source='libblit.c' object='libblit_la-libblit.lo' libtool=yes \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblit_la_CFLAGS) $(CFLAGS) -c -o libblit_la-libblit.lo `test -f 'libblit.c' || echo '$(srcdir)/'`libblit.c
+
+libblit_la-g_blit.lo: g_blit.c
+ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblit_la_CFLAGS) $(CFLAGS) -MT libblit_la-g_blit.lo -MD -MP -MF $(DEPDIR)/libblit_la-g_blit.Tpo -c -o libblit_la-g_blit.lo `test -f 'g_blit.c' || echo '$(srcdir)/'`g_blit.c
+ $(am__mv) $(DEPDIR)/libblit_la-g_blit.Tpo $(DEPDIR)/libblit_la-g_blit.Plo
+# source='g_blit.c' object='libblit_la-g_blit.lo' libtool=yes \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblit_la_CFLAGS) $(CFLAGS) -c -o libblit_la-g_blit.lo `test -f 'g_blit.c' || echo '$(srcdir)/'`g_blit.c
+
+libblit_la-g_pixel.lo: g_pixel.c
+ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblit_la_CFLAGS) $(CFLAGS) -MT libblit_la-g_pixel.lo -MD -MP -MF $(DEPDIR)/libblit_la-g_pixel.Tpo -c -o libblit_la-g_pixel.lo `test -f 'g_pixel.c' || echo '$(srcdir)/'`g_pixel.c
+ $(am__mv) $(DEPDIR)/libblit_la-g_pixel.Tpo $(DEPDIR)/libblit_la-g_pixel.Plo
+# source='g_pixel.c' object='libblit_la-g_pixel.lo' libtool=yes \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblit_la_CFLAGS) $(CFLAGS) -c -o libblit_la-g_pixel.lo `test -f 'g_pixel.c' || echo '$(srcdir)/'`g_pixel.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-libLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLTLIBRARIES clean-libtool cscopelist ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am \
+ install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-libLTLIBRARIES
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/modules/libblit/Makefile.am b/modules/libblit/Makefile.am
new file mode 100644
index 0000000..89b63ec
--- /dev/null
+++ b/modules/libblit/Makefile.am
@@ -0,0 +1,14 @@
+## Process this file with automake to produce Makefile.in
+
+#AUTOMAKE_OPTIONS = no-dependencies foreign
+
+lib_LTLIBRARIES = libblit.la
+
+libblit_la_SOURCES = libblit.c g_blit.c g_pixel.c
+libblit_la_CFLAGS = $(COMMON_CFLAGS) $(SDL_CFLAGS) -I$(BGD_PATH)/include -I$(BGD_PATH)/bgdrtm/include -I. -I../libgrbase/
+libblit_la_LDFLAGS = -s -module -no-undefined -avoid-version
+libblit_la_LIBADD = $(COMMON_LDFLAGS) $(SDL_LIBS) -L$(BGD_PATH)/bgdrtm/src/.libs -lbgdrtm -L../libgrbase/.libs -lgrbase
+
+## Make sure these will be cleaned even when they're not built by
+## default.
+CLEANFILES = libblit.la
diff --git a/modules/libblit/Makefile.in b/modules/libblit/Makefile.in
new file mode 100644
index 0000000..c3b02bb
--- /dev/null
+++ b/modules/libblit/Makefile.in
@@ -0,0 +1,626 @@
+# Makefile.in generated by automake 1.12.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#AUTOMAKE_OPTIONS = no-dependencies foreign
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = libblit
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(libdir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libblit_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_libblit_la_OBJECTS = libblit_la-libblit.lo libblit_la-g_blit.lo \
+ libblit_la-g_pixel.lo
+libblit_la_OBJECTS = $(am_libblit_la_OBJECTS)
+libblit_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libblit_la_CFLAGS) \
+ $(CFLAGS) $(libblit_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libblit_la_SOURCES)
+DIST_SOURCES = $(libblit_la_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BGD_PATH = @BGD_PATH@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMMON_CFLAGS = @COMMON_CFLAGS@
+COMMON_LDFLAGS = @COMMON_LDFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DESLIBS = @DESLIBS@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PNGLIBS = @PNGLIBS@
+PNG_CFLAGS = @PNG_CFLAGS@
+PNG_LIBS = @PNG_LIBS@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_LIBS = @SDL_LIBS@
+SDL_mixer_CFLAGS = @SDL_mixer_CFLAGS@
+SDL_mixer_LIBS = @SDL_mixer_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+WINDRES = @WINDRES@
+X11LIBS = @X11LIBS@
+ZLIBS = @ZLIBS@
+ZLIB_CFLAGS = @ZLIB_CFLAGS@
+ZLIB_LIBS = @ZLIB_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+lib_LTLIBRARIES = libblit.la
+libblit_la_SOURCES = libblit.c g_blit.c g_pixel.c
+libblit_la_CFLAGS = $(COMMON_CFLAGS) $(SDL_CFLAGS) -I$(BGD_PATH)/include -I$(BGD_PATH)/bgdrtm/include -I. -I../libgrbase/
+libblit_la_LDFLAGS = -s -module -no-undefined -avoid-version
+libblit_la_LIBADD = $(COMMON_LDFLAGS) $(SDL_LIBS) -L$(BGD_PATH)/bgdrtm/src/.libs -lbgdrtm -L../libgrbase/.libs -lgrbase
+CLEANFILES = libblit.la
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libblit/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu libblit/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+ }
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+libblit.la: $(libblit_la_OBJECTS) $(libblit_la_DEPENDENCIES) $(EXTRA_libblit_la_DEPENDENCIES)
+ $(libblit_la_LINK) -rpath $(libdir) $(libblit_la_OBJECTS) $(libblit_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libblit_la-g_blit.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libblit_la-g_pixel.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libblit_la-libblit.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+libblit_la-libblit.lo: libblit.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblit_la_CFLAGS) $(CFLAGS) -MT libblit_la-libblit.lo -MD -MP -MF $(DEPDIR)/libblit_la-libblit.Tpo -c -o libblit_la-libblit.lo `test -f 'libblit.c' || echo '$(srcdir)/'`libblit.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libblit_la-libblit.Tpo $(DEPDIR)/libblit_la-libblit.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libblit.c' object='libblit_la-libblit.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblit_la_CFLAGS) $(CFLAGS) -c -o libblit_la-libblit.lo `test -f 'libblit.c' || echo '$(srcdir)/'`libblit.c
+
+libblit_la-g_blit.lo: g_blit.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblit_la_CFLAGS) $(CFLAGS) -MT libblit_la-g_blit.lo -MD -MP -MF $(DEPDIR)/libblit_la-g_blit.Tpo -c -o libblit_la-g_blit.lo `test -f 'g_blit.c' || echo '$(srcdir)/'`g_blit.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libblit_la-g_blit.Tpo $(DEPDIR)/libblit_la-g_blit.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='g_blit.c' object='libblit_la-g_blit.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblit_la_CFLAGS) $(CFLAGS) -c -o libblit_la-g_blit.lo `test -f 'g_blit.c' || echo '$(srcdir)/'`g_blit.c
+
+libblit_la-g_pixel.lo: g_pixel.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblit_la_CFLAGS) $(CFLAGS) -MT libblit_la-g_pixel.lo -MD -MP -MF $(DEPDIR)/libblit_la-g_pixel.Tpo -c -o libblit_la-g_pixel.lo `test -f 'g_pixel.c' || echo '$(srcdir)/'`g_pixel.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libblit_la-g_pixel.Tpo $(DEPDIR)/libblit_la-g_pixel.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='g_pixel.c' object='libblit_la-g_pixel.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblit_la_CFLAGS) $(CFLAGS) -c -o libblit_la-g_pixel.lo `test -f 'g_pixel.c' || echo '$(srcdir)/'`g_pixel.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-libLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLTLIBRARIES clean-libtool cscopelist ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am \
+ install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-libLTLIBRARIES
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/modules/libblit/g_blit.c b/modules/libblit/g_blit.c
new file mode 100644
index 0000000..49b0948
--- /dev/null
+++ b/modules/libblit/g_blit.c
@@ -0,0 +1,2959 @@
+/*
+ * Copyright � 2006-2016 SplinterGU (Fenix/Bennugd)
+ * Copyright � 2002-2006 Fenix Team (Fenix)
+ * Copyright � 1999-2002 Jos� Luis Cebri�n Pag�e (Fenix)
+ *
+ * This file is part of Bennu - Game Development
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ */
+
+/* --------------------------------------------------------------------------- */
+
+#include <stdlib.h>
+#include <limits.h>
+#include <stdio.h>
+#include <fmath.h>
+
+/*#include <math.h>
+typedef long int fixed ;
+#define FIXED_PREC 10000
+#define fixtof(a) (( ( float ) a ) / FIXED_PREC )
+#define fcos(a) (cos(a* M_PI / 180000.0)*FIXED_PREC)
+#define fsin(a) (sin(a* M_PI / 180000.0)*FIXED_PREC)
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+*/
+#include "libblit.h"
+
+/* --------------------------------------------------------------------------- */
+
+/* Define some constants and structs used by the blitter */
+
+typedef struct
+{
+ int x, y;
+}
+_POINT;
+
+typedef struct
+{
+ float x, y;
+}
+_POINTF;
+
+typedef struct
+{
+ int x;
+ int y;
+ float s;
+ float t;
+}
+VERTEX;
+
+/* --------------------------------------------------------------------------- */
+
+typedef _POINTF VECTOR;
+
+typedef void ( DRAW_SPAN )( GRAPH *, GRAPH *, int, int, int, int, int, int, int );
+typedef void ( DRAW_HSPAN )( void *, void *, int, int, int, int, int );
+typedef int ( BLEND_FUNC )( int, int );
+
+/* --------------------------------------------------------------------------- */
+
+/* Conversion tables used by transparency /blending
+ *
+ * In 16 bits, this two lookup tables will be used as:
+ *
+ * Dest_color = ghost1[screen_color] + ghost2[graphic_color]
+ *
+ * In transparency mode, both tables are the assigned to the ghostcolor global table
+ * (a table that reduces all color components to half)
+ */
+
+uint16_t * ghost1;
+uint16_t * ghost2;
+uint8_t * ghost8;
+
+uint32_t * pcolorequiv = NULL ;
+
+uint32_t _factor ;
+uint32_t _factor2 ;
+
+/* --------------------------------------------------------------------------- */
+
+/* Calculates additive blend value */
+
+static BLEND_FUNC * blend_func;
+
+/* --------------------------------------------------------------------------- */
+
+static int substractive_blend8( int A, int B )
+{
+ int32_t r, g, b, r2, g2, b2;
+
+ gr_get_rgb( B, &r, &g, &b );
+ gr_get_rgb( A, &r2, &g2, &b2 );
+
+ r += ( r2 - 256 ); if ( r < 0 ) r = 0;
+ g += ( g2 - 256 ); if ( g < 0 ) g = 0;
+ b += ( b2 - 256 ); if ( b < 0 ) b = 0;
+
+ return gr_find_nearest_color( r, g, b );
+}
+
+static int substractive_blend16( int A, int B )
+{
+ int32_t r, g, b;
+
+ r = ( B & 0x0000F800 ) + (( A & 0x0000F800 ) - 0x00010000 );
+ g = ( B & 0x000007e0 ) + (( A & 0x000007e0 ) - 0x00000800 );
+ b = ( B & 0x0000001f ) + (( A & 0x0000001f ) - 0x00000020 );
+
+ if ( r & 0xFFFF07FF ) r = 0 ;
+ if ( g & 0xFFFFF81F ) g = 0 ;
+ if ( b & 0xFFFFFFE0 ) b = 0 ;
+
+ return ( r | g | b );
+}
+
+static int substractive_blend32( int A, int B )
+{
+ uint32_t r, g, b/*, a*/;
+
+ /* NOTE: ~ and << are expensive */
+
+ r = ( B & 0x00ff0000 ) + ( A & 0x00ff0000 ) - 0x01000000 ;
+ g = ( B & 0x0000ff00 ) + ( A & 0x0000ff00 ) - 0x00010000 ;
+ b = ( B & 0x000000ff ) + ( A & 0x000000ff ) - 0x00000100 ;
+// a = ( B & 0xff000000 ) + ( A & 0xff000000 ) - 0x00000001 ;
+
+ if ( r & 0xFF00FFFF ) r = 0 ;
+ if ( g & 0xFFFF00FF ) g = 0 ;
+ if ( b & 0xFFFFFF00 ) b = 0 ;
+// if ( a & 0x00FFFFFF ) a = 0 ;
+
+ return ( r | g | b /*| a*/ );
+}
+
+static int additive_blend8( int A, int B )
+{
+ int32_t r, g, b, r2, g2, b2;
+
+ gr_get_rgb( B, &r, &g, &b );
+ gr_get_rgb( A, &r2, &g2, &b2 );
+
+ r += r2; if ( r > 255 ) r = 255;
+ g += g2; if ( g > 255 ) g = 255;
+ b += b2; if ( b > 255 ) b = 255;
+
+ return gr_find_nearest_color( r, g, b );
+}
+
+static int additive_blend16( int A, int B )
+{
+ int32_t r, g, b;
+
+ r = ( B & 0x0000F800 ) + ( A & 0x0000F800 ) ;
+ g = ( B & 0x000007e0 ) + ( A & 0x000007e0 ) ;
+ b = ( B & 0x0000001f ) + ( A & 0x0000001f ) ;
+
+ if ( r & 0xFFFF07FF ) r = 0x0000F800 ;
+ if ( g & 0xFFFFF81F ) g = 0x000007e0 ;
+ if ( b & 0xFFFFFFE0 ) b = 0x0000001f ;
+
+ return ( r | g | b );
+}
+
+static int additive_blend32( int A, int B )
+{
+ uint32_t r, g, b/*, a*/;
+
+ r = ( B & 0x00ff0000 ) + ( A & 0x00ff0000 ) ;
+ g = ( B & 0x0000ff00 ) + ( A & 0x0000ff00 ) ;
+ b = ( B & 0x000000ff ) + ( A & 0x000000ff ) ;
+// a = ( B & 0xff000000 ) + ( A & 0xff000000 ) ;
+
+ if ( r & 0xFF00FFFF ) r = 0x00ff0000 ;
+ if ( g & 0xFFFF00FF ) g = 0x0000ff00 ;
+ if ( b & 0xFFFFFF00 ) b = 0x000000ff ;
+// if ( a & 0x00FFFFFF ) b = 0xFF000000 ;
+
+ return ( r | g | b /*| a*/ );
+}
+
+/* --------------------------------------------------------------------------- */
+
+/* Routine to sort vertexes in y, x order */
+static int compare_vertex_y( const VERTEX * a, const VERTEX * b )
+{
+ return ( a->y == b->y ) ? a->x - b->x : a->y - b->y;
+}
+
+/* --------------------------------------------------------------------------- */
+/*
+ * FUNCTION : gr_draw_span_XXX
+ *
+ * Draw a textures span line into a bitmap. Those functions
+ * represent the inner loop of the blitter.
+ *
+ * This file includes unoptimized C versions of those functions
+ *
+ * There is one version of this function for each bit depth
+ * and blend effect configuration
+ *
+ * PARAMS :
+ * dest Destination bitmap or NULL for screen
+ * orig Pointer to the graphic object to draw
+ * x, y Pixel coordinates of the destination leftmost point
+ * pixels Number of pixels to draw
+ * s, t Texture coordinates of the leftmost point
+ * s2, t2 Texture coordinates of the rightmost point
+ *
+ * RETURN VALUE :
+ * None
+ *
+ */
+/* --------------------------------------------------------------------------- */
+
+/*
+static void draw_span_1to1(GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct)
+{
+ uint8_t *ptr = (uint8_t *)dest->data + dest->pitch * y + x/8 ;
+ int cs = s, ct = t, i;
+
+ for (i = 0 ; i < pixels ; i++)
+ {
+ uint8_t * tex = (uint8_t *)orig->data + orig->pitch *(ct >> 16)/8 + (cs >> 16)/8;
+ uint8_t mask = (0x80 >> ((cs >> 16)/8 & 7));
+
+ *ptr |= (*tex & mask);
+
+ if (ct%8==7) ptr++;
+
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_1to1_nocolorkey(GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct)
+{
+ uint8_t *ptr = (uint8_t *)dest->data + dest->pitch * y + x/8 ;
+ int cs = s, ct = t, i;
+
+ for (i = 0 ; i < pixels ; i++)
+ {
+ uint8_t * tex = (uint8_t *)orig->data + orig->pitch *(ct >> 16)/8 + (cs >> 16)/8;
+ uint8_t mask = (0x80 >> ((cs >> 16)/8 & 7));
+
+ *ptr &= ~mask;
+ *ptr |= (*tex & mask);
+
+ if (ct%8==7) ptr++;
+
+ cs += incs, ct += inct;
+ }
+}
+*/
+
+/* --------------------------------------------------------------------------- */
+/* 1 to 8 */
+/* --------------------------------------------------------------------------- */
+
+static void draw_span_1to8( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint8_t *ptr = ( uint8_t * ) dest->data + dest->pitch * y + x ;
+ int cs = s, ct = t;
+
+ while ( pixels-- )
+ {
+ uint8_t * tex = ( uint8_t * ) orig->data + orig->pitch * ( ct >> 16 ) + ( cs >> 16 ) / 8;
+ uint8_t mask = ( 0x80 >> (( cs >> 16 ) & 7 ) );
+ if ( *tex & mask ) *ptr++ = pixel_color8;
+ else ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+/* --------------------------------------------------------------------------- */
+/* 8 to 8 */
+/* --------------------------------------------------------------------------- */
+
+static void draw_span_8to8_nocolorkey( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint8_t *ptr = ( uint8_t * ) dest->data + dest->pitch * y + x;
+ int cs = s, ct = t;
+
+ while ( pixels-- )
+ {
+ uint8_t * tex = ( uint8_t * ) orig->data + orig->pitch * ( ct >> 16 ) + ( cs >> 16 );
+ *ptr++ = *tex;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_8to8_translucent( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint8_t *ptr = ( uint8_t * ) dest->data + dest->pitch * y + x;
+ int cs = s, ct = t;
+
+ while ( pixels-- )
+ {
+ uint8_t * tex = ( uint8_t * ) orig->data + orig->pitch * ( ct >> 16 ) + ( cs >> 16 );
+ if ( *tex ) *ptr = ghost8[( *tex << 8 ) + *ptr];
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_8to8( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint8_t *ptr = ( uint8_t * ) dest->data + dest->pitch * y + x;
+ int cs = s, ct = t;
+
+ while ( pixels-- )
+ {
+ uint8_t * tex = ( uint8_t * ) orig->data + orig->pitch * ( ct >> 16 ) + ( cs >> 16 );
+ if ( *tex ) *ptr = *tex;
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_8to8_ablend( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint8_t *ptr = ( uint8_t * ) dest->data + dest->pitch * y + x;
+ int cs = s, ct = t;
+
+ while ( pixels-- )
+ {
+ uint8_t * tex = ( uint8_t * ) orig->data + orig->pitch * ( ct >> 16 ) + ( cs >> 16 );
+
+ if ( *tex ) *ptr = ( uint8_t ) blend_func( *tex, *ptr );
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_8to8_tablend( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint8_t *ptr = ( uint8_t * ) dest->data + dest->pitch * y + x;
+ int cs = s, ct = t;
+
+ while ( pixels-- )
+ {
+ uint8_t * tex = ( uint8_t * ) orig->data + orig->pitch * ( ct >> 16 ) + ( cs >> 16 );
+ if ( *tex ) *ptr = ( uint8_t ) ghost8[(blend_func( *tex, *ptr ) << 8 )+ *ptr ];
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+/* --------------------------------------------------------------------------- */
+/* 1 to 16 */
+/* --------------------------------------------------------------------------- */
+
+static void draw_span_1to16( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint16_t *ptr = ( uint16_t * ) dest->data + ( dest->pitch * y >> 1 ) + x ;
+ int cs = s, ct = t;
+
+ while ( pixels-- )
+ {
+ uint8_t * tex = ( uint8_t * ) orig->data + orig->pitch * ( ct >> 16 ) + ( cs >> 16 ) / 8;
+ uint8_t mask = ( 0x80 >> (( cs >> 16 ) & 7 ) );
+ if ( *tex & mask ) *ptr++ = pixel_color16;
+ else ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+/* --------------------------------------------------------------------------- */
+/* 8 to 16 */
+/* --------------------------------------------------------------------------- */
+
+static void draw_span_8to16( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint16_t *ptr = ( uint16_t * ) dest->data + ( dest->pitch * y >> 1 ) + x;
+ int cs = s, ct = t;
+
+ while ( pixels-- )
+ {
+ uint8_t * tex = ( uint8_t * ) orig->data + orig->pitch * ( ct >> 16 ) + ( cs >> 16 );
+ if ( *tex ) *ptr = pcolorequiv[*tex];
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_8to16_ablend( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint16_t *ptr = ( uint16_t * ) dest->data + ( dest->pitch * y >> 1 ) + x;
+ int cs = s, ct = t;
+
+ while ( pixels-- )
+ {
+ uint8_t * tex = ( uint8_t * ) orig->data + orig->pitch * ( ct >> 16 ) + ( cs >> 16 );
+ if ( *tex ) *ptr = blend_func( pcolorequiv[*tex], *ptr );
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_8to16_tablend( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint16_t *ptr = ( uint16_t * ) dest->data + ( dest->pitch * y >> 1 ) + x;
+ int cs = s, ct = t;
+
+ while ( pixels-- )
+ {
+ uint8_t * tex = ( uint8_t * ) orig->data + orig->pitch * ( ct >> 16 ) + ( cs >> 16 );
+ if ( *tex ) *ptr = ( uint16_t )( ghost1[blend_func( pcolorequiv[*tex], *ptr )] + ghost2[*ptr] );
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_8to16_translucent( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint16_t *ptr = ( uint16_t * ) dest->data + ( dest->pitch * y >> 1 ) + x;
+ int cs = s, ct = t;
+
+ while ( pixels-- )
+ {
+ uint8_t * tex = ( uint8_t * ) orig->data + orig->pitch * ( ct >> 16 ) + ( cs >> 16 );
+ if ( *tex ) *ptr = ghost1[pcolorequiv[*tex]] + ghost2[*ptr];
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_8to16_nocolorkey( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint16_t *ptr = ( uint16_t * ) dest->data + ( dest->pitch * y >> 1 ) + x;
+ int cs = s, ct = t;
+
+ while ( pixels-- )
+ {
+ uint8_t * tex = ( uint8_t * ) orig->data + orig->pitch * ( ct >> 16 ) + ( cs >> 16 );
+ *ptr++ = pcolorequiv[*tex];
+ cs += incs, ct += inct;
+ }
+}
+
+/* --------------------------------------------------------------------------- */
+/* 8 to 32 */
+/* --------------------------------------------------------------------------- */
+
+static void draw_span_8to32( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint32_t *ptr = ( uint32_t * ) dest->data + ( dest->pitch * y >> 2 ) + x;
+ int cs = s, ct = t;
+
+ while ( pixels-- )
+ {
+ uint8_t * tex = ( uint8_t * ) orig->data + orig->pitch * ( ct >> 16 ) + ( cs >> 16 );
+ if ( *tex ) *ptr = ( *ptr & 0xff000000 ) | pcolorequiv[*tex];
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_8to32_ablend( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint32_t *ptr = ( uint32_t * ) dest->data + ( dest->pitch * y >> 2 ) + x;
+ int cs = s, ct = t;
+
+ while ( pixels-- )
+ {
+ uint8_t * tex = ( uint8_t * ) orig->data + orig->pitch * ( ct >> 16 ) + ( cs >> 16 );
+ if ( *tex ) *ptr = ( *ptr & 0xff000000 ) | blend_func( pcolorequiv[*tex], *ptr );
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_8to32_tablend( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint32_t *ptr = ( uint32_t * ) dest->data + ( dest->pitch * y >> 2 ) + x;
+ int cs = s, ct = t;
+ uint32_t r, g, b, c;
+
+ while ( pixels-- )
+ {
+ uint8_t * tex = ( uint8_t * ) orig->data + orig->pitch * ( ct >> 16 ) + ( cs >> 16 );
+ if ( *tex )
+ {
+ c = blend_func( pcolorequiv[*tex], *ptr ) ;
+
+ r = ((( c & 0x00ff0000 ) * _factor ) + (( *ptr & 0x00ff0000 ) * _factor2 ) ) >> 8 ;
+ g = ((( c & 0x0000ff00 ) * _factor ) + (( *ptr & 0x0000ff00 ) * _factor2 ) ) >> 8 ;
+ b = ((( c & 0x000000ff ) * _factor ) + (( *ptr & 0x000000ff ) * _factor2 ) ) >> 8 ;
+
+ if ( r > 0x00ff0000 ) r = 0x00ff0000 ; else r &= 0x00ff0000 ;
+ if ( g > 0x0000ff00 ) g = 0x0000ff00 ; else g &= 0x0000ff00 ;
+ if ( b > 0x000000ff ) b = 0x000000ff ; else b &= 0x000000ff ;
+
+ *ptr = ( *ptr & 0xff000000 ) | r | g | b ;
+ }
+
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_8to32_translucent( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint32_t *ptr = ( uint32_t * ) dest->data + ( dest->pitch * y >> 2 ) + x;
+ int cs = s, ct = t;
+ uint32_t r, g, b, c;
+
+ while ( pixels-- )
+ {
+ uint8_t * tex = ( uint8_t * ) orig->data + orig->pitch * ( ct >> 16 ) + ( cs >> 16 );
+ if ( *tex )
+ {
+ c = pcolorequiv[*tex];
+
+ r = ((( c & 0x00ff0000 ) * _factor ) + (( *ptr & 0x00ff0000 ) * _factor2 ) ) >> 8 ;
+ g = ((( c & 0x0000ff00 ) * _factor ) + (( *ptr & 0x0000ff00 ) * _factor2 ) ) >> 8 ;
+ b = ((( c & 0x000000ff ) * _factor ) + (( *ptr & 0x000000ff ) * _factor2 ) ) >> 8 ;
+
+ if ( r > 0x00ff0000 ) r = 0x00ff0000 ; else r &= 0x00ff0000 ;
+ if ( g > 0x0000ff00 ) g = 0x0000ff00 ; else g &= 0x0000ff00 ;
+ if ( b > 0x000000ff ) b = 0x000000ff ; else b &= 0x000000ff ;
+
+ *ptr = ( *ptr & 0xff000000 ) | r | g | b ;
+ }
+
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_8to32_nocolorkey( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint32_t *ptr = ( uint32_t * ) dest->data + ( dest->pitch * y >> 2 ) + x;
+ int cs = s, ct = t;
+
+ while ( pixels-- )
+ {
+ uint8_t * tex = ( uint8_t * ) orig->data + orig->pitch * ( ct >> 16 ) + ( cs >> 16 );
+ *ptr = ( *ptr & 0xff000000 ) | pcolorequiv[*tex];
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+/* --------------------------------------------------------------------------- */
+/* 16 to 16 */
+/* --------------------------------------------------------------------------- */
+
+static void draw_span_16to16( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint16_t *ptr = ( uint16_t * ) dest->data + ( dest->pitch * y >> 1 ) + x;
+ int cs = s, ct = t;
+ uint16_t * tex ;
+
+ while ( pixels-- )
+ {
+ tex = ( uint16_t * ) orig->data + ( orig->pitch * ( ct >> 16 ) >> 1 ) + ( cs >> 16 );
+ if ( *tex ) *ptr = *tex;
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_16to16_ablend( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint16_t *ptr = ( uint16_t * ) dest->data + ( dest->pitch * y >> 1 ) + x;
+ int cs = s, ct = t;
+ uint16_t * tex ;
+
+ while ( pixels-- )
+ {
+ tex = ( uint16_t * ) orig->data + ( orig->pitch * ( ct >> 16 ) >> 1 ) + ( cs >> 16 );
+ if ( *tex ) *ptr = blend_func( *tex, *ptr );
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_16to16_tablend( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint16_t *ptr = ( uint16_t * ) dest->data + ( dest->pitch * y >> 1 ) + x;
+ int cs = s, ct = t;
+ uint16_t * tex ;
+
+ while ( pixels-- )
+ {
+ tex = ( uint16_t * ) orig->data + ( orig->pitch * ( ct >> 16 ) >> 1 ) + ( cs >> 16 );
+ if ( *tex ) *ptr = ( uint16_t )( ghost1[blend_func( *tex,*ptr )] + ghost2[*ptr] );
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_16to16_translucent( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint16_t *ptr = ( uint16_t * ) dest->data + ( dest->pitch * y >> 1 ) + x;
+ int cs = s, ct = t;
+ uint16_t * tex ;
+
+ while ( pixels-- )
+ {
+ tex = ( uint16_t * ) orig->data + ( orig->pitch * ( ct >> 16 ) >> 1 ) + ( cs >> 16 );
+ if ( *tex ) *ptr = ghost1[*tex] + ghost2[*ptr];
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_16to16_nocolorkey( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint16_t *ptr = ( uint16_t * ) dest->data + ( dest->pitch * y >> 1 ) + x;
+ int cs = s, ct = t;
+ uint16_t * tex ;
+
+ while ( pixels-- )
+ {
+ tex = ( uint16_t * ) orig->data + ( orig->pitch * ( ct >> 16 ) >> 1 ) + ( cs >> 16 );
+ *ptr++ = *tex;
+ cs += incs, ct += inct;
+ }
+}
+
+/* --------------------------------------------------------------------------- */
+/* 16 to 32 */
+/* --------------------------------------------------------------------------- */
+
+static void draw_span_16to32( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint32_t *ptr = ( uint32_t * ) dest->data + ( dest->pitch * y >> 2 ) + x;
+ int cs = s, ct = t;
+ uint16_t * tex ;
+
+ while ( pixels-- )
+ {
+ tex = ( uint16_t * ) orig->data + ( orig->pitch * ( ct >> 16 ) >> 1 ) + ( cs >> 16 );
+ if ( *tex ) *ptr = ( *ptr & 0xff000000 ) | (( * tex & 0xf800 ) << 8 ) | (( * tex & 0x07e0 ) << 5 ) | (( * tex & 0x001f ) << 3 ) ;
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_16to32_ablend( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint32_t *ptr = ( uint32_t * ) dest->data + ( dest->pitch * y >> 2 ) + x;
+ int cs = s, ct = t;
+ uint16_t * tex ;
+
+ while ( pixels-- )
+ {
+ tex = ( uint16_t * ) orig->data + ( orig->pitch * ( ct >> 16 ) >> 1 ) + ( cs >> 16 );
+ if ( *tex ) *ptr = ( *ptr & 0xff000000 ) | blend_func((( * tex & 0xf800 ) << 8 ) | (( * tex & 0x07e0 ) << 5 ) | (( * tex & 0x001f ) << 3 ), *ptr );
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_16to32_tablend( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint32_t *ptr = ( uint32_t * ) dest->data + ( dest->pitch * y >> 2 ) + x;
+ int cs = s, ct = t;
+ uint16_t * tex ;
+ uint32_t r, g, b, c;
+
+ while ( pixels-- )
+ {
+ tex = ( uint16_t * ) orig->data + ( orig->pitch * ( ct >> 16 ) >> 1 ) + ( cs >> 16 );
+ if ( *tex )
+ {
+ c = blend_func((( * tex & 0xf800 ) << 8 ) | (( * tex & 0x07e0 ) << 5 ) | (( * tex & 0x001f ) << 3 ), *ptr ) ;
+
+ r = ((( c & 0x00ff0000 ) * _factor ) + (( *ptr & 0x00ff0000 ) * _factor2 ) ) >> 8 ;
+ g = ((( c & 0x0000ff00 ) * _factor ) + (( *ptr & 0x0000ff00 ) * _factor2 ) ) >> 8 ;
+ b = ((( c & 0x000000ff ) * _factor ) + (( *ptr & 0x000000ff ) * _factor2 ) ) >> 8 ;
+
+ if ( r > 0x00ff0000 ) r = 0x00ff0000 ; else r &= 0x00ff0000 ;
+ if ( g > 0x0000ff00 ) g = 0x0000ff00 ; else g &= 0x0000ff00 ;
+ if ( b > 0x000000ff ) b = 0x000000ff ; else b &= 0x000000ff ;
+
+ *ptr = ( *ptr & 0xff000000 ) | r | g | b ;
+ }
+
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_16to32_translucent( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint32_t *ptr = ( uint32_t * ) dest->data + ( dest->pitch * y >> 2 ) + x;
+ int cs = s, ct = t;
+ uint16_t * tex ;
+ int r, g, b, c;
+
+ while ( pixels-- )
+ {
+ tex = ( uint16_t * ) orig->data + ( orig->pitch * ( ct >> 16 ) >> 1 ) + ( cs >> 16 );
+ if ( *tex )
+ {
+ c = (( * tex & 0xf800 ) << 8 ) | (( * tex & 0x07e0 ) << 5 ) | (( * tex & 0x001f ) << 3 );
+
+ r = ((( c & 0x00ff0000 ) * _factor ) + (( *ptr & 0x00ff0000 ) * _factor2 ) ) >> 8 ;
+ g = ((( c & 0x0000ff00 ) * _factor ) + (( *ptr & 0x0000ff00 ) * _factor2 ) ) >> 8 ;
+ b = ((( c & 0x000000ff ) * _factor ) + (( *ptr & 0x000000ff ) * _factor2 ) ) >> 8 ;
+
+ if ( r > 0x00ff0000 ) r = 0x00ff0000 ; else r &= 0x00ff0000 ;
+ if ( g > 0x0000ff00 ) g = 0x0000ff00 ; else g &= 0x0000ff00 ;
+ if ( b > 0x000000ff ) b = 0x000000ff ; else b &= 0x000000ff ;
+
+ *ptr = ( *ptr & 0xff000000 ) | r | g | b ;
+ }
+
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_16to32_nocolorkey( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint32_t *ptr = ( uint32_t * ) dest->data + ( dest->pitch * y >> 2 ) + x;
+ int cs = s, ct = t;
+ uint16_t * tex ;
+
+ while ( pixels-- )
+ {
+ tex = ( uint16_t * ) orig->data + ( orig->pitch * ( ct >> 16 ) >> 1 ) + ( cs >> 16 );
+ *ptr = ( *ptr & 0xff000000 ) | (( * tex & 0xf800 ) << 8 ) | (( * tex & 0x07e0 ) << 5 ) | (( * tex & 0x001f ) << 3 );
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+/* --------------------------------------------------------------------------- */
+/* 1 to 32 */
+/* --------------------------------------------------------------------------- */
+
+static void draw_span_1to32( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint32_t *ptr = ( uint32_t * ) dest->data + ( dest->pitch * y >> 2 ) + x ;
+ int cs = s, ct = t;
+
+ while ( pixels-- )
+ {
+ uint8_t * tex = ( uint8_t * ) orig->data + orig->pitch * ( ct >> 16 ) + ( cs >> 16 ) / 8;
+ uint8_t mask = ( 0x80 >> (( cs >> 16 ) & 7 ) );
+ if ( *tex & mask ) *ptr = ( *ptr & 0xff000000 ) | pixel_color32;
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+/* --------------------------------------------------------------------------- */
+/* 32 to 32 */
+/* --------------------------------------------------------------------------- */
+
+static void draw_span_32to32( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint32_t *ptr = ( uint32_t * ) dest->data + ( dest->pitch * y >> 2 ) + x;
+ int cs = s, ct = t;
+ uint32_t * tex ;
+ int r, g, b, c;
+
+ while ( pixels-- )
+ {
+ tex = ( uint32_t * ) orig->data + ( orig->pitch * ( ct >> 16 ) >> 2 ) + ( cs >> 16 );
+ if ( *tex )
+ {
+ if ( *tex ^ 0xff000000 )
+ {
+ c = *tex;
+ _factor = ( c & 0xff000000 ) >> 24;
+ _factor2 = 255 - _factor;
+
+ r = ((( c & 0x00ff0000 ) * _factor ) + (( *ptr & 0x00ff0000 ) * _factor2 ) ) >> 8 ;
+ g = ((( c & 0x0000ff00 ) * _factor ) + (( *ptr & 0x0000ff00 ) * _factor2 ) ) >> 8 ;
+ b = ((( c & 0x000000ff ) * _factor ) + (( *ptr & 0x000000ff ) * _factor2 ) ) >> 8 ;
+
+ if ( r > 0x00ff0000 ) r = 0x00ff0000 ; else r &= 0x00ff0000 ;
+ if ( g > 0x0000ff00 ) g = 0x0000ff00 ; else g &= 0x0000ff00 ;
+ if ( b > 0x000000ff ) b = 0x000000ff ; else b &= 0x000000ff ;
+
+ *ptr = ( MAX( c & 0xff000000, *ptr & 0xff000000 ) ) | r | g | b ;
+ }
+ else if ( *tex )
+ *ptr = *tex;
+ }
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_32to32_ablend( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint32_t *ptr = ( uint32_t * ) dest->data + ( dest->pitch * y >> 2 ) + x;
+ int cs = s, ct = t;
+ uint32_t * tex ;
+ uint32_t r, g, b, c;
+
+ while ( pixels-- )
+ {
+ tex = ( uint32_t * ) orig->data + ( orig->pitch * ( ct >> 16 ) >> 2 ) + ( cs >> 16 );
+ if ( *tex )
+ {
+ if ( *tex ^ 0xff000000 )
+ {
+ c = blend_func( *tex, *ptr );
+ _factor = ( *tex & 0xff000000 ) >> 24;
+ _factor2 = 255 - _factor;
+
+ r = ((( c & 0x00ff0000 ) * _factor ) + (( *ptr & 0x00ff0000 ) * _factor2 ) ) >> 8 ;
+ g = ((( c & 0x0000ff00 ) * _factor ) + (( *ptr & 0x0000ff00 ) * _factor2 ) ) >> 8 ;
+ b = ((( c & 0x000000ff ) * _factor ) + (( *ptr & 0x000000ff ) * _factor2 ) ) >> 8 ;
+
+ if ( r > 0x00ff0000 ) r = 0x00ff0000 ; else r &= 0x00ff0000 ;
+ if ( g > 0x0000ff00 ) g = 0x0000ff00 ; else g &= 0x0000ff00 ;
+ if ( b > 0x000000ff ) b = 0x000000ff ; else b &= 0x000000ff ;
+
+ *ptr = ( MAX( c & 0xff000000, *ptr & 0xff000000 ) ) | r | g | b ;
+ }
+ else if ( *tex )
+ *ptr = ( MAX( *tex & 0xff000000, *ptr & 0xff000000 ) ) | blend_func( *tex, *ptr );
+ }
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_32to32_tablend( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint32_t *ptr = ( uint32_t * ) dest->data + ( dest->pitch * y >> 2 ) + x;
+ int cs = s, ct = t;
+ uint32_t * tex ;
+ uint32_t r, g, b;
+ unsigned int c, _f, _f2;
+
+ while ( pixels-- )
+ {
+ tex = ( uint32_t * ) orig->data + ( orig->pitch * ( ct >> 16 ) >> 2 ) + ( cs >> 16 );
+
+ if ( *tex )
+ {
+ c = blend_func( *tex, *ptr ) ;
+ _f = (( unsigned int ) * tex ) & 0xff000000;
+ if ( _f != 0xff000000 )
+ {
+ _f = ( _f >> 24 ) * _factor / 255 ;
+ _f2 = 255 - _f ;
+
+ r = ((( c & 0x00ff0000 ) * _f ) + (( *ptr & 0x00ff0000 ) * _f2 ) ) >> 8 ;
+ g = ((( c & 0x0000ff00 ) * _f ) + (( *ptr & 0x0000ff00 ) * _f2 ) ) >> 8 ;
+ b = ((( c & 0x000000ff ) * _f ) + (( *ptr & 0x000000ff ) * _f2 ) ) >> 8 ;
+ }
+ else
+ {
+ r = ((( c & 0x00ff0000 ) * _factor ) + (( *ptr & 0x00ff0000 ) * _factor2 ) ) >> 8 ;
+ g = ((( c & 0x0000ff00 ) * _factor ) + (( *ptr & 0x0000ff00 ) * _factor2 ) ) >> 8 ;
+ b = ((( c & 0x000000ff ) * _factor ) + (( *ptr & 0x000000ff ) * _factor2 ) ) >> 8 ;
+ }
+
+ if ( r > 0x00ff0000 ) r = 0x00ff0000 ; else r &= 0x00ff0000 ;
+ if ( g > 0x0000ff00 ) g = 0x0000ff00 ; else g &= 0x0000ff00 ;
+ if ( b > 0x000000ff ) b = 0x000000ff ; else b &= 0x000000ff ;
+
+ *ptr = ( MAX( c & 0xff000000, *ptr & 0xff000000 ) ) | r | g | b ;
+ }
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_32to32_translucent( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint32_t *ptr = ( uint32_t * ) dest->data + ( dest->pitch * y >> 2 ) + x;
+ int cs = s, ct = t;
+ uint32_t * tex ;
+ int r, g, b;
+ unsigned int c, _f, _f2;
+
+ while ( pixels-- )
+ {
+ tex = ( uint32_t * ) orig->data + ( orig->pitch * ( ct >> 16 ) >> 2 ) + ( cs >> 16 );
+
+ if ( *tex )
+ {
+ c = *tex ;
+ _f = c & 0xff000000;
+ if ( _f != 0xff000000 )
+ {
+ _f = ( _f >> 24 ) * _factor / 255 ;
+ _f2 = 255 - _f ;
+
+ r = ((( c & 0x00ff0000 ) * _f ) + (( *ptr & 0x00ff0000 ) * _f2 ) ) >> 8 ;
+ g = ((( c & 0x0000ff00 ) * _f ) + (( *ptr & 0x0000ff00 ) * _f2 ) ) >> 8 ;
+ b = ((( c & 0x000000ff ) * _f ) + (( *ptr & 0x000000ff ) * _f2 ) ) >> 8 ;
+ }
+ else
+ {
+ r = ((( c & 0x00ff0000 ) * _factor ) + (( *ptr & 0x00ff0000 ) * _factor2 ) ) >> 8 ;
+ g = ((( c & 0x0000ff00 ) * _factor ) + (( *ptr & 0x0000ff00 ) * _factor2 ) ) >> 8 ;
+ b = ((( c & 0x000000ff ) * _factor ) + (( *ptr & 0x000000ff ) * _factor2 ) ) >> 8 ;
+ }
+
+ if ( r > 0x00ff0000 ) r = 0x00ff0000 ; else r &= 0x00ff0000 ;
+ if ( g > 0x0000ff00 ) g = 0x0000ff00 ; else g &= 0x0000ff00 ;
+ if ( b > 0x000000ff ) b = 0x000000ff ; else b &= 0x000000ff ;
+
+ *ptr = ( MAX( c & 0xff000000, *ptr & 0xff000000 ) ) | r | g | b ;
+ }
+ ptr++;
+ cs += incs, ct += inct;
+ }
+}
+
+static void draw_span_32to32_nocolorkey( GRAPH * dest, GRAPH * orig, int x, int y, int pixels, int s, int t, int incs, int inct )
+{
+ uint32_t *ptr = ( uint32_t * ) dest->data + ( dest->pitch * y >> 2 ) + x;
+ int cs = s, ct = t;
+ uint32_t * tex ;
+
+ while ( pixels-- )
+ {
+ tex = ( uint32_t * ) orig->data + ( orig->pitch * ( ct >> 16 ) >> 2 ) + ( cs >> 16 );
+ *ptr++ = *tex;
+ cs += incs, ct += inct;
+ }
+}
+
+/* --------------------------------------------------------------------------- */
+/*
+ * FUNCTION : gr_draw_hspan_XXX
+ *
+ * Draw a textures span line into a bitmap. Those functions
+ * represent the inner loop of the blitter, but in an
+ * unscaled, non-rotated case (for gr_blit). Texture/screen
+ * coordinates are already calculated in origin/dest pointers.
+ *
+ * This file includes unoptimized C versions of those functions
+ *
+ * There is one version of this function for each bit depth
+ * and blend effect configuration
+ *
+ * PARAMS :
+ * dest Destination pointer
+ * tex Origin pointer
+ * pixels Number of pixels to draw
+ * incs Texture increment: must be 1 or -1
+ *
+ * RETURN VALUE :
+ * None
+ *
+ */
+
+/* Parameter for 1to8 and 16to8 */
+static int posx;
+
+/* --------------------------------------------------------------------------- */
+/* 1 to 8 */
+/* --------------------------------------------------------------------------- */
+
+static void draw_hspan_1to8( uint8_t *scr, uint8_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int mask, omask = ( 0x80 >> ( posx & 7 ) );
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ mask = omask;
+ for ( i = pixels; i--; )
+ {
+ if ( *tex & mask ) *scr++ = pixel_color8;
+ else scr++;
+ if ( incs < 0 )
+ {
+ if ( mask == 0x80 ) mask = 0x01, tex--;
+ else mask <<= 1;
+ }
+ else
+ {
+ if ( mask == 0x01 ) mask = 0x80, tex++;
+ else mask >>= 1;
+ }
+ }
+ scr = _scr += scr_inc; tex = _tex += tex_inc;
+ }
+}
+
+/* --------------------------------------------------------------------------- */
+/* 8 to 8 */
+/* --------------------------------------------------------------------------- */
+
+static void draw_hspan_8to8_nocolorkey( uint8_t *scr, uint8_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ *scr++ = *tex;
+ tex += incs;
+ }
+ scr = _scr += scr_inc; tex = _tex += tex_inc;
+ }
+}
+
+static void draw_hspan_8to8_translucent( uint8_t *scr, uint8_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex ) *scr = ghost8[( *tex << 8 ) + *scr];
+ scr++;
+ tex += incs;
+ }
+ scr = _scr += scr_inc; tex = _tex += tex_inc;
+ }
+}
+
+static void draw_hspan_8to8_tablend( uint8_t *scr, uint8_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex ) *scr = ( uint8_t ) ghost8[(blend_func( *tex,*scr ) << 8 )+ *scr ];
+ scr++;
+ tex += incs;
+ }
+ scr = _scr += scr_inc; tex = _tex += tex_inc;
+ }
+}
+
+static void draw_hspan_8to8_ablend( uint8_t *scr, uint8_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex ) *scr = ( uint8_t ) blend_func( *tex, *scr );
+ scr++;
+ tex += incs;
+ }
+ scr = _scr += scr_inc; tex = _tex += tex_inc;
+ }
+}
+
+static void draw_hspan_8to8( uint8_t *scr, uint8_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex ) *scr = *tex;
+ scr++;
+ tex += incs;
+ }
+ scr = _scr += scr_inc; tex = _tex += tex_inc;
+ }
+}
+
+/* --------------------------------------------------------------------------- */
+/* 1 to 16 */
+/* --------------------------------------------------------------------------- */
+
+static void draw_hspan_1to16( uint16_t *scr, uint8_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int mask, omask = ( 0x80 >> ( posx & 7 ) );
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ mask = omask;
+ for ( i = pixels; i--; )
+ {
+ if ( *tex & mask ) *scr++ = pixel_color16;
+ else scr++;
+ if ( incs < 0 )
+ {
+ if ( mask == 0x80 ) mask = 0x01, tex--;
+ else mask <<= 1;
+ }
+ else
+ {
+ if ( mask == 0x01 ) mask = 0x80, tex++;
+ else mask >>= 1;
+ }
+ }
+ scr = ( uint16_t * )( _scr += scr_inc ); tex = _tex += tex_inc;
+ }
+}
+
+/* --------------------------------------------------------------------------- */
+/* 8 to 16 */
+/* --------------------------------------------------------------------------- */
+
+static void draw_hspan_8to16( uint16_t *scr, uint8_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex ) *scr = pcolorequiv[*tex];
+ scr++;
+ tex += incs;
+ }
+ scr = ( uint16_t * )( _scr += scr_inc ); tex = _tex += tex_inc;
+ }
+}
+
+static void draw_hspan_8to16_ablend( uint16_t *scr, uint8_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex ) *scr = blend_func( pcolorequiv[*tex], *scr );
+ scr++;
+ tex += incs;
+ }
+ scr = ( uint16_t * )( _scr += scr_inc ); tex = _tex += tex_inc;
+ }
+}
+
+static void draw_hspan_8to16_tablend( uint16_t *scr, uint8_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex ) *scr = ( uint16_t )( ghost1[blend_func( pcolorequiv[*tex], *scr )] + ghost2[*scr] );
+ scr++;
+ tex += incs;
+ }
+ scr = ( uint16_t * )( _scr += scr_inc ); tex = _tex += tex_inc;
+ }
+}
+
+static void draw_hspan_8to16_translucent( uint16_t *scr, uint8_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex ) *scr = ghost1[pcolorequiv[*tex]] + ghost2[*scr];
+ scr++;
+ tex += incs;
+ }
+ scr = ( uint16_t * )( _scr += scr_inc ); tex = _tex += tex_inc;
+ }
+}
+
+static void draw_hspan_8to16_nocolorkey( uint16_t *scr, uint8_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ *scr++ = pcolorequiv[*tex];
+ tex += incs;
+ }
+ scr = ( uint16_t * )( _scr += scr_inc ); tex = _tex += tex_inc;
+ }
+}
+
+/* --------------------------------------------------------------------------- */
+/* 16 to 16 */
+/* --------------------------------------------------------------------------- */
+
+static void draw_hspan_16to16( uint16_t *scr, uint16_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex ) *scr = *tex;
+ scr++ ;
+ tex += incs;
+ }
+ scr = ( uint16_t * )( _scr += scr_inc ); tex = ( uint16_t * )( _tex += tex_inc );
+ }
+}
+
+static void draw_hspan_16to16_ablend( uint16_t *scr, uint16_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex ) *scr = blend_func( *tex, *scr );
+ scr++ ;
+ tex += incs;
+ }
+ scr = ( uint16_t * )( _scr += scr_inc ); tex = ( uint16_t * )( _tex += tex_inc );
+ }
+}
+
+static void draw_hspan_16to16_tablend( uint16_t *scr, uint16_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex ) *scr = ( uint16_t )( ghost1[blend_func( *tex,*scr )] + ghost2[*scr] );
+ scr++;
+ tex += incs;
+ }
+ scr = ( uint16_t * )( _scr += scr_inc ); tex = ( uint16_t * )( _tex += tex_inc );
+ }
+}
+
+static void draw_hspan_16to16_translucent( uint16_t *scr, uint16_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex ) *scr = ghost1[*tex] + ghost2[*scr];
+ scr++;
+ tex += incs;
+ }
+ scr = ( uint16_t * )( _scr += scr_inc ); tex = ( uint16_t * )( _tex += tex_inc );
+ }
+}
+
+static void draw_hspan_16to16_nocolorkey( uint16_t *scr, uint16_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ *scr++ = *tex;
+ tex += incs;
+ }
+ scr = ( uint16_t * )( _scr += scr_inc ); tex = ( uint16_t * )( _tex += tex_inc );
+ }
+}
+
+/* --------------------------------------------------------------------------- */
+/* 1 to 32 */
+/* --------------------------------------------------------------------------- */
+
+static void draw_hspan_1to32( uint32_t *scr, uint8_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int mask, omask = ( 0x80 >> ( posx & 7 ) );
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ mask = omask;
+ for ( i = pixels; i--; )
+ {
+ if ( *tex & mask ) *scr = ( *scr & 0xff000000 ) | pixel_color32;
+ scr++;
+ if ( incs < 0 )
+ {
+ if ( mask == 0x80 ) mask = 0x01, tex--;
+ else mask <<= 1;
+ }
+ else
+ {
+ if ( mask == 0x01 ) mask = 0x80, tex++;
+ else mask >>= 1;
+ }
+ }
+ scr = ( uint32_t * )( _scr += scr_inc ); tex = _tex += tex_inc;
+ }
+}
+
+/* --------------------------------------------------------------------------- */
+/* 8 to 32 */
+/* --------------------------------------------------------------------------- */
+
+static void draw_hspan_8to32( uint32_t *scr, uint8_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex ) *scr = ( *scr & 0xff000000 ) | pcolorequiv[*tex];
+ scr++;
+ tex += incs;
+ }
+ scr = ( uint32_t * )( _scr += scr_inc ); tex = _tex += tex_inc;
+ }
+}
+
+static void draw_hspan_8to32_ablend( uint32_t *scr, uint8_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex ) *scr = ( *scr & 0xff000000 ) | blend_func( pcolorequiv[*tex], *scr );
+ scr++;
+ tex += incs;
+ }
+ scr = ( uint32_t * )( _scr += scr_inc ); tex = _tex += tex_inc;
+ }
+}
+
+static void draw_hspan_8to32_tablend( uint32_t *scr, uint8_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+ uint32_t r, g, b, c;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex )
+ {
+ c = blend_func( pcolorequiv[*tex], *scr ) ;
+
+ r = ((( c & 0x00ff0000 ) * _factor ) + (( *scr & 0x00ff0000 ) * _factor2 ) ) >> 8 ;
+ g = ((( c & 0x0000ff00 ) * _factor ) + (( *scr & 0x0000ff00 ) * _factor2 ) ) >> 8 ;
+ b = ((( c & 0x000000ff ) * _factor ) + (( *scr & 0x000000ff ) * _factor2 ) ) >> 8 ;
+
+ if ( r > 0x00ff0000 ) r = 0x00ff0000 ; else r &= 0x00ff0000 ;
+ if ( g > 0x0000ff00 ) g = 0x0000ff00 ; else g &= 0x0000ff00 ;
+ if ( b > 0x000000ff ) b = 0x000000ff ; else b &= 0x000000ff ;
+
+ *scr = ( *scr & 0xff000000 ) | r | g | b ;
+ }
+ scr++;
+ tex += incs;
+ }
+ scr = ( uint32_t * )( _scr += scr_inc ); tex = _tex += tex_inc;
+ }
+}
+
+static void draw_hspan_8to32_translucent( uint32_t *scr, uint8_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+ uint32_t r, g, b, c;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex )
+ {
+ c = ( pcolorequiv[*tex] );
+
+ r = ((( c & 0x00ff0000 ) * _factor ) + (( *scr & 0x00ff0000 ) * _factor2 ) ) >> 8 ;
+ g = ((( c & 0x0000ff00 ) * _factor ) + (( *scr & 0x0000ff00 ) * _factor2 ) ) >> 8 ;
+ b = ((( c & 0x000000ff ) * _factor ) + (( *scr & 0x000000ff ) * _factor2 ) ) >> 8 ;
+
+ if ( r > 0x00ff0000 ) r = 0x00ff0000 ; else r &= 0x00ff0000 ;
+ if ( g > 0x0000ff00 ) g = 0x0000ff00 ; else g &= 0x0000ff00 ;
+ if ( b > 0x000000ff ) b = 0x000000ff ; else b &= 0x000000ff ;
+
+ *scr = ( *scr & 0xff000000 ) | r | g | b ;
+ }
+ scr++;
+ tex += incs;
+ }
+ scr = ( uint32_t * )( _scr += scr_inc ); tex = _tex += tex_inc;
+ }
+}
+
+static void draw_hspan_8to32_nocolorkey( uint32_t *scr, uint8_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ *scr = ( *scr & 0xff000000 ) | pcolorequiv[*tex];
+ scr++;
+ tex += incs;
+ }
+ scr = ( uint32_t * )( _scr += scr_inc ); tex = _tex += tex_inc;
+ }
+}
+
+/* --------------------------------------------------------------------------- */
+/* 16 to 32 */
+/* --------------------------------------------------------------------------- */
+
+static void draw_hspan_16to32( uint32_t *scr, uint16_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex ) *scr = ( *scr & 0xff000000 ) | (( * tex & 0xf800 ) << 8 ) | (( * tex & 0x07e0 ) << 5 ) | (( * tex & 0x001f ) << 3 ) ;
+ scr++ ;
+ tex += incs;
+ }
+ scr = ( uint32_t * )( _scr += scr_inc ); tex = ( uint16_t * )( _tex += tex_inc );
+ }
+}
+
+static void draw_hspan_16to32_ablend( uint32_t *scr, uint16_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex ) *scr = ( *scr & 0xff000000 ) | blend_func((( * tex & 0xf800 ) << 8 ) | (( * tex & 0x07e0 ) << 5 ) | (( * tex & 0x001f ) << 3 ), *scr );
+ scr++ ;
+ tex += incs;
+ }
+ scr = ( uint32_t * )( _scr += scr_inc ); tex = ( uint16_t * )( _tex += tex_inc );
+ }
+}
+
+static void draw_hspan_16to32_tablend( uint32_t *scr, uint16_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+ uint32_t r, g, b, c;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex )
+ {
+ c = blend_func((( * tex & 0xf800 ) << 8 ) | (( * tex & 0x07e0 ) << 5 ) | (( * tex & 0x001f ) << 3 ), *scr ) ;
+
+ r = ((( c & 0x00ff0000 ) * _factor ) + (( *scr & 0x00ff0000 ) * _factor2 ) ) >> 8 ;
+ g = ((( c & 0x0000ff00 ) * _factor ) + (( *scr & 0x0000ff00 ) * _factor2 ) ) >> 8 ;
+ b = ((( c & 0x000000ff ) * _factor ) + (( *scr & 0x000000ff ) * _factor2 ) ) >> 8 ;
+
+ if ( r > 0x00ff0000 ) r = 0x00ff0000 ; else r &= 0x00ff0000 ;
+ if ( g > 0x0000ff00 ) g = 0x0000ff00 ; else g &= 0x0000ff00 ;
+ if ( b > 0x000000ff ) b = 0x000000ff ; else b &= 0x000000ff ;
+
+ *scr = ( *scr & 0xff000000 ) | r | g | b ;
+ }
+ scr++;
+ tex += incs;
+ }
+ scr = ( uint32_t * )( _scr += scr_inc ); tex = ( uint16_t * )( _tex += tex_inc );
+ }
+}
+
+static void draw_hspan_16to32_translucent( uint32_t *scr, uint16_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+ uint32_t r, g, b, c;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex )
+ {
+ c = (( * tex & 0xf800 ) << 8 ) | (( * tex & 0x07e0 ) << 5 ) | (( * tex & 0x001f ) << 3 );
+
+ r = ((( c & 0x00ff0000 ) * _factor ) + (( *scr & 0x00ff0000 ) * _factor2 ) ) >> 8 ;
+ g = ((( c & 0x0000ff00 ) * _factor ) + (( *scr & 0x0000ff00 ) * _factor2 ) ) >> 8 ;
+ b = ((( c & 0x000000ff ) * _factor ) + (( *scr & 0x000000ff ) * _factor2 ) ) >> 8 ;
+
+ if ( r > 0x00ff0000 ) r = 0x00ff0000 ; else r &= 0x00ff0000 ;
+ if ( g > 0x0000ff00 ) g = 0x0000ff00 ; else g &= 0x0000ff00 ;
+ if ( b > 0x000000ff ) b = 0x000000ff ; else b &= 0x000000ff ;
+
+ *scr = ( *scr & 0xff000000 ) | r | g | b ;
+ }
+ scr++;
+ tex += incs;
+ }
+ scr = ( uint32_t * )( _scr += scr_inc ); tex = ( uint16_t * )( _tex += tex_inc );
+ }
+}
+
+static void draw_hspan_16to32_nocolorkey( uint32_t *scr, uint16_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ *scr = ( *scr & 0xff000000 ) | (( * tex & 0xf800 ) << 8 ) | (( * tex & 0x07e0 ) << 5 ) | (( * tex & 0x001f ) << 3 );
+ scr++;
+ tex += incs;
+ }
+ scr = ( uint32_t * )( _scr += scr_inc ); tex = ( uint16_t * )( _tex += tex_inc );
+ }
+}
+
+/* --------------------------------------------------------------------------- */
+/* 32 to 32 */
+/* --------------------------------------------------------------------------- */
+
+static void draw_hspan_32to32( uint32_t *scr, uint32_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+ uint32_t r, g, b, c;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex )
+ {
+ if ( *tex ^ 0xff000000 )
+ {
+ c = *tex;
+ _factor = ( c & 0xff000000 ) >> 24;
+ _factor2 = 255 - _factor;
+
+ r = ((( c & 0x00ff0000 ) * _factor ) + (( *scr & 0x00ff0000 ) * _factor2 ) ) >> 8 ;
+ g = ((( c & 0x0000ff00 ) * _factor ) + (( *scr & 0x0000ff00 ) * _factor2 ) ) >> 8 ;
+ b = ((( c & 0x000000ff ) * _factor ) + (( *scr & 0x000000ff ) * _factor2 ) ) >> 8 ;
+
+ if ( r > 0x00ff0000 ) r = 0x00ff0000 ; else r &= 0x00ff0000 ;
+ if ( g > 0x0000ff00 ) g = 0x0000ff00 ; else g &= 0x0000ff00 ;
+ if ( b > 0x000000ff ) b = 0x000000ff ; else b &= 0x000000ff ;
+
+ *scr = ( MAX( c & 0xff000000, *scr & 0xff000000 ) ) | r | g | b ;
+ }
+ else if ( *tex )
+ *scr = *tex;
+ }
+ scr++ ;
+ tex += incs;
+ }
+ scr = ( uint32_t * )( _scr += scr_inc ); tex = ( uint32_t * )( _tex += tex_inc );
+ }
+}
+
+static void draw_hspan_32to32_ablend( uint32_t *scr, uint32_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+ uint32_t r, g, b, c;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex )
+ {
+ if ( *tex ^ 0xff000000 )
+ {
+ c = blend_func( *tex, *scr );
+ _factor = ( *tex & 0xff000000 ) >> 24;
+ _factor2 = 255 - _factor;
+
+ r = ((( c & 0x00ff0000 ) * _factor ) + (( *scr & 0x00ff0000 ) * _factor2 ) ) >> 8 ;
+ g = ((( c & 0x0000ff00 ) * _factor ) + (( *scr & 0x0000ff00 ) * _factor2 ) ) >> 8 ;
+ b = ((( c & 0x000000ff ) * _factor ) + (( *scr & 0x000000ff ) * _factor2 ) ) >> 8 ;
+
+ if ( r > 0x00ff0000 ) r = 0x00ff0000 ; else r &= 0x00ff0000 ;
+ if ( g > 0x0000ff00 ) g = 0x0000ff00 ; else g &= 0x0000ff00 ;
+ if ( b > 0x000000ff ) b = 0x000000ff ; else b &= 0x000000ff ;
+
+ *scr = ( MAX( c & 0xff000000, *scr & 0xff000000 ) ) | r | g | b ;
+ }
+ else if ( *tex )
+ *scr = ( MAX( *tex & 0xff000000, *scr & 0xff000000 ) ) | blend_func( *tex, *scr );
+ }
+ scr++ ;
+ tex += incs;
+ }
+ scr = ( uint32_t * )( _scr += scr_inc ); tex = ( uint32_t * )( _tex += tex_inc );
+ }
+}
+
+static void draw_hspan_32to32_tablend( uint32_t *scr, uint32_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+ uint32_t r, g, b;
+ unsigned int c, _f, _f2;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex )
+ {
+ c = blend_func( *tex, *scr ) ;
+ _f = (( unsigned int ) * tex ) & 0xff000000;
+ if ( _f != 0xff000000 )
+ {
+ _f = ( _f >> 24 ) * _factor / 255 ;
+ _f2 = 255 - _f ;
+
+ r = ((( c & 0x00ff0000 ) * _f ) + (( *scr & 0x00ff0000 ) * _f2 ) ) >> 8 ;
+ g = ((( c & 0x0000ff00 ) * _f ) + (( *scr & 0x0000ff00 ) * _f2 ) ) >> 8 ;
+ b = ((( c & 0x000000ff ) * _f ) + (( *scr & 0x000000ff ) * _f2 ) ) >> 8 ;
+ }
+ else
+ {
+ r = ((( c & 0x00ff0000 ) * _factor ) + (( *scr & 0x00ff0000 ) * _factor2 ) ) >> 8 ;
+ g = ((( c & 0x0000ff00 ) * _factor ) + (( *scr & 0x0000ff00 ) * _factor2 ) ) >> 8 ;
+ b = ((( c & 0x000000ff ) * _factor ) + (( *scr & 0x000000ff ) * _factor2 ) ) >> 8 ;
+ }
+ if ( r > 0x00ff0000 ) r = 0x00ff0000 ; else r &= 0x00ff0000 ;
+ if ( g > 0x0000ff00 ) g = 0x0000ff00 ; else g &= 0x0000ff00 ;
+ if ( b > 0x000000ff ) b = 0x000000ff ; else b &= 0x000000ff ;
+
+ *scr = ( MAX( c & 0xff000000, *scr & 0xff000000 ) ) | r | g | b ;
+ }
+ scr++;
+ tex += incs;
+ }
+ scr = ( uint32_t * )( _scr += scr_inc ); tex = ( uint32_t * )( _tex += tex_inc );
+ }
+}
+
+static void draw_hspan_32to32_translucent( uint32_t *scr, uint32_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+ int r, g, b;
+ unsigned int c, _f, _f2;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ if ( *tex )
+ {
+ c = *tex ;
+ _f = c & 0xff000000;
+ if ( _f != 0xff000000 )
+ {
+ _f = ( _f >> 24 ) * _factor / 255 ;
+ _f2 = 255 - _f ;
+
+ r = ((( c & 0x00ff0000 ) * _f ) + (( *scr & 0x00ff0000 ) * _f2 ) ) >> 8 ;
+ g = ((( c & 0x0000ff00 ) * _f ) + (( *scr & 0x0000ff00 ) * _f2 ) ) >> 8 ;
+ b = ((( c & 0x000000ff ) * _f ) + (( *scr & 0x000000ff ) * _f2 ) ) >> 8 ;
+ }
+ else
+ {
+ r = ((( c & 0x00ff0000 ) * _factor ) + (( *scr & 0x00ff0000 ) * _factor2 ) ) >> 8 ;
+ g = ((( c & 0x0000ff00 ) * _factor ) + (( *scr & 0x0000ff00 ) * _factor2 ) ) >> 8 ;
+ b = ((( c & 0x000000ff ) * _factor ) + (( *scr & 0x000000ff ) * _factor2 ) ) >> 8 ;
+ }
+
+ if ( r > 0x00ff0000 ) r = 0x00ff0000 ; else r &= 0x00ff0000 ;
+ if ( g > 0x0000ff00 ) g = 0x0000ff00 ; else g &= 0x0000ff00 ;
+ if ( b > 0x000000ff ) b = 0x000000ff ; else b &= 0x000000ff ;
+
+ *scr = ( MAX( c & 0xff000000, *scr & 0xff000000 ) ) | r | g | b ;
+ }
+ scr++;
+ tex += incs;
+ }
+ scr = ( uint32_t * )( _scr += scr_inc ); tex = ( uint32_t * )( _tex += tex_inc );
+ }
+}
+
+static void draw_hspan_32to32_nocolorkey( uint32_t *scr, uint32_t * tex, int pixels, int incs, int l, int scr_inc, int tex_inc )
+{
+ int i;
+ uint8_t * _scr = ( uint8_t * ) scr, * _tex = ( uint8_t * ) tex;
+
+ while ( l-- )
+ {
+ for ( i = pixels; i--; )
+ {
+ *scr++ = *tex;
+ tex += incs;
+ }
+ scr = ( uint32_t * )( _scr += scr_inc ); tex = ( uint32_t * )( _tex += tex_inc );
+ }
+}
+
+/* --------------------------------------------------------------------------- */
+/*
+ * FUNCTION : gr_calculate_corners
+ *
+ * Calculate the screen coordinates of the corners of a graphic
+ * when rotated and scaled in an specific angle
+ *
+ * PARAMS :
+ * graph Pointer to the graphic object
+ * x, y Pixel coordinates of the center on screen
+ * angle Angle of rotation in miliangles
+ * scalex, scaley Scaling ratio in percentaje (100 for original size)
+ * corners Pointer to the output array of 4 points
+ *
+ * RETURN VALUE :
+ * The screen coordinates of the points will be written
+ * into the "corners" array
+ *
+ */
+
+static void gr_calculate_corners( GRAPH * dest, int screen_x, int screen_y, int flags, int angle, int scalex, int scaley, _POINT * corners )
+{
+ float center_x, center_y, sx = 1, sy = -1;
+
+ if ( scalex < 0 ) scalex = 0;
+ if ( scaley < 0 ) scaley = 0;
+
+ /* Calculate the graphic center */
+
+ if ( dest->ncpoints && dest->cpoints[0].x != CPOINT_UNDEFINED )
+ {
+ center_x = dest->cpoints[0].x + 0.5;
+ center_y = dest->cpoints[0].y + 0.5;
+ }
+ else
+ {
+ center_x = dest->width / 2.0;
+ center_y = dest->height / 2.0;
+ }
+
+ if ( flags & B_HMIRROR ) sx = -1;
+ if ( flags & B_VMIRROR ) sy = 1;
+
+ /* Rotate the coordinates */
+
+ float cos_angle = fixtof( fcos( angle ) );
+ float sin_angle = fixtof( fsin( angle ) );
+
+ /* Top-left, top-right, bottom-left, bottom-right */
+
+ float x0 = ( (float)screen_x + 0.5 ) * 100.0,
+ y0 = ( (float)screen_y + 0.5 ) * 100.0;
+
+ float lef_x, top_y, rig_x, bot_y;
+/*
+ lef_x = - ( scalex * center_x - 0.5 ) ;
+ rig_x = ( scalex * ( dest->width - center_x ) - 0.5 ) ;
+
+ top_y = - ( scaley * center_y - 0.5 ) ;
+ bot_y = ( scaley * ( dest->height - center_y ) - 0.5 ) ;
+*/
+
+ lef_x = - ( (float) scalex * center_x ) ;
+ rig_x = ( (float) scalex * ( dest->width - center_x ) ) ;
+
+ top_y = - ( (float) scaley * center_y ) ;
+ bot_y = ( (float) scaley * ( dest->height - center_y ) ) ;
+
+ if ( (int) lef_x != (int) rig_x )
+ {
+ lef_x += 0.5;
+ rig_x -= 0.5;
+ }
+
+ if ( (int) top_y != (int) bot_y )
+ {
+ top_y += 0.5;
+ bot_y -= 0.5;
+ }
+
+ corners[0].x = ( lef_x * cos_angle + top_y * sin_angle ) * sx + x0;
+ corners[0].y = ( lef_x * sin_angle - top_y * cos_angle ) * sy + y0;
+ corners[1].x = ( rig_x * cos_angle + top_y * sin_angle ) * sx + x0;
+ corners[1].y = ( rig_x * sin_angle - top_y * cos_angle ) * sy + y0;
+ corners[2].x = ( lef_x * cos_angle + bot_y * sin_angle ) * sx + x0;
+ corners[2].y = ( lef_x * sin_angle - bot_y * cos_angle ) * sy + y0;
+ corners[3].x = ( rig_x * cos_angle + bot_y * sin_angle ) * sx + x0;
+ corners[3].y = ( rig_x * sin_angle - bot_y * cos_angle ) * sy + y0;
+}
+
+/* --------------------------------------------------------------------------- */
+/*
+ * FUNCTION : gr_get_bbox
+ *
+ * Calculate the bounding box of a graphic, when drawing it with
+ * the gr_rotated_blit function
+ *
+ * PARAMS :
+ * dest Destination bitmap or NULL for screen
+ * clip Clipping region or NULL for the whole screen
+ * scrx, scry Pixel coordinates of the center on screen
+ * angle Angle of rotation in miliangles
+ * scalex, scaley Scaling ratio in percentaje (100 for original size)
+ * gr Pointer to the graphic object to draw
+ *
+ * RETURN VALUE :
+ * None
+ *
+ */
+
+void gr_get_bbox( REGION * dest, REGION * clip, int x, int y, int flags, int angle, int scalex, int scaley, GRAPH * gr )
+{
+ _POINT corners[4];
+ _POINT min, max;
+ int i;
+
+ /* Calculate the coordinates of each corner in the graphic */
+
+ gr_calculate_corners( gr, x, y, flags, angle, scalex, scaley, corners );
+
+ /* Calculate the bounding box */
+
+ min.x = max.x = corners[0].x;
+ min.y = max.y = corners[0].y;
+
+ for ( i = 1 ; i < 4 ; i++ )
+ {
+ if ( min.x > corners[i].x ) min.x = corners[i].x;
+ if ( max.x < corners[i].x ) max.x = corners[i].x;
+ if ( min.y > corners[i].y ) min.y = corners[i].y;
+ if ( max.y < corners[i].y ) max.y = corners[i].y;
+ }
+
+ dest->x = min.x / 100 ;
+ dest->y = min.y / 100 ;
+ dest->x2 = max.x / 100 ;
+ dest->y2 = max.y / 100 ;
+}
+
+/* --------------------------------------------------------------------------- */
+/*
+ * FUNCTION : gr_rotated_blit
+ *
+ * Draw a rotated and/or scaled bitmap
+ *
+ * PARAMS :
+ * dest Destination bitmap or NULL for screen
+ * clip Clipping region or NULL for the whole screen
+ * scrx, scry Pixel coordinates of the center on screen
+ * angle Angle of rotation in miliangles
+ * scalex, scaley Scaling ratio in percentaje (100 for original size)
+ * gr Pointer to the graphic object to draw
+ *
+ * RETURN VALUE :
+ * None
+ *
+ */
+
+void gr_rotated_blit(
+ GRAPH * dest,
+ REGION * clip,
+ int scrx,
+ int scry,
+ int flags,
+ int angle,
+ int scalex,
+ int scaley,
+ GRAPH * gr )
+{
+ _POINT corners[4];
+ _POINT min, max;
+ VERTEX vertex[4];
+ int i;
+
+ float half_texel_size_x = 0.0;
+ float half_texel_size_y = 0.0;
+
+ /* Data for the left line */
+ int left_steps;
+ int left_pos;
+ VECTOR left_texture_increment;
+ VERTEX* left_start;
+ VERTEX* left_end;
+
+ /* Data for the right line */
+ int right_steps;
+ int right_pos;
+ VECTOR right_texture_increment;
+ VERTEX* right_start;
+ VERTEX* right_end;
+
+ /* Pointer to the line drawing function */
+ DRAW_SPAN * draw_span = NULL;
+
+ if ( !dest ) dest = scrbitmap;
+
+ if ( !dest->data || !gr->data ) return;
+ if ( scalex <= 0 || scaley <= 0 ) return;
+
+ /* Analize the bitmap if needed (find if no color key used */
+
+ if ( gr->modified > 1 ) bitmap_analize( gr ) ;
+
+ if ( gr->info_flags & GI_NOCOLORKEY ) flags |= B_NOCOLORKEY ;
+
+ /* Setup the 16 bits translucency tables if necessay */
+
+ if ( gr->blend_table )
+ {
+ if ( dest->format->depth == 32 ) return ;
+ ghost1 = ( uint16_t * ) gr->blend_table ;
+ ghost2 = ( uint16_t * )( gr->blend_table + 65536 ) ;
+ flags |= B_TRANSLUCENT ;
+ }
+ else if ( flags & B_ALPHA )
+ {
+ if ( dest->format->depth == 32 )
+ {
+ if ( flags & B_TRANSLUCENT )
+ {
+ _factor = ((( flags & B_ALPHA_MASK ) >> B_ALPHA_SHIFT ) ) >> 1;
+ }
+ else
+ {
+ _factor = ((( flags & B_ALPHA_MASK ) >> B_ALPHA_SHIFT ) ) ;
+ }
+
+ _factor2 = 255 - _factor ;
+ }
+ else if ( dest->format->depth == 16 )
+ {
+ if ( flags & B_TRANSLUCENT )
+ {
+ ghost1 = gr_alpha16((( flags & B_ALPHA_MASK ) >> B_ALPHA_SHIFT ) >> 1 );
+ ghost2 = gr_alpha16( 255 - ((( flags & B_ALPHA_MASK ) >> B_ALPHA_SHIFT ) >> 1 ) );
+ }
+ else
+ {
+ ghost1 = gr_alpha16(( flags & B_ALPHA_MASK ) >> B_ALPHA_SHIFT );
+ ghost2 = gr_alpha16( 255 - (( flags & B_ALPHA_MASK ) >> B_ALPHA_SHIFT ) );
+ }
+ }
+ else if ( dest->format->depth == 8 )
+ {
+ if ( flags & B_TRANSLUCENT )
+ {
+ ghost8 = gr_alpha8((( flags & B_ALPHA_MASK ) >> B_ALPHA_SHIFT ) >> 1 );
+ }
+ else
+ {
+ ghost8 = gr_alpha8(( flags & B_ALPHA_MASK ) >> B_ALPHA_SHIFT );
+ }
+ }
+
+ flags |= B_TRANSLUCENT ;
+ }
+ else if ( flags & B_TRANSLUCENT )
+ {
+ _factor = 128 ;
+ _factor2 = 128 ;
+ ghost1 = ghost2 = colorghost ;
+ ghost8 = ( uint8_t * ) trans_table ;
+ }
+
+ if ((flags & B_TRANSLUCENT) && !trans_table_updated) gr_make_trans_table() ;
+
+ blend_func = ( BLEND_FUNC * ) NULL;
+
+ /* Choose a line drawing function */
+
+ if ( dest->format->depth == 8 ) /* 8 bits target */
+ {
+ if ( gr->format->depth == 8 )
+ {
+ if ( flags & B_TRANSLUCENT )
+ {
+ if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend8;
+ draw_span = ( DRAW_SPAN * )draw_span_8to8_tablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend8;
+ draw_span = ( DRAW_SPAN * )draw_span_8to8_tablend;
+ }
+ else
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_8to8_translucent;
+ }
+ }
+ else if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend8;
+ draw_span = ( DRAW_SPAN * )draw_span_8to8_ablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend8;
+ draw_span = ( DRAW_SPAN * )draw_span_8to8_ablend;
+ }
+ else if ( flags & B_NOCOLORKEY )
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_8to8_nocolorkey;
+ }
+ else
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_8to8;
+ }
+ }
+ else if ( gr->format->depth == 1 )
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_1to8;
+ }
+ else
+ return;
+ }
+ else if ( dest->format->depth == 16 ) /* 16 bits target */
+ {
+ if ( gr->format->depth == 8 )
+ {
+ pcolorequiv = gr->format->palette ? gr->format->palette->colorequiv : sys_pixel_format->palette ? sys_pixel_format->palette->colorequiv : default_colorequiv ;
+
+ if ( flags & B_TRANSLUCENT )
+ {
+ if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend16;
+ draw_span = ( DRAW_SPAN * )draw_span_8to16_tablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend16;
+ draw_span = ( DRAW_SPAN * )draw_span_8to16_tablend;
+ }
+ else
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_8to16_translucent;
+ }
+ }
+ else if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend16;
+ draw_span = ( DRAW_SPAN * )draw_span_8to16_ablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend16;
+ draw_span = ( DRAW_SPAN * )draw_span_8to16_ablend;
+ }
+ else if ( flags & B_NOCOLORKEY )
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_8to16_nocolorkey;
+ }
+ else
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_8to16;
+ }
+ }
+ else if ( gr->format->depth == 16 )
+ {
+ if ( flags & B_TRANSLUCENT )
+ {
+ if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend16;
+ draw_span = ( DRAW_SPAN * )draw_span_16to16_tablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend16;
+ draw_span = ( DRAW_SPAN * )draw_span_16to16_tablend;
+ }
+ else
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_16to16_translucent;
+ }
+ }
+ else if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend16;
+ draw_span = ( DRAW_SPAN * )draw_span_16to16_ablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend16;
+ draw_span = ( DRAW_SPAN * )draw_span_16to16_ablend;
+ }
+ else if ( flags & B_NOCOLORKEY )
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_16to16_nocolorkey;
+ }
+ else
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_16to16;
+ }
+ }
+ else if ( gr->format->depth == 1 )
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_1to16;
+ }
+ else
+ {
+ return ; //Profundidad de color no soportada
+ }
+ }
+ else if ( dest->format->depth == 32 ) /* 32 bits target */
+ {
+ if ( gr->format->depth == 8 )
+ {
+ pcolorequiv = gr->format->palette ? gr->format->palette->colorequiv : sys_pixel_format->palette ? sys_pixel_format->palette->colorequiv : default_colorequiv ;
+
+ if ( flags & B_TRANSLUCENT )
+ {
+ if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend32;
+ draw_span = ( DRAW_SPAN * )draw_span_8to32_tablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend32;
+ draw_span = ( DRAW_SPAN * )draw_span_8to32_tablend;
+ }
+ else
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_8to32_translucent;
+ }
+ }
+ else if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend32;
+ draw_span = ( DRAW_SPAN * )draw_span_8to32_ablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend32;
+ draw_span = ( DRAW_SPAN * )draw_span_8to32_ablend;
+ }
+ else if ( flags & B_NOCOLORKEY )
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_8to32_nocolorkey;
+ }
+ else
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_8to32;
+ }
+ }
+ else if ( gr->format->depth == 16 )
+ {
+ if ( flags & B_TRANSLUCENT )
+ {
+ if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend32;
+ draw_span = ( DRAW_SPAN * )draw_span_16to32_tablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend32;
+ draw_span = ( DRAW_SPAN * )draw_span_16to32_tablend;
+ }
+ else
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_16to32_translucent;
+ }
+ }
+ else if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend32;
+ draw_span = ( DRAW_SPAN * )draw_span_16to32_ablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend32;
+ draw_span = ( DRAW_SPAN * )draw_span_16to32_ablend;
+ }
+ else if ( flags & B_NOCOLORKEY )
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_16to32_nocolorkey;
+ }
+ else
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_16to32;
+ }
+ }
+ else if ( gr->format->depth == 32 )
+ {
+ if ( flags & B_TRANSLUCENT )
+ {
+ if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend32;
+ draw_span = ( DRAW_SPAN * )draw_span_32to32_tablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend32;
+ draw_span = ( DRAW_SPAN * )draw_span_32to32_tablend;
+ }
+ else
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_32to32_translucent;
+ }
+ }
+ else if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend32;
+ draw_span = ( DRAW_SPAN * )draw_span_32to32_ablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend32;
+ draw_span = ( DRAW_SPAN * )draw_span_32to32_ablend;
+ }
+ else if ( flags & B_NOCOLORKEY )
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_32to32_nocolorkey;
+ }
+ else
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_32to32;
+ }
+ }
+ else if ( gr->format->depth == 1 )
+ {
+ draw_span = ( DRAW_SPAN * )draw_span_1to32;
+ }
+ else
+ {
+ return ; //Profundidad de color no soportada
+ }
+ }
+ else
+ {
+ return ; //Profundidad de color no soportada
+ }
+
+ /* Calculate the coordinates of each corner in the graphic */
+
+ gr_calculate_corners( gr, scrx, scry, flags, angle, scalex, scaley, corners );
+
+ /* Calculate the clipping coordinates */
+
+ if ( clip )
+ {
+ min.x = MAX( clip->x, 0 );
+ min.y = MAX( clip->y, 0 );
+ max.x = MIN( clip->x2, dest->width - 1 );
+ max.y = MIN( clip->y2, dest->height - 1 );
+ }
+ else
+ {
+ min.x = 0;
+ min.y = 0;
+ max.x = dest->width - 1;
+ max.y = dest->height - 1;
+ }
+
+ /* The texture coordinates of each corner point are displaced
+ to the center of the texel to sidestep precision errors */
+
+ half_texel_size_x = 50.0 / ( float ) scalex;
+ half_texel_size_y = 50.0 / ( float ) scaley;
+// half_texel_size_x = 0.5 / ( float ) scalex;
+// half_texel_size_y = 0.5 / ( float ) scaley;
+
+ /* Fill the vertex array with the four obtained points */
+
+ for ( i = 0; i < 4; i++ )
+ {
+ vertex[i].x = corners[i].x ;
+ vertex[i].y = corners[i].y ;
+ }
+
+ /* if ( flags & B_VMIRROR )
+ {
+ vertex[1].s = vertex[3].s = half_texel_size_y ;
+ vertex[0].s = vertex[2].s = gr->width - half_texel_size_x ;
+ }
+ else
+ {*/
+ vertex[0].s = vertex[2].s = half_texel_size_y;
+ vertex[1].s = vertex[3].s = gr->width - half_texel_size_x;
+ //}
+
+ /*if ( flags & B_HMIRROR )
+ {
+ vertex[2].t = vertex[3].t = half_texel_size_x;
+ vertex[0].t = vertex[1].t = gr->height - half_texel_size_y ;
+ }
+ else
+ {*/
+ vertex[0].t = vertex[1].t = half_texel_size_x;
+ vertex[2].t = vertex[3].t = gr->height - half_texel_size_y;
+ // }
+
+ /* Sort the vertex list in y coordinate order */
+
+ qsort( vertex, 4, sizeof( VERTEX ), compare_vertex_y );
+
+ /* Create the first two left and right line segments */
+
+ left_start = &vertex[0];
+ left_end = &vertex[1];
+
+ right_start = &vertex[2];
+ right_end = &vertex[3];
+
+ if ( right_start->x < right_end->x )
+ {
+ left_end = &vertex[2];
+ right_start = &vertex[1];
+ }
+
+ if ( right_start->x > right_end->x )
+ {
+ right_end = right_start;
+ right_start = &vertex[0];
+ }
+
+ left_steps = ( left_end->y - left_start->y ) / 100 ;
+ left_texture_increment.x = ( left_end->s - left_start->s ) / ( float )( left_steps ) ;
+ left_texture_increment.y = ( left_end->t - left_start->t ) / ( float )( left_steps ) ;
+
+ right_steps = ( right_end->y - right_start->y ) / 100;
+ right_texture_increment.x = ( right_end->s - right_start->s ) / ( float )( right_steps ) ;
+ right_texture_increment.y = ( right_end->t - right_start->t ) / ( float )( right_steps ) ;
+
+ left_pos = -1 ;
+ right_pos = -1 ;
+
+ /* Draw the graphic a line each time, navigating through the
+ * left and right line segments until reaching the graphic bottom */
+
+ int x, x2;
+ float s, t, s2, t2;
+ int y, y2 = vertex[3].y / 100;
+
+ for ( y = vertex[0].y / 100 ; y <= y2; y++ )
+ {
+ left_pos++;
+ right_pos++;
+
+ /* Calculate the left point coordinates in screen and texture */
+ x = left_start->x / 100 ;
+ s = left_start->s;
+ t = left_start->t;
+ if ( left_pos > 0 && left_steps > 0 )
+ {
+ x += (( left_end->x - left_start->x ) / 100 ) * left_pos / left_steps;
+ s += left_texture_increment.x * left_pos ;
+ t += left_texture_increment.y * left_pos ;
+ }
+
+ /* Calculate the right point coordinates in screen and texture */
+ x2 = right_start->x / 100;
+ s2 = right_start->s;
+ t2 = right_start->t;
+ if ( right_pos > 0 && right_steps > 0 )
+ {
+ x2 += (( right_end->x - right_start->x ) / 100 ) * right_pos / right_steps;
+ s2 += right_texture_increment.x * right_pos ;
+ t2 += right_texture_increment.y * right_pos ;
+ }
+
+ /* We don't calculate y /y2 coordinate positions, because they
+ should be equal to i. However, precision errors may prevent it. */
+
+ /* Clip the resulting coordinates */
+ if ( y >= min.y && y <= max.y )
+ {
+ if ( x < min.x && x2 > x )
+ {
+ s += ( min.x - x ) * (( s2 - s ) / ( x2 - x ) );
+ t += ( min.x - x ) * (( t2 - t ) / ( x2 - x ) );
+ x = min.x;
+ }
+
+ if ( x2 > max.x && x2 > x )
+ {
+ s2 -= ( x2 - max.x ) * (( s2 - s ) / ( x2 - x ) );
+ t2 -= ( x2 - max.x ) * (( t2 - t ) / ( x2 - x ) );
+ x2 = max.x;
+ }
+
+ /* Draw the resulting line */
+ if ( x2 > x )
+ {
+ draw_span
+ (
+ dest,
+ gr,
+ x,
+ y,
+ x2 - x + 1,
+ ( int )( s * 65536 ),
+ ( int )( t * 65536 ),
+ ( int )(( s2 - s ) / ( x2 - x ) * 65536 ), //increm destino
+ ( int )(( t2 - t ) / ( x2 - x ) * 65536 ) //increm text
+ );
+ }
+ }
+
+ /* If there is no more steps in the left vector,
+ * advance to the next segment */
+
+ if ( left_pos == left_steps )
+ {
+ left_start = left_end;
+ left_end = &vertex[3];
+ left_pos = -1 ;
+ left_steps = ( left_end->y - left_start->y ) / 100;
+ if ( left_steps > 0 )
+ {
+ left_texture_increment.x = ( left_end->s - left_start->s ) / ( float )( left_steps ) ;
+ left_texture_increment.y = ( left_end->t - left_start->t ) / ( float )( left_steps ) ;
+ }
+ }
+
+ /* Same for the right vector */
+
+ if ( right_pos == right_steps )
+ {
+ right_start = right_end;
+ right_end = &vertex[3];
+ right_pos = -1 ;
+ right_steps = ( right_end->y - right_start->y ) / 100;
+ if ( right_steps > 0 )
+ {
+ right_texture_increment.x = ( right_end->s - right_start->s ) / ( float )( right_steps ) ;
+ right_texture_increment.y = ( right_end->t - right_start->t ) / ( float )( right_steps ) ;
+ }
+ }
+ }
+
+ dest->info_flags &= ~GI_CLEAN;
+ dest->modified = 2 ;
+}
+
+/* --------------------------------------------------------------------------- */
+/*
+ * FUNCTION : gr_blit
+ *
+ * Draw a bitmap (with no rotation or scaling, but with flags & clipping)
+ *
+ * PARAMS :
+ * dest Destination bitmap or NULL for screen
+ * clip Clipping region or NULL for the whole screen
+ * scrx, scry Pixel coordinates of the center on screen
+ * gr Pointer to the graphic object to draw
+ *
+ * RETURN VALUE :
+ * None
+ *
+ */
+
+void gr_blit( GRAPH * dest, REGION * clip, int scrx, int scry, int flags, GRAPH * gr )
+{
+ _POINT min, max;
+ _POINT center;
+ int x, y, s, t, p, l;
+ void * tex;
+ void * scr;
+ int tex_inc;
+ int scr_inc;
+ int direction;
+
+ DRAW_HSPAN * draw_hspan = ( DRAW_HSPAN * )NULL;
+
+ if ( !dest ) dest = scrbitmap ;
+ if ( !dest->data || !gr->data ) return;
+
+ /* Calculate the clipping coordinates */
+
+ if ( clip )
+ {
+ min.x = MAX( clip->x, 0 );
+ min.y = MAX( clip->y, 0 );
+ max.x = MIN( clip->x2, ( int ) dest->width - 1 );
+ max.y = MIN( clip->y2, ( int ) dest->height - 1 );
+ }
+ else
+ {
+ min.x = 0;
+ min.y = 0;
+ max.x = dest->width - 1;
+ max.y = dest->height - 1;
+ }
+
+ /* Analize the bitmap if needed (find if no color key used */
+
+ if ( gr->modified > 1 ) bitmap_analize( gr ) ;
+
+ if ( gr->info_flags & GI_NOCOLORKEY ) flags |= B_NOCOLORKEY ;
+
+ /* Setup the 16 bits translucency tables if necessay */
+
+ if ( gr->blend_table )
+ {
+ if ( dest->format->depth == 32 ) return ;
+ ghost1 = ( uint16_t * ) gr->blend_table ;
+ ghost2 = ( uint16_t * )( gr->blend_table + 65536 );
+ flags |= B_TRANSLUCENT ;
+ }
+ else if ( flags & B_ALPHA )
+ {
+ if ( dest->format->depth == 32 )
+ {
+ if ( flags & B_TRANSLUCENT )
+ {
+ _factor = ((( flags & B_ALPHA_MASK ) >> B_ALPHA_SHIFT ) ) >> 1;
+ }
+ else
+ {
+ _factor = ((( flags & B_ALPHA_MASK ) >> B_ALPHA_SHIFT ) ) ;
+ }
+
+ _factor2 = 255 - _factor ;
+ }
+ else if ( dest->format->depth == 16 )
+ {
+ if ( flags & B_TRANSLUCENT )
+ {
+ ghost1 = gr_alpha16((( flags & B_ALPHA_MASK ) >> B_ALPHA_SHIFT ) >> 1 );
+ ghost2 = gr_alpha16( 255 - ((( flags & B_ALPHA_MASK ) >> B_ALPHA_SHIFT ) >> 1 ) );
+ }
+ else
+ {
+ ghost1 = gr_alpha16(( flags & B_ALPHA_MASK ) >> B_ALPHA_SHIFT );
+ ghost2 = gr_alpha16( 255 - (( flags & B_ALPHA_MASK ) >> B_ALPHA_SHIFT ) );
+ }
+ }
+ else if ( dest->format->depth == 8 )
+ {
+ if ( flags & B_TRANSLUCENT )
+ {
+ ghost8 = gr_alpha8((( flags & B_ALPHA_MASK ) >> B_ALPHA_SHIFT ) >> 1 );
+ }
+ else
+ {
+ ghost8 = gr_alpha8(( flags & B_ALPHA_MASK ) >> B_ALPHA_SHIFT );
+ }
+ }
+
+ flags |= B_TRANSLUCENT ;
+ }
+ else if ( flags & B_TRANSLUCENT )
+ {
+ _factor = 128 ;
+ _factor2 = 128 ;
+ ghost1 = ghost2 = colorghost ;
+ ghost8 = ( uint8_t * ) trans_table ;
+ }
+
+ if ((flags & B_TRANSLUCENT) && !trans_table_updated) gr_make_trans_table() ;
+
+ blend_func = ( BLEND_FUNC * ) NULL;
+
+ /* Choose a line drawing function */
+
+ if ( dest->format->depth == 8 ) /* 8 bits target */
+ {
+ if ( gr->format->depth == 8 )
+ {
+ if ( flags & B_TRANSLUCENT )
+ {
+ if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend8;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to8_tablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend8;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to8_tablend;
+ }
+ else
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to8_translucent;
+ }
+ }
+ else if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend8;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to8_ablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend8;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to8_ablend;
+ }
+ else if ( flags & B_NOCOLORKEY )
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to8_nocolorkey;
+ }
+ else
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to8;
+ }
+ }
+ else if ( gr->format->depth == 1 )
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_1to8;
+ }
+ else
+ return;
+ }
+ else if ( dest->format->depth == 16 ) /* 16 bits target */
+ {
+ if ( gr->format->depth == 8 )
+ {
+ pcolorequiv = gr->format->palette ? gr->format->palette->colorequiv : sys_pixel_format->palette ? sys_pixel_format->palette->colorequiv : default_colorequiv ;
+
+ if ( flags & B_TRANSLUCENT )
+ {
+ if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend16;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to16_tablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend16;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to16_tablend;
+ }
+ else
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to16_translucent;
+ }
+ }
+ else if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend16;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to16_ablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend16;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to16_ablend;
+ }
+ else if ( flags & B_NOCOLORKEY )
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to16_nocolorkey;
+ }
+ else
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to16;
+ }
+ }
+ else if ( gr->format->depth == 16 )
+ {
+ if ( flags & B_TRANSLUCENT )
+ {
+ if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend16;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_16to16_tablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend16;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_16to16_tablend;
+ }
+ else
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_16to16_translucent;
+ }
+ }
+ else if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend16;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_16to16_ablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend16;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_16to16_ablend;
+ }
+ else if ( flags & B_NOCOLORKEY )
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_16to16_nocolorkey;
+ }
+ else
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_16to16;
+ }
+ }
+ else if ( gr->format->depth == 1 )
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_1to16;
+ }
+ else
+ {
+ return ; //Profundidad de color no soportada
+ }
+ }
+ else if ( dest->format->depth == 32 ) /* 32 bits target */
+ {
+ if ( gr->format->depth == 8 )
+ {
+ pcolorequiv = gr->format->palette ? gr->format->palette->colorequiv : sys_pixel_format->palette ? sys_pixel_format->palette->colorequiv : default_colorequiv ;
+
+ if ( flags & B_TRANSLUCENT )
+ {
+ if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend32;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to32_tablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend32;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to32_tablend;
+ }
+ else
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to32_translucent;
+ }
+ }
+ else if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend32;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to32_ablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend32;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to32_ablend;
+ }
+ else if ( flags & B_NOCOLORKEY )
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to32_nocolorkey;
+ }
+ else
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_8to32;
+ }
+ }
+ else if ( gr->format->depth == 16 )
+ {
+ if ( flags & B_TRANSLUCENT )
+ {
+ if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend32;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_16to32_tablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend32;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_16to32_tablend;
+ }
+ else
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_16to32_translucent;
+ }
+ }
+ else if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend32;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_16to32_ablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend32;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_16to32_ablend;
+ }
+ else if ( flags & B_NOCOLORKEY )
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_16to32_nocolorkey;
+ }
+ else
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_16to32;
+ }
+ }
+ else if ( gr->format->depth == 32 )
+ {
+ if ( flags & B_TRANSLUCENT )
+ {
+ if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend32;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_32to32_tablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend32;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_32to32_tablend;
+ }
+ else
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_32to32_translucent;
+ }
+ }
+ else if ( flags & B_ABLEND )
+ {
+ blend_func = additive_blend32;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_32to32_ablend;
+ }
+ else if ( flags & B_SBLEND )
+ {
+ blend_func = substractive_blend32;
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_32to32_ablend;
+ }
+ else if ( flags & B_NOCOLORKEY )
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_32to32_nocolorkey;
+ }
+ else
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_32to32;
+ }
+ }
+ else if ( gr->format->depth == 1 )
+ {
+ draw_hspan = ( DRAW_HSPAN * )draw_hspan_1to32;
+ }
+ else
+ {
+ return ; //Profundidad de color no soportada
+ }
+ }
+ else
+ {
+ return ; //Profundidad de color no soportada
+ }
+
+ /* Calculate the graphic center */
+
+ if ( gr->ncpoints && gr->cpoints[0].x != CPOINT_UNDEFINED )
+ {
+ center.x = gr->cpoints[0].x ;
+ center.y = gr->cpoints[0].y ;
+ }
+ else
+ {
+ center.x = gr->width / 2;
+ center.y = gr->height / 2;
+ }
+
+ if ( flags & B_HMIRROR ) center.x = gr->width - 1 - center.x;
+ if ( flags & B_VMIRROR ) center.y = gr->height - 1 - center.y;
+
+ /* Calculate the initial texture and screen coordinates */
+
+ x = scrx - center.x;
+ y = scry - center.y;
+ p = gr->width;
+ l = gr->height;
+ s = t = 0;
+
+ /* Clip the coordinates */
+
+ if ( y < min.y )
+ {
+ l -= min.y - y;
+ t += min.y - y;
+ y = min.y;
+ }
+
+ if ( y + l - 1 > max.y ) l -= y + l - 1 - max.y ;
+
+ if ( x < min.x )
+ {
+ p -= min.x - x;
+ s += min.x - x;
+ x = min.x;
+ }
+
+ if ( x + p - 1 > max.x ) p -= x + p - 1 - max.x;
+
+ if ( p < 1 || l < 1 ) return;
+
+ /* Mirror the texture coordinates if needed */
+
+ if ( flags & B_HMIRROR ) s = gr->width - 1 - s;
+ if ( flags & B_VMIRROR ) t = gr->height - 1 - t;
+
+ /* Calculate the initial pointers and advances */
+
+ posx = s;
+ if ( dest->format->depth == 1 )
+ scr = ( uint8_t * ) dest->data + dest->pitch * y + x / 8;
+ else
+ scr = ( uint8_t * ) dest->data + dest->pitch * y + x * dest->format->depthb;
+
+ //s,t -> x,y para lectura de textura...
+ if ( gr->format->depth == 1 )
+ tex = ( uint8_t * ) gr->data + gr->pitch * t + s / 8;
+ else
+ tex = ( uint8_t * ) gr->data + gr->pitch * t + s * gr->format->depthb;
+
+ scr_inc = dest->pitch ;
+
+
+ if ( flags & B_VMIRROR ) tex_inc = -gr->pitch; else tex_inc = gr->pitch ;
+ if ( flags & B_HMIRROR ) direction = -1; else direction = 1;
+
+ if ( p > 0 ) draw_hspan( scr, tex, p, direction, l, scr_inc, tex_inc );
+
+ dest->info_flags &= ~GI_CLEAN;
+ dest->modified = 2 ;
+}
+
+/* --------------------------------------------------------------------------- */
diff --git a/modules/libblit/g_blit.h b/modules/libblit/g_blit.h
new file mode 100644
index 0000000..2240321
--- /dev/null
+++ b/modules/libblit/g_blit.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2006-2013 SplinterGU (Fenix/Bennugd)
+ * Copyright © 2002-2006 Fenix Team (Fenix)
+ * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix)
+ *
+ * This file is part of Bennu - Game Development
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ */
+
+#ifndef __BLIT_H
+#define __BLIT_H
+
+/* --------------------------------------------------------------------------- */
+
+/* Flags para gr_blit */
+
+#define B_HMIRROR 0x0001
+#define B_VMIRROR 0x0002
+#define B_TRANSLUCENT 0x0004
+#define B_ALPHA 0x0008
+#define B_ABLEND 0x0010
+#define B_SBLEND 0x0020
+#define B_NOCOLORKEY 0x0080
+
+#define B_ALPHA_MASK 0xFF00
+#define B_ALPHA_SHIFT 8
+
+/* --------------------------------------------------------------------------- */
+
+#ifndef __BGDC__
+
+#include "libgrbase.h"
+
+/* --------------------------------------------------------------------------- */
+
+extern void gr_blit( GRAPH * dest, REGION * clip, int x, int y, int flags, GRAPH * gr ) ;
+extern void gr_get_bbox( REGION * dest, REGION * clip, int x, int y, int flags, int angle, int scalex, int scaley, GRAPH * gr ) ;
+extern void gr_rotated_blit( GRAPH * dest, REGION * clip, int x, int y, int flags, int angle, int scalex, int scaley, GRAPH * gr ) ;
+
+/* --------------------------------------------------------------------------- */
+#endif
+
+#endif
diff --git a/modules/libblit/g_pixel.c b/modules/libblit/g_pixel.c
new file mode 100644
index 0000000..07238c8
--- /dev/null
+++ b/modules/libblit/g_pixel.c
@@ -0,0 +1,271 @@
+/*
+ * Copyright © 2006-2016 SplinterGU (Fenix/Bennugd)
+ * Copyright © 2002-2006 Fenix Team (Fenix)
+ * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix)
+ *
+ * This file is part of Bennu - Game Development
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ */
+
+#include <stdio.h>
+
+#include "libblit.h"
+
+/* --------------------------------------------------------------------------- */
+
+int pixel_color8 = 15 ;
+uint16_t pixel_color16 = 0xFFFF ;
+uint32_t pixel_color32 = 0xFFFFFFFF ;
+
+uint16_t pixel_color16_alpha = 0xFFFF ;
+
+int pixel_alpha = 255;
+uint8_t * pixel_alpha8 = NULL ;
+uint16_t * pixel_alpha16 = NULL ;
+
+/* --------------------------------------------------------------------------- */
+/*
+ * FUNCTION : gr_get_pixel
+ *
+ * Read a pixel from a bitmap
+ *
+ * PARAMS :
+ * dest Destination bitmap
+ * x, y Pixel coordinates
+ *
+ * RETURN VALUE :
+ * 1, 8 or 16-bit integer with the pixel value
+ *
+ */
+
+int gr_get_pixel( GRAPH * dest, int x, int y )
+{
+ if ( x < 0 || y < 0 || x >= ( int ) dest->width || y >= ( int ) dest->height ) return -1 ;
+
+ switch ( dest->format->depth )
+ {
+ case 1:
+ return (( *( uint8_t * )( dest->data + dest->pitch * y + ( x >> 3 ) ) ) & ( 0x80 >> ( x & 7 ) ) ) ? 1 : 0;
+
+ case 8:
+ return *(( uint8_t * ) dest->data + dest->pitch * y + x ) ;
+
+ case 16:
+ return *( uint16_t * )(( uint8_t * ) dest->data + dest->pitch * y + ( x << 1 ) ) ;
+
+ case 32:
+ return *( uint32_t * )(( uint8_t * ) dest->data + dest->pitch * y + ( x << 2 ) ) ;
+ }
+ return -1;
+}
+
+/* --------------------------------------------------------------------------- */
+/*
+ * FUNCTION : gr_put_pixel
+ *
+ * Paint a pixel with no clipping whatsoever, except by
+ * the bitmap's dimensions
+ *
+ * PARAMS :
+ * dest Destination bitmap
+ * x, y Pixel coordinates
+ * color 1, 8 or 16-bit pixel value
+ *
+ * RETURN VALUE :
+ * None
+ *
+ */
+
+void gr_put_pixel( GRAPH * dest, int x, int y, int color )
+{
+ if ( x < 0 || y < 0 || x >= ( int ) dest->width || y >= ( int ) dest->height ) return ;
+
+ switch ( dest->format->depth )
+ {
+ case 1:
+ if ( color )
+ *(( uint8_t * ) dest->data + dest->pitch * y + ( x >> 3 ) ) |= ( 0x80 >> ( x & 7 ) ) ;
+ else
+ *(( uint8_t * ) dest->data + dest->pitch * y + ( x >> 3 ) ) &= ~( 0x80 >> ( x & 7 ) ) ;
+ break;
+
+ case 8:
+ _Pixel8(( uint8_t * ) dest->data + dest->pitch * y + x , color );
+ break;
+
+ case 16:
+ _Pixel16(( uint8_t * ) dest->data + dest->pitch * y + ( x << 1 ), color, gr_alpha16( pixel_alpha )[ color ] ) ;
+ break;
+
+ case 32:
+ {
+ uint32_t * ptr = ( uint32_t * ) (( uint8_t * ) dest->data + dest->pitch * y + ( x << 2 )) ;
+
+ if ( pixel_alpha == 255 && ( color & 0xff000000 ) == 0xff000000 )
+ {
+ *ptr = color ;
+ }
+ else
+ {
+ unsigned int _f = color & 0xff000000, _f2 ;
+ unsigned int r, g, b ;
+
+ _f = ( _f >> 24 ) * pixel_alpha / 255 ;
+ _f2 = 255 - _f ;
+
+ if ( _f != 0x000000ff )
+ {
+ r = ( ( color & 0x00ff0000 ) * _f + (( *ptr & 0x00ff0000 ) * _f2 ) ) >> 8 ;
+ g = ( ( color & 0x0000ff00 ) * _f + (( *ptr & 0x0000ff00 ) * _f2 ) ) >> 8 ;
+ b = ( ( color & 0x000000ff ) * _f + (( *ptr & 0x000000ff ) * _f2 ) ) >> 8 ;
+
+ if ( r > 0x00ff0000 ) r = 0x00ff0000 ; else r &= 0x00ff0000 ;
+ if ( g > 0x0000ff00 ) g = 0x0000ff00 ; else g &= 0x0000ff00 ;
+ if ( b > 0x000000ff ) b = 0x000000ff ; else b &= 0x000000ff ;
+
+ *ptr = ( _f << 24 ) | r | g | b ;
+ }
+ else
+ {
+ r = ( ( color & 0x00ff0000 ) * pixel_alpha + (( *ptr & 0x00ff0000 ) * _f2 ) ) >> 8 ;
+ g = ( ( color & 0x0000ff00 ) * pixel_alpha + (( *ptr & 0x0000ff00 ) * _f2 ) ) >> 8 ;
+ b = ( ( color & 0x000000ff ) * pixel_alpha + (( *ptr & 0x000000ff ) * _f2 ) ) >> 8 ;
+
+ if ( r > 0x00ff0000 ) r = 0x00ff0000 ; else r &= 0x00ff0000 ;
+ if ( g > 0x0000ff00 ) g = 0x0000ff00 ; else g &= 0x0000ff00 ;
+ if ( b > 0x000000ff ) b = 0x000000ff ; else b &= 0x000000ff ;
+
+ *ptr = 0xff000000 | r | g | b ;
+ }
+ }
+ }
+ break;
+ }
+
+ if ( color )
+ {
+ dest->modified = 2 ;
+ dest->info_flags &= ~GI_CLEAN;
+ }
+ else
+ {
+ dest->modified = 1 ; /* Don't needs analysis */
+ dest->info_flags &= ~GI_NOCOLORKEY;
+ }
+}
+
+/* --------------------------------------------------------------------------- */
+/*
+ * FUNCTION : gr_put_pixelc
+ *
+ * Paint a pixel using a clipping region
+ *
+ * PARAMS :
+ * dest Destination bitmap
+ * x, y Pixel coordinates
+ * color 1, 8 or 16-bit pixel value
+ *
+ * RETURN VALUE :
+ * None
+ *
+ */
+
+void gr_put_pixelc( GRAPH * dest, REGION * clip, int x, int y, int color )
+{
+ if ( clip && x >= clip->x && x <= clip->x2 && y >= clip->y && y <= clip->y2 )
+ gr_put_pixel( dest, x, y, color );
+}
+
+/* --------------------------------------------------------------------------- */
+/*
+ * FUNCTION : gr_setcolor
+ *
+ * Sets the drawing color
+ *
+ * PARAMS :
+ * alpha New color (16 bits if 16 bits enabled)
+ *
+ * RETURN VALUE :
+ * None
+ *
+ */
+
+void gr_setcolor( int c )
+{
+/*
+ int r, g, b;
+
+ if ( c )
+ {
+ if ( sys_pixel_format->depth != 8 )
+ {
+ gr_get_rgb( c, &r, &g, &b );
+ pixel_color8 = gr_find_nearest_color( r, g, b );
+ }
+ else
+ {
+
+ }
+ }
+ else
+ pixel_color8 = 0;
+*/
+ /* Fix this */
+ pixel_color8 = c;
+ pixel_color16 = c ;
+ pixel_color32 = c ;
+
+ if ( sys_pixel_format->depth == 16 && pixel_alpha != 255 ) pixel_color16_alpha = gr_alpha16( pixel_alpha )[ pixel_color16 ];
+}
+
+/* --------------------------------------------------------------------------- */
+/*
+ * FUNCTION : gr_setalpha
+ *
+ * Sets the drawing alpha value for primitives
+ *
+ * PARAMS :
+ * alpha New alpha (0-255)
+ *
+ * RETURN VALUE :
+ * None
+ *
+ */
+
+void gr_setalpha( int value )
+{
+ value &= 0xFF;
+ pixel_alpha = value;
+
+ if ( sys_pixel_format->depth == 16 )
+ {
+ pixel_alpha8 = gr_alpha8( value );
+ pixel_alpha16 = gr_alpha16( 255 - value );
+ pixel_color16_alpha = gr_alpha16( value )[ pixel_color16 ];
+ }
+ else
+ {
+ pixel_alpha8 = gr_alpha8( value );
+ }
+}
+
+/* --------------------------------------------------------------------------- */
diff --git a/modules/libblit/g_pixel.h b/modules/libblit/g_pixel.h
new file mode 100644
index 0000000..07362c3
--- /dev/null
+++ b/modules/libblit/g_pixel.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright © 2006-2013 SplinterGU (Fenix/Bennugd)
+ * Copyright © 2002-2006 Fenix Team (Fenix)
+ * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix)
+ *
+ * This file is part of Bennu - Game Development
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ */
+
+#ifndef __PIXEL_H
+#define __PIXEL_H
+
+/* --------------------------------------------------------------------------- */
+
+#include <stdint.h>
+
+/* --------------------------------------------------------------------------- */
+
+extern int pixel_color8 ;
+extern uint16_t pixel_color16 ;
+extern uint32_t pixel_color32 ;
+
+extern uint16_t pixel_color16_alpha ;
+
+extern int pixel_alpha ;
+extern uint8_t * pixel_alpha8 ;
+extern uint16_t * pixel_alpha16 ;
+
+/* --------------------------------------------------------------------------- */
+/* Pixels */
+/* ------ */
+
+/* --------------------------------------------------------------------------- */
+
+#define _Pixel8(ptr,color) * ((uint8_t *)(ptr)) = (( pixel_alpha == 255 ) ? (color) : (pixel_alpha8[(uint8_t)(((color) << 8) + *(ptr))]))
+#define _Pixel16(ptr,color,color_alpha) * ((uint16_t *)(ptr)) = (( pixel_alpha == 255 ) ? (color) : (pixel_alpha16[(uint16_t)*(ptr)] + (color_alpha)))
+#define _Pixel32(ptr,color) * ((uint32_t *)(ptr)) = (( pixel_alpha == 255 ) ? (color) : (color))
+
+/* --------------------------------------------------------------------------- */
+
+extern int gr_get_pixel( GRAPH * dest, int x, int y );
+extern void gr_put_pixel( GRAPH * dest, int x, int y, int color );
+extern void gr_put_pixelc( GRAPH * dest, REGION * clip, int x, int y, int color );
+extern void gr_setalpha( int value );
+extern void gr_setcolor( int c );
+
+/* --------------------------------------------------------------------------- */
+#endif
diff --git a/modules/libblit/libblit.c b/modules/libblit/libblit.c
new file mode 100644
index 0000000..7927fde
--- /dev/null
+++ b/modules/libblit/libblit.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright © 2006-2016 SplinterGU (Fenix/Bennugd)
+ * Copyright © 2002-2006 Fenix Team (Fenix)
+ * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix)
+ *
+ * This file is part of Bennu - Game Development
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ */
+
+/* --------------------------------------------------------------------------- */
+/* exports */
+/* --------------------------------------------------------------------------- */
+
+#include "libblit.h"
+
+#include "libblit_exports.h"
+
+/* --------------------------------------------------------------------------- */
diff --git a/modules/libblit/libblit.h b/modules/libblit/libblit.h
new file mode 100644
index 0000000..e63ec63
--- /dev/null
+++ b/modules/libblit/libblit.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright © 2006-2013 SplinterGU (Fenix/Bennugd)
+ * Copyright © 2002-2006 Fenix Team (Fenix)
+ * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix)
+ *
+ * This file is part of Bennu - Game Development
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ */
+
+#ifndef __LIBBLIT_H
+#define __LIBBLIT_H
+
+#include "libgrbase.h"
+
+#include "g_blit.h"
+#include "g_pixel.h"
+
+#endif
diff --git a/modules/libblit/libblit_exports.h b/modules/libblit/libblit_exports.h
new file mode 100644
index 0000000..171f29b
--- /dev/null
+++ b/modules/libblit/libblit_exports.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright © 2006-2013 SplinterGU (Fenix/Bennugd)
+ * Copyright © 2002-2006 Fenix Team (Fenix)
+ * Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix)
+ *
+ * This file is part of Bennu - Game Development
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ */
+
+#ifndef __LIBBLIT_EXPORTS
+#define __LIBBLIT_EXPORTS
+
+/* --------------------------------------------------------------------------- */
+
+#if defined(__BGDC__) || !defined(__STATIC__)
+
+/* --------------------------------------------------------------------------- */
+
+#include "bgddl.h"
+#include "g_blit.h"
+
+/* --------------------------------------------------------------------------- */
+
+DLCONSTANT __bgdexport( libblit, constants_def )[] =
+{
+ /* Flags para gr_blit */
+ { "B_HMIRROR" , TYPE_DWORD, B_HMIRROR },
+ { "B_VMIRROR" , TYPE_DWORD, B_VMIRROR },
+ { "B_TRANSLUCENT" , TYPE_DWORD, B_TRANSLUCENT },
+ { "B_ALPHA" , TYPE_DWORD, B_ALPHA },
+ { "B_ABLEND" , TYPE_DWORD, B_ABLEND },
+ { "B_SBLEND" , TYPE_DWORD, B_SBLEND },
+ { "B_NOCOLORKEY" , TYPE_DWORD, B_NOCOLORKEY },
+
+ { NULL , 0 , 0 }
+} ;
+
+/* --------------------------------------------------------------------------- */
+
+#endif
+
+#endif