diff --git a/legacy/evas/evas-software-8-x11.pc.in b/legacy/evas/evas-software-8-x11.pc.in new file mode 100644 index 0000000000..1a0e46db08 --- /dev/null +++ b/legacy/evas/evas-software-8-x11.pc.in @@ -0,0 +1,3 @@ +Name: evas-software-8-x11 +Description: Evas software X11 8bpp grayscale engine +Version: @VERSION@ diff --git a/legacy/evas/src/lib/engines/common_8/Makefile.am b/legacy/evas/src/lib/engines/common_8/Makefile.am new file mode 100644 index 0000000000..5fdd086f97 --- /dev/null +++ b/legacy/evas/src/lib/engines/common_8/Makefile.am @@ -0,0 +1,31 @@ + +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I. \ +-I$(top_srcdir)/src/lib \ +-I$(top_srcdir)/src/lib/include \ +@FREETYPE_CFLAGS@ \ +@VALGRIND_CFLAGS@ \ +@EINA_CFLAGS@ \ +@EET_CFLAGS@ \ +@pthread_cflags@ + +noinst_LTLIBRARIES = libevas_engine_common_8.la + +libevas_engine_common_8_la_SOURCES = \ +evas_soft8_dither_mask.c \ +evas_soft8_font.c \ +evas_soft8_image_unscaled.c \ +evas_soft8_main.c \ +evas_soft8_rectangle.c \ +evas_soft8_line.c \ +evas_soft8_polygon.c \ +evas_soft8_image_scaled_sampled.c + + +libevas_engine_common_8_la_DEPENDENCIES = $(top_builddir)/config.h + +EXTRA_DIST = \ +evas_soft8_scanline_blend.c \ +evas_soft8_scanline_fill.c diff --git a/legacy/evas/src/lib/engines/common_8/Makefile.in b/legacy/evas/src/lib/engines/common_8/Makefile.in new file mode 100644 index 0000000000..137c9e508b --- /dev/null +++ b/legacy/evas/src/lib/engines/common_8/Makefile.in @@ -0,0 +1,659 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ + +VPATH = @srcdir@ +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@ +subdir = src/lib/engines/common_8 +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_fnmatch.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 \ + $(top_srcdir)/m4/evas_check_engine.m4 \ + $(top_srcdir)/m4/evas_check_loader.m4 \ + $(top_srcdir)/m4/evas_converter.m4 \ + $(top_srcdir)/m4/evas_dither.m4 \ + $(top_srcdir)/m4/evas_scaler.m4 $(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.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libevas_engine_common_8_la_LIBADD = +am_libevas_engine_common_8_la_OBJECTS = evas_soft8_dither_mask.lo \ + evas_soft8_font.lo evas_soft8_image_unscaled.lo \ + evas_soft8_main.lo evas_soft8_rectangle.lo evas_soft8_line.lo \ + evas_soft8_polygon.lo evas_soft8_image_scaled_sampled.lo +libevas_engine_common_8_la_OBJECTS = \ + $(am_libevas_engine_common_8_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +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) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libevas_engine_common_8_la_SOURCES) +DIST_SOURCES = $(libevas_engine_common_8_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EDB_CFLAGS = @EDB_CFLAGS@ +EDB_LIBS = @EDB_LIBS@ +EET_CFLAGS = @EET_CFLAGS@ +EET_LIBS = @EET_LIBS@ +EFL_FNMATCH_LIBS = @EFL_FNMATCH_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ +FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ +FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ +FREETYPE_LIBS = @FREETYPE_LIBS@ +FRIBIDI_CFLAGS = @FRIBIDI_CFLAGS@ +FRIBIDI_LIBS = @FRIBIDI_LIBS@ +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@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MODULE_ARCH = @MODULE_ARCH@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJCPP = @OBJCPP@ +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@ +PNG_CFLAGS = @PNG_CFLAGS@ +PNG_LIBS = @PNG_LIBS@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SVG_CFLAGS = @SVG_CFLAGS@ +SVG_LIBS = @SVG_LIBS@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +XCBRENDER_CFLAGS = @XCBRENDER_CFLAGS@ +XCBRENDER_LIBS = @XCBRENDER_LIBS@ +XCB_CFLAGS = @XCB_CFLAGS@ +XCB_LIBS = @XCB_LIBS@ +XEXT_CFLAGS = @XEXT_CFLAGS@ +XEXT_LIBS = @XEXT_LIBS@ +XMKMF = @XMKMF@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +altivec_cflags = @altivec_cflags@ +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@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +evas_engine_buffer_cflags = @evas_engine_buffer_cflags@ +evas_engine_buffer_libs = @evas_engine_buffer_libs@ +evas_engine_direct3d_cflags = @evas_engine_direct3d_cflags@ +evas_engine_direct3d_libs = @evas_engine_direct3d_libs@ +evas_engine_directfb_cflags = @evas_engine_directfb_cflags@ +evas_engine_directfb_libs = @evas_engine_directfb_libs@ +evas_engine_fb_cflags = @evas_engine_fb_cflags@ +evas_engine_fb_libs = @evas_engine_fb_libs@ +evas_engine_gl_common_libs = @evas_engine_gl_common_libs@ +evas_engine_gl_glew_cflags = @evas_engine_gl_glew_cflags@ +evas_engine_gl_glew_libs = @evas_engine_gl_glew_libs@ +evas_engine_gl_sdl_cflags = @evas_engine_gl_sdl_cflags@ +evas_engine_gl_sdl_libs = @evas_engine_gl_sdl_libs@ +evas_engine_gl_x11_cflags = @evas_engine_gl_x11_cflags@ +evas_engine_gl_x11_libs = @evas_engine_gl_x11_libs@ +evas_engine_quartz_cflags = @evas_engine_quartz_cflags@ +evas_engine_quartz_libs = @evas_engine_quartz_libs@ +evas_engine_software_16_ddraw_cflags = @evas_engine_software_16_ddraw_cflags@ +evas_engine_software_16_ddraw_libs = @evas_engine_software_16_ddraw_libs@ +evas_engine_software_16_wince_cflags = @evas_engine_software_16_wince_cflags@ +evas_engine_software_16_wince_libs = @evas_engine_software_16_wince_libs@ +evas_engine_software_16_x11_cflags = @evas_engine_software_16_x11_cflags@ +evas_engine_software_16_x11_libs = @evas_engine_software_16_x11_libs@ +evas_engine_software_8_x11_cflags = @evas_engine_software_8_x11_cflags@ +evas_engine_software_8_x11_libs = @evas_engine_software_8_x11_libs@ +evas_engine_software_ddraw_cflags = @evas_engine_software_ddraw_cflags@ +evas_engine_software_ddraw_libs = @evas_engine_software_ddraw_libs@ +evas_engine_software_gdi_cflags = @evas_engine_software_gdi_cflags@ +evas_engine_software_gdi_libs = @evas_engine_software_gdi_libs@ +evas_engine_software_sdl_cflags = @evas_engine_software_sdl_cflags@ +evas_engine_software_sdl_libs = @evas_engine_software_sdl_libs@ +evas_engine_software_xcb_cflags = @evas_engine_software_xcb_cflags@ +evas_engine_software_xcb_libs = @evas_engine_software_xcb_libs@ +evas_engine_software_xlib_cflags = @evas_engine_software_xlib_cflags@ +evas_engine_software_xlib_libs = @evas_engine_software_xlib_libs@ +evas_engine_xrender_x11_cflags = @evas_engine_xrender_x11_cflags@ +evas_engine_xrender_x11_libs = @evas_engine_xrender_x11_libs@ +evas_engine_xrender_xcb_cflags = @evas_engine_xrender_xcb_cflags@ +evas_engine_xrender_xcb_libs = @evas_engine_xrender_xcb_libs@ +evas_image_loader_bmp_cflags = @evas_image_loader_bmp_cflags@ +evas_image_loader_bmp_libs = @evas_image_loader_bmp_libs@ +evas_image_loader_edb_cflags = @evas_image_loader_edb_cflags@ +evas_image_loader_edb_libs = @evas_image_loader_edb_libs@ +evas_image_loader_eet_cflags = @evas_image_loader_eet_cflags@ +evas_image_loader_eet_libs = @evas_image_loader_eet_libs@ +evas_image_loader_gif_cflags = @evas_image_loader_gif_cflags@ +evas_image_loader_gif_libs = @evas_image_loader_gif_libs@ +evas_image_loader_jpeg_cflags = @evas_image_loader_jpeg_cflags@ +evas_image_loader_jpeg_libs = @evas_image_loader_jpeg_libs@ +evas_image_loader_pmaps_cflags = @evas_image_loader_pmaps_cflags@ +evas_image_loader_pmaps_libs = @evas_image_loader_pmaps_libs@ +evas_image_loader_png_cflags = @evas_image_loader_png_cflags@ +evas_image_loader_png_libs = @evas_image_loader_png_libs@ +evas_image_loader_svg_cflags = @evas_image_loader_svg_cflags@ +evas_image_loader_svg_libs = @evas_image_loader_svg_libs@ +evas_image_loader_tga_cflags = @evas_image_loader_tga_cflags@ +evas_image_loader_tga_libs = @evas_image_loader_tga_libs@ +evas_image_loader_tiff_cflags = @evas_image_loader_tiff_cflags@ +evas_image_loader_tiff_libs = @evas_image_loader_tiff_libs@ +evas_image_loader_xpm_cflags = @evas_image_loader_xpm_cflags@ +evas_image_loader_xpm_libs = @evas_image_loader_xpm_libs@ +exec_prefix = @exec_prefix@ +have_evas_engine_software_xcb = @have_evas_engine_software_xcb@ +have_evas_engine_software_xlib = @have_evas_engine_software_xlib@ +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@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pthread_cflags = @pthread_cflags@ +pthread_libs = @pthread_libs@ +release_info = @release_info@ +requirement_evas = @requirement_evas@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I. \ +-I$(top_srcdir)/src/lib \ +-I$(top_srcdir)/src/lib/include \ +@FREETYPE_CFLAGS@ \ +@VALGRIND_CFLAGS@ \ +@EINA_CFLAGS@ \ +@EET_CFLAGS@ \ +@pthread_cflags@ + +noinst_LTLIBRARIES = libevas_engine_common_8.la +libevas_engine_common_8_la_SOURCES = \ +evas_soft8_dither_mask.c \ +evas_soft8_font.c \ +evas_soft8_image_unscaled.c \ +evas_soft8_main.c \ +evas_soft8_rectangle.c \ +evas_soft8_line.c \ +evas_soft8_polygon.c \ +evas_soft8_image_scaled_sampled.c + +libevas_engine_common_8_la_DEPENDENCIES = $(top_builddir)/config.h +EXTRA_DIST = \ +evas_soft8_scanline_blend.c \ +evas_soft8_scanline_fill.c + +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 src/lib/engines/common_8/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/engines/common_8/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): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libevas_engine_common_8.la: $(libevas_engine_common_8_la_OBJECTS) $(libevas_engine_common_8_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libevas_engine_common_8_la_OBJECTS) $(libevas_engine_common_8_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_soft8_dither_mask.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_soft8_font.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_soft8_image_scaled_sampled.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_soft8_image_unscaled.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_soft8_line.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_soft8_main.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_soft8_polygon.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_soft8_rectangle.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@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@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@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@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@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 $@ $< + +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" + +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: +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +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." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + 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-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: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES 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-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 + + +# 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/legacy/evas/src/lib/engines/common_8/evas_soft8_dither_mask.c b/legacy/evas/src/lib/engines/common_8/evas_soft8_dither_mask.c new file mode 100644 index 0000000000..74c88b40db --- /dev/null +++ b/legacy/evas/src/lib/engines/common_8/evas_soft8_dither_mask.c @@ -0,0 +1,103 @@ +#include "evas_common_soft8.h" + +static always_inline void +_soft8_convert_from_rgba_pt(const DATA32 * src, DATA8 * dst, DATA8 * alpha, + const int x, const int y) +{ + if (A_VAL(src) == 0) + { + *dst = 0; + *alpha = 0; + } + else + { + *dst = GRY_8_FROM_RGB(src); + *alpha = A_VAL(src); + } +} + +static inline void +_soft8_convert_from_rgba_scanline(const DATA32 * src, DATA8 * dst, + DATA8 * alpha, const int y, const int w) +{ + int x, m; + + m = (w & ~7); + x = 0; + pld(src, 0); + + while (x < m) + { + pld(src, 32); + UNROLL8( + { + _soft8_convert_from_rgba_pt(src, dst, alpha, x, y); + src++; dst++; alpha++; x++;} + ); + } + + for (; x < w; x++, src++, dst++, alpha++) + _soft8_convert_from_rgba_pt(src, dst, alpha, x, y); +} + +void +soft8_image_convert_from_rgba(Soft8_Image * im, const DATA32 * src) +{ + const DATA32 *sp; + DATA8 *dp; + DATA8 *ap; + int y; + + sp = src; + dp = im->pixels; + ap = im->alpha; + + for (y = 0; y < im->cache_entry.h; + y++, sp += im->cache_entry.w, dp += im->stride, ap += im->stride) + _soft8_convert_from_rgba_scanline(sp, dp, ap, y, im->cache_entry.w); +} + +static always_inline void +_soft8_convert_from_rgb_pt(const DATA32 * src, DATA8 * dst, + const int x, const int y) +{ + *dst = GRY_8_FROM_RGB(src); +} + +static inline void +_soft8_convert_from_rgb_scanline(const DATA32 * src, DATA8 * dst, const int y, + const int w) +{ + int x, m; + + m = (w & ~7); + x = 0; + pld(src, 0); + + while (x < m) + { + pld(src, 32); + UNROLL8( + { + _soft8_convert_from_rgb_pt(src, dst, x, y); src++; dst++; x++;} + ); + } + + for (; x < w; x++, src++, dst++) + _soft8_convert_from_rgb_pt(src, dst, x, y); +} + +void +soft8_image_convert_from_rgb(Soft8_Image * im, const DATA32 * src) +{ + const DATA32 *sp; + DATA8 *dp; + int y; + + sp = src; + dp = im->pixels; + + for (y = 0; y < im->cache_entry.h; + y++, sp += im->cache_entry.w, dp += im->stride) + _soft8_convert_from_rgb_scanline(sp, dp, y, im->cache_entry.w); +} diff --git a/legacy/evas/src/lib/engines/common_8/evas_soft8_font.c b/legacy/evas/src/lib/engines/common_8/evas_soft8_font.c new file mode 100644 index 0000000000..84ef736e31 --- /dev/null +++ b/legacy/evas/src/lib/engines/common_8/evas_soft8_font.c @@ -0,0 +1,286 @@ +#include "evas_common_soft8.h" +#include "evas_soft8_scanline_blend.c" + +static always_inline void +_glyph_pt_mask_solid_solid(DATA8 * dst, const DATA8 gry8, const DATA8 * mask) +{ + DATA8 alpha = *mask; + + if (alpha == 0xff) + *dst = gry8; + else if (alpha > 0) + { + *dst = GRY_8_BLEND_UNMUL(gry8, *dst, alpha); + } +} + +static void +_glyph_scanline_mask_solid_solid(DATA8 * dst, + int size, const DATA8 gry8, const DATA8 * mask) +{ + DATA8 *start, *end; + + start = dst; + pld(start, 0); + pld(mask, 0); + end = start + (size & ~3); + + while (start < end) + { + pld(start, 8); + pld(mask, 4); + UNROLL4( + { + _glyph_pt_mask_solid_solid(start, gry8, mask); + start++; mask++;} + ); + } + + end = start + (size & 3); + for (; start < end; start++, mask++) + _glyph_pt_mask_solid_solid(start, gry8, mask); +} + +static always_inline void +_glyph_pt_mask_transp_solid(DATA8 * dst, + DATA8 gry8, DATA8 alpha, const DATA8 * mask) +{ + DATA32 a, b; + int rel_alpha; + + rel_alpha = *mask; + alpha = (alpha * rel_alpha) >> 8; + if (alpha == 0) + return; + + alpha++; + + *dst = GRY_8_BLEND((gry8 * rel_alpha) >> 8, *dst, alpha); +} + +static void +_glyph_scanline_mask_transp_solid(DATA8 * dst, + int size, + const DATA8 gry8, + const DATA8 rel_alpha, const DATA8 * mask) +{ + DATA8 *start, *end; + + start = dst; + pld(start, 0); + pld(mask, 0); + end = start + (size & ~3); + + while (start < end) + { + pld(start, 8); + pld(mask, 4); + UNROLL4( + { + _glyph_pt_mask_transp_solid(start, gry8, rel_alpha, mask); + start++; mask++;} + ); + } + + end = start + (size & 3); + for (; start < end; start++, mask++) + _glyph_pt_mask_transp_solid(start, gry8, rel_alpha, mask); +} + +static inline void +_calc_ext(const Soft8_Image * dst, const RGBA_Draw_Context * dc, + Eina_Rectangle * ext) +{ + EINA_RECTANGLE_SET(ext, 0, 0, dst->cache_entry.w, dst->cache_entry.h); + + if (dc->clip.use) + { + int v; + + EINA_RECTANGLE_SET(ext, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h); + if (ext->x < 0) + { + ext->w += ext->x; + ext->x = 0; + } + if (ext->y < 0) + { + ext->h += ext->y; + ext->y = 0; + } + + v = dst->cache_entry.w - ext->x; + if (ext->w > v) + ext->w = v; + + v = dst->cache_entry.h - ext->y; + if (ext->h > v) + ext->h = v; + } +} + +static inline void +_glyph_scanline(Soft8_Image * dst, const DATA8 * p_mask, + const Eina_Rectangle ext, int dx, int dy, int max_x, int max_y, + int w, DATA8 alpha, const DATA8 gry8) +{ + int size, in_x, in_w; + DATA8 *p_pixels; + + if ((dx >= max_x) || (dy < ext.y) || (dy >= max_y)) + return; + + in_x = 0; + in_w = 0; + + if (dx + w > max_x) + in_w += (dx + w) - max_x; + + if (dx < ext.x) + { + in_w += ext.x - dx; + in_x = ext.x - dx; + dx = ext.x; + } + + size = w - in_w; + p_pixels = dst->pixels + (dy * dst->stride) + dx; + p_mask += in_x; + + if (size > 1) + { + if (alpha == 0xff) + _glyph_scanline_mask_solid_solid(p_pixels, size, gry8, p_mask); + else if (alpha != 0) + _glyph_scanline_mask_transp_solid + (p_pixels, size, gry8, alpha, p_mask); + } + else if (size == 1) + { + if (alpha == 0xff) + _glyph_pt_mask_solid_solid(p_pixels, gry8, p_mask); + else if (alpha != 0) + _glyph_pt_mask_transp_solid(p_pixels, gry8, alpha, p_mask); + } +} + +static void +_soft8_font_glyph_draw_grayscale(Soft8_Image * dst, + RGBA_Draw_Context * dc __UNUSED__, + RGBA_Font_Glyph * fg __UNUSED__, int x, int y, + DATA8 alpha, DATA8 gry8, + const Eina_Rectangle ext, int bw, int bh, + int bpitch, const DATA8 * bitmap) +{ + int i, max_x, max_y; + + max_x = ext.x + ext.w; + max_y = ext.y + ext.h; + + for (i = 0; i < bh; i++, bitmap += bpitch) + _glyph_scanline(dst, bitmap, ext, x, y + i, max_x, max_y, bw, + alpha, gry8); +} + +static inline void +_glyph_create_mask_line(DATA8 * mask, const DATA8 * bitmap, int w) +{ + const DATA8 bitrepl[2] = { 0x0, 0xff }; + int i; + + for (i = 0; i < w; i += 8, bitmap++) + { + int j, size; + DATA32 bits; + + if (i + 8 < w) + size = 8; + else + size = w - i; + + bits = *bitmap; + + for (j = size - 1; j >= 0; j--, mask++) + *mask = bitrepl[(bits >> j) & 0x1]; + } +} + +static void +_soft8_font_glyph_draw_mono(Soft8_Image * dst, + RGBA_Draw_Context * dc __UNUSED__, + RGBA_Font_Glyph * fg __UNUSED__, int x, int y, + DATA8 alpha, DATA8 gry8, const Eina_Rectangle ext, + int bw, int bh, int bpitch, const DATA8 * bitmap) +{ + DATA8 *mask; + int i, max_x, max_y; + + max_x = ext.x + ext.w; + max_y = ext.y + ext.h; + + mask = alloca(bpitch); + for (i = 0; i < bh; i++, bitmap += bpitch) + { + _glyph_create_mask_line(mask, bitmap, bw); + _glyph_scanline(dst, mask, ext, x, y + i, max_x, max_y, bw, + alpha, gry8); + } +} + +void +soft8_font_glyph_draw(void *data, void *dest __UNUSED__, void *context, + RGBA_Font_Glyph * fg, int x, int y) +{ + Soft8_Image *dst; + RGBA_Draw_Context *dc; + const DATA8 *bitmap; + DATA8 alpha, r, g, b; + DATA8 gry8; + Eina_Rectangle ext; + int bpitch, bw, bh; + + dst = data; + dc = context; + + alpha = A_VAL(&dc->col.col); + if (alpha == 0) + return; + + gry8 = GRY_8_FROM_RGB(&dc->col.col); + + /* + * if (r > alpha) r = alpha; + * if (g > alpha) g = alpha; + * if (b > alpha) b = alpha; + * + * gry8 = GRY_8_FROM_COMPONENTS(r, g, b); + */ + + bitmap = fg->glyph_out->bitmap.buffer; + bh = fg->glyph_out->bitmap.rows; + bw = fg->glyph_out->bitmap.width; + bpitch = fg->glyph_out->bitmap.pitch; + if (bpitch < bw) + bpitch = bw; + + _calc_ext(dst, dc, &ext); + + if ((fg->glyph_out->bitmap.num_grays == 256) && + (fg->glyph_out->bitmap.pixel_mode == ft_pixel_mode_grays)) + _soft8_font_glyph_draw_grayscale(dst, dc, fg, x, y, alpha, gry8, + ext, bw, bh, bpitch, bitmap); + else + _soft8_font_glyph_draw_mono(dst, dc, fg, x, y, alpha, gry8, + ext, bw, bh, bpitch, bitmap); +} + +void * +soft8_font_glyph_new(void *data __UNUSED__, RGBA_Font_Glyph * fg __UNUSED__) +{ + return (void *)1; /* core requires != NULL to work */ +} + +void +soft8_font_glyph_free(void *ext_dat __UNUSED__) +{ +} diff --git a/legacy/evas/src/lib/engines/common_8/evas_soft8_image_scaled_sampled.c b/legacy/evas/src/lib/engines/common_8/evas_soft8_image_scaled_sampled.c new file mode 100644 index 0000000000..9e8dcadf1b --- /dev/null +++ b/legacy/evas/src/lib/engines/common_8/evas_soft8_image_scaled_sampled.c @@ -0,0 +1,463 @@ +#include "evas_common_soft8.h" +#include "evas_soft8_scanline_blend.c" + +static void +_soft8_image_draw_scaled_solid_solid(Soft8_Image * src, + Soft8_Image * dst, + RGBA_Draw_Context * dc __UNUSED__, + int dst_offset, int w, int h, + int *offset_x, int *offset_y) +{ + DATA8 *dst_itr; + int y, w_align; + + w_align = w & ~7; + + dst_itr = dst->pixels + dst_offset; + for (y = 0; y < h; y++, dst_itr += dst->stride) + { + DATA8 *d, *s; + int x; + + s = src->pixels + offset_y[y]; + pld(s, 0); + pld(offset_x, 0); + + d = dst_itr; + x = 0; + while (x < w_align) + { + pld(s, 32); + pld(offset_x + x, 32); + + UNROLL8( + { + _soft8_pt_blend_solid_solid(d, s[offset_x[x]]); x++; d++;} + ); + } + + for (; x < w; x++, d++) + _soft8_pt_blend_solid_solid(d, s[offset_x[x]]); + } +} +static void +_soft8_image_draw_scaled_transp_solid(Soft8_Image * src, + Soft8_Image * dst, + RGBA_Draw_Context * dc __UNUSED__, + int dst_offset, int w, int h, + int *offset_x, int *offset_y) +{ + DATA8 *dst_itr; + int y, w_align; + + w_align = w & ~7; + + dst_itr = dst->pixels + dst_offset; + for (y = 0; y < h; y++, dst_itr += dst->stride) + { + DATA8 *d, *s; + DATA8 *a; + int x; + + s = src->pixels + offset_y[y]; + a = src->alpha + offset_y[y]; + pld(s, 0); + pld(a, 0); + pld(offset_x, 0); + + d = dst_itr; + x = 0; + while (x < w_align) + { + pld(s, 32); + pld(a, 8); + pld(offset_x + x, 32); + + UNROLL8( + { + int off_x = offset_x[x]; + _soft8_pt_blend_transp_solid(d, s[off_x], a[off_x]); + x++; d++;}); + } + + for (; x < w; x++, d++) + _soft8_pt_blend_transp_solid(d, s[offset_x[x]], a[offset_x[x]]); + } +} + +static inline void +_soft8_image_draw_scaled_no_mul(Soft8_Image * src, Soft8_Image * dst, + RGBA_Draw_Context * dc, + int dst_offset, int w, int h, + int *offset_x, int *offset_y) +{ + if ((src->cache_entry.flags.alpha && src->alpha) && + (!dst->cache_entry.flags.alpha)) + _soft8_image_draw_scaled_transp_solid + (src, dst, dc, dst_offset, w, h, offset_x, offset_y); + else if (!dst->cache_entry.flags.alpha) + _soft8_image_draw_scaled_solid_solid + (src, dst, dc, dst_offset, w, h, offset_x, offset_y); + else + ERR("Unsupported draw of scaled images src->cache_entry.flags.alpha=%d, " + "dst->cache_entry.flags.alpha=%d, WITHOUT COLOR MUL", + src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha); +} + +static void +_soft8_image_draw_scaled_solid_solid_mul_alpha(Soft8_Image * src, + Soft8_Image * dst, + RGBA_Draw_Context * + dc __UNUSED__, int dst_offset, + int w, int h, int *offset_x, + int *offset_y, DATA8 alpha) +{ + DATA8 *dst_itr; + int y, w_align; + + w_align = w & ~7; + + dst_itr = dst->pixels + dst_offset; + for (y = 0; y < h; y++, dst_itr += dst->stride) + { + DATA8 *d, *s; + int x; + + s = src->pixels + offset_y[y]; + pld(s, 0); + pld(offset_x, 0); + + d = dst_itr; + x = 0; + while (x < w_align) + { + pld(s, 32); + pld(offset_x + x, 32); + + UNROLL8( + { + _soft8_pt_blend_solid_solid_mul_alpha + (d, s[offset_x[x]], alpha); x++; d++;} + ); + } + + for (; x < w; x++, d++) + _soft8_pt_blend_solid_solid_mul_alpha(d, s[offset_x[x]], alpha); + } +} + +static void +_soft8_image_draw_scaled_transp_solid_mul_alpha(Soft8_Image * src, + Soft8_Image * dst, + RGBA_Draw_Context * + dc __UNUSED__, int dst_offset, + int w, int h, int *offset_x, + int *offset_y, DATA8 alpha) +{ + DATA8 *dst_itr; + int y, w_align; + + w_align = w & ~7; + + dst_itr = dst->pixels + dst_offset; + for (y = 0; y < h; y++, dst_itr += dst->stride) + { + DATA8 *d, *s; + DATA8 *a; + int x; + + s = src->pixels + offset_y[y]; + a = src->alpha + offset_y[y]; + pld(s, 0); + pld(a, 0); + pld(offset_x, 0); + + d = dst_itr; + x = 0; + while (x < w_align) + { + pld(s, 32); + pld(a, 8); + pld(offset_x + x, 32); + + UNROLL8( + { + int off_x = offset_x[x]; + _soft8_pt_blend_transp_solid_mul_alpha + (d, s[off_x], a[off_x], alpha); x++; d++;}); + } + + for (; x < w; x++, d++) + _soft8_pt_blend_transp_solid_mul_alpha + (d, s[offset_x[x]], a[offset_x[x]], alpha); + } +} + +static inline void +_soft8_image_draw_scaled_mul_alpha(Soft8_Image * src, Soft8_Image * dst, + RGBA_Draw_Context * dc, + int dst_offset, int w, int h, + int *offset_x, int *offset_y, DATA8 a) +{ + if ((src->cache_entry.flags.alpha && src->alpha) && + (!dst->cache_entry.flags.alpha)) + _soft8_image_draw_scaled_transp_solid_mul_alpha + (src, dst, dc, dst_offset, w, h, offset_x, offset_y, a); + else if (!dst->cache_entry.flags.alpha) + _soft8_image_draw_scaled_solid_solid_mul_alpha + (src, dst, dc, dst_offset, w, h, offset_x, offset_y, a); + else + ERR("Unsupported draw of scaled images src->cache_entry.flags.alpha=%d, " + "dst->cache_entry.flags.alpha=%d, WITH ALPHA MUL %d", + src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha, + A_VAL(&dc->mul.col)); +} + +static void +_soft8_image_draw_scaled_solid_solid_mul_color(Soft8_Image * src, + Soft8_Image * dst, + RGBA_Draw_Context * + dc __UNUSED__, int dst_offset, + int w, int h, int *offset_x, + int *offset_y, DATA8 r, DATA8 g, + DATA8 b, DATA8 alpha) +{ + DATA8 *dst_itr; + int y, w_align; + + w_align = w & ~7; + + dst_itr = dst->pixels + dst_offset; + + if (alpha == 0xff) + for (y = 0; y < h; y++, dst_itr += dst->stride) + { + DATA8 *d, *s; + int x; + + s = src->pixels + offset_y[y]; + pld(s, 0); + pld(offset_x, 0); + + d = dst_itr; + x = 0; + while (x < w_align) + { + pld(s, 32); + pld(offset_x + x, 32); + + UNROLL8( + { + _soft8_pt_blend_solid_solid_mul_color_solid + (d, s[offset_x[x]], r, g, b); x++; d++;} + ); + } + + for (; x < w; x++, d++) + _soft8_pt_blend_solid_solid_mul_color_solid + (d, s[offset_x[x]], r, g, b); + } + else + for (y = 0; y < h; y++, dst_itr += dst->stride) + { + DATA8 *d, *s; + int x; + + s = src->pixels + offset_y[y]; + pld(s, 0); + pld(offset_x, 0); + + d = dst_itr; + x = 0; + while (x < w_align) + { + pld(s, 32); + pld(offset_x + x, 32); + + UNROLL8( + { + _soft8_pt_blend_solid_solid_mul_color_transp + (d, s[offset_x[x]], alpha, r, g, b); x++; d++;} + ); + } + + for (; x < w; x++, d++) + _soft8_pt_blend_solid_solid_mul_color_transp + (d, s[offset_x[x]], alpha, r, g, b); + } +} + +static void +_soft8_image_draw_scaled_transp_solid_mul_color(Soft8_Image * src, + Soft8_Image * dst, + RGBA_Draw_Context * + dc __UNUSED__, int dst_offset, + int w, int h, int *offset_x, + int *offset_y, DATA8 r, DATA8 g, + DATA8 b, DATA8 alpha) +{ + DATA8 *dst_itr; + int y, w_align; + + w_align = w & ~7; + + dst_itr = dst->pixels + dst_offset; + + if (alpha == 0xff) + for (y = 0; y < h; y++, dst_itr += dst->stride) + { + DATA8 *d, *s; + DATA8 *a; + int x; + + s = src->pixels + offset_y[y]; + a = src->alpha + offset_y[y]; + pld(s, 0); + pld(a, 0); + pld(offset_x, 0); + + d = dst_itr; + x = 0; + while (x < w_align) + { + pld(s, 32); + pld(a, 8); + pld(offset_x + x, 32); + + UNROLL8( + { + int off_x = offset_x[x]; + _soft8_pt_blend_transp_solid_mul_color_solid + (d, s[off_x], a[off_x], r, g, b); x++; d++;}); + } + + for (; x < w; x++, d++) + _soft8_pt_blend_transp_solid_mul_color_solid + (d, s[offset_x[x]], a[offset_x[x]], r, g, b); + } + else + for (y = 0; y < h; y++, dst_itr += dst->stride) + { + DATA8 *d, *s; + DATA8 *a; + int x; + + s = src->pixels + offset_y[y]; + a = src->alpha + offset_y[y]; + pld(s, 0); + pld(a, 0); + pld(offset_x, 0); + + d = dst_itr; + x = 0; + while (x < w_align) + { + pld(s, 32); + pld(a, 8); + pld(offset_x + x, 32); + + UNROLL8( + { + int off_x = offset_x[x]; + _soft8_pt_blend_transp_solid_mul_color_transp + (d, s[off_x], a[off_x], alpha, r, g, b); x++; d++;}); + } + + for (; x < w; x++, d++) + _soft8_pt_blend_transp_solid_mul_color_transp + (d, s[offset_x[x]], a[offset_x[x]], alpha, r, g, b); + } +} + +static inline void +_soft8_image_draw_scaled_mul_color(Soft8_Image * src, Soft8_Image * dst, + RGBA_Draw_Context * dc, + int dst_offset, int w, int h, + int *offset_x, int *offset_y, + DATA8 r, DATA8 g, DATA8 b, DATA8 a) +{ + if ((src->cache_entry.flags.alpha && src->alpha) && + (!dst->cache_entry.flags.alpha)) + _soft8_image_draw_scaled_transp_solid_mul_color + (src, dst, dc, dst_offset, w, h, offset_x, offset_y, r, g, b, a); + else if (!dst->cache_entry.flags.alpha) + _soft8_image_draw_scaled_solid_solid_mul_color + (src, dst, dc, dst_offset, w, h, offset_x, offset_y, r, g, b, a); + else + ERR("Unsupported draw of scaled images src->cache_entry.flags.alpha=%d, " + "dst->cache_entry.flags.alpha=%d, WITH COLOR MUL 0x%08x", + src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha, + dc->mul.col); +} + +static inline void +_soft8_image_draw_scaled_mul(Soft8_Image * src, Soft8_Image * dst, + RGBA_Draw_Context * dc, + int dst_offset, int w, int h, + int *offset_x, int *offset_y, DATA8 r, DATA8 g, + DATA8 b, DATA8 a) +{ + if ((a == r) && (a == g) && (a == b)) + _soft8_image_draw_scaled_mul_alpha + (src, dst, dc, dst_offset, w, h, offset_x, offset_y, a); + else + _soft8_image_draw_scaled_mul_color + (src, dst, dc, dst_offset, w, h, offset_x, offset_y, r, g, b, a); +} + +void +soft8_image_draw_scaled_sampled(Soft8_Image * src, Soft8_Image * dst, + RGBA_Draw_Context * dc, + const Eina_Rectangle sr, + const Eina_Rectangle dr, + const Eina_Rectangle cr) +{ + int x, y, dst_offset, *offset_x, *offset_y; + DATA8 mul_gry8; + DATA8 r, g, b, a; + + if (!dc->mul.use) + { + r = g = b = a = 0xff; + mul_gry8 = 0xff; + } + else + { + a = A_VAL(&dc->mul.col); + if (a == 0) + return; + + r = R_VAL(&dc->mul.col); + g = G_VAL(&dc->mul.col); + b = B_VAL(&dc->mul.col); + + if (r > a) + r = a; + if (g > a) + g = a; + if (b > a) + b = a; + + mul_gry8 = GRY_8_FROM_COMPONENTS(r, g, b); + } + + /* pre-calculated scale tables */ + offset_x = alloca(cr.w * sizeof(*offset_x)); + for (x = 0; x < cr.w; x++) + offset_x[x] = (((x + cr.x - dr.x) * sr.w) / dr.w) + sr.x; + + offset_y = alloca(cr.h * sizeof(*offset_y)); + for (y = 0; y < cr.h; y++) + offset_y[y] = (((((y + cr.y - dr.y) * sr.h) / dr.h) + sr.y) + * src->stride); + + dst_offset = cr.x + (cr.y * dst->stride); + + if (mul_gry8 == 0xff) + _soft8_image_draw_scaled_no_mul + (src, dst, dc, dst_offset, cr.w, cr.h, offset_x, offset_y); + else + _soft8_image_draw_scaled_mul + (src, dst, dc, dst_offset, cr.w, cr.h, offset_x, offset_y, r, g, b, + a); +} diff --git a/legacy/evas/src/lib/engines/common_8/evas_soft8_image_unscaled.c b/legacy/evas/src/lib/engines/common_8/evas_soft8_image_unscaled.c new file mode 100644 index 0000000000..912e5fe6c7 --- /dev/null +++ b/legacy/evas/src/lib/engines/common_8/evas_soft8_image_unscaled.c @@ -0,0 +1,284 @@ +#include "evas_common_soft8.h" +#include "evas_soft8_scanline_blend.c" + +static void +_soft8_image_draw_unscaled_solid_solid(Soft8_Image * src, Soft8_Image * dst, + RGBA_Draw_Context * dc __UNUSED__, + int src_offset, int dst_offset, + int w, int h) +{ + DATA8 *src_itr, *dst_itr; + int y; + + src_itr = src->pixels + src_offset; + dst_itr = dst->pixels + dst_offset; + + for (y = 0; y < h; y++) + { + _soft8_scanline_blend_solid_solid(src_itr, dst_itr, w); + src_itr += src->stride; + dst_itr += dst->stride; + } +} + +static void +_soft8_image_draw_unscaled_transp_solid(Soft8_Image * src, Soft8_Image * dst, + RGBA_Draw_Context * dc __UNUSED__, + int src_offset, int dst_offset, + int w, int h) +{ + DATA8 *src_itr, *dst_itr; + DATA8 *alpha_itr; + int y; + + src_itr = src->pixels + src_offset; + alpha_itr = src->alpha + src_offset; + dst_itr = dst->pixels + dst_offset; + + for (y = 0; y < h; y++) + { + _soft8_scanline_blend_transp_solid(src_itr, alpha_itr, dst_itr, w); + src_itr += src->stride; + alpha_itr += src->stride; + dst_itr += dst->stride; + } +} + +static inline void +_soft8_image_draw_unscaled_no_mul(Soft8_Image * src, Soft8_Image * dst, + RGBA_Draw_Context * dc, + int src_offset, int dst_offset, + int width, int height) +{ + if (src->cache_entry.flags.alpha && (!dst->cache_entry.flags.alpha)) + _soft8_image_draw_unscaled_transp_solid(src, dst, dc, + src_offset, dst_offset, + width, height); + else if ((!src->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha)) + _soft8_image_draw_unscaled_solid_solid(src, dst, dc, + src_offset, dst_offset, + width, height); + else + ERR("Unsupported draw of unscaled images src->cache_entry.flags.alpha=%d, " + "dst->cache_entry.flags.alpha=%d, WITHOUT COLOR MUL", + src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha); +} + +static void +_soft8_image_draw_unscaled_solid_solid_mul_alpha(Soft8_Image * src, + Soft8_Image * dst, + RGBA_Draw_Context * + dc __UNUSED__, int src_offset, + int dst_offset, int w, int h, + DATA8 a) +{ + DATA8 *src_itr, *dst_itr; + int y; + + src_itr = src->pixels + src_offset; + dst_itr = dst->pixels + dst_offset; + + for (y = 0; y < h; y++) + { + _soft8_scanline_blend_solid_solid_mul_alpha(src_itr, dst_itr, w, a); + src_itr += src->stride; + dst_itr += dst->stride; + } +} + +static void +_soft8_image_draw_unscaled_transp_solid_mul_alpha(Soft8_Image * src, + Soft8_Image * dst, + RGBA_Draw_Context * + dc __UNUSED__, int src_offset, + int dst_offset, int w, int h, + DATA8 a) +{ + DATA8 *src_itr, *dst_itr; + DATA8 *alpha_itr; + int y; + + src_itr = src->pixels + src_offset; + alpha_itr = src->alpha + src_offset; + dst_itr = dst->pixels + dst_offset; + + for (y = 0; y < h; y++) + { + _soft8_scanline_blend_transp_solid_mul_alpha(src_itr, alpha_itr, + dst_itr, w, a); + src_itr += src->stride; + alpha_itr += src->stride; + dst_itr += dst->stride; + } +} + +static inline void +_soft8_image_draw_unscaled_mul_alpha(Soft8_Image * src, Soft8_Image * dst, + RGBA_Draw_Context * dc, + int src_offset, int dst_offset, + int width, int height, DATA8 a) +{ + if (src->cache_entry.flags.alpha && (!dst->cache_entry.flags.alpha)) + _soft8_image_draw_unscaled_transp_solid_mul_alpha + (src, dst, dc, src_offset, dst_offset, width, height, a); + else if ((!src->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha)) + _soft8_image_draw_unscaled_solid_solid_mul_alpha + (src, dst, dc, src_offset, dst_offset, width, height, a); + else + ERR("Unsupported draw of unscaled images src->cache_entry.flags.alpha=%d, " + "dst->cache_entry.flags.alpha=%d, WITH ALPHA MUL %d", + src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha, A_VAL(&dc->mul.col)); +} + +static void +_soft8_image_draw_unscaled_solid_solid_mul_color(Soft8_Image * src, + Soft8_Image * dst, + RGBA_Draw_Context * + dc __UNUSED__, int src_offset, + int dst_offset, int w, int h, + DATA8 r, DATA8 g, DATA8 b, + DATA8 a) +{ + DATA8 *src_itr, *dst_itr; + int y; + + src_itr = src->pixels + src_offset; + dst_itr = dst->pixels + dst_offset; + + if (a == 0xff) + for (y = 0; y < h; y++) + { + _soft8_scanline_blend_solid_solid_mul_color_solid + (src_itr, dst_itr, w, r, g, b); + src_itr += src->stride; + dst_itr += dst->stride; + } + else + for (y = 0; y < h; y++) + { + _soft8_scanline_blend_solid_solid_mul_color_transp + (src_itr, dst_itr, w, a, r, g, b); + src_itr += src->stride; + dst_itr += dst->stride; + } +} + +static void +_soft8_image_draw_unscaled_transp_solid_mul_color(Soft8_Image * src, + Soft8_Image * dst, + RGBA_Draw_Context * + dc __UNUSED__, int src_offset, + int dst_offset, int w, int h, + DATA8 r, DATA8 g, DATA8 b, + DATA8 a) +{ + DATA8 *src_itr, *dst_itr; + DATA8 *alpha_itr; + int y; + + src_itr = src->pixels + src_offset; + alpha_itr = src->alpha + src_offset; + dst_itr = dst->pixels + dst_offset; + + if (a == 0xff) + for (y = 0; y < h; y++) + { + _soft8_scanline_blend_transp_solid_mul_color_solid + (src_itr, alpha_itr, dst_itr, w, r, g, b); + src_itr += src->stride; + alpha_itr += src->stride; + dst_itr += dst->stride; + } + else + for (y = 0; y < h; y++) + { + _soft8_scanline_blend_transp_solid_mul_color_transp + (src_itr, alpha_itr, dst_itr, w, a, r, g, b); + src_itr += src->stride; + alpha_itr += src->stride; + dst_itr += dst->stride; + } +} + +static inline void +_soft8_image_draw_unscaled_mul_color(Soft8_Image * src, Soft8_Image * dst, + RGBA_Draw_Context * dc, + int src_offset, int dst_offset, + int width, int height, + DATA8 r, DATA8 g, DATA8 b, DATA8 a) +{ + if (src->cache_entry.flags.alpha && (!dst->cache_entry.flags.alpha)) + _soft8_image_draw_unscaled_transp_solid_mul_color + (src, dst, dc, src_offset, dst_offset, width, height, r, g, b, a); + else if ((!src->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha)) + _soft8_image_draw_unscaled_solid_solid_mul_color + (src, dst, dc, src_offset, dst_offset, width, height, r, g, b, a); + else + ERR("Unsupported draw of unscaled images src->cache_entry.flags.alpha=%d, " + "dst->cache_entry.flags.alpha=%d, WITH COLOR MUL 0x%08x", + src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha, dc->mul.col); +} + +static inline void +_soft8_image_draw_unscaled_mul(Soft8_Image * src, Soft8_Image * dst, + RGBA_Draw_Context * dc, + int src_offset, int dst_offset, + int width, int height, DATA8 r, DATA8 g, + DATA8 b, DATA8 a) +{ + if ((a == r) && (a == g) && (a == b)) + _soft8_image_draw_unscaled_mul_alpha(src, dst, dc, src_offset, + dst_offset, width, height, a); + else + _soft8_image_draw_unscaled_mul_color(src, dst, dc, src_offset, + dst_offset, width, height, + r, g, b, a); +} + +void +soft8_image_draw_unscaled(Soft8_Image * src, Soft8_Image * dst, + RGBA_Draw_Context * dc, + const Eina_Rectangle sr, + const Eina_Rectangle dr, const Eina_Rectangle cr) +{ + int src_offset_rows, src_offset, dst_offset; + DATA8 mul_gry8; + DATA8 r, g, b, a; + + if (!dc->mul.use) + { + r = g = b = a = 0xff; + mul_gry8 = 0xff; + } + else + { + a = A_VAL(&dc->mul.col); + if (a == 0) + return; + + r = R_VAL(&dc->mul.col); + g = G_VAL(&dc->mul.col); + b = B_VAL(&dc->mul.col); + + if (r > a) + r = a; + if (g > a) + g = a; + if (b > a) + b = a; + + mul_gry8 = GRY_8_FROM_COMPONENTS(r, g, b); + } + + src_offset_rows = (cr.y - dr.y) + sr.y; + src_offset = (src_offset_rows * src->stride) + (cr.x - dr.x) + sr.x; + + dst_offset = cr.x + (cr.y * dst->stride); + + if (mul_gry8 == 0xff) + _soft8_image_draw_unscaled_no_mul(src, dst, dc, src_offset, dst_offset, + cr.w, cr.h); + else + _soft8_image_draw_unscaled_mul(src, dst, dc, src_offset, dst_offset, + cr.w, cr.h, r, g, b, a); +} diff --git a/legacy/evas/src/lib/engines/common_8/evas_soft8_line.c b/legacy/evas/src/lib/engines/common_8/evas_soft8_line.c new file mode 100644 index 0000000000..4135acfbb6 --- /dev/null +++ b/legacy/evas/src/lib/engines/common_8/evas_soft8_line.c @@ -0,0 +1,426 @@ +#include "evas_common_soft8.h" +#include "evas_soft8_scanline_fill.c" + +/* + * All functions except by soft8_line_draw() expect x0 <= x1. + */ + +static inline int +_in_range(int value, int min, int max) +{ + return min <= value && value <= max; +} + +static inline int +_is_xy_inside_clip(int x, int y, const struct RGBA_Draw_Context_clip clip) +{ + if (!clip.use) + return 1; + + if (!_in_range(x, clip.x, clip.x + clip.w - 1)) + return 0; + + if (!_in_range(y, clip.y, clip.y + clip.h - 1)) + return 0; + + return 1; +} + +static inline int +_is_x_inside_clip(int x, const struct RGBA_Draw_Context_clip clip) +{ + if (!clip.use) + return 1; + + return _in_range(x, clip.x, clip.x + clip.w - 1); +} + +static inline int +_is_y_inside_clip(int y, const struct RGBA_Draw_Context_clip clip) +{ + if (!clip.use) + return 1; + + return _in_range(y, clip.y, clip.y + clip.h - 1); +} + +static inline int +_is_xy_inside_rect(int x, int y, int w, int h) +{ + return _in_range(x, 0, w - 1) && _in_range(y, 0, h - 1); +} + +static inline int +_is_empty_clip(const struct RGBA_Draw_Context_clip clip) +{ + return clip.w < 1 || clip.h < 1; +} + +static void +_soft8_line_point(Soft8_Image * dst, RGBA_Draw_Context * dc, int x, int y) +{ + DATA8 gry8, *dst_itr; + DATA8 alpha; + + if (!_is_xy_inside_rect(x, y, dst->cache_entry.w, dst->cache_entry.h)) + return; + + if (!_is_xy_inside_clip(x, y, dc->clip)) + return; + + dst_itr = dst->pixels + (dst->stride * y) + x; + alpha = A_VAL(&dc->col.col); + gry8 = GRY_8_FROM_RGB(&dc->col.col); + + if (alpha == 0xff) + _soft8_pt_fill_solid_solid(dst_itr, gry8); + else if (alpha > 0) + { + alpha++; + _soft8_pt_fill_transp_solid(dst_itr, gry8, alpha); + } +} + +static void +_soft8_line_horiz(Soft8_Image * dst, RGBA_Draw_Context * dc, int x0, int x1, + int y) +{ + DATA8 gry8, *dst_itr; + DATA8 alpha; + int w; + + if (!_is_y_inside_clip(y, dc->clip)) + return; + + if (x0 < dc->clip.x) + x0 = dc->clip.x; + + if (x1 >= dc->clip.x + dc->clip.w) + x1 = dc->clip.x + dc->clip.w - 1; + + w = x1 - x0; + if (w < 1) + return; + + dst_itr = dst->pixels + (dst->stride * y) + x0; + alpha = A_VAL(&dc->col.col); + gry8 = GRY_8_FROM_RGB(&dc->col.col); + + if (alpha == 0xff) + _soft8_scanline_fill_solid_solid(dst_itr, w, gry8); + else if (alpha > 0) + { + alpha++; + _soft8_scanline_fill_transp_solid(dst_itr, w, gry8, alpha); + } +} + +static void +_soft8_line_vert(Soft8_Image * dst, RGBA_Draw_Context * dc, int x, int y0, + int y1) +{ + DATA8 gry8, *dst_itr; + DATA8 alpha; + int h; + + if (!_is_x_inside_clip(x, dc->clip)) + return; + + if (y1 < y0) + { + int t; + t = y0; + y0 = y1; + y1 = t; + } + + if (y0 < dc->clip.y) + y0 = dc->clip.y; + + if (y1 >= dc->clip.y + dc->clip.h) + y1 = dc->clip.y + dc->clip.h - 1; + + h = y1 - y0; + if (h < 1) + return; + + dst_itr = dst->pixels + (dst->stride * y0) + x; + alpha = A_VAL(&dc->col.col); + gry8 = GRY_8_FROM_RGB(&dc->col.col); + + if (alpha == 0xff) + { + for (; h > 0; h--, dst_itr += dst->stride) + _soft8_pt_fill_solid_solid(dst_itr, gry8); + } + else if (alpha > 0) + { + alpha++; + + for (; h > 0; h--, dst_itr += dst->stride) + _soft8_pt_fill_transp_solid(dst_itr, gry8, alpha); + } +} + +static inline void +_soft8_line_45deg_adjust_boundaries(const struct RGBA_Draw_Context_clip clip, + int *p_x0, int *p_y0, int *p_x1, int *p_y1) +{ + int diff, dy, x0, y0, x1, y1; + + x0 = *p_x0; + y0 = *p_y0; + x1 = *p_x1; + y1 = *p_y1; + + dy = y1 - y0; + + diff = clip.x - x0; + if (diff > 0) + { + x0 = clip.x; + y0 += (dy > 0) ? diff : -diff; + } + + diff = x1 - (clip.x + clip.w); + if (diff > 0) + { + x1 = clip.x + clip.w; + y1 += (dy > 0) ? -diff : diff; + } + + if (dy > 0) + { + diff = clip.y - y0; + if (diff > 0) + { + y0 = clip.y; + x0 += diff; + } + + diff = y1 - (clip.y + clip.h); + if (diff > 0) + { + y1 = clip.y + clip.h; + x1 -= diff; + } + } + else + { + diff = clip.y - y1; + if (diff > 0) + { + y1 = clip.y; + x1 -= diff; + } + + diff = y0 - (clip.y + clip.h - 1); + if (diff > 0) + { + y0 = clip.y + clip.h - 1; + x0 += diff; + } + } + + *p_x0 = x0; + *p_y0 = y0; + *p_x1 = x1; + *p_y1 = y1; +} + +static void +_soft8_line_45deg(Soft8_Image * dst, RGBA_Draw_Context * dc, int x0, int y0, + int x1, int y1) +{ + int dy, step_dst_itr, len; + DATA8 alpha; + DATA8 *dst_itr, gry8; + + alpha = A_VAL(&dc->col.col); + if (alpha < 1) + return; + + gry8 = GRY_8_FROM_RGB(&dc->col.col); + + dy = y1 - y0; + step_dst_itr = 1 + ((dy > 0) ? dst->stride : -dst->stride); + + _soft8_line_45deg_adjust_boundaries(dc->clip, &x0, &y0, &x1, &y1); + + len = (dy > 0) ? (y1 - y0) : (y0 - y1); + if (len < 1) + return; + + dst_itr = dst->pixels + dst->stride * y0 + x0; + if (alpha == 0xff) + { + for (; len > 0; len--, dst_itr += step_dst_itr) + _soft8_pt_fill_solid_solid(dst_itr, gry8); + } + else + { + alpha++; + for (; len > 0; len--, dst_itr += step_dst_itr) + _soft8_pt_fill_transp_solid(dst_itr, gry8, alpha); + } +} + +static always_inline void +_soft8_line_aliased_pt(DATA8 * dst_itr, DATA8 gry8, DATA8 alpha) +{ + if (alpha == 32) + _soft8_pt_fill_solid_solid(dst_itr, gry8); + else + _soft8_pt_fill_transp_solid(dst_itr, gry8, alpha); +} + +static void +_soft8_line_aliased(Soft8_Image * dst, RGBA_Draw_Context * dc, int x0, int y0, + int x1, int y1) +{ + int dx, dy, step_y, step_dst_itr; + DATA8 gry8; + DATA8 alpha; + + alpha = A_VAL(&dc->col.col); + if (alpha == 0) + return; + alpha++; + + gry8 = GRY_8_FROM_RGB(&dc->col.col); + + dx = x1 - x0; + dy = y1 - y0; + + if (dy >= 0) + { + step_y = 1; + step_dst_itr = dst->stride; + } + else + { + dy = -dy; + step_y = -1; + step_dst_itr = -dst->stride; + } + + if (dx > dy) + { + DATA8 *dst_itr; + int e, x, y; + + e = -(dx / 2); + y = y0; + dst_itr = dst->pixels + dst->stride * y0 + x0; + for (x = x0; x <= x1; x++, dst_itr++) + { + if (_is_xy_inside_clip(x, y, dc->clip)) + _soft8_line_aliased_pt(dst_itr, gry8, alpha); + + e += dy; + if (e >= 0) + { + dst_itr += step_dst_itr; + y += step_y; + e -= dx; + } + } + } + else + { + DATA8 *dst_itr; + int e, x, y; + + e = -(dy / 2); + x = x0; + dst_itr = dst->pixels + dst->stride * y0 + x0; + for (y = y0; y != y1; y += step_y, dst_itr += step_dst_itr) + { + if (_is_xy_inside_clip(x, y, dc->clip)) + _soft8_line_aliased_pt(dst_itr, gry8, alpha); + + e += dx; + if (e >= 0) + { + dst_itr++; + x++; + e -= dy; + } + } + } +} + +void +soft8_line_draw(Soft8_Image * dst, RGBA_Draw_Context * dc, int x0, int y0, + int x1, int y1) +{ + struct RGBA_Draw_Context_clip c_bkp, c_tmp; + int dx, dy; + int x, y, w, h; + + c_tmp.use = 1; + c_tmp.x = 0; + c_tmp.y = 0; + c_tmp.w = dst->cache_entry.w; + c_tmp.h = dst->cache_entry.h; + + /* save out clip info */ + c_bkp = dc->clip; + if (c_bkp.use) + { + RECTS_CLIP_TO_RECT(c_tmp.x, c_tmp.y, c_tmp.w, c_tmp.h, + c_bkp.x, c_bkp.y, c_bkp.w, c_bkp.h); + if (_is_empty_clip(c_tmp)) + return; + } + + x = MIN(x0, x1); + y = MIN(y0, y1); + w = MAX(x0, x1) - x + 1; + h = MAX(y0, y1) - y + 1; + + RECTS_CLIP_TO_RECT(c_tmp.x, c_tmp.y, c_tmp.w, c_tmp.h, x, y, w, h); + if (_is_empty_clip(c_tmp)) + return; + + /* Check if the line doesn't cross the clip area */ + if (x0 < c_tmp.x && x1 < c_tmp.x) + return; + if (x0 >= c_tmp.x + c_tmp.w && x1 >= c_tmp.x + c_tmp.w) + return; + if (y0 < c_tmp.y && y1 < c_tmp.y) + return; + if (y0 >= c_tmp.y + c_tmp.h && y1 >= c_tmp.y + c_tmp.h) + return; + + dc->clip = c_tmp; + dx = x1 - x0; + dy = y1 - y0; + + if (dx < 0) + { + int t; + + t = x0; + x0 = x1; + x1 = t; + + t = y0; + y0 = y1; + y1 = t; + } + + if (dx == 0 && dy == 0) + _soft8_line_point(dst, dc, x0, y0); + else if (dx == 0) + _soft8_line_vert(dst, dc, x0, y0, y1); + else if (dy == 0) + _soft8_line_horiz(dst, dc, x0, x1, y0); + else if (dy == dx || dy == -dx) + _soft8_line_45deg(dst, dc, x0, y0, x1, y1); + else + _soft8_line_aliased(dst, dc, x0, y0, x1, y1); + + /* restore clip info */ + dc->clip = c_bkp; +} diff --git a/legacy/evas/src/lib/engines/common_8/evas_soft8_main.c b/legacy/evas/src/lib/engines/common_8/evas_soft8_main.c new file mode 100644 index 0000000000..4072a20d5b --- /dev/null +++ b/legacy/evas/src/lib/engines/common_8/evas_soft8_main.c @@ -0,0 +1,659 @@ +#include "evas_common_soft8.h" + +static Evas_Cache_Image *eci = NULL; +static int reference = 0; + +static Image_Entry *_evas_common_soft8_image_new(void); +static void _evas_common_soft8_image_delete(Image_Entry * ie); + +static int _evas_common_soft8_image_surface_alloc(Image_Entry * ie, int w, + int h); +static void _evas_common_soft8_image_surface_delete(Image_Entry * ie); +static DATA32 *_evas_common_soft8_image_surface_pixels(Image_Entry * ie); + +static int _evas_common_load_soft8_image_from_file(Image_Entry * ie); +static void _evas_common_soft8_image_unload(Image_Entry * ie); + +static void _evas_common_soft8_image_dirty_region(Image_Entry * im, int x, + int y, int w, int h); +static int _evas_common_soft8_image_dirty(Image_Entry * ie_dst, + const Image_Entry * ie_src); + +static int _evas_common_soft8_image_ram_usage(Image_Entry * ie); + +static int _evas_common_soft8_image_size_set(Image_Entry * ie_dst, + const Image_Entry * ie_im, int w, + int h); +static int _evas_common_soft8_image_from_copied_data(Image_Entry * ie_dst, + int w, int h, + DATA32 * image_data, + int alpha, int cspace); +static int _evas_common_soft8_image_from_data(Image_Entry * ie_dst, int w, + int h, DATA32 * image_data, + int alpha, int cspace); +static int _evas_common_soft8_image_colorspace_set(Image_Entry * ie_dst, + int cspace); + +static int _evas_common_load_soft8_image_data_from_file(Image_Entry * ie); + +/* +static void +_evas_common_soft8_image_debug(const char* context, Image_Entry *eim) +{ + DBG("[8] %p = [%s] {%s,%s} %i [%i|%i]\n", eim, context, eim->file, eim->key, eim->references, eim->w, eim->h); +} +*/ + +static const Evas_Cache_Image_Func _evas_common_soft8_image_func = { + _evas_common_soft8_image_new, + _evas_common_soft8_image_delete, + _evas_common_soft8_image_surface_alloc, + _evas_common_soft8_image_surface_delete, + _evas_common_soft8_image_surface_pixels, + _evas_common_load_soft8_image_from_file, + _evas_common_soft8_image_unload, + _evas_common_soft8_image_dirty_region, + _evas_common_soft8_image_dirty, + _evas_common_soft8_image_size_set, + _evas_common_soft8_image_from_copied_data, + _evas_common_soft8_image_from_data, + _evas_common_soft8_image_colorspace_set, + _evas_common_load_soft8_image_data_from_file, + _evas_common_soft8_image_ram_usage, +/* _evas_common_soft8_image_debug */ + NULL +}; + +EAPI void +evas_common_soft8_image_init(void) +{ + if (!eci) + eci = evas_cache_image_init(&_evas_common_soft8_image_func); + reference++; +} + +EAPI void +evas_common_soft8_image_shutdown(void) +{ + if (--reference == 0) + { +// DISABLE for now - something wrong with cache shutdown freeing things +// still in use - rage_thumb segv's now. +// +// actually - i think i see it. cache ref goes to 0 (and thus gets freed) +// because in eng_setup() when a buffer changes size it is FIRST freed +// THEN allocated again - thus brignhjing ref to 0 then back to 1 immediately +// where it should stay at 1. - see evas_engine.c in the buffer enigne for +// example. eng_output_free() is called BEFORE _output_setup(). although this +// is only a SIGNE of the problem. we can patch this up with either freeing +// after the setup (so we just pt a ref of 2 then back to 1), or just +// evas_common_image_init() at the start and evas_common_image_shutdown() +// after it all. really ref 0 should only be reached when no more canvases +// with no more objects exist anywhere. + +// ENABLE IT AGAIN, hope it is fixed. Gustavo @ January 22nd, 2009. + //evas_cache_image_shutdown(eci); + //eci = NULL; + } +} + +EAPI Evas_Cache_Image * +evas_common_soft8_image_cache_get(void) +{ + return eci; +} + +static Image_Entry * +_evas_common_soft8_image_new(void) +{ + Soft8_Image *im; + + im = calloc(1, sizeof(Soft8_Image)); + if (!im) + return NULL; + + im->stride = -1; + + return (Image_Entry *) im; +} + +static void +_evas_common_soft8_image_delete(Image_Entry * ie) +{ + memset(ie, 0xFF, sizeof(Soft8_Image)); + free(ie); +} + +static int +_evas_common_soft8_image_surface_alloc(Image_Entry * ie, int w, int h) +{ + Soft8_Image *im = (Soft8_Image *) ie; + + if (im->stride < 0) + im->stride = _calc_stride(w); + + im->pixels = + realloc(im->pixels, IMG_BYTE_SIZE(im->stride, h, ie->flags.alpha)); + if (!im->pixels) + return -1; + + if (ie->flags.alpha) + { + im->alpha = (DATA8 *) (im->pixels + (im->stride * h)); + im->flags.free_alpha = 0; + } + im->flags.free_pixels = 1; + + return 0; +} + +static void +_evas_common_soft8_image_surface_delete(Image_Entry * ie) +{ + Soft8_Image *im = (Soft8_Image *) ie; + + if (im->flags.free_pixels) + free(im->pixels); + im->pixels = NULL; + im->flags.free_pixels = 0; + + if (im->flags.free_alpha) + free(im->alpha); + im->alpha = NULL; + im->flags.free_alpha = 0; +} + +static DATA32 * +_evas_common_soft8_image_surface_pixels(Image_Entry * ie __UNUSED__) +{ + abort(); + + return NULL; +} + +static int +_evas_common_load_soft8_image_from_file(Image_Entry * ie) +{ + Soft8_Image *sim = (Soft8_Image *) ie; + RGBA_Image *im; + int error = 0; + + im = (RGBA_Image *) evas_cache_image_request(evas_common_image_cache_get(), + sim->cache_entry.file, + sim->cache_entry.key, + &sim->cache_entry.load_opts, + &error); + sim->source = im; + if (!sim->source) + return -1; + + sim->cache_entry.w = sim->source->cache_entry.w; + sim->cache_entry.h = sim->source->cache_entry.h; + ie->flags.alpha = im->cache_entry.flags.alpha; + if (sim->stride < 0) + sim->stride = _calc_stride(sim->cache_entry.w); + + return 0; +} + +static void +_evas_common_soft8_image_unload(Image_Entry * ie __UNUSED__) +{ +} + +static void +_evas_common_soft8_image_dirty_region(Image_Entry * im __UNUSED__, + int x __UNUSED__, int y __UNUSED__, + int w __UNUSED__, int h __UNUSED__) +{ +} + +static int +_evas_common_soft8_image_dirty(Image_Entry * ie_dst, const Image_Entry * ie_src) +{ + Soft8_Image *dst = (Soft8_Image *) ie_dst; + Soft8_Image *src = (Soft8_Image *) ie_src; + + evas_cache_image_load_data(&src->cache_entry); + evas_cache_image_surface_alloc(&dst->cache_entry, + src->cache_entry.w, src->cache_entry.h); + +/* evas_common_blit_rectangle(src, dst, 0, 0, src->cache_entry.w, src->cache_entry.h, 0, 0); */ + + return 0; +} + +static int +_evas_common_soft8_image_ram_usage(Image_Entry * ie) +{ + Soft8_Image *im = (Soft8_Image *) ie; + + if (im->pixels && im->flags.free_pixels) + return IMG_BYTE_SIZE(im->stride, im->cache_entry.h, ie->flags.alpha); + return 0; +} + +static int +_evas_common_soft8_image_size_set(Image_Entry * ie_dst, + const Image_Entry * ie_im, int w __UNUSED__, + int h __UNUSED__) +{ + Soft8_Image *dst = (Soft8_Image *) ie_dst; + Soft8_Image *im = (Soft8_Image *) ie_im; + + dst->flags = im->flags; + + return 0; +} + +static int +_evas_common_soft8_image_from_data(Image_Entry * ie_dst, int w, int h, + DATA32 * image_data, int alpha, + int cspace __UNUSED__) +{ + Soft8_Image *im = (Soft8_Image *) ie_dst; + + /* FIXME: handle colorspace */ + ie_dst->w = w; + ie_dst->h = h; + ie_dst->flags.alpha = alpha; + + im->flags.free_pixels = 0; + im->flags.free_alpha = 0; + if (im->stride < 0) + im->stride = _calc_stride(w); + + /* FIXME: That's bad, the application must be aware of the engine internal. */ + im->pixels = (DATA8 *) image_data; + if (ie_dst->flags.alpha) + im->alpha = (DATA8 *) (im->pixels + (im->stride * h)); + + return 0; +} + +static int +_evas_common_soft8_image_from_copied_data(Image_Entry * ie_dst, + int w __UNUSED__, int h, + DATA32 * image_data, + int alpha __UNUSED__, + int cspace __UNUSED__) +{ + Soft8_Image *im = (Soft8_Image *) ie_dst; + + /* FIXME: handle colorspace */ + if (image_data) + memcpy(im->pixels, image_data, + IMG_BYTE_SIZE(im->stride, h, ie_dst->flags.alpha)); + else + memset(im->pixels, 0, IMG_BYTE_SIZE(im->stride, h, ie_dst->flags.alpha)); + + return 0; +} + +static int +_evas_common_soft8_image_colorspace_set(Image_Entry * ie_dst, + int cspace __UNUSED__) +{ + /* FIXME: handle colorspace */ + return 0; +} + +static int +_evas_common_load_soft8_image_data_from_file(Image_Entry * ie) +{ + Soft8_Image *im = (Soft8_Image *) ie; + + if (im->pixels) + return 0; + if (!im->source) + return -1; + + evas_cache_image_load_data(&im->source->cache_entry); + if (im->source->image.data) + { + DATA32 *sp; + + evas_cache_image_surface_alloc(&im->cache_entry, + im->source->cache_entry.w, + im->source->cache_entry.h); + + sp = im->source->image.data; + if (im->alpha) + soft8_image_convert_from_rgba(im, sp); + else + soft8_image_convert_from_rgb(im, sp); + } + evas_cache_image_drop(&im->source->cache_entry); + im->source = NULL; + + return 0; +} + +/* Soft16_Image * */ +/* soft16_image_new(int w, int h, int stride, int have_alpha, DATA16 *pixels, */ +/* int copy) */ +/* { */ +/* Soft16_Image *im; */ + +/* if (stride < 0) stride = _calc_stride(w); */ + +/* im = soft16_image_alloc(w, h, stride, have_alpha, copy); */ +/* if (!im) return NULL; */ + +/* if (pixels) */ +/* { */ +/* if (copy) */ +/* memcpy(im->pixels, pixels, IMG_BYTE_SIZE(stride, h, have_alpha)); */ +/* else */ +/* { */ +/* im->pixels = pixels; */ +/* if (have_alpha) im->alpha = (DATA8 *)(im->pixels + (stride * h)); */ +/* } */ +/* } */ +/* return im; */ +/* } */ + +static inline void +_get_clip(const RGBA_Draw_Context * dc, const Soft8_Image * im, + Eina_Rectangle * clip) +{ + if (dc->clip.use) + { + EINA_RECTANGLE_SET(clip, dc->clip.x, dc->clip.y, dc->clip.w, + dc->clip.h); + if (clip->x < 0) + { + clip->w += clip->x; + clip->x = 0; + } + if (clip->y < 0) + { + clip->h += clip->y; + clip->y = 0; + } + if ((clip->x + clip->w) > im->cache_entry.w) + clip->w = im->cache_entry.w - clip->x; + if ((clip->y + clip->h) > im->cache_entry.h) + clip->h = im->cache_entry.h - clip->y; + } + else + { + EINA_RECTANGLE_SET(clip, 0, 0, im->cache_entry.w, im->cache_entry.h); + } +} + +static inline int +_is_empty_rectangle(const Eina_Rectangle * r) +{ + return (r->w < 1) || (r->h < 1); +} + +static inline void +_shrink(int *s_pos, int *s_size, int pos, int size) +{ + int d; + + d = (*s_pos) - pos; + if (d < 0) + { + (*s_size) += d; + (*s_pos) = pos; + } + + d = size + pos - (*s_pos); + if ((*s_size) > d) + (*s_size) = d; +} + +static int +_soft8_adjust_areas(Eina_Rectangle * src, + int src_max_x, int src_max_y, + Eina_Rectangle * dst, + int dst_max_x, int dst_max_y, Eina_Rectangle * dst_clip) +{ + if (_is_empty_rectangle(src) || + _is_empty_rectangle(dst) || _is_empty_rectangle(dst_clip)) + return 0; + + /* shrink clip */ + _shrink(&dst_clip->x, &dst_clip->w, dst->x, dst->w); + _shrink(&dst_clip->y, &dst_clip->h, dst->y, dst->h); + if (_is_empty_rectangle(dst_clip)) + return 0; + + /* sanitise x */ + if (src->x < 0) + { + dst->x -= (src->x * dst->w) / src->w; + dst->w += (src->x * dst->w) / src->w; + src->w += src->x; + src->x = 0; + } + if (src->x >= src_max_x) + return 0; + if ((src->x + src->w) > src_max_x) + { + dst->w = (dst->w * (src_max_x - src->x)) / (src->w); + src->w = src_max_x - src->x; + } + if (dst->w <= 0) + return 0; + if (src->w <= 0) + return 0; + if (dst_clip->x < 0) + { + dst_clip->w += dst_clip->x; + dst_clip->x = 0; + } + if (dst_clip->w <= 0) + return 0; + if (dst_clip->x >= dst_max_x) + return 0; + + _shrink(&dst_clip->x, &dst_clip->w, 0, dst_max_x); + if (dst_clip->w <= 0) + return 0; + + /* sanitise y */ + if (src->y < 0) + { + dst->y -= (src->y * dst->h) / src->h; + dst->h += (src->y * dst->h) / src->h; + src->h += src->y; + src->y = 0; + } + if (src->y >= src_max_y) + return 0; + if ((src->y + src->h) > src_max_y) + { + dst->h = (dst->h * (src_max_y - src->y)) / (src->h); + src->h = src_max_y - src->y; + } + if (dst->h <= 0) + return 0; + if (src->h <= 0) + return 0; + if (dst_clip->y < 0) + { + dst_clip->h += dst_clip->y; + dst_clip->y = 0; + } + if (dst_clip->h <= 0) + return 0; + if (dst_clip->y >= dst_max_y) + return 0; + + _shrink(&dst_clip->y, &dst_clip->h, 0, dst_max_y); + if (dst_clip->h <= 0) + return 0; + + return 1; +} + +static void +_soft8_image_draw_sampled_int(Soft8_Image * src, Soft8_Image * dst, + RGBA_Draw_Context * dc, + Eina_Rectangle sr, Eina_Rectangle dr) +{ + Eina_Rectangle cr; + + if (! + (RECTS_INTERSECT + (dr.x, dr.y, dr.w, dr.h, 0, 0, dst->cache_entry.w, dst->cache_entry.h))) + return; + if (! + (RECTS_INTERSECT + (sr.x, sr.y, sr.w, sr.h, 0, 0, src->cache_entry.w, src->cache_entry.h))) + return; + + _get_clip(dc, dst, &cr); + if (!_soft8_adjust_areas + (&sr, src->cache_entry.w, src->cache_entry.h, &dr, dst->cache_entry.w, + dst->cache_entry.h, &cr)) + return; + + if ((dr.w == sr.w) && (dr.h == sr.h)) + soft8_image_draw_unscaled(src, dst, dc, sr, dr, cr); + else + soft8_image_draw_scaled_sampled(src, dst, dc, sr, dr, cr); +} + +EAPI void +soft8_image_draw(Soft8_Image * src, Soft8_Image * dst, + RGBA_Draw_Context * dc, + int src_region_x, int src_region_y, + int src_region_w, int src_region_h, + int dst_region_x, int dst_region_y, + int dst_region_w, int dst_region_h, int smooth) +{ + Eina_Rectangle sr, dr; + Cutout_Rects *rects; + Cutout_Rect *r; + struct RGBA_Draw_Context_clip clip_bkp; + int i; + + /* handle cutouts here! */ + EINA_RECTANGLE_SET(&dr, dst_region_x, dst_region_y, dst_region_w, + dst_region_h); + + if (_is_empty_rectangle(&dr)) + return; + if (! + (RECTS_INTERSECT + (dr.x, dr.y, dr.w, dr.h, 0, 0, dst->cache_entry.w, dst->cache_entry.h))) + return; + + EINA_RECTANGLE_SET(&sr, src_region_x, src_region_y, src_region_w, + src_region_h); + + if (_is_empty_rectangle(&sr)) + return; + if (! + (RECTS_INTERSECT + (sr.x, sr.y, sr.w, sr.h, 0, 0, src->cache_entry.w, src->cache_entry.h))) + return; + + /* no cutouts - cut right to the chase */ + if (!dc->cutout.rects) + { + _soft8_image_draw_sampled_int(src, dst, dc, sr, dr); + return; + } + + /* save out clip info */ + clip_bkp = dc->clip; + evas_common_draw_context_clip_clip(dc, 0, 0, dst->cache_entry.w, + dst->cache_entry.h); + evas_common_draw_context_clip_clip(dc, dst_region_x, dst_region_y, + dst_region_w, dst_region_h); + /* our clip is 0 size.. abort */ + if ((dc->clip.w <= 0) || (dc->clip.h <= 0)) + { + dc->clip = clip_bkp; + return; + } + rects = evas_common_draw_context_apply_cutouts(dc); + for (i = 0; i < rects->active; i++) + { + r = rects->rects + i; + evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h); + _soft8_image_draw_sampled_int(src, dst, dc, sr, dr); + } + evas_common_draw_context_apply_clear_cutouts(rects); + dc->clip = clip_bkp; +} + +EAPI Soft8_Image * +soft8_image_alpha_set(Soft8_Image * im, int have_alpha) +{ + Soft8_Image *new_im; + + if (im->cache_entry.flags.alpha == have_alpha) + return im; + + new_im = (Soft8_Image *) evas_cache_image_alone(&im->cache_entry); + + new_im->cache_entry.flags.alpha = have_alpha; + + if (im->cache_entry.w > 0 && im->cache_entry.h) + new_im = + (Soft8_Image *) evas_cache_image_size_set(&new_im->cache_entry, + im->cache_entry.w, + im->cache_entry.h); + + return new_im; +} + +/* Soft16_Image * */ +/* soft16_image_size_set(Soft16_Image *old_im, int w, int h) */ +/* { */ +/* Soft16_Image *new_im; */ +/* DATA16 *dp, *sp; */ +/* int i, cw, ch, ew; */ + +/* if ((old_im->cache_entry.w == w) && (old_im->cache_entry.h == h)) return old_im; */ + +/* new_im = soft16_image_new(w, h, -1, old_im->flags.have_alpha, NULL, 1); */ + +/* if (old_im->cache_entry.w < new_im->cache_entry.w) */ +/* cw = old_im->cache_entry.w; */ +/* else */ +/* cw = new_im->cache_entry.w; */ + +/* ew = new_im->cache_entry.w - cw; */ + +/* if (old_im->cache_entry.h < new_im->cache_entry.h) */ +/* ch = old_im->cache_entry.h; */ +/* else */ +/* ch = new_im->cache_entry.h; */ + +/* dp = new_im->pixels; */ +/* sp = old_im->pixels; */ +/* for (i = 0; i < ch; i++) */ +/* { */ +/* memcpy(dp, sp, cw * sizeof(DATA16)); */ +/* if (ew > 0) memset(dp, 0, ew * sizeof(DATA16)); */ + +/* dp += new_im->stride; */ +/* sp += old_im->stride; */ +/* } */ + +/* if (old_im->flags.have_alpha) */ +/* { */ +/* DATA8 *dp, *sp; */ + +/* dp = new_im->alpha; */ +/* sp = old_im->alpha; */ +/* for (i = 0; i < ch; i++) */ +/* { */ +/* memcpy(dp, sp, cw * sizeof(DATA8)); */ +/* if (ew > 0) memset(dp, 0, ew * sizeof(DATA8)); */ + +/* dp += new_im->stride; */ +/* sp += old_im->stride; */ +/* } */ +/* } */ + +/* evas_cache_image_drop(&old_im->cache_entry); */ +/* return new_im; */ +/* } */ diff --git a/legacy/evas/src/lib/engines/common_8/evas_soft8_polygon.c b/legacy/evas/src/lib/engines/common_8/evas_soft8_polygon.c new file mode 100644 index 0000000000..e4d7766d10 --- /dev/null +++ b/legacy/evas/src/lib/engines/common_8/evas_soft8_polygon.c @@ -0,0 +1,230 @@ +#include +#include "evas_soft8_scanline_fill.c" +#include + +typedef struct _RGBA_Edge RGBA_Edge; +typedef struct _RGBA_Vertex RGBA_Vertex; + +struct _RGBA_Edge { + float x, dx; + int i; +}; + +struct _RGBA_Vertex { + float x, y; + int i; +}; + +#define POLY_EDGE_DEL(_i) \ +{ \ + int _j; \ + \ + for (_j = 0; (_j < num_active_edges) && (edges[_j].i != _i); _j++); \ + if (_j < num_active_edges) \ + { \ + num_active_edges--; \ + memmove(&(edges[_j]), &(edges[_j + 1]), \ + (num_active_edges - _j) * sizeof(RGBA_Edge)); \ + } \ +} + +#define POLY_EDGE_ADD(_i, _y) \ +{ \ + int _j; \ + float _dx; \ + RGBA_Vertex *_p, *_q; \ + if (_i < (n - 1)) _j = _i + 1; \ + else _j = 0; \ + if (point[_i].y < point[_j].y) \ + { \ + _p = &(point[_i]); \ + _q = &(point[_j]); \ + } \ + else \ + { \ + _p = &(point[_j]); \ + _q = &(point[_i]); \ + } \ + edges[num_active_edges].dx = _dx = (_q->x - _p->x) / (_q->y - _p->y); \ + edges[num_active_edges].x = (_dx * ((float)_y + 0.5 - _p->y)) + _p->x; \ + edges[num_active_edges].i = _i; \ + num_active_edges++; \ +} + +static int +polygon_point_sorter(const void *a, const void *b) +{ + RGBA_Vertex *p, *q; + + p = (RGBA_Vertex *) a; + q = (RGBA_Vertex *) b; + if (p->y <= q->y) + return -1; + return 1; +} + +static int +polygon_edge_sorter(const void *a, const void *b) +{ + RGBA_Edge *p, *q; + + p = (RGBA_Edge *) a; + q = (RGBA_Edge *) b; + if (p->x <= q->x) + return -1; + return 1; +} + +void +soft8_polygon_draw(Soft8_Image * dst, RGBA_Draw_Context * dc, + RGBA_Polygon_Point * points, int x, int y) +{ + RGBA_Polygon_Point *pt; + RGBA_Vertex *point; + RGBA_Edge *edges; + int num_active_edges; + int n; + int i, j, k; + int y0, y1, yi; + int ext_x, ext_y, ext_w, ext_h; + int *sorted_index; + DATA8 alpha; + DATA8 gry8; + + alpha = A_VAL(&dc->col.col); + if (alpha == 0) + return; + alpha++; + + gry8 = GRY_8_FROM_RGB(&dc->col.col); + + ext_x = 0; + ext_y = 0; + ext_w = dst->cache_entry.w; + ext_h = dst->cache_entry.h; + if (dc->clip.use) + RECTS_CLIP_TO_RECT(ext_x, ext_y, ext_w, ext_h, + dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h); + + if ((ext_w <= 0) || (ext_h <= 0)) + return; + + n = 0; + EINA_INLIST_FOREACH(points, pt) n++; + + if (n < 3) + return; + + edges = malloc(sizeof(RGBA_Edge) * n); + if (!edges) + return; + + point = malloc(sizeof(RGBA_Vertex) * n); + if (!point) + { + free(edges); + return; + } + + sorted_index = malloc(sizeof(int) * n); + if (!sorted_index) + { + free(edges); + free(point); + return; + } + + k = 0; + EINA_INLIST_FOREACH(points, pt) + { + point[k].x = pt->x + x; + point[k].y = pt->y + y; + point[k].i = k; + k++; + } + qsort(point, n, sizeof(RGBA_Vertex), polygon_point_sorter); + + for (k = 0; k < n; k++) + sorted_index[k] = point[k].i; + + k = 0; + EINA_INLIST_FOREACH(points, pt) + { + point[k].x = pt->x + x; + point[k].y = pt->y + y; + point[k].i = k; + k++; + } + + y0 = MAX(ext_y, ceil(point[sorted_index[0]].y - 0.5)); + y1 = MIN(ext_y + ext_h - 1, floor(point[sorted_index[n - 1]].y - 0.5)); + + k = 0; + num_active_edges = 0; + + for (yi = y0; yi <= y1; yi++) + { + for (; (k < n) && (point[sorted_index[k]].y <= ((float)yi + 0.5)); k++) + { + i = sorted_index[k]; + + if (i > 0) + j = i - 1; + else + j = n - 1; + if (point[j].y <= ((float)yi - 0.5)) + { + POLY_EDGE_DEL(j)} + else if (point[j].y > ((float)yi + 0.5)) + { + POLY_EDGE_ADD(j, yi)} + if (i < (n - 1)) + j = i + 1; + else + j = 0; + if (point[j].y <= ((float)yi - 0.5)) + { + POLY_EDGE_DEL(i)} + else if (point[j].y > ((float)yi + 0.5)) + { + POLY_EDGE_ADD(i, yi)} + } + + qsort(edges, num_active_edges, sizeof(RGBA_Edge), polygon_edge_sorter); + + for (j = 0; j < num_active_edges; j += 2) + { + int x0, x1; + + x0 = ceil(edges[j].x - 0.5); + if (j < (num_active_edges - 1)) + x1 = floor(edges[j + 1].x - 0.5); + else + x1 = x0; + if ((x1 >= ext_x) && (x0 < (ext_x + ext_w)) && (x0 <= x1)) + { + DATA8 *dst_itr; + int w; + + if (x0 < ext_x) + x0 = ext_x; + if (x1 >= (ext_x + ext_w)) + x1 = ext_x + ext_w - 1; + + w = (x1 - x0) + 1; + dst_itr = dst->pixels + (yi * dst->stride) + x0; + + if (alpha == 0xff) + _soft8_scanline_fill_solid_solid(dst_itr, w, gry8); + else + _soft8_scanline_fill_transp_solid(dst_itr, w, gry8, alpha); + } + edges[j].x += edges[j].dx; + edges[j + 1].x += edges[j + 1].dx; + } + } + + free(edges); + free(point); + free(sorted_index); +} diff --git a/legacy/evas/src/lib/engines/common_8/evas_soft8_rectangle.c b/legacy/evas/src/lib/engines/common_8/evas_soft8_rectangle.c new file mode 100644 index 0000000000..20c48e2518 --- /dev/null +++ b/legacy/evas/src/lib/engines/common_8/evas_soft8_rectangle.c @@ -0,0 +1,125 @@ +#include "evas_common_soft8.h" +#include "evas_soft8_scanline_fill.c" + +static inline int +_is_empty_rectangle(const Eina_Rectangle * r) +{ + return (r->w < 1) || (r->h < 1); +} + +static inline void +_soft8_rectangle_draw_solid_solid(Soft8_Image * dst, int offset, int w, int h, + DATA8 gry8) +{ + DATA8 *dst_itr; + int i; + + dst_itr = dst->pixels + offset; + + for (i = 0; i < h; i++, dst_itr += dst->stride) + _soft8_scanline_fill_solid_solid(dst_itr, w, gry8); +} + +static inline void +_soft8_rectangle_draw_transp_solid(Soft8_Image * dst, int offset, int w, int h, + DATA8 gry8, DATA8 alpha) +{ + DATA8 *dst_itr; + int i; + + dst_itr = dst->pixels + offset; + alpha++; + + for (i = 0; i < h; i++, dst_itr += dst->stride) + _soft8_scanline_fill_transp_solid(dst_itr, w, gry8, alpha); +} + +static void +_soft8_rectangle_draw_int(Soft8_Image * dst, RGBA_Draw_Context * dc, + Eina_Rectangle dr) +{ + int dst_offset; + + if (_is_empty_rectangle(&dr)) + return; + RECTS_CLIP_TO_RECT(dr.x, dr.y, dr.w, dr.h, 0, 0, dst->cache_entry.w, + dst->cache_entry.h); + if (_is_empty_rectangle(&dr)) + return; + + if (dc->clip.use) + RECTS_CLIP_TO_RECT(dr.x, dr.y, dr.w, dr.h, dc->clip.x, + dc->clip.y, dc->clip.w, dc->clip.h); + if (_is_empty_rectangle(&dr)) + return; + if (A_VAL(&dc->col.col) == 0) + return; + + dst_offset = dr.x + (dr.y * dst->stride); + + if (!dst->cache_entry.flags.alpha) + { + DATA8 gry8; + DATA8 alpha; + + alpha = A_VAL(&dc->col.col); + gry8 = GRY_8_FROM_RGB(&dc->col.col); + + if (alpha == 0xff) + _soft8_rectangle_draw_solid_solid(dst, dst_offset, dr.w, dr.h, gry8); + else if (alpha > 0) + _soft8_rectangle_draw_transp_solid + (dst, dst_offset, dr.w, dr.h, gry8, alpha); + } + else + ERR("Unsupported feature: drawing rectangle to non-opaque destination."); +} + +void +soft8_rectangle_draw(Soft8_Image * dst, RGBA_Draw_Context * dc, + int x, int y, int w, int h) +{ + Eina_Rectangle dr; + Cutout_Rects *rects; + Cutout_Rect *r; + struct RGBA_Draw_Context_clip c_bkp; + int i; + + /* handle cutouts here! */ + EINA_RECTANGLE_SET(&dr, x, y, w, h); + + if (_is_empty_rectangle(&dr)) + return; + if (! + (RECTS_INTERSECT + (dr.x, dr.y, dr.w, dr.h, 0, 0, dst->cache_entry.w, dst->cache_entry.h))) + return; + + /* no cutouts - cut right to the chase */ + if (!dc->cutout.rects) + { + _soft8_rectangle_draw_int(dst, dc, dr); + return; + } + + c_bkp = dc->clip; + + evas_common_draw_context_clip_clip(dc, 0, 0, dst->cache_entry.w, + dst->cache_entry.h); + evas_common_draw_context_clip_clip(dc, x, y, w, h); + /* our clip is 0 size.. abort */ + if ((dc->clip.w <= 0) || (dc->clip.h <= 0)) + { + dc->clip = c_bkp; + return; + } + rects = evas_common_draw_context_apply_cutouts(dc); + for (i = 0; i < rects->active; ++i) + { + r = rects->rects + i; + evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h); + _soft8_rectangle_draw_int(dst, dc, dr); + } + evas_common_draw_context_apply_clear_cutouts(rects); + dc->clip = c_bkp; +} diff --git a/legacy/evas/src/lib/engines/common_8/evas_soft8_scanline_blend.c b/legacy/evas/src/lib/engines/common_8/evas_soft8_scanline_blend.c new file mode 100644 index 0000000000..ee4427a6e8 --- /dev/null +++ b/legacy/evas/src/lib/engines/common_8/evas_soft8_scanline_blend.c @@ -0,0 +1,447 @@ +/** NOTE: This file is meant to be included by users **/ + +/** NOTE2: r, g, b parameters are 16bits, so you can pass 0 to 256 inclusive. + ** this is due our division by 256 when multiplying the color. + **/ + +/***************************************************************************** + * Scanline processing + * + * _soft8_scanline___[_]() + * + ****************************************************************************/ + +static always_inline void +_soft8_pt_blend_transp_solid(DATA8 * p_dst, DATA8 src, DATA8 alpha) +{ + if (alpha == 0xff) + *p_dst = src; + else if (alpha != 0) + { + *p_dst = GRY_8_BLEND(src, *p_dst, alpha); + } +} + +/*********************************************************************** + * Regular blend operations + */ +static void +_soft8_scanline_blend_transp_solid(DATA8 * src, DATA8 * alpha, DATA8 * dst, + int size) +{ + DATA8 *start, *end; + + start = dst; + end = start + (size & ~7); + + pld(alpha, 0); + pld(src, 0); + + /* work on 8 pixels per time, do data preload */ + while (start < end) + { + DATA8 alpha1, alpha2; + + alpha1 = alpha[0]; + alpha += 8; + + /* empirical tests show these give the best performance */ + pld(alpha, 8); + pld(src, 32); + + src += 8; + start += 8; + + alpha2 = alpha[-7]; + _soft8_pt_blend_transp_solid(start - 8, src[-8], alpha1); + + alpha1 = alpha[-6]; + _soft8_pt_blend_transp_solid(start - 7, src[-7], alpha2); + + alpha2 = alpha[-5]; + _soft8_pt_blend_transp_solid(start - 6, src[-6], alpha1); + + alpha1 = alpha[-4]; + _soft8_pt_blend_transp_solid(start - 5, src[-5], alpha2); + + alpha2 = alpha[-3]; + _soft8_pt_blend_transp_solid(start - 4, src[-4], alpha1); + + alpha1 = alpha[-2]; + _soft8_pt_blend_transp_solid(start - 3, src[-3], alpha2); + + alpha2 = alpha[-1]; + _soft8_pt_blend_transp_solid(start - 2, src[-2], alpha1); + + _soft8_pt_blend_transp_solid(start - 1, src[-1], alpha2); + } + + /* remaining pixels (up to 7) */ + end = start + (size & 7); + for (; start < end; start++, src++, alpha++) + _soft8_pt_blend_transp_solid(start, *src, *alpha); +} + +static always_inline void +_soft8_pt_blend_solid_solid(DATA8 * p_dst, DATA8 src) +{ + *p_dst = src; +} + +static inline void +_soft8_scanline_blend_solid_solid(DATA8 * src, DATA8 * dst, int size) +{ + memcpy(dst, src, size * sizeof(DATA8)); +} + +/*********************************************************************** + * Blend operations taking an extra alpha (fade in, out) + */ + +static inline void +_soft8_pt_blend_transp_solid_mul_alpha(DATA8 * p_dst, DATA8 src, DATA8 alpha, + DATA8 rel_alpha) +{ + alpha = alpha * rel_alpha; + if (alpha == 0) + return; + + alpha++; + *p_dst = GRY_8_BLEND((src * rel_alpha) & 0xff, *p_dst, alpha); +} + +static void +_soft8_scanline_blend_transp_solid_mul_alpha(DATA8 * src, DATA8 * alpha, + DATA8 * dst, int size, + const DATA8 rel_alpha) +{ + DATA8 *start, *end; + + start = dst; + end = start + (size & ~7); + + pld(alpha, 0); + pld(src, 0); + + while (start < end) + { + DATA8 alpha1, alpha2; + + alpha1 = alpha[0]; + alpha += 8; + + pld(alpha, 8); + pld(src, 32); + + src += 8; + start += 8; + + alpha2 = alpha[-7]; + _soft8_pt_blend_transp_solid_mul_alpha + (start - 8, src[-8], alpha1, rel_alpha); + + alpha1 = alpha[-6]; + _soft8_pt_blend_transp_solid_mul_alpha + (start - 7, src[-7], alpha2, rel_alpha); + + alpha2 = alpha[-5]; + _soft8_pt_blend_transp_solid_mul_alpha + (start - 6, src[-6], alpha1, rel_alpha); + + alpha1 = alpha[-4]; + _soft8_pt_blend_transp_solid_mul_alpha + (start - 5, src[-5], alpha2, rel_alpha); + + alpha2 = alpha[-3]; + _soft8_pt_blend_transp_solid_mul_alpha + (start - 4, src[-4], alpha1, rel_alpha); + + alpha1 = alpha[-2]; + _soft8_pt_blend_transp_solid_mul_alpha + (start - 3, src[-3], alpha2, rel_alpha); + + alpha2 = alpha[-1]; + _soft8_pt_blend_transp_solid_mul_alpha + (start - 2, src[-2], alpha1, rel_alpha); + + _soft8_pt_blend_transp_solid_mul_alpha + (start - 1, src[-1], alpha2, rel_alpha); + } + + end = start + (size & 7); + for (; start < end; start++, src++, alpha++) + _soft8_pt_blend_transp_solid_mul_alpha(start, *src, *alpha, rel_alpha); +} + +static always_inline void +_soft8_pt_blend_solid_solid_mul_alpha(DATA8 * p_dst, DATA8 src, DATA8 rel_alpha) +{ + *p_dst = GRY_8_BLEND_UNMUL(src, *p_dst, rel_alpha); +} + +static void +_soft8_scanline_blend_solid_solid_mul_alpha(DATA8 * src, DATA8 * dst, int size, + DATA8 rel_alpha) +{ + DATA8 *start, *end; + + start = dst; + end = start + (size & ~7); + + pld(src, 0); + + while (start < end) + { + pld(src, 32); + UNROLL8( + { + _soft8_pt_blend_solid_solid_mul_alpha(start, *src, rel_alpha); + start++; src++;} + ); + } + + end = start + (size & 7); + for (; start < end; start++, src++) + _soft8_pt_blend_solid_solid_mul_alpha(start, *src, rel_alpha); +} + +/*********************************************************************** + * Blend operations with extra alpha and multiply color + */ + +static always_inline void +_soft8_pt_blend_transp_solid_mul_color_transp(DATA8 * p_dst, DATA8 src, + DATA8 alpha, DATA8 rel_alpha, + DATA8 r, DATA8 g, DATA8 b) +{ + alpha = alpha * rel_alpha; + if (alpha == 0) + return; + + alpha++; + + DATA8 gry8 = (src * GRY_8_FROM_COMPONENTS(r, g, b)) >> 8; + *p_dst = GRY_8_BLEND(gry8, *p_dst, alpha); +} + +static void +_soft8_scanline_blend_transp_solid_mul_color_transp(DATA8 * src, DATA8 * alpha, + DATA8 * dst, int size, + DATA8 rel_alpha, DATA8 r, + DATA8 g, DATA8 b) +{ + DATA8 *start, *end; + + start = dst; + end = start + (size & ~7); + + pld(alpha, 0); + pld(src, 0); + + while (start < end) + { + DATA8 alpha1, alpha2; + + alpha1 = alpha[0]; + alpha += 8; + + pld(src, 32); + pld(start, 32); + + src += 8; + start += 8; + + alpha2 = alpha[-7]; + _soft8_pt_blend_transp_solid_mul_color_transp + (start - 8, src[-8], alpha1, rel_alpha, r, g, b); + + alpha1 = alpha[-6]; + _soft8_pt_blend_transp_solid_mul_color_transp + (start - 7, src[-7], alpha2, rel_alpha, r, g, b); + + alpha2 = alpha[-5]; + _soft8_pt_blend_transp_solid_mul_color_transp + (start - 6, src[-6], alpha1, rel_alpha, r, g, b); + + alpha1 = alpha[-4]; + _soft8_pt_blend_transp_solid_mul_color_transp + (start - 5, src[-5], alpha2, rel_alpha, r, g, b); + + alpha2 = alpha[-3]; + _soft8_pt_blend_transp_solid_mul_color_transp + (start - 4, src[-4], alpha1, rel_alpha, r, g, b); + + alpha1 = alpha[-2]; + _soft8_pt_blend_transp_solid_mul_color_transp + (start - 3, src[-3], alpha2, rel_alpha, r, g, b); + + alpha2 = alpha[-1]; + _soft8_pt_blend_transp_solid_mul_color_transp + (start - 2, src[-2], alpha1, rel_alpha, r, g, b); + + _soft8_pt_blend_transp_solid_mul_color_transp + (start - 1, src[-1], alpha2, rel_alpha, r, g, b); + } + + end = start + (size & 7); + for (; start < end; start++, src++, alpha++) + _soft8_pt_blend_transp_solid_mul_color_transp + (start, *src, *alpha, rel_alpha, r, g, b); +} + +static always_inline void +_soft8_pt_blend_solid_solid_mul_color_transp(DATA8 * p_dst, DATA8 src, + DATA8 rel_alpha, DATA8 r, DATA8 g, + DATA8 b) +{ + DATA8 gry8 = (src * GRY_8_FROM_COMPONENTS(r, g, b)) >> 8; + *p_dst = GRY_8_BLEND(gry8, *p_dst, rel_alpha); +} + +static void +_soft8_scanline_blend_solid_solid_mul_color_transp(DATA8 * src, DATA8 * dst, + int size, DATA8 rel_alpha, + DATA8 r, DATA8 g, DATA8 b) +{ + DATA8 *start, *end; + + start = dst; + end = start + (size & ~7); + + pld(src, 0); + + while (start < end) + { + pld(src, 32); + UNROLL8( + { + _soft8_pt_blend_solid_solid_mul_color_transp + (start, *src, rel_alpha, r, g, b); start++; src++;} + ); + } + + end = start + (size & 7); + for (; start < end; start++, src++) + _soft8_pt_blend_solid_solid_mul_color_transp + (start, *src, rel_alpha, r, g, b); +} + +/*********************************************************************** + * Blend operations with extra multiply color + */ +static always_inline void +_soft8_pt_blend_transp_solid_mul_color_solid(DATA8 * p_dst, DATA8 src, + DATA8 alpha, DATA8 r, DATA8 g, + DATA8 b) +{ + if (alpha == 0) + return; + + DATA8 gry8 = (src * GRY_8_FROM_COMPONENTS(r, g, b)) >> 8; + + if (alpha == 0xff) + *p_dst = gry8; + else + { + *p_dst = GRY_8_BLEND(gry8, *p_dst, alpha); + } +} + +static void +_soft8_scanline_blend_transp_solid_mul_color_solid(DATA8 * src, DATA8 * alpha, + DATA8 * dst, int size, + DATA8 r, DATA8 g, DATA8 b) +{ + DATA8 *start, *end; + + start = dst; + end = start + (size & ~7); + + pld(alpha, 0); + pld(src, 0); + + while (start < end) + { + DATA8 alpha1, alpha2; + + alpha1 = alpha[0]; + alpha += 8; + + pld(alpha, 8); + pld(src, 32); + + src += 8; + start += 8; + + alpha2 = alpha[-7]; + _soft8_pt_blend_transp_solid_mul_color_solid + (start - 8, src[-8], alpha1, r, g, b); + + alpha1 = alpha[-6]; + _soft8_pt_blend_transp_solid_mul_color_solid + (start - 7, src[-7], alpha2, r, g, b); + + alpha2 = alpha[-5]; + _soft8_pt_blend_transp_solid_mul_color_solid + (start - 6, src[-6], alpha1, r, g, b); + + alpha1 = alpha[-4]; + _soft8_pt_blend_transp_solid_mul_color_solid + (start - 5, src[-5], alpha2, r, g, b); + + alpha2 = alpha[-3]; + _soft8_pt_blend_transp_solid_mul_color_solid + (start - 4, src[-4], alpha1, r, g, b); + + alpha1 = alpha[-2]; + _soft8_pt_blend_transp_solid_mul_color_solid + (start - 3, src[-3], alpha2, r, g, b); + + alpha2 = alpha[-1]; + _soft8_pt_blend_transp_solid_mul_color_solid + (start - 2, src[-2], alpha1, r, g, b); + + _soft8_pt_blend_transp_solid_mul_color_solid + (start - 1, src[-1], alpha2, r, g, b); + } + + end = start + (size & 7); + for (; start < end; start++, src++, alpha++) + _soft8_pt_blend_transp_solid_mul_color_solid + (start, *src, *alpha, r, g, b); +} + +static always_inline void +_soft8_pt_blend_solid_solid_mul_color_solid(DATA8 * p_dst, DATA8 src, DATA8 r, + DATA8 g, DATA8 b) +{ + *p_dst = (src * GRY_8_FROM_COMPONENTS(r, g, b)) >> 8; +} + +static void +_soft8_scanline_blend_solid_solid_mul_color_solid(DATA8 * src, DATA8 * dst, + int size, DATA8 r, DATA8 g, + DATA8 b) +{ + DATA8 *start, *end; + + start = dst; + end = start + (size & ~7); + + pld(src, 0); + + while (start < end) + { + pld(src, 32); + UNROLL8( + { + _soft8_pt_blend_solid_solid_mul_color_solid(start, *src, r, g, + b); start++; + src++;} + ); + } + + end = start + (size & 7); + for (; start < end; start++, src++) + _soft8_pt_blend_solid_solid_mul_color_solid(start, *src, r, g, b); +} diff --git a/legacy/evas/src/lib/engines/common_8/evas_soft8_scanline_fill.c b/legacy/evas/src/lib/engines/common_8/evas_soft8_scanline_fill.c new file mode 100644 index 0000000000..0d2f18b2d1 --- /dev/null +++ b/legacy/evas/src/lib/engines/common_8/evas_soft8_scanline_fill.c @@ -0,0 +1,53 @@ +/** NOTE: This file is meant to be included by users **/ + +/***************************************************************************** + * Point processing + * + * _soft8_pt___[_]() + * + * Scanline processing + * + * _soft8_scanline___[_]() + * + ****************************************************************************/ +static always_inline void +_soft8_pt_fill_solid_solid(DATA8 * dst, DATA8 gry8) +{ + *dst = gry8; +} + +static always_inline void +_soft8_scanline_fill_solid_solid(DATA8 * dst, int size, DATA8 gry8) +{ + memset(dst, gry8, size); +} + +static always_inline void +_soft8_pt_fill_transp_solid(DATA8 * dst, DATA8 gry8, DATA8 alpha) +{ + *dst = GRY_8_BLEND(gry8, *dst, alpha); +} + +static void +_soft8_scanline_fill_transp_solid(DATA8 * dst, int size, DATA8 gry8, + DATA8 alpha) +{ + DATA8 *start, *end; + + start = dst; + pld(start, 0); + end = start + (size & ~7); + + while (start < end) + { + pld(start, 32); + UNROLL8( + { + _soft8_pt_fill_transp_solid(start, gry8, alpha); start++;} + ); + } + + end = start + (size & 7); + for (; start < end; start++) + _soft8_pt_fill_transp_solid(start, gry8, alpha); +} diff --git a/legacy/evas/src/lib/include/evas_common_soft8.h b/legacy/evas/src/lib/include/evas_common_soft8.h new file mode 100644 index 0000000000..af07146f7a --- /dev/null +++ b/legacy/evas/src/lib/include/evas_common_soft8.h @@ -0,0 +1,194 @@ +#ifndef EVAS_COMMON_SOFT16_H +#define EVAS_COMMON_SOFT16_H + +#include "evas_common.h" +#include "evas_private.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef always_inline +#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) +# define always_inline __attribute__((always_inline)) inline +#else +# define always_inline inline +#endif +#endif + +#define GRY_8_BLEND(a, b, alpha) \ + ((b) + (a) - ((((b) * ((alpha) + 1)) >> 8) & 0xff)) + +#define GRY_8_BLEND_UNMUL(a, b, alpha) \ + ((b) + ((((a) - (b)) * ((alpha) + 1)) >> 8)) + +#if 0 +#define GRY_8_FROM_COMPONENTS(r, g, b) \ + (((307 * (r)) + \ + (604 * (g)) + \ + (113 * (b))) >> 10) + +#define GRY_8_FROM_RGB(rgb) \ + GRY_8_FROM_COMPONENTS(R_VAL(rgb), G_VAL(rgb), B_VAL(rgb)) +#endif + +//Y = R * 0.2126 + G * 0.7152 + B * 0.0722 + +#define GRY_8_FROM_COMPONENTS(r, g, b) \ + (((218 * (r)) + \ + (732 * (g)) + \ + (74 * (b))) >> 10) + +#define GRY_8_FROM_RGB(rgb) \ + GRY_8_FROM_COMPONENTS(R_VAL(rgb), G_VAL(rgb), B_VAL(rgb)) + +#define UNROLL2(op...) op op +#define UNROLL4(op...) UNROLL2(op) UNROLL2(op) +#define UNROLL8(op...) UNROLL4(op) UNROLL4(op) +#define UNROLL16(op...) UNROLL8(op) UNROLL8(op) + +#if defined(__ARM_ARCH_3M__) +# define __ARM_ARCH__ 40 +#endif +#if defined(__ARM_ARCH_4__) +# define __ARM_ARCH__ 40 +#endif +#if defined(__ARM_ARCH_4T__) +# define __ARM_ARCH__ 41 +#endif + +#if defined(__ARM_ARCH_5__) +# define __ARM_ARCH__ 50 +#endif +#if defined(__ARM_ARCH_5T__) +# define __ARM_ARCH__ 51 +#endif +#if defined(__ARM_ARCH_5E__) +# define __ARM_ARCH__ 52 +#endif +#if defined(__ARM_ARCH_5TE__) +# define __ARM_ARCH__ 53 +#endif +#if defined(__ARM_ARCH_5TEJ__) +# define __ARM_ARCH__ 54 +#endif + +#if defined(__ARM_ARCH_6__) +# define __ARM_ARCH__ 60 +#endif +#if defined(__ARM_ARCH_6J__) +# define __ARM_ARCH__ 61 +#endif +#if defined(__ARM_ARCH_6K__) +# define __ARM_ARCH__ 62 +#endif +#if defined(__ARM_ARCH_6Z__) +# define __ARM_ARCH__ 63 +#endif +#if defined(__ARM_ARCH_6ZK__) +# define __ARM_ARCH__ 64 +#endif +#if defined(__ARM_ARCH_6T2__) +# define __ARM_ARCH__ 65 +#endif + +#if defined(__ARM_ARCH_7__) +# define __ARM_ARCH__ 70 +#endif +#if defined(__ARM_ARCH_7A__) +# define __ARM_ARCH__ 71 +#endif +#if defined(__ARM_ARCH_7R__) +# define __ARM_ARCH__ 72 +#endif +#if defined(__ARM_ARCH_7M__) +# define __ARM_ARCH__ 73 +#endif + +#if defined(__ARM_ARCH__) && (__ARM_ARCH__ >= 52) +/* tested on ARMv6 (arm1136j-s), Nokia N800 CPU */ +#define pld(addr, off) \ + __asm__("pld [%[address], %[offset]]":: \ + [address] "r" (addr), [offset] "i" (off)) +#else +#define pld(addr, off) +#endif /* __ARMEL__ */ + +static inline int +_calc_stride(int w) +{ + int pad; + + pad = w % 4; + if (!pad) return w; + else return w + 4 - pad; +} + +#define IMG_BYTE_SIZE(stride, height, has_alpha) \ + ((stride) * (height) * (!(has_alpha) ? 1 : 2)) + +typedef struct _Soft8_Image Soft8_Image; +struct _Soft8_Image +{ + Image_Entry cache_entry; + + RGBA_Image *source; + + int stride; // pixel stride + DATA8 *pixels; // 8bpp pixels gry8 + DATA8 *alpha; // 8bit alpha mask - optional. points into pixels + + void *extended_info; + + struct + { +/* unsigned char have_alpha : 1; // 1 if we have halpha */ + unsigned char free_pixels : 1; // 1 if pixels should be freed + unsigned char free_alpha : 1; // 1 if alpha mask should be freed + } flags; +}; + +/** + * Image (evas_soft8_main.c) + */ +EAPI void evas_common_soft8_image_init(void); +EAPI void evas_common_soft8_image_shutdown(void); +EAPI Evas_Cache_Image *evas_common_soft8_image_cache_get(void); + +EAPI void soft8_image_draw(Soft8_Image *src, Soft8_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h, int smooth); +EAPI Soft8_Image *soft8_image_alpha_set(Soft8_Image *im, int have_alpha); + +void soft8_image_draw_unscaled(Soft8_Image *src, Soft8_Image *dst, RGBA_Draw_Context *dc, const Eina_Rectangle sr, const Eina_Rectangle dr, const Eina_Rectangle cr); +void soft8_image_draw_scaled_sampled(Soft8_Image *src, Soft8_Image *dst, RGBA_Draw_Context *dc, const Eina_Rectangle sr, const Eina_Rectangle dr, const Eina_Rectangle cr); + +/* convert/dither functions */ +void soft8_image_convert_from_rgb(Soft8_Image *im, const DATA32 *src); +void soft8_image_convert_from_rgba(Soft8_Image *im, const DATA32 *src); + +/** + * Rectangle (evas_soft8_rectangle.c) + */ +EAPI void soft8_rectangle_draw(Soft8_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h); + +/** + * Polygon (evas_soft8_polygon.c) + */ +EAPI void soft8_polygon_draw(Soft8_Image *dst, RGBA_Draw_Context *dc, RGBA_Polygon_Point *points, int x, int y); + +/** + * Line (evas_soft8_line.c) + */ +EAPI void soft8_line_draw(Soft8_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, int y1); + +/** + * Font (evas_soft8_font.c) + */ +EAPI void *soft8_font_glyph_new(void *data, RGBA_Font_Glyph *fg); +EAPI void soft8_font_glyph_free(void *ext_dat); +EAPI void soft8_font_glyph_draw(void *data, void *dest, void *context, RGBA_Font_Glyph *fg, int x, int y); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/legacy/evas/src/modules/engines/software_8/Makefile.am b/legacy/evas/src/modules/engines/software_8/Makefile.am new file mode 100644 index 0000000000..9f100f6678 --- /dev/null +++ b/legacy/evas/src/modules/engines/software_8/Makefile.am @@ -0,0 +1,38 @@ + +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I. \ +-I$(top_srcdir)/src/lib \ +-I$(top_srcdir)/src/lib/include \ +-I$(top_srcdir)/src/modules/engines \ +@FREETYPE_CFLAGS@ \ +@EINA_CFLAGS@ + +AM_CFLAGS = @WIN32_CFLAGS@ + +if BUILD_ENGINE_SOFTWARE_8 + +SOFTWARE_8_SOURCES = evas_engine.c + +pkgdir = $(libdir)/evas/modules/engines/software_8/$(MODULE_ARCH) + +if !EVAS_STATIC_BUILD_SOFTWARE_8_X11 + +pkg_LTLIBRARIES = module.la +module_la_SOURCES = $(SOFTWARE_8_SOURCES) +module_la_LIBADD = @EINA_LIBS@ $(top_builddir)/src/lib/libevas.la +module_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version +module_la_LIBTOOLFLAGS = --tag=disable-static + +else + +noinst_LTLIBRARIES = libevas_engine_software_8.la + +libevas_engine_software_8_la_SOURCES = $(SOFTWARE_8_SOURCES) + +endif +endif + +EXTRA_DIST = \ +evas_engine.c diff --git a/legacy/evas/src/modules/engines/software_8/evas_engine.c b/legacy/evas/src/modules/engines/software_8/evas_engine.c new file mode 100644 index 0000000000..2764f9f077 --- /dev/null +++ b/legacy/evas/src/modules/engines/software_8/evas_engine.c @@ -0,0 +1,1188 @@ +#include "evas_common.h" +#include "evas_common_soft8.h" + +/* + ***** + ** + ** ENGINE ROUTINES + ** + ***** + */ +int _evas_soft8_log_dom = -1; +#ifdef ERR +#undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR( _evas_soft8_log_dom, __VA_ARGS__) + +#ifdef DBG +#undef DBG +#endif +#define DBG(...) EINA_LOG_DOM_DBG(_evas_soft8_log_dom, __VA_ARGS__) + +#ifdef INF +#undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_evas_soft8_log_dom, __VA_ARGS__) + +#ifdef WRN +#undef WRN +#endif +#define WRN(...) EINA_LOG_DOM_WARN(_evas_soft8_log_dom, __VA_ARGS__) + +#ifdef CRIT +#undef CRIT +#endif +#define CRIT(...) EINA_LOG_DOM_CRIT(_evas_soft8_log_dom, __VA_ARGS__) + +#define NOT_IMPLEMENTED() \ + WRN("NOT_IMPLEMENTED: %s() at %s:%d", \ + __FUNCTION__, __FILE__, __LINE__) + +static void +eng_output_dump(void *data __UNUSED__) +{ + evas_common_image_image_all_unload(); + evas_common_font_font_all_unload(); +} + +static void * +eng_context_new(void *data __UNUSED__) +{ + return evas_common_draw_context_new(); +} + +static void +eng_context_free(void *data __UNUSED__, void *context) +{ + evas_common_draw_context_free(context); +} + +static void +eng_context_clip_set(void *data __UNUSED__, void *context, int x, int y, int w, + int h) +{ + evas_common_draw_context_set_clip(context, x, y, w, h); +} + +static void +eng_context_clip_clip(void *data __UNUSED__, void *context, int x, int y, int w, + int h) +{ + evas_common_draw_context_clip_clip(context, x, y, w, h); +} + +static void +eng_context_clip_unset(void *data __UNUSED__, void *context) +{ + evas_common_draw_context_unset_clip(context); +} + +static int +eng_context_clip_get(void *data __UNUSED__, void *context, int *x, int *y, + int *w, int *h) +{ + *x = ((RGBA_Draw_Context *) context)->clip.x; + *y = ((RGBA_Draw_Context *) context)->clip.y; + *w = ((RGBA_Draw_Context *) context)->clip.w; + *h = ((RGBA_Draw_Context *) context)->clip.h; + return ((RGBA_Draw_Context *) context)->clip.use; +} + +static void +eng_context_color_set(void *data __UNUSED__, void *context, int r, int g, int b, + int a) +{ + evas_common_draw_context_set_color(context, r, g, b, a); +} + +static int +eng_context_color_get(void *data __UNUSED__, void *context, int *r, int *g, + int *b, int *a) +{ + *r = (int)(R_VAL(&((RGBA_Draw_Context *) context)->col.col)); + *g = (int)(G_VAL(&((RGBA_Draw_Context *) context)->col.col)); + *b = (int)(B_VAL(&((RGBA_Draw_Context *) context)->col.col)); + *a = (int)(A_VAL(&((RGBA_Draw_Context *) context)->col.col)); + return 1; +} + +static void +eng_context_multiplier_set(void *data __UNUSED__, void *context, int r, int g, + int b, int a) +{ + evas_common_draw_context_set_multiplier(context, r, g, b, a); +} + +static void +eng_context_multiplier_unset(void *data __UNUSED__, void *context) +{ + evas_common_draw_context_unset_multiplier(context); +} + +static int +eng_context_multiplier_get(void *data __UNUSED__, void *context, int *r, int *g, + int *b, int *a) +{ + *r = (int)(R_VAL(&((RGBA_Draw_Context *) context)->mul.col)); + *g = (int)(G_VAL(&((RGBA_Draw_Context *) context)->mul.col)); + *b = (int)(B_VAL(&((RGBA_Draw_Context *) context)->mul.col)); + *a = (int)(A_VAL(&((RGBA_Draw_Context *) context)->mul.col)); + return ((RGBA_Draw_Context *) context)->mul.use; +} + +static void +eng_context_cutout_add(void *data __UNUSED__, void *context, int x, int y, + int w, int h) +{ + evas_common_draw_context_add_cutout(context, x, y, w, h); +} + +static void +eng_context_cutout_clear(void *data __UNUSED__, void *context) +{ + evas_common_draw_context_clear_cutouts(context); +} + +static void +eng_context_anti_alias_set(void *data __UNUSED__, void *context, + unsigned char aa) +{ + evas_common_draw_context_set_anti_alias(context, aa); +} + +static unsigned char +eng_context_anti_alias_get(void *data __UNUSED__, void *context) +{ + return ((RGBA_Draw_Context *) context)->anti_alias; +} + +static void +eng_context_color_interpolation_set(void *data __UNUSED__, void *context, + int color_space) +{ + evas_common_draw_context_set_color_interpolation(context, color_space); +} + +static int +eng_context_color_interpolation_get(void *data __UNUSED__, void *context) +{ + return ((RGBA_Draw_Context *) context)->interpolation.color_space; +} + +static void +eng_context_render_op_set(void *data __UNUSED__, void *context, int op) +{ + evas_common_draw_context_set_render_op(context, op); +} + +static int +eng_context_render_op_get(void *data __UNUSED__, void *context) +{ + return ((RGBA_Draw_Context *) context)->render_op; +} + +static void +eng_rectangle_draw(void *data __UNUSED__, void *context, void *surface, int x, + int y, int w, int h) +{ + soft8_rectangle_draw(surface, context, x, y, w, h); +} + +static void +eng_line_draw(void *data __UNUSED__, void *context, void *surface, int x1, + int y1, int x2, int y2) +{ + soft8_line_draw(surface, context, x1, y1, x2, y2); +} + +static void * +eng_polygon_point_add(void *data __UNUSED__, void *context __UNUSED__, + void *polygon, int x, int y) +{ + return evas_common_polygon_point_add(polygon, x, y); +} + +static void * +eng_polygon_points_clear(void *data __UNUSED__, void *context __UNUSED__, + void *polygon) +{ + return evas_common_polygon_points_clear(polygon); +} + +static void +eng_polygon_draw(void *data __UNUSED__, void *context, void *surface, + void *polygon, int x, int y) +{ + soft8_polygon_draw(surface, context, polygon, x, y); +} + +static void +eng_gradient2_color_np_stop_insert(void *data __UNUSED__, + void *gradient __UNUSED__, int r __UNUSED__, + int g __UNUSED__, int b __UNUSED__, + int a __UNUSED__, float pos __UNUSED__) +{ +} + +static void +eng_gradient2_clear(void *data __UNUSED__, void *gradient __UNUSED__) +{ +} + +static void +eng_gradient2_fill_transform_set(void *data __UNUSED__, + void *gradient __UNUSED__, + void *transform __UNUSED__) +{ +} + +static void +eng_gradient2_fill_spread_set(void *data __UNUSED__, void *gradient __UNUSED__, + int spread __UNUSED__) +{ +} + +static void * +eng_gradient2_linear_new(void *data __UNUSED__) +{ + return NULL; +} + +static void +eng_gradient2_linear_free(void *data __UNUSED__, + void *linear_gradient __UNUSED__) +{ +} + +static void +eng_gradient2_linear_fill_set(void *data __UNUSED__, + void *linear_gradient __UNUSED__, + float x0 __UNUSED__, float y0 __UNUSED__, + float x1 __UNUSED__, float y1 __UNUSED__) +{ +} + +static int +eng_gradient2_linear_is_opaque(void *data __UNUSED__, void *context __UNUSED__, + void *linear_gradient __UNUSED__, + int x __UNUSED__, int y __UNUSED__, + int w __UNUSED__, int h __UNUSED__) +{ + return 1; +} + +static int +eng_gradient2_linear_is_visible(void *data __UNUSED__, void *context __UNUSED__, + void *linear_gradient __UNUSED__, + int x __UNUSED__, int y __UNUSED__, + int w __UNUSED__, int h __UNUSED__) +{ + return 1; +} + +static void +eng_gradient2_linear_render_pre(void *data __UNUSED__, void *context __UNUSED__, + void *linear_gradient __UNUSED__) +{ +} + +static void +eng_gradient2_linear_render_post(void *data __UNUSED__, + void *linear_gradient __UNUSED__) +{ +} + +static void +eng_gradient2_linear_draw(void *data __UNUSED__, void *context __UNUSED__, + void *surface __UNUSED__, + void *linear_gradient __UNUSED__, int x __UNUSED__, + int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) +{ +} + +static void * +eng_gradient2_radial_new(void *data __UNUSED__) +{ + return NULL; +} + +static void +eng_gradient2_radial_free(void *data __UNUSED__, + void *radial_gradient __UNUSED__) +{ +} + +static void +eng_gradient2_radial_fill_set(void *data __UNUSED__, + void *radial_gradient __UNUSED__, + float cx __UNUSED__, float cy __UNUSED__, + float rx __UNUSED__, float ry __UNUSED__) +{ +} + +static int +eng_gradient2_radial_is_opaque(void *data __UNUSED__, void *context __UNUSED__, + void *radial_gradient __UNUSED__, + int x __UNUSED__, int y __UNUSED__, + int w __UNUSED__, int h __UNUSED__) +{ + return 1; +} + +static int +eng_gradient2_radial_is_visible(void *data __UNUSED__, void *context __UNUSED__, + void *radial_gradient __UNUSED__, + int x __UNUSED__, int y __UNUSED__, + int w __UNUSED__, int h __UNUSED__) +{ + return 1; +} + +static void +eng_gradient2_radial_render_pre(void *data __UNUSED__, void *context __UNUSED__, + void *radial_gradient __UNUSED__) +{ +} + +static void +eng_gradient2_radial_render_post(void *data __UNUSED__, + void *radial_gradient __UNUSED__) +{ +} + +static void +eng_gradient2_radial_draw(void *data __UNUSED__, void *context __UNUSED__, + void *surface __UNUSED__, + void *radial_gradient __UNUSED__, int x __UNUSED__, + int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) +{ +} + +static void * +eng_gradient_new(void *data __UNUSED__) +{ + NOT_IMPLEMENTED(); + return NULL; +// return evas_common_gradient_new(); +} + +static void +eng_gradient_free(void *data __UNUSED__, void *gradient __UNUSED__) +{ + NOT_IMPLEMENTED(); +// evas_common_gradient_free(gradient); +} + +static void +eng_gradient_color_stop_add(void *data __UNUSED__, void *gradient __UNUSED__, + int r __UNUSED__, int g __UNUSED__, + int b __UNUSED__, int a __UNUSED__, + int delta __UNUSED__) +{ + NOT_IMPLEMENTED(); +// evas_common_gradient_color_stop_add(gradient, r, g, b, a, delta); +} + +static void +eng_gradient_alpha_stop_add(void *data __UNUSED__, void *gradient __UNUSED__, + int a __UNUSED__, int delta __UNUSED__) +{ + NOT_IMPLEMENTED(); +// evas_common_gradient_alpha_stop_add(gradient, a, delta); +} + +static void +eng_gradient_color_data_set(void *data __UNUSED__, void *gradient __UNUSED__, + void *map __UNUSED__, int len __UNUSED__, + int has_alpha __UNUSED__) +{ + NOT_IMPLEMENTED(); +// evas_common_gradient_color_data_set(gradient, map, len, has_alpha); +} + +static void +eng_gradient_alpha_data_set(void *data __UNUSED__, void *gradient __UNUSED__, + void *alpha_map __UNUSED__, int len __UNUSED__) +{ + NOT_IMPLEMENTED(); +// evas_common_gradient_alpha_data_set(gradient, alpha_map, len); +} + +static void +eng_gradient_clear(void *data __UNUSED__, void *gradient __UNUSED__) +{ + NOT_IMPLEMENTED(); +// evas_common_gradient_clear(gradient); +} + +static void +eng_gradient_fill_set(void *data __UNUSED__, void *gradient __UNUSED__, + int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, + int h __UNUSED__) +{ + NOT_IMPLEMENTED(); +// evas_common_gradient_fill_set(gradient, x, y, w, h); +} + +static void +eng_gradient_fill_angle_set(void *data __UNUSED__, void *gradient __UNUSED__, + double angle __UNUSED__) +{ + NOT_IMPLEMENTED(); +// evas_common_gradient_fill_angle_set(gradient, angle); +} + +static void +eng_gradient_fill_spread_set(void *data __UNUSED__, void *gradient __UNUSED__, + int spread __UNUSED__) +{ + NOT_IMPLEMENTED(); +// evas_common_gradient_fill_spread_set(gradient, spread); +} + +static void +eng_gradient_angle_set(void *data __UNUSED__, void *gradient __UNUSED__, + double angle __UNUSED__) +{ + NOT_IMPLEMENTED(); +// evas_common_gradient_map_angle_set(gradient, angle); +} + +static void +eng_gradient_offset_set(void *data __UNUSED__, void *gradient __UNUSED__, + float offset __UNUSED__) +{ + NOT_IMPLEMENTED(); +// evas_common_gradient_map_offset_set(gradient, offset); +} + +static void +eng_gradient_direction_set(void *data __UNUSED__, void *gradient __UNUSED__, + int direction __UNUSED__) +{ + NOT_IMPLEMENTED(); +// evas_common_gradient_map_direction_set(gradient, direction); +} + +static void +eng_gradient_type_set(void *data __UNUSED__, void *gradient __UNUSED__, + char *name __UNUSED__, char *params __UNUSED__) +{ + NOT_IMPLEMENTED(); +// evas_common_gradient_type_set(gradient, name, params); +} + +static int +eng_gradient_is_opaque(void *data __UNUSED__, void *context __UNUSED__, + void *gradient __UNUSED__, int x __UNUSED__, + int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) +{ + NOT_IMPLEMENTED(); + return 0; +// RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context; +// RGBA_Gradient *gr = (RGBA_Gradient *)gradient; +// +// if (!dc || !gr || !gr->type.geometer) return 0; +// return !(gr->type.geometer->has_alpha(gr, dc->render_op) | +// gr->type.geometer->has_mask(gr, dc->render_op)); +} + +static int +eng_gradient_is_visible(void *data __UNUSED__, void *context __UNUSED__, + void *gradient __UNUSED__, int x __UNUSED__, + int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) +{ + NOT_IMPLEMENTED(); + return 0; +// RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context; +// +// if (!dc || !gradient) return 0; +// return 1; +} + +static void +eng_gradient_render_pre(void *data __UNUSED__, void *context __UNUSED__, + void *gradient __UNUSED__) +{ +// RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context; +// RGBA_Gradient *gr = (RGBA_Gradient *)gradient; +// int len; +// +// if (!dc || !gr || !gr->type.geometer) return; +// gr->type.geometer->geom_set(gr); +// len = gr->type.geometer->get_map_len(gr); +// evas_common_gradient_map(dc, gr, len); + NOT_IMPLEMENTED(); +} + +static void +eng_gradient_render_post(void *data __UNUSED__, void *gradient __UNUSED__) +{ + NOT_IMPLEMENTED(); +} + +static void +eng_gradient_draw(void *data __UNUSED__, void *context __UNUSED__, + void *surface __UNUSED__, void *gradient __UNUSED__, + int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, + int h __UNUSED__) +{ +// evas_common_gradient_draw(surface, context, x, y, w, h, gradient); +// evas_common_cpu_end_opt(); + NOT_IMPLEMENTED(); +} + +static int +eng_image_alpha_get(void *data __UNUSED__, void *image) +{ + Soft8_Image *im; + + if (!image) + return 0; + im = image; + return im->cache_entry.flags.alpha; +} + +static int +eng_image_colorspace_get(void *data __UNUSED__, void *image __UNUSED__) +{ + return EVAS_COLORSPACE_GRY8; +} + +static void * +eng_image_alpha_set(void *data __UNUSED__, void *image, int have_alpha) +{ + if (!image) + return NULL; + have_alpha = !!have_alpha; + image = soft8_image_alpha_set(image, have_alpha); + return image; +} + +static void * +eng_image_border_set(void *data __UNUSED__, void *image, int l __UNUSED__, + int r __UNUSED__, int t __UNUSED__, int b __UNUSED__) +{ + return image; +} + +static void +eng_image_border_get(void *data __UNUSED__, void *image __UNUSED__, + int *l __UNUSED__, int *r __UNUSED__, int *t __UNUSED__, + int *b __UNUSED__) +{ +} + +static char * +eng_image_comment_get(void *data __UNUSED__, void *image __UNUSED__, + char *key __UNUSED__) +{ + return NULL; +} + +static char * +eng_image_format_get(void *data __UNUSED__, void *image __UNUSED__) +{ + NOT_IMPLEMENTED(); + return NULL; +} + +static void +eng_image_colorspace_set(void *data __UNUSED__, void *image __UNUSED__, + int cspace __UNUSED__) +{ + NOT_IMPLEMENTED(); +} + +static void +eng_image_native_set(void *data __UNUSED__, void *image __UNUSED__, + void *native __UNUSED__) +{ + NOT_IMPLEMENTED(); +} + +static void * +eng_image_native_get(void *data __UNUSED__, void *image __UNUSED__) +{ + NOT_IMPLEMENTED(); + return NULL; +} + +static void * +eng_image_load(void *data __UNUSED__, const char *file, const char *key, + int *error, Evas_Image_Load_Opts * lo) +{ + return evas_cache_image_request(evas_common_soft8_image_cache_get(), file, + key, lo, error); +} + +static void * +eng_image_new_from_data(void *data __UNUSED__, int w, int h, + DATA32 * image_data, int alpha, int cspace) +{ + if ((image_data) && (cspace != EVAS_COLORSPACE_GRY8)) + { + WRN("Unsupported colorspace %d in %s() (%s:%d)", + cspace, __FUNCTION__, __FILE__, __LINE__); + return NULL; + } + return evas_cache_image_data(evas_common_soft8_image_cache_get(), w, h, + image_data, alpha, EVAS_COLORSPACE_GRY8); +} + +static void * +eng_image_new_from_copied_data(void *data __UNUSED__, int w, int h, + DATA32 * image_data, int alpha, int cspace) +{ + if ((image_data) && (cspace != EVAS_COLORSPACE_GRY8)) + { + WRN("Unsupported colorspace %d in %s() (%s:%d)", + cspace, __FUNCTION__, __FILE__, __LINE__); + return NULL; + } + return evas_cache_image_copied_data(evas_common_soft8_image_cache_get(), w, + h, image_data, alpha, + EVAS_COLORSPACE_GRY8); +} + +static void +eng_image_free(void *data __UNUSED__, void *image) +{ + evas_cache_image_drop((Image_Entry *) image); +} + +static void +eng_image_size_get(void *data __UNUSED__, void *image, int *w, int *h) +{ + Soft8_Image *im; + + if (w) + *w = 0; + if (h) + *h = 0; + if (!image) + return; + im = image; + if (w) + *w = im->cache_entry.w; + if (h) + *h = im->cache_entry.h; +} + +static void * +eng_image_size_set(void *data __UNUSED__, void *image, int w, int h) +{ + if (!image) + return NULL; + if ((w <= 0) || (h <= 0)) + { + evas_cache_image_drop((Image_Entry *) image); + return NULL; + } + return evas_cache_image_size_set((Image_Entry *) image, w, h); +} + +static void +eng_image_stride_get(void *data __UNUSED__, void *image, int *stride) +{ + Soft8_Image *im; + + if (stride) + *stride = 0; + if (!image) + return; + im = image; + if (stride) + *stride = im->stride; +} + +static void * +eng_image_dirty_region(void *data __UNUSED__, void *image __UNUSED__, + int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, + int h __UNUSED__) +{ + /* FIXME: is this required? */ + //NOT_IMPLEMENTED(); + return image; +} + +static void * +eng_image_data_get(void *data __UNUSED__, void *image, int to_write, + DATA32 ** image_data) +{ + Soft8_Image *im; + + if (!image) + { + *image_data = NULL; + return NULL; + } + + im = image; + evas_cache_image_load_data(&im->cache_entry); + + if (to_write) + im = (Soft8_Image *) evas_cache_image_alone(&im->cache_entry); + + if (image_data) + *image_data = (DATA32 *) im->pixels; + + return im; +} + +static void * +eng_image_data_put(void *data __UNUSED__, void *image, DATA32 * image_data) +{ + Soft8_Image *old_im, *new_im; + + if (!image) + return NULL; + + old_im = image; + if ((DATA8 *) image_data == old_im->pixels) + return old_im; + + new_im = + (Soft8_Image *) + evas_cache_image_data(evas_common_soft8_image_cache_get(), + old_im->cache_entry.w, old_im->cache_entry.h, + image_data, old_im->cache_entry.flags.alpha, + EVAS_COLORSPACE_GRY8); + evas_cache_image_drop(&old_im->cache_entry); + return new_im; +} + +static void +eng_image_data_preload_request(void *data __UNUSED__, void *image, + const void *target) +{ + Soft8_Image *im = image; + + if (!im) + return; + evas_cache_image_preload_data(&im->cache_entry, target); +} + +static void +eng_image_data_preload_cancel(void *data __UNUSED__, void *image, + const void *target) +{ + Soft8_Image *im = image; + + if (!im) + return; + evas_cache_image_preload_cancel(&im->cache_entry, target); +} + +static void +eng_image_draw(void *data __UNUSED__, void *context, void *surface, void *image, + int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, + int dst_w, int dst_h, int smooth) +{ + Soft8_Image *im; + + im = (Soft8_Image *) image; + + evas_cache_image_load_data(&im->cache_entry); + soft8_image_draw(im, surface, context, + src_x, src_y, src_w, src_h, + dst_x, dst_y, dst_w, dst_h, smooth); +} + +static void +eng_image_scale_hint_set(void *data __UNUSED__, void *image __UNUSED__, + int hint __UNUSED__) +{ +} + +static int +eng_image_scale_hint_get(void *data __UNUSED__, void *image __UNUSED__) +{ + return EVAS_IMAGE_SCALE_HINT_NONE; +} + +static void +eng_image_cache_flush(void *data __UNUSED__) +{ + evas_cache_image_flush(evas_common_soft8_image_cache_get()); +} + +static void +eng_image_cache_set(void *data __UNUSED__, int bytes) +{ + evas_cache_image_set(evas_common_soft8_image_cache_get(), bytes); +} + +static int +eng_image_cache_get(void *data __UNUSED__) +{ + return evas_cache_image_get(evas_common_soft8_image_cache_get()); +} + +static void * +eng_font_load(void *data __UNUSED__, const char *name, int size) +{ + return evas_common_font_load(name, size); +} + +static void * +eng_font_memory_load(void *data __UNUSED__, char *name, int size, + const void *fdata, int fdata_size) +{ + return evas_common_font_memory_load(name, size, fdata, fdata_size); +} + +static void * +eng_font_add(void *data __UNUSED__, void *font, const char *name, int size) +{ + return evas_common_font_add(font, name, size); +} + +static void * +eng_font_memory_add(void *data __UNUSED__, void *font, char *name, int size, + const void *fdata, int fdata_size) +{ + return evas_common_font_memory_add(font, name, size, fdata, fdata_size); +} + +static void +eng_font_free(void *data __UNUSED__, void *font) +{ + evas_common_font_free(font); +} + +static int +eng_font_ascent_get(void *data __UNUSED__, void *font) +{ + return evas_common_font_ascent_get(font); +} + +static int +eng_font_descent_get(void *data __UNUSED__, void *font) +{ + return evas_common_font_descent_get(font); +} + +static int +eng_font_max_ascent_get(void *data __UNUSED__, void *font) +{ + return evas_common_font_max_ascent_get(font); +} + +static int +eng_font_max_descent_get(void *data __UNUSED__, void *font) +{ + return evas_common_font_max_descent_get(font); +} + +static void +eng_font_string_size_get(void *data __UNUSED__, void *font, const char *text, + int *w, int *h) +{ + evas_common_font_query_size(font, text, w, h); +} + +static int +eng_font_inset_get(void *data __UNUSED__, void *font, const char *text) +{ + return evas_common_font_query_inset(font, text); +} + +static int +eng_font_h_advance_get(void *data __UNUSED__, void *font, const char *text) +{ + int h, v; + + evas_common_font_query_advance(font, text, &h, &v); + return h; +} + +static int +eng_font_v_advance_get(void *data __UNUSED__, void *font, const char *text) +{ + int h, v; + + evas_common_font_query_advance(font, text, &h, &v); + return v; +} + +static int +eng_font_char_coords_get(void *data __UNUSED__, void *font, const char *text, + int pos, int *cx, int *cy, int *cw, int *ch) +{ + return evas_common_font_query_char_coords(font, text, pos, cx, cy, cw, ch); +} + +static int +eng_font_char_at_coords_get(void *data __UNUSED__, void *font, const char *text, + int x, int y, int *cx, int *cy, int *cw, int *ch) +{ + return evas_common_font_query_text_at_pos(font, text, x, y, cx, cy, cw, ch); +} + +static int +eng_font_last_up_to_pos(void *data __UNUSED__, void *font, const char *text, + int x, int y) +{ + return evas_common_font_query_last_up_to_pos(font, text, x, y); +} + +static void +eng_font_draw(void *data __UNUSED__, void *context, void *surface, void *font, + int x, int y, int w, int h, int ow, int oh, const char *text) +{ + static RGBA_Image *im = NULL; + Soft8_Image *dst = surface; + + if (!im) + im = (RGBA_Image *) + evas_cache_image_empty(evas_common_soft8_image_cache_get()); + evas_cache_image_surface_alloc(&im->cache_entry, dst->cache_entry.w, + dst->cache_entry.h); + evas_common_draw_context_font_ext_set(context, surface, soft8_font_glyph_new, + soft8_font_glyph_free, + soft8_font_glyph_draw); + evas_common_font_draw(im, context, font, x, y, text); + evas_common_draw_context_font_ext_set(context, NULL, NULL, NULL, NULL); +} + +static void +eng_font_cache_flush(void *data __UNUSED__) +{ + evas_common_font_flush(); +} + +static void +eng_font_cache_set(void *data __UNUSED__, int bytes) +{ + evas_common_font_cache_set(bytes); +} + +static int +eng_font_cache_get(void *data __UNUSED__) +{ + return evas_common_font_cache_get(); +} + +static void +eng_font_hinting_set(void *data __UNUSED__, void *font, int hinting) +{ + evas_common_font_hinting_set(font, hinting); +} + +static int +eng_font_hinting_can_hint(void *data __UNUSED__, int hinting) +{ + return evas_common_hinting_available(hinting); +} + +static Eina_Bool +eng_canvas_alpha_get(void *data __UNUSED__, void *context __UNUSED__) +{ + return EINA_TRUE; +} + +/* + ***** + ** + ** ENGINE API + ** + ***** + */ + +static Evas_Func func = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + eng_output_dump, + /* draw context virtual methods */ + eng_context_new, + eng_canvas_alpha_get, + eng_context_free, + eng_context_clip_set, + eng_context_clip_clip, + eng_context_clip_unset, + eng_context_clip_get, + eng_context_color_set, + eng_context_color_get, + eng_context_multiplier_set, + eng_context_multiplier_unset, + eng_context_multiplier_get, + eng_context_cutout_add, + eng_context_cutout_clear, + eng_context_anti_alias_set, + eng_context_anti_alias_get, + eng_context_color_interpolation_set, + eng_context_color_interpolation_get, + eng_context_render_op_set, + eng_context_render_op_get, + /* rect draw funcs */ + eng_rectangle_draw, + /* line draw funcs */ + eng_line_draw, + /* polygon draw funcs */ + eng_polygon_point_add, + eng_polygon_points_clear, + eng_polygon_draw, + /* gradient draw funcs */ + eng_gradient2_color_np_stop_insert, + eng_gradient2_clear, + eng_gradient2_fill_transform_set, + eng_gradient2_fill_spread_set, + + eng_gradient2_linear_new, + eng_gradient2_linear_free, + eng_gradient2_linear_fill_set, + eng_gradient2_linear_is_opaque, + eng_gradient2_linear_is_visible, + eng_gradient2_linear_render_pre, + eng_gradient2_linear_render_post, + eng_gradient2_linear_draw, + + eng_gradient2_radial_new, + eng_gradient2_radial_free, + eng_gradient2_radial_fill_set, + eng_gradient2_radial_is_opaque, + eng_gradient2_radial_is_visible, + eng_gradient2_radial_render_pre, + eng_gradient2_radial_render_post, + eng_gradient2_radial_draw, + + eng_gradient_new, + eng_gradient_free, + eng_gradient_color_stop_add, + eng_gradient_alpha_stop_add, + eng_gradient_color_data_set, + eng_gradient_alpha_data_set, + eng_gradient_clear, + eng_gradient_fill_set, + eng_gradient_fill_angle_set, + eng_gradient_fill_spread_set, + eng_gradient_angle_set, + eng_gradient_offset_set, + eng_gradient_direction_set, + eng_gradient_type_set, + eng_gradient_is_opaque, + eng_gradient_is_visible, + eng_gradient_render_pre, + eng_gradient_render_post, + eng_gradient_draw, + /* image draw funcs */ + eng_image_load, + eng_image_new_from_data, + eng_image_new_from_copied_data, + eng_image_free, + eng_image_size_get, + eng_image_size_set, + eng_image_stride_get, + eng_image_dirty_region, + eng_image_data_get, + eng_image_data_put, + eng_image_data_preload_request, + eng_image_data_preload_cancel, + eng_image_alpha_set, + eng_image_alpha_get, + eng_image_border_set, + eng_image_border_get, + eng_image_draw, + eng_image_comment_get, + eng_image_format_get, + eng_image_colorspace_set, + eng_image_colorspace_get, + eng_image_native_set, + eng_image_native_get, + /* image cache funcs */ + eng_image_cache_flush, + eng_image_cache_set, + eng_image_cache_get, + /* font draw functions */ + eng_font_load, + eng_font_memory_load, + eng_font_add, + eng_font_memory_add, + eng_font_free, + eng_font_ascent_get, + eng_font_descent_get, + eng_font_max_ascent_get, + eng_font_max_descent_get, + eng_font_string_size_get, + eng_font_inset_get, + eng_font_h_advance_get, + eng_font_v_advance_get, + eng_font_char_coords_get, + eng_font_char_at_coords_get, + eng_font_draw, + /* font cache functions */ + eng_font_cache_flush, + eng_font_cache_set, + eng_font_cache_get, + /* font hinting functions */ + eng_font_hinting_set, + eng_font_hinting_can_hint, + eng_image_scale_hint_set, + eng_image_scale_hint_get, + /* more font draw functions */ + eng_font_last_up_to_pos + /* FUTURE software generic calls go here */ +// ORD(image_map4_draw); +// ORD(image_map_surface_new); +// ORD(image_map_surface_free); + /* FUTURE software generic calls go here */ +}; + +/* + ***** + ** + ** MODULE ACCESSIBLE API API + ** + ***** + */ + +static int +module_open(Evas_Module * em) +{ + if (!em) + return 0; + _evas_soft8_log_dom = + eina_log_domain_register("Soft8Engine", EVAS_DEFAULT_LOG_COLOR); + if (_evas_soft8_log_dom < 0) + { + EINA_LOG_ERR + ("Impossible to create a log domain for the soft8 Engine.\n"); + return 0; + } + em->functions = (void *)(&func); + + return 1; +} + +static void +module_close(Evas_Module * em) +{ + eina_log_domain_unregister(_evas_soft8_log_dom); +} + +static Evas_Module_Api evas_modapi = { + EVAS_MODULE_API_VERSION, + "software_8", + "none", + { + module_open, + module_close} +}; + +EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, software_8); + +#ifndef EVAS_STATIC_BUILD_SOFTWARE_8 +EVAS_EINA_MODULE_DEFINE(engine, software_8); +#endif diff --git a/legacy/evas/src/modules/engines/software_8_x11/Evas_Engine_Software_8_X11.h b/legacy/evas/src/modules/engines/software_8_x11/Evas_Engine_Software_8_X11.h new file mode 100644 index 0000000000..fac3d8e71d --- /dev/null +++ b/legacy/evas/src/modules/engines/software_8_x11/Evas_Engine_Software_8_X11.h @@ -0,0 +1,38 @@ +#ifndef _EVAS_ENGINE_SOFTWARE_8_X11_H +#define _EVAS_ENGINE_SOFTWARE_8_X11_H + +#include + +typedef struct _Evas_Engine_Info_Software_8_X11 Evas_Engine_Info_Software_8_X11; + +struct _Evas_Engine_Info_Software_8_X11 +{ + /* PRIVATE - don't mess with this baby or evas will poke its tongue out */ + /* at you and make nasty noises */ + Evas_Engine_Info magic; + + /* engine specific data & parameters it needs to set up */ + struct { + xcb_connection_t *connection; + xcb_drawable_t drawable; + xcb_gcontext_t gc; + xcb_screen_t *screen; + + unsigned int mask; + void *visual; + unsigned int colormap; + int depth; + int rotation; + + int alloc_grayscale : 1; + int debug : 1; + int shape_dither : 1; + int destination_alpha : 1; + int track_mask_changes : 1; + } info; + + /* non-blocking or blocking mode */ + Evas_Engine_Render_Mode render_mode; +}; + +#endif diff --git a/legacy/evas/src/modules/engines/software_8_x11/Makefile.am b/legacy/evas/src/modules/engines/software_8_x11/Makefile.am new file mode 100644 index 0000000000..b4e6b8a07f --- /dev/null +++ b/legacy/evas/src/modules/engines/software_8_x11/Makefile.am @@ -0,0 +1,47 @@ + +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I. \ +-I$(top_srcdir)/src/lib \ +-I$(top_srcdir)/src/lib/include \ +-I$(top_srcdir)/src/modules/engines \ +-I$(top_srcdir)/src/modules/engines/software_8 \ +@FREETYPE_CFLAGS@ \ +@EINA_CFLAGS@ \ +@evas_engine_software_8_x11_cflags@ \ +-I/usr/include/pixman-1 + +if BUILD_ENGINE_SOFTWARE_8_X11 + +SOFTWARE_8_X11_SOURCES = \ +evas_engine.c \ +evas_x_buffer.c + +SOFTWARE_8_X11_LIBADD = @evas_engine_software_8_x11_libs@ + +pkgdir = $(libdir)/evas/modules/engines/software_8_x11/$(MODULE_ARCH) + +include_HEADERS = Evas_Engine_Software_8_X11.h + +if !EVAS_STATIC_BUILD_SOFTWARE_8_X11 + +pkg_LTLIBRARIES = module.la + +module_la_SOURCES = $(SOFTWARE_8_X11_SOURCES) +module_la_LIBADD = @EINA_LIBS@ $(SOFTWARE_8_X11_LIBADD) $(top_builddir)/src/lib/libevas.la +#-lxcb-image -lxcb-shm -lxcb -lpixman-1 +module_la_LDFLAGS = -no-undefined -module -avoid-version +module_la_LIBTOOLFLAGS = --tag=disable-static + +else + +noinst_LTLIBRARIES = libevas_engine_software_8_x11.la + +libevas_engine_software_8_x11_la_SOURCES = $(SOFTWARE_8_X11_SOURCES) +libevas_engine_software_8_x11_la_LIBADD = $(SOFTWARE_8_X11_LIBADD) + +endif +endif + +EXTRA_DIST = evas_engine.h diff --git a/legacy/evas/src/modules/engines/software_8_x11/evas_engine.c b/legacy/evas/src/modules/engines/software_8_x11/evas_engine.c new file mode 100644 index 0000000000..e23550347d --- /dev/null +++ b/legacy/evas/src/modules/engines/software_8_x11/evas_engine.c @@ -0,0 +1,700 @@ +#include "evas_common.h" +#include "evas_private.h" +#include "evas_engine.h" +#include "Evas_Engine_Software_8_X11.h" +#include "evas_common_soft8.h" +#include + +int _evas_engine_soft8_x11_log_dom = -1; +/* function tables - filled in later (func and parent func) */ +static Evas_Func func, pfunc; + +/* engine struct data */ +typedef struct _Render_Engine Render_Engine; + +struct _Render_Engine { + xcb_connection_t *connection; + xcb_drawable_t drawable; + xcb_screen_t *screen; + unsigned char pal[256]; + int depth; + + int w, h, rot; + Tilebuf *tb; + Tilebuf_Rect *rects; + Tilebuf_Rect *cur_rect; + + X_Output_Buffer *shbuf; + Soft8_Image *tmp_out; /* used by indirect render, like rotation */ + + pixman_region16_t *clip_rects; + unsigned char end:1; + unsigned char shm:1; +}; + +/* prototypes we will use here */ + +static void *eng_info(Evas * e); +static void eng_info_free(Evas * e, void *info); +static int eng_setup(Evas * e, void *info); +static void eng_output_free(void *data); +static void eng_output_resize(void *data, int w, int h); +static void eng_output_tile_size_set(void *data, int w, int h); +static void eng_output_redraws_rect_add(void *data, int x, int y, int w, int h); +static void eng_output_redraws_rect_del(void *data, int x, int y, int w, int h); +static void eng_output_redraws_clear(void *data); +static void *eng_output_redraws_next_update_get(void *data, int *x, int *y, + int *w, int *h, int *cx, + int *cy, int *cw, int *ch); +static void eng_output_redraws_next_update_push(void *data, void *surface, + int x, int y, int w, int h); +static void eng_output_flush(void *data); +static void eng_output_idle_flush(void *data); + +/* engine api this module provides */ +static void * +eng_info(Evas * e) +{ + Evas_Engine_Info_Software_8_X11 *info; + + info = calloc(1, sizeof(Evas_Engine_Info_Software_8_X11)); + if (!info) + return NULL; + info->magic.magic = rand(); + info->render_mode = EVAS_RENDER_MODE_BLOCKING; + return info; + e = NULL; +} + +static void +eng_info_free(Evas * e __UNUSED__, void *info) +{ + Evas_Engine_Info_Software_8_X11 *in; + in = (Evas_Engine_Info_Software_8_X11 *) info; + free(in); +} + +static void +_tmp_out_alloc(Render_Engine * re) +{ + Tilebuf_Rect *r; + int w = 0, h = 0; + + EINA_INLIST_FOREACH(re->rects, r) + { + if (r->w > w) + w = r->w; + if (r->h > h) + h = r->h; + } + + if (re->tmp_out) + { + if ((re->tmp_out->cache_entry.w < w) + || (re->tmp_out->cache_entry.h < h)) + { + evas_cache_image_drop(&re->tmp_out->cache_entry); + re->tmp_out = NULL; + } + } + + if (!re->tmp_out) + { + Soft8_Image *im; + + im = (Soft8_Image *) + evas_cache_image_empty(evas_common_soft8_image_cache_get()); + im->cache_entry.flags.alpha = 0; + evas_cache_image_surface_alloc(&im->cache_entry, w, h); + + re->tmp_out = im; + } +} + +static void +alloc_colors(Render_Engine * re) +{ + xcb_alloc_color_cookie_t color_rq[256]; + xcb_alloc_color_reply_t *rep; + xcb_colormap_t colormap = re->screen->default_colormap; + + int i; + for (i = 0; i < 256; i++) + color_rq[i] = + xcb_alloc_color(re->connection, colormap, i << 8, i << 8, i << 8); + + for (i = 0; i < 256; i++) + { + rep = xcb_alloc_color_reply(re->connection, color_rq[i], NULL); + re->pal[i] = rep->pixel; + free(rep); + } +} + +static int +eng_setup(Evas * e, void *in) +{ + Render_Engine *re; + Evas_Engine_Info_Software_8_X11 *info; +/* X_Output_Buffer *xob; */ + + info = (Evas_Engine_Info_Software_8_X11 *) in; + if (!e->engine.data.output) + { + /* the only check - simplistic, i know, but enough for this + * "special purpose" engine. Remember it is meant to be used + * for limited power devices that have a 8bit display mode + * and no real other acceleration, and high resolution so we + * can pre-dither into 8bpp. */ +// if (DefaultDepth(info->info.display, +// DefaultScreen(info->info.display)) != 8) +// return; + /* do common routine init - we wil at least use it for core + * image loading and font loading/glyph rendering & placement */ + evas_common_cpu_init(); + + evas_common_blend_init(); + evas_common_image_init(); + evas_common_convert_init(); + evas_common_scale_init(); + evas_common_rectangle_init(); + evas_common_gradient_init(); + evas_common_polygon_init(); + evas_common_line_init(); + evas_common_font_init(); + evas_common_draw_init(); + evas_common_tilebuf_init(); + evas_common_soft8_image_init(); + + /* render engine specific data */ + re = calloc(1, sizeof(Render_Engine)); + if (!re) + return 0; + e->engine.data.output = re; + re->connection = info->info.connection; + re->screen = info->info.screen; + re->drawable = info->info.drawable; + re->depth = info->info.depth; + re->w = e->output.w; + re->h = e->output.h; + re->rot = info->info.rotation; + re->tb = evas_common_tilebuf_new(e->output.w, e->output.h); + if (re->tb) + evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE); + alloc_colors(re); + } + else + { + /* we changed the info after first init - do a re-eval where + * appropriate */ + re = e->engine.data.output; + if (re->tb) + evas_common_tilebuf_free(re->tb); + re->connection = info->info.connection; + re->screen = info->info.screen; + re->drawable = info->info.drawable; + re->w = e->output.w; + re->h = e->output.h; + re->rot = info->info.rotation; + re->tb = evas_common_tilebuf_new(e->output.w, e->output.h); + if (re->tb) + evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE); + if (re->tmp_out) + { + evas_cache_image_drop(&re->tmp_out->cache_entry); + re->tmp_out = NULL; + } + alloc_colors(re); + } + if (!e->engine.data.output) + return 0; + + /* add a draw context if we dont have one */ + if (!e->engine.data.context) + e->engine.data.context = + e->engine.func->context_new(e->engine.data.output); + /* check if the display can do shm */ + re->shm = evas_software_x11_x_can_do_shm(re->connection, re->screen); + + return 1; +} + +static void +eng_output_free(void *data) +{ + Render_Engine *re; + + re = (Render_Engine *) data; + if (re->shbuf) + evas_software_x11_x_output_buffer_free(re->shbuf, 0); + if (re->clip_rects) + { + pixman_region_fini(re->clip_rects); + free(re->clip_rects); + re->clip_rects = NULL; + } + if (re->tb) + evas_common_tilebuf_free(re->tb); + if (re->rects) + evas_common_tilebuf_free_render_rects(re->rects); + if (re->tmp_out) + evas_cache_image_drop(&re->tmp_out->cache_entry); + free(re); + + evas_common_font_shutdown(); + evas_common_image_shutdown(); + evas_common_soft8_image_shutdown(); +} + +static void +eng_output_resize(void *data, int w, int h) +{ + Render_Engine *re; + + re = (Render_Engine *) data; + + if ((re->w == w) && (re->h == h)) + return; + + evas_common_tilebuf_free(re->tb); + re->w = w; + re->h = h; + re->tb = evas_common_tilebuf_new(w, h); + if (re->tb) + evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE); + if (re->shbuf) + { + evas_software_x11_x_output_buffer_free(re->shbuf, 0); + re->shbuf = NULL; + } + if (re->clip_rects) + { + pixman_region_fini(re->clip_rects); + free(re->clip_rects); + re->clip_rects = NULL; + } + + if (re->tmp_out) + { + evas_cache_image_drop(&re->tmp_out->cache_entry); + re->tmp_out = NULL; + } +} + +static void +eng_output_tile_size_set(void *data, int w, int h) +{ + Render_Engine *re; + + re = (Render_Engine *) data; + evas_common_tilebuf_set_tile_size(re->tb, w, h); +} + +static void +eng_output_redraws_rect_add(void *data, int x, int y, int w, int h) +{ + Render_Engine *re; + + re = (Render_Engine *) data; + evas_common_tilebuf_add_redraw(re->tb, x, y, w, h); +} + +static void +eng_output_redraws_rect_del(void *data, int x, int y, int w, int h) +{ + Render_Engine *re; + + re = (Render_Engine *) data; + evas_common_tilebuf_del_redraw(re->tb, x, y, w, h); +} + +static void +eng_output_redraws_clear(void *data) +{ + Render_Engine *re; + + re = (Render_Engine *) data; + evas_common_tilebuf_clear(re->tb); +} + +static inline void +_output_buffer_alloc(Render_Engine * re) +{ + int w, h; + if (re->shbuf) + return; + + if ((re->rot == 0) || (re->rot == 180)) + { + w = re->w; + h = re->h; + } + else + { + w = re->h; + h = re->w; + } + + re->shbuf = evas_software_x11_x_output_buffer_new + (re->connection, re->screen, re->depth, re->pal, w, h, 1, NULL); + + re->shbuf->drawable = re->drawable; + re->shbuf->screen = re->screen; + if (re->shbuf->gc) + { + xcb_free_gc(re->shbuf->connection, re->shbuf->gc); + re->shbuf->gc = 0; + } + + re->shbuf->gc = xcb_generate_id(re->shbuf->connection); + xcb_create_gc(re->shbuf->connection, re->shbuf->gc, re->shbuf->drawable, 0, + NULL); +} + +static void * +eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, + int *cx, int *cy, int *cw, int *ch) +{ + Render_Engine *re; + Tilebuf_Rect *rect; + int ux, uy, uw, uh; + + re = (Render_Engine *) data; + if (re->end) + { + re->end = 0; + return NULL; + } + if (!re->rects) + { + re->rects = evas_common_tilebuf_get_render_rects(re->tb); + if (!re->rects) + return NULL; + + re->cur_rect = re->rects; + _output_buffer_alloc(re); + if (re->rot != 0) + _tmp_out_alloc(re); /* grows if required */ + } + if (!re->cur_rect) + { + if (re->rects) + evas_common_tilebuf_free_render_rects(re->rects); + re->rects = NULL; + return NULL; + } + rect = re->cur_rect; + ux = rect->x; + uy = rect->y; + uw = rect->w; + uh = rect->h; + re->cur_rect = (Tilebuf_Rect *) ((EINA_INLIST_GET(re->cur_rect))->next); + if (!re->cur_rect) + { + evas_common_tilebuf_free_render_rects(re->rects); + re->rects = NULL; + re->end = 1; + } + + *x = ux; + *y = uy; + *w = uw; + *h = uh; + if (re->rot == 0) + { + *cx = ux; + *cy = uy; + *cw = uw; + *ch = uh; + return re->shbuf->im; + } + else + { + *cx = 0; + *cy = 0; + *cw = uw; + *ch = uh; + return re->tmp_out; + } +} + +static void +_blit_rot_90(Soft8_Image * dst, const Soft8_Image * src, + int out_x, int out_y, int w, int h) +{ + DATA8 *dp, *sp; + int x, y; + + sp = src->pixels; + dp = dst->pixels + (out_x + (w + out_y - 1) * dst->stride); + + for (y = 0; y < h; y++) + { + DATA8 *dp_itr, *sp_itr; + + sp_itr = sp; + dp_itr = dp; + + for (x = 0; x < w; x++) + { + *dp_itr = *sp_itr; + + sp_itr++; + dp_itr -= dst->stride; + } + sp += src->stride; + dp++; + } +} + +static void +_blit_rot_180(Soft8_Image * dst, const Soft8_Image * src, + int out_x, int out_y, int w, int h) +{ + DATA8 *dp, *sp; + int x, y; + + sp = src->pixels; + dp = dst->pixels + ((w + out_x - 1) + (h + out_y - 1) * dst->stride); + + for (y = 0; y < h; y++) + { + DATA8 *dp_itr, *sp_itr; + + sp_itr = sp; + dp_itr = dp; + + for (x = 0; x < w; x++) + { + *dp_itr = *sp_itr; + + sp_itr++; + dp_itr--; + } + sp += src->stride; + dp -= dst->stride; + } +} + +static void +_blit_rot_270(Soft8_Image * dst, const Soft8_Image * src, + int out_x, int out_y, int w, int h) +{ + DATA8 *dp, *sp; + int x, y; + + sp = src->pixels; + dp = dst->pixels + ((h + out_x - 1) + out_y * dst->stride); + + for (y = 0; y < h; y++) + { + DATA8 *dp_itr, *sp_itr; + + sp_itr = sp; + dp_itr = dp; + + for (x = 0; x < w; x++) + { + *dp_itr = *sp_itr; + + sp_itr++; + dp_itr += dst->stride; + } + sp += src->stride; + dp--; + } +} + +static void +_tmp_out_process(Render_Engine * re, int out_x, int out_y, int w, int h) +{ + Soft8_Image *d, *s; + + d = re->shbuf->im; + s = re->tmp_out; + + if ((w < 1) || (h < 1) || (out_x >= d->cache_entry.w) + || (out_y >= d->cache_entry.h)) + return; + + if (re->rot == 90) + _blit_rot_90(d, s, out_x, out_y, w, h); + else if (re->rot == 180) + _blit_rot_180(d, s, out_x, out_y, w, h); + else if (re->rot == 270) + _blit_rot_270(d, s, out_x, out_y, w, h); +} + +static void +eng_output_redraws_next_update_push(void *data, void *surface __UNUSED__, int x, + int y, int w, int h) +{ + Render_Engine *re; + struct { + int x, y, width, height; + } r = + { + 0, 0, 0, 0}; + + re = (Render_Engine *) data; + + if (!re->clip_rects) + { + re->clip_rects = + (pixman_region16_t *) malloc(sizeof(pixman_region16_t)); + pixman_region_init(re->clip_rects); + } + + if (re->rot == 0) + { + r.x = x; + r.y = y; + r.width = w; + r.height = h; + } + else if (re->rot == 90) + { + r.x = y; + r.y = re->w - w - x; + r.width = h; + r.height = w; + } + else if (re->rot == 180) + { + r.x = re->w - w - x; + r.y = re->h - h - y; + r.width = w; + r.height = h; + } + else if (re->rot == 270) + { + r.x = re->h - h - y; + r.y = x; + r.width = h; + r.height = w; + } + + if (re->rot != 0) + _tmp_out_process(re, r.x, r.y, w, h); + + pixman_region_union_rect(re->clip_rects, re->clip_rects, + r.x, r.y, r.width, r.height); +} + +static void +eng_output_flush(void *data) +{ + Render_Engine *re; + + re = (Render_Engine *) data; + + if (re->clip_rects) + { + re->shbuf->drawable = re->drawable; + { + int i; + pixman_box16_t *rects = + pixman_region_rectangles(re->clip_rects, NULL); + for (i = 0; i < pixman_region_n_rects(re->clip_rects); i++, rects++) + evas_software_x11_x_output_buffer_paste + (re->shbuf, re->drawable, re->shbuf->gc, rects->x1, rects->y1, + rects->x2 - rects->x1, rects->y2 - rects->y1, 1); + } + + pixman_region_fini(re->clip_rects); + free(re->clip_rects); + re->clip_rects = NULL; + } +} + +static void +eng_output_idle_flush(void *data) +{ + Render_Engine *re; + + re = (Render_Engine *) data; + if (re->shbuf) + { + evas_software_x11_x_output_buffer_free(re->shbuf, 0); + re->shbuf = NULL; + } + if (re->clip_rects) + { + pixman_region_fini(re->clip_rects); + free(re->clip_rects); + re->clip_rects = NULL; + } + if (re->tmp_out) + { + evas_cache_image_drop(&re->tmp_out->cache_entry); + re->tmp_out = NULL; + } +} + +static Eina_Bool +eng_canvas_alpha_get(void *data __UNUSED__, void *context __UNUSED__) +{ + return EINA_FALSE; +} + +/* module advertising code */ +static int +module_open(Evas_Module * em) +{ + if (!em) + return 0; + /* get whatever engine module we inherit from */ + if (!_evas_module_engine_inherit(&pfunc, "software_8")) + return 0; + _evas_engine_soft8_x11_log_dom = + eina_log_domain_register("EvasSoft8X11", EVAS_DEFAULT_LOG_COLOR); + if (_evas_engine_soft8_x11_log_dom < 0) + { + EINA_LOG_ERR + ("Impossible to create a log domain for the Soft8_X11 engine.\n"); + return 0; + } + + /* store it for later use */ + func = pfunc; + /* now to override methods */ +#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_) + ORD(info); + ORD(info_free); + ORD(setup); + ORD(canvas_alpha_get); + ORD(output_free); + ORD(output_resize); + ORD(output_tile_size_set); + ORD(output_redraws_rect_add); + ORD(output_redraws_rect_del); + ORD(output_redraws_clear); + ORD(output_redraws_next_update_get); + ORD(output_redraws_next_update_push); + ORD(output_flush); + ORD(output_idle_flush); + /* now advertise out own api */ + em->functions = (void *)(&func); + return 1; +} + +static void +module_close(Evas_Module * em) +{ + eina_log_domain_unregister(_evas_engine_soft8_x11_log_dom); +} + +static Evas_Module_Api evas_modapi = { + EVAS_MODULE_API_VERSION, + "software_8_x11", + "none", + { + module_open, + module_close} +}; + +EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, software_8_x11); + +#ifndef EVAS_STATIC_BUILD_SOFTWARE_8_X11 +EVAS_EINA_MODULE_DEFINE(engine, software_8_x11); +#endif diff --git a/legacy/evas/src/modules/engines/software_8_x11/evas_engine.h b/legacy/evas/src/modules/engines/software_8_x11/evas_engine.h new file mode 100644 index 0000000000..14082717de --- /dev/null +++ b/legacy/evas/src/modules/engines/software_8_x11/evas_engine.h @@ -0,0 +1,67 @@ +#ifndef EVAS_ENGINE_H +#define EVAS_ENGINE_H + +#include +#include + +#include +#include +#include + +#include "evas_common.h" +#include "evas_common_soft8.h" + +extern int _evas_engine_soft8_x11_log_dom; +#ifdef ERR +# undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_evas_engine_soft8_x11_log_dom, __VA_ARGS__) + +#ifdef DBG +# undef DBG +#endif +#define DBG(...) EINA_LOG_DOM_DBG(_evas_engine_soft8_x11_log_dom, __VA_ARGS__) + +#ifdef INF +# undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_evas_engine_soft8_x11_log_dom, __VA_ARGS__) + +#ifdef WRN +# undef WRN +#endif +#define WRN(...) EINA_LOG_DOM_WARN(_evas_engine_soft8_x11_log_dom, __VA_ARGS__) + +#ifdef CRIT +# undef CRIT +#endif +#define CRIT(...) EINA_LOG_DOM_CRIT(_evas_engine_soft8_x11_log_dom, __VA_ARGS__) + +typedef struct _X_Output_Buffer X_Output_Buffer; + +struct _X_Output_Buffer +{ + Soft8_Image *im; + xcb_connection_t *connection; + xcb_screen_t *screen; + xcb_image_t *xim; + xcb_drawable_t drawable; + xcb_gcontext_t gc; + xcb_shm_segment_info_t *shm_info; + unsigned char *pal; + void *data; +}; + +/****/ +void evas_software_x11_x_init (void); + +int evas_software_x11_x_can_do_shm (xcb_connection_t *c, xcb_screen_t *screen); +X_Output_Buffer *evas_software_x11_x_output_buffer_new (xcb_connection_t *, xcb_screen_t *screen, int depth, unsigned char *pal, int w, int h, int try_shm, void *data); +void evas_software_x11_x_output_buffer_free (X_Output_Buffer *xob, int sync); +void evas_software_x11_x_output_buffer_paste (X_Output_Buffer *xob, xcb_drawable_t d, xcb_gcontext_t gc, int x, int y, int w, int h, int sync); +DATA8 *evas_software_x11_x_output_buffer_data (X_Output_Buffer *xob, int *bytes_per_line_ret); +int evas_software_x11_x_output_buffer_depth (X_Output_Buffer *xob); +int evas_software_x11_x_output_buffer_byte_order (X_Output_Buffer *xob); +int evas_software_x11_x_output_buffer_bit_order (X_Output_Buffer *xob); + +#endif diff --git a/legacy/evas/src/modules/engines/software_8_x11/evas_x_buffer.c b/legacy/evas/src/modules/engines/software_8_x11/evas_x_buffer.c new file mode 100644 index 0000000000..6c6b667c31 --- /dev/null +++ b/legacy/evas/src/modules/engines/software_8_x11/evas_x_buffer.c @@ -0,0 +1,245 @@ +#include "evas_common.h" +#include "evas_engine.h" + +static int _xcb_err = 0; + +int +evas_software_x11_x_can_do_shm(xcb_connection_t * c, xcb_screen_t * screen) +{ + static xcb_connection_t *cached_c = NULL; + static int cached_result = 0; + + if (c == cached_c) + return cached_result; + cached_c = c; + + if (xcb_get_extension_data(c, &xcb_shm_id)) + { + X_Output_Buffer *xob; + + xob = evas_software_x11_x_output_buffer_new(c, + screen, + screen->root_depth, + (unsigned char *)NULL, + 16, 16, 2, NULL); + if (!xob) + { + cached_result = 0; + return 0; + } + evas_software_x11_x_output_buffer_free(xob, 1); + cached_result = 1; + return 1; + } + cached_result = 0; + return 0; +} + +X_Output_Buffer * +evas_software_x11_x_output_buffer_new(xcb_connection_t * c, + xcb_screen_t * s, + int depth, + unsigned char *pal, + int w, int h, int try_shm, void *data) +{ + X_Output_Buffer *xob; + + xob = calloc(1, sizeof(X_Output_Buffer)); + if (!xob) + return NULL; + + xob->connection = c; + xob->screen = s; + xob->xim = NULL; + xob->shm_info = NULL; + xob->pal = pal; + + if (try_shm > 0) + { + xob->shm_info = malloc(sizeof(xcb_shm_segment_info_t)); + if (xob->shm_info) + { + xob->shm_info->shmseg = xcb_generate_id(c); + xob->xim = xcb_image_create_native(c, w, h, + XCB_IMAGE_FORMAT_Z_PIXMAP, + depth, NULL, ~0, NULL); + if (xob->xim) + { + xob->shm_info->shmid = shmget(IPC_PRIVATE, + xob->xim->size, + IPC_CREAT | 0777); + + if (xob->shm_info->shmid >= 0) + { + xob->shm_info->shmaddr = xob->xim->data = + shmat(xob->shm_info->shmid, 0, 0); + + if (xob->shm_info->shmaddr != NULL) + { + /* + * FIXME: no error mechanism + */ + + /* XErrorHandler ph; */ + /* EventHandlers eh; */ + + free(xcb_get_input_focus_reply + (c, xcb_get_input_focus_unchecked(c), NULL)); + _xcb_err = 0; + /* ph = XSetErrorHandler((XErrorHandler) */ + /* x_output_tmp_x_err); */ + xcb_shm_attach(c, + xob->shm_info->shmseg, + xob->shm_info->shmid, 0); + free(xcb_get_input_focus_reply + (c, xcb_get_input_focus_unchecked(c), NULL)); + /* XSetErrorHandler((XErrorHandler)ph); */ + if (!_xcb_err) + { + xob->im = + (Soft8_Image *) + evas_cache_image_data + (evas_common_soft8_image_cache_get(), w, h, + (DATA32 *) xob->xim->data, 0, + EVAS_COLORSPACE_GRY8); + + if (xob->im) + xob->im->stride = + xob->xim->stride / sizeof(DATA8); + return xob; + } + } + shmdt(xob->shm_info->shmaddr); + shmctl(xob->shm_info->shmid, IPC_RMID, 0); + } + if (xob->xim) + xcb_image_destroy(xob->xim); + xob->xim = NULL; + } + if (xob->shm_info) + free(xob->shm_info); + xob->shm_info = NULL; + } + } + + if (try_shm > 1) + return NULL; + + xob->xim = xcb_image_create_native(c, w, h, XCB_IMAGE_FORMAT_Z_PIXMAP, + depth, NULL, ~0, NULL); + if (!xob->xim) + { + free(xob); + return NULL; + } + + xob->data = data; + + if (!xob->xim->data) + { + xob->xim->data = malloc(xob->xim->stride * xob->xim->height); + if (!xob->xim->data) + { + xcb_image_destroy(xob->xim); + free(xob); + return NULL; + } + } + if (xob->im) + evas_cache_image_drop(&xob->im->cache_entry); + + xob->im = + (Soft8_Image *) + evas_cache_image_data(evas_common_soft8_image_cache_get(), w, h, + (DATA32 *) xob->xim->data, 0, + EVAS_COLORSPACE_GRY8); + if (xob->im) + xob->im->stride = xob->xim->stride / sizeof(DATA8); + return xob; +} + +void +evas_software_x11_x_output_buffer_free(X_Output_Buffer * xob, int sync) +{ + if (xob->shm_info) + { + if (sync) + free(xcb_get_input_focus_reply(xob->connection, + xcb_get_input_focus_unchecked(xob-> + connection), + NULL)); + xcb_shm_detach(xob->connection, xob->shm_info->shmseg); + xcb_image_destroy(xob->xim); + shmdt(xob->shm_info->shmaddr); + shmctl(xob->shm_info->shmid, IPC_RMID, 0); + free(xob->shm_info); + } + else + { + if (xob->data) + xob->xim->data = NULL; + free(xob->xim->data); + xcb_image_destroy(xob->xim); + } + free(xob); +} + +void +evas_software_x11_x_output_buffer_paste(X_Output_Buffer * xob, + xcb_drawable_t d, + xcb_gcontext_t gc, + int x, int y, int w, int h, int sync) +{ + unsigned char *data; + int i, j; + + if (xob->shm_info) + { + for (i = y; i < y + h; i++) + { + data = xob->xim->data + i * xob->xim->width + x; + for (j = x; j < x + w; j++, data++) + *data = xob->pal[*data]; + } + + xcb_image_shm_put(xob->connection, d, gc, + xob->xim, *xob->shm_info, x, y, x, y, w, h, 0); + + if (sync) + free(xcb_get_input_focus_reply(xob->connection, + xcb_get_input_focus_unchecked(xob-> + connection), + NULL)); + } + else + { + xcb_image_put(xob->connection, d, gc, xob->xim, x, y, 0); + } +} + +DATA8 * +evas_software_x11_x_output_buffer_data(X_Output_Buffer * xob, + int *bytes_per_line_ret) +{ + if (bytes_per_line_ret) + *bytes_per_line_ret = xob->xim->stride; + return (DATA8 *) xob->xim->data; +} + +int +evas_software_x11_x_output_buffer_depth(X_Output_Buffer * xob) +{ + return xob->xim->bpp; +} + +int +evas_software_x11_x_output_buffer_byte_order(X_Output_Buffer * xob) +{ + return xob->xim->byte_order; +} + +int +evas_software_x11_x_output_buffer_bit_order(X_Output_Buffer * xob) +{ + return xob->xim->bit_order; +}