diff options
author | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
commit | dd7595a3475407a7fa96a97393bae8c5220e8762 (patch) | |
tree | e341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/evas/src/modules/engines/direct3d | |
parent | Add the skeleton. (diff) | |
download | SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2 SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz |
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to 'libraries/evas/src/modules/engines/direct3d')
30 files changed, 5865 insertions, 0 deletions
diff --git a/libraries/evas/src/modules/engines/direct3d/Evas_Engine_Direct3D.h b/libraries/evas/src/modules/engines/direct3d/Evas_Engine_Direct3D.h new file mode 100644 index 0000000..f9b7a9c --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/Evas_Engine_Direct3D.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifndef __EVAS_ENGINE_DIRECT3D_H__ | ||
2 | #define __EVAS_ENGINE_DIRECT3D_H__ | ||
3 | |||
4 | |||
5 | #define WIN32_LEAN_AND_MEAN | ||
6 | #include <windows.h> | ||
7 | #undef WIN32_LEAN_AND_MEAN | ||
8 | |||
9 | typedef struct _Evas_Engine_Info_Direct3D Evas_Engine_Info_Direct3D; | ||
10 | |||
11 | struct _Evas_Engine_Info_Direct3D | ||
12 | { | ||
13 | /* PRIVATE - don't mess with this baby or evas will poke its tongue out */ | ||
14 | /* at you and make nasty noises */ | ||
15 | Evas_Engine_Info magic; | ||
16 | |||
17 | struct { | ||
18 | HWND window; | ||
19 | int rotation; | ||
20 | int depth; | ||
21 | int fullscreen : 1; | ||
22 | int layered : 1; | ||
23 | } info; | ||
24 | |||
25 | struct { | ||
26 | unsigned short width; | ||
27 | unsigned short height; | ||
28 | unsigned char *mask; | ||
29 | } *shape; | ||
30 | |||
31 | /* non-blocking or blocking mode */ | ||
32 | Evas_Engine_Render_Mode render_mode; | ||
33 | }; | ||
34 | |||
35 | |||
36 | #endif /* __EVAS_ENGINE_DIRECT3D_H__ */ | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/Makefile.am b/libraries/evas/src/modules/engines/direct3d/Makefile.am new file mode 100644 index 0000000..cdbfd52 --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/Makefile.am | |||
@@ -0,0 +1,71 @@ | |||
1 | |||
2 | MAINTAINERCLEANFILES = Makefile.in | ||
3 | |||
4 | AM_CPPFLAGS = \ | ||
5 | -I. \ | ||
6 | -I$(top_srcdir)/src/lib \ | ||
7 | -I$(top_srcdir)/src/lib/include \ | ||
8 | -I$(top_srcdir)/src/modules/engines \ | ||
9 | @EINA_CFLAGS@ \ | ||
10 | @FREETYPE_CFLAGS@ \ | ||
11 | @PIXMAN_CFLAGS@ \ | ||
12 | @evas_engine_direct3d_cflags@ | ||
13 | |||
14 | if BUILD_ENGINE_DIRECT3D | ||
15 | |||
16 | DIRECT3D_SOURCES = \ | ||
17 | evas_engine.c \ | ||
18 | evas_direct3d_context.cpp \ | ||
19 | evas_direct3d_device.cpp \ | ||
20 | evas_direct3d_image_cache.cpp \ | ||
21 | evas_direct3d_main.cpp \ | ||
22 | evas_direct3d_object.cpp \ | ||
23 | evas_direct3d_object_font.cpp \ | ||
24 | evas_direct3d_object_image.cpp \ | ||
25 | evas_direct3d_object_line.cpp \ | ||
26 | evas_direct3d_object_rect.cpp \ | ||
27 | evas_direct3d_scene.cpp \ | ||
28 | evas_direct3d_shader_pack.cpp \ | ||
29 | evas_direct3d_vertex_buffer_cache.cpp | ||
30 | |||
31 | DIRECT3D_LIBADD = @evas_engine_direct3d_libs@ | ||
32 | |||
33 | |||
34 | includes_HEADERS = Evas_Engine_Direct3D.h | ||
35 | includesdir = $(includedir)/evas-@VMAJ@ | ||
36 | |||
37 | if !EVAS_STATIC_BUILD_DIRECT3D | ||
38 | |||
39 | pkgdir = $(libdir)/evas/modules/engines/direct3d/$(MODULE_ARCH) | ||
40 | pkg_LTLIBRARIES = module.la | ||
41 | module_la_SOURCES = $(DIRECT3D_SOURCES) | ||
42 | module_la_CXXFLAGS = -fno-exceptions | ||
43 | module_la_LIBADD = $(top_builddir)/src/lib/libevas.la $(DIRECT3D_LIBADD) @EINA_LIBS@ | ||
44 | module_la_LDFLAGS = @lt_enable_auto_import@ -no-undefined -module -avoid-version | ||
45 | module_la_LIBTOOLFLAGS = --tag=disable-static | ||
46 | |||
47 | else | ||
48 | |||
49 | noinst_LTLIBRARIES = libevas_engine_direct3d.la | ||
50 | |||
51 | libevas_engine_direct3d_la_SOURCES = $(DIRECT3D_SOURCES) | ||
52 | libevas_engine_direct3d_la_LIBADD = $(DIRECT3D_LIBADD) | ||
53 | |||
54 | endif | ||
55 | endif | ||
56 | |||
57 | EXTRA_DIST = \ | ||
58 | array.h \ | ||
59 | evas_direct3d_context.h \ | ||
60 | evas_direct3d_device.h \ | ||
61 | evas_direct3d_image_cache.h \ | ||
62 | evas_direct3d_object.h \ | ||
63 | evas_direct3d_object_font.h \ | ||
64 | evas_direct3d_object_image.h \ | ||
65 | evas_direct3d_object_line.h \ | ||
66 | evas_direct3d_object_rect.h \ | ||
67 | evas_direct3d_scene.h \ | ||
68 | evas_direct3d_shader_pack.h \ | ||
69 | evas_direct3d_vertex_buffer_cache.h \ | ||
70 | evas_engine.h \ | ||
71 | ref.h | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/Makefile.in b/libraries/evas/src/modules/engines/direct3d/Makefile.in new file mode 100644 index 0000000..03d892e --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/Makefile.in | |||
@@ -0,0 +1,1021 @@ | |||
1 | # Makefile.in generated by automake 1.11.1 from Makefile.am. | ||
2 | # @configure_input@ | ||
3 | |||
4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, | ||
5 | # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, | ||
6 | # Inc. | ||
7 | # This Makefile.in is free software; the Free Software Foundation | ||
8 | # gives unlimited permission to copy and/or distribute it, | ||
9 | # with or without modifications, as long as this notice is preserved. | ||
10 | |||
11 | # This program is distributed in the hope that it will be useful, | ||
12 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without | ||
13 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
14 | # PARTICULAR PURPOSE. | ||
15 | |||
16 | @SET_MAKE@ | ||
17 | |||
18 | |||
19 | VPATH = @srcdir@ | ||
20 | pkgdatadir = $(datadir)/@PACKAGE@ | ||
21 | pkgincludedir = $(includedir)/@PACKAGE@ | ||
22 | pkglibdir = $(libdir)/@PACKAGE@ | ||
23 | pkglibexecdir = $(libexecdir)/@PACKAGE@ | ||
24 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd | ||
25 | install_sh_DATA = $(install_sh) -c -m 644 | ||
26 | install_sh_PROGRAM = $(install_sh) -c | ||
27 | install_sh_SCRIPT = $(install_sh) -c | ||
28 | INSTALL_HEADER = $(INSTALL_DATA) | ||
29 | transform = $(program_transform_name) | ||
30 | NORMAL_INSTALL = : | ||
31 | PRE_INSTALL = : | ||
32 | POST_INSTALL = : | ||
33 | NORMAL_UNINSTALL = : | ||
34 | PRE_UNINSTALL = : | ||
35 | POST_UNINSTALL = : | ||
36 | build_triplet = @build@ | ||
37 | host_triplet = @host@ | ||
38 | subdir = src/modules/engines/direct3d | ||
39 | DIST_COMMON = $(am__includes_HEADERS_DIST) $(srcdir)/Makefile.am \ | ||
40 | $(srcdir)/Makefile.in | ||
41 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | ||
42 | am__aclocal_m4_deps = $(top_srcdir)/m4/efl_attribute.m4 \ | ||
43 | $(top_srcdir)/m4/efl_coverage.m4 \ | ||
44 | $(top_srcdir)/m4/efl_doxygen.m4 \ | ||
45 | $(top_srcdir)/m4/efl_fnmatch.m4 \ | ||
46 | $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ | ||
47 | $(top_srcdir)/m4/evas_check_engine.m4 \ | ||
48 | $(top_srcdir)/m4/evas_check_loader.m4 \ | ||
49 | $(top_srcdir)/m4/evas_converter.m4 \ | ||
50 | $(top_srcdir)/m4/evas_dither.m4 \ | ||
51 | $(top_srcdir)/m4/evas_scaler.m4 $(top_srcdir)/m4/libtool.m4 \ | ||
52 | $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ | ||
53 | $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ | ||
54 | $(top_srcdir)/configure.ac | ||
55 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ | ||
56 | $(ACLOCAL_M4) | ||
57 | mkinstalldirs = $(install_sh) -d | ||
58 | CONFIG_HEADER = $(top_builddir)/config.h | ||
59 | CONFIG_CLEAN_FILES = | ||
60 | CONFIG_CLEAN_VPATH_FILES = | ||
61 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; | ||
62 | am__vpath_adj = case $$p in \ | ||
63 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ | ||
64 | *) f=$$p;; \ | ||
65 | esac; | ||
66 | am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; | ||
67 | am__install_max = 40 | ||
68 | am__nobase_strip_setup = \ | ||
69 | srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` | ||
70 | am__nobase_strip = \ | ||
71 | for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" | ||
72 | am__nobase_list = $(am__nobase_strip_setup); \ | ||
73 | for p in $$list; do echo "$$p $$p"; done | \ | ||
74 | sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ | ||
75 | $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ | ||
76 | if (++n[$$2] == $(am__install_max)) \ | ||
77 | { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ | ||
78 | END { for (dir in files) print dir, files[dir] }' | ||
79 | am__base_list = \ | ||
80 | sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ | ||
81 | sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | ||
82 | am__installdirs = "$(DESTDIR)$(pkgdir)" "$(DESTDIR)$(includesdir)" | ||
83 | LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) | ||
84 | am__DEPENDENCIES_1 = | ||
85 | @BUILD_ENGINE_DIRECT3D_TRUE@@EVAS_STATIC_BUILD_DIRECT3D_TRUE@libevas_engine_direct3d_la_DEPENDENCIES = $(am__DEPENDENCIES_1) | ||
86 | am__libevas_engine_direct3d_la_SOURCES_DIST = evas_engine.c \ | ||
87 | evas_direct3d_context.cpp evas_direct3d_device.cpp \ | ||
88 | evas_direct3d_image_cache.cpp evas_direct3d_main.cpp \ | ||
89 | evas_direct3d_object.cpp evas_direct3d_object_font.cpp \ | ||
90 | evas_direct3d_object_image.cpp evas_direct3d_object_line.cpp \ | ||
91 | evas_direct3d_object_rect.cpp evas_direct3d_scene.cpp \ | ||
92 | evas_direct3d_shader_pack.cpp \ | ||
93 | evas_direct3d_vertex_buffer_cache.cpp | ||
94 | @BUILD_ENGINE_DIRECT3D_TRUE@am__objects_1 = evas_engine.lo \ | ||
95 | @BUILD_ENGINE_DIRECT3D_TRUE@ evas_direct3d_context.lo \ | ||
96 | @BUILD_ENGINE_DIRECT3D_TRUE@ evas_direct3d_device.lo \ | ||
97 | @BUILD_ENGINE_DIRECT3D_TRUE@ evas_direct3d_image_cache.lo \ | ||
98 | @BUILD_ENGINE_DIRECT3D_TRUE@ evas_direct3d_main.lo \ | ||
99 | @BUILD_ENGINE_DIRECT3D_TRUE@ evas_direct3d_object.lo \ | ||
100 | @BUILD_ENGINE_DIRECT3D_TRUE@ evas_direct3d_object_font.lo \ | ||
101 | @BUILD_ENGINE_DIRECT3D_TRUE@ evas_direct3d_object_image.lo \ | ||
102 | @BUILD_ENGINE_DIRECT3D_TRUE@ evas_direct3d_object_line.lo \ | ||
103 | @BUILD_ENGINE_DIRECT3D_TRUE@ evas_direct3d_object_rect.lo \ | ||
104 | @BUILD_ENGINE_DIRECT3D_TRUE@ evas_direct3d_scene.lo \ | ||
105 | @BUILD_ENGINE_DIRECT3D_TRUE@ evas_direct3d_shader_pack.lo \ | ||
106 | @BUILD_ENGINE_DIRECT3D_TRUE@ evas_direct3d_vertex_buffer_cache.lo | ||
107 | @BUILD_ENGINE_DIRECT3D_TRUE@@EVAS_STATIC_BUILD_DIRECT3D_TRUE@am_libevas_engine_direct3d_la_OBJECTS = $(am__objects_1) | ||
108 | libevas_engine_direct3d_la_OBJECTS = \ | ||
109 | $(am_libevas_engine_direct3d_la_OBJECTS) | ||
110 | AM_V_lt = $(am__v_lt_$(V)) | ||
111 | am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) | ||
112 | am__v_lt_0 = --silent | ||
113 | @BUILD_ENGINE_DIRECT3D_TRUE@@EVAS_STATIC_BUILD_DIRECT3D_TRUE@am_libevas_engine_direct3d_la_rpath = | ||
114 | @BUILD_ENGINE_DIRECT3D_TRUE@@EVAS_STATIC_BUILD_DIRECT3D_FALSE@module_la_DEPENDENCIES = $(top_builddir)/src/lib/libevas.la \ | ||
115 | @BUILD_ENGINE_DIRECT3D_TRUE@@EVAS_STATIC_BUILD_DIRECT3D_FALSE@ $(am__DEPENDENCIES_1) | ||
116 | am__module_la_SOURCES_DIST = evas_engine.c evas_direct3d_context.cpp \ | ||
117 | evas_direct3d_device.cpp evas_direct3d_image_cache.cpp \ | ||
118 | evas_direct3d_main.cpp evas_direct3d_object.cpp \ | ||
119 | evas_direct3d_object_font.cpp evas_direct3d_object_image.cpp \ | ||
120 | evas_direct3d_object_line.cpp evas_direct3d_object_rect.cpp \ | ||
121 | evas_direct3d_scene.cpp evas_direct3d_shader_pack.cpp \ | ||
122 | evas_direct3d_vertex_buffer_cache.cpp | ||
123 | @BUILD_ENGINE_DIRECT3D_TRUE@am__objects_2 = module_la-evas_engine.lo \ | ||
124 | @BUILD_ENGINE_DIRECT3D_TRUE@ module_la-evas_direct3d_context.lo \ | ||
125 | @BUILD_ENGINE_DIRECT3D_TRUE@ module_la-evas_direct3d_device.lo \ | ||
126 | @BUILD_ENGINE_DIRECT3D_TRUE@ module_la-evas_direct3d_image_cache.lo \ | ||
127 | @BUILD_ENGINE_DIRECT3D_TRUE@ module_la-evas_direct3d_main.lo \ | ||
128 | @BUILD_ENGINE_DIRECT3D_TRUE@ module_la-evas_direct3d_object.lo \ | ||
129 | @BUILD_ENGINE_DIRECT3D_TRUE@ module_la-evas_direct3d_object_font.lo \ | ||
130 | @BUILD_ENGINE_DIRECT3D_TRUE@ module_la-evas_direct3d_object_image.lo \ | ||
131 | @BUILD_ENGINE_DIRECT3D_TRUE@ module_la-evas_direct3d_object_line.lo \ | ||
132 | @BUILD_ENGINE_DIRECT3D_TRUE@ module_la-evas_direct3d_object_rect.lo \ | ||
133 | @BUILD_ENGINE_DIRECT3D_TRUE@ module_la-evas_direct3d_scene.lo \ | ||
134 | @BUILD_ENGINE_DIRECT3D_TRUE@ module_la-evas_direct3d_shader_pack.lo \ | ||
135 | @BUILD_ENGINE_DIRECT3D_TRUE@ module_la-evas_direct3d_vertex_buffer_cache.lo | ||
136 | @BUILD_ENGINE_DIRECT3D_TRUE@@EVAS_STATIC_BUILD_DIRECT3D_FALSE@am_module_la_OBJECTS = $(am__objects_2) | ||
137 | module_la_OBJECTS = $(am_module_la_OBJECTS) | ||
138 | module_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ | ||
139 | $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ | ||
140 | $(module_la_CXXFLAGS) $(CXXFLAGS) $(module_la_LDFLAGS) \ | ||
141 | $(LDFLAGS) -o $@ | ||
142 | @BUILD_ENGINE_DIRECT3D_TRUE@@EVAS_STATIC_BUILD_DIRECT3D_FALSE@am_module_la_rpath = -rpath \ | ||
143 | @BUILD_ENGINE_DIRECT3D_TRUE@@EVAS_STATIC_BUILD_DIRECT3D_FALSE@ $(pkgdir) | ||
144 | DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) | ||
145 | depcomp = $(SHELL) $(top_srcdir)/depcomp | ||
146 | am__depfiles_maybe = depfiles | ||
147 | am__mv = mv -f | ||
148 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ | ||
149 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) | ||
150 | LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ | ||
151 | $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ | ||
152 | $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ | ||
153 | $(AM_CFLAGS) $(CFLAGS) | ||
154 | AM_V_CC = $(am__v_CC_$(V)) | ||
155 | am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) | ||
156 | am__v_CC_0 = @echo " CC " $@; | ||
157 | AM_V_at = $(am__v_at_$(V)) | ||
158 | am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) | ||
159 | am__v_at_0 = @ | ||
160 | CCLD = $(CC) | ||
161 | LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ | ||
162 | $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ | ||
163 | $(AM_LDFLAGS) $(LDFLAGS) -o $@ | ||
164 | AM_V_CCLD = $(am__v_CCLD_$(V)) | ||
165 | am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) | ||
166 | am__v_CCLD_0 = @echo " CCLD " $@; | ||
167 | CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ | ||
168 | $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) | ||
169 | LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ | ||
170 | $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ | ||
171 | $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ | ||
172 | $(AM_CXXFLAGS) $(CXXFLAGS) | ||
173 | AM_V_CXX = $(am__v_CXX_$(V)) | ||
174 | am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY)) | ||
175 | am__v_CXX_0 = @echo " CXX " $@; | ||
176 | CXXLD = $(CXX) | ||
177 | CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ | ||
178 | $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ | ||
179 | $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ | ||
180 | AM_V_CXXLD = $(am__v_CXXLD_$(V)) | ||
181 | am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY)) | ||
182 | am__v_CXXLD_0 = @echo " CXXLD " $@; | ||
183 | AM_V_GEN = $(am__v_GEN_$(V)) | ||
184 | am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) | ||
185 | am__v_GEN_0 = @echo " GEN " $@; | ||
186 | SOURCES = $(libevas_engine_direct3d_la_SOURCES) $(module_la_SOURCES) | ||
187 | DIST_SOURCES = $(am__libevas_engine_direct3d_la_SOURCES_DIST) \ | ||
188 | $(am__module_la_SOURCES_DIST) | ||
189 | am__includes_HEADERS_DIST = Evas_Engine_Direct3D.h | ||
190 | HEADERS = $(includes_HEADERS) | ||
191 | ETAGS = etags | ||
192 | CTAGS = ctags | ||
193 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) | ||
194 | ACLOCAL = @ACLOCAL@ | ||
195 | ALLOCA = @ALLOCA@ | ||
196 | AMTAR = @AMTAR@ | ||
197 | AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ | ||
198 | AR = @AR@ | ||
199 | AS = @AS@ | ||
200 | AUTOCONF = @AUTOCONF@ | ||
201 | AUTOHEADER = @AUTOHEADER@ | ||
202 | AUTOMAKE = @AUTOMAKE@ | ||
203 | AWK = @AWK@ | ||
204 | CC = @CC@ | ||
205 | CCDEPMODE = @CCDEPMODE@ | ||
206 | CFLAGS = @CFLAGS@ | ||
207 | CHECK_CFLAGS = @CHECK_CFLAGS@ | ||
208 | CHECK_LIBS = @CHECK_LIBS@ | ||
209 | CPP = @CPP@ | ||
210 | CPPFLAGS = @CPPFLAGS@ | ||
211 | CXX = @CXX@ | ||
212 | CXXCPP = @CXXCPP@ | ||
213 | CXXDEPMODE = @CXXDEPMODE@ | ||
214 | CXXFLAGS = @CXXFLAGS@ | ||
215 | CYGPATH_W = @CYGPATH_W@ | ||
216 | DEFS = @DEFS@ | ||
217 | DEPDIR = @DEPDIR@ | ||
218 | DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ | ||
219 | DIRECTFB_LIBS = @DIRECTFB_LIBS@ | ||
220 | DLLTOOL = @DLLTOOL@ | ||
221 | DSYMUTIL = @DSYMUTIL@ | ||
222 | DUMPBIN = @DUMPBIN@ | ||
223 | ECHO_C = @ECHO_C@ | ||
224 | ECHO_N = @ECHO_N@ | ||
225 | ECHO_T = @ECHO_T@ | ||
226 | ECORE_EVAS_CFLAGS = @ECORE_EVAS_CFLAGS@ | ||
227 | ECORE_EVAS_LIBS = @ECORE_EVAS_LIBS@ | ||
228 | EDB_CFLAGS = @EDB_CFLAGS@ | ||
229 | EDB_LIBS = @EDB_LIBS@ | ||
230 | EDJE_CFLAGS = @EDJE_CFLAGS@ | ||
231 | EDJE_LIBS = @EDJE_LIBS@ | ||
232 | EET_CFLAGS = @EET_CFLAGS@ | ||
233 | EET_LIBS = @EET_LIBS@ | ||
234 | EFL_COVERAGE_CFLAGS = @EFL_COVERAGE_CFLAGS@ | ||
235 | EFL_COVERAGE_LIBS = @EFL_COVERAGE_LIBS@ | ||
236 | EFL_FNMATCH_LIBS = @EFL_FNMATCH_LIBS@ | ||
237 | EGREP = @EGREP@ | ||
238 | EINA_CFLAGS = @EINA_CFLAGS@ | ||
239 | EINA_LIBS = @EINA_LIBS@ | ||
240 | EVAS_CFLAGS = @EVAS_CFLAGS@ | ||
241 | EVAS_LIBS = @EVAS_LIBS@ | ||
242 | EVAS_SSE3_CFLAGS = @EVAS_SSE3_CFLAGS@ | ||
243 | EVIL_CFLAGS = @EVIL_CFLAGS@ | ||
244 | EVIL_LIBS = @EVIL_LIBS@ | ||
245 | EXEEXT = @EXEEXT@ | ||
246 | FGREP = @FGREP@ | ||
247 | FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ | ||
248 | FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ | ||
249 | FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ | ||
250 | FREETYPE_LIBS = @FREETYPE_LIBS@ | ||
251 | FRIBIDI_CFLAGS = @FRIBIDI_CFLAGS@ | ||
252 | FRIBIDI_LIBS = @FRIBIDI_LIBS@ | ||
253 | GL_EET_CFLAGS = @GL_EET_CFLAGS@ | ||
254 | GL_EET_LIBS = @GL_EET_LIBS@ | ||
255 | GREP = @GREP@ | ||
256 | HARFBUZZ_CFLAGS = @HARFBUZZ_CFLAGS@ | ||
257 | HARFBUZZ_LIBS = @HARFBUZZ_LIBS@ | ||
258 | INSTALL = @INSTALL@ | ||
259 | INSTALL_DATA = @INSTALL_DATA@ | ||
260 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | ||
261 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ | ||
262 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ | ||
263 | LD = @LD@ | ||
264 | LDFLAGS = @LDFLAGS@ | ||
265 | LIBOBJS = @LIBOBJS@ | ||
266 | LIBS = @LIBS@ | ||
267 | LIBTOOL = @LIBTOOL@ | ||
268 | LINEBREAK_CFLAGS = @LINEBREAK_CFLAGS@ | ||
269 | LINEBREAK_LIBS = @LINEBREAK_LIBS@ | ||
270 | LIPO = @LIPO@ | ||
271 | LN_S = @LN_S@ | ||
272 | LTLIBOBJS = @LTLIBOBJS@ | ||
273 | MAKEINFO = @MAKEINFO@ | ||
274 | MKDIR_P = @MKDIR_P@ | ||
275 | MODULE_ARCH = @MODULE_ARCH@ | ||
276 | NM = @NM@ | ||
277 | NMEDIT = @NMEDIT@ | ||
278 | OBJC = @OBJC@ | ||
279 | OBJCDEPMODE = @OBJCDEPMODE@ | ||
280 | OBJCFLAGS = @OBJCFLAGS@ | ||
281 | OBJDUMP = @OBJDUMP@ | ||
282 | OBJEXT = @OBJEXT@ | ||
283 | OTOOL = @OTOOL@ | ||
284 | OTOOL64 = @OTOOL64@ | ||
285 | PACKAGE = @PACKAGE@ | ||
286 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ | ||
287 | PACKAGE_NAME = @PACKAGE_NAME@ | ||
288 | PACKAGE_STRING = @PACKAGE_STRING@ | ||
289 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ | ||
290 | PACKAGE_URL = @PACKAGE_URL@ | ||
291 | PACKAGE_VERSION = @PACKAGE_VERSION@ | ||
292 | PATH_SEPARATOR = @PATH_SEPARATOR@ | ||
293 | PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ | ||
294 | PIXMAN_LIBS = @PIXMAN_LIBS@ | ||
295 | PKG_CONFIG = @PKG_CONFIG@ | ||
296 | PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ | ||
297 | PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ | ||
298 | PNG_CFLAGS = @PNG_CFLAGS@ | ||
299 | PNG_LIBS = @PNG_LIBS@ | ||
300 | RANLIB = @RANLIB@ | ||
301 | SDL_CFLAGS = @SDL_CFLAGS@ | ||
302 | SDL_LIBS = @SDL_LIBS@ | ||
303 | SED = @SED@ | ||
304 | SET_MAKE = @SET_MAKE@ | ||
305 | SHELL = @SHELL@ | ||
306 | SHM_OPEN_LINK = @SHM_OPEN_LINK@ | ||
307 | STRIP = @STRIP@ | ||
308 | SVG_CFLAGS = @SVG_CFLAGS@ | ||
309 | SVG_LIBS = @SVG_LIBS@ | ||
310 | VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ | ||
311 | VALGRIND_LIBS = @VALGRIND_LIBS@ | ||
312 | VERSION = @VERSION@ | ||
313 | VMAJ = @VMAJ@ | ||
314 | WIN32_CFLAGS = @WIN32_CFLAGS@ | ||
315 | WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ | ||
316 | XCB_CFLAGS = @XCB_CFLAGS@ | ||
317 | XCB_GL_CFLAGS = @XCB_GL_CFLAGS@ | ||
318 | XCB_GL_LIBS = @XCB_GL_LIBS@ | ||
319 | XCB_LIBS = @XCB_LIBS@ | ||
320 | XEXT_CFLAGS = @XEXT_CFLAGS@ | ||
321 | XEXT_LIBS = @XEXT_LIBS@ | ||
322 | XMKMF = @XMKMF@ | ||
323 | X_CFLAGS = @X_CFLAGS@ | ||
324 | X_EXTRA_LIBS = @X_EXTRA_LIBS@ | ||
325 | X_LIBS = @X_LIBS@ | ||
326 | X_PRE_LIBS = @X_PRE_LIBS@ | ||
327 | abs_builddir = @abs_builddir@ | ||
328 | abs_srcdir = @abs_srcdir@ | ||
329 | abs_top_builddir = @abs_top_builddir@ | ||
330 | abs_top_srcdir = @abs_top_srcdir@ | ||
331 | ac_ct_CC = @ac_ct_CC@ | ||
332 | ac_ct_CXX = @ac_ct_CXX@ | ||
333 | ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ | ||
334 | ac_ct_OBJC = @ac_ct_OBJC@ | ||
335 | altivec_cflags = @altivec_cflags@ | ||
336 | am__include = @am__include@ | ||
337 | am__leading_dot = @am__leading_dot@ | ||
338 | am__quote = @am__quote@ | ||
339 | am__tar = @am__tar@ | ||
340 | am__untar = @am__untar@ | ||
341 | bindir = @bindir@ | ||
342 | build = @build@ | ||
343 | build_alias = @build_alias@ | ||
344 | build_cpu = @build_cpu@ | ||
345 | build_os = @build_os@ | ||
346 | build_vendor = @build_vendor@ | ||
347 | builddir = @builddir@ | ||
348 | datadir = @datadir@ | ||
349 | datarootdir = @datarootdir@ | ||
350 | dlopen_libs = @dlopen_libs@ | ||
351 | docdir = @docdir@ | ||
352 | dvidir = @dvidir@ | ||
353 | edje_cc = @edje_cc@ | ||
354 | efl_doxygen = @efl_doxygen@ | ||
355 | efl_have_doxygen = @efl_have_doxygen@ | ||
356 | evas_engine_buffer_cflags = @evas_engine_buffer_cflags@ | ||
357 | evas_engine_buffer_libs = @evas_engine_buffer_libs@ | ||
358 | evas_engine_direct3d_cflags = @evas_engine_direct3d_cflags@ | ||
359 | evas_engine_direct3d_libs = @evas_engine_direct3d_libs@ | ||
360 | evas_engine_directfb_cflags = @evas_engine_directfb_cflags@ | ||
361 | evas_engine_directfb_libs = @evas_engine_directfb_libs@ | ||
362 | evas_engine_fb_cflags = @evas_engine_fb_cflags@ | ||
363 | evas_engine_fb_libs = @evas_engine_fb_libs@ | ||
364 | evas_engine_gl_cocoa_cflags = @evas_engine_gl_cocoa_cflags@ | ||
365 | evas_engine_gl_cocoa_libs = @evas_engine_gl_cocoa_libs@ | ||
366 | evas_engine_gl_common_libs = @evas_engine_gl_common_libs@ | ||
367 | evas_engine_gl_sdl_cflags = @evas_engine_gl_sdl_cflags@ | ||
368 | evas_engine_gl_sdl_libs = @evas_engine_gl_sdl_libs@ | ||
369 | evas_engine_gl_xcb_cflags = @evas_engine_gl_xcb_cflags@ | ||
370 | evas_engine_gl_xcb_libs = @evas_engine_gl_xcb_libs@ | ||
371 | evas_engine_gl_xlib_cflags = @evas_engine_gl_xlib_cflags@ | ||
372 | evas_engine_gl_xlib_libs = @evas_engine_gl_xlib_libs@ | ||
373 | evas_engine_psl1ght_cflags = @evas_engine_psl1ght_cflags@ | ||
374 | evas_engine_psl1ght_libs = @evas_engine_psl1ght_libs@ | ||
375 | evas_engine_software_16_ddraw_cflags = @evas_engine_software_16_ddraw_cflags@ | ||
376 | evas_engine_software_16_ddraw_libs = @evas_engine_software_16_ddraw_libs@ | ||
377 | evas_engine_software_16_sdl_cflags = @evas_engine_software_16_sdl_cflags@ | ||
378 | evas_engine_software_16_sdl_libs = @evas_engine_software_16_sdl_libs@ | ||
379 | evas_engine_software_16_wince_cflags = @evas_engine_software_16_wince_cflags@ | ||
380 | evas_engine_software_16_wince_libs = @evas_engine_software_16_wince_libs@ | ||
381 | evas_engine_software_16_x11_cflags = @evas_engine_software_16_x11_cflags@ | ||
382 | evas_engine_software_16_x11_libs = @evas_engine_software_16_x11_libs@ | ||
383 | evas_engine_software_8_x11_cflags = @evas_engine_software_8_x11_cflags@ | ||
384 | evas_engine_software_8_x11_libs = @evas_engine_software_8_x11_libs@ | ||
385 | evas_engine_software_ddraw_cflags = @evas_engine_software_ddraw_cflags@ | ||
386 | evas_engine_software_ddraw_libs = @evas_engine_software_ddraw_libs@ | ||
387 | evas_engine_software_gdi_cflags = @evas_engine_software_gdi_cflags@ | ||
388 | evas_engine_software_gdi_libs = @evas_engine_software_gdi_libs@ | ||
389 | evas_engine_software_sdl_cflags = @evas_engine_software_sdl_cflags@ | ||
390 | evas_engine_software_sdl_libs = @evas_engine_software_sdl_libs@ | ||
391 | evas_engine_software_xcb_cflags = @evas_engine_software_xcb_cflags@ | ||
392 | evas_engine_software_xcb_libs = @evas_engine_software_xcb_libs@ | ||
393 | evas_engine_software_xlib_cflags = @evas_engine_software_xlib_cflags@ | ||
394 | evas_engine_software_xlib_libs = @evas_engine_software_xlib_libs@ | ||
395 | evas_image_loader_bmp_cflags = @evas_image_loader_bmp_cflags@ | ||
396 | evas_image_loader_bmp_libs = @evas_image_loader_bmp_libs@ | ||
397 | evas_image_loader_edb_cflags = @evas_image_loader_edb_cflags@ | ||
398 | evas_image_loader_edb_libs = @evas_image_loader_edb_libs@ | ||
399 | evas_image_loader_eet_cflags = @evas_image_loader_eet_cflags@ | ||
400 | evas_image_loader_eet_libs = @evas_image_loader_eet_libs@ | ||
401 | evas_image_loader_generic_cflags = @evas_image_loader_generic_cflags@ | ||
402 | evas_image_loader_generic_libs = @evas_image_loader_generic_libs@ | ||
403 | evas_image_loader_gif_cflags = @evas_image_loader_gif_cflags@ | ||
404 | evas_image_loader_gif_libs = @evas_image_loader_gif_libs@ | ||
405 | evas_image_loader_ico_cflags = @evas_image_loader_ico_cflags@ | ||
406 | evas_image_loader_ico_libs = @evas_image_loader_ico_libs@ | ||
407 | evas_image_loader_jpeg_cflags = @evas_image_loader_jpeg_cflags@ | ||
408 | evas_image_loader_jpeg_libs = @evas_image_loader_jpeg_libs@ | ||
409 | evas_image_loader_pmaps_cflags = @evas_image_loader_pmaps_cflags@ | ||
410 | evas_image_loader_pmaps_libs = @evas_image_loader_pmaps_libs@ | ||
411 | evas_image_loader_png_cflags = @evas_image_loader_png_cflags@ | ||
412 | evas_image_loader_png_libs = @evas_image_loader_png_libs@ | ||
413 | evas_image_loader_psd_cflags = @evas_image_loader_psd_cflags@ | ||
414 | evas_image_loader_psd_libs = @evas_image_loader_psd_libs@ | ||
415 | evas_image_loader_svg_cflags = @evas_image_loader_svg_cflags@ | ||
416 | evas_image_loader_svg_libs = @evas_image_loader_svg_libs@ | ||
417 | evas_image_loader_tga_cflags = @evas_image_loader_tga_cflags@ | ||
418 | evas_image_loader_tga_libs = @evas_image_loader_tga_libs@ | ||
419 | evas_image_loader_tiff_cflags = @evas_image_loader_tiff_cflags@ | ||
420 | evas_image_loader_tiff_libs = @evas_image_loader_tiff_libs@ | ||
421 | evas_image_loader_wbmp_cflags = @evas_image_loader_wbmp_cflags@ | ||
422 | evas_image_loader_wbmp_libs = @evas_image_loader_wbmp_libs@ | ||
423 | evas_image_loader_xpm_cflags = @evas_image_loader_xpm_cflags@ | ||
424 | evas_image_loader_xpm_libs = @evas_image_loader_xpm_libs@ | ||
425 | exec_prefix = @exec_prefix@ | ||
426 | have_evas_engine_gl_x11 = @have_evas_engine_gl_x11@ | ||
427 | have_evas_engine_gl_xcb = @have_evas_engine_gl_xcb@ | ||
428 | have_evas_engine_gl_xlib = @have_evas_engine_gl_xlib@ | ||
429 | have_evas_engine_software_x11 = @have_evas_engine_software_x11@ | ||
430 | have_evas_engine_software_xcb = @have_evas_engine_software_xcb@ | ||
431 | have_evas_engine_software_xlib = @have_evas_engine_software_xlib@ | ||
432 | have_lcov = @have_lcov@ | ||
433 | host = @host@ | ||
434 | host_alias = @host_alias@ | ||
435 | host_cpu = @host_cpu@ | ||
436 | host_os = @host_os@ | ||
437 | host_vendor = @host_vendor@ | ||
438 | htmldir = @htmldir@ | ||
439 | includedir = @includedir@ | ||
440 | infodir = @infodir@ | ||
441 | install_sh = @install_sh@ | ||
442 | libdir = @libdir@ | ||
443 | libexecdir = @libexecdir@ | ||
444 | localedir = @localedir@ | ||
445 | localstatedir = @localstatedir@ | ||
446 | lt_ECHO = @lt_ECHO@ | ||
447 | lt_enable_auto_import = @lt_enable_auto_import@ | ||
448 | mandir = @mandir@ | ||
449 | mkdir_p = @mkdir_p@ | ||
450 | oldincludedir = @oldincludedir@ | ||
451 | pdfdir = @pdfdir@ | ||
452 | pkgconfig_requires_private = @pkgconfig_requires_private@ | ||
453 | prefix = @prefix@ | ||
454 | program_transform_name = @program_transform_name@ | ||
455 | psdir = @psdir@ | ||
456 | pthread_cflags = @pthread_cflags@ | ||
457 | pthread_libs = @pthread_libs@ | ||
458 | release_info = @release_info@ | ||
459 | requirement_evas = @requirement_evas@ | ||
460 | sbindir = @sbindir@ | ||
461 | sharedstatedir = @sharedstatedir@ | ||
462 | srcdir = @srcdir@ | ||
463 | sysconfdir = @sysconfdir@ | ||
464 | target_alias = @target_alias@ | ||
465 | top_build_prefix = @top_build_prefix@ | ||
466 | top_builddir = @top_builddir@ | ||
467 | top_srcdir = @top_srcdir@ | ||
468 | version_info = @version_info@ | ||
469 | MAINTAINERCLEANFILES = Makefile.in | ||
470 | AM_CPPFLAGS = \ | ||
471 | -I. \ | ||
472 | -I$(top_srcdir)/src/lib \ | ||
473 | -I$(top_srcdir)/src/lib/include \ | ||
474 | -I$(top_srcdir)/src/modules/engines \ | ||
475 | @EINA_CFLAGS@ \ | ||
476 | @FREETYPE_CFLAGS@ \ | ||
477 | @PIXMAN_CFLAGS@ \ | ||
478 | @evas_engine_direct3d_cflags@ | ||
479 | |||
480 | @BUILD_ENGINE_DIRECT3D_TRUE@DIRECT3D_SOURCES = \ | ||
481 | @BUILD_ENGINE_DIRECT3D_TRUE@evas_engine.c \ | ||
482 | @BUILD_ENGINE_DIRECT3D_TRUE@evas_direct3d_context.cpp \ | ||
483 | @BUILD_ENGINE_DIRECT3D_TRUE@evas_direct3d_device.cpp \ | ||
484 | @BUILD_ENGINE_DIRECT3D_TRUE@evas_direct3d_image_cache.cpp \ | ||
485 | @BUILD_ENGINE_DIRECT3D_TRUE@evas_direct3d_main.cpp \ | ||
486 | @BUILD_ENGINE_DIRECT3D_TRUE@evas_direct3d_object.cpp \ | ||
487 | @BUILD_ENGINE_DIRECT3D_TRUE@evas_direct3d_object_font.cpp \ | ||
488 | @BUILD_ENGINE_DIRECT3D_TRUE@evas_direct3d_object_image.cpp \ | ||
489 | @BUILD_ENGINE_DIRECT3D_TRUE@evas_direct3d_object_line.cpp \ | ||
490 | @BUILD_ENGINE_DIRECT3D_TRUE@evas_direct3d_object_rect.cpp \ | ||
491 | @BUILD_ENGINE_DIRECT3D_TRUE@evas_direct3d_scene.cpp \ | ||
492 | @BUILD_ENGINE_DIRECT3D_TRUE@evas_direct3d_shader_pack.cpp \ | ||
493 | @BUILD_ENGINE_DIRECT3D_TRUE@evas_direct3d_vertex_buffer_cache.cpp | ||
494 | |||
495 | @BUILD_ENGINE_DIRECT3D_TRUE@DIRECT3D_LIBADD = @evas_engine_direct3d_libs@ | ||
496 | @BUILD_ENGINE_DIRECT3D_TRUE@includes_HEADERS = Evas_Engine_Direct3D.h | ||
497 | @BUILD_ENGINE_DIRECT3D_TRUE@includesdir = $(includedir)/evas-@VMAJ@ | ||
498 | @BUILD_ENGINE_DIRECT3D_TRUE@@EVAS_STATIC_BUILD_DIRECT3D_FALSE@pkgdir = $(libdir)/evas/modules/engines/direct3d/$(MODULE_ARCH) | ||
499 | @BUILD_ENGINE_DIRECT3D_TRUE@@EVAS_STATIC_BUILD_DIRECT3D_FALSE@pkg_LTLIBRARIES = module.la | ||
500 | @BUILD_ENGINE_DIRECT3D_TRUE@@EVAS_STATIC_BUILD_DIRECT3D_FALSE@module_la_SOURCES = $(DIRECT3D_SOURCES) | ||
501 | @BUILD_ENGINE_DIRECT3D_TRUE@@EVAS_STATIC_BUILD_DIRECT3D_FALSE@module_la_CXXFLAGS = -fno-exceptions | ||
502 | @BUILD_ENGINE_DIRECT3D_TRUE@@EVAS_STATIC_BUILD_DIRECT3D_FALSE@module_la_LIBADD = $(top_builddir)/src/lib/libevas.la $(DIRECT3D_LIBADD) @EINA_LIBS@ | ||
503 | @BUILD_ENGINE_DIRECT3D_TRUE@@EVAS_STATIC_BUILD_DIRECT3D_FALSE@module_la_LDFLAGS = @lt_enable_auto_import@ -no-undefined -module -avoid-version | ||
504 | @BUILD_ENGINE_DIRECT3D_TRUE@@EVAS_STATIC_BUILD_DIRECT3D_FALSE@module_la_LIBTOOLFLAGS = --tag=disable-static | ||
505 | @BUILD_ENGINE_DIRECT3D_TRUE@@EVAS_STATIC_BUILD_DIRECT3D_TRUE@noinst_LTLIBRARIES = libevas_engine_direct3d.la | ||
506 | @BUILD_ENGINE_DIRECT3D_TRUE@@EVAS_STATIC_BUILD_DIRECT3D_TRUE@libevas_engine_direct3d_la_SOURCES = $(DIRECT3D_SOURCES) | ||
507 | @BUILD_ENGINE_DIRECT3D_TRUE@@EVAS_STATIC_BUILD_DIRECT3D_TRUE@libevas_engine_direct3d_la_LIBADD = $(DIRECT3D_LIBADD) | ||
508 | EXTRA_DIST = \ | ||
509 | array.h \ | ||
510 | evas_direct3d_context.h \ | ||
511 | evas_direct3d_device.h \ | ||
512 | evas_direct3d_image_cache.h \ | ||
513 | evas_direct3d_object.h \ | ||
514 | evas_direct3d_object_font.h \ | ||
515 | evas_direct3d_object_image.h \ | ||
516 | evas_direct3d_object_line.h \ | ||
517 | evas_direct3d_object_rect.h \ | ||
518 | evas_direct3d_scene.h \ | ||
519 | evas_direct3d_shader_pack.h \ | ||
520 | evas_direct3d_vertex_buffer_cache.h \ | ||
521 | evas_engine.h \ | ||
522 | ref.h | ||
523 | |||
524 | all: all-am | ||
525 | |||
526 | .SUFFIXES: | ||
527 | .SUFFIXES: .c .cpp .lo .o .obj | ||
528 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) | ||
529 | @for dep in $?; do \ | ||
530 | case '$(am__configure_deps)' in \ | ||
531 | *$$dep*) \ | ||
532 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ | ||
533 | && { if test -f $@; then exit 0; else break; fi; }; \ | ||
534 | exit 1;; \ | ||
535 | esac; \ | ||
536 | done; \ | ||
537 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/modules/engines/direct3d/Makefile'; \ | ||
538 | $(am__cd) $(top_srcdir) && \ | ||
539 | $(AUTOMAKE) --gnu src/modules/engines/direct3d/Makefile | ||
540 | .PRECIOUS: Makefile | ||
541 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | ||
542 | @case '$?' in \ | ||
543 | *config.status*) \ | ||
544 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ | ||
545 | *) \ | ||
546 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ | ||
547 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ | ||
548 | esac; | ||
549 | |||
550 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) | ||
551 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
552 | |||
553 | $(top_srcdir)/configure: $(am__configure_deps) | ||
554 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
555 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) | ||
556 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
557 | $(am__aclocal_m4_deps): | ||
558 | |||
559 | clean-noinstLTLIBRARIES: | ||
560 | -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) | ||
561 | @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ | ||
562 | dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ | ||
563 | test "$$dir" != "$$p" || dir=.; \ | ||
564 | echo "rm -f \"$${dir}/so_locations\""; \ | ||
565 | rm -f "$${dir}/so_locations"; \ | ||
566 | done | ||
567 | install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) | ||
568 | @$(NORMAL_INSTALL) | ||
569 | test -z "$(pkgdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdir)" | ||
570 | @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \ | ||
571 | list2=; for p in $$list; do \ | ||
572 | if test -f $$p; then \ | ||
573 | list2="$$list2 $$p"; \ | ||
574 | else :; fi; \ | ||
575 | done; \ | ||
576 | test -z "$$list2" || { \ | ||
577 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkgdir)'"; \ | ||
578 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkgdir)"; \ | ||
579 | } | ||
580 | |||
581 | uninstall-pkgLTLIBRARIES: | ||
582 | @$(NORMAL_UNINSTALL) | ||
583 | @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \ | ||
584 | for p in $$list; do \ | ||
585 | $(am__strip_dir) \ | ||
586 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$f'"; \ | ||
587 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$f"; \ | ||
588 | done | ||
589 | |||
590 | clean-pkgLTLIBRARIES: | ||
591 | -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) | ||
592 | @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ | ||
593 | dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ | ||
594 | test "$$dir" != "$$p" || dir=.; \ | ||
595 | echo "rm -f \"$${dir}/so_locations\""; \ | ||
596 | rm -f "$${dir}/so_locations"; \ | ||
597 | done | ||
598 | libevas_engine_direct3d.la: $(libevas_engine_direct3d_la_OBJECTS) $(libevas_engine_direct3d_la_DEPENDENCIES) | ||
599 | $(AM_V_CXXLD)$(CXXLINK) $(am_libevas_engine_direct3d_la_rpath) $(libevas_engine_direct3d_la_OBJECTS) $(libevas_engine_direct3d_la_LIBADD) $(LIBS) | ||
600 | module.la: $(module_la_OBJECTS) $(module_la_DEPENDENCIES) | ||
601 | $(AM_V_CXXLD)$(module_la_LINK) $(am_module_la_rpath) $(module_la_OBJECTS) $(module_la_LIBADD) $(LIBS) | ||
602 | |||
603 | mostlyclean-compile: | ||
604 | -rm -f *.$(OBJEXT) | ||
605 | |||
606 | distclean-compile: | ||
607 | -rm -f *.tab.c | ||
608 | |||
609 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_direct3d_context.Plo@am__quote@ | ||
610 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_direct3d_device.Plo@am__quote@ | ||
611 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_direct3d_image_cache.Plo@am__quote@ | ||
612 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_direct3d_main.Plo@am__quote@ | ||
613 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_direct3d_object.Plo@am__quote@ | ||
614 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_direct3d_object_font.Plo@am__quote@ | ||
615 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_direct3d_object_image.Plo@am__quote@ | ||
616 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_direct3d_object_line.Plo@am__quote@ | ||
617 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_direct3d_object_rect.Plo@am__quote@ | ||
618 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_direct3d_scene.Plo@am__quote@ | ||
619 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_direct3d_shader_pack.Plo@am__quote@ | ||
620 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_direct3d_vertex_buffer_cache.Plo@am__quote@ | ||
621 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas_engine.Plo@am__quote@ | ||
622 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_la-evas_direct3d_context.Plo@am__quote@ | ||
623 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_la-evas_direct3d_device.Plo@am__quote@ | ||
624 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_la-evas_direct3d_image_cache.Plo@am__quote@ | ||
625 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_la-evas_direct3d_main.Plo@am__quote@ | ||
626 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_la-evas_direct3d_object.Plo@am__quote@ | ||
627 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_la-evas_direct3d_object_font.Plo@am__quote@ | ||
628 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_la-evas_direct3d_object_image.Plo@am__quote@ | ||
629 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_la-evas_direct3d_object_line.Plo@am__quote@ | ||
630 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_la-evas_direct3d_object_rect.Plo@am__quote@ | ||
631 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_la-evas_direct3d_scene.Plo@am__quote@ | ||
632 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_la-evas_direct3d_shader_pack.Plo@am__quote@ | ||
633 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_la-evas_direct3d_vertex_buffer_cache.Plo@am__quote@ | ||
634 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_la-evas_engine.Plo@am__quote@ | ||
635 | |||
636 | .c.o: | ||
637 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | ||
638 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | ||
639 | @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ | ||
640 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | ||
641 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
642 | @am__fastdepCC_FALSE@ $(COMPILE) -c $< | ||
643 | |||
644 | .c.obj: | ||
645 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` | ||
646 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | ||
647 | @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ | ||
648 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | ||
649 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
650 | @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` | ||
651 | |||
652 | .c.lo: | ||
653 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | ||
654 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo | ||
655 | @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ | ||
656 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ | ||
657 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
658 | @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< | ||
659 | |||
660 | module_la-evas_engine.lo: evas_engine.c | ||
661 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT module_la-evas_engine.lo -MD -MP -MF $(DEPDIR)/module_la-evas_engine.Tpo -c -o module_la-evas_engine.lo `test -f 'evas_engine.c' || echo '$(srcdir)/'`evas_engine.c | ||
662 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/module_la-evas_engine.Tpo $(DEPDIR)/module_la-evas_engine.Plo | ||
663 | @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ | ||
664 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='evas_engine.c' object='module_la-evas_engine.lo' libtool=yes @AMDEPBACKSLASH@ | ||
665 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
666 | @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o module_la-evas_engine.lo `test -f 'evas_engine.c' || echo '$(srcdir)/'`evas_engine.c | ||
667 | |||
668 | .cpp.o: | ||
669 | @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | ||
670 | @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | ||
671 | @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ | ||
672 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | ||
673 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
674 | @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< | ||
675 | |||
676 | .cpp.obj: | ||
677 | @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` | ||
678 | @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | ||
679 | @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ | ||
680 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | ||
681 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
682 | @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` | ||
683 | |||
684 | .cpp.lo: | ||
685 | @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | ||
686 | @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo | ||
687 | @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ | ||
688 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ | ||
689 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
690 | @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< | ||
691 | |||
692 | module_la-evas_direct3d_context.lo: evas_direct3d_context.cpp | ||
693 | @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -MT module_la-evas_direct3d_context.lo -MD -MP -MF $(DEPDIR)/module_la-evas_direct3d_context.Tpo -c -o module_la-evas_direct3d_context.lo `test -f 'evas_direct3d_context.cpp' || echo '$(srcdir)/'`evas_direct3d_context.cpp | ||
694 | @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/module_la-evas_direct3d_context.Tpo $(DEPDIR)/module_la-evas_direct3d_context.Plo | ||
695 | @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ | ||
696 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='evas_direct3d_context.cpp' object='module_la-evas_direct3d_context.lo' libtool=yes @AMDEPBACKSLASH@ | ||
697 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
698 | @am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -c -o module_la-evas_direct3d_context.lo `test -f 'evas_direct3d_context.cpp' || echo '$(srcdir)/'`evas_direct3d_context.cpp | ||
699 | |||
700 | module_la-evas_direct3d_device.lo: evas_direct3d_device.cpp | ||
701 | @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -MT module_la-evas_direct3d_device.lo -MD -MP -MF $(DEPDIR)/module_la-evas_direct3d_device.Tpo -c -o module_la-evas_direct3d_device.lo `test -f 'evas_direct3d_device.cpp' || echo '$(srcdir)/'`evas_direct3d_device.cpp | ||
702 | @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/module_la-evas_direct3d_device.Tpo $(DEPDIR)/module_la-evas_direct3d_device.Plo | ||
703 | @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ | ||
704 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='evas_direct3d_device.cpp' object='module_la-evas_direct3d_device.lo' libtool=yes @AMDEPBACKSLASH@ | ||
705 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
706 | @am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -c -o module_la-evas_direct3d_device.lo `test -f 'evas_direct3d_device.cpp' || echo '$(srcdir)/'`evas_direct3d_device.cpp | ||
707 | |||
708 | module_la-evas_direct3d_image_cache.lo: evas_direct3d_image_cache.cpp | ||
709 | @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -MT module_la-evas_direct3d_image_cache.lo -MD -MP -MF $(DEPDIR)/module_la-evas_direct3d_image_cache.Tpo -c -o module_la-evas_direct3d_image_cache.lo `test -f 'evas_direct3d_image_cache.cpp' || echo '$(srcdir)/'`evas_direct3d_image_cache.cpp | ||
710 | @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/module_la-evas_direct3d_image_cache.Tpo $(DEPDIR)/module_la-evas_direct3d_image_cache.Plo | ||
711 | @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ | ||
712 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='evas_direct3d_image_cache.cpp' object='module_la-evas_direct3d_image_cache.lo' libtool=yes @AMDEPBACKSLASH@ | ||
713 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
714 | @am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -c -o module_la-evas_direct3d_image_cache.lo `test -f 'evas_direct3d_image_cache.cpp' || echo '$(srcdir)/'`evas_direct3d_image_cache.cpp | ||
715 | |||
716 | module_la-evas_direct3d_main.lo: evas_direct3d_main.cpp | ||
717 | @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -MT module_la-evas_direct3d_main.lo -MD -MP -MF $(DEPDIR)/module_la-evas_direct3d_main.Tpo -c -o module_la-evas_direct3d_main.lo `test -f 'evas_direct3d_main.cpp' || echo '$(srcdir)/'`evas_direct3d_main.cpp | ||
718 | @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/module_la-evas_direct3d_main.Tpo $(DEPDIR)/module_la-evas_direct3d_main.Plo | ||
719 | @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ | ||
720 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='evas_direct3d_main.cpp' object='module_la-evas_direct3d_main.lo' libtool=yes @AMDEPBACKSLASH@ | ||
721 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
722 | @am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -c -o module_la-evas_direct3d_main.lo `test -f 'evas_direct3d_main.cpp' || echo '$(srcdir)/'`evas_direct3d_main.cpp | ||
723 | |||
724 | module_la-evas_direct3d_object.lo: evas_direct3d_object.cpp | ||
725 | @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -MT module_la-evas_direct3d_object.lo -MD -MP -MF $(DEPDIR)/module_la-evas_direct3d_object.Tpo -c -o module_la-evas_direct3d_object.lo `test -f 'evas_direct3d_object.cpp' || echo '$(srcdir)/'`evas_direct3d_object.cpp | ||
726 | @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/module_la-evas_direct3d_object.Tpo $(DEPDIR)/module_la-evas_direct3d_object.Plo | ||
727 | @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ | ||
728 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='evas_direct3d_object.cpp' object='module_la-evas_direct3d_object.lo' libtool=yes @AMDEPBACKSLASH@ | ||
729 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
730 | @am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -c -o module_la-evas_direct3d_object.lo `test -f 'evas_direct3d_object.cpp' || echo '$(srcdir)/'`evas_direct3d_object.cpp | ||
731 | |||
732 | module_la-evas_direct3d_object_font.lo: evas_direct3d_object_font.cpp | ||
733 | @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -MT module_la-evas_direct3d_object_font.lo -MD -MP -MF $(DEPDIR)/module_la-evas_direct3d_object_font.Tpo -c -o module_la-evas_direct3d_object_font.lo `test -f 'evas_direct3d_object_font.cpp' || echo '$(srcdir)/'`evas_direct3d_object_font.cpp | ||
734 | @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/module_la-evas_direct3d_object_font.Tpo $(DEPDIR)/module_la-evas_direct3d_object_font.Plo | ||
735 | @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ | ||
736 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='evas_direct3d_object_font.cpp' object='module_la-evas_direct3d_object_font.lo' libtool=yes @AMDEPBACKSLASH@ | ||
737 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
738 | @am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -c -o module_la-evas_direct3d_object_font.lo `test -f 'evas_direct3d_object_font.cpp' || echo '$(srcdir)/'`evas_direct3d_object_font.cpp | ||
739 | |||
740 | module_la-evas_direct3d_object_image.lo: evas_direct3d_object_image.cpp | ||
741 | @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -MT module_la-evas_direct3d_object_image.lo -MD -MP -MF $(DEPDIR)/module_la-evas_direct3d_object_image.Tpo -c -o module_la-evas_direct3d_object_image.lo `test -f 'evas_direct3d_object_image.cpp' || echo '$(srcdir)/'`evas_direct3d_object_image.cpp | ||
742 | @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/module_la-evas_direct3d_object_image.Tpo $(DEPDIR)/module_la-evas_direct3d_object_image.Plo | ||
743 | @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ | ||
744 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='evas_direct3d_object_image.cpp' object='module_la-evas_direct3d_object_image.lo' libtool=yes @AMDEPBACKSLASH@ | ||
745 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
746 | @am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -c -o module_la-evas_direct3d_object_image.lo `test -f 'evas_direct3d_object_image.cpp' || echo '$(srcdir)/'`evas_direct3d_object_image.cpp | ||
747 | |||
748 | module_la-evas_direct3d_object_line.lo: evas_direct3d_object_line.cpp | ||
749 | @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -MT module_la-evas_direct3d_object_line.lo -MD -MP -MF $(DEPDIR)/module_la-evas_direct3d_object_line.Tpo -c -o module_la-evas_direct3d_object_line.lo `test -f 'evas_direct3d_object_line.cpp' || echo '$(srcdir)/'`evas_direct3d_object_line.cpp | ||
750 | @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/module_la-evas_direct3d_object_line.Tpo $(DEPDIR)/module_la-evas_direct3d_object_line.Plo | ||
751 | @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ | ||
752 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='evas_direct3d_object_line.cpp' object='module_la-evas_direct3d_object_line.lo' libtool=yes @AMDEPBACKSLASH@ | ||
753 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
754 | @am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -c -o module_la-evas_direct3d_object_line.lo `test -f 'evas_direct3d_object_line.cpp' || echo '$(srcdir)/'`evas_direct3d_object_line.cpp | ||
755 | |||
756 | module_la-evas_direct3d_object_rect.lo: evas_direct3d_object_rect.cpp | ||
757 | @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -MT module_la-evas_direct3d_object_rect.lo -MD -MP -MF $(DEPDIR)/module_la-evas_direct3d_object_rect.Tpo -c -o module_la-evas_direct3d_object_rect.lo `test -f 'evas_direct3d_object_rect.cpp' || echo '$(srcdir)/'`evas_direct3d_object_rect.cpp | ||
758 | @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/module_la-evas_direct3d_object_rect.Tpo $(DEPDIR)/module_la-evas_direct3d_object_rect.Plo | ||
759 | @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ | ||
760 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='evas_direct3d_object_rect.cpp' object='module_la-evas_direct3d_object_rect.lo' libtool=yes @AMDEPBACKSLASH@ | ||
761 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
762 | @am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -c -o module_la-evas_direct3d_object_rect.lo `test -f 'evas_direct3d_object_rect.cpp' || echo '$(srcdir)/'`evas_direct3d_object_rect.cpp | ||
763 | |||
764 | module_la-evas_direct3d_scene.lo: evas_direct3d_scene.cpp | ||
765 | @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -MT module_la-evas_direct3d_scene.lo -MD -MP -MF $(DEPDIR)/module_la-evas_direct3d_scene.Tpo -c -o module_la-evas_direct3d_scene.lo `test -f 'evas_direct3d_scene.cpp' || echo '$(srcdir)/'`evas_direct3d_scene.cpp | ||
766 | @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/module_la-evas_direct3d_scene.Tpo $(DEPDIR)/module_la-evas_direct3d_scene.Plo | ||
767 | @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ | ||
768 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='evas_direct3d_scene.cpp' object='module_la-evas_direct3d_scene.lo' libtool=yes @AMDEPBACKSLASH@ | ||
769 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
770 | @am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -c -o module_la-evas_direct3d_scene.lo `test -f 'evas_direct3d_scene.cpp' || echo '$(srcdir)/'`evas_direct3d_scene.cpp | ||
771 | |||
772 | module_la-evas_direct3d_shader_pack.lo: evas_direct3d_shader_pack.cpp | ||
773 | @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -MT module_la-evas_direct3d_shader_pack.lo -MD -MP -MF $(DEPDIR)/module_la-evas_direct3d_shader_pack.Tpo -c -o module_la-evas_direct3d_shader_pack.lo `test -f 'evas_direct3d_shader_pack.cpp' || echo '$(srcdir)/'`evas_direct3d_shader_pack.cpp | ||
774 | @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/module_la-evas_direct3d_shader_pack.Tpo $(DEPDIR)/module_la-evas_direct3d_shader_pack.Plo | ||
775 | @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ | ||
776 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='evas_direct3d_shader_pack.cpp' object='module_la-evas_direct3d_shader_pack.lo' libtool=yes @AMDEPBACKSLASH@ | ||
777 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
778 | @am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -c -o module_la-evas_direct3d_shader_pack.lo `test -f 'evas_direct3d_shader_pack.cpp' || echo '$(srcdir)/'`evas_direct3d_shader_pack.cpp | ||
779 | |||
780 | module_la-evas_direct3d_vertex_buffer_cache.lo: evas_direct3d_vertex_buffer_cache.cpp | ||
781 | @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -MT module_la-evas_direct3d_vertex_buffer_cache.lo -MD -MP -MF $(DEPDIR)/module_la-evas_direct3d_vertex_buffer_cache.Tpo -c -o module_la-evas_direct3d_vertex_buffer_cache.lo `test -f 'evas_direct3d_vertex_buffer_cache.cpp' || echo '$(srcdir)/'`evas_direct3d_vertex_buffer_cache.cpp | ||
782 | @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/module_la-evas_direct3d_vertex_buffer_cache.Tpo $(DEPDIR)/module_la-evas_direct3d_vertex_buffer_cache.Plo | ||
783 | @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ | ||
784 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='evas_direct3d_vertex_buffer_cache.cpp' object='module_la-evas_direct3d_vertex_buffer_cache.lo' libtool=yes @AMDEPBACKSLASH@ | ||
785 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
786 | @am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(module_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(module_la_CXXFLAGS) $(CXXFLAGS) -c -o module_la-evas_direct3d_vertex_buffer_cache.lo `test -f 'evas_direct3d_vertex_buffer_cache.cpp' || echo '$(srcdir)/'`evas_direct3d_vertex_buffer_cache.cpp | ||
787 | |||
788 | mostlyclean-libtool: | ||
789 | -rm -f *.lo | ||
790 | |||
791 | clean-libtool: | ||
792 | -rm -rf .libs _libs | ||
793 | install-includesHEADERS: $(includes_HEADERS) | ||
794 | @$(NORMAL_INSTALL) | ||
795 | test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" | ||
796 | @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ | ||
797 | for p in $$list; do \ | ||
798 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ | ||
799 | echo "$$d$$p"; \ | ||
800 | done | $(am__base_list) | \ | ||
801 | while read files; do \ | ||
802 | echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ | ||
803 | $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ | ||
804 | done | ||
805 | |||
806 | uninstall-includesHEADERS: | ||
807 | @$(NORMAL_UNINSTALL) | ||
808 | @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ | ||
809 | files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ | ||
810 | test -n "$$files" || exit 0; \ | ||
811 | echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ | ||
812 | cd "$(DESTDIR)$(includesdir)" && rm -f $$files | ||
813 | |||
814 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) | ||
815 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
816 | unique=`for i in $$list; do \ | ||
817 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
818 | done | \ | ||
819 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
820 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
821 | mkid -fID $$unique | ||
822 | tags: TAGS | ||
823 | |||
824 | TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ | ||
825 | $(TAGS_FILES) $(LISP) | ||
826 | set x; \ | ||
827 | here=`pwd`; \ | ||
828 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
829 | unique=`for i in $$list; do \ | ||
830 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
831 | done | \ | ||
832 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
833 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
834 | shift; \ | ||
835 | if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ | ||
836 | test -n "$$unique" || unique=$$empty_fix; \ | ||
837 | if test $$# -gt 0; then \ | ||
838 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ | ||
839 | "$$@" $$unique; \ | ||
840 | else \ | ||
841 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ | ||
842 | $$unique; \ | ||
843 | fi; \ | ||
844 | fi | ||
845 | ctags: CTAGS | ||
846 | CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ | ||
847 | $(TAGS_FILES) $(LISP) | ||
848 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
849 | unique=`for i in $$list; do \ | ||
850 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
851 | done | \ | ||
852 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
853 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
854 | test -z "$(CTAGS_ARGS)$$unique" \ | ||
855 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ | ||
856 | $$unique | ||
857 | |||
858 | GTAGS: | ||
859 | here=`$(am__cd) $(top_builddir) && pwd` \ | ||
860 | && $(am__cd) $(top_srcdir) \ | ||
861 | && gtags -i $(GTAGS_ARGS) "$$here" | ||
862 | |||
863 | distclean-tags: | ||
864 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags | ||
865 | |||
866 | distdir: $(DISTFILES) | ||
867 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | ||
868 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | ||
869 | list='$(DISTFILES)'; \ | ||
870 | dist_files=`for file in $$list; do echo $$file; done | \ | ||
871 | sed -e "s|^$$srcdirstrip/||;t" \ | ||
872 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ | ||
873 | case $$dist_files in \ | ||
874 | */*) $(MKDIR_P) `echo "$$dist_files" | \ | ||
875 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ | ||
876 | sort -u` ;; \ | ||
877 | esac; \ | ||
878 | for file in $$dist_files; do \ | ||
879 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ | ||
880 | if test -d $$d/$$file; then \ | ||
881 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ | ||
882 | if test -d "$(distdir)/$$file"; then \ | ||
883 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ | ||
884 | fi; \ | ||
885 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ | ||
886 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ | ||
887 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ | ||
888 | fi; \ | ||
889 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ | ||
890 | else \ | ||
891 | test -f "$(distdir)/$$file" \ | ||
892 | || cp -p $$d/$$file "$(distdir)/$$file" \ | ||
893 | || exit 1; \ | ||
894 | fi; \ | ||
895 | done | ||
896 | check-am: all-am | ||
897 | check: check-am | ||
898 | all-am: Makefile $(LTLIBRARIES) $(HEADERS) | ||
899 | installdirs: | ||
900 | for dir in "$(DESTDIR)$(pkgdir)" "$(DESTDIR)$(includesdir)"; do \ | ||
901 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ | ||
902 | done | ||
903 | install: install-am | ||
904 | install-exec: install-exec-am | ||
905 | install-data: install-data-am | ||
906 | uninstall: uninstall-am | ||
907 | |||
908 | install-am: all-am | ||
909 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am | ||
910 | |||
911 | installcheck: installcheck-am | ||
912 | install-strip: | ||
913 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ | ||
914 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ | ||
915 | `test -z '$(STRIP)' || \ | ||
916 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install | ||
917 | mostlyclean-generic: | ||
918 | |||
919 | clean-generic: | ||
920 | |||
921 | distclean-generic: | ||
922 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) | ||
923 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) | ||
924 | |||
925 | maintainer-clean-generic: | ||
926 | @echo "This command is intended for maintainers to use" | ||
927 | @echo "it deletes files that may require special tools to rebuild." | ||
928 | -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) | ||
929 | clean: clean-am | ||
930 | |||
931 | clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ | ||
932 | clean-pkgLTLIBRARIES mostlyclean-am | ||
933 | |||
934 | distclean: distclean-am | ||
935 | -rm -rf ./$(DEPDIR) | ||
936 | -rm -f Makefile | ||
937 | distclean-am: clean-am distclean-compile distclean-generic \ | ||
938 | distclean-tags | ||
939 | |||
940 | dvi: dvi-am | ||
941 | |||
942 | dvi-am: | ||
943 | |||
944 | html: html-am | ||
945 | |||
946 | html-am: | ||
947 | |||
948 | info: info-am | ||
949 | |||
950 | info-am: | ||
951 | |||
952 | install-data-am: install-includesHEADERS install-pkgLTLIBRARIES | ||
953 | |||
954 | install-dvi: install-dvi-am | ||
955 | |||
956 | install-dvi-am: | ||
957 | |||
958 | install-exec-am: | ||
959 | |||
960 | install-html: install-html-am | ||
961 | |||
962 | install-html-am: | ||
963 | |||
964 | install-info: install-info-am | ||
965 | |||
966 | install-info-am: | ||
967 | |||
968 | install-man: | ||
969 | |||
970 | install-pdf: install-pdf-am | ||
971 | |||
972 | install-pdf-am: | ||
973 | |||
974 | install-ps: install-ps-am | ||
975 | |||
976 | install-ps-am: | ||
977 | |||
978 | installcheck-am: | ||
979 | |||
980 | maintainer-clean: maintainer-clean-am | ||
981 | -rm -rf ./$(DEPDIR) | ||
982 | -rm -f Makefile | ||
983 | maintainer-clean-am: distclean-am maintainer-clean-generic | ||
984 | |||
985 | mostlyclean: mostlyclean-am | ||
986 | |||
987 | mostlyclean-am: mostlyclean-compile mostlyclean-generic \ | ||
988 | mostlyclean-libtool | ||
989 | |||
990 | pdf: pdf-am | ||
991 | |||
992 | pdf-am: | ||
993 | |||
994 | ps: ps-am | ||
995 | |||
996 | ps-am: | ||
997 | |||
998 | uninstall-am: uninstall-includesHEADERS uninstall-pkgLTLIBRARIES | ||
999 | |||
1000 | .MAKE: install-am install-strip | ||
1001 | |||
1002 | .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ | ||
1003 | clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ | ||
1004 | ctags distclean distclean-compile distclean-generic \ | ||
1005 | distclean-libtool distclean-tags distdir dvi dvi-am html \ | ||
1006 | html-am info info-am install install-am install-data \ | ||
1007 | install-data-am install-dvi install-dvi-am install-exec \ | ||
1008 | install-exec-am install-html install-html-am \ | ||
1009 | install-includesHEADERS install-info install-info-am \ | ||
1010 | install-man install-pdf install-pdf-am install-pkgLTLIBRARIES \ | ||
1011 | install-ps install-ps-am install-strip installcheck \ | ||
1012 | installcheck-am installdirs maintainer-clean \ | ||
1013 | maintainer-clean-generic mostlyclean mostlyclean-compile \ | ||
1014 | mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ | ||
1015 | tags uninstall uninstall-am uninstall-includesHEADERS \ | ||
1016 | uninstall-pkgLTLIBRARIES | ||
1017 | |||
1018 | |||
1019 | # Tell versions [3.59,3.63) of GNU make to not export all variables. | ||
1020 | # Otherwise a system limit (for SysV at least) may be exceeded. | ||
1021 | .NOEXPORT: | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/array.h b/libraries/evas/src/modules/engines/direct3d/array.h new file mode 100644 index 0000000..dfd80b7 --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/array.h | |||
@@ -0,0 +1,305 @@ | |||
1 | #ifndef __ARRAY_H__ | ||
2 | #define __ARRAY_H__ | ||
3 | |||
4 | #include "ref.h" | ||
5 | #include <assert.h> | ||
6 | |||
7 | template <class T> | ||
8 | class TArray : virtual public Referenc | ||
9 | { | ||
10 | public: | ||
11 | TArray(); | ||
12 | TArray(const TArray<T> &arr) | ||
13 | { | ||
14 | data = NULL; | ||
15 | size = num = 0; | ||
16 | block_size = arr.block_size; | ||
17 | keep_order = arr.keep_order; | ||
18 | |||
19 | //assert(0 && "Direct assignment for arrays is NOT allowed"); | ||
20 | // risky probably, but anyway | ||
21 | arr.CopyTo(*this); | ||
22 | } | ||
23 | ~TArray(); | ||
24 | |||
25 | bool Allocate(int new_num); | ||
26 | bool Resize(int new_size = 0); | ||
27 | bool Add(T &el); | ||
28 | bool Add(const T &el); | ||
29 | |||
30 | inline T &operator[](int i); | ||
31 | inline const T &operator[](int i) const; | ||
32 | inline const TArray<T> &operator =(const TArray<T> &arr) | ||
33 | { | ||
34 | block_size = arr.block_size; | ||
35 | keep_order = arr.keep_order; | ||
36 | |||
37 | //assert(0 && "Direct assignment for arrays is NOT allowed"); | ||
38 | // risky probably, but anyway | ||
39 | arr.CopyTo(*this); | ||
40 | return *this; | ||
41 | } | ||
42 | |||
43 | T *Last() | ||
44 | { | ||
45 | if (num > 0) | ||
46 | return &data[num - 1]; | ||
47 | return NULL; | ||
48 | } | ||
49 | |||
50 | inline int Length() const | ||
51 | { | ||
52 | return num; | ||
53 | } | ||
54 | |||
55 | inline int Size() const | ||
56 | { | ||
57 | return size; | ||
58 | } | ||
59 | |||
60 | inline int BlockSize() const | ||
61 | { | ||
62 | return block_size; | ||
63 | } | ||
64 | |||
65 | inline T *Data() | ||
66 | { | ||
67 | return data; | ||
68 | } | ||
69 | |||
70 | inline T **DataPtr() | ||
71 | { | ||
72 | return &data; | ||
73 | } | ||
74 | |||
75 | inline const T *Data() const | ||
76 | { | ||
77 | return data; | ||
78 | } | ||
79 | |||
80 | inline void SetKeepOrder(bool enable) | ||
81 | { | ||
82 | keep_order = enable; | ||
83 | } | ||
84 | |||
85 | bool Find(const T &el); | ||
86 | |||
87 | bool Add(TArray<T> &arr); | ||
88 | bool CopyTo(TArray<T> &dest) const; | ||
89 | bool Init(const T *arr, int len); | ||
90 | |||
91 | void Swap(int to, int from); | ||
92 | void Replace(int i); | ||
93 | |||
94 | bool SetBlockSize(int new_size); | ||
95 | void Set(T &el); | ||
96 | void Set(const T &el); | ||
97 | |||
98 | protected: | ||
99 | T *data; | ||
100 | int size; | ||
101 | int num; | ||
102 | int block_size; | ||
103 | // Some operations restricted, order of the elements is fixed | ||
104 | bool keep_order; | ||
105 | |||
106 | }; | ||
107 | |||
108 | namespace Array | ||
109 | { | ||
110 | const int default_block_size = 16; | ||
111 | const int max_array_size = 0xffffff; | ||
112 | } | ||
113 | |||
114 | |||
115 | template <class T> TArray<T>::TArray() | ||
116 | : data(NULL), size(0), num(0), block_size(Array::default_block_size), keep_order(false) | ||
117 | { | ||
118 | } | ||
119 | |||
120 | template <class T> TArray<T>::~TArray() | ||
121 | { | ||
122 | if (data != NULL) | ||
123 | Resize(); | ||
124 | } | ||
125 | |||
126 | template <class T> bool TArray<T>::Allocate(int new_num) | ||
127 | { | ||
128 | assert(new_num >= 0 && new_num <= Array::max_array_size); | ||
129 | if (new_num > size) | ||
130 | { | ||
131 | if (!Resize(new_num)) | ||
132 | return false; | ||
133 | } | ||
134 | num = new_num; | ||
135 | return true; | ||
136 | } | ||
137 | |||
138 | template <class T> bool TArray<T>::Resize(int new_size) | ||
139 | { | ||
140 | assert(new_size >= 0 && new_size <= Array::max_array_size); | ||
141 | if (new_size == 0) | ||
142 | { | ||
143 | delete[] data; | ||
144 | data = NULL; | ||
145 | size = 0; | ||
146 | num = 0; | ||
147 | return true; | ||
148 | } | ||
149 | if (new_size == size) | ||
150 | return true; | ||
151 | |||
152 | T *new_data = new T[new_size]; | ||
153 | if (new_data == NULL) | ||
154 | return false; | ||
155 | |||
156 | if (data != NULL && num > 0) | ||
157 | { | ||
158 | //CopyMemory(new_data, data, num * sizeof(T)); | ||
159 | for (int i = 0; i < num && i < new_size; i++) | ||
160 | new_data[i] = data[i]; | ||
161 | } | ||
162 | delete[] data; | ||
163 | |||
164 | data = new_data; | ||
165 | size = new_size; | ||
166 | return true; | ||
167 | } | ||
168 | |||
169 | template <class T> bool TArray<T>::Add(T &el) | ||
170 | { | ||
171 | if (data == NULL) | ||
172 | Resize(1); | ||
173 | |||
174 | if (num < size) | ||
175 | { | ||
176 | data[num++] = el; | ||
177 | return true; | ||
178 | } | ||
179 | // num >= size | ||
180 | int new_size = size + block_size; | ||
181 | if (!Resize(new_size)) | ||
182 | return false; | ||
183 | |||
184 | data[num++] = el; | ||
185 | return true; | ||
186 | } | ||
187 | |||
188 | template <class T> bool TArray<T>::Add(const T &el) | ||
189 | { | ||
190 | if (data == NULL) | ||
191 | Resize(1); | ||
192 | |||
193 | if (num < size) | ||
194 | { | ||
195 | data[num++] = *(T *)⪙ | ||
196 | return true; | ||
197 | } | ||
198 | // num >= size | ||
199 | int new_size = size + block_size; | ||
200 | if (!Resize(new_size)) | ||
201 | return false; | ||
202 | |||
203 | data[num++] = *(T *)⪙ | ||
204 | return true; | ||
205 | } | ||
206 | |||
207 | template <class T> bool TArray<T>::Add(TArray<T> &arr) | ||
208 | { | ||
209 | if (arr.Length() == 0) | ||
210 | return true; | ||
211 | int numf = num; | ||
212 | if (!Allocate(Length() + arr.Length())) | ||
213 | return false; | ||
214 | CopyMemory(&data[numf], arr.Data(), arr.Length() * sizeof(T)); | ||
215 | return true; | ||
216 | } | ||
217 | |||
218 | template <class T> T &TArray<T>::operator [](int i) | ||
219 | { | ||
220 | assert(i >= 0 && i < num); | ||
221 | return data[i]; | ||
222 | } | ||
223 | |||
224 | template <class T> const T &TArray<T>::operator [](int i) const | ||
225 | { | ||
226 | assert(i >= 0 && i < num); | ||
227 | return data[i]; | ||
228 | } | ||
229 | |||
230 | template <class T> bool TArray<T>::SetBlockSize(int new_size) | ||
231 | { | ||
232 | assert(new_size >= 0 && new_size <= Array::max_array_size); | ||
233 | block_size = new_size; | ||
234 | return true; | ||
235 | } | ||
236 | |||
237 | template <class T> void TArray<T>::Set(T &el) | ||
238 | { | ||
239 | for (int i = 0; i < num; i++) | ||
240 | data[i] = el; | ||
241 | } | ||
242 | |||
243 | template <class T> void TArray<T>::Set(const T &el) | ||
244 | { | ||
245 | for (int i = 0; i < num; i++) | ||
246 | data[i] = el; | ||
247 | } | ||
248 | |||
249 | template <class T> bool TArray<T>::CopyTo(TArray<T> &dest) const | ||
250 | { | ||
251 | if (!dest.Resize(size)) | ||
252 | return false; | ||
253 | dest.num = 0; | ||
254 | for (int i = 0; i < num; i++) | ||
255 | dest.Add(data[i]); | ||
256 | |||
257 | return true; | ||
258 | } | ||
259 | |||
260 | template <class T> bool TArray<T>::Init(const T *arr, int len) | ||
261 | { | ||
262 | assert(arr != NULL); | ||
263 | if (!Resize(len)) | ||
264 | return false; | ||
265 | num = 0; | ||
266 | for (int i = 0; i < len; i++) | ||
267 | Add((T)arr[i]); | ||
268 | |||
269 | return true; | ||
270 | } | ||
271 | |||
272 | template <class T> void TArray<T>::Swap(int to, int from) | ||
273 | { | ||
274 | assert(to >= 0 && to < num && from >= 0 && from < num); | ||
275 | if (keep_order) | ||
276 | return; | ||
277 | T t = data[to]; | ||
278 | data[to] = data[from]; | ||
279 | data[from] = t; | ||
280 | } | ||
281 | |||
282 | template <class T> void TArray<T>::Replace(int i) | ||
283 | { | ||
284 | assert(i >= 0 && i < num); | ||
285 | if (keep_order) | ||
286 | return; | ||
287 | if (num >= 1) | ||
288 | { | ||
289 | data[i] = data[num - 1]; | ||
290 | num--; | ||
291 | } | ||
292 | } | ||
293 | |||
294 | // operator == for type T should be defined | ||
295 | template <class T> bool TArray<T>::Find(const T &el) | ||
296 | { | ||
297 | for (int i = 0; i < num; i++) | ||
298 | { | ||
299 | if (data[i] == el) | ||
300 | return true; | ||
301 | } | ||
302 | return false; | ||
303 | } | ||
304 | |||
305 | #endif // __ARRAY_H__ | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_context.cpp b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_context.cpp new file mode 100644 index 0000000..07cfa3d --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_context.cpp | |||
@@ -0,0 +1,8 @@ | |||
1 | |||
2 | #include "evas_direct3d_context.h" | ||
3 | |||
4 | D3DContext::D3DContext() | ||
5 | { | ||
6 | color = 0xff000000; | ||
7 | color_mul = 0xffffffff; | ||
8 | } | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_context.h b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_context.h new file mode 100644 index 0000000..763d189 --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_context.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef __EVAS_DIRECT3D_CONTEXT_H__ | ||
2 | #define __EVAS_DIRECT3D_CONTEXT_H__ | ||
3 | |||
4 | #include "evas_engine.h" | ||
5 | |||
6 | #include "ref.h" | ||
7 | #include "evas_direct3d_object.h" | ||
8 | |||
9 | class D3DContext : virtual public Referenc | ||
10 | { | ||
11 | public: | ||
12 | D3DContext(); | ||
13 | |||
14 | public: | ||
15 | DWORD color; | ||
16 | DWORD color_mul; | ||
17 | |||
18 | Ref<D3DObject> font; | ||
19 | |||
20 | }; | ||
21 | |||
22 | #endif // __EVAS_DIRECT3D_CONTEXT_H__ | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_device.cpp b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_device.cpp new file mode 100644 index 0000000..ce0d985 --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_device.cpp | |||
@@ -0,0 +1,393 @@ | |||
1 | //#define ENABLE_LOG_PRINTF | ||
2 | |||
3 | #include "evas_direct3d_device.h" | ||
4 | |||
5 | #include "evas_direct3d_vertex_buffer_cache.h" | ||
6 | |||
7 | D3DDevice::D3DDevice() | ||
8 | { | ||
9 | ResetParams(); | ||
10 | } | ||
11 | |||
12 | bool D3DDevice::Init(HWND window, int depth, bool fullscreen) | ||
13 | { | ||
14 | D3DPRESENT_PARAMETERS pp; | ||
15 | D3DDISPLAYMODE dm; | ||
16 | D3DCAPS9 caps; | ||
17 | RECT rect; | ||
18 | DWORD flag; | ||
19 | HRESULT hr; | ||
20 | |||
21 | if (window == NULL) | ||
22 | return false; | ||
23 | |||
24 | Destroy(); | ||
25 | |||
26 | _object = Direct3DCreate9(D3D_SDK_VERSION); | ||
27 | if (_object == NULL) | ||
28 | return false; | ||
29 | |||
30 | if (FAILED(hr = _object->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &dm))) | ||
31 | { | ||
32 | ERR("GetAdapterDisplayMode failed: %x", hr); | ||
33 | Destroy(); | ||
34 | return false; | ||
35 | } | ||
36 | |||
37 | if (FAILED(hr = _object->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &caps))) | ||
38 | { | ||
39 | ERR("GetDeviceCaps failed: %x", hr); | ||
40 | Destroy(); | ||
41 | return false; | ||
42 | } | ||
43 | |||
44 | if (!GetClientRect(window, &rect)) | ||
45 | { | ||
46 | ERR("GetClientRect failed: %x", GetLastError()); | ||
47 | Destroy(); | ||
48 | return false; | ||
49 | } | ||
50 | |||
51 | if (SUCCEEDED(_object->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, | ||
52 | dm.Format, 0, D3DRTYPE_TEXTURE, (depth == 16) ? D3DFMT_R5G6B5 : D3DFMT_A8R8G8B8))) | ||
53 | { | ||
54 | dm.Format = (depth == 16) ? D3DFMT_R5G6B5 : D3DFMT_A8R8G8B8; | ||
55 | } | ||
56 | |||
57 | flag = (caps.VertexProcessingCaps != 0) ? | ||
58 | (D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE) : | ||
59 | D3DCREATE_SOFTWARE_VERTEXPROCESSING; | ||
60 | |||
61 | ZeroMemory(&pp, sizeof(pp)); | ||
62 | if (!fullscreen) | ||
63 | { | ||
64 | pp.BackBufferWidth = rect.right - rect.left; | ||
65 | pp.BackBufferHeight = rect.bottom - rect.top; | ||
66 | } | ||
67 | else | ||
68 | { | ||
69 | pp.BackBufferWidth = ::GetSystemMetrics(SM_CXSCREEN); | ||
70 | pp.BackBufferHeight = ::GetSystemMetrics(SM_CYSCREEN); | ||
71 | } | ||
72 | pp.BackBufferFormat = dm.Format; | ||
73 | pp.BackBufferCount = 1; | ||
74 | pp.MultiSampleType = D3DMULTISAMPLE_NONE; | ||
75 | pp.MultiSampleQuality = 0; | ||
76 | pp.SwapEffect = D3DSWAPEFFECT_DISCARD; | ||
77 | pp.hDeviceWindow = window; | ||
78 | pp.Windowed = fullscreen ? FALSE : TRUE; | ||
79 | //pp.EnableAutoDepthStencil = TRUE; | ||
80 | //pp.AutoDepthStencilFormat = D3DFMT_D16; | ||
81 | pp.FullScreen_RefreshRateInHz = 0; | ||
82 | pp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; | ||
83 | |||
84 | if (FAILED(hr = _object->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, | ||
85 | window, flag, &pp, &_device))) | ||
86 | { | ||
87 | WRN("CreateDevice failed: %x", hr); | ||
88 | Destroy(); | ||
89 | return false; | ||
90 | } | ||
91 | |||
92 | LPDIRECT3DSURFACE9 backbuffer = NULL; | ||
93 | _device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer); | ||
94 | backbuffer->GetDesc(&_backbuffer_desc); | ||
95 | backbuffer->Release(); | ||
96 | |||
97 | switch (dm.Format) { | ||
98 | case D3DFMT_A8R8G8B8: | ||
99 | case D3DFMT_X8R8G8B8: | ||
100 | _depth = 32; | ||
101 | break; | ||
102 | case D3DFMT_R5G6B5: | ||
103 | _depth = 16; | ||
104 | break; | ||
105 | default: | ||
106 | WRN("No supported format found"); | ||
107 | Destroy(); | ||
108 | return false; | ||
109 | } | ||
110 | |||
111 | //_render_to_texture = false; | ||
112 | |||
113 | _d3dpp = pp; | ||
114 | _device_lost = FALSE; | ||
115 | _scene_rendering = FALSE; | ||
116 | _width = rect.right - rect.left; | ||
117 | _height = rect.bottom - rect.top; | ||
118 | _window = window; | ||
119 | |||
120 | if (FAILED(CreateRenderTarget())) | ||
121 | { | ||
122 | ERR("Failed to create render target"); | ||
123 | Destroy(); | ||
124 | return false; | ||
125 | } | ||
126 | |||
127 | Log("initialized"); | ||
128 | return true; | ||
129 | } | ||
130 | |||
131 | bool D3DDevice::Reset(int width, int height, int fullscreen) | ||
132 | { | ||
133 | D3DPRESENT_PARAMETERS pp = _d3dpp; | ||
134 | _d3dpp.BackBufferWidth = (width > 0) ? width : _d3dpp.BackBufferWidth; | ||
135 | _d3dpp.BackBufferHeight = (height > 0) ? height : _d3dpp.BackBufferHeight; | ||
136 | _d3dpp.Windowed = (fullscreen == 1) ? FALSE : ((fullscreen == 0) ? TRUE : _d3dpp.Windowed); | ||
137 | if (FAILED(ResetDevice())) | ||
138 | { | ||
139 | WRN("Couldnt restore device"); | ||
140 | _d3dpp = pp; | ||
141 | return SUCCEEDED(ResetDevice()); | ||
142 | } | ||
143 | _width = _d3dpp.BackBufferWidth; | ||
144 | _height = _d3dpp.BackBufferHeight; | ||
145 | return true; | ||
146 | } | ||
147 | |||
148 | void D3DDevice::Destroy() | ||
149 | { | ||
150 | //if (_render_target != NULL) | ||
151 | //{ | ||
152 | // _render_target->Release(); | ||
153 | // _render_target = NULL; | ||
154 | //} | ||
155 | if (_render_target_data != NULL) | ||
156 | { | ||
157 | _render_target_data->Release(); | ||
158 | _render_target_data = NULL; | ||
159 | } | ||
160 | if (_device != NULL) | ||
161 | { | ||
162 | int num = _device->Release(); | ||
163 | assert(num == 0); | ||
164 | } | ||
165 | if (_object != NULL) | ||
166 | _object->Release(); | ||
167 | ResetParams(); | ||
168 | |||
169 | INF("uninitialized"); | ||
170 | } | ||
171 | |||
172 | void D3DDevice::ResetParams() | ||
173 | { | ||
174 | _window = NULL; | ||
175 | _object = NULL; | ||
176 | _device = NULL; | ||
177 | _width = 0; | ||
178 | _height = 0; | ||
179 | _rot = 0; | ||
180 | _depth = 0; | ||
181 | _device_lost = false; | ||
182 | _scene_rendering = false; | ||
183 | ZeroMemory(&_d3dpp, sizeof(_d3dpp)); | ||
184 | ZeroMemory(&_backbuffer_desc, sizeof(_backbuffer_desc)); | ||
185 | //_render_target = NULL; | ||
186 | _render_target_data = NULL; | ||
187 | _render_data_updated = false; | ||
188 | _render_data.Resize(); | ||
189 | //_original_render_target = NULL; | ||
190 | //_render_to_texture = false; | ||
191 | } | ||
192 | |||
193 | HRESULT D3DDevice::RestoreDevice() | ||
194 | { | ||
195 | Log("restore"); | ||
196 | assert(_device != NULL); | ||
197 | |||
198 | HRESULT hr = S_OK; | ||
199 | |||
200 | // Test the cooperative level to see if it's okay to render | ||
201 | if (SUCCEEDED(hr = _device->TestCooperativeLevel())) | ||
202 | { | ||
203 | _device_lost = FALSE; | ||
204 | DBG("render test ok"); | ||
205 | return S_OK; | ||
206 | } | ||
207 | |||
208 | // If the device was lost, do not render until we get it back | ||
209 | if (hr == D3DERR_DEVICELOST) | ||
210 | return E_FAIL; | ||
211 | |||
212 | // Check if the device needs to be reset. | ||
213 | if (hr == D3DERR_DEVICENOTRESET) | ||
214 | { | ||
215 | if (FAILED(hr = ResetDevice())) | ||
216 | return hr; | ||
217 | } | ||
218 | return hr; | ||
219 | } | ||
220 | |||
221 | HRESULT D3DDevice::ResetDevice() | ||
222 | { | ||
223 | DBG("reset"); | ||
224 | HRESULT hr = S_OK; | ||
225 | |||
226 | _scene_rendering = FALSE; | ||
227 | |||
228 | // Release all video memory objects | ||
229 | // Bad to call such, make better | ||
230 | D3DVertexBufferCache::Current()->Uninitialize(); | ||
231 | |||
232 | //if (_render_target != NULL) | ||
233 | //{ | ||
234 | // _render_target->Release(); | ||
235 | // _render_target = NULL; | ||
236 | //} | ||
237 | if (_render_target_data != NULL) | ||
238 | { | ||
239 | _render_target_data->Release(); | ||
240 | _render_target_data = NULL; | ||
241 | } | ||
242 | |||
243 | // Reset the device | ||
244 | if (FAILED(hr = _device->Reset(&_d3dpp))) | ||
245 | { | ||
246 | ERR("D3DDevice: Reset of the device failed! Error (%X)", (DWORD)hr); | ||
247 | return hr; | ||
248 | } | ||
249 | |||
250 | // Store render target surface desc | ||
251 | LPDIRECT3DSURFACE9 backbuffer = NULL; | ||
252 | _device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer); | ||
253 | if (backbuffer != NULL) | ||
254 | { | ||
255 | backbuffer->GetDesc(&_backbuffer_desc); | ||
256 | backbuffer->Release(); | ||
257 | } | ||
258 | |||
259 | // Initialize the app's device-dependent objects | ||
260 | hr = CreateRenderTarget(); | ||
261 | |||
262 | if (FAILED(hr)) | ||
263 | { | ||
264 | WRN("Restoration of device objects failed"); | ||
265 | // Invalidate objects | ||
266 | |||
267 | return E_FAIL; | ||
268 | } | ||
269 | |||
270 | DBG("Device objects were successfuly restored"); | ||
271 | _textures.Set(NULL); | ||
272 | |||
273 | //_device_objects_restored = true; | ||
274 | return S_OK; | ||
275 | } | ||
276 | |||
277 | bool D3DDevice::Begin() | ||
278 | { | ||
279 | if (FAILED(RestoreDevice())) | ||
280 | return false; | ||
281 | |||
282 | //if (_render_to_texture && _render_target != NULL) | ||
283 | //{ | ||
284 | // if (FAILED(_device->GetRenderTarget(0, &_original_render_target))) | ||
285 | // return false; | ||
286 | // if (FAILED(_device->SetRenderTarget(0, _render_target))) | ||
287 | // return false; | ||
288 | //} | ||
289 | |||
290 | HRESULT hr; | ||
291 | if (FAILED(hr = _device->BeginScene())) | ||
292 | { | ||
293 | WRN("Cannot begin scene: %X", (DWORD)hr); | ||
294 | return false; | ||
295 | } | ||
296 | |||
297 | //static const D3DVIEWPORT9 vp = {0, 0, _width, _height, 0.f, 1.f}; | ||
298 | //_device->SetViewport(&vp); | ||
299 | //_device->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE); | ||
300 | |||
301 | //_device->Clear(0, NULL, D3DCLEAR_TARGET /*| D3DCLEAR_ZBUFFER*/, 0xff8080ff, 1.f, 0); | ||
302 | return true; | ||
303 | } | ||
304 | |||
305 | bool D3DDevice::End() | ||
306 | { | ||
307 | _device->EndScene(); | ||
308 | _device->Present(NULL, NULL, NULL, NULL); | ||
309 | |||
310 | _render_data_updated = false; | ||
311 | |||
312 | //if (_render_to_texture && _render_target != NULL && _original_render_target != NULL) | ||
313 | //{ | ||
314 | // if (FAILED(_device->SetRenderTarget(0, _original_render_target))) | ||
315 | // return false; | ||
316 | //} | ||
317 | |||
318 | return true; | ||
319 | } | ||
320 | |||
321 | TArray<DWORD> &D3DDevice::GetRenderData() | ||
322 | { | ||
323 | if (_render_data_updated) | ||
324 | return _render_data; | ||
325 | _render_data.Allocate(0); | ||
326 | if (_render_target_data == NULL) | ||
327 | return _render_data; | ||
328 | |||
329 | LPDIRECT3DSURFACE9 surf = NULL; | ||
330 | HRESULT hr; | ||
331 | if (FAILED(_device->GetRenderTarget(0, &surf))) | ||
332 | return _render_data; | ||
333 | if (FAILED(hr = _device->GetRenderTargetData(surf, _render_target_data))) | ||
334 | { | ||
335 | WRN("Failed to get render target data (%X)", (DWORD)hr); | ||
336 | surf->Release(); | ||
337 | return _render_data; | ||
338 | } | ||
339 | D3DLOCKED_RECT lr; | ||
340 | if (FAILED(_render_target_data->LockRect(&lr, NULL, D3DLOCK_READONLY))) | ||
341 | { | ||
342 | surf->Release(); | ||
343 | return _render_data; | ||
344 | } | ||
345 | _render_data.Allocate(_width * _height); | ||
346 | |||
347 | for (int i = 0; i < _height; i++) | ||
348 | { | ||
349 | CopyMemory(&_render_data[i * _width], (BYTE *)lr.pBits + i * lr.Pitch, | ||
350 | _width * sizeof(DWORD)); | ||
351 | } | ||
352 | |||
353 | _render_target_data->UnlockRect(); | ||
354 | _render_data_updated = true; | ||
355 | surf->Release(); | ||
356 | return _render_data; | ||
357 | } | ||
358 | |||
359 | HRESULT D3DDevice::SetTexture(DWORD stage, LPDIRECT3DTEXTURE9 tex) | ||
360 | { | ||
361 | if (stage >= 8) | ||
362 | return E_FAIL; | ||
363 | if (_textures.Length() <= (int)stage) | ||
364 | _textures.Allocate(stage + 1); | ||
365 | if (_textures[stage] != tex) | ||
366 | { | ||
367 | _textures[stage] = tex; | ||
368 | return _device->SetTexture(stage, tex); | ||
369 | } | ||
370 | return S_OK; | ||
371 | } | ||
372 | |||
373 | HRESULT D3DDevice::CreateRenderTarget() | ||
374 | { | ||
375 | if (_device == NULL) | ||
376 | return E_FAIL; | ||
377 | //if (_render_target != NULL && | ||
378 | if (_render_target_data != NULL) | ||
379 | return S_OK; | ||
380 | |||
381 | //if (FAILED(_device->CreateRenderTarget(_width, _height, _backbuffer_desc.Format, | ||
382 | // D3DMULTISAMPLE_NONE, 0, FALSE, &_render_target, NULL))) | ||
383 | //{ | ||
384 | // return E_FAIL; | ||
385 | //} | ||
386 | if (FAILED(_device->CreateOffscreenPlainSurface(_backbuffer_desc.Width, | ||
387 | _backbuffer_desc.Height, _backbuffer_desc.Format, D3DPOOL_SYSTEMMEM, | ||
388 | &_render_target_data, NULL))) | ||
389 | { | ||
390 | return E_FAIL; | ||
391 | } | ||
392 | return S_OK; | ||
393 | } | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_device.h b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_device.h new file mode 100644 index 0000000..c5a4b49 --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_device.h | |||
@@ -0,0 +1,87 @@ | |||
1 | #ifndef __EVAS_DIRECT3D_DEVICE_H__ | ||
2 | #define __EVAS_DIRECT3D_DEVICE_H__ | ||
3 | |||
4 | #include "evas_engine.h" | ||
5 | |||
6 | #include <assert.h> | ||
7 | |||
8 | #include "ref.h" | ||
9 | #include "array.h" | ||
10 | |||
11 | |||
12 | class D3DDevice : virtual public Referenc | ||
13 | { | ||
14 | public: | ||
15 | D3DDevice(); | ||
16 | |||
17 | bool Init(HWND window, int depth, bool fullscreen = false); | ||
18 | bool Reset(int width, int height, int fullscreen); | ||
19 | void Destroy(); | ||
20 | bool Begin(); | ||
21 | bool End(); | ||
22 | |||
23 | inline LPDIRECT3DDEVICE9 GetDevice(); | ||
24 | inline int GetWidth(); | ||
25 | inline int GetHeight(); | ||
26 | inline HWND GetWindow(); | ||
27 | inline bool GetFullscreen(); | ||
28 | |||
29 | TArray<DWORD> &GetRenderData(); | ||
30 | |||
31 | HRESULT SetTexture(DWORD stage, LPDIRECT3DTEXTURE9 tex); | ||
32 | |||
33 | private: | ||
34 | HRESULT RestoreDevice(); | ||
35 | HRESULT ResetDevice(); | ||
36 | void ResetParams(); | ||
37 | |||
38 | HRESULT CreateRenderTarget(); | ||
39 | |||
40 | private: | ||
41 | HWND _window; | ||
42 | LPDIRECT3D9 _object; | ||
43 | LPDIRECT3DDEVICE9 _device; | ||
44 | int _width; | ||
45 | int _height; | ||
46 | int _rot; | ||
47 | int _depth; | ||
48 | bool _device_lost; | ||
49 | bool _scene_rendering; | ||
50 | D3DPRESENT_PARAMETERS _d3dpp; | ||
51 | D3DSURFACE_DESC _backbuffer_desc; | ||
52 | //LPDIRECT3DSURFACE9 _render_target; | ||
53 | LPDIRECT3DSURFACE9 _render_target_data; | ||
54 | //LPDIRECT3DSURFACE9 _original_render_target; | ||
55 | //bool _render_to_texture; | ||
56 | TArray<DWORD> _render_data; | ||
57 | bool _render_data_updated; | ||
58 | |||
59 | TArray<LPDIRECT3DTEXTURE9> _textures; | ||
60 | }; | ||
61 | |||
62 | LPDIRECT3DDEVICE9 D3DDevice::GetDevice() | ||
63 | { | ||
64 | return _device; | ||
65 | } | ||
66 | |||
67 | int D3DDevice::GetWidth() | ||
68 | { | ||
69 | return _width; | ||
70 | } | ||
71 | |||
72 | int D3DDevice::GetHeight() | ||
73 | { | ||
74 | return _height; | ||
75 | } | ||
76 | |||
77 | HWND D3DDevice::GetWindow() | ||
78 | { | ||
79 | return _window; | ||
80 | } | ||
81 | |||
82 | bool D3DDevice::GetFullscreen() | ||
83 | { | ||
84 | return (_d3dpp.Windowed == 0); | ||
85 | } | ||
86 | |||
87 | #endif // __EVAS_DIRECT3D_DEVICE_H__ | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_image_cache.cpp b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_image_cache.cpp new file mode 100644 index 0000000..aa44eb9 --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_image_cache.cpp | |||
@@ -0,0 +1,436 @@ | |||
1 | #include "evas_direct3d_image_cache.h" | ||
2 | |||
3 | #include "evas_direct3d_device.h" | ||
4 | |||
5 | #include <assert.h> | ||
6 | |||
7 | Ref<D3DImageCache> D3DImageCache::_this; | ||
8 | |||
9 | D3DImageCache::D3DImageCache() | ||
10 | { | ||
11 | _max_width = 512; | ||
12 | _max_height = 512; | ||
13 | _margin = 0; | ||
14 | } | ||
15 | |||
16 | D3DImageCache::~D3DImageCache() | ||
17 | { | ||
18 | Uninitialize(); | ||
19 | } | ||
20 | |||
21 | D3DImageCache *D3DImageCache::Current() | ||
22 | { | ||
23 | if (_this.IsNull()) | ||
24 | _this = new D3DImageCache(); | ||
25 | return _this; | ||
26 | } | ||
27 | |||
28 | void D3DImageCache::SetCurrent(D3DImageCache *obj) | ||
29 | { | ||
30 | _this = obj; | ||
31 | } | ||
32 | |||
33 | void D3DImageCache::Uninitialize() | ||
34 | { | ||
35 | for (int i = 0; i < _cache.Length(); i++) | ||
36 | { | ||
37 | // In normal case they all will be NULL | ||
38 | if (_cache[i].texture != NULL) | ||
39 | _cache[i].texture->Release(); | ||
40 | } | ||
41 | _cache.Resize(); | ||
42 | } | ||
43 | |||
44 | bool D3DImageCache::SelectImageToDevice(D3DDevice *d3d, int id) | ||
45 | { | ||
46 | if (id < 0 || id >= _cache.Length()) | ||
47 | return false; | ||
48 | assert(_cache[id].texture != NULL); | ||
49 | return SUCCEEDED(d3d->SetTexture(_cache[id].stage, _cache[id].texture)); | ||
50 | } | ||
51 | |||
52 | void D3DImageCache::RemoveImageUser(int id) | ||
53 | { | ||
54 | if (id < 0 || id >= _cache.Length()) | ||
55 | return; | ||
56 | assert(_cache[id].texture != NULL); | ||
57 | _cache[id].users--; | ||
58 | if (_cache[id].users == 0) | ||
59 | { | ||
60 | _cache[id].texture->Release(); | ||
61 | ZeroMemory(&_cache[id], sizeof(_cache[id])); | ||
62 | } | ||
63 | } | ||
64 | |||
65 | void D3DImageCache::AddImageUser(int id) | ||
66 | { | ||
67 | if (id < 0 || id >= _cache.Length()) | ||
68 | return; | ||
69 | assert(_cache[id].texture != NULL); | ||
70 | _cache[id].users++; | ||
71 | } | ||
72 | |||
73 | bool D3DImageCache::InsertImage(D3DDevice *d3d, DWORD *data, int w, int h, CacheEntryInfo &info) | ||
74 | { | ||
75 | CacheEntry *ce = NULL; | ||
76 | int id = -1; | ||
77 | for (int i = 0; i < _cache.Length(); i++) | ||
78 | { | ||
79 | if (!_cache[i].locked && RequestInsert(_cache[i], w, h)) | ||
80 | { | ||
81 | ce = &_cache[i]; | ||
82 | id = i; | ||
83 | break; | ||
84 | } | ||
85 | } | ||
86 | if (ce == NULL) | ||
87 | { | ||
88 | CacheEntry new_entry; | ||
89 | if (!CreateEntry(d3d, new_entry, w, h)) | ||
90 | return false; | ||
91 | for (id = 0; id < _cache.Length(); id++) | ||
92 | { | ||
93 | if (_cache[id].texture == NULL) | ||
94 | break; | ||
95 | } | ||
96 | |||
97 | if (id < _cache.Length()) | ||
98 | { | ||
99 | _cache[id] = new_entry; | ||
100 | ce = &_cache[id]; | ||
101 | } | ||
102 | else | ||
103 | { | ||
104 | _cache.Add(new_entry); | ||
105 | ce = _cache.Last(); | ||
106 | id = _cache.Length() - 1; | ||
107 | } | ||
108 | } | ||
109 | |||
110 | assert(ce != NULL && ce->texture != NULL); | ||
111 | |||
112 | if (!InsertData(*ce, data, w, h)) | ||
113 | return false; | ||
114 | |||
115 | info.id = id; | ||
116 | info.u = FLOAT(ce->cur_x) / FLOAT(ce->width); | ||
117 | info.v = FLOAT(ce->cur_y) / FLOAT(ce->height); | ||
118 | info.du = FLOAT(w) / FLOAT(ce->width); | ||
119 | info.dv = FLOAT(h) / FLOAT(ce->height); | ||
120 | info.width = w; | ||
121 | info.height = h; | ||
122 | |||
123 | UpdateInsert(*ce, w, h); | ||
124 | return true; | ||
125 | } | ||
126 | |||
127 | bool D3DImageCache::InsertImage(D3DDevice *d3d, int id, DWORD *data, int w, int h, CacheEntryInfo &info) | ||
128 | { | ||
129 | if (id < 0 || id >= _cache.Length()) | ||
130 | return false; | ||
131 | assert(_cache[id].texture != NULL); | ||
132 | CacheEntry *ce = &_cache[id]; | ||
133 | if (!RequestInsert(*ce, w, h)) | ||
134 | return false; | ||
135 | if (!InsertData(*ce, data, w, h)) | ||
136 | return false; | ||
137 | |||
138 | info.id = id; | ||
139 | info.u = FLOAT(ce->cur_x) / FLOAT(ce->width); | ||
140 | info.v = FLOAT(ce->cur_y) / FLOAT(ce->height); | ||
141 | info.du = FLOAT(w) / FLOAT(ce->width); | ||
142 | info.dv = FLOAT(h) / FLOAT(ce->height); | ||
143 | info.width = w; | ||
144 | info.height = h; | ||
145 | |||
146 | UpdateInsert(*ce, w, h); | ||
147 | return true; | ||
148 | } | ||
149 | |||
150 | bool D3DImageCache::CreateImage(D3DDevice *d3d, int w, int h, bool locked, CacheEntryInfo &info) | ||
151 | { | ||
152 | int id; | ||
153 | CacheEntry new_entry; | ||
154 | CacheEntry *ce = NULL; | ||
155 | |||
156 | if (!CreateEntry(d3d, new_entry, w, h, true)) | ||
157 | return false; | ||
158 | for (id = 0; id < _cache.Length(); id++) | ||
159 | { | ||
160 | if (_cache[id].texture == NULL) | ||
161 | break; | ||
162 | } | ||
163 | |||
164 | if (id < _cache.Length()) | ||
165 | { | ||
166 | _cache[id] = new_entry; | ||
167 | ce = &_cache[id]; | ||
168 | } | ||
169 | else | ||
170 | { | ||
171 | _cache.Add(new_entry); | ||
172 | ce = _cache.Last(); | ||
173 | id = _cache.Length() - 1; | ||
174 | } | ||
175 | |||
176 | assert(ce != NULL && ce->texture != NULL); | ||
177 | |||
178 | // Fill with zero | ||
179 | if (!InsertData(*ce, NULL, w, h)) | ||
180 | return false; | ||
181 | |||
182 | info.id = id; | ||
183 | info.u = 0; | ||
184 | info.v = 0; | ||
185 | info.du = 1; | ||
186 | info.dv = 1; | ||
187 | info.width = w; | ||
188 | info.height = h; | ||
189 | |||
190 | UpdateInsert(*ce, 0, 0); | ||
191 | ce->locked = locked; | ||
192 | return true; | ||
193 | } | ||
194 | |||
195 | bool D3DImageCache::ResizeImage(D3DDevice *d3d, int nw, int nh, int id) | ||
196 | { | ||
197 | if (id < 0 || id >= _cache.Length()) | ||
198 | return false; | ||
199 | assert(_cache[id].texture != NULL); | ||
200 | CacheEntry *ce = &_cache[id]; | ||
201 | |||
202 | if (ce->width == nw && ce->height == nh) | ||
203 | return true; | ||
204 | |||
205 | LPDIRECT3DTEXTURE9 tex = NULL; | ||
206 | |||
207 | HRESULT hr; | ||
208 | if (FAILED(hr = d3d->GetDevice()->CreateTexture(nw, nh, 0, 0, D3DFMT_A8R8G8B8, | ||
209 | D3DPOOL_MANAGED, &tex, NULL))) | ||
210 | { | ||
211 | WRN("Failed to create texture: %X", hr); | ||
212 | return false; | ||
213 | } | ||
214 | assert(tex != NULL); | ||
215 | |||
216 | ce->texture->Release(); | ||
217 | ce->texture = tex; | ||
218 | ce->width = nw; | ||
219 | ce->height = nh; | ||
220 | return true; | ||
221 | } | ||
222 | |||
223 | bool D3DImageCache::RequestInsert(CacheEntry &entry, int w, int h) | ||
224 | { | ||
225 | // If we already have large image entry | ||
226 | if (entry.width > _max_width || entry.height > _max_height) | ||
227 | return false; | ||
228 | // If requested size does not fit into this entry at all | ||
229 | if (entry.height - entry.cur_h < h + _margin * 2 || entry.width < w + _margin * 2) | ||
230 | return false; | ||
231 | |||
232 | // If requested size does not fit into the current line of the entry | ||
233 | if (entry.width - entry.cur_x < w + _margin * 2) | ||
234 | { | ||
235 | entry.cur_y = entry.cur_h + _margin; | ||
236 | entry.cur_x = _margin; | ||
237 | return true; | ||
238 | } | ||
239 | entry.cur_x += _margin; | ||
240 | |||
241 | return true; | ||
242 | } | ||
243 | |||
244 | bool D3DImageCache::CreateEntry(D3DDevice *d3d, CacheEntry &entry, int w, int h, bool exact_size) | ||
245 | { | ||
246 | int width = exact_size ? w : max(_max_width, w); | ||
247 | int height = exact_size ? h : max(_max_height, h); | ||
248 | HRESULT hr; | ||
249 | if (FAILED(hr = d3d->GetDevice()->CreateTexture(width, height, 0, 0, D3DFMT_A8R8G8B8, | ||
250 | D3DPOOL_MANAGED, &entry.texture, NULL))) | ||
251 | { | ||
252 | WRN("Failed to create texture: %X", hr); | ||
253 | return false; | ||
254 | } | ||
255 | |||
256 | entry.cur_x = entry.cur_y = entry.cur_h = 0; | ||
257 | entry.width = width; | ||
258 | entry.height = height; | ||
259 | entry.users = 0; | ||
260 | entry.locked = false; | ||
261 | entry.stage = 0; | ||
262 | return true; | ||
263 | } | ||
264 | |||
265 | bool D3DImageCache::InsertData(CacheEntry &entry, DWORD *data, int w, int h) | ||
266 | { | ||
267 | if (entry.texture == NULL) | ||
268 | return false; | ||
269 | |||
270 | RECT rc = {entry.cur_x, entry.cur_y, entry.cur_x + w, entry.cur_y + h}; | ||
271 | D3DLOCKED_RECT lr; | ||
272 | if (FAILED(entry.texture->LockRect(0, &lr, &rc, 0))) | ||
273 | { | ||
274 | WRN("Failed to lock texture"); | ||
275 | return false; | ||
276 | } | ||
277 | |||
278 | if (data != NULL) | ||
279 | { | ||
280 | for (int i = 0; i < h; i++) | ||
281 | CopyMemory(((BYTE *)lr.pBits) + i * lr.Pitch, data + i * w, sizeof(DWORD) * w); | ||
282 | } | ||
283 | else | ||
284 | { | ||
285 | for (int i = 0; i < h; i++) | ||
286 | ZeroMemory(((BYTE *)lr.pBits) + i * lr.Pitch, sizeof(DWORD) * w); | ||
287 | } | ||
288 | |||
289 | if (FAILED(entry.texture->UnlockRect(0))) | ||
290 | { | ||
291 | WRN("Failed to unlock texture"); | ||
292 | return false; | ||
293 | } | ||
294 | return true; | ||
295 | } | ||
296 | |||
297 | |||
298 | bool D3DImageCache::RetrieveData(CacheEntry &entry, DWORD *data, int w, int h) | ||
299 | { | ||
300 | if (entry.texture == NULL || data == NULL) | ||
301 | return false; | ||
302 | |||
303 | RECT rc = {entry.cur_x, entry.cur_y, entry.cur_x + w, entry.cur_y + h}; | ||
304 | D3DLOCKED_RECT lr; | ||
305 | if (FAILED(entry.texture->LockRect(0, &lr, &rc, D3DLOCK_READONLY))) | ||
306 | { | ||
307 | WRN("Failed to lock texture"); | ||
308 | return false; | ||
309 | } | ||
310 | |||
311 | for (int i = 0; i < h; i++) | ||
312 | CopyMemory(data + i * w, ((BYTE *)lr.pBits) + i * lr.Pitch, sizeof(DWORD) * w); | ||
313 | |||
314 | if (FAILED(entry.texture->UnlockRect(0))) | ||
315 | { | ||
316 | WRN("Failed to unlock texture"); | ||
317 | return false; | ||
318 | } | ||
319 | return true; | ||
320 | } | ||
321 | |||
322 | void D3DImageCache::UpdateInsert(CacheEntry &entry, int w, int h) | ||
323 | { | ||
324 | entry.cur_h = max(entry.cur_h, entry.cur_y + h + _margin); | ||
325 | entry.cur_x += w + _margin; | ||
326 | entry.users++; | ||
327 | } | ||
328 | |||
329 | bool D3DImageCache::UpdateImageData(CacheEntryInfo &info, DWORD *data) | ||
330 | { | ||
331 | assert(data != NULL); | ||
332 | if (info.id < 0 || info.id >= _cache.Length()) | ||
333 | return false; | ||
334 | CacheEntry ce_copy = _cache[info.id]; | ||
335 | ce_copy.cur_x = int(info.u * FLOAT(ce_copy.width)); | ||
336 | ce_copy.cur_y = int(info.v * FLOAT(ce_copy.height)); | ||
337 | return InsertData(ce_copy, data, info.width, info.height); | ||
338 | } | ||
339 | |||
340 | bool D3DImageCache::UpdateImageDataWithDirtyInfo(CacheEntryInfo &info, DWORD *data, POINT *dirty) | ||
341 | { | ||
342 | if (info.id < 0 || info.id >= _cache.Length()) | ||
343 | return false; | ||
344 | CacheEntry &entry = _cache[info.id]; | ||
345 | if (entry.texture == NULL) | ||
346 | return false; | ||
347 | |||
348 | RECT rc = {0, 0, entry.width, entry.height}; | ||
349 | D3DLOCKED_RECT lr; | ||
350 | if (FAILED(entry.texture->LockRect(0, &lr, &rc, 0))) | ||
351 | { | ||
352 | WRN("Failed to lock texture"); | ||
353 | return false; | ||
354 | } | ||
355 | |||
356 | if (data != NULL) | ||
357 | { | ||
358 | for (int i = 0; i < rc.bottom; i++) | ||
359 | { | ||
360 | if (dirty[i].x < 0 && dirty[i].y < 0) | ||
361 | continue; | ||
362 | if (dirty[i].x >= 0 && dirty[i].y >= 0) | ||
363 | { | ||
364 | CopyMemory(((BYTE *)lr.pBits) + i * lr.Pitch + dirty[i].x * 4, | ||
365 | data + i * rc.right + dirty[i].x, sizeof(DWORD) * (dirty[i].y - dirty[i].x + 1)); | ||
366 | dirty[i].y = -dirty[i].y; | ||
367 | } | ||
368 | else if (dirty[i].x >= 0 && dirty[i].y < 0) | ||
369 | { | ||
370 | ZeroMemory(((BYTE *)lr.pBits) + i * lr.Pitch + dirty[i].x * 4, | ||
371 | sizeof(DWORD) * (-dirty[i].y - dirty[i].x + 1)); | ||
372 | dirty[i].x = -dirty[i].x; | ||
373 | } | ||
374 | } | ||
375 | } | ||
376 | else | ||
377 | { | ||
378 | for (int i = 0; i < rc.bottom; i++) | ||
379 | { | ||
380 | if (dirty[i].x < 0 || dirty[i].y < 0) | ||
381 | continue; | ||
382 | ZeroMemory(((BYTE *)lr.pBits) + i * lr.Pitch + dirty[i].x * 4, | ||
383 | sizeof(DWORD) * (dirty[i].y - dirty[i].x + 1)); | ||
384 | } | ||
385 | } | ||
386 | |||
387 | if (FAILED(entry.texture->UnlockRect(0))) | ||
388 | { | ||
389 | WRN("Failed to unlock texture"); | ||
390 | return false; | ||
391 | } | ||
392 | return true; | ||
393 | } | ||
394 | |||
395 | bool D3DImageCache::UpdateImageDataDiscard(CacheEntryInfo &info, DWORD *data) | ||
396 | { | ||
397 | assert(data != NULL); | ||
398 | if (info.id < 0 || info.id >= _cache.Length()) | ||
399 | return false; | ||
400 | CacheEntry &entry = _cache[info.id]; | ||
401 | if (entry.texture == NULL) | ||
402 | return false; | ||
403 | |||
404 | RECT rc = {0, 0, entry.width, entry.height}; | ||
405 | D3DLOCKED_RECT lr; | ||
406 | if (FAILED(entry.texture->LockRect(0, &lr, &rc, 0))) | ||
407 | { | ||
408 | WRN("Failed to lock texture"); | ||
409 | return false; | ||
410 | } | ||
411 | |||
412 | for (int i = 0; i < rc.bottom; i++) | ||
413 | { | ||
414 | CopyMemory(((BYTE *)lr.pBits) + i * lr.Pitch, | ||
415 | data + i * rc.right, sizeof(DWORD) * rc.right); | ||
416 | } | ||
417 | |||
418 | if (FAILED(entry.texture->UnlockRect(0))) | ||
419 | { | ||
420 | WRN("Failed to unlock texture"); | ||
421 | return false; | ||
422 | } | ||
423 | return true; | ||
424 | } | ||
425 | |||
426 | bool D3DImageCache::GetImageData(CacheEntryInfo &info, TArray<DWORD> &data) | ||
427 | { | ||
428 | if (info.id < 0 || info.id >= _cache.Length()) | ||
429 | return false; | ||
430 | CacheEntry ce_copy = _cache[info.id]; | ||
431 | ce_copy.cur_x = int(info.u * FLOAT(ce_copy.width)); | ||
432 | ce_copy.cur_y = int(info.v * FLOAT(ce_copy.height)); | ||
433 | data.Allocate(info.width * info.height); | ||
434 | |||
435 | return RetrieveData(ce_copy, data.Data(), info.width, info.height); | ||
436 | } | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_image_cache.h b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_image_cache.h new file mode 100644 index 0000000..6fb4c18 --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_image_cache.h | |||
@@ -0,0 +1,108 @@ | |||
1 | #ifndef __EVAS_DIRECT3D_IMAGE_CACHE_H__ | ||
2 | #define __EVAS_DIRECT3D_IMAGE_CACHE_H__ | ||
3 | |||
4 | #include "evas_engine.h" | ||
5 | |||
6 | #include "ref.h" | ||
7 | #include "array.h" | ||
8 | |||
9 | class D3DDevice; | ||
10 | |||
11 | class D3DImageCache : virtual public Referenc | ||
12 | { | ||
13 | public: | ||
14 | struct CacheEntryInfo | ||
15 | { | ||
16 | int id; | ||
17 | int width, height; | ||
18 | FLOAT u, v; | ||
19 | FLOAT du, dv; | ||
20 | }; | ||
21 | |||
22 | public: | ||
23 | ~D3DImageCache(); | ||
24 | |||
25 | static D3DImageCache *Current(); | ||
26 | static void SetCurrent(D3DImageCache *obj); | ||
27 | |||
28 | inline void SetMaxSize(int w, int h); | ||
29 | inline void SetMargin(int margin); | ||
30 | |||
31 | bool InsertImage(D3DDevice *d3d, DWORD *data, int w, int h, CacheEntryInfo &info); | ||
32 | bool InsertImage(D3DDevice *d3d, int id, DWORD *data, int w, int h, CacheEntryInfo &info); | ||
33 | bool CreateImage(D3DDevice *d3d, int w, int h, bool locked, CacheEntryInfo &info); | ||
34 | bool ResizeImage(D3DDevice *d3d, int nw, int nh, int id); | ||
35 | bool SelectImageToDevice(D3DDevice *d3d, int id); | ||
36 | void RemoveImageUser(int id); | ||
37 | void AddImageUser(int id); | ||
38 | bool UpdateImageData(CacheEntryInfo &info, DWORD *data); | ||
39 | bool UpdateImageDataWithDirtyInfo(CacheEntryInfo &info, DWORD *data, POINT *dirty); | ||
40 | bool UpdateImageDataDiscard(CacheEntryInfo &info, DWORD *data); | ||
41 | bool GetImageData(CacheEntryInfo &info, TArray<DWORD> &data); | ||
42 | void Uninitialize(); | ||
43 | |||
44 | inline int GetImageWidth(int image_id); | ||
45 | inline int GetImageHeight(int image_id); | ||
46 | |||
47 | inline void SetImageStage(int image_id, int stage); | ||
48 | |||
49 | private: | ||
50 | struct CacheEntry | ||
51 | { | ||
52 | LPDIRECT3DTEXTURE9 texture; | ||
53 | int width; | ||
54 | int height; | ||
55 | int cur_x; | ||
56 | int cur_y; | ||
57 | int cur_h; | ||
58 | int users; | ||
59 | bool locked; | ||
60 | int stage; | ||
61 | }; | ||
62 | |||
63 | private: | ||
64 | D3DImageCache(); | ||
65 | |||
66 | bool RequestInsert(CacheEntry &entry, int w, int h); | ||
67 | bool CreateEntry(D3DDevice *d3d, CacheEntry &entry, int w, int h, bool exact_size = false); | ||
68 | bool InsertData(CacheEntry &entry, DWORD *data, int w, int h); | ||
69 | bool RetrieveData(CacheEntry &entry, DWORD *data, int w, int h); | ||
70 | void UpdateInsert(CacheEntry &entry, int w, int h); | ||
71 | |||
72 | private: | ||
73 | TArray<CacheEntry> _cache; | ||
74 | int _max_width; | ||
75 | int _max_height; | ||
76 | |||
77 | int _margin; | ||
78 | |||
79 | static Ref<D3DImageCache> _this; | ||
80 | }; | ||
81 | |||
82 | void D3DImageCache::SetMaxSize(int w, int h) | ||
83 | { | ||
84 | _max_width = w; | ||
85 | _max_height = h; | ||
86 | } | ||
87 | |||
88 | void D3DImageCache::SetMargin(int margin) | ||
89 | { | ||
90 | _margin = margin; | ||
91 | } | ||
92 | |||
93 | int D3DImageCache::GetImageWidth(int image_id) | ||
94 | { | ||
95 | return _cache[image_id].width; | ||
96 | } | ||
97 | |||
98 | int D3DImageCache::GetImageHeight(int image_id) | ||
99 | { | ||
100 | return _cache[image_id].height; | ||
101 | } | ||
102 | |||
103 | void D3DImageCache::SetImageStage(int image_id, int stage) | ||
104 | { | ||
105 | _cache[image_id].stage = stage; | ||
106 | } | ||
107 | |||
108 | #endif // __EVAS_DIRECT3D_IMAGE_CACHE_H__ | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_main.cpp b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_main.cpp new file mode 100644 index 0000000..fe1e13f --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_main.cpp | |||
@@ -0,0 +1,774 @@ | |||
1 | // Force the layered windows APIs to be visible. | ||
2 | #define _WIN32_WINNT 0x0500 | ||
3 | |||
4 | #include "evas_engine.h" | ||
5 | #include <assert.h> | ||
6 | |||
7 | #include <d3dx9.h> | ||
8 | |||
9 | #include "evas_direct3d_device.h" | ||
10 | #include "evas_direct3d_context.h" | ||
11 | #include "evas_direct3d_shader_pack.h" | ||
12 | #include "evas_direct3d_scene.h" | ||
13 | #include "evas_direct3d_image_cache.h" | ||
14 | #include "evas_direct3d_object_line.h" | ||
15 | #include "evas_direct3d_object_rect.h" | ||
16 | #include "evas_direct3d_object_image.h" | ||
17 | #include "evas_direct3d_vertex_buffer_cache.h" | ||
18 | #include "evas_direct3d_object_font.h" | ||
19 | |||
20 | // Internal structure that joins two types of objects | ||
21 | struct ImagePtr | ||
22 | { | ||
23 | Ref<D3DObjectImage> ref; | ||
24 | RGBA_Image *img; | ||
25 | }; | ||
26 | |||
27 | struct DevicePtr | ||
28 | { | ||
29 | Ref<D3DDevice> device; | ||
30 | Ref<D3DScene> scene; | ||
31 | Ref<D3DContext> context; | ||
32 | Ref<D3DImageCache> image_cache; | ||
33 | Ref<D3DShaderPack> shader_pack; | ||
34 | Ref<D3DVertexBufferCache> vb_cache; | ||
35 | |||
36 | int fonts_buffer_image_id; | ||
37 | |||
38 | // Layered windows cannot render D3D in the normal way | ||
39 | bool layered; | ||
40 | |||
41 | // Window shape mask | ||
42 | struct | ||
43 | { | ||
44 | // Width and height may be different from target size | ||
45 | int width; | ||
46 | int height; | ||
47 | // Pointer to external memory location, dont do anything with it | ||
48 | unsigned char *mask; | ||
49 | } shape; | ||
50 | |||
51 | // GDI output target | ||
52 | struct | ||
53 | { | ||
54 | HBITMAP image; | ||
55 | HDC hdc; | ||
56 | BITMAPINFO info; | ||
57 | BYTE *data; | ||
58 | } dib; | ||
59 | |||
60 | }; | ||
61 | |||
62 | DevicePtr *SelectDevice(Direct3DDeviceHandler d3d) | ||
63 | { | ||
64 | DevicePtr *dev_ptr = (DevicePtr *)d3d; | ||
65 | D3DImageCache::SetCurrent(dev_ptr->image_cache); | ||
66 | D3DShaderPack::SetCurrent(dev_ptr->shader_pack); | ||
67 | D3DVertexBufferCache::SetCurrent(dev_ptr->vb_cache); | ||
68 | return dev_ptr; | ||
69 | } | ||
70 | |||
71 | void DeleteDIBObjects(DevicePtr *dev_ptr) | ||
72 | { | ||
73 | assert(dev_ptr != NULL); | ||
74 | if (dev_ptr->dib.image != NULL) | ||
75 | DeleteObject(dev_ptr->dib.image); | ||
76 | if (dev_ptr->dib.hdc != NULL) | ||
77 | DeleteDC(dev_ptr->dib.hdc); | ||
78 | ZeroMemory(&dev_ptr->dib, sizeof(dev_ptr->dib)); | ||
79 | } | ||
80 | |||
81 | bool CreateDIBObjects(DevicePtr *dev_ptr) | ||
82 | { | ||
83 | assert(dev_ptr != NULL); | ||
84 | if ((dev_ptr->dib.hdc = CreateCompatibleDC(NULL)) == NULL) | ||
85 | { | ||
86 | WRN("Failed to create compatible DC"); | ||
87 | return false; | ||
88 | } | ||
89 | ZeroMemory(&dev_ptr->dib.info, sizeof(dev_ptr->dib.info)); | ||
90 | dev_ptr->dib.info.bmiHeader.biSize = sizeof(dev_ptr->dib.info.bmiHeader); | ||
91 | dev_ptr->dib.info.bmiHeader.biBitCount = 32; | ||
92 | dev_ptr->dib.info.bmiHeader.biWidth = dev_ptr->device->GetWidth(); | ||
93 | dev_ptr->dib.info.bmiHeader.biHeight = -dev_ptr->device->GetHeight(); | ||
94 | dev_ptr->dib.info.bmiHeader.biCompression = BI_RGB; | ||
95 | dev_ptr->dib.info.bmiHeader.biPlanes = 1; | ||
96 | if ((dev_ptr->dib.image = CreateDIBSection(dev_ptr->dib.hdc, &dev_ptr->dib.info, | ||
97 | DIB_RGB_COLORS, (void **)&dev_ptr->dib.data, NULL, 0)) == NULL) | ||
98 | { | ||
99 | WRN("Failed to create dib section"); | ||
100 | DeleteDIBObjects(dev_ptr); | ||
101 | return false; | ||
102 | } | ||
103 | assert(dev_ptr->dib.data != NULL); | ||
104 | GdiFlush(); | ||
105 | return true; | ||
106 | } | ||
107 | |||
108 | |||
109 | |||
110 | |||
111 | extern "C" { | ||
112 | |||
113 | Direct3DDeviceHandler evas_direct3d_init(HWND window, int depth, int fullscreen) | ||
114 | { | ||
115 | Ref<D3DDevice> device = new D3DDevice(); | ||
116 | if (!device->Init(window, depth, fullscreen == 1)) | ||
117 | return NULL; | ||
118 | |||
119 | D3DImageCache::SetCurrent(NULL); | ||
120 | D3DShaderPack::SetCurrent(NULL); | ||
121 | D3DVertexBufferCache::SetCurrent(NULL); | ||
122 | |||
123 | if (!D3DShaderPack::Current()->Initialize(device)) | ||
124 | { | ||
125 | ERR("Failed to build shader pack"); | ||
126 | device->Destroy(); | ||
127 | return NULL; | ||
128 | } | ||
129 | |||
130 | DevicePtr *dev_ptr = new DevicePtr; | ||
131 | ZeroMemory(dev_ptr, sizeof(DevicePtr)); | ||
132 | dev_ptr->device = device; | ||
133 | dev_ptr->scene = new D3DScene(); | ||
134 | dev_ptr->context = new D3DContext(); | ||
135 | dev_ptr->image_cache = D3DImageCache::Current(); | ||
136 | dev_ptr->shader_pack = D3DShaderPack::Current(); | ||
137 | dev_ptr->vb_cache = D3DVertexBufferCache::Current(); | ||
138 | dev_ptr->fonts_buffer_image_id = -1; | ||
139 | |||
140 | D3DImageCache::CacheEntryInfo info; | ||
141 | if (!D3DImageCache::Current()->CreateImage(device, device->GetWidth(), device->GetHeight(), | ||
142 | true, info)) | ||
143 | { | ||
144 | WRN("Failed to create fonts image buffer"); | ||
145 | return NULL; | ||
146 | } | ||
147 | dev_ptr->fonts_buffer_image_id = info.id; | ||
148 | D3DImageCache::Current()->SetImageStage(info.id, 1); | ||
149 | |||
150 | return (Direct3DDeviceHandler)dev_ptr; | ||
151 | } | ||
152 | |||
153 | void | ||
154 | evas_direct3d_free(Direct3DDeviceHandler d3d) | ||
155 | { | ||
156 | DevicePtr *dev_ptr = SelectDevice(d3d); | ||
157 | |||
158 | DeleteDIBObjects(dev_ptr); | ||
159 | |||
160 | dev_ptr->context = NULL; | ||
161 | dev_ptr->scene = NULL; | ||
162 | dev_ptr->image_cache = NULL; | ||
163 | dev_ptr->shader_pack = NULL; | ||
164 | D3DShaderPack::Current()->Uninitialize(); | ||
165 | D3DImageCache::Current()->Uninitialize(); | ||
166 | D3DVertexBufferCache::Current()->Uninitialize(); | ||
167 | D3DShaderPack::SetCurrent(NULL); | ||
168 | D3DImageCache::SetCurrent(NULL); | ||
169 | D3DVertexBufferCache::SetCurrent(NULL); | ||
170 | |||
171 | dev_ptr->device = NULL; | ||
172 | delete dev_ptr; | ||
173 | |||
174 | DBG("uninitialized"); | ||
175 | } | ||
176 | |||
177 | void | ||
178 | evas_direct3d_resize(Direct3DDeviceHandler d3d, int width, int height) | ||
179 | { | ||
180 | DevicePtr *dev_ptr = SelectDevice(d3d); | ||
181 | D3DDevice *device = dev_ptr->device; | ||
182 | if (!device->Reset(width, height, -1)) | ||
183 | { | ||
184 | ERR("Failed to resize"); | ||
185 | return; | ||
186 | } | ||
187 | if (!D3DImageCache::Current()->ResizeImage(device, width, height, | ||
188 | dev_ptr->fonts_buffer_image_id)) | ||
189 | { | ||
190 | WRN("Failed to resize fonts image buffer"); | ||
191 | } | ||
192 | if (dev_ptr->layered) | ||
193 | { | ||
194 | DeleteDIBObjects(dev_ptr); | ||
195 | if (!CreateDIBObjects(dev_ptr)) | ||
196 | WRN("Failed to create dib objects"); | ||
197 | } | ||
198 | } | ||
199 | |||
200 | void | ||
201 | evas_direct3d_set_fullscreen(Direct3DDeviceHandler d3d, int width, int height, int fullscreen) | ||
202 | { | ||
203 | DevicePtr *dev_ptr = SelectDevice(d3d); | ||
204 | D3DDevice *device = dev_ptr->device; | ||
205 | |||
206 | if (width < 0) | ||
207 | width = ::GetSystemMetrics(SM_CXSCREEN); | ||
208 | if (height < 0) | ||
209 | height = ::GetSystemMetrics(SM_CYSCREEN); | ||
210 | |||
211 | if (!device->Reset(width, height, fullscreen)) | ||
212 | { | ||
213 | WRN("Failed to resize"); | ||
214 | return; | ||
215 | } | ||
216 | if (!D3DImageCache::Current()->ResizeImage(device, width, height, | ||
217 | dev_ptr->fonts_buffer_image_id)) | ||
218 | { | ||
219 | WRN("Failed to resize fonts image buffer"); | ||
220 | } | ||
221 | |||
222 | if (fullscreen == 0) | ||
223 | InvalidateRect(HWND_DESKTOP, NULL, TRUE); | ||
224 | } | ||
225 | |||
226 | void | ||
227 | evas_direct3d_set_layered(Direct3DDeviceHandler d3d, int layered, | ||
228 | int mask_width, int mask_height, unsigned char *mask) | ||
229 | { | ||
230 | DevicePtr *dev_ptr = SelectDevice(d3d); | ||
231 | dev_ptr->layered = (layered != 0); | ||
232 | dev_ptr->shape.width = mask_width; | ||
233 | dev_ptr->shape.height = mask_height; | ||
234 | dev_ptr->shape.mask = mask; | ||
235 | |||
236 | if (dev_ptr->layered && dev_ptr->dib.data == NULL) | ||
237 | CreateDIBObjects(dev_ptr); | ||
238 | else if (!dev_ptr->layered) | ||
239 | DeleteDIBObjects(dev_ptr); | ||
240 | } | ||
241 | |||
242 | void | ||
243 | evas_direct3d_context_color_set(Direct3DDeviceHandler d3d, int r, int g, int b, int a) | ||
244 | { | ||
245 | DevicePtr *dev_ptr = SelectDevice(d3d); | ||
246 | dev_ptr->context->color = ((a & 0xff) << 24) | ((r & 0xff) << 16) | | ||
247 | ((g & 0xff) << 8) | (b & 0xff); | ||
248 | } | ||
249 | |||
250 | void | ||
251 | evas_direct3d_context_set_multiplier(Direct3DDeviceHandler d3d, int r, int g, int b, int a) | ||
252 | { | ||
253 | DevicePtr *dev_ptr = SelectDevice(d3d); | ||
254 | dev_ptr->context->color_mul = ((a & 0xff) << 24) | ((r & 0xff) << 16) | | ||
255 | ((g & 0xff) << 8) | (b & 0xff); | ||
256 | } | ||
257 | |||
258 | void | ||
259 | evas_direct3d_render_all(Direct3DDeviceHandler d3d) | ||
260 | { | ||
261 | DBG("render"); | ||
262 | assert(d3d != NULL); | ||
263 | DevicePtr *dev_ptr = SelectDevice(d3d); | ||
264 | D3DDevice *device = dev_ptr->device; | ||
265 | D3DScene *scene = dev_ptr->scene; | ||
266 | |||
267 | if (!device->Begin()) | ||
268 | return; | ||
269 | |||
270 | device->GetDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); | ||
271 | device->GetDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); | ||
272 | device->GetDevice()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); | ||
273 | |||
274 | //device->GetDevice()->SetSamplerState(1, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); | ||
275 | //device->GetDevice()->SetSamplerState(1, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); | ||
276 | |||
277 | D3DObjectLine::BeginCache(); | ||
278 | D3DObjectRect::BeginCache(); | ||
279 | D3DObjectImage::BeginCache(); | ||
280 | scene->DrawAll(device); | ||
281 | D3DObjectLine::EndCache(device); | ||
282 | D3DObjectRect::EndCache(device); | ||
283 | D3DObjectImage::EndCache(device); | ||
284 | D3DObjectFont::EndCache(device); | ||
285 | |||
286 | device->End(); | ||
287 | |||
288 | if (dev_ptr->layered && !device->GetFullscreen() && dev_ptr->dib.data != NULL) | ||
289 | { | ||
290 | HDC hdc = GetDC(device->GetWindow()); | ||
291 | if (hdc != NULL) | ||
292 | { | ||
293 | POINT dest = {0, 0}; | ||
294 | POINT src = {0, 0}; | ||
295 | SIZE client = {device->GetWidth(), device->GetHeight()}; | ||
296 | BLENDFUNCTION blend_func = {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA}; | ||
297 | |||
298 | if (device->GetRenderData().Length() == client.cx * client.cy) | ||
299 | { | ||
300 | CopyMemory(dev_ptr->dib.data, device->GetRenderData().Data(), | ||
301 | sizeof(DWORD) * client.cx * client.cy); | ||
302 | } | ||
303 | |||
304 | for (int i = 0; i < client.cy; i++) | ||
305 | { | ||
306 | for (int j = 0; j < client.cx; j++) | ||
307 | { | ||
308 | int mask_i = int(dev_ptr->shape.height * float(i) / float(client.cy)); | ||
309 | int mask_j = int(dev_ptr->shape.width * float(j) / float(client.cx)); | ||
310 | if (mask_i < 0) | ||
311 | mask_i = 0; | ||
312 | else if (mask_i >= dev_ptr->shape.height) | ||
313 | mask_i = dev_ptr->shape.height - 1; | ||
314 | if (mask_j < 0) | ||
315 | mask_j = 0; | ||
316 | else if (mask_j >= dev_ptr->shape.width) | ||
317 | mask_j = dev_ptr->shape.width - 1; | ||
318 | BYTE mask_b = dev_ptr->shape.mask[mask_i * dev_ptr->shape.width + mask_j]; | ||
319 | float alpha = float(mask_b) / 255.f; | ||
320 | |||
321 | dev_ptr->dib.data[j * 4 + 0 + i * 4 * client.cx] = BYTE(float(dev_ptr->dib.data[j * 4 + 0 + i * 4 * client.cx]) * alpha); | ||
322 | dev_ptr->dib.data[j * 4 + 1 + i * 4 * client.cx] = BYTE(float(dev_ptr->dib.data[j * 4 + 1 + i * 4 * client.cx]) * alpha); | ||
323 | dev_ptr->dib.data[j * 4 + 2 + i * 4 * client.cx] = BYTE(float(dev_ptr->dib.data[j * 4 + 2 + i * 4 * client.cx]) * alpha); | ||
324 | dev_ptr->dib.data[j * 4 + 3 + i * 4 * client.cx] = mask_b; | ||
325 | } | ||
326 | } | ||
327 | HGDIOBJ prev_obj = SelectObject(dev_ptr->dib.hdc, dev_ptr->dib.image); | ||
328 | ClientToScreen(device->GetWindow(), &dest); | ||
329 | |||
330 | UpdateLayeredWindow(device->GetWindow(), hdc, &dest, &client, | ||
331 | dev_ptr->dib.hdc, &src, 0, &blend_func, ULW_ALPHA); | ||
332 | |||
333 | SelectObject(dev_ptr->dib.hdc, prev_obj); | ||
334 | ReleaseDC(device->GetWindow(), hdc); | ||
335 | } | ||
336 | } | ||
337 | scene->FreeObjects(); | ||
338 | } | ||
339 | |||
340 | void evas_direct3d_line_draw(Direct3DDeviceHandler d3d, int x1, int y1, int x2, int y2) | ||
341 | { | ||
342 | DevicePtr *dev_ptr = SelectDevice(d3d); | ||
343 | D3DDevice *device = dev_ptr->device; | ||
344 | D3DScene *scene = dev_ptr->scene; | ||
345 | D3DContext *context = dev_ptr->context; | ||
346 | |||
347 | Ref<D3DObjectLine> line = scene->GetFreeObject<D3DObjectLine>(); | ||
348 | if (line == NULL) | ||
349 | { | ||
350 | line = new D3DObjectLine(); | ||
351 | scene->AddObject(line); | ||
352 | DBG("New line object (total objects: %d)", scene->GetObjectCount()); | ||
353 | } | ||
354 | else | ||
355 | { | ||
356 | line->SetFree(false); | ||
357 | DBG("Line reused (object: %p)", line.Addr()); | ||
358 | } | ||
359 | |||
360 | line->Setup( | ||
361 | 2.f * float(x1) / float(device->GetWidth()) - 1.f, | ||
362 | 2.f * (1.f - float(y1) / float(device->GetHeight())) - 1.f, | ||
363 | 2.f * float(x2) / float(device->GetWidth()) - 1.f, | ||
364 | 2.f * (1.f - float(y2) / float(device->GetHeight())) - 1.f, | ||
365 | context->color); | ||
366 | } | ||
367 | |||
368 | void evas_direct3d_rectangle_draw(Direct3DDeviceHandler d3d, int x, int y, int w, int h) | ||
369 | { | ||
370 | DevicePtr *dev_ptr = SelectDevice(d3d); | ||
371 | D3DDevice *device = dev_ptr->device; | ||
372 | D3DScene *scene = dev_ptr->scene; | ||
373 | D3DContext *context = dev_ptr->context; | ||
374 | |||
375 | Ref<D3DObjectRect> rect = scene->GetFreeObject<D3DObjectRect>(); | ||
376 | if (rect == NULL) | ||
377 | { | ||
378 | rect = new D3DObjectRect(); | ||
379 | scene->AddObject(rect); | ||
380 | DBG("New rect object (total objects: %d)", scene->GetObjectCount()); | ||
381 | } | ||
382 | else | ||
383 | { | ||
384 | rect->SetFree(false); | ||
385 | DBG("Rect reused (object: %p)", rect.Addr()); | ||
386 | } | ||
387 | |||
388 | rect->Setup( | ||
389 | 2.f * float(x) / float(device->GetWidth()) - 1.f, | ||
390 | 2.f * (1.f - float(y) / float(device->GetHeight())) - 1.f, | ||
391 | 2.f * float(w) / float(device->GetWidth()), | ||
392 | -2.f * float(h) / float(device->GetHeight()), | ||
393 | context->color); | ||
394 | } | ||
395 | |||
396 | Direct3DImageHandler evas_direct3d_image_load(Direct3DDeviceHandler d3d, | ||
397 | const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo) | ||
398 | { | ||
399 | DevicePtr *dev_ptr = SelectDevice(d3d); | ||
400 | D3DDevice *device = dev_ptr->device; | ||
401 | D3DScene *scene = dev_ptr->scene; | ||
402 | |||
403 | RGBA_Image *evas_image = evas_common_load_image_from_file(file, key, lo); | ||
404 | if (evas_image == NULL) | ||
405 | { | ||
406 | WRN("Failed to load image from %s", file); | ||
407 | return NULL; | ||
408 | } | ||
409 | int image_width = evas_image->cache_entry.w; | ||
410 | int image_height = evas_image->cache_entry.h; | ||
411 | assert(image_width > 0 && image_height > 0); | ||
412 | |||
413 | D3DImageCache::CacheEntryInfo info; | ||
414 | ZeroMemory(&info, sizeof(info)); | ||
415 | info.id = -1; | ||
416 | |||
417 | Ref<D3DObjectImage> image = new D3DObjectImage(); | ||
418 | image->Init(info.u, info.v, info.du, info.dv, info.id, | ||
419 | info.width, info.height, evas_image->cache_entry.file); | ||
420 | image->SetFree(true); | ||
421 | scene->AddObject(image); | ||
422 | |||
423 | DBG("New image object (total objects: %d)", scene->GetObjectCount()); | ||
424 | |||
425 | ImagePtr *ptr = new ImagePtr; | ||
426 | ptr->ref = image; | ||
427 | ptr->img = evas_image; | ||
428 | |||
429 | return (Direct3DImageHandler)ptr; | ||
430 | } | ||
431 | |||
432 | Direct3DImageHandler evas_direct3d_image_new_from_data(Direct3DDeviceHandler d3d, | ||
433 | int w, int h, DWORD *image_data, int alpha, int cspace) | ||
434 | { | ||
435 | DevicePtr *dev_ptr = SelectDevice(d3d); | ||
436 | D3DDevice *device = dev_ptr->device; | ||
437 | D3DScene *scene = dev_ptr->scene; | ||
438 | |||
439 | int image_width = w; | ||
440 | int image_height = h; | ||
441 | assert(image_width > 0 && image_height > 0); | ||
442 | |||
443 | Ref<D3DObjectImage> image = new D3DObjectImage(); | ||
444 | |||
445 | D3DImageCache::CacheEntryInfo info; | ||
446 | ZeroMemory(&info, sizeof(info)); | ||
447 | if (!D3DImageCache::Current()->InsertImage(device, image_data, | ||
448 | image_width, image_height, info)) | ||
449 | { | ||
450 | WRN("Couldnt add image to the cache"); | ||
451 | return NULL; | ||
452 | } | ||
453 | char buf[64]; | ||
454 | sprintf(buf, "%p", image_data); | ||
455 | image->Init(info.u, info.v, info.du, info.dv, info.id, | ||
456 | info.width, info.height, buf); | ||
457 | |||
458 | image->SetFree(true); | ||
459 | scene->AddObject(image); | ||
460 | |||
461 | DBG("New image object (total objects: %d)", scene->GetObjectCount()); | ||
462 | |||
463 | ImagePtr *ptr = new ImagePtr; | ||
464 | ptr->ref = image; | ||
465 | ptr->img = NULL; | ||
466 | |||
467 | return (Direct3DImageHandler)ptr; | ||
468 | } | ||
469 | |||
470 | Direct3DImageHandler evas_direct3d_image_new_from_copied_data(Direct3DDeviceHandler d3d, | ||
471 | int w, int h, DWORD *image_data, int alpha, int cspace) | ||
472 | { | ||
473 | return evas_direct3d_image_new_from_data(d3d, w, h, image_data, alpha, cspace); | ||
474 | } | ||
475 | |||
476 | void evas_direct3d_image_free(Direct3DDeviceHandler d3d, Direct3DImageHandler image) | ||
477 | { | ||
478 | DevicePtr *dev_ptr = SelectDevice(d3d); | ||
479 | D3DDevice *device = dev_ptr->device; | ||
480 | D3DScene *scene = dev_ptr->scene; | ||
481 | |||
482 | ImagePtr *ptr = (ImagePtr *)image; | ||
483 | |||
484 | Ref<D3DObjectImage> image_ref = ptr->ref; | ||
485 | assert(!image_ref.IsNull()); | ||
486 | scene->DeleteObject(image_ref); | ||
487 | |||
488 | delete ptr; | ||
489 | } | ||
490 | |||
491 | void evas_direct3d_image_data_put(Direct3DDeviceHandler d3d, Direct3DImageHandler image, | ||
492 | DWORD *image_data) | ||
493 | { | ||
494 | ImagePtr *ptr = (ImagePtr *)image; | ||
495 | Ref<D3DObjectImage> image_ref = ptr->ref; | ||
496 | //assert(!image_ref.IsNull()); | ||
497 | if (image_ref.IsNull()) | ||
498 | return; | ||
499 | |||
500 | if (!image_ref->UpdateImageData(image_data)) | ||
501 | ERR("Failed to update image data"); | ||
502 | } | ||
503 | |||
504 | void evas_direct3d_image_data_get(Direct3DDeviceHandler d3d, Direct3DImageHandler image, | ||
505 | int to_write, DATA32 **image_data) | ||
506 | { | ||
507 | ImagePtr *ptr = (ImagePtr *)image; | ||
508 | Ref<D3DObjectImage> image_ref = ptr->ref; | ||
509 | if (image_ref.IsNull()) | ||
510 | return; | ||
511 | if (image_data == NULL) | ||
512 | return; | ||
513 | assert(sizeof(DATA32) == sizeof(DWORD)); | ||
514 | *image_data = (DATA32 *)image_ref->GetImageData(); | ||
515 | } | ||
516 | |||
517 | void evas_direct3d_image_draw(Direct3DDeviceHandler d3d, Direct3DImageHandler image, | ||
518 | int src_x, int src_y, int src_w, int src_h, | ||
519 | int dst_x, int dst_y, int dst_w, int dst_h, int smooth) | ||
520 | { | ||
521 | ImagePtr *ptr = (ImagePtr *)image; | ||
522 | Ref<D3DObjectImage> image_ref = ptr->ref; | ||
523 | RGBA_Image *evas_image = ptr->img; | ||
524 | DevicePtr *dev_ptr = SelectDevice(d3d); | ||
525 | D3DDevice *device = dev_ptr->device; | ||
526 | D3DScene *scene = dev_ptr->scene; | ||
527 | //assert(!image_ref.IsNull()); | ||
528 | if (image_ref.IsNull()) | ||
529 | return; | ||
530 | |||
531 | if (!image_ref->IsValid()) | ||
532 | { | ||
533 | TArray<D3DObjectImage *> images; | ||
534 | scene->GetObjectsOfType<D3DObjectImage>(images); | ||
535 | bool found = false; | ||
536 | for (int i = 0; i < images.Length(); i++) | ||
537 | { | ||
538 | if (images[i]->IsValid() && | ||
539 | _stricmp(images[i]->GetSource(), image_ref->GetSource()) == 0) | ||
540 | { | ||
541 | images[i]->CopyTo(image_ref); | ||
542 | found = true; | ||
543 | WRN("Image object info reused, source: \"%s\"", image_ref->GetSource()); | ||
544 | break; | ||
545 | } | ||
546 | } | ||
547 | if (!found && evas_image != NULL) | ||
548 | evas_cache_image_load_data(&evas_image->cache_entry); | ||
549 | } | ||
550 | |||
551 | // If the image object wasn't initialized yet | ||
552 | if (evas_image != NULL && evas_image->image.data != NULL && !image_ref->IsValid()) | ||
553 | { | ||
554 | D3DImageCache::CacheEntryInfo info; | ||
555 | ZeroMemory(&info, sizeof(info)); | ||
556 | if (!D3DImageCache::Current()->InsertImage(device, (DWORD *)evas_image->image.data, | ||
557 | evas_image->cache_entry.w, evas_image->cache_entry.h, info)) | ||
558 | { | ||
559 | WRN("Couldnt add image to the cache"); | ||
560 | return; | ||
561 | } | ||
562 | image_ref->Init(info.u, info.v, info.du, info.dv, info.id, | ||
563 | info.width, info.height, evas_image->cache_entry.file); | ||
564 | } | ||
565 | |||
566 | // Do not draw invalid objects | ||
567 | if (!image_ref->IsValid()) | ||
568 | { | ||
569 | image_ref->SetFree(true); | ||
570 | return; | ||
571 | } | ||
572 | |||
573 | image_ref->Setup( | ||
574 | 2.f * float(dst_x) / float(device->GetWidth()) - 1.f, | ||
575 | 2.f * (1.f - float(dst_y) / float(device->GetHeight())) - 1.f, | ||
576 | 2.f * float(dst_w) / float(device->GetWidth()), | ||
577 | -2.f * float(dst_h) / float(device->GetHeight()), | ||
578 | src_x, src_y, src_w, src_h); | ||
579 | |||
580 | image_ref->SetupColorFilter(dev_ptr->context->color_mul); | ||
581 | |||
582 | image_ref->SetFree(false); | ||
583 | } | ||
584 | |||
585 | void evas_direct3d_image_size_get(Direct3DImageHandler image, int *w, int *h) | ||
586 | { | ||
587 | ImagePtr *ptr = (ImagePtr *)image; | ||
588 | if (ptr == NULL) | ||
589 | return; | ||
590 | if (ptr->img != NULL) | ||
591 | { | ||
592 | if (w != NULL) | ||
593 | *w = ptr->img->cache_entry.w; | ||
594 | if (h != NULL) | ||
595 | *h = ptr->img->cache_entry.h; | ||
596 | } | ||
597 | else if (!ptr->ref.IsNull()) | ||
598 | { | ||
599 | if (w != NULL) | ||
600 | *w = ptr->ref->GetWidth(); | ||
601 | if (h != NULL) | ||
602 | *h = ptr->ref->GetHeight(); | ||
603 | } | ||
604 | } | ||
605 | |||
606 | void evas_direct3d_image_border_set(Direct3DDeviceHandler d3d, Direct3DImageHandler image, | ||
607 | int l, int r, int t, int b) | ||
608 | { | ||
609 | ImagePtr *ptr = (ImagePtr *)image; | ||
610 | Ref<D3DObjectImage> image_ref = ptr->ref; | ||
611 | DevicePtr *dev_ptr = SelectDevice(d3d); | ||
612 | D3DDevice *device = dev_ptr->device; | ||
613 | if (image_ref.IsNull()) | ||
614 | return; | ||
615 | |||
616 | int im_w, im_h; | ||
617 | if (ptr->img != NULL) | ||
618 | { | ||
619 | im_w = ptr->img->cache_entry.w; | ||
620 | im_h = ptr->img->cache_entry.h; | ||
621 | } | ||
622 | else | ||
623 | { | ||
624 | im_w = image_ref->GetWidth(); | ||
625 | im_h = image_ref->GetHeight(); | ||
626 | } | ||
627 | |||
628 | image_ref->SetupBorder( | ||
629 | D3DXVECTOR4( | ||
630 | 2.f * float(l) / float(device->GetWidth()), | ||
631 | -2.f * float(t) / float(device->GetHeight()), | ||
632 | 2.f * float(r) / float(device->GetWidth()), | ||
633 | -2.f * float(b) / float(device->GetHeight())), | ||
634 | D3DXVECTOR4(float(l) / float(im_w), | ||
635 | float(t) / float(im_h), | ||
636 | float(r) / float(im_w), | ||
637 | float(b) / float(im_h))); | ||
638 | } | ||
639 | |||
640 | void evas_direct3d_image_border_get(Direct3DDeviceHandler d3d, Direct3DImageHandler image, | ||
641 | int *l, int *r, int *t, int *b) | ||
642 | { | ||
643 | ImagePtr *ptr = (ImagePtr *)image; | ||
644 | Ref<D3DObjectImage> image_ref = ptr->ref; | ||
645 | DevicePtr *dev_ptr = SelectDevice(d3d); | ||
646 | D3DDevice *device = dev_ptr->device; | ||
647 | if (image_ref.IsNull()) | ||
648 | return; | ||
649 | assert(l != NULL && r != NULL && b != NULL && t != NULL); | ||
650 | *l = (int)(0.5f * image_ref->GetBorderLeft() * device->GetWidth()); | ||
651 | *r = (int)(0.5f * image_ref->GetBorderRight() * device->GetWidth()); | ||
652 | *t = (int)(-0.5f * image_ref->GetBorderTop() * device->GetHeight()); | ||
653 | *b = (int)(-0.5f * image_ref->GetBorderBottom() * device->GetHeight()); | ||
654 | } | ||
655 | |||
656 | |||
657 | Direct3DFontGlyphHandler evas_direct3d_font_texture_new(Direct3DDeviceHandler d3d, | ||
658 | RGBA_Font_Glyph *fg) | ||
659 | { | ||
660 | DevicePtr *dev_ptr = SelectDevice(d3d); | ||
661 | D3DContext *context = dev_ptr->context; | ||
662 | D3DDevice *device = dev_ptr->device; | ||
663 | |||
664 | if (context->font.IsNull()) | ||
665 | return NULL; | ||
666 | |||
667 | D3DObjectFont *font = (D3DObjectFont *)context->font.Addr(); | ||
668 | // This is not reliable | ||
669 | //D3DObjectFont::Glyph *glyph = (D3DObjectFont::Glyph *)fg->ext_dat; | ||
670 | D3DObjectFont::Glyph *glyph = font->GetGlyph(fg); | ||
671 | if (glyph != NULL) | ||
672 | { | ||
673 | assert(glyph->Compare(fg)); | ||
674 | return glyph; | ||
675 | } | ||
676 | glyph = font->AddGlyph(device, fg, fg->glyph_out->bitmap.buffer, | ||
677 | fg->glyph_out->bitmap.width, fg->glyph_out->bitmap.rows, fg->glyph_out->bitmap.pitch); | ||
678 | return (Direct3DFontGlyphHandler)glyph; | ||
679 | } | ||
680 | |||
681 | void evas_direct3d_font_texture_free(Direct3DFontGlyphHandler ft) | ||
682 | { | ||
683 | if (ft == NULL) | ||
684 | return; | ||
685 | D3DObjectFont::Glyph *glyph = (D3DObjectFont::Glyph *)ft; | ||
686 | RGBA_Font_Glyph *fg = (RGBA_Font_Glyph *)glyph->Source(); | ||
687 | fg->ext_dat = NULL; | ||
688 | } | ||
689 | |||
690 | void evas_direct3d_font_texture_draw(Direct3DDeviceHandler d3d, void *, void *, | ||
691 | RGBA_Font_Glyph *fg, int x, int y) | ||
692 | { | ||
693 | DevicePtr *dev_ptr = SelectDevice(d3d); | ||
694 | D3DContext *context = dev_ptr->context; | ||
695 | D3DDevice *device = dev_ptr->device; | ||
696 | |||
697 | if (context->font.IsNull()) | ||
698 | return; | ||
699 | |||
700 | D3DObjectFont *font = (D3DObjectFont *)context->font.Addr(); | ||
701 | D3DObjectFont::Glyph *glyph = (D3DObjectFont::Glyph *)fg->ext_dat; | ||
702 | if (glyph == NULL) | ||
703 | return; | ||
704 | assert(glyph->Compare(fg)); | ||
705 | |||
706 | font->SetColor(context->color); | ||
707 | font->PushForDraw(glyph, x, y); | ||
708 | font->SetFree(false); | ||
709 | } | ||
710 | |||
711 | void evas_direct3d_select_or_create_font(Direct3DDeviceHandler d3d, void *font) | ||
712 | { | ||
713 | // The Plan | ||
714 | // 1. Create D3DObjectFont with source string = "%p" (font) | ||
715 | // 2. Or find this object in the scene | ||
716 | // 3. On each texture_new call - fill internal texture with glyph, remember the | ||
717 | // glyph pointer - we'll use it. | ||
718 | |||
719 | DevicePtr *dev_ptr = SelectDevice(d3d); | ||
720 | D3DContext *context = dev_ptr->context; | ||
721 | |||
722 | if (!context->font.IsNull() && ((D3DObjectFont *)context->font.Addr())->Compare(font)) | ||
723 | return; | ||
724 | |||
725 | D3DScene *scene = dev_ptr->scene; | ||
726 | |||
727 | static TArray<D3DObjectFont *> fonts; | ||
728 | scene->GetObjectsOfType<D3DObjectFont>(fonts); | ||
729 | for (int i = 0; i < fonts.Length(); i++) | ||
730 | { | ||
731 | if (fonts[i]->Compare(font)) | ||
732 | { | ||
733 | context->font = fonts[i]; | ||
734 | return; | ||
735 | } | ||
736 | } | ||
737 | |||
738 | D3DDevice *device = dev_ptr->device; | ||
739 | |||
740 | assert(dev_ptr->fonts_buffer_image_id >= 0); | ||
741 | |||
742 | Ref<D3DObjectFont> new_font = new D3DObjectFont(font, dev_ptr->fonts_buffer_image_id); | ||
743 | scene->AddObject(new_font); | ||
744 | context->font = new_font; | ||
745 | } | ||
746 | |||
747 | void evas_direct3d_font_free(Direct3DDeviceHandler d3d, void *font) | ||
748 | { | ||
749 | DevicePtr *dev_ptr = SelectDevice(d3d); | ||
750 | D3DContext *context = dev_ptr->context; | ||
751 | D3DScene *scene = dev_ptr->scene; | ||
752 | |||
753 | if (context->font.IsNull() || !((D3DObjectFont *)context->font.Addr())->Compare(font)) | ||
754 | { | ||
755 | D3DScene *scene = dev_ptr->scene; | ||
756 | |||
757 | static TArray<D3DObjectFont *> fonts; | ||
758 | scene->GetObjectsOfType<D3DObjectFont>(fonts); | ||
759 | for (int i = 0; i < fonts.Length(); i++) | ||
760 | { | ||
761 | if (fonts[i]->Compare(font)) | ||
762 | { | ||
763 | context->font = fonts[i]; | ||
764 | break; | ||
765 | } | ||
766 | } | ||
767 | } | ||
768 | |||
769 | scene->DeleteObject(context->font); | ||
770 | context->font = NULL; | ||
771 | } | ||
772 | |||
773 | |||
774 | } // extern "C" | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object.cpp b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object.cpp new file mode 100644 index 0000000..15a801e --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object.cpp | |||
@@ -0,0 +1,12 @@ | |||
1 | |||
2 | #include "evas_direct3d_object.h" | ||
3 | |||
4 | D3DObject::D3DObject() | ||
5 | { | ||
6 | _free = false; | ||
7 | } | ||
8 | |||
9 | D3DObject::~D3DObject() | ||
10 | { | ||
11 | } | ||
12 | |||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object.h b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object.h new file mode 100644 index 0000000..8c4e6df --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object.h | |||
@@ -0,0 +1,35 @@ | |||
1 | #ifndef __EVAS_DIRECT3D_OBJECT_H__ | ||
2 | #define __EVAS_DIRECT3D_OBJECT_H__ | ||
3 | |||
4 | #include "evas_engine.h" | ||
5 | |||
6 | #include "ref.h" | ||
7 | |||
8 | class D3DDevice; | ||
9 | |||
10 | class D3DObject : virtual public Referenc | ||
11 | { | ||
12 | public: | ||
13 | D3DObject(); | ||
14 | virtual ~D3DObject(); | ||
15 | |||
16 | virtual void Draw(D3DDevice *d3d) = 0; | ||
17 | |||
18 | inline bool IsFree(); | ||
19 | inline void SetFree(bool state); | ||
20 | |||
21 | private: | ||
22 | bool _free; | ||
23 | }; | ||
24 | |||
25 | bool D3DObject::IsFree() | ||
26 | { | ||
27 | return _free; | ||
28 | } | ||
29 | |||
30 | void D3DObject::SetFree(bool state) | ||
31 | { | ||
32 | _free = state; | ||
33 | } | ||
34 | |||
35 | #endif // __EVAS_DIRECT3D_OBJECT_H__ | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_font.cpp b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_font.cpp new file mode 100644 index 0000000..f072e87 --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_font.cpp | |||
@@ -0,0 +1,231 @@ | |||
1 | //#define ENABLE_LOG_PRINTF | ||
2 | |||
3 | #include <string.h> | ||
4 | |||
5 | #include "evas_direct3d_object_font.h" | ||
6 | #include "evas_direct3d_image_cache.h" | ||
7 | #include "evas_direct3d_device.h" | ||
8 | #include "evas_direct3d_shader_pack.h" | ||
9 | #include "evas_direct3d_vertex_buffer_cache.h" | ||
10 | |||
11 | D3DObjectFont::Cache D3DObjectFont::_cache; | ||
12 | |||
13 | D3DObjectFont::D3DObjectFont(void *source, int image_id) | ||
14 | { | ||
15 | _image_id = image_id; | ||
16 | _color = 0xff000000; | ||
17 | _source = source; | ||
18 | D3DImageCache::Current()->AddImageUser(_image_id); | ||
19 | } | ||
20 | |||
21 | D3DObjectFont::~D3DObjectFont() | ||
22 | { | ||
23 | D3DImageCache::Current()->RemoveImageUser(_image_id); | ||
24 | } | ||
25 | |||
26 | void D3DObjectFont::CopyTo(D3DObjectFont *font) | ||
27 | { | ||
28 | assert(font != NULL); | ||
29 | font->_image_id = _image_id; | ||
30 | font->_source = _source; | ||
31 | D3DImageCache::Current()->AddImageUser(font->_image_id); | ||
32 | _glyphs.CopyTo(font->_glyphs); | ||
33 | } | ||
34 | |||
35 | void D3DObjectFont::BeginCache(int image_id) | ||
36 | { | ||
37 | if (_cache.enabled) | ||
38 | return; | ||
39 | int w = D3DImageCache::Current()->GetImageWidth(image_id); | ||
40 | int h = D3DImageCache::Current()->GetImageHeight(image_id); | ||
41 | _cache.enabled = true; | ||
42 | _cache.image_id = image_id; | ||
43 | _cache.data.Allocate(w * h); | ||
44 | |||
45 | if (_cache.dirty.Length() != h) | ||
46 | { | ||
47 | _cache.dirty.Allocate(h); | ||
48 | memset(_cache.dirty.Data(), 0xff, sizeof(POINT) * _cache.dirty.Length()); | ||
49 | } | ||
50 | |||
51 | ZeroMemory(_cache.data.Data(), sizeof(DWORD) * _cache.data.Length()); | ||
52 | _cache.width = w; | ||
53 | _cache.height = h; | ||
54 | |||
55 | _cache.valid_rect.left = w; | ||
56 | _cache.valid_rect.right = 0; | ||
57 | _cache.valid_rect.top = h; | ||
58 | _cache.valid_rect.bottom = 0; | ||
59 | } | ||
60 | |||
61 | void D3DObjectFont::Draw(D3DDevice *d3d) | ||
62 | { | ||
63 | assert(_cache.image_id == _image_id); | ||
64 | } | ||
65 | |||
66 | void D3DObjectFont::EndCache(D3DDevice *d3d) | ||
67 | { | ||
68 | if (!_cache.enabled) | ||
69 | return; | ||
70 | _cache.enabled = false; | ||
71 | |||
72 | if (_cache.data.Length() == 0) | ||
73 | return; | ||
74 | |||
75 | D3DImageCache::CacheEntryInfo info; | ||
76 | ZeroMemory(&info, sizeof(info)); | ||
77 | info.id = _cache.image_id; | ||
78 | info.width = _cache.width; | ||
79 | info.height = _cache.height; | ||
80 | if (!D3DImageCache::Current()->UpdateImageDataWithDirtyInfo(info, | ||
81 | _cache.data.Data(), _cache.dirty.Data())) | ||
82 | //if (!D3DImageCache::Current()->UpdateImageDataDiscard(info, _cache.data.Data())); | ||
83 | { | ||
84 | return; | ||
85 | } | ||
86 | |||
87 | D3DShaderPack::Current()->SetVDecl(d3d, D3DShaderPack::VDECL_XYUV); | ||
88 | D3DShaderPack::Current()->SetVS(d3d, D3DShaderPack::VS_COPY_UV); | ||
89 | D3DShaderPack::Current()->SetPS(d3d, D3DShaderPack::PS_TEX_2); // This image is in s1 | ||
90 | D3DImageCache::Current()->SelectImageToDevice(d3d, _cache.image_id); | ||
91 | |||
92 | const FLOAT half_x = 0.5f / FLOAT(_cache.width); | ||
93 | const FLOAT half_y = 0.5f / FLOAT(_cache.height); | ||
94 | FLOAT left = FLOAT(_cache.valid_rect.left - 5) / FLOAT(_cache.width), | ||
95 | top = FLOAT(_cache.valid_rect.top - 5) / FLOAT(_cache.height), | ||
96 | right = FLOAT(_cache.valid_rect.right + 5) / FLOAT(_cache.width), | ||
97 | bottom = FLOAT(_cache.valid_rect.bottom + 5) / FLOAT(_cache.height); | ||
98 | |||
99 | const Vertex data[6] = { | ||
100 | {left * 2 - 1, 2 * (1 - bottom) - 1, left + half_x, bottom + half_y}, | ||
101 | {left * 2 - 1, 2 * (1 - top) - 1, left + half_x, top + half_y}, | ||
102 | {right * 2 - 1, 2 * (1 - bottom) - 1, right + half_x, bottom + half_y}, | ||
103 | {right * 2 - 1, 2 * (1 - bottom) - 1, right + half_x, bottom + half_y}, | ||
104 | {left * 2 - 1, 2 * (1 - top) - 1, left + half_x, top + half_y}, | ||
105 | {right * 2 - 1, 2 * (1 - top) - 1, right + half_x, top + half_y}}; | ||
106 | |||
107 | d3d->GetDevice()->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, data, sizeof(Vertex)); | ||
108 | |||
109 | //D3DImageCache::Current()->UpdateImageDataWithDirtyInfo(info, NULL, _cache.dirty.Data()); | ||
110 | } | ||
111 | |||
112 | D3DObjectFont::Glyph *D3DObjectFont::GetGlyph(void *source) | ||
113 | { | ||
114 | if (_image_id < 0) | ||
115 | { | ||
116 | WRN("Font is not initialized"); | ||
117 | return NULL; | ||
118 | } | ||
119 | for (int i = 0; i < _glyphs.Length(); i++) | ||
120 | { | ||
121 | if (_glyphs[i]->Compare(source)) | ||
122 | return _glyphs[i]; | ||
123 | } | ||
124 | return NULL; | ||
125 | } | ||
126 | |||
127 | D3DObjectFont::Glyph *D3DObjectFont::AddGlyph(D3DDevice *d3d, void *source, | ||
128 | BYTE *data8, int width, int height, int pitch) | ||
129 | { | ||
130 | if (_image_id < 0) | ||
131 | { | ||
132 | WRN("Font is not initialized"); | ||
133 | return NULL; | ||
134 | } | ||
135 | for (int i = 0; i < _glyphs.Length(); i++) | ||
136 | { | ||
137 | if (_glyphs[i]->Compare(source)) | ||
138 | return _glyphs[i]; | ||
139 | } | ||
140 | Ref<Glyph> glyph = new Glyph(source); | ||
141 | glyph->_data.Allocate(width * height); | ||
142 | glyph->_width = width; | ||
143 | glyph->_height = height; | ||
144 | |||
145 | for (int i = 0; i < height; i++) | ||
146 | CopyMemory(&glyph->_data[i * width], &data8[i * pitch], width); | ||
147 | |||
148 | Log("Glyph added (%p) (%dx%d)", source, width, height); | ||
149 | _glyphs.Add(glyph); | ||
150 | return _glyphs.Last()->Addr(); | ||
151 | } | ||
152 | |||
153 | void D3DObjectFont::PushForDraw(Glyph *glyph, int x, int y) | ||
154 | { | ||
155 | BeginCache(_image_id); | ||
156 | |||
157 | // Uff, I'm not sure about multiple windows... | ||
158 | |||
159 | #define LERP(a, b, t1, t2) (BYTE)(FLOAT(a) * (t1) + FLOAT(b) * (t2)) | ||
160 | |||
161 | Color dc, sc; | ||
162 | FLOAT a; | ||
163 | sc.color = _color; | ||
164 | |||
165 | const FLOAT color_alpha = sc.Alpha(); | ||
166 | |||
167 | DWORD *data = _cache.data.Data(); | ||
168 | BYTE *gdata = glyph->_data.Data(); | ||
169 | const int glyph_height = glyph->_height; | ||
170 | const int cache_height = _cache.height; | ||
171 | const int glyph_width = glyph->_width; | ||
172 | const int cache_width = _cache.width; | ||
173 | |||
174 | for (int i = 0, yi = y; i < glyph_height && yi < cache_height; i++, yi++) | ||
175 | { | ||
176 | if (yi < 0) | ||
177 | continue; | ||
178 | DWORD *dst = data + ((yi) * cache_width + x); | ||
179 | BYTE *src = gdata + (i * glyph_width); | ||
180 | POINT *dirty_yi = &_cache.dirty[yi]; | ||
181 | |||
182 | if (_cache.valid_rect.top > yi) | ||
183 | _cache.valid_rect.top = yi; | ||
184 | if (_cache.valid_rect.bottom < yi) | ||
185 | _cache.valid_rect.bottom = yi; | ||
186 | |||
187 | for (int j = 0, xj = x; j < glyph_width && xj < cache_width; j++, xj++, dst++, src++) | ||
188 | { | ||
189 | if (xj < 0) | ||
190 | continue; | ||
191 | BYTE glyph_pix = *src; | ||
192 | if (glyph_pix == 0) | ||
193 | continue; | ||
194 | |||
195 | if (dirty_yi->x >= 0 && dirty_yi->y < 0) | ||
196 | dirty_yi->x = 0, dirty_yi->y = cache_width - 1; | ||
197 | else | ||
198 | { | ||
199 | if (dirty_yi->x < 0 || dirty_yi->x > xj) | ||
200 | dirty_yi->x = xj; | ||
201 | if (dirty_yi->y < 0 || dirty_yi->y < xj) | ||
202 | dirty_yi->y = xj; | ||
203 | } | ||
204 | |||
205 | if (_cache.valid_rect.left > xj) | ||
206 | _cache.valid_rect.left = xj; | ||
207 | if (_cache.valid_rect.right < xj) | ||
208 | _cache.valid_rect.right = xj; | ||
209 | |||
210 | if (glyph_pix == 0xff && sc.a == 0xff) | ||
211 | { | ||
212 | *dst = sc.color; | ||
213 | continue; | ||
214 | } | ||
215 | a = FLOAT(glyph_pix) * color_alpha / 255.f; | ||
216 | if (*dst == 0) | ||
217 | { | ||
218 | *dst = (BYTE(255.f * a) << 24) | (0x00ffffff & sc.color); | ||
219 | continue; | ||
220 | } | ||
221 | |||
222 | dc.color = *dst; | ||
223 | |||
224 | dc.r = LERP(dc.r, sc.r, 1 - a, a); | ||
225 | dc.g = LERP(dc.g, sc.g, 1 - a, a); | ||
226 | dc.b = LERP(dc.b, sc.b, 1 - a, a); | ||
227 | dc.a = max(dc.a, BYTE(255.f * a)); | ||
228 | *dst = dc.color; | ||
229 | } | ||
230 | } | ||
231 | } | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_font.h b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_font.h new file mode 100644 index 0000000..e8c0196 --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_font.h | |||
@@ -0,0 +1,113 @@ | |||
1 | #ifndef __EVAS_DIRECT3D_OBJECT_FONT_H__ | ||
2 | #define __EVAS_DIRECT3D_OBJECT_FONT_H__ | ||
3 | |||
4 | #include "evas_engine.h" | ||
5 | |||
6 | #include "ref.h" | ||
7 | #include "array.h" | ||
8 | |||
9 | #include "evas_direct3d_object.h" | ||
10 | |||
11 | class D3DObjectFont : public D3DObject | ||
12 | { | ||
13 | public: | ||
14 | |||
15 | class Glyph : public Referenc | ||
16 | { | ||
17 | public: | ||
18 | Glyph(void *source) | ||
19 | : _source(source), _width(0), _height(0) {}; | ||
20 | |||
21 | bool Compare(void *source) | ||
22 | { | ||
23 | return (_source == source); | ||
24 | } | ||
25 | void *Source() | ||
26 | { | ||
27 | return _source; | ||
28 | } | ||
29 | |||
30 | private: | ||
31 | friend class D3DObjectFont; | ||
32 | void *_source; | ||
33 | TArray<BYTE> _data; | ||
34 | int _width; | ||
35 | int _height; | ||
36 | }; | ||
37 | |||
38 | public: | ||
39 | D3DObjectFont(void *source, int image_id); | ||
40 | ~D3DObjectFont(); | ||
41 | |||
42 | inline bool Compare(void *source); | ||
43 | void CopyTo(D3DObjectFont *font); | ||
44 | |||
45 | virtual void Draw(D3DDevice *d3d); | ||
46 | static void EndCache(D3DDevice *d3d); | ||
47 | |||
48 | inline void SetColor(DWORD color); | ||
49 | |||
50 | Glyph *GetGlyph(void *source); | ||
51 | Glyph *AddGlyph(D3DDevice *d3d, void *source, BYTE *data8, int width, int height, int pitch); | ||
52 | void PushForDraw(Glyph *glyph, int x, int y); | ||
53 | |||
54 | protected: | ||
55 | static void BeginCache(int image_id); | ||
56 | |||
57 | private: | ||
58 | struct Vertex | ||
59 | { | ||
60 | FLOAT x, y; | ||
61 | FLOAT u, v; | ||
62 | }; | ||
63 | |||
64 | struct Color | ||
65 | { | ||
66 | union | ||
67 | { | ||
68 | struct | ||
69 | { | ||
70 | BYTE b, g, r, a; | ||
71 | }; | ||
72 | DWORD color; | ||
73 | }; | ||
74 | |||
75 | FLOAT Alpha() { return FLOAT(a) / 255.f; } | ||
76 | }; | ||
77 | |||
78 | class Cache | ||
79 | { | ||
80 | public: | ||
81 | Cache() | ||
82 | : enabled(false), image_id(-1), width(0), height(0) {}; | ||
83 | public: | ||
84 | TArray<DWORD> data; | ||
85 | TArray<POINT> dirty; // Start, End | ||
86 | bool enabled; | ||
87 | int image_id; | ||
88 | int width; | ||
89 | int height; | ||
90 | RECT valid_rect; | ||
91 | }; | ||
92 | |||
93 | private: | ||
94 | DWORD _color; | ||
95 | void *_source; | ||
96 | int _image_id; | ||
97 | |||
98 | TArray<Ref<Glyph> > _glyphs; | ||
99 | |||
100 | static Cache _cache; | ||
101 | }; | ||
102 | |||
103 | bool D3DObjectFont::Compare(void *source) | ||
104 | { | ||
105 | return (_source == source); | ||
106 | } | ||
107 | |||
108 | void D3DObjectFont::SetColor(DWORD color) | ||
109 | { | ||
110 | _color = color; | ||
111 | } | ||
112 | |||
113 | #endif // __EVAS_DIRECT3D_OBJECT_FONT_H__ | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_image.cpp b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_image.cpp new file mode 100644 index 0000000..3bfbe1e --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_image.cpp | |||
@@ -0,0 +1,320 @@ | |||
1 | //#define ENABLE_LOG_PRINTF | ||
2 | |||
3 | #include <string.h> | ||
4 | |||
5 | #include <d3dx9.h> | ||
6 | |||
7 | #include "evas_direct3d_object_image.h" | ||
8 | #include "evas_direct3d_image_cache.h" | ||
9 | #include "evas_direct3d_device.h" | ||
10 | #include "evas_direct3d_shader_pack.h" | ||
11 | #include "evas_direct3d_vertex_buffer_cache.h" | ||
12 | |||
13 | TArray<D3DObjectImage *> D3DObjectImage::_cache; | ||
14 | bool D3DObjectImage::_cache_enabled = false; | ||
15 | |||
16 | D3DObjectImage::D3DObjectImage() | ||
17 | { | ||
18 | _x = _y = _w = _h = 0; | ||
19 | _sx = _sy = _sw = _sh = 0; | ||
20 | _u = _v = _du = _dv = 0; | ||
21 | _image_id = -1; | ||
22 | _width = _height = 0; | ||
23 | _source[0] = 0; | ||
24 | _color = 0xffffffff; | ||
25 | _cache_i = 0; | ||
26 | _border = D3DXVECTOR4(0, 0, 0, 0); | ||
27 | _uvborder = D3DXVECTOR4(0, 0, 0, 0); | ||
28 | _with_border = false; | ||
29 | _dirty = false; | ||
30 | _image_data_updated = false; | ||
31 | } | ||
32 | |||
33 | D3DObjectImage::~D3DObjectImage() | ||
34 | { | ||
35 | D3DImageCache::Current()->RemoveImageUser(_image_id); | ||
36 | } | ||
37 | |||
38 | void D3DObjectImage::CopyTo(D3DObjectImage *image) | ||
39 | { | ||
40 | assert(image != NULL); | ||
41 | image->_u = _u; | ||
42 | image->_v = _v; | ||
43 | image->_du = _du; | ||
44 | image->_dv = _dv; | ||
45 | image->_image_id = _image_id; | ||
46 | image->_width = _width; | ||
47 | image->_height = _height; | ||
48 | CopyMemory(image->_source, _source, sizeof(_source)); | ||
49 | D3DImageCache::Current()->AddImageUser(image->_image_id); | ||
50 | } | ||
51 | |||
52 | void D3DObjectImage::BeginCache() | ||
53 | { | ||
54 | _cache.Allocate(0); | ||
55 | _cache_enabled = true; | ||
56 | } | ||
57 | |||
58 | void D3DObjectImage::EndCache(D3DDevice *d3d) | ||
59 | { | ||
60 | if (!_cache_enabled || _cache.Length() == 0) | ||
61 | return; | ||
62 | D3DShaderPack::Current()->SetVDecl(d3d, D3DShaderPack::VDECL_XYUVC); | ||
63 | D3DShaderPack::Current()->SetVS(d3d, D3DShaderPack::VS_COPY_UV_COLOR); | ||
64 | D3DShaderPack::Current()->SetPS(d3d, D3DShaderPack::PS_TEX_COLOR_FILTER); | ||
65 | |||
66 | static TArray<Vertex> sorted; | ||
67 | static TArray<GroupDesc> groups; | ||
68 | sorted.Allocate(0); | ||
69 | groups.Allocate(0); | ||
70 | |||
71 | bool found = true; | ||
72 | while (found) | ||
73 | { | ||
74 | found = false; | ||
75 | int cur_id = -1; | ||
76 | int num = 0; | ||
77 | for (int i = 0; i < _cache.Length(); i++) | ||
78 | { | ||
79 | // We have processed this | ||
80 | if (_cache[i]->_image_id < 0) | ||
81 | continue; | ||
82 | found = true; | ||
83 | if (cur_id < 0) | ||
84 | cur_id = _cache[i]->_image_id; | ||
85 | if (_cache[i]->_image_id == cur_id) | ||
86 | { | ||
87 | if (!_cache[i]->_with_border) | ||
88 | { | ||
89 | Vertex *data = _cache[i]->MakeData(); | ||
90 | sorted.Add(data[0]); | ||
91 | sorted.Add(data[1]); | ||
92 | sorted.Add(data[2]); | ||
93 | sorted.Add(data[3]); | ||
94 | sorted.Add(data[4]); | ||
95 | sorted.Add(data[5]); | ||
96 | _cache[i]->_image_id = -_cache[i]->_image_id - 1; | ||
97 | num++; | ||
98 | } | ||
99 | else | ||
100 | { | ||
101 | Vertex *data = _cache[i]->MakeDataBorder(); | ||
102 | int last_len = sorted.Length(); | ||
103 | sorted.Allocate(last_len + 6 * 9); | ||
104 | CopyMemory(&sorted[last_len], data, sizeof(Vertex) * 6 * 9); | ||
105 | _cache[i]->_image_id = -_cache[i]->_image_id - 1; | ||
106 | num += 9; | ||
107 | } | ||
108 | } | ||
109 | } | ||
110 | if (num > 0) | ||
111 | { | ||
112 | GroupDesc gd = {num, cur_id}; | ||
113 | groups.Add(gd); | ||
114 | } | ||
115 | } | ||
116 | |||
117 | // Restore ids | ||
118 | for (int i = 0; i < _cache.Length(); i++) | ||
119 | _cache[i]->_image_id = -_cache[i]->_image_id - 1; | ||
120 | |||
121 | D3DVertexBufferCache::CacheEntryInfo ce_info; | ||
122 | if (!D3DVertexBufferCache::Current()->InitBuffer(d3d, (BYTE *)sorted.Data(), | ||
123 | sorted.Length() * sizeof(Vertex), ce_info)) | ||
124 | { | ||
125 | return; | ||
126 | } | ||
127 | D3DVertexBufferCache::Current()->SelectBufferToDevice(d3d, ce_info.id, sizeof(Vertex)); | ||
128 | |||
129 | HRESULT hr; | ||
130 | for (int i = 0, cur = 0; i < groups.Length(); i++) | ||
131 | { | ||
132 | if (FAILED(hr = D3DImageCache::Current()->SelectImageToDevice(d3d, groups[i].id))) | ||
133 | { | ||
134 | Log("Failed to select texture: %X", (DWORD)hr); | ||
135 | } | ||
136 | // d3d->GetDevice()->DrawPrimitiveUP(D3DPT_TRIANGLELIST, groups[i].num * 2, | ||
137 | // &sorted[cur], sizeof(Vertex)); | ||
138 | d3d->GetDevice()->DrawPrimitive(D3DPT_TRIANGLELIST, cur, groups[i].num * 2); | ||
139 | cur += groups[i].num * 6; | ||
140 | } | ||
141 | |||
142 | DBG("Image cache drawn: %d items, %d groups", _cache.Length(), groups.Length()); | ||
143 | _cache_enabled = false; | ||
144 | } | ||
145 | |||
146 | void D3DObjectImage::Draw(D3DDevice *d3d) | ||
147 | { | ||
148 | _dirty = false; | ||
149 | |||
150 | DBG("Image draw: (%.3f, %.3f, %.3f, %.3f)", _x, _y, _w, _h); | ||
151 | |||
152 | if (_cache_enabled) | ||
153 | { | ||
154 | _cache.Add(this); | ||
155 | _cache_i = _cache.Length() - 1; | ||
156 | return; | ||
157 | } | ||
158 | |||
159 | D3DShaderPack::Current()->SetVDecl(d3d, D3DShaderPack::VDECL_XYUVC); | ||
160 | D3DShaderPack::Current()->SetVS(d3d, D3DShaderPack::VS_COPY_UV_COLOR); | ||
161 | D3DShaderPack::Current()->SetPS(d3d, D3DShaderPack::PS_TEX_COLOR_FILTER); | ||
162 | D3DImageCache::Current()->SelectImageToDevice(d3d, _image_id); | ||
163 | |||
164 | if (!_with_border) | ||
165 | d3d->GetDevice()->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, MakeData(), sizeof(Vertex)); | ||
166 | else | ||
167 | d3d->GetDevice()->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 18, MakeDataBorder(), sizeof(Vertex)); | ||
168 | } | ||
169 | |||
170 | void D3DObjectImage::Init(FLOAT u, FLOAT v, FLOAT du, FLOAT dv, | ||
171 | int image_id, int width, int height, const char *source) | ||
172 | { | ||
173 | _u = u; | ||
174 | _v = v; | ||
175 | _du = du; | ||
176 | _dv = dv; | ||
177 | _image_id = image_id; | ||
178 | _width = width; | ||
179 | _height = height; | ||
180 | #ifdef __MINGW32__ | ||
181 | strncpy(_source, source, sizeof(_source) - 1); | ||
182 | #else | ||
183 | strncpy_s(_source, sizeof(_source), source, sizeof(_source) - 1); | ||
184 | #endif // ! __MINGW32__ | ||
185 | } | ||
186 | |||
187 | void D3DObjectImage::Setup(FLOAT x, FLOAT y, FLOAT w, FLOAT h, | ||
188 | int sx, int sy, int sw, int sh) | ||
189 | { | ||
190 | if (!_dirty) | ||
191 | { | ||
192 | _x = 1.f; | ||
193 | _y = -1.f; | ||
194 | _w = _h = 0.f; | ||
195 | _sx = _sy = 1.f; | ||
196 | _sw = _sh = 0.f; | ||
197 | } | ||
198 | |||
199 | if (!_with_border) | ||
200 | { | ||
201 | _x = x; | ||
202 | _y = y; | ||
203 | _w = w; | ||
204 | _h = h; | ||
205 | _sx = FLOAT(sx) / FLOAT(_width); | ||
206 | _sy = FLOAT(sy) / FLOAT(_height); | ||
207 | _sw = FLOAT(sw) / FLOAT(_width); | ||
208 | _sh = FLOAT(sh) / FLOAT(_height); | ||
209 | } | ||
210 | else | ||
211 | { | ||
212 | _x = min(_x, x); | ||
213 | _y = max(_y, y); | ||
214 | _w += w / 3; | ||
215 | _h += h / 3; | ||
216 | _sx = min(_sx, FLOAT(sx) / FLOAT(_width)); | ||
217 | _sy = min(_sy, FLOAT(sy) / FLOAT(_height)); | ||
218 | _sw += FLOAT(sw) / (3.f * FLOAT(_width)); | ||
219 | _sh += FLOAT(sh) / (3.f * FLOAT(_height)); | ||
220 | } | ||
221 | _dirty = true; | ||
222 | |||
223 | } | ||
224 | |||
225 | void D3DObjectImage::SetupColorFilter(DWORD color) | ||
226 | { | ||
227 | //_color = ((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); | ||
228 | _color = color; | ||
229 | } | ||
230 | |||
231 | D3DObjectImage::Vertex *D3DObjectImage::MakeData() | ||
232 | { | ||
233 | //FLOAT z = (FLOAT(_cache_i) + 0.5f) / _cache.Length(); | ||
234 | Vertex data[6] = { | ||
235 | {_x, _y, _u + _sx * _du, _v + _sy * _dv, _color}, | ||
236 | {_x + _w, _y, _u + (_sx + _sw) * _du, _v + _sy * _dv, _color}, | ||
237 | {_x, _y + _h, _u + _sx * _du, _v + (_sy + _sh) * _dv, _color}, | ||
238 | {_x, _y + _h, _u + _sx * _du, _v + (_sy + _sh) * _dv, _color}, | ||
239 | {_x + _w, _y, _u + (_sx + _sw) * _du, _v + _sy * _dv, _color}, | ||
240 | {_x + _w, _y + _h, _u + (_sx + _sw) * _du, _v + (_sy + _sh) * _dv, _color}}; | ||
241 | CopyMemory(_data, data, sizeof(data)); | ||
242 | return _data; | ||
243 | } | ||
244 | |||
245 | D3DObjectImage::Vertex *D3DObjectImage::MakeDataBorder() | ||
246 | { | ||
247 | //FLOAT z = (FLOAT(_cache_i) + 0.5f) / _cache.Length(); | ||
248 | if (_border.x + _border.z > _w) | ||
249 | _border.x = _border.z = _w / 2; | ||
250 | if (_border.y + _border.w < _h) | ||
251 | _border.y = _border.w = _h / 2; | ||
252 | |||
253 | FLOAT ul, ut, ur, ub; | ||
254 | ul = _uvborder.x * _du; | ||
255 | ut = _uvborder.y * _dv; | ||
256 | ur = _uvborder.z * _du; | ||
257 | ub = _uvborder.w * _dv; | ||
258 | FLOAT bl, bt, br, bb; | ||
259 | bl = _border.x; | ||
260 | bt = _border.y; | ||
261 | br = _border.z; | ||
262 | bb = _border.w; | ||
263 | |||
264 | const FLOAT half_x = 0.5f * _du / FLOAT(_width); | ||
265 | const FLOAT half_y = 0.5f * _dv / FLOAT(_height); | ||
266 | |||
267 | // Diagonal knots | ||
268 | Vertex data[4] = { | ||
269 | {_x, _y, _u + _sx * _du + half_x, _v + _sy * _dv + half_y, _color}, | ||
270 | {_x + bl, _y + bt, _u + ul + _sx * _du, _v + ut + _sy * _dv, _color}, | ||
271 | {_x + _w - br, _y + _h - bb, _u - ur + (_sx + _sw) * _du, _v - ub + (_sy + _sh) * _dv, _color}, | ||
272 | {_x + _w, _y + _h, _u + (_sx + _sw) * _du - half_x, _v + (_sy + _sh) * _dv - half_y, _color}}; | ||
273 | |||
274 | static const int yshift[6] = {0, 0, 1, 1, 0, 1}; | ||
275 | static const int xshift[6] = {0, 1, 0, 0, 1, 1}; | ||
276 | |||
277 | int vi = 0; | ||
278 | for (int i = 0; i < 3; i++) | ||
279 | { | ||
280 | for (int j = 0; j < 3; j++) | ||
281 | { | ||
282 | for (int v = 0; v < 6; v++) | ||
283 | { | ||
284 | _data[vi].x = data[xshift[v] + j].x; | ||
285 | _data[vi].y = data[yshift[v] + i].y; | ||
286 | _data[vi].u = data[xshift[v] + j].u; | ||
287 | _data[vi].v = data[yshift[v] + i].v; | ||
288 | _data[vi].col = data[0].col; | ||
289 | vi++; | ||
290 | } | ||
291 | } | ||
292 | } | ||
293 | |||
294 | return _data; | ||
295 | } | ||
296 | |||
297 | void D3DObjectImage::SetupBorder(const D3DXVECTOR4 &world_border, const D3DXVECTOR4 &pix_border) | ||
298 | { | ||
299 | _border = world_border; | ||
300 | _uvborder = pix_border; | ||
301 | _with_border = (_border.x > 0.0001f || _border.y > 0.0001f || | ||
302 | _border.z > 0.0001f || _border.w > 0.0001f); | ||
303 | } | ||
304 | |||
305 | bool D3DObjectImage::UpdateImageData(DWORD *image_data) | ||
306 | { | ||
307 | D3DImageCache::CacheEntryInfo info = {_image_id, _width, _height, _u, _v, _du, _dv}; | ||
308 | _image_data_updated = false; | ||
309 | return D3DImageCache::Current()->UpdateImageData(info, image_data); | ||
310 | } | ||
311 | |||
312 | DWORD *D3DObjectImage::GetImageData() | ||
313 | { | ||
314 | if (_image_data_updated) | ||
315 | return _image_data.Data(); | ||
316 | _image_data_updated = true; | ||
317 | D3DImageCache::CacheEntryInfo info = {_image_id, _width, _height, _u, _v, _du, _dv}; | ||
318 | D3DImageCache::Current()->GetImageData(info, _image_data); | ||
319 | return _image_data.Data(); | ||
320 | } | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_image.h b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_image.h new file mode 100644 index 0000000..379207b --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_image.h | |||
@@ -0,0 +1,127 @@ | |||
1 | #ifndef __EVAS_DIRECT3D_OBJECT_IMAGE_H__ | ||
2 | #define __EVAS_DIRECT3D_OBJECT_IMAGE_H__ | ||
3 | |||
4 | #include "evas_engine.h" | ||
5 | |||
6 | #include "ref.h" | ||
7 | #include "array.h" | ||
8 | |||
9 | #include "evas_direct3d_object.h" | ||
10 | |||
11 | class D3DObjectImage : public D3DObject | ||
12 | { | ||
13 | public: | ||
14 | D3DObjectImage(); | ||
15 | virtual ~D3DObjectImage(); | ||
16 | |||
17 | void CopyTo(D3DObjectImage *image); | ||
18 | |||
19 | static void BeginCache(); | ||
20 | virtual void Draw(D3DDevice *d3d); | ||
21 | static void EndCache(D3DDevice *d3d); | ||
22 | |||
23 | void Init(FLOAT u, FLOAT v, FLOAT du, FLOAT dv, int image_id, | ||
24 | int width, int height, const char *source); | ||
25 | void Setup(FLOAT x, FLOAT y, FLOAT w, FLOAT h, | ||
26 | int sx, int sy, int sw, int sh); | ||
27 | void SetupColorFilter(DWORD color); | ||
28 | void SetupBorder(const D3DXVECTOR4 &world_border, const D3DXVECTOR4 &pix_border); | ||
29 | |||
30 | inline bool IsValid(); | ||
31 | inline const char *GetSource(); | ||
32 | inline int GetWidth(); | ||
33 | inline int GetHeight(); | ||
34 | inline FLOAT GetBorderLeft(); | ||
35 | inline FLOAT GetBorderRight(); | ||
36 | inline FLOAT GetBorderTop(); | ||
37 | inline FLOAT GetBorderBottom(); | ||
38 | |||
39 | bool UpdateImageData(DWORD *image_data); | ||
40 | DWORD *GetImageData(); | ||
41 | |||
42 | private: | ||
43 | struct Vertex | ||
44 | { | ||
45 | FLOAT x, y; | ||
46 | FLOAT u, v; | ||
47 | D3DCOLOR col; | ||
48 | }; | ||
49 | |||
50 | struct GroupDesc | ||
51 | { | ||
52 | int num; | ||
53 | int id; | ||
54 | }; | ||
55 | |||
56 | private: | ||
57 | Vertex *MakeData(); | ||
58 | Vertex *MakeDataBorder(); | ||
59 | |||
60 | private: | ||
61 | FLOAT _x, _y, _w, _h; | ||
62 | FLOAT _sx, _sy, _sw, _sh; | ||
63 | D3DXVECTOR4 _border; | ||
64 | D3DXVECTOR4 _uvborder; | ||
65 | |||
66 | FLOAT _u, _v, _du, _dv; | ||
67 | int _image_id; | ||
68 | int _width, _height; | ||
69 | |||
70 | D3DCOLOR _color; | ||
71 | int _cache_i; | ||
72 | bool _with_border; | ||
73 | bool _dirty; | ||
74 | |||
75 | TArray<DWORD> _image_data; | ||
76 | bool _image_data_updated; | ||
77 | |||
78 | char _source[256]; | ||
79 | |||
80 | Vertex _data[54]; | ||
81 | |||
82 | static TArray<D3DObjectImage *> _cache; | ||
83 | static bool _cache_enabled; | ||
84 | }; | ||
85 | |||
86 | bool D3DObjectImage::IsValid() | ||
87 | { | ||
88 | return _image_id >= 0 && _width > 0 && _height > 0; | ||
89 | } | ||
90 | |||
91 | const char *D3DObjectImage::GetSource() | ||
92 | { | ||
93 | return _source; | ||
94 | } | ||
95 | |||
96 | int D3DObjectImage::GetWidth() | ||
97 | { | ||
98 | return _width; | ||
99 | } | ||
100 | |||
101 | int D3DObjectImage::GetHeight() | ||
102 | { | ||
103 | return _height; | ||
104 | } | ||
105 | |||
106 | FLOAT D3DObjectImage::GetBorderLeft() | ||
107 | { | ||
108 | return _border.x; | ||
109 | } | ||
110 | |||
111 | FLOAT D3DObjectImage::GetBorderRight() | ||
112 | { | ||
113 | return _border.z; | ||
114 | } | ||
115 | |||
116 | FLOAT D3DObjectImage::GetBorderTop() | ||
117 | { | ||
118 | return _border.y; | ||
119 | } | ||
120 | |||
121 | FLOAT D3DObjectImage::GetBorderBottom() | ||
122 | { | ||
123 | return _border.w; | ||
124 | } | ||
125 | |||
126 | |||
127 | #endif // __EVAS_DIRECT3D_OBJECT_IMAGE_H__ | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_line.cpp b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_line.cpp new file mode 100644 index 0000000..9442243 --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_line.cpp | |||
@@ -0,0 +1,60 @@ | |||
1 | |||
2 | #include "evas_direct3d_object_line.h" | ||
3 | #include "evas_direct3d_device.h" | ||
4 | #include "evas_direct3d_shader_pack.h" | ||
5 | |||
6 | TArray<D3DObjectLine::Vertex> D3DObjectLine::_cache; | ||
7 | bool D3DObjectLine::_cache_enabled = false; | ||
8 | |||
9 | D3DObjectLine::D3DObjectLine() | ||
10 | { | ||
11 | _x1 = _y1 = 0; | ||
12 | _x2 = _y2 = 0; | ||
13 | } | ||
14 | |||
15 | void D3DObjectLine::BeginCache() | ||
16 | { | ||
17 | _cache.Allocate(0); | ||
18 | _cache_enabled = true; | ||
19 | } | ||
20 | |||
21 | void D3DObjectLine::EndCache(D3DDevice *d3d) | ||
22 | { | ||
23 | if (!_cache_enabled || _cache.Length() == 0) | ||
24 | return; | ||
25 | D3DShaderPack::Current()->SetVDecl(d3d, D3DShaderPack::VDECL_XYC); | ||
26 | D3DShaderPack::Current()->SetVS(d3d, D3DShaderPack::VS_COPY_COLOR); | ||
27 | D3DShaderPack::Current()->SetPS(d3d, D3DShaderPack::PS_COLOR); | ||
28 | d3d->GetDevice()->DrawPrimitiveUP(D3DPT_LINELIST, _cache.Length() / 2, | ||
29 | _cache.Data(), sizeof(Vertex)); | ||
30 | |||
31 | DBG("Line cache drawn: %d items", _cache.Length() / 2); | ||
32 | _cache_enabled = false; | ||
33 | } | ||
34 | |||
35 | void D3DObjectLine::Draw(D3DDevice *d3d) | ||
36 | { | ||
37 | Vertex data[2] = {{_x1, _y1, _color}, {_x2, _y2, _color}}; | ||
38 | |||
39 | if (!_cache_enabled) | ||
40 | { | ||
41 | D3DShaderPack::Current()->SetVDecl(d3d, D3DShaderPack::VDECL_XYC); | ||
42 | D3DShaderPack::Current()->SetVS(d3d, D3DShaderPack::VS_COPY_COLOR); | ||
43 | D3DShaderPack::Current()->SetPS(d3d, D3DShaderPack::PS_COLOR); | ||
44 | d3d->GetDevice()->DrawPrimitiveUP(D3DPT_LINELIST, 1, data, sizeof(Vertex)); | ||
45 | } | ||
46 | else | ||
47 | { | ||
48 | _cache.Add(data[0]); | ||
49 | _cache.Add(data[1]); | ||
50 | } | ||
51 | } | ||
52 | |||
53 | void D3DObjectLine::Setup(FLOAT x1, FLOAT y1, FLOAT x2, FLOAT y2, DWORD color) | ||
54 | { | ||
55 | _x1 = x1; | ||
56 | _y1 = y1; | ||
57 | _x2 = x2; | ||
58 | _y2 = y2; | ||
59 | _color = color; | ||
60 | } | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_line.h b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_line.h new file mode 100644 index 0000000..0e5d807 --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_line.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #ifndef __EVAS_DIRECT3D_OBJECT_LINE_H__ | ||
2 | #define __EVAS_DIRECT3D_OBJECT_LINE_H__ | ||
3 | |||
4 | #include "evas_engine.h" | ||
5 | |||
6 | #include "ref.h" | ||
7 | #include "array.h" | ||
8 | |||
9 | #include "evas_direct3d_object.h" | ||
10 | |||
11 | class D3DObjectLine : public D3DObject | ||
12 | { | ||
13 | public: | ||
14 | D3DObjectLine(); | ||
15 | |||
16 | static void BeginCache(); | ||
17 | virtual void Draw(D3DDevice *d3d); | ||
18 | static void EndCache(D3DDevice *d3d); | ||
19 | |||
20 | void Setup(FLOAT x1, FLOAT y1, FLOAT x2, FLOAT y2, DWORD color); | ||
21 | |||
22 | private: | ||
23 | FLOAT _x1, _y1, _x2, _y2; | ||
24 | DWORD _color; | ||
25 | |||
26 | private: | ||
27 | struct Vertex | ||
28 | { | ||
29 | FLOAT x, y; | ||
30 | DWORD color; | ||
31 | }; | ||
32 | |||
33 | static TArray<Vertex> _cache; | ||
34 | static bool _cache_enabled; | ||
35 | }; | ||
36 | |||
37 | #endif // __EVAS_DIRECT3D_OBJECT_LINE_H__ | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_rect.cpp b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_rect.cpp new file mode 100644 index 0000000..ebdd22b --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_rect.cpp | |||
@@ -0,0 +1,65 @@ | |||
1 | #include "evas_direct3d_object_rect.h" | ||
2 | #include "evas_direct3d_device.h" | ||
3 | #include "evas_direct3d_shader_pack.h" | ||
4 | |||
5 | TArray<D3DObjectRect::Vertex> D3DObjectRect::_cache; | ||
6 | bool D3DObjectRect::_cache_enabled = false; | ||
7 | |||
8 | D3DObjectRect::D3DObjectRect() | ||
9 | { | ||
10 | _x = _y = 0; | ||
11 | _w = _h = 0; | ||
12 | } | ||
13 | |||
14 | void D3DObjectRect::BeginCache() | ||
15 | { | ||
16 | _cache.Allocate(0); | ||
17 | _cache_enabled = true; | ||
18 | } | ||
19 | |||
20 | void D3DObjectRect::EndCache(D3DDevice *d3d) | ||
21 | { | ||
22 | if (!_cache_enabled || _cache.Length() == 0) | ||
23 | return; | ||
24 | D3DShaderPack::Current()->SetVDecl(d3d, D3DShaderPack::VDECL_XYC); | ||
25 | D3DShaderPack::Current()->SetVS(d3d, D3DShaderPack::VS_COPY_COLOR); | ||
26 | D3DShaderPack::Current()->SetPS(d3d, D3DShaderPack::PS_COLOR); | ||
27 | d3d->GetDevice()->DrawPrimitiveUP(D3DPT_TRIANGLELIST, _cache.Length() / 3, | ||
28 | _cache.Data(), sizeof(Vertex)); | ||
29 | |||
30 | DBG("Rect cache drawn: %d items", _cache.Length() / 6); | ||
31 | _cache_enabled = false; | ||
32 | } | ||
33 | |||
34 | void D3DObjectRect::Draw(D3DDevice *d3d) | ||
35 | { | ||
36 | Vertex data[6] = { | ||
37 | {_x, _y, _color}, {_x + _w, _y, _color}, {_x, _y + _h, _color}, | ||
38 | {_x, _y + _h, _color}, {_x + _w, _y, _color}, {_x + _w, _y + _h, _color}}; | ||
39 | |||
40 | if (!_cache_enabled) | ||
41 | { | ||
42 | D3DShaderPack::Current()->SetVDecl(d3d, D3DShaderPack::VDECL_XYC); | ||
43 | D3DShaderPack::Current()->SetVS(d3d, D3DShaderPack::VS_COPY_COLOR); | ||
44 | D3DShaderPack::Current()->SetPS(d3d, D3DShaderPack::PS_COLOR); | ||
45 | d3d->GetDevice()->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, data, sizeof(Vertex)); | ||
46 | } | ||
47 | else | ||
48 | { | ||
49 | _cache.Add(data[0]); | ||
50 | _cache.Add(data[1]); | ||
51 | _cache.Add(data[2]); | ||
52 | _cache.Add(data[3]); | ||
53 | _cache.Add(data[4]); | ||
54 | _cache.Add(data[5]); | ||
55 | } | ||
56 | } | ||
57 | |||
58 | void D3DObjectRect::Setup(FLOAT x, FLOAT y, FLOAT w, FLOAT h, DWORD color) | ||
59 | { | ||
60 | _x = x; | ||
61 | _y = y; | ||
62 | _w = w; | ||
63 | _h = h; | ||
64 | _color = color; | ||
65 | } | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_rect.h b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_rect.h new file mode 100644 index 0000000..f7ef084 --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_object_rect.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #ifndef __EVAS_DIRECT3D_OBJECT_RECT_H__ | ||
2 | #define __EVAS_DIRECT3D_OBJECT_RECT_H__ | ||
3 | |||
4 | #include "evas_engine.h" | ||
5 | |||
6 | #include "ref.h" | ||
7 | #include "array.h" | ||
8 | |||
9 | #include "evas_direct3d_object.h" | ||
10 | |||
11 | class D3DObjectRect : public D3DObject | ||
12 | { | ||
13 | public: | ||
14 | D3DObjectRect(); | ||
15 | |||
16 | static void BeginCache(); | ||
17 | virtual void Draw(D3DDevice *d3d); | ||
18 | static void EndCache(D3DDevice *d3d); | ||
19 | |||
20 | void Setup(FLOAT x, FLOAT y, FLOAT w, FLOAT h, DWORD color); | ||
21 | |||
22 | private: | ||
23 | FLOAT _x, _y, _w, _h; | ||
24 | DWORD _color; | ||
25 | |||
26 | private: | ||
27 | struct Vertex | ||
28 | { | ||
29 | FLOAT x, y; | ||
30 | DWORD color; | ||
31 | }; | ||
32 | |||
33 | static TArray<Vertex> _cache; | ||
34 | static bool _cache_enabled; | ||
35 | }; | ||
36 | |||
37 | #endif // __EVAS_DIRECT3D_OBJECT_RECT_H__ | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_scene.cpp b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_scene.cpp new file mode 100644 index 0000000..b171fc0 --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_scene.cpp | |||
@@ -0,0 +1,33 @@ | |||
1 | |||
2 | #include "evas_direct3d_scene.h" | ||
3 | |||
4 | D3DScene::D3DScene() | ||
5 | { | ||
6 | } | ||
7 | |||
8 | void D3DScene::FreeObjects() | ||
9 | { | ||
10 | for (int i = 0; i < _objects.Length(); i++) | ||
11 | _objects[i]->SetFree(true); | ||
12 | } | ||
13 | |||
14 | void D3DScene::DrawAll(D3DDevice *d3d) | ||
15 | { | ||
16 | for (int i = 0; i < _objects.Length(); i++) | ||
17 | { | ||
18 | if (!_objects[i]->IsFree()) | ||
19 | _objects[i]->Draw(d3d); | ||
20 | } | ||
21 | } | ||
22 | |||
23 | void D3DScene::DeleteObject(D3DObject *object) | ||
24 | { | ||
25 | for (int i = 0; i < _objects.Length(); i++) | ||
26 | { | ||
27 | if (_objects[i].Addr() == object) | ||
28 | { | ||
29 | _objects.Replace(i); | ||
30 | return; | ||
31 | } | ||
32 | } | ||
33 | } | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_scene.h b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_scene.h new file mode 100644 index 0000000..e2f5f94 --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_scene.h | |||
@@ -0,0 +1,63 @@ | |||
1 | #ifndef __EVAS_DIRECT3D_SCENE_H__ | ||
2 | #define __EVAS_DIRECT3D_SCENE_H__ | ||
3 | |||
4 | #include "evas_engine.h" | ||
5 | |||
6 | #include <assert.h> | ||
7 | #include <typeinfo> | ||
8 | |||
9 | #include "ref.h" | ||
10 | #include "array.h" | ||
11 | |||
12 | #include "evas_direct3d_object.h" | ||
13 | |||
14 | class D3DDevice; | ||
15 | |||
16 | class D3DScene : virtual public Referenc | ||
17 | { | ||
18 | public: | ||
19 | D3DScene(); | ||
20 | |||
21 | void FreeObjects(); | ||
22 | |||
23 | inline void AddObject(D3DObject *object); | ||
24 | inline int GetObjectCount(); | ||
25 | void DeleteObject(D3DObject *object); | ||
26 | |||
27 | void DrawAll(D3DDevice *d3d); | ||
28 | |||
29 | template <class T> T *GetFreeObject() | ||
30 | { | ||
31 | for (int i = 0; i < _objects.Length(); i++) | ||
32 | { | ||
33 | if (typeid(T) == typeid(*_objects[i].Addr()) && _objects[i]->IsFree()) | ||
34 | return (T *)_objects[i].Addr(); | ||
35 | } | ||
36 | return NULL; | ||
37 | } | ||
38 | |||
39 | template <class T> void GetObjectsOfType(TArray<T *> &res) | ||
40 | { | ||
41 | for (int i = 0; i < _objects.Length(); i++) | ||
42 | { | ||
43 | if (typeid(T) == typeid(*_objects[i].Addr())) | ||
44 | res.Add((T *)_objects[i].Addr()); | ||
45 | } | ||
46 | } | ||
47 | |||
48 | private: | ||
49 | TArray<Ref<D3DObject> > _objects; | ||
50 | }; | ||
51 | |||
52 | void D3DScene::AddObject(D3DObject *object) | ||
53 | { | ||
54 | assert(object != NULL); | ||
55 | _objects.Add(object); | ||
56 | } | ||
57 | |||
58 | int D3DScene::GetObjectCount() | ||
59 | { | ||
60 | return _objects.Length(); | ||
61 | } | ||
62 | |||
63 | #endif // __EVAS_DIRECT3D_SCENE_H__ | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_shader_pack.cpp b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_shader_pack.cpp new file mode 100644 index 0000000..d9c868f --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_shader_pack.cpp | |||
@@ -0,0 +1,344 @@ | |||
1 | |||
2 | #include <assert.h> | ||
3 | |||
4 | #include <d3dx9.h> | ||
5 | |||
6 | #include "evas_direct3d_shader_pack.h" | ||
7 | #include "evas_direct3d_device.h" | ||
8 | |||
9 | Ref<D3DShaderPack> D3DShaderPack::_this; | ||
10 | |||
11 | D3DShaderPack::D3DShaderPack() | ||
12 | { | ||
13 | } | ||
14 | |||
15 | D3DShaderPack::~D3DShaderPack() | ||
16 | { | ||
17 | Uninitialize(); | ||
18 | } | ||
19 | |||
20 | D3DShaderPack *D3DShaderPack::Current() | ||
21 | { | ||
22 | if (_this.IsNull()) | ||
23 | _this = new D3DShaderPack(); | ||
24 | return _this; | ||
25 | } | ||
26 | |||
27 | void D3DShaderPack::SetCurrent(D3DShaderPack *obj) | ||
28 | { | ||
29 | _this = obj; | ||
30 | } | ||
31 | |||
32 | |||
33 | bool D3DShaderPack::Initialize(D3DDevice *d3d) | ||
34 | { | ||
35 | bool res = true; | ||
36 | if (!(res = InitVertexDeclarations(d3d) && res)) | ||
37 | WRN("Failed to create vdecl set"); | ||
38 | if (!(res = InitVertexShaders(d3d) && res)) | ||
39 | WRN("Failed to create vs set"); | ||
40 | if (!(res = InitPixelShaders(d3d) && res)) | ||
41 | WRN("Failed to create ps set"); | ||
42 | return res; | ||
43 | } | ||
44 | |||
45 | void D3DShaderPack::Uninitialize() | ||
46 | { | ||
47 | for (int i = 0; i < _vdecl.Length(); i++) | ||
48 | { | ||
49 | if (_vdecl[i] != NULL) | ||
50 | { | ||
51 | _vdecl[i]->Release(); | ||
52 | _vdecl[i] = NULL; | ||
53 | } | ||
54 | } | ||
55 | |||
56 | for (int i = 0; i < _vs.Length(); i++) | ||
57 | { | ||
58 | if (_vs[i] != NULL) | ||
59 | { | ||
60 | _vs[i]->Release(); | ||
61 | _vs[i] = NULL; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | for (int i = 0; i < _ps.Length(); i++) | ||
66 | { | ||
67 | if (_ps[i] != NULL) | ||
68 | { | ||
69 | _ps[i]->Release(); | ||
70 | _ps[i] = NULL; | ||
71 | } | ||
72 | } | ||
73 | } | ||
74 | |||
75 | bool D3DShaderPack::InitVertexDeclarations(D3DDevice *d3d) | ||
76 | { | ||
77 | _vdecl.Allocate(VDECL_NUM); | ||
78 | _vdecl.Set(NULL); | ||
79 | |||
80 | LPDIRECT3DVERTEXDECLARATION9 vdecl = NULL; | ||
81 | { | ||
82 | D3DVERTEXELEMENT9 elements[] = { | ||
83 | {0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, | ||
84 | {0, 8, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0}, | ||
85 | D3DDECL_END() | ||
86 | }; | ||
87 | if (FAILED(d3d->GetDevice()->CreateVertexDeclaration(elements, &vdecl))) | ||
88 | return false; | ||
89 | if (vdecl == NULL) | ||
90 | return false; | ||
91 | } | ||
92 | _vdecl[VDECL_XYC] = vdecl; | ||
93 | vdecl = NULL; | ||
94 | { | ||
95 | D3DVERTEXELEMENT9 elements[] = { | ||
96 | {0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, | ||
97 | {0, 8, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, | ||
98 | D3DDECL_END() | ||
99 | }; | ||
100 | if (FAILED(d3d->GetDevice()->CreateVertexDeclaration(elements, &vdecl))) | ||
101 | return false; | ||
102 | if (vdecl == NULL) | ||
103 | return false; | ||
104 | } | ||
105 | _vdecl[VDECL_XYUV] = vdecl; | ||
106 | vdecl = NULL; | ||
107 | { | ||
108 | D3DVERTEXELEMENT9 elements[] = { | ||
109 | {0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, | ||
110 | {0, 8, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, | ||
111 | {0, 16, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0}, | ||
112 | D3DDECL_END() | ||
113 | }; | ||
114 | if (FAILED(d3d->GetDevice()->CreateVertexDeclaration(elements, &vdecl))) | ||
115 | return false; | ||
116 | if (vdecl == NULL) | ||
117 | return false; | ||
118 | } | ||
119 | _vdecl[VDECL_XYUVC] = vdecl; | ||
120 | vdecl = NULL; | ||
121 | { | ||
122 | D3DVERTEXELEMENT9 elements[] = { | ||
123 | {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, | ||
124 | {0, 12, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, | ||
125 | {0, 20, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0}, | ||
126 | D3DDECL_END() | ||
127 | }; | ||
128 | if (FAILED(d3d->GetDevice()->CreateVertexDeclaration(elements, &vdecl))) | ||
129 | return false; | ||
130 | if (vdecl == NULL) | ||
131 | return false; | ||
132 | } | ||
133 | _vdecl[VDECL_XYZUVC] = vdecl; | ||
134 | |||
135 | return true; | ||
136 | } | ||
137 | |||
138 | bool D3DShaderPack::InitVertexShaders(D3DDevice *d3d) | ||
139 | { | ||
140 | _vs.Allocate(VS_NUM); | ||
141 | _vs.Set(NULL); | ||
142 | |||
143 | { | ||
144 | char buf[] = | ||
145 | "struct VsInput { float2 pos : POSITION; float4 col : COLOR; };\n" | ||
146 | "struct VsOutput { float4 pos : POSITION; float4 col : COLOR0; };\n" | ||
147 | "VsOutput main(VsInput vs_in) {\n" | ||
148 | "VsOutput vs_out;\n" | ||
149 | "vs_out.pos = float4(vs_in.pos, 0, 1);\n" | ||
150 | "vs_out.col = vs_in.col;\n" | ||
151 | "return vs_out;}"; | ||
152 | |||
153 | _vs[VS_COPY_COLOR] = (LPDIRECT3DVERTEXSHADER9) | ||
154 | CompileShader(d3d, true, "CopyColor", buf, sizeof(buf) - 1); | ||
155 | if (_vs[VS_COPY_COLOR] == NULL) | ||
156 | return false; | ||
157 | } | ||
158 | |||
159 | { | ||
160 | char buf[] = | ||
161 | "struct VsInput { float2 pos : POSITION; float2 tex : TEXCOORD0; };\n" | ||
162 | "struct VsOutput { float4 pos : POSITION; float2 tex : TEXCOORD0; };\n" | ||
163 | "VsOutput main(VsInput vs_in) {\n" | ||
164 | "VsOutput vs_out;\n" | ||
165 | "vs_out.pos = float4(vs_in.pos, 0, 1);\n" | ||
166 | "vs_out.tex = vs_in.tex;\n" | ||
167 | "return vs_out;}"; | ||
168 | |||
169 | _vs[VS_COPY_UV] = (LPDIRECT3DVERTEXSHADER9) | ||
170 | CompileShader(d3d, true, "CopyUV", buf, sizeof(buf) - 1); | ||
171 | if (_vs[VS_COPY_UV] == NULL) | ||
172 | return false; | ||
173 | } | ||
174 | |||
175 | { | ||
176 | char buf[] = | ||
177 | "struct VsInput { float2 pos : POSITION; float2 tex : TEXCOORD0; float4 col : COLOR; };\n" | ||
178 | "struct VsOutput { float4 pos : POSITION; float2 tex : TEXCOORD0; float4 col : COLOR0; };\n" | ||
179 | "VsOutput main(VsInput vs_in) {\n" | ||
180 | "VsOutput vs_out;\n" | ||
181 | "vs_out.pos = float4(vs_in.pos, 0, 1);\n" | ||
182 | "vs_out.tex = vs_in.tex;\n" | ||
183 | "vs_out.col = vs_in.col;\n" | ||
184 | "return vs_out;}"; | ||
185 | |||
186 | _vs[VS_COPY_UV_COLOR] = (LPDIRECT3DVERTEXSHADER9) | ||
187 | CompileShader(d3d, true, "CopyUVColor", buf, sizeof(buf) - 1); | ||
188 | if (_vs[VS_COPY_UV_COLOR] == NULL) | ||
189 | return false; | ||
190 | } | ||
191 | |||
192 | { | ||
193 | char buf[] = | ||
194 | "struct VsInput { float3 pos : POSITION; float2 tex : TEXCOORD0; float4 col : COLOR; };\n" | ||
195 | "struct VsOutput { float4 pos : POSITION; float2 tex : TEXCOORD0; float4 col : COLOR0; };\n" | ||
196 | "VsOutput main(VsInput vs_in) {\n" | ||
197 | "VsOutput vs_out;\n" | ||
198 | "vs_out.pos = float4(vs_in.pos, 1);\n" | ||
199 | "vs_out.tex = vs_in.tex;\n" | ||
200 | "vs_out.col = vs_in.col;\n" | ||
201 | "return vs_out;}"; | ||
202 | |||
203 | _vs[VS_COPY_UV_COLOR_Z] = (LPDIRECT3DVERTEXSHADER9) | ||
204 | CompileShader(d3d, true, "CopyUVColorZ", buf, sizeof(buf) - 1); | ||
205 | if (_vs[VS_COPY_UV_COLOR_Z] == NULL) | ||
206 | return false; | ||
207 | } | ||
208 | |||
209 | return true; | ||
210 | } | ||
211 | |||
212 | bool D3DShaderPack::InitPixelShaders(D3DDevice *d3d) | ||
213 | { | ||
214 | _ps.Allocate(PS_NUM); | ||
215 | _ps.Set(NULL); | ||
216 | |||
217 | { | ||
218 | char buf[] = | ||
219 | "struct VsOutput { float4 pos : POSITION; float4 col : COLOR0; };\n" | ||
220 | "float4 main(VsOutput ps_in) : COLOR0 {\n" | ||
221 | "return ps_in.col;}"; | ||
222 | |||
223 | _ps[PS_COLOR] = (LPDIRECT3DPIXELSHADER9) | ||
224 | CompileShader(d3d, false, "Color", buf, sizeof(buf) - 1); | ||
225 | if (_ps[PS_COLOR] == NULL) | ||
226 | return false; | ||
227 | } | ||
228 | |||
229 | { | ||
230 | char buf[] = | ||
231 | "sampler Texture : register(s0);\n" | ||
232 | "struct VsOutput { float4 pos : POSITION; float2 tex : TEXCOORD0; };\n" | ||
233 | "float4 main(VsOutput ps_in) : COLOR0 {\n" | ||
234 | "return tex2D(Texture, ps_in.tex);}"; | ||
235 | |||
236 | _ps[PS_TEX] = (LPDIRECT3DPIXELSHADER9) | ||
237 | CompileShader(d3d, false, "Tex", buf, sizeof(buf) - 1); | ||
238 | if (_ps[PS_TEX] == NULL) | ||
239 | return false; | ||
240 | } | ||
241 | |||
242 | { | ||
243 | char buf[] = | ||
244 | "sampler Texture : register(s0);\n" | ||
245 | "struct VsOutput { float4 pos : POSITION; float2 tex : TEXCOORD0; float4 col : COLOR0; };\n" | ||
246 | "float4 main(VsOutput ps_in) : COLOR0 {\n" | ||
247 | "return tex2D(Texture, ps_in.tex) * ps_in.col;}"; | ||
248 | |||
249 | _ps[PS_TEX_COLOR_FILTER] = (LPDIRECT3DPIXELSHADER9) | ||
250 | CompileShader(d3d, false, "TexColorFilter", buf, sizeof(buf) - 1); | ||
251 | if (_ps[PS_TEX_COLOR_FILTER] == NULL) | ||
252 | return false; | ||
253 | } | ||
254 | |||
255 | { | ||
256 | char buf[] = | ||
257 | "sampler Texture : register(s1);\n" | ||
258 | "struct VsOutput { float4 pos : POSITION; float2 tex : TEXCOORD0; };\n" | ||
259 | "float4 main(VsOutput ps_in) : COLOR0 {\n" | ||
260 | "return tex2D(Texture, ps_in.tex);}"; | ||
261 | |||
262 | _ps[PS_TEX_2] = (LPDIRECT3DPIXELSHADER9) | ||
263 | CompileShader(d3d, false, "Tex2", buf, sizeof(buf) - 1); | ||
264 | if (_ps[PS_TEX_2] == NULL) | ||
265 | return false; | ||
266 | } | ||
267 | |||
268 | return true; | ||
269 | } | ||
270 | |||
271 | void *D3DShaderPack::CompileShader(D3DDevice *d3d, bool make_vs, | ||
272 | const char *name, const char *buf, int size) | ||
273 | { | ||
274 | LPD3DXBUFFER compiled_res = NULL; | ||
275 | LPD3DXBUFFER error_msgs = NULL; | ||
276 | |||
277 | HRESULT res = D3DXCompileShader(buf, size, NULL, NULL, | ||
278 | "main", make_vs ? "vs_2_0" : "ps_2_0", // ? | ||
279 | 0, &compiled_res, &error_msgs, NULL); | ||
280 | |||
281 | if (FAILED(res)) | ||
282 | { | ||
283 | ERR("Shader %s compilation failed, code = %X", name, res); | ||
284 | if (error_msgs == NULL) | ||
285 | return NULL; | ||
286 | const char *mess = (const char *)error_msgs->GetBufferPointer(); | ||
287 | ERR("Error output:\n%s", mess); | ||
288 | error_msgs->Release(); | ||
289 | return NULL; | ||
290 | } | ||
291 | |||
292 | if (error_msgs != NULL) | ||
293 | error_msgs->Release(); | ||
294 | |||
295 | void *res_ptr = NULL; | ||
296 | if (make_vs) | ||
297 | { | ||
298 | LPDIRECT3DVERTEXSHADER9 vs; | ||
299 | res = d3d->GetDevice()->CreateVertexShader((DWORD *)compiled_res->GetBufferPointer(), &vs); | ||
300 | res_ptr = (void *)vs; | ||
301 | } | ||
302 | else | ||
303 | { | ||
304 | LPDIRECT3DPIXELSHADER9 ps; | ||
305 | res = d3d->GetDevice()->CreatePixelShader((DWORD *)compiled_res->GetBufferPointer(), &ps); | ||
306 | res_ptr = (void *)ps; | ||
307 | } | ||
308 | |||
309 | compiled_res->Release(); | ||
310 | |||
311 | if (FAILED(res)) | ||
312 | { | ||
313 | WRN("Shader %s creation failed, code = %X", name, res); | ||
314 | return NULL; | ||
315 | } | ||
316 | return res_ptr; | ||
317 | } | ||
318 | |||
319 | bool D3DShaderPack::SetVDecl(D3DDevice *d3d, int id) | ||
320 | { | ||
321 | if (id < 0 || id >= _vdecl.Length() || _vdecl[id] == NULL) | ||
322 | return false; | ||
323 | assert(d3d != NULL); | ||
324 | d3d->GetDevice()->SetVertexDeclaration(_vdecl[id]); | ||
325 | return true; | ||
326 | } | ||
327 | |||
328 | bool D3DShaderPack::SetVS(D3DDevice *d3d, int id) | ||
329 | { | ||
330 | if (id < 0 || id >= _vs.Length() || _vs[id] == NULL) | ||
331 | return false; | ||
332 | assert(d3d != NULL); | ||
333 | d3d->GetDevice()->SetVertexShader(_vs[id]); | ||
334 | return true; | ||
335 | } | ||
336 | |||
337 | bool D3DShaderPack::SetPS(D3DDevice *d3d, int id) | ||
338 | { | ||
339 | if (id < 0 || id >= _ps.Length() || _ps[id] == NULL) | ||
340 | return false; | ||
341 | assert(d3d != NULL); | ||
342 | d3d->GetDevice()->SetPixelShader(_ps[id]); | ||
343 | return true; | ||
344 | } | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_shader_pack.h b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_shader_pack.h new file mode 100644 index 0000000..b865f78 --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_shader_pack.h | |||
@@ -0,0 +1,75 @@ | |||
1 | #ifndef __EVAS_DIRECT3D_SHADER_PACK_H__ | ||
2 | #define __EVAS_DIRECT3D_SHADER_PACK_H__ | ||
3 | |||
4 | #include "evas_engine.h" | ||
5 | |||
6 | #include "ref.h" | ||
7 | #include "array.h" | ||
8 | |||
9 | class D3DDevice; | ||
10 | |||
11 | class D3DShaderPack : virtual public Referenc | ||
12 | { | ||
13 | public: | ||
14 | ~D3DShaderPack(); | ||
15 | |||
16 | static D3DShaderPack *Current(); | ||
17 | static void SetCurrent(D3DShaderPack *obj); | ||
18 | |||
19 | bool Initialize(D3DDevice *d3d); | ||
20 | void Uninitialize(); | ||
21 | |||
22 | bool SetVDecl(D3DDevice *d3d, int id); | ||
23 | bool SetVS(D3DDevice *d3d, int id); | ||
24 | bool SetPS(D3DDevice *d3d, int id); | ||
25 | |||
26 | public: | ||
27 | enum VDECL | ||
28 | { | ||
29 | VDECL_XYC = 0, | ||
30 | VDECL_XYUV, | ||
31 | VDECL_XYUVC, | ||
32 | VDECL_XYZUVC, | ||
33 | |||
34 | VDECL_NUM | ||
35 | }; | ||
36 | |||
37 | enum VS | ||
38 | { | ||
39 | VS_COPY_COLOR = 0, | ||
40 | VS_COPY_UV, | ||
41 | VS_COPY_UV_COLOR, | ||
42 | VS_COPY_UV_COLOR_Z, | ||
43 | |||
44 | VS_NUM | ||
45 | }; | ||
46 | |||
47 | enum PS | ||
48 | { | ||
49 | PS_COLOR = 0, | ||
50 | PS_TEX, | ||
51 | PS_TEX_COLOR_FILTER, | ||
52 | PS_TEX_2, | ||
53 | |||
54 | PS_NUM | ||
55 | }; | ||
56 | |||
57 | private: | ||
58 | D3DShaderPack(); | ||
59 | |||
60 | bool InitVertexDeclarations(D3DDevice *d3d); | ||
61 | bool InitVertexShaders(D3DDevice *d3d); | ||
62 | bool InitPixelShaders(D3DDevice *d3d); | ||
63 | |||
64 | void *CompileShader(D3DDevice *d3d, bool make_vs, const char *name, | ||
65 | const char *buf, int size); | ||
66 | |||
67 | private: | ||
68 | TArray<LPDIRECT3DVERTEXDECLARATION9> _vdecl; | ||
69 | TArray<LPDIRECT3DVERTEXSHADER9> _vs; | ||
70 | TArray<LPDIRECT3DPIXELSHADER9> _ps; | ||
71 | |||
72 | static Ref<D3DShaderPack> _this; | ||
73 | }; | ||
74 | |||
75 | #endif // __EVAS_DIRECT3D_SHADER_PACK_H__ | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_vertex_buffer_cache.cpp b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_vertex_buffer_cache.cpp new file mode 100644 index 0000000..8d3dd45 --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_vertex_buffer_cache.cpp | |||
@@ -0,0 +1,154 @@ | |||
1 | |||
2 | //#define ENABLE_LOG_PRINTF | ||
3 | |||
4 | #include "evas_direct3d_vertex_buffer_cache.h" | ||
5 | #include "evas_direct3d_device.h" | ||
6 | |||
7 | #include <assert.h> | ||
8 | |||
9 | |||
10 | Ref<D3DVertexBufferCache> D3DVertexBufferCache::_this; | ||
11 | |||
12 | D3DVertexBufferCache::D3DVertexBufferCache() | ||
13 | { | ||
14 | size_border_low = 0.6; // We can reuse buffer on 60% | ||
15 | size_border_high = 0.2; // We can reallocate the buffer on 20% | ||
16 | } | ||
17 | |||
18 | D3DVertexBufferCache::~D3DVertexBufferCache() | ||
19 | { | ||
20 | Uninitialize(); | ||
21 | } | ||
22 | |||
23 | D3DVertexBufferCache *D3DVertexBufferCache::Current() | ||
24 | { | ||
25 | if (_this.IsNull()) | ||
26 | _this = new D3DVertexBufferCache(); | ||
27 | return _this; | ||
28 | } | ||
29 | |||
30 | void D3DVertexBufferCache::SetCurrent(D3DVertexBufferCache *obj) | ||
31 | { | ||
32 | _this = obj; | ||
33 | } | ||
34 | |||
35 | void D3DVertexBufferCache::Uninitialize() | ||
36 | { | ||
37 | for (int i = 0; i < _cache.Length(); i++) | ||
38 | { | ||
39 | assert(_cache[i].vb != NULL); | ||
40 | _cache[i].vb->Release(); | ||
41 | } | ||
42 | _cache.Resize(); | ||
43 | } | ||
44 | |||
45 | bool D3DVertexBufferCache::InitBuffer(D3DDevice *d3d, BYTE *data, int size, CacheEntryInfo &info) | ||
46 | { | ||
47 | assert(d3d != NULL); | ||
48 | assert(data != NULL); | ||
49 | assert(size > 0); | ||
50 | |||
51 | int best = FindBestEntry(size); | ||
52 | CacheEntry *ce = NULL; | ||
53 | |||
54 | // Reallocate | ||
55 | if (best >= 0 && _cache[best].size < size) | ||
56 | { | ||
57 | DeleteEntry(best); | ||
58 | best = -1; | ||
59 | } | ||
60 | |||
61 | // New | ||
62 | if (best < 0) | ||
63 | { | ||
64 | CacheEntry new_entry; | ||
65 | if (!CreateEntry(d3d, new_entry, size)) | ||
66 | { | ||
67 | WRN("Failed to create new vbcache entry"); | ||
68 | return false; | ||
69 | } | ||
70 | _cache.Add(new_entry); | ||
71 | info.id = _cache.Length() - 1; | ||
72 | ce = _cache.Last(); | ||
73 | } | ||
74 | else | ||
75 | { | ||
76 | info.id = best; | ||
77 | ce = &_cache[best]; | ||
78 | } | ||
79 | |||
80 | assert(ce != NULL); | ||
81 | if (!InsertData(*ce, data, size)) | ||
82 | { | ||
83 | WRN("Failed to insert vbcache data"); | ||
84 | return false; | ||
85 | } | ||
86 | return true; | ||
87 | } | ||
88 | |||
89 | bool D3DVertexBufferCache::SelectBufferToDevice(D3DDevice *device, int id, int vertex_size) | ||
90 | { | ||
91 | if (id < 0 || id >= _cache.Length()) | ||
92 | return false; | ||
93 | return SUCCEEDED(device->GetDevice()->SetStreamSource(0, _cache[id].vb, 0, vertex_size)); | ||
94 | } | ||
95 | |||
96 | int D3DVertexBufferCache::FindBestEntry(int size) | ||
97 | { | ||
98 | // Search for buffer that fits in borders | ||
99 | for (int i = 0; i < _cache.Length(); i++) | ||
100 | { | ||
101 | const int vs = _cache[i].size; | ||
102 | if (size >= (vs - FLOAT(vs) * size_border_low) && size <= vs) | ||
103 | return i; | ||
104 | } | ||
105 | bool less_than_all = true; | ||
106 | for (int i = 0; i < _cache.Length(); i++) | ||
107 | { | ||
108 | const int vs = _cache[i].size; | ||
109 | if (size >= (vs - FLOAT(vs) * size_border_low)) | ||
110 | less_than_all = false; | ||
111 | } | ||
112 | // Requested size is too small to reuse in any buffer | ||
113 | if (less_than_all) | ||
114 | return -1; | ||
115 | // Search for buffer that can be reallocated | ||
116 | for (int i = 0; i < _cache.Length(); i++) | ||
117 | { | ||
118 | const int vs = _cache[i].size; | ||
119 | if (size <= (vs + FLOAT(vs) * size_border_high)) | ||
120 | return i; | ||
121 | } | ||
122 | // No buffer can be reused or reallocated, create a new one | ||
123 | return -1; | ||
124 | } | ||
125 | |||
126 | bool D3DVertexBufferCache::CreateEntry(D3DDevice *d3d, CacheEntry &entry, int size) | ||
127 | { | ||
128 | assert(d3d != NULL); | ||
129 | if (FAILED(d3d->GetDevice()->CreateVertexBuffer(size, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, | ||
130 | 0, D3DPOOL_DEFAULT, &entry.vb, NULL))) | ||
131 | { | ||
132 | return false; | ||
133 | } | ||
134 | entry.size = size; | ||
135 | return true; | ||
136 | } | ||
137 | |||
138 | void D3DVertexBufferCache::DeleteEntry(int id) | ||
139 | { | ||
140 | if (id < 0 || id >= _cache.Length()) | ||
141 | return; | ||
142 | assert(_cache[id].vb != NULL); | ||
143 | _cache[id].vb->Release(); | ||
144 | _cache.Replace(id); | ||
145 | } | ||
146 | |||
147 | bool D3DVertexBufferCache::InsertData(CacheEntry &entry, BYTE *data, int size) | ||
148 | { | ||
149 | BYTE *ptr = NULL; | ||
150 | if (FAILED(entry.vb->Lock(0, size, (void **)&ptr, D3DLOCK_DISCARD))) | ||
151 | return false; | ||
152 | CopyMemory(ptr, data, size); | ||
153 | return SUCCEEDED(entry.vb->Unlock()); | ||
154 | } | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_vertex_buffer_cache.h b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_vertex_buffer_cache.h new file mode 100644 index 0000000..822ac80 --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_vertex_buffer_cache.h | |||
@@ -0,0 +1,60 @@ | |||
1 | #ifndef __EVAS_DIRECT3D_VERTEX_BUFFER_CACHE_H__ | ||
2 | #define __EVAS_DIRECT3D_VERTEX_BUFFER_CACHE_H__ | ||
3 | |||
4 | #include "evas_engine.h" | ||
5 | |||
6 | #include "ref.h" | ||
7 | #include "array.h" | ||
8 | |||
9 | class D3DDevice; | ||
10 | |||
11 | class D3DVertexBufferCache : virtual public Referenc | ||
12 | { | ||
13 | public: | ||
14 | struct CacheEntryInfo | ||
15 | { | ||
16 | int id; | ||
17 | }; | ||
18 | |||
19 | public: | ||
20 | ~D3DVertexBufferCache(); | ||
21 | |||
22 | static D3DVertexBufferCache *Current(); | ||
23 | static void SetCurrent(D3DVertexBufferCache *obj); | ||
24 | |||
25 | inline void SetSizeBorders(FLOAT low, FLOAT high); | ||
26 | |||
27 | bool InitBuffer(D3DDevice *d3d, BYTE *data, int size, CacheEntryInfo &info); | ||
28 | bool SelectBufferToDevice(D3DDevice *device, int id, int vertex_size); | ||
29 | void Uninitialize(); | ||
30 | |||
31 | private: | ||
32 | struct CacheEntry | ||
33 | { | ||
34 | LPDIRECT3DVERTEXBUFFER9 vb; | ||
35 | int size; | ||
36 | }; | ||
37 | |||
38 | private: | ||
39 | D3DVertexBufferCache(); | ||
40 | |||
41 | int FindBestEntry(int size); | ||
42 | bool CreateEntry(D3DDevice *d3d, CacheEntry &entry, int size); | ||
43 | void DeleteEntry(int id); | ||
44 | bool InsertData(CacheEntry &entry, BYTE *data, int size); | ||
45 | |||
46 | private: | ||
47 | TArray<CacheEntry> _cache; | ||
48 | FLOAT size_border_low; | ||
49 | FLOAT size_border_high; | ||
50 | |||
51 | static Ref<D3DVertexBufferCache> _this; | ||
52 | }; | ||
53 | |||
54 | void D3DVertexBufferCache::SetSizeBorders(FLOAT low, FLOAT high) | ||
55 | { | ||
56 | size_border_low = low; | ||
57 | size_border_high = high; | ||
58 | } | ||
59 | |||
60 | #endif // __EVAS_DIRECT3D_VERTEX_BUFFER_CACHE_H__ | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_engine.c b/libraries/evas/src/modules/engines/direct3d/evas_engine.c new file mode 100644 index 0000000..f7722d8 --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_engine.c | |||
@@ -0,0 +1,503 @@ | |||
1 | #include "evas_common.h" /* Also includes international specific stuff */ | ||
2 | #include "evas_engine.h" | ||
3 | #include "evas_private.h" | ||
4 | #include "Evas_Engine_Direct3D.h" | ||
5 | |||
6 | #undef EAPI | ||
7 | #define EAPI __declspec(dllexport) | ||
8 | |||
9 | /* engine struct data */ | ||
10 | typedef struct _Render_Engine Render_Engine; | ||
11 | struct _Render_Engine | ||
12 | { | ||
13 | Direct3DDeviceHandler d3d; | ||
14 | int width, height; | ||
15 | int end : 1; | ||
16 | int in_redraw : 1; | ||
17 | }; | ||
18 | |||
19 | int _evas_engine_direct3d_log_dom = -1; | ||
20 | |||
21 | /* function tables - filled in later (func and parent func) */ | ||
22 | static Evas_Func func, pfunc; | ||
23 | |||
24 | ////////////////////////////////////////////////////////////////////////////// | ||
25 | // Prototypes | ||
26 | |||
27 | static void *eng_info(Evas *e); | ||
28 | static void eng_info_free(Evas *e, void *info); | ||
29 | static int eng_setup(Evas *e, void *info); | ||
30 | static void eng_output_free(void *data); | ||
31 | static void eng_output_resize(void *data, int width, int height); | ||
32 | |||
33 | ////////////////////////////////////////////////////////////////////////////// | ||
34 | // Init / shutdown methods | ||
35 | // | ||
36 | |||
37 | static void * | ||
38 | _output_setup(int width, int height, int rotation, HWND window, int depth, int fullscreen) | ||
39 | { | ||
40 | Render_Engine *re; | ||
41 | |||
42 | re = (Render_Engine *)calloc(1, sizeof(Render_Engine)); | ||
43 | if (!re) | ||
44 | return NULL; | ||
45 | |||
46 | /* if we haven't initialized - init (automatic abort if already done) */ | ||
47 | evas_common_cpu_init(); | ||
48 | |||
49 | evas_common_blend_init(); | ||
50 | evas_common_image_init(); | ||
51 | evas_common_convert_init(); | ||
52 | evas_common_scale_init(); | ||
53 | evas_common_rectangle_init(); | ||
54 | evas_common_polygon_init(); | ||
55 | evas_common_line_init(); | ||
56 | evas_common_font_init(); | ||
57 | evas_common_draw_init(); | ||
58 | evas_common_tilebuf_init(); | ||
59 | |||
60 | if ((re->d3d = evas_direct3d_init(window, depth, fullscreen)) == 0) | ||
61 | { | ||
62 | free(re); | ||
63 | return NULL; | ||
64 | } | ||
65 | |||
66 | re->width = width; | ||
67 | re->height = height; | ||
68 | |||
69 | return re; | ||
70 | } | ||
71 | |||
72 | static void * | ||
73 | eng_info(Evas *e) | ||
74 | { | ||
75 | Evas_Engine_Info_Direct3D *info; | ||
76 | info = (Evas_Engine_Info_Direct3D *)calloc(1, sizeof(Evas_Engine_Info_Direct3D)); | ||
77 | if (!info) return NULL; | ||
78 | info->magic.magic = rand(); | ||
79 | memset(&info->info, 0, sizeof(info->info)); | ||
80 | info->render_mode = EVAS_RENDER_MODE_BLOCKING; | ||
81 | return info; | ||
82 | e = NULL; | ||
83 | } | ||
84 | |||
85 | static void | ||
86 | eng_info_free(Evas *e, void *info) | ||
87 | { | ||
88 | Evas_Engine_Info_Direct3D *in; | ||
89 | in = (Evas_Engine_Info_Direct3D *)info; | ||
90 | free(in); | ||
91 | } | ||
92 | |||
93 | static int | ||
94 | eng_setup(Evas *e, void *info) | ||
95 | { | ||
96 | Render_Engine *re; | ||
97 | Evas_Engine_Info_Direct3D *in; | ||
98 | re = (Render_Engine *)e->engine.data.output; | ||
99 | in = (Evas_Engine_Info_Direct3D *)info; | ||
100 | if (!e->engine.data.output) | ||
101 | { | ||
102 | e->engine.data.output = _output_setup(e->output.w, | ||
103 | e->output.h, | ||
104 | in->info.rotation, | ||
105 | in->info.window, | ||
106 | in->info.depth, | ||
107 | in->info.fullscreen); | ||
108 | } | ||
109 | else if (in->info.fullscreen != 0) | ||
110 | { | ||
111 | if (re) | ||
112 | evas_direct3d_set_layered(re->d3d, 0, 0, 0, NULL); | ||
113 | evas_direct3d_set_fullscreen(re->d3d, -1, -1, 1); | ||
114 | } | ||
115 | else if (in->info.fullscreen == 0) | ||
116 | { | ||
117 | evas_direct3d_set_fullscreen(re->d3d, re->width, re->height, 0); | ||
118 | if (re && in->info.layered == 0) | ||
119 | evas_direct3d_set_layered(re->d3d, 0, 0, 0, NULL); | ||
120 | else if (re && in->info.layered != 0 && in->shape) | ||
121 | evas_direct3d_set_layered(re->d3d, 1, in->shape->width, in->shape->height, in->shape->mask); | ||
122 | } | ||
123 | |||
124 | if (!e->engine.data.output) | ||
125 | return 0; | ||
126 | if (!e->engine.data.context) | ||
127 | e->engine.data.context = e->engine.func->context_new(e->engine.data.output); | ||
128 | |||
129 | return 1; | ||
130 | } | ||
131 | |||
132 | static void | ||
133 | eng_output_free(void *data) | ||
134 | { | ||
135 | Render_Engine *re = (Render_Engine *)data; | ||
136 | |||
137 | evas_direct3d_free(re->d3d); | ||
138 | |||
139 | free(re); | ||
140 | |||
141 | evas_common_font_shutdown(); | ||
142 | evas_common_image_shutdown(); | ||
143 | } | ||
144 | |||
145 | ////////////////////////////////////////////////////////////////////////////// | ||
146 | // Context | ||
147 | // | ||
148 | |||
149 | static void | ||
150 | eng_context_color_set(void *data, void *context, int r, int g, int b, int a) | ||
151 | { | ||
152 | Render_Engine *re = (Render_Engine *)data; | ||
153 | evas_direct3d_context_color_set(re->d3d, r, g, b, a); | ||
154 | |||
155 | evas_common_draw_context_set_color(context, r, g, b, a); | ||
156 | } | ||
157 | |||
158 | static void | ||
159 | eng_context_multiplier_set(void *data, void *context, int r, int g, int b, int a) | ||
160 | { | ||
161 | Render_Engine *re = (Render_Engine *)data; | ||
162 | evas_direct3d_context_set_multiplier(re->d3d, 255, 255, 255, a); | ||
163 | |||
164 | evas_common_draw_context_set_multiplier(context, r, g, b, a); | ||
165 | } | ||
166 | |||
167 | static void | ||
168 | eng_context_multiplier_unset(void *data, void *context) | ||
169 | { | ||
170 | Render_Engine *re = (Render_Engine *)data; | ||
171 | evas_direct3d_context_set_multiplier(re->d3d, 255, 255, 255, 255); | ||
172 | |||
173 | evas_common_draw_context_unset_multiplier(context); | ||
174 | } | ||
175 | |||
176 | |||
177 | ////////////////////////////////////////////////////////////////////////////// | ||
178 | // Output manipulating | ||
179 | // | ||
180 | |||
181 | static void | ||
182 | eng_output_resize(void *data, int width, int height) | ||
183 | { | ||
184 | Render_Engine *re = (Render_Engine *)data; | ||
185 | re->width = width; | ||
186 | re->height = height; | ||
187 | evas_direct3d_resize(re->d3d, width, height); | ||
188 | } | ||
189 | |||
190 | static void | ||
191 | eng_output_redraws_rect_add(void *data, int x, int y, int width, int height) | ||
192 | { | ||
193 | Render_Engine *re = (Render_Engine *)data; | ||
194 | } | ||
195 | |||
196 | static void | ||
197 | eng_output_redraws_rect_del(void *data, int x, int y, int width, int height) | ||
198 | { | ||
199 | Render_Engine *re = (Render_Engine *)data; | ||
200 | } | ||
201 | |||
202 | static void | ||
203 | eng_output_redraws_clear(void *data) | ||
204 | { | ||
205 | Render_Engine *re = (Render_Engine *)data; | ||
206 | } | ||
207 | |||
208 | static void * | ||
209 | eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, | ||
210 | int *cx, int *cy, int *cw, int *ch) | ||
211 | { | ||
212 | Render_Engine *re; | ||
213 | |||
214 | re = (Render_Engine *)data; | ||
215 | if (re->end) | ||
216 | { | ||
217 | re->end = 0; | ||
218 | re->in_redraw = 0; | ||
219 | return NULL; | ||
220 | } | ||
221 | |||
222 | if (x) *x = 0; | ||
223 | if (y) *y = 0; | ||
224 | if (w) *w = 800; //re->d3d.width; | ||
225 | if (h) *h = 600; //re->d3d.height; | ||
226 | if (cx) *cx = 0; | ||
227 | if (cy) *cy = 0; | ||
228 | if (cw) *cw = 800; //re->d3d.width; | ||
229 | if (ch) *ch = 600; //re->d3d.height; | ||
230 | |||
231 | re->in_redraw = 1; | ||
232 | |||
233 | return re; | ||
234 | } | ||
235 | |||
236 | static void | ||
237 | eng_output_redraws_next_update_push(void *data, void *surface, | ||
238 | int x, int y, int w, int h) | ||
239 | { | ||
240 | Render_Engine *re = (Render_Engine *)data; | ||
241 | re->end = 1; | ||
242 | } | ||
243 | |||
244 | static void | ||
245 | eng_output_flush(void *data) | ||
246 | { | ||
247 | Render_Engine *re = (Render_Engine *)data; | ||
248 | evas_direct3d_render_all(re->d3d); | ||
249 | } | ||
250 | |||
251 | static void | ||
252 | eng_output_idle_flush(void *data) | ||
253 | { | ||
254 | Render_Engine *re = (Render_Engine *)data; | ||
255 | } | ||
256 | |||
257 | |||
258 | ////////////////////////////////////////////////////////////////////////////// | ||
259 | // Draw objects | ||
260 | // | ||
261 | |||
262 | static void | ||
263 | eng_line_draw(void *data, void *context, void *surface, int x1, int y1, int x2, int y2) | ||
264 | { | ||
265 | Render_Engine *re = (Render_Engine *)data; | ||
266 | if (re->in_redraw == 0) | ||
267 | return; | ||
268 | evas_direct3d_line_draw(re->d3d, x1, y1, x2, y2); | ||
269 | } | ||
270 | |||
271 | static void | ||
272 | eng_rectangle_draw(void *data, void *context, void *surface, int x, int y, int w, int h) | ||
273 | { | ||
274 | Render_Engine *re = (Render_Engine *)data; | ||
275 | if (re->in_redraw == 0) | ||
276 | return; | ||
277 | evas_direct3d_rectangle_draw(re->d3d, x, y, w, h); | ||
278 | } | ||
279 | |||
280 | static void * | ||
281 | eng_image_load(void *data, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo) | ||
282 | { | ||
283 | Render_Engine *re = (Render_Engine *)data; | ||
284 | *error = 0; | ||
285 | return evas_direct3d_image_load(re->d3d, file, key, NULL, lo); | ||
286 | } | ||
287 | |||
288 | static void * | ||
289 | eng_image_new_from_data(void *data, int w, int h, DATA32 *image_data, int alpha, int cspace) | ||
290 | { | ||
291 | Render_Engine *re = (Render_Engine *)data; | ||
292 | return evas_direct3d_image_new_from_data(re->d3d, w, h, image_data, alpha, cspace); | ||
293 | } | ||
294 | |||
295 | static void * | ||
296 | eng_image_new_from_copied_data(void *data, int w, int h, DATA32 *image_data, int alpha, int cspace) | ||
297 | { | ||
298 | Render_Engine *re = (Render_Engine *)data; | ||
299 | return evas_direct3d_image_new_from_copied_data(re->d3d, w, h, image_data, alpha, cspace); | ||
300 | } | ||
301 | |||
302 | static void | ||
303 | eng_image_free(void *data, void *image) | ||
304 | { | ||
305 | Render_Engine *re = (Render_Engine *)data; | ||
306 | evas_direct3d_image_free(re->d3d, image); | ||
307 | } | ||
308 | |||
309 | static void * | ||
310 | eng_image_data_put(void *data, void *image, DATA32 *image_data) | ||
311 | { | ||
312 | Render_Engine *re = (Render_Engine *)data; | ||
313 | evas_direct3d_image_data_put(re->d3d, image, image_data); | ||
314 | return image; | ||
315 | } | ||
316 | |||
317 | static void * | ||
318 | eng_image_dirty_region(void *data, void *image, int x, int y, int w, int h) | ||
319 | { | ||
320 | return image; | ||
321 | } | ||
322 | |||
323 | static void * | ||
324 | eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, int *err) | ||
325 | { | ||
326 | Render_Engine *re = (Render_Engine *)data; | ||
327 | evas_direct3d_image_data_get(re->d3d, image, to_write, image_data); | ||
328 | if (err) *err = EVAS_LOAD_ERROR_NONE; | ||
329 | return image; | ||
330 | } | ||
331 | |||
332 | static void | ||
333 | eng_image_draw(void *data, void *context, void *surface, void *image, | ||
334 | int src_x, int src_y, int src_w, int src_h, | ||
335 | int dst_x, int dst_y, int dst_w, int dst_h, int smooth) | ||
336 | { | ||
337 | Render_Engine *re = (Render_Engine *)data; | ||
338 | evas_direct3d_image_draw(re->d3d, image, | ||
339 | src_x, src_y, src_w, src_h, | ||
340 | dst_x, dst_y, dst_w, dst_h, smooth); | ||
341 | } | ||
342 | |||
343 | static void | ||
344 | eng_image_size_get(void *data, void *image, int *w, int *h) | ||
345 | { | ||
346 | evas_direct3d_image_size_get(image, w, h); | ||
347 | } | ||
348 | |||
349 | static int | ||
350 | eng_image_alpha_get(void *data, void *image) | ||
351 | { | ||
352 | // Hm:) | ||
353 | if (!image) | ||
354 | return 1; | ||
355 | return 0; | ||
356 | } | ||
357 | |||
358 | static int | ||
359 | eng_image_colorspace_get(void *data, void *image) | ||
360 | { | ||
361 | // Well, change that when you think about other colorspace | ||
362 | return EVAS_COLORSPACE_ARGB8888; | ||
363 | } | ||
364 | |||
365 | static void * | ||
366 | eng_image_border_set(void *data, void *image, int l, int r, int t, int b) | ||
367 | { | ||
368 | Render_Engine *re = (Render_Engine *)data; | ||
369 | evas_direct3d_image_border_set(re->d3d, image, l, t, r, b); | ||
370 | return image; | ||
371 | } | ||
372 | |||
373 | static void | ||
374 | eng_image_border_get(void *data, void *image, int *l, int *r, int *t, int *b) | ||
375 | { | ||
376 | Render_Engine *re = (Render_Engine *)data; | ||
377 | evas_direct3d_image_border_get(re->d3d, image, l, t, r, b); | ||
378 | } | ||
379 | |||
380 | static void | ||
381 | eng_image_scale_hint_set(void *data __UNUSED__, void *image, int hint) | ||
382 | { | ||
383 | } | ||
384 | |||
385 | static int | ||
386 | eng_image_scale_hint_get(void *data __UNUSED__, void *image) | ||
387 | { | ||
388 | return EVAS_IMAGE_SCALE_HINT_NONE; | ||
389 | } | ||
390 | |||
391 | static void | ||
392 | eng_font_draw(void *data, void *context, void *surface, Evas_Font_Set *font, int x, int y, int w, int h, int ow, int oh, const Evas_Text_Props *intl_props) | ||
393 | { | ||
394 | Render_Engine *re = (Render_Engine *)data; | ||
395 | RGBA_Image im; | ||
396 | im.image.data = NULL; | ||
397 | im.cache_entry.w = re->width; | ||
398 | im.cache_entry.h = re->height; | ||
399 | |||
400 | evas_direct3d_select_or_create_font(re->d3d, font); | ||
401 | |||
402 | evas_common_draw_context_font_ext_set(context, re->d3d, | ||
403 | evas_direct3d_font_texture_new, | ||
404 | evas_direct3d_font_texture_free, | ||
405 | evas_direct3d_font_texture_draw); | ||
406 | evas_common_font_draw(&im, context, (RGBA_Font *) font, x, y, intl_props); | ||
407 | evas_common_draw_context_font_ext_set(context, NULL, NULL, NULL, NULL); | ||
408 | } | ||
409 | |||
410 | static void | ||
411 | eng_font_free(void *data, void *font) | ||
412 | { | ||
413 | Render_Engine *re = (Render_Engine *)data; | ||
414 | evas_common_font_free(font); | ||
415 | evas_direct3d_font_free(re->d3d, font); | ||
416 | } | ||
417 | |||
418 | /* module advertising code */ | ||
419 | static int | ||
420 | module_open(Evas_Module *em) | ||
421 | { | ||
422 | if (!em) return 0; | ||
423 | /* get whatever engine module we inherit from */ | ||
424 | if (!_evas_module_engine_inherit(&pfunc, "software_generic")) return 0; | ||
425 | /* Initialize the log domain */ | ||
426 | _evas_engine_direct3d_log_dom = eina_log_domain_register | ||
427 | ("evas-direct3d", EVAS_DEFAULT_LOG_COLOR); | ||
428 | if (_evas_engine_direct3d_log_dom < 0) | ||
429 | { | ||
430 | EINA_LOG_ERR("Can not create a module log domain."); | ||
431 | return 0; | ||
432 | } | ||
433 | /* store it for later use */ | ||
434 | func = pfunc; | ||
435 | /* now to override methods */ | ||
436 | #define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_) | ||
437 | ORD(info); | ||
438 | ORD(info_free); | ||
439 | ORD(setup); | ||
440 | ORD(context_color_set); | ||
441 | ORD(context_multiplier_set); | ||
442 | ORD(context_multiplier_unset); | ||
443 | ORD(output_free); | ||
444 | ORD(output_resize); | ||
445 | ORD(output_redraws_rect_add); | ||
446 | ORD(output_redraws_rect_del); | ||
447 | ORD(output_redraws_clear); | ||
448 | ORD(output_redraws_next_update_get); | ||
449 | ORD(output_redraws_next_update_push); | ||
450 | ORD(output_flush); | ||
451 | ORD(output_idle_flush); | ||
452 | ORD(line_draw); | ||
453 | ORD(rectangle_draw); | ||
454 | ORD(image_load); | ||
455 | ORD(image_new_from_data); | ||
456 | ORD(image_new_from_copied_data); | ||
457 | ORD(image_free); | ||
458 | ORD(image_data_put); | ||
459 | ORD(image_dirty_region); | ||
460 | ORD(image_data_get); | ||
461 | ORD(image_draw); | ||
462 | ORD(image_size_get); | ||
463 | ORD(image_alpha_get); | ||
464 | ORD(image_colorspace_get); | ||
465 | ORD(image_border_set); | ||
466 | ORD(image_border_get); | ||
467 | ORD(font_draw); | ||
468 | ORD(font_free); | ||
469 | |||
470 | ORD(image_scale_hint_set); | ||
471 | ORD(image_scale_hint_get); | ||
472 | |||
473 | // ORD(image_map_draw); | ||
474 | // ORD(image_map_surface_new); | ||
475 | // ORD(image_map_surface_free); | ||
476 | |||
477 | /* now advertise out own api */ | ||
478 | em->functions = (void *)(&func); | ||
479 | return 1; | ||
480 | } | ||
481 | |||
482 | static void | ||
483 | module_close(Evas_Module *em) | ||
484 | { | ||
485 | eina_log_domain_unregister(_evas_engine_direct3d_log_dom); | ||
486 | } | ||
487 | |||
488 | static Evas_Module_Api evas_modapi = | ||
489 | { | ||
490 | EVAS_MODULE_API_VERSION, | ||
491 | "direct3d", | ||
492 | "none", | ||
493 | { | ||
494 | module_open, | ||
495 | module_close | ||
496 | } | ||
497 | }; | ||
498 | |||
499 | EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, direct3d); | ||
500 | |||
501 | #ifndef EVAS_STATIC_BUILD_DIRECT3D | ||
502 | EVAS_EINA_MODULE_DEFINE(engine, direct3d); | ||
503 | #endif | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_engine.h b/libraries/evas/src/modules/engines/direct3d/evas_engine.h new file mode 100644 index 0000000..da1ebff --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_engine.h | |||
@@ -0,0 +1,125 @@ | |||
1 | #ifndef __EVAS_ENGINE_H__ | ||
2 | #define __EVAS_ENGINE_H__ | ||
3 | |||
4 | |||
5 | #define WIN32_LEAN_AND_MEAN | ||
6 | #include <windows.h> | ||
7 | #undef WIN32_LEAN_AND_MEAN | ||
8 | #include <d3d9.h> | ||
9 | |||
10 | #ifdef __cplusplus | ||
11 | extern "C" { | ||
12 | #endif | ||
13 | |||
14 | #define EVAS_INLINE_ARRAY_H // We dont need that and it is buggy | ||
15 | |||
16 | #include "evas_common.h" | ||
17 | |||
18 | #ifdef __cplusplus | ||
19 | } | ||
20 | #endif | ||
21 | |||
22 | |||
23 | //#define ENABLE_LOG_PRINTF | ||
24 | |||
25 | extern int _evas_engine_direct3d_log_dom ; | ||
26 | #ifdef ERR | ||
27 | # undef ERR | ||
28 | #endif | ||
29 | #define ERR(...) EINA_LOG_DOM_ERR(_evas_engine_direct3d_log_dom, __VA_ARGS__) | ||
30 | |||
31 | #ifdef DBG | ||
32 | # undef DBG | ||
33 | #endif | ||
34 | #define DBG(...) EINA_LOG_DOM_DBG(_evas_engine_direct3d_log_dom, __VA_ARGS__) | ||
35 | |||
36 | #ifdef INF | ||
37 | # undef INF | ||
38 | #endif | ||
39 | #define INF(...) EINA_LOG_DOM_INFO(_evas_engine_direct3d_log_dom, __VA_ARGS__) | ||
40 | |||
41 | #ifdef WRN | ||
42 | # undef WRN | ||
43 | #endif | ||
44 | #define WRN(...) EINA_LOG_DOM_WARN(_evas_engine_direct3d_log_dom, __VA_ARGS__) | ||
45 | |||
46 | #ifdef CRIT | ||
47 | # undef CRIT | ||
48 | #endif | ||
49 | #define CRIT(...) EINA_LOG_DOM_CRIT(_evas_engine_direct3d_log_dom, __VA_ARGS__) | ||
50 | |||
51 | #ifdef ENABLE_LOG_PRINTF | ||
52 | #define Log(str, ...) INF("D3D "str, __VA_ARGS__) | ||
53 | #else | ||
54 | #define Log(str, ...) | ||
55 | #endif | ||
56 | |||
57 | typedef void * Direct3DDeviceHandler; | ||
58 | typedef void * Direct3DImageHandler; | ||
59 | typedef void * Direct3DFontGlyphHandler; | ||
60 | |||
61 | |||
62 | #ifdef __cplusplus | ||
63 | extern "C" { | ||
64 | #endif | ||
65 | |||
66 | // Main engine functions | ||
67 | |||
68 | Direct3DDeviceHandler evas_direct3d_init(HWND window, int depth, int fullscreen); | ||
69 | void evas_direct3d_free(Direct3DDeviceHandler d3d); | ||
70 | void evas_direct3d_render_all(Direct3DDeviceHandler d3d); | ||
71 | void evas_direct3d_resize(Direct3DDeviceHandler d3d, int width, int height); | ||
72 | void evas_direct3d_set_fullscreen(Direct3DDeviceHandler d3d, | ||
73 | int width, int height, int fullscreen); | ||
74 | void evas_direct3d_set_layered(Direct3DDeviceHandler d3d, int layered, | ||
75 | int mask_width, int mask_height, unsigned char *mask); | ||
76 | |||
77 | |||
78 | // Context manipulations | ||
79 | |||
80 | void evas_direct3d_context_color_set(Direct3DDeviceHandler d3d, int r, int g, int b, int a); | ||
81 | void evas_direct3d_context_set_multiplier(Direct3DDeviceHandler d3d, int r, int g, int b, int a); | ||
82 | |||
83 | // Simple objects | ||
84 | |||
85 | void evas_direct3d_line_draw(Direct3DDeviceHandler d3d, int x1, int y1, int x2, int y2); | ||
86 | void evas_direct3d_rectangle_draw(Direct3DDeviceHandler d3d, int x, int y, int w, int h); | ||
87 | |||
88 | // Images | ||
89 | |||
90 | Direct3DImageHandler evas_direct3d_image_load(Direct3DDeviceHandler d3d, | ||
91 | const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo); | ||
92 | Direct3DImageHandler evas_direct3d_image_new_from_data(Direct3DDeviceHandler d3d, | ||
93 | int w, int h, DWORD *image_data, int alpha, int cspace); | ||
94 | Direct3DImageHandler evas_direct3d_image_new_from_copied_data(Direct3DDeviceHandler d3d, | ||
95 | int w, int h, DWORD *image_data, int alpha, int cspace); | ||
96 | void evas_direct3d_image_free(Direct3DDeviceHandler d3d, Direct3DImageHandler image); | ||
97 | void evas_direct3d_image_data_put(Direct3DDeviceHandler d3d, Direct3DImageHandler image, | ||
98 | DWORD *image_data); | ||
99 | void evas_direct3d_image_data_get(Direct3DDeviceHandler d3d, Direct3DImageHandler image, | ||
100 | int to_write, DATA32 **image_data); | ||
101 | void evas_direct3d_image_draw(Direct3DDeviceHandler d3d, Direct3DImageHandler image, | ||
102 | int src_x, int src_y, int src_w, int src_h, | ||
103 | int dst_x, int dst_y, int dst_w, int dst_h, int smooth); | ||
104 | void evas_direct3d_image_size_get(Direct3DImageHandler image, int *w, int *h); | ||
105 | void evas_direct3d_image_border_set(Direct3DDeviceHandler d3d, Direct3DImageHandler image, | ||
106 | int l, int r, int t, int b); | ||
107 | void evas_direct3d_image_border_get(Direct3DDeviceHandler d3d, Direct3DImageHandler image, | ||
108 | int *l, int *r, int *t, int *b); | ||
109 | |||
110 | // Fonts | ||
111 | |||
112 | Direct3DFontGlyphHandler evas_direct3d_font_texture_new(Direct3DDeviceHandler d3d, | ||
113 | RGBA_Font_Glyph *fg); | ||
114 | void evas_direct3d_font_texture_free(Direct3DFontGlyphHandler ft); | ||
115 | void evas_direct3d_font_texture_draw(Direct3DDeviceHandler d3d, void *dest, void *context, | ||
116 | RGBA_Font_Glyph *fg, int x, int y); | ||
117 | void evas_direct3d_select_or_create_font(Direct3DDeviceHandler d3d, void *font); | ||
118 | void evas_direct3d_font_free(Direct3DDeviceHandler d3d, void *font); | ||
119 | |||
120 | #ifdef __cplusplus | ||
121 | } | ||
122 | #endif | ||
123 | |||
124 | |||
125 | #endif /* __EVAS_ENGINE_H__ */ | ||
diff --git a/libraries/evas/src/modules/engines/direct3d/ref.h b/libraries/evas/src/modules/engines/direct3d/ref.h new file mode 100644 index 0000000..0853f2e --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/ref.h | |||
@@ -0,0 +1,210 @@ | |||
1 | #ifndef __REF_H__ | ||
2 | #define __REF_H__ | ||
3 | |||
4 | ////////////////////////////////////////////////////////////////////////////// | ||
5 | // class Referenc | ||
6 | // Desc: Base class enabling reference interface | ||
7 | // Note: Class should derive as virtual | ||
8 | // | ||
9 | class Referenc | ||
10 | { | ||
11 | public: | ||
12 | Referenc() | ||
13 | : refs_count(0) {}; | ||
14 | |||
15 | inline int AddRef() | ||
16 | { | ||
17 | return ++refs_count; | ||
18 | } | ||
19 | inline int RemRef() | ||
20 | { | ||
21 | return --refs_count; | ||
22 | } | ||
23 | inline int RefCount() | ||
24 | { | ||
25 | return refs_count; | ||
26 | } | ||
27 | |||
28 | private: | ||
29 | int refs_count; | ||
30 | }; | ||
31 | |||
32 | |||
33 | ////////////////////////////////////////////////////////////////////////////// | ||
34 | // template Ref | ||
35 | // Desc: Holder in smart-pointers system. | ||
36 | // Important: Only Referenc subclasses may be used as template param. | ||
37 | // | ||
38 | |||
39 | template <class T> | ||
40 | class Ref | ||
41 | { | ||
42 | public: | ||
43 | // Constructors & destructor | ||
44 | Ref(); | ||
45 | //Ref(Ref<T> &ref); | ||
46 | Ref(const Ref<T> &ref); | ||
47 | Ref(T *ptr); | ||
48 | Ref(const T *ptr); | ||
49 | ~Ref(); | ||
50 | |||
51 | Ref<T> &operator =(Ref<T> &ref); | ||
52 | Ref<T> &operator =(T *ptr); | ||
53 | |||
54 | inline T *Addr(); | ||
55 | inline T *Addr() const; | ||
56 | inline int RefCount(); | ||
57 | inline bool IsNull(); | ||
58 | |||
59 | inline T *operator ->(); | ||
60 | inline operator const T *() const; | ||
61 | inline operator T *(); | ||
62 | |||
63 | //private: | ||
64 | void RemRef(); | ||
65 | |||
66 | private: | ||
67 | T *m_ptr; | ||
68 | }; | ||
69 | |||
70 | ////////////////////////////////////////////////////////////////////////////// | ||
71 | // Constructors & destructor | ||
72 | template <class T> Ref<T>::Ref() | ||
73 | : m_ptr(NULL) | ||
74 | { | ||
75 | } | ||
76 | |||
77 | //template <class T> Ref<T>::Ref(Ref<T> &ref) | ||
78 | //: m_ptr(NULL) | ||
79 | //{ | ||
80 | // if (ref.Addr() != NULL) | ||
81 | // { | ||
82 | // m_ptr = ref.Addr(); | ||
83 | // ((Referenc *)m_ptr)->AddRef(); | ||
84 | // } | ||
85 | //} | ||
86 | |||
87 | template <class T> Ref<T>::Ref(const Ref<T> &ref) | ||
88 | : m_ptr(NULL) | ||
89 | { | ||
90 | if (ref.Addr() != NULL) | ||
91 | { | ||
92 | m_ptr = ref.Addr(); | ||
93 | ((Referenc *)m_ptr)->AddRef(); | ||
94 | } | ||
95 | } | ||
96 | |||
97 | template <class T> Ref<T>::Ref(T *ptr) | ||
98 | : m_ptr(NULL) | ||
99 | { | ||
100 | if (ptr != NULL) | ||
101 | { | ||
102 | m_ptr = ptr; | ||
103 | ((Referenc *)m_ptr)->AddRef(); | ||
104 | } | ||
105 | } | ||
106 | |||
107 | template <class T> Ref<T>::Ref(const T *ptr) | ||
108 | : m_ptr(NULL) | ||
109 | { | ||
110 | if (ptr != NULL) | ||
111 | { | ||
112 | m_ptr = ptr; | ||
113 | ((Referenc *)m_ptr)->AddRef(); | ||
114 | } | ||
115 | } | ||
116 | |||
117 | template <class T> Ref<T>::~Ref() | ||
118 | { | ||
119 | if (m_ptr == NULL) | ||
120 | return; | ||
121 | RemRef(); | ||
122 | } | ||
123 | |||
124 | // Check pointer on correctness | ||
125 | template <class T> bool Ref<T>::IsNull() | ||
126 | { | ||
127 | return (m_ptr == NULL); | ||
128 | } | ||
129 | |||
130 | ////////////////////////////////////////////////////////////////////////////// | ||
131 | // Operators | ||
132 | |||
133 | template <class T> Ref<T> &Ref<T>::operator =(T *ptr) | ||
134 | { | ||
135 | if (ptr != NULL) | ||
136 | { | ||
137 | if (m_ptr != ptr) | ||
138 | { | ||
139 | RemRef(); | ||
140 | m_ptr = ptr; | ||
141 | ((Referenc *)m_ptr)->AddRef(); | ||
142 | } | ||
143 | } | ||
144 | else if (m_ptr != NULL) | ||
145 | RemRef(); | ||
146 | return *this; | ||
147 | } | ||
148 | |||
149 | template <class T> Ref<T> &Ref<T>::operator =(Ref<T> &ref) | ||
150 | { | ||
151 | if (ref.Addr() != NULL) | ||
152 | { | ||
153 | if (m_ptr != ref.Addr()) | ||
154 | { | ||
155 | RemRef(); | ||
156 | m_ptr = ref.Addr(); | ||
157 | ((Referenc *)m_ptr)->AddRef(); | ||
158 | } | ||
159 | } | ||
160 | else if (m_ptr != NULL) | ||
161 | RemRef(); | ||
162 | return *this; | ||
163 | } | ||
164 | |||
165 | // Get pointer | ||
166 | template <class T> T *Ref<T>::Addr() | ||
167 | { | ||
168 | return m_ptr; | ||
169 | } | ||
170 | |||
171 | template <class T> T *Ref<T>::Addr() const | ||
172 | { | ||
173 | return m_ptr; | ||
174 | } | ||
175 | |||
176 | // Get refs count | ||
177 | template <class T> int Ref<T>::RefCount() | ||
178 | { | ||
179 | if (m_ptr == NULL) | ||
180 | return 0; | ||
181 | return ((Referenc *)m_ptr)->RefCount(); | ||
182 | } | ||
183 | |||
184 | // Remove ref to the object and delete it if necessary | ||
185 | // WARNING: arrays cannot be deleted | ||
186 | template <class T> void Ref<T>::RemRef() | ||
187 | { | ||
188 | if (m_ptr == NULL) | ||
189 | return; | ||
190 | if (((Referenc *)m_ptr)->RemRef() == 0) | ||
191 | delete m_ptr; | ||
192 | m_ptr = NULL; | ||
193 | } | ||
194 | |||
195 | template <class T> T *Ref<T>::operator ->() | ||
196 | { | ||
197 | return m_ptr; | ||
198 | } | ||
199 | |||
200 | template <class T> Ref<T>::operator const T *() const | ||
201 | { | ||
202 | return m_ptr; | ||
203 | } | ||
204 | |||
205 | template <class T> Ref<T>::operator T *() | ||
206 | { | ||
207 | return m_ptr; | ||
208 | } | ||
209 | |||
210 | #endif // __REF_H__ | ||