OpenTTD Source: src/blitter/40bpp_anim.cpp Source File

OpenTTD Source 1.11.0-RC1

40bpp_anim.cpp
1 /* $Id$ */
2
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
9
12 #include "../stdafx.h"
13 #include "../zoom_func.h"
14 #include "../settings_type.h"
15 #include "../video/video_driver.hpp"
16 #include "40bpp_anim.hpp"
17 #include "common.hpp"
18
19 #include "../table/sprites.h"
20
21 #include "../safeguards.h"
22
23
25 static FBlitter_40bppAnim iFBlitter_40bppAnim;
26
28 static const Colour _black_colour(0, 0, 0);
29
30
31 void Blitter_40bppAnim::SetPixel(void *video, int x, int y, uint8 colour)
32 {
33 if (_screen_disable_anim) {
34 Blitter_32bppOptimized::SetPixel(video, x, y, colour);
35 } else {
36 *((Colour *)video + x + y * _screen.pitch) = _black_colour;
37
38 VideoDriver::GetInstance()->GetAnimBuffer()[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * _screen.pitch] = colour;
39 }
40 }
41
42 void Blitter_40bppAnim::DrawRect(void *video, int width, int height, uint8 colour)
43 {
44 if (_screen_disable_anim) {
45 /* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawRect() */
46 Blitter_32bppOptimized::DrawRect(video, width, height, colour);
47 return;
48 }
49
50 assert(VideoDriver::GetInstance()->GetAnimBuffer() != nullptr);
51 uint8 *anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + VideoDriver::GetInstance()->GetAnimBuffer();
52
53 do {
54 Colour *dst = (Colour *)video;
55 uint8 *anim = anim_line;
56
57 for (int i = width; i > 0; i--) {
58 *dst = _black_colour;
59 *anim = colour;
60 dst++;
61 anim++;
62 }
63 video = (uint32 *)video + _screen.pitch;
64 anim_line += _screen.pitch;
65 } while (--height);
66 }
67
68 void Blitter_40bppAnim::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash)
69 {
70 if (_screen_disable_anim) {
71 /* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawRect() */
72 Blitter_32bppOptimized::DrawLine(video, x, y, x2, y2, screen_width, screen_height, colour, width, dash);
73 return;
74 }
75
76 assert(VideoDriver::GetInstance()->GetAnimBuffer() != nullptr);
77 uint8 *anim = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + VideoDriver::GetInstance()->GetAnimBuffer();
78
79 this->DrawLineGeneric(x, y, x2, y2, screen_width, screen_height, width, dash, [=](int x, int y) {
80 *((Colour *)video + x + y * _screen.pitch) = _black_colour;
81 *(anim + x + y * _screen.pitch) = colour;
82 });
83 }
84
92 template <BlitterMode mode>
93 inline void Blitter_40bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
94 {
95 const SpriteData *src = (const SpriteData *)bp->sprite;
96
97 /* src_px : each line begins with uint32 n = 'number of bytes in this line',
98 * then n times is the Colour struct for this line */
99 const Colour *src_px = (const Colour *)(src->data + src->offset[zoom][0]);
100 /* src_n : each line begins with uint32 n = 'number of bytes in this line',
101 * then interleaved stream of 'm' and 'n' channels. 'm' is remap,
102 * 'n' is number of bytes with the same alpha channel class */
103 const uint16 *src_n = (const uint16 *)(src->data + src->offset[zoom][1]);
104
105 /* skip upper lines in src_px and src_n */
106 for (uint i = bp->skip_top; i != 0; i--) {
107 src_px = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
108 src_n = (const uint16 *)((const byte *)src_n + *(const uint32 *)src_n);
109 }
110
111 /* skip lines in dst */
112 Colour *dst = (Colour *)bp->dst + bp->top * bp->pitch + bp->left;
113 assert(VideoDriver::GetInstance()->GetAnimBuffer() != nullptr);
114 uint8 *anim = VideoDriver::GetInstance()->GetAnimBuffer() + ((uint32 *)bp->dst - (uint32 *)_screen.dst_ptr) + bp->top * bp->pitch + bp->left;
115
116 /* store so we don't have to access it via bp everytime (compiler assumes pointer aliasing) */
117 const byte *remap = bp->remap;
118
119 for (int y = 0; y < bp->height; y++) {
120 /* next dst line begins here */
121 Colour *dst_ln = dst + bp->pitch;
122 uint8 *anim_ln = anim + bp->pitch;
123
124 /* next src line begins here */
125 const Colour *src_px_ln = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
126 src_px++;
127
128 /* next src_n line begins here */
129 const uint16 *src_n_ln = (const uint16 *)((const byte *)src_n + *(const uint32 *)src_n);
130 src_n += 2;
131
132 /* we will end this line when we reach this point */
133 Colour *dst_end = dst + bp->skip_left;
134
135 /* number of pixels with the same alpha channel class */
136 uint n;
137
138 while (dst < dst_end) {
139 n = *src_n++;
140
141 if (src_px->a == 0) {
142 dst += n;
143 src_px++;
144 src_n++;
145
146 if (dst > dst_end) anim += dst - dst_end;
147 } else {
148 if (dst + n > dst_end) {
149 uint d = dst_end - dst;
150 src_px += d;
151 src_n += d;
152
153 dst = dst_end - bp->skip_left;
154 dst_end = dst + bp->width;
155
156 n = std::min<uint>(n - d, (uint)bp->width);
157 goto draw;
158 }
159 dst += n;
160 src_px += n;
161 src_n += n;
162 }
163 }
164
165 dst -= bp->skip_left;
166 dst_end -= bp->skip_left;
167
168 dst_end += bp->width;
169
170 while (dst < dst_end) {
171 n = std::min<uint>(*src_n++, (uint)(dst_end - dst));
172
173 if (src_px->a == 0) {
174 anim += n;
175 dst += n;
176 src_px++;
177 src_n++;
178 continue;
179 }
180
181 draw:;
182
183 switch (mode) {
184 case BM_COLOUR_REMAP:
185 case BM_CRASH_REMAP:
186 if (src_px->a == 255) {
187 do {
188 uint8 m = GB(*src_n, 0, 8);
189 /* In case the m-channel is zero, only apply the crash remap by darkening the RGB colour. */
190 if (m == 0) {
191 *dst = mode == BM_CRASH_REMAP ? this->MakeDark(*src_px) : *src_px;
192 *anim = 0;
193 } else {
194 uint r = remap[m];
195 if (r != 0) {
196 *dst = src_px->data;
197 *anim = r;
198 }
199 }
200 anim++;
201 dst++;
202 src_px++;
203 src_n++;
204 } while (--n != 0);
205 } else {
206 do {
207 uint8 m = GB(*src_n, 0, 8);
208 Colour b = this->RealizeBlendedColour(*anim, *dst);
209 if (m == 0) {
210 Colour c = mode == BM_CRASH_REMAP ? this->MakeDark(*src_px) : *src_px;
211 *dst = this->ComposeColourRGBANoCheck(c.r, c.g, c.b, src_px->a, b);
212 *anim = 0;
213 } else {
214 uint r = remap[m];
215 if (r != 0) {
216 *dst = this->ComposeColourPANoCheck(this->LookupColourInPalette(r), src_px->a, b);
217 *anim = 0; // Animation colours don't work with alpha-blending.
218 }
219 }
220 anim++;
221 dst++;
222 src_px++;
223 src_n++;
224 } while (--n != 0);
225 }
226 break;
227
228 case BM_BLACK_REMAP:
229 do {
230 *anim++ = 0;
231 *dst++ = _black_colour;
232 src_px++;
233 src_n++;
234 } while (--n != 0);
235 break;
236
237 case BM_TRANSPARENT:
238 /* TODO -- We make an assumption here that the remap in fact is transparency, not some colour.
239 * This is never a problem with the code we produce, but newgrfs can make it fail... or at least:
240 * we produce a result the newgrf maker didn't expect ;) */
241
242 /* Make the current colour a bit more black, so it looks like this image is transparent */
243 src_n += n;
244 if (src_px->a == 255) {
245 src_px += n;
246 do {
247 /* If the anim buffer contains a color value, the image composition will
248 * only look at the RGB brightness value. As such, we can simply darken the
249 * RGB value to darken the anim color. */
250 Colour b = *anim != 0 ? Colour(this->GetColourBrightness(*dst), 0, 0) : *dst;
251 *dst = this->MakeTransparent(b, 3, 4);
252 anim++;
253 dst++;
254 } while (--n != 0);
255 } else {
256 do {
257 Colour b = this->RealizeBlendedColour(*anim, *dst);
258 *dst = this->MakeTransparent(b, (256 * 4 - src_px->a), 256 * 4);
259 *anim = 0; // Animation colours don't work with alpha-blending.
260 anim++;
261 dst++;
262 src_px++;
263 } while (--n != 0);
264 }
265 break;
266
267 default:
268 if (src_px->a == 255) {
269 do {
270 *anim++ = GB(*src_n, 0, 8);
271 *dst++ = src_px->data;
272 src_px++;
273 src_n++;
274 } while (--n != 0);
275 break;
276 } else {
277 do {
278 uint8 m = GB(*src_n, 0, 8);
279 Colour b = this->RealizeBlendedColour(*anim, *dst);
280
281 if (m == 0) {
282 *dst = this->ComposeColourRGBANoCheck(src_px->r, src_px->g, src_px->b, src_px->a, b);
283 *anim = 0;
284 } else {
285 *dst = this->ComposeColourPANoCheck(this->LookupColourInPalette(m), src_px->a, b);
286 *anim = m;
287 }
288
289 anim++;
290 dst++;
291 src_px++;
292 src_n++;
293 } while (--n != 0);
294 }
295 }
296 }
297
298 dst = dst_ln;
299 anim = anim_ln;
300 src_px = src_px_ln;
301 src_n = src_n_ln;
302 }
303 }
304
312 void Blitter_40bppAnim::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
313 {
314 assert(_screen.dst_ptr != nullptr);
315
316 if (_screen_disable_anim || VideoDriver::GetInstance()->GetAnimBuffer() == nullptr) {
317 /* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent Draw() */
318 Blitter_32bppOptimized::Draw<true>(bp, mode, zoom);
319 return;
320 }
321
322 switch (mode) {
323 default: NOT_REACHED();
324 case BM_NORMAL: Draw<BM_NORMAL> (bp, zoom); return;
325 case BM_COLOUR_REMAP: Draw<BM_COLOUR_REMAP>(bp, zoom); return;
326 case BM_TRANSPARENT: Draw<BM_TRANSPARENT> (bp, zoom); return;
327 case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP> (bp, zoom); return;
328 case BM_BLACK_REMAP: Draw<BM_BLACK_REMAP> (bp, zoom); return;
329 }
330 }
331
332 void Blitter_40bppAnim::DrawColourMappingRect(void *dst, int width, int height, PaletteID pal)
333 {
334 if (_screen_disable_anim) {
335 /* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawColourMappingRect() */
336 Blitter_32bppOptimized::DrawColourMappingRect(dst, width, height, pal);
337 return;
338 }
339
340 Colour *udst = (Colour *)dst;
341 uint8 *anim = VideoDriver::GetInstance()->GetAnimBuffer() + ((uint32 *)dst - (uint32 *)_screen.dst_ptr);
342
343 if (pal == PALETTE_TO_TRANSPARENT) {
344 /* If the anim buffer contains a color value, the image composition will
345 * only look at the RGB brightness value. As such, we can simply darken the
346 * RGB value to darken the anim color. */
347 do {
348 for (int i = 0; i != width; i++) {
349 Colour b = *anim != 0 ? Colour(this->GetColourBrightness(*udst), 0, 0) : *udst;
350 *udst = MakeTransparent(b, 154);
351 udst++;
352 anim++;
353 }
354 udst = udst - width + _screen.pitch;
355 anim = anim - width + _screen.pitch;
356 } while (--height);
357 } else if (pal == PALETTE_NEWSPAPER) {
358 const uint8 *remap = GetNonSprite(pal, ST_RECOLOUR) + 1;
359 do {
360 for (int i = 0; i != width; i++) {
361 if (*anim == 0) *udst = MakeGrey(*udst);
362 *anim = remap[*anim];
363 udst++;
364 anim++;
365 }
366 udst = udst - width + _screen.pitch;
367 anim = anim - width + _screen.pitch;
368 } while (--height);
369 } else {
370 const uint8 *remap = GetNonSprite(pal, ST_RECOLOUR) + 1;
371 do {
372 for (int i = 0; i != width; i++) {
373 *anim = remap[*anim];
374 anim++;
375 }
376 anim = anim - width + _screen.pitch;
377 } while (--height);
378 }
379 }
380
381 Sprite *Blitter_40bppAnim::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
382 {
383 return this->EncodeInternal<false>(sprite, allocator);
384 }
385
386
387 void Blitter_40bppAnim::CopyFromBuffer(void *video, const void *src, int width, int height)
388 {
389 assert(!_screen_disable_anim);
390 assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
391 uint32 *dst = (uint32 *)video;
392 const uint32 *usrc = (const uint32 *)src;
393
394 uint8 *anim_buf = VideoDriver::GetInstance()->GetAnimBuffer();
395 if (anim_buf == nullptr) return;
396 uint8 *anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + anim_buf;
397
398 for (; height > 0; height--) {
399 memcpy(dst, usrc, width * sizeof(uint32));
400 usrc += width;
401 dst += _screen.pitch;
402 /* Copy back the anim-buffer */
403 memcpy(anim_line, usrc, width * sizeof(uint8));
404 usrc = (const uint32 *)((const uint8 *)usrc + width);
405 anim_line += _screen.pitch;
406 }
407 }
408
409 void Blitter_40bppAnim::CopyToBuffer(const void *video, void *dst, int width, int height)
410 {
411 assert(!_screen_disable_anim);
412 assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
413 uint32 *udst = (uint32 *)dst;
414 const uint32 *src = (const uint32 *)video;
415
416 uint8 *anim_buf = VideoDriver::GetInstance()->GetAnimBuffer();
417 if (anim_buf == nullptr) return;
418 const uint8 *anim_line = ((const uint32 *)video - (uint32 *)_screen.dst_ptr) + anim_buf;
419
420 for (; height > 0; height--) {
421 memcpy(udst, src, width * sizeof(uint32));
422 src += _screen.pitch;
423 udst += width;
424 /* Copy the anim-buffer */
425 memcpy(udst, anim_line, width * sizeof(uint8));
426 udst = (uint32 *)((uint8 *)udst + width);
427 anim_line += _screen.pitch;
428 }
429 }
430
431 void Blitter_40bppAnim::CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch)
432 {
433 uint8 *anim_buf = VideoDriver::GetInstance()->GetAnimBuffer();
434 if (anim_buf == nullptr) {
435 Blitter_32bppOptimized::CopyImageToBuffer(video, dst, width, height, dst_pitch);
436 return;
437 }
438
439 uint32 *udst = (uint32 *)dst;
440 const uint32 *src = (const uint32 *)video;
441 const uint8 *anim_line = ((const uint32 *)video - (uint32 *)_screen.dst_ptr) + anim_buf;
442
443 for (; height > 0; height--) {
444 for (int x = 0; x < width; x++) {
445 udst[x] = this->RealizeBlendedColour(anim_line[x], src[x]).data;
446 }
447 src += _screen.pitch;
448 anim_line += _screen.pitch;
449 udst += dst_pitch;
450 }
451 }
452
453 void Blitter_40bppAnim::ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y)
454 {
455 assert(!_screen_disable_anim);
456 assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
457 uint8 *anim_buf = VideoDriver::GetInstance()->GetAnimBuffer();
458 uint8 *dst, *src;
459
460 /* We need to scroll the anim-buffer too */
461 if (scroll_y > 0) {
462 dst = anim_buf + left + (top + height - 1) * _screen.pitch;
463 src = dst - scroll_y * _screen.pitch;
464
465 /* Adjust left & width */
466 if (scroll_x >= 0) {
467 dst += scroll_x;
468 } else {
469 src -= scroll_x;
470 }
471
472 uint tw = width + (scroll_x >= 0 ? -scroll_x : scroll_x);
473 uint th = height - scroll_y;
474 for (; th > 0; th--) {
475 memcpy(dst, src, tw * sizeof(uint8));
476 src -= _screen.pitch;
477 dst -= _screen.pitch;
478 }
479 } else {
480 /* Calculate pointers */
481 dst = anim_buf + left + top * _screen.pitch;
482 src = dst - scroll_y * _screen.pitch;
483
484 /* Adjust left & width */
485 if (scroll_x >= 0) {
486 dst += scroll_x;
487 } else {
488 src -= scroll_x;
489 }
490
491 /* the y-displacement may be 0 therefore we have to use memmove,
492 * because source and destination may overlap */
493 uint tw = width + (scroll_x >= 0 ? -scroll_x : scroll_x);
494 uint th = height + scroll_y;
495 for (; th > 0; th--) {
496 memmove(dst, src, tw * sizeof(uint8));
497 src += _screen.pitch;
498 dst += _screen.pitch;
499 }
500 }
501
502 Blitter_32bppBase::ScrollBuffer(video, left, top, width, height, scroll_x, scroll_y);
503 }
504
505 int Blitter_40bppAnim::BufferSize(int width, int height)
506 {
507 return width * height * (sizeof(uint32) + sizeof(uint8));
508 }
509
510 Blitter::PaletteAnimation Blitter_40bppAnim::UsePaletteAnimation()
511 {
512 return Blitter::PALETTE_ANIMATION_VIDEO_BACKEND;
513 }
514
515 bool Blitter_40bppAnim::NeedsAnimationBuffer()
516 {
517 return true;
518 }
Colour::data
uint32 data
Conversion of the channel information to a 32 bit number.
Definition: gfx_type.h:164
GB
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
Definition: bitmath_func.hpp:32
Blitter::BlitterParams::top
int top
The top offset in the 'dst' in pixels to start drawing.
Definition: base.hpp:42
BM_TRANSPARENT
@ BM_TRANSPARENT
Perform transparency colour remapping.
Definition: base.hpp:20
Blitter::BlitterParams::skip_left
int skip_left
How much pixels of the source to skip on the left (based on zoom of dst)
Definition: base.hpp:35
Blitter_40bppAnim::DrawColourMappingRect
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override
Draw a colourtable to the screen.
Definition: 40bpp_anim.cpp:332
BlitterMode
BlitterMode
The modes of blitting we can do.
Definition: base.hpp:17
Blitter::BlitterParams::width
int width
The width in pixels that needs to be drawn to dst.
Definition: base.hpp:37
common.hpp
Blitter::BlitterParams::dst
void * dst
Destination buffer.
Definition: base.hpp:44
PALETTE_TO_TRANSPARENT
static const PaletteID PALETTE_TO_TRANSPARENT
This sets the sprite to transparent.
Definition: sprites.h:1591
Blitter_32bppBase::ComposeColourPANoCheck
static Colour ComposeColourPANoCheck(Colour colour, uint a, Colour current)
Compose a colour based on Pixel value, alpha value, and the current pixel value.
Definition: 32bpp_base.hpp:74
ZoomLevel
ZoomLevel
All zoom levels we know.
Definition: zoom_type.h:21
Blitter_32bppBase::SetPixel
void SetPixel(void *video, int x, int y, uint8 colour) override
Draw a pixel with a given colour on the video-buffer.
Definition: 32bpp_base.cpp:21
Blitter::BlitterParams::pitch
int pitch
The pitch of the destination buffer.
Definition: base.hpp:45
Blitter_40bppAnim::CopyToBuffer
void CopyToBuffer(const void *video, void *dst, int width, int height) override
Copy from the screen to a buffer.
Definition: 40bpp_anim.cpp:409
Blitter_40bppAnim::CopyFromBuffer
void CopyFromBuffer(void *video, const void *src, int width, int height) override
Copy from a buffer to the screen.
Definition: 40bpp_anim.cpp:387
BM_NORMAL
@ BM_NORMAL
Perform the simple blitting.
Definition: base.hpp:18
Blitter_40bppAnim::BufferSize
int BufferSize(int width, int height) override
Calculate how much memory there is needed for an image of this size in the video-buffer.
Definition: 40bpp_anim.cpp:505
Blitter_40bppAnim::Draw
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override
Draws a sprite to a (screen) buffer.
Definition: 40bpp_anim.cpp:312
Blitter::BlitterParams::sprite
const void * sprite
Pointer to the sprite how ever the encoder stored it.
Definition: base.hpp:32
Blitter_32bppOptimized::SpriteData::data
byte data[]
Data, all zoomlevels.
Definition: 32bpp_optimized.hpp:21
Blitter_40bppAnim::SetPixel
void SetPixel(void *video, int x, int y, uint8 colour) override
Draw a pixel with a given colour on the video-buffer.
Definition: 40bpp_anim.cpp:31
Blitter_32bppBase::MakeGrey
static Colour MakeGrey(Colour colour)
Make a colour grey - based.
Definition: 32bpp_base.hpp:144
Blitter_32bppBase::ScrollBuffer
void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) override
Scroll the videobuffer some 'x' and 'y' value.
Definition: 32bpp_base.cpp:84
_screen_disable_anim
bool _screen_disable_anim
Disable palette animation (important for 32bpp-anim blitter during giant screenshot)
Definition: gfx.cpp:43
BM_COLOUR_REMAP
@ BM_COLOUR_REMAP
Perform a colour remapping.
Definition: base.hpp:19
PALETTE_NEWSPAPER
static const PaletteID PALETTE_NEWSPAPER
Recolour sprite for newspaper-greying.
Definition: sprites.h:1593
BM_CRASH_REMAP
@ BM_CRASH_REMAP
Perform a crash remapping.
Definition: base.hpp:21
Blitter_32bppBase::LookupColourInPalette
static Colour LookupColourInPalette(uint index)
Look up the colour in the current palette.
Definition: 32bpp_base.hpp:38
Blitter_32bppSimple::DrawColourMappingRect
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override
Draw a colourtable to the screen.
Definition: 32bpp_simple.cpp:84
Blitter_40bppAnim::ScrollBuffer
void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) override
Scroll the videobuffer some 'x' and 'y' value.
Definition: 40bpp_anim.cpp:453
BM_BLACK_REMAP
@ BM_BLACK_REMAP
Perform remapping to a completely blackened sprite.
Definition: base.hpp:22
Blitter_40bppAnim::CopyImageToBuffer
void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override
Copy from the screen to a buffer in a palette format for 8bpp and RGBA format for 32bpp.
Definition: 40bpp_anim.cpp:431
FBlitter_40bppAnim
Factory for the 40 bpp animated blitter (for OpenGL).
Definition: 40bpp_anim.hpp:52
VideoDriver::GetInstance
static VideoDriver * GetInstance()
Get the currently active instance of the video driver.
Definition: video_driver.hpp:187
Blitter_32bppBase::MakeDark
static uint8 MakeDark(uint8 r, uint8 g, uint8 b)
Make a colour dark grey, for specialized 32bpp remapping.
Definition: 32bpp_base.hpp:121
Blitter_40bppAnim::DrawLine
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override
Draw a line with a given colour.
Definition: 40bpp_anim.cpp:68
VideoDriver::GetAnimBuffer
virtual uint8 * GetAnimBuffer()
Get a pointer to the animation buffer of the video back-end.
Definition: video_driver.hpp:137
Colour
Structure to access the alpha, red, green, and blue channels from a 32 bit number.
Definition: gfx_type.h:163
Blitter::PaletteAnimation
PaletteAnimation
Types of palette animation.
Definition: base.hpp:49
Colour::a
uint8 a
colour channels in LE order
Definition: gfx_type.h:171
Blitter_40bppAnim::DrawRect
void DrawRect(void *video, int width, int height, uint8 colour) override
Make a single horizontal line in a single colour on the video-buffer.
Definition: 40bpp_anim.cpp:42
PaletteID
uint32 PaletteID
The number of the palette.
Definition: gfx_type.h:18
Blitter::BlitterParams::left
int left
The left offset in the 'dst' in pixels to start drawing.
Definition: base.hpp:41
Blitter::PALETTE_ANIMATION_VIDEO_BACKEND
@ PALETTE_ANIMATION_VIDEO_BACKEND
Palette animation should be done by video backend (8bpp only!)
Definition: base.hpp:51
Blitter_32bppBase::DrawRect
void DrawRect(void *video, int width, int height, uint8 colour) override
Make a single horizontal line in a single colour on the video-buffer.
Definition: 32bpp_base.cpp:34
Blitter_32bppOptimized::SpriteData::offset
uint32 offset[ZOOM_LVL_COUNT][2]
Offsets (from .data) to streams for different zoom levels, and the normal and remap image information...
Definition: 32bpp_optimized.hpp:20
Blitter_32bppBase::ComposeColourRGBANoCheck
static Colour ComposeColourRGBANoCheck(uint r, uint g, uint b, uint a, Colour current)
Compose a colour based on RGBA values and the current pixel value.
Definition: 32bpp_base.hpp:46
SpriteLoader::Sprite
Structure for passing information from the sprite loader to the blitter.
Definition: spriteloader.hpp:47
Blitter_40bppAnim::Encode
Sprite * Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override
Convert a sprite from the loader to our own format.
Definition: 40bpp_anim.cpp:381
Blitter_32bppBase::MakeTransparent
static Colour MakeTransparent(Colour colour, uint nom, uint denom=256)
Make a pixel looks like it is transparent.
Definition: 32bpp_base.hpp:105
Blitter_40bppAnim::NeedsAnimationBuffer
bool NeedsAnimationBuffer() override
Does this blitter require a separate animation buffer from the video backend?
Definition: 40bpp_anim.cpp:515
Blitter_32bppBase::DrawLine
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override
Draw a line with a given colour.
Definition: 32bpp_base.cpp:26
Blitter::BlitterParams
Parameters related to blitting.
Definition: base.hpp:31
Blitter::BlitterParams::height
int height
The height in pixels that needs to be drawn to dst.
Definition: base.hpp:38
ST_RECOLOUR
@ ST_RECOLOUR
Recolour sprite.
Definition: gfx_type.h:305
Blitter_32bppOptimized::SpriteData
Data stored about a (single) sprite.
Definition: 32bpp_optimized.hpp:19
Blitter_32bppBase::CopyImageToBuffer
void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override
Copy from the screen to a buffer in a palette format for 8bpp and RGBA format for 32bpp.
Definition: 32bpp_base.cpp:72
Blitter::BlitterParams::skip_top
int skip_top
How much pixels of the source to skip on the top (based on zoom of dst)
Definition: base.hpp:36
Sprite
Data structure describing a sprite.
Definition: spritecache.h:17
Blitter::BlitterParams::remap
const byte * remap
XXX – Temporary storage for remap array.
Definition: base.hpp:33
Blitter_40bppAnim::UsePaletteAnimation
Blitter::PaletteAnimation UsePaletteAnimation() override
Check if the blitter uses palette animation at all.
Definition: 40bpp_anim.cpp:510