20 #ifndef OPENXCOM_SHADERDRAW_H
21 #define OPENXCOM_SHADERDRAW_H
23 #include "ShaderDrawHelper.h"
38 template<
typename ColorFunc,
typename DestType,
typename Src0Type,
typename Src1Type,
typename Src2Type,
typename Src3Type>
39 static inline void ShaderDraw(
const DestType& dest_frame,
const Src0Type& src0_frame,
const Src1Type& src1_frame,
const Src2Type& src2_frame,
const Src3Type& src3_frame)
42 helper::controler<DestType> dest(dest_frame);
43 helper::controler<Src0Type> src0(src0_frame);
44 helper::controler<Src1Type> src1(src1_frame);
45 helper::controler<Src2Type> src2(src2_frame);
46 helper::controler<Src3Type> src3(src3_frame);
49 GraphSubset end_temp = dest.get_range();
52 src0.mod_range(end_temp);
53 src1.mod_range(end_temp);
54 src2.mod_range(end_temp);
55 src3.mod_range(end_temp);
57 const GraphSubset end = end_temp;
58 if(end.size_x() == 0 || end.size_y() == 0)
68 int begin_y = 0, end_y = end.size_y();
70 dest.mod_y(begin_y, end_y);
71 src0.mod_y(begin_y, end_y);
72 src1.mod_y(begin_y, end_y);
73 src2.mod_y(begin_y, end_y);
74 src3.mod_y(begin_y, end_y);
78 dest.set_y(begin_y, end_y);
79 src0.set_y(begin_y, end_y);
80 src1.set_y(begin_y, end_y);
81 src2.set_y(begin_y, end_y);
82 src3.set_y(begin_y, end_y);
85 for(
int y = end_y-begin_y; y>0; --y, dest.inc_y(), src0.inc_y(), src1.inc_y(), src2.inc_y(), src3.inc_y())
87 int begin_x = 0, end_x = end.size_x();
89 dest.mod_x(begin_x, end_x);
90 src0.mod_x(begin_x, end_x);
91 src1.mod_x(begin_x, end_x);
92 src2.mod_x(begin_x, end_x);
93 src3.mod_x(begin_x, end_x);
97 dest.set_x(begin_x, end_x);
98 src0.set_x(begin_x, end_x);
99 src1.set_x(begin_x, end_x);
100 src2.set_x(begin_x, end_x);
101 src3.set_x(begin_x, end_x);
104 for(
int x = end_x-begin_x; x>0; --x, dest.inc_x(), src0.inc_x(), src1.inc_x(), src2.inc_x(), src3.inc_x())
106 ColorFunc::func(dest.get_ref(), src0.get_ref(), src1.get_ref(), src2.get_ref(), src3.get_ref());
112 template<
typename ColorFunc,
typename DestType,
typename Src0Type,
typename Src1Type,
typename Src2Type>
113 static inline void ShaderDraw(
const DestType& dest_frame,
const Src0Type& src0_frame,
const Src1Type& src1_frame,
const Src2Type& src2_frame)
115 ShaderDraw<ColorFunc>(dest_frame, src0_frame, src1_frame, src2_frame, helper::Nothing());
117 template<
typename ColorFunc,
typename DestType,
typename Src0Type,
typename Src1Type>
118 static inline void ShaderDraw(
const DestType& dest_frame,
const Src0Type& src0_frame,
const Src1Type& src1_frame)
120 ShaderDraw<ColorFunc>(dest_frame, src0_frame, src1_frame, helper::Nothing(), helper::Nothing());
122 template<
typename ColorFunc,
typename DestType,
typename Src0Type>
123 static inline void ShaderDraw(
const DestType& dest_frame,
const Src0Type& src0_frame)
125 ShaderDraw<ColorFunc>(dest_frame, src0_frame, helper::Nothing(), helper::Nothing(), helper::Nothing());
127 template<
typename ColorFunc,
typename DestType>
128 static inline void ShaderDraw(
const DestType& dest_frame)
130 ShaderDraw<ColorFunc>(dest_frame, helper::Nothing(), helper::Nothing(), helper::Nothing(), helper::Nothing());
134 static inline helper::Scalar<T> ShaderScalar(T& t)
136 return helper::Scalar<T>(t);
139 static inline helper::Scalar<const T> ShaderScalar(
const T& t)
141 return helper::Scalar<const T>(t);
147 const Uint8 ColorGroup = 15<<4;
148 const Uint8 ColorShade = 15;
149 const Uint8 ColorShadeMax = 15;
150 const Uint8 BLACK = 15;