2 #include "oxygine-include.h" 5 #include "math/Color.h" 7 #include "math/AffineTransform.h" 8 #include "NativeTexture.h" 9 #include "VideoDriver.h" 11 #if OXYGINE_NO_SUBPIXEL_RENDERING 12 #define SNAP_PIXEL(arg) floor(arg) 14 #define SNAP_PIXEL(arg) (arg) 19 typedef AffineTransform Transform;
21 #define MAKE_BLEND_MODE(source, dest) ((IVideoDriver::BT_##source << 16) | (IVideoDriver::BT_##dest)) 27 blend_premultiplied_alpha = MAKE_BLEND_MODE(ONE, ONE_MINUS_SRC_ALPHA),
28 blend_alpha = MAKE_BLEND_MODE(SRC_ALPHA, ONE_MINUS_SRC_ALPHA),
29 blend_add = MAKE_BLEND_MODE(ONE, ONE),
30 blend_screen = MAKE_BLEND_MODE(ONE, ONE_MINUS_SRC_COLOR),
31 blend_multiply = MAKE_BLEND_MODE(DST_COLOR, ONE_MINUS_SRC_ALPHA),
32 blend_inverse = MAKE_BLEND_MODE(ONE_MINUS_DST_COLOR, ZERO),
37 void fillQuadT(V* pv,
const RectF& srcRect,
const RectF& destRect,
const AffineTransform& transform,
unsigned int rgba)
39 float u = srcRect.pos.x;
40 float v = srcRect.pos.y;
42 float du = srcRect.size.x;
43 float dv = srcRect.size.y;
48 const Vector2& pos = destRect.pos;
49 const Vector2& size = destRect.size;
51 Vector2 p1(pos.x, pos.y);
52 Vector2 p2(pos.x, pos.y + size.y);
53 Vector2 p3(pos.x + size.x, pos.y);
54 Vector2 p4(pos.x + size.x, pos.y + size.y);
57 p1 = transform.transform(p1);
58 p2 = transform.transform(p2);
59 p3 = transform.transform(p3);
60 p4 = transform.transform(p4);
64 vt.x = SNAP_PIXEL(p1.x);
65 vt.y = SNAP_PIXEL(p1.y);
71 vt.x = SNAP_PIXEL(p2.x);
72 vt.y = SNAP_PIXEL(p2.y);
78 vt.x = SNAP_PIXEL(p3.x);
79 vt.y = SNAP_PIXEL(p3.y);
85 vt.x = SNAP_PIXEL(p4.x);
86 vt.y = SNAP_PIXEL(p4.y);
94 void fillQuadZT(V* pv,
const RectF& srcRect,
const RectF& destRect,
float Z,
unsigned int rgba)
96 float u = srcRect.pos.x;
97 float v = srcRect.pos.y;
99 float du = srcRect.size.x;
100 float dv = srcRect.size.y;
105 const Vector2& pos = destRect.pos;
106 const Vector2& size = destRect.size;
108 Vector2 p1(pos.x, pos.y);
109 Vector2 p2(pos.x, pos.y + size.y);
110 Vector2 p3(pos.x + size.x, pos.y);
111 Vector2 p4(pos.x + size.x, pos.y + size.y);
116 vt.x = SNAP_PIXEL(p1.x);
117 vt.y = SNAP_PIXEL(p1.y);
123 vt.x = SNAP_PIXEL(p2.x);
124 vt.y = SNAP_PIXEL(p2.y);
130 vt.x = SNAP_PIXEL(p3.x);
131 vt.y = SNAP_PIXEL(p3.y);
137 vt.x = SNAP_PIXEL(p4.x);
138 vt.y = SNAP_PIXEL(p4.y);
147 void fillQuadT2(V* pv,
const RectF& srcRect,
const RectF& srcRect2,
const RectF& destRect,
const AffineTransform& transform,
unsigned int rgba)
149 float u = srcRect.pos.x;
150 float v = srcRect.pos.y;
152 float du = srcRect.size.x;
153 float dv = srcRect.size.y;
155 float u2 = srcRect2.pos.x;
156 float v2 = srcRect2.pos.y;
158 float du2 = srcRect2.size.x;
159 float dv2 = srcRect2.size.y;
164 const Vector2& pos = destRect.pos;
165 const Vector2& size = destRect.size;
167 Vector2 p1(pos.x, pos.y);
168 Vector2 p2(pos.x, pos.y + size.y);
169 Vector2 p3(pos.x + size.x, pos.y);
170 Vector2 p4(pos.x + size.x, pos.y + size.y);
173 p1 = transform.transform(p1);
174 p2 = transform.transform(p2);
175 p3 = transform.transform(p3);
176 p4 = transform.transform(p4);
180 vt.x = SNAP_PIXEL(p1.x);
181 vt.y = SNAP_PIXEL(p1.y);
189 vt.x = SNAP_PIXEL(p2.x);
190 vt.y = SNAP_PIXEL(p2.y);
198 vt.x = SNAP_PIXEL(p3.x);
199 vt.y = SNAP_PIXEL(p3.y);
207 vt.x = SNAP_PIXEL(p4.x);
208 vt.y = SNAP_PIXEL(p4.y);
221 virtual void drawElement(
const spNativeTexture& texture,
unsigned int color,
const RectF& src,
const RectF& dest) = 0;
Matrix makeViewMatrix(int w, int h, bool flipU=false)
–oxgl-end–!
Definition: Actor.h:14
Definition: Renderer.h:217