Author: shadowmaster
Date: Tue Mar 31 01:05:58 2009
New Revision: 34310
URL: http://svn.gna.org/viewcvs/wesnoth?rev=34310&view=rev
Log:
Implement the ~NOP() image functor, which takes a surface and returns
the same (not copied) surface.
I'll later decide whether WML authors need to know about this or not.
Modified:
trunk/src/image.cpp
trunk/src/image_function.cpp
trunk/src/image_function.hpp
Modified: trunk/src/image.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/image.cpp?rev=34310&r1=34309&r2=34310&view=diff
==============================================================================
--- trunk/src/image.cpp (original)
+++ trunk/src/image.cpp Tue Mar 31 01:05:58 2009
@@ -617,6 +617,10 @@
else if("B" == function) {
const int b =
lexical_cast_default<int>(field);
functor_queue.push_back(new
cs_function(0,0,b));
+ }
+ else if("NOP" == function) {
+ // Odd, isn't it?
+ functor_queue.push_back(new
nop_function());
}
// Fake image function used by GUI2 portraits
until
// Mordante gets rid of it. *tsk* *tsk*
Modified: trunk/src/image_function.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/image_function.cpp?rev=34310&r1=34309&r2=34310&view=diff
==============================================================================
--- trunk/src/image_function.cpp (original)
+++ trunk/src/image_function.cpp Tue Mar 31 01:05:58 2009
@@ -20,6 +20,11 @@
#define ERR_DP LOG_STREAM(err, display)
namespace image {
+
+surface nop_function::operator()(const surface& src) const
+{
+ return src;
+}
surface rc_function::operator()(const surface& src) const
{
Modified: trunk/src/image_function.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/image_function.hpp?rev=34310&r1=34309&r2=34310&view=diff
==============================================================================
--- trunk/src/image_function.hpp (original)
+++ trunk/src/image_function.hpp Tue Mar 31 01:05:58 2009
@@ -33,6 +33,17 @@
* Applies the image-path function on the specified surface.
*/
virtual surface operator()(const surface& src) const = 0;
+};
+
+/**
+ * NOP function.
+ * It takes a surface and returns a pointer to the same surface.
+ */
+class nop_function : public function_base
+{
+public:
+ nop_function() {}
+ virtual surface operator()(const surface& src) const;
};
/**
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits