author | Tero Marttila <terom@fixme.fi> |
Fri, 19 Dec 2008 02:25:44 +0200 | |
branch | terom-mini |
changeset 10442 | 7089fa402bfd |
parent 9989 | 62e68bd41c90 |
permissions | -rw-r--r-- |
8091
674be8638d74
(svn r11652) -Codechange: add the svn $ header for several files
smatz
parents:
7558
diff
changeset
|
1 |
/* $Id$ */ |
674be8638d74
(svn r11652) -Codechange: add the svn $ header for several files
smatz
parents:
7558
diff
changeset
|
2 |
|
9111
48ce04029fe4
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
8264
diff
changeset
|
3 |
/** @file 32bpp_anim.cpp Implementation of the optimized 32 bpp blitter with animation support. */ |
48ce04029fe4
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
8264
diff
changeset
|
4 |
|
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
5 |
#include "../stdafx.h" |
8130
d2eb7d04f6e1
(svn r11691) -Codechange: move+rename helpers.hpp and only include it when it is really needed.
rubidium
parents:
8123
diff
changeset
|
6 |
#include "../core/alloc_func.hpp" |
9548
eae9545bf02c
(svn r13564) -Codechange: do not use SetPixel in PaletteAnimate, access destination directly instead. Makes palette animation ~40% faster.
smatz
parents:
9111
diff
changeset
|
7 |
#include "../core/math_func.hpp" |
8123
ce31d2843a95
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
8091
diff
changeset
|
8 |
#include "../gfx_func.h" |
ce31d2843a95
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
8091
diff
changeset
|
9 |
#include "../zoom_func.h" |
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
10 |
#include "../debug.h" |
7170
923946ec324f
(svn r10444) -Codechange: switch to c++ classes and inheritance for sound/music/video drivers, using self-registration based on the blitter-model.
peter1138
parents:
7138
diff
changeset
|
11 |
#include "../video/video_driver.hpp" |
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
12 |
#include "32bpp_anim.hpp" |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
13 |
|
8264
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8249
diff
changeset
|
14 |
#include "../table/sprites.h" |
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8249
diff
changeset
|
15 |
|
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
16 |
static FBlitter_32bppAnim iFBlitter_32bppAnim; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
17 |
|
9597
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
18 |
template <BlitterMode mode> |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
19 |
inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom) |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
20 |
{ |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
21 |
const SpriteData *src = (const SpriteData *)bp->sprite; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
22 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
23 |
const Colour *src_px = (const Colour *)(src->data + src->offset[zoom][0]); |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
24 |
const uint8 *src_n = (const uint8 *)(src->data + src->offset[zoom][1]); |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
25 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
26 |
for (uint i = bp->skip_top; i != 0; i--) { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
27 |
src_px = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px); |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
28 |
src_n += *(const uint32 *)src_n; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
29 |
} |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
30 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
31 |
uint32 *dst = (uint32 *)bp->dst + bp->top * bp->pitch + bp->left; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
32 |
uint8 *anim = this->anim_buf + ((uint32 *)bp->dst - (uint32 *)_screen.dst_ptr) + bp->top * this->anim_buf_width + bp->left; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
33 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
34 |
const byte *remap = bp->remap; // store so we don't have to access it via bp everytime |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
35 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
36 |
for (int y = 0; y < bp->height; y++) { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
37 |
uint32 *dst_ln = dst + bp->pitch; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
38 |
uint8 *anim_ln = anim + this->anim_buf_width; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
39 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
40 |
const Colour *src_px_ln = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px); |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
41 |
src_px++; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
42 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
43 |
const uint8 *src_n_ln = src_n + *(uint32 *)src_n; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
44 |
src_n += 4; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
45 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
46 |
uint32 *dst_end = dst + bp->skip_left; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
47 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
48 |
uint n; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
49 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
50 |
while (dst < dst_end) { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
51 |
n = *src_n++; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
52 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
53 |
if (src_px->a == 0) { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
54 |
dst += n; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
55 |
src_px ++; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
56 |
src_n++; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
57 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
58 |
if (dst > dst_end) anim += dst - dst_end; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
59 |
} else { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
60 |
if (dst + n > dst_end) { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
61 |
uint d = dst_end - dst; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
62 |
src_px += d; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
63 |
src_n += d; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
64 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
65 |
dst = dst_end - bp->skip_left; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
66 |
dst_end = dst + bp->width; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
67 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
68 |
n = min<uint>(n - d, (uint)bp->width); |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
69 |
goto draw; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
70 |
} |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
71 |
dst += n; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
72 |
src_px += n; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
73 |
src_n += n; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
74 |
} |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
75 |
} |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
76 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
77 |
dst -= bp->skip_left; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
78 |
dst_end -= bp->skip_left; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
79 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
80 |
dst_end += bp->width; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
81 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
82 |
while (dst < dst_end) { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
83 |
n = min<uint>(*src_n++, (uint)(dst_end - dst)); |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
84 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
85 |
if (src_px->a == 0) { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
86 |
anim += n; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
87 |
dst += n; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
88 |
src_px++; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
89 |
src_n++; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
90 |
continue; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
91 |
} |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
92 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
93 |
draw:; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
94 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
95 |
switch (mode) { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
96 |
case BM_COLOUR_REMAP: |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
97 |
if (src_px->a == 255) { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
98 |
do { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
99 |
uint m = *src_n; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
100 |
/* In case the m-channel is zero, do not remap this pixel in any way */ |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
101 |
if (m == 0) { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
102 |
*dst = *src_px; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
103 |
*anim = 0; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
104 |
} else { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
105 |
uint r = remap[m]; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
106 |
*anim = r; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
107 |
if (r != 0) *dst = this->LookupColourInPalette(r); |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
108 |
} |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
109 |
anim++; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
110 |
dst++; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
111 |
src_px++; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
112 |
src_n++; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
113 |
} while (--n != 0); |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
114 |
} else { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
115 |
do { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
116 |
uint m = *src_n; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
117 |
if (m == 0) { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
118 |
*dst = ComposeColourRGBANoCheck(src_px->r, src_px->g, src_px->b, src_px->a, *dst); |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
119 |
*anim = 0; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
120 |
} else { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
121 |
uint r = remap[m]; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
122 |
*anim = r; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
123 |
if (r != 0) *dst = ComposeColourPANoCheck(this->LookupColourInPalette(r), src_px->a, *dst); |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
124 |
} |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
125 |
anim++; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
126 |
dst++; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
127 |
src_px++; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
128 |
src_n++; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
129 |
} while (--n != 0); |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
130 |
} |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
131 |
break; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
132 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
133 |
case BM_TRANSPARENT: |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
134 |
/* TODO -- We make an assumption here that the remap in fact is transparency, not some color. |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
135 |
* This is never a problem with the code we produce, but newgrfs can make it fail... or at least: |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
136 |
* we produce a result the newgrf maker didn't expect ;) */ |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
137 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
138 |
/* Make the current color a bit more black, so it looks like this image is transparent */ |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
139 |
src_n += n; |
9598
101174f1c2b8
(svn r13640) -Codechange: make colours behind not fully solid objects less darker for BM_TRANSPARENT (for 32bpp blitters)
smatz
parents:
9597
diff
changeset
|
140 |
if (src_px->a == 255) { |
101174f1c2b8
(svn r13640) -Codechange: make colours behind not fully solid objects less darker for BM_TRANSPARENT (for 32bpp blitters)
smatz
parents:
9597
diff
changeset
|
141 |
src_px += n; |
101174f1c2b8
(svn r13640) -Codechange: make colours behind not fully solid objects less darker for BM_TRANSPARENT (for 32bpp blitters)
smatz
parents:
9597
diff
changeset
|
142 |
do { |
101174f1c2b8
(svn r13640) -Codechange: make colours behind not fully solid objects less darker for BM_TRANSPARENT (for 32bpp blitters)
smatz
parents:
9597
diff
changeset
|
143 |
*dst = MakeTransparent(*dst, 3, 4); |
101174f1c2b8
(svn r13640) -Codechange: make colours behind not fully solid objects less darker for BM_TRANSPARENT (for 32bpp blitters)
smatz
parents:
9597
diff
changeset
|
144 |
*anim = remap[*anim]; |
101174f1c2b8
(svn r13640) -Codechange: make colours behind not fully solid objects less darker for BM_TRANSPARENT (for 32bpp blitters)
smatz
parents:
9597
diff
changeset
|
145 |
anim++; |
101174f1c2b8
(svn r13640) -Codechange: make colours behind not fully solid objects less darker for BM_TRANSPARENT (for 32bpp blitters)
smatz
parents:
9597
diff
changeset
|
146 |
dst++; |
101174f1c2b8
(svn r13640) -Codechange: make colours behind not fully solid objects less darker for BM_TRANSPARENT (for 32bpp blitters)
smatz
parents:
9597
diff
changeset
|
147 |
} while (--n != 0); |
101174f1c2b8
(svn r13640) -Codechange: make colours behind not fully solid objects less darker for BM_TRANSPARENT (for 32bpp blitters)
smatz
parents:
9597
diff
changeset
|
148 |
} else { |
101174f1c2b8
(svn r13640) -Codechange: make colours behind not fully solid objects less darker for BM_TRANSPARENT (for 32bpp blitters)
smatz
parents:
9597
diff
changeset
|
149 |
do { |
101174f1c2b8
(svn r13640) -Codechange: make colours behind not fully solid objects less darker for BM_TRANSPARENT (for 32bpp blitters)
smatz
parents:
9597
diff
changeset
|
150 |
*dst = MakeTransparent(*dst, (256 * 4 - src_px->a), 256 * 4); |
101174f1c2b8
(svn r13640) -Codechange: make colours behind not fully solid objects less darker for BM_TRANSPARENT (for 32bpp blitters)
smatz
parents:
9597
diff
changeset
|
151 |
*anim = remap[*anim]; |
101174f1c2b8
(svn r13640) -Codechange: make colours behind not fully solid objects less darker for BM_TRANSPARENT (for 32bpp blitters)
smatz
parents:
9597
diff
changeset
|
152 |
anim++; |
101174f1c2b8
(svn r13640) -Codechange: make colours behind not fully solid objects less darker for BM_TRANSPARENT (for 32bpp blitters)
smatz
parents:
9597
diff
changeset
|
153 |
dst++; |
101174f1c2b8
(svn r13640) -Codechange: make colours behind not fully solid objects less darker for BM_TRANSPARENT (for 32bpp blitters)
smatz
parents:
9597
diff
changeset
|
154 |
src_px++; |
101174f1c2b8
(svn r13640) -Codechange: make colours behind not fully solid objects less darker for BM_TRANSPARENT (for 32bpp blitters)
smatz
parents:
9597
diff
changeset
|
155 |
} while (--n != 0); |
101174f1c2b8
(svn r13640) -Codechange: make colours behind not fully solid objects less darker for BM_TRANSPARENT (for 32bpp blitters)
smatz
parents:
9597
diff
changeset
|
156 |
} |
9597
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
157 |
break; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
158 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
159 |
default: |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
160 |
if (src_px->a == 255) { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
161 |
do { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
162 |
/* Compiler assumes pointer aliasing, can't optimise this on its own */ |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
163 |
uint m = *src_n++; |
9870
0aade3ddf995
(svn r14016) -Codechange: Remove some magical numbers
belugas
parents:
9598
diff
changeset
|
164 |
/* Above 217 (PALETTE_ANIM_SIZE_START) is palette animation */ |
9597
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
165 |
*anim++ = m; |
9870
0aade3ddf995
(svn r14016) -Codechange: Remove some magical numbers
belugas
parents:
9598
diff
changeset
|
166 |
*dst++ = (m >= PALETTE_ANIM_SIZE_START) ? this->LookupColourInPalette(m) : *src_px; |
9597
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
167 |
src_px++; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
168 |
} while (--n != 0); |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
169 |
} else { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
170 |
do { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
171 |
uint m = *src_n++; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
172 |
*anim++ = m; |
9870
0aade3ddf995
(svn r14016) -Codechange: Remove some magical numbers
belugas
parents:
9598
diff
changeset
|
173 |
if (m >= PALETTE_ANIM_SIZE_START) { |
9597
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
174 |
*dst = ComposeColourPANoCheck(this->LookupColourInPalette(m), src_px->a, *dst); |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
175 |
} else { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
176 |
*dst = ComposeColourRGBANoCheck(src_px->r, src_px->g, src_px->b, src_px->a, *dst); |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
177 |
} |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
178 |
dst++; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
179 |
src_px++; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
180 |
} while (--n != 0); |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
181 |
} |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
182 |
break; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
183 |
} |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
184 |
} |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
185 |
|
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
186 |
anim = anim_ln; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
187 |
dst = dst_ln; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
188 |
src_px = src_px_ln; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
189 |
src_n = src_n_ln; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
190 |
} |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
191 |
} |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
192 |
|
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
193 |
void Blitter_32bppAnim::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
194 |
{ |
8249
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
195 |
if (_screen_disable_anim) { |
7556
7224575e68fb
(svn r11081) -Fix r11080: now solved the problem in a pretty way: don't do animation if we are not drawing to the screen-pointer
truelight
parents:
7555
diff
changeset
|
196 |
/* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent Draw() */ |
7224575e68fb
(svn r11081) -Fix r11080: now solved the problem in a pretty way: don't do animation if we are not drawing to the screen-pointer
truelight
parents:
7555
diff
changeset
|
197 |
Blitter_32bppOptimized::Draw(bp, mode, zoom); |
7224575e68fb
(svn r11081) -Fix r11080: now solved the problem in a pretty way: don't do animation if we are not drawing to the screen-pointer
truelight
parents:
7555
diff
changeset
|
198 |
return; |
7224575e68fb
(svn r11081) -Fix r11080: now solved the problem in a pretty way: don't do animation if we are not drawing to the screen-pointer
truelight
parents:
7555
diff
changeset
|
199 |
} |
7557
4b3f3b4c613e
(svn r11082) -Fix r11081: save before commit (yeah, whitelines are important too!)
truelight
parents:
7556
diff
changeset
|
200 |
|
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
201 |
if (_screen.width != this->anim_buf_width || _screen.height != this->anim_buf_height) { |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
202 |
/* The size of the screen changed; we can assume we can wipe all data from our buffer */ |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
203 |
free(this->anim_buf); |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
204 |
this->anim_buf = CallocT<uint8>(_screen.width * _screen.height); |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
205 |
this->anim_buf_width = _screen.width; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
206 |
this->anim_buf_height = _screen.height; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
207 |
} |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
208 |
|
9597
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
209 |
switch (mode) { |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
210 |
default: NOT_REACHED(); |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
211 |
case BM_NORMAL: Draw<BM_NORMAL> (bp, zoom); return; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
212 |
case BM_COLOUR_REMAP: Draw<BM_COLOUR_REMAP>(bp, zoom); return; |
825e5483799b
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
smatz
parents:
9550
diff
changeset
|
213 |
case BM_TRANSPARENT: Draw<BM_TRANSPARENT> (bp, zoom); return; |
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
214 |
} |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
215 |
} |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
216 |
|
6985
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
217 |
void Blitter_32bppAnim::DrawColorMappingRect(void *dst, int width, int height, int pal) |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
218 |
{ |
8249
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
219 |
if (_screen_disable_anim) { |
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
220 |
/* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawColorMappingRect() */ |
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
221 |
Blitter_32bppOptimized::DrawColorMappingRect(dst, width, height, pal); |
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
222 |
return; |
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
223 |
} |
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
224 |
|
6985
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
225 |
uint32 *udst = (uint32 *)dst; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
226 |
uint8 *anim; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
227 |
|
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
228 |
anim = this->anim_buf + ((uint32 *)dst - (uint32 *)_screen.dst_ptr); |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
229 |
|
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
230 |
if (pal == PALETTE_TO_TRANSPARENT) { |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
231 |
do { |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
232 |
for (int i = 0; i != width; i++) { |
7552
56aa62dba204
(svn r11076) -Fix: MakeTransparent of 32bpp blitter used 0..100; using 0..255 makes it much faster (frosch)
truelight
parents:
7170
diff
changeset
|
233 |
*udst = MakeTransparent(*udst, 154); |
6985
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
234 |
*anim = 0; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
235 |
udst++; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
236 |
anim++; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
237 |
} |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
238 |
udst = udst - width + _screen.pitch; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
239 |
anim = anim - width + this->anim_buf_width; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
240 |
} while (--height); |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
241 |
return; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
242 |
} |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
243 |
if (pal == PALETTE_TO_STRUCT_GREY) { |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
244 |
do { |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
245 |
for (int i = 0; i != width; i++) { |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
246 |
*udst = MakeGrey(*udst); |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
247 |
*anim = 0; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
248 |
udst++; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
249 |
anim++; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
250 |
} |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
251 |
udst = udst - width + _screen.pitch; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
252 |
anim = anim - width + this->anim_buf_width; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
253 |
} while (--height); |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
254 |
return; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
255 |
} |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
256 |
|
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
257 |
DEBUG(misc, 0, "32bpp blitter doesn't know how to draw this color table ('%d')", pal); |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
258 |
} |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
259 |
|
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
260 |
void Blitter_32bppAnim::SetPixel(void *video, int x, int y, uint8 color) |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
261 |
{ |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
262 |
*((uint32 *)video + x + y * _screen.pitch) = LookupColourInPalette(color); |
8249
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
263 |
|
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
264 |
/* Set the color in the anim-buffer too, if we are rendering to the screen */ |
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
265 |
if (_screen_disable_anim) return; |
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
266 |
this->anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->anim_buf_width] = color; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
267 |
} |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
268 |
|
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
269 |
void Blitter_32bppAnim::SetPixelIfEmpty(void *video, int x, int y, uint8 color) |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
270 |
{ |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
271 |
uint32 *dst = (uint32 *)video + x + y * _screen.pitch; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
272 |
if (*dst == 0) { |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
273 |
*dst = LookupColourInPalette(color); |
8249
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
274 |
/* Set the color in the anim-buffer too, if we are rendering to the screen */ |
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
275 |
if (_screen_disable_anim) return; |
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
276 |
this->anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->anim_buf_width] = color; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
277 |
} |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
278 |
} |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
279 |
|
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
280 |
void Blitter_32bppAnim::DrawRect(void *video, int width, int height, uint8 color) |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
281 |
{ |
8249
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
282 |
if (_screen_disable_anim) { |
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
283 |
/* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawRect() */ |
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
284 |
Blitter_32bppOptimized::DrawRect(video, width, height, color); |
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
285 |
return; |
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
286 |
} |
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
287 |
|
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
288 |
uint32 color32 = LookupColourInPalette(color); |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
289 |
uint8 *anim_line; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
290 |
|
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
291 |
anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
292 |
|
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
293 |
do { |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
294 |
uint32 *dst = (uint32 *)video; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
295 |
uint8 *anim = anim_line; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
296 |
|
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
297 |
for (int i = width; i > 0; i--) { |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
298 |
*dst = color32; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
299 |
/* Set the color in the anim-buffer too */ |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
300 |
*anim = color; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
301 |
dst++; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
302 |
anim++; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
303 |
} |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
304 |
video = (uint32 *)video + _screen.pitch; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
305 |
anim_line += this->anim_buf_width; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
306 |
} while (--height); |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
307 |
} |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
308 |
|
6985
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
309 |
void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width, int height) |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
310 |
{ |
8249
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
311 |
assert(!_screen_disable_anim); |
6985
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
312 |
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch); |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
313 |
uint32 *dst = (uint32 *)video; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
314 |
uint32 *usrc = (uint32 *)src; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
315 |
uint8 *anim_line; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
316 |
|
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
317 |
anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
318 |
|
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
319 |
for (; height > 0; height--) { |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
320 |
memcpy(dst, usrc, width * sizeof(uint32)); |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
321 |
usrc += width; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
322 |
dst += _screen.pitch; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
323 |
/* Copy back the anim-buffer */ |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
324 |
memcpy(anim_line, usrc, width * sizeof(uint8)); |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
325 |
usrc = (uint32 *)((uint8 *)usrc + width); |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
326 |
anim_line += this->anim_buf_width; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
327 |
} |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
328 |
|
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
329 |
/* We update the palette (or the pixels that do animation) immediatly, to avoid graphical glitches */ |
9989
62e68bd41c90
(svn r14146) -Codechange: allow palette override in both ways and remove some unneeded '(x == 0) ? 0 : 1' constructs.
rubidium
parents:
9870
diff
changeset
|
330 |
this->PaletteAnimate(PALETTE_ANIM_SIZE_START, (_use_palette == PAL_DOS) ? PALETTE_ANIM_SIZE_DOS : PALETTE_ANIM_SIZE_WIN); |
6985
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
331 |
} |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
332 |
|
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
333 |
void Blitter_32bppAnim::CopyToBuffer(const void *video, void *dst, int width, int height) |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
334 |
{ |
8249
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
335 |
assert(!_screen_disable_anim); |
6985
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
336 |
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch); |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
337 |
uint32 *udst = (uint32 *)dst; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
338 |
uint32 *src = (uint32 *)video; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
339 |
uint8 *anim_line; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
340 |
|
6986
56897f817855
(svn r10242) -Fix: avoid a segfault if you move your mouse at startup with 32bpp-anim
truelight
parents:
6985
diff
changeset
|
341 |
if (this->anim_buf == NULL) return; |
56897f817855
(svn r10242) -Fix: avoid a segfault if you move your mouse at startup with 32bpp-anim
truelight
parents:
6985
diff
changeset
|
342 |
|
6985
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
343 |
anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
344 |
|
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
345 |
for (; height > 0; height--) { |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
346 |
memcpy(udst, src, width * sizeof(uint32)); |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
347 |
src += _screen.pitch; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
348 |
udst += width; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
349 |
/* Copy the anim-buffer */ |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
350 |
memcpy(udst, anim_line, width * sizeof(uint8)); |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
351 |
udst = (uint32 *)((uint8 *)udst + width); |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
352 |
anim_line += this->anim_buf_width; |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
353 |
} |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
354 |
} |
d50d59dca7c1
(svn r10241) -Codechange: CopyToBuffer now produces a buffer that is unreadable from outside the blitter, so the blitter can store anything he likes
truelight
parents:
6979
diff
changeset
|
355 |
|
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
356 |
void Blitter_32bppAnim::ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
357 |
{ |
8249
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
358 |
assert(!_screen_disable_anim); |
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
359 |
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch); |
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
360 |
uint8 *dst, *src; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
361 |
|
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
362 |
/* We need to scroll the anim-buffer too */ |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
363 |
if (scroll_y > 0) { |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
364 |
dst = this->anim_buf + left + (top + height - 1) * this->anim_buf_width; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
365 |
src = dst - scroll_y * this->anim_buf_width; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
366 |
|
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
367 |
/* Adjust left & width */ |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
368 |
if (scroll_x >= 0) dst += scroll_x; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
369 |
else src -= scroll_x; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
370 |
|
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
371 |
uint tw = width + (scroll_x >= 0 ? -scroll_x : scroll_x); |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
372 |
uint th = height - scroll_y; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
373 |
for (; th > 0; th--) { |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
374 |
memcpy(dst, src, tw * sizeof(uint8)); |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
375 |
src -= this->anim_buf_width; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
376 |
dst -= this->anim_buf_width; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
377 |
} |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
378 |
} else { |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
379 |
/* Calculate pointers */ |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
380 |
dst = this->anim_buf + left + top * this->anim_buf_width; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
381 |
src = dst - scroll_y * this->anim_buf_width; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
382 |
|
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
383 |
/* Adjust left & width */ |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
384 |
if (scroll_x >= 0) dst += scroll_x; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
385 |
else src -= scroll_x; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
386 |
|
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
387 |
/* the y-displacement may be 0 therefore we have to use memmove, |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
388 |
* because source and destination may overlap */ |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
389 |
uint tw = width + (scroll_x >= 0 ? -scroll_x : scroll_x); |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
390 |
uint th = height + scroll_y; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
391 |
for (; th > 0; th--) { |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
392 |
memmove(dst, src, tw * sizeof(uint8)); |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
393 |
src += this->anim_buf_width; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
394 |
dst += this->anim_buf_width; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
395 |
} |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
396 |
} |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
397 |
|
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
398 |
Blitter_32bppBase::ScrollBuffer(video, left, top, width, height, scroll_x, scroll_y); |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
399 |
} |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
400 |
|
6988
980738eadcc2
(svn r10244) -Fix: make sure to let 32bpp-anim report the increased buffer-size it needs
truelight
parents:
6986
diff
changeset
|
401 |
int Blitter_32bppAnim::BufferSize(int width, int height) |
980738eadcc2
(svn r10244) -Fix: make sure to let 32bpp-anim report the increased buffer-size it needs
truelight
parents:
6986
diff
changeset
|
402 |
{ |
980738eadcc2
(svn r10244) -Fix: make sure to let 32bpp-anim report the increased buffer-size it needs
truelight
parents:
6986
diff
changeset
|
403 |
return width * height * (sizeof(uint32) + sizeof(uint8)); |
980738eadcc2
(svn r10244) -Fix: make sure to let 32bpp-anim report the increased buffer-size it needs
truelight
parents:
6986
diff
changeset
|
404 |
} |
980738eadcc2
(svn r10244) -Fix: make sure to let 32bpp-anim report the increased buffer-size it needs
truelight
parents:
6986
diff
changeset
|
405 |
|
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
406 |
void Blitter_32bppAnim::PaletteAnimate(uint start, uint count) |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
407 |
{ |
8249
90bd3316062f
(svn r11813) -Fix [FS#1602]: Switch _screen to the output buffer and disable usage of 32bpp-anim animation buffer during giant screenshots.
frosch
parents:
8130
diff
changeset
|
408 |
assert(!_screen_disable_anim); |
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
409 |
|
6979
c4abd9b85a7a
(svn r10235) -Fix: the 32bpp-anim blitter repainted pixel color 0, which is transparency and therefor should never be repainted (spotted by Rubidium)
truelight
parents:
6971
diff
changeset
|
410 |
/* Never repaint the transparency pixel */ |
9548
eae9545bf02c
(svn r13564) -Codechange: do not use SetPixel in PaletteAnimate, access destination directly instead. Makes palette animation ~40% faster.
smatz
parents:
9111
diff
changeset
|
411 |
if (start == 0) { |
eae9545bf02c
(svn r13564) -Codechange: do not use SetPixel in PaletteAnimate, access destination directly instead. Makes palette animation ~40% faster.
smatz
parents:
9111
diff
changeset
|
412 |
start++; |
eae9545bf02c
(svn r13564) -Codechange: do not use SetPixel in PaletteAnimate, access destination directly instead. Makes palette animation ~40% faster.
smatz
parents:
9111
diff
changeset
|
413 |
count--; |
eae9545bf02c
(svn r13564) -Codechange: do not use SetPixel in PaletteAnimate, access destination directly instead. Makes palette animation ~40% faster.
smatz
parents:
9111
diff
changeset
|
414 |
} |
eae9545bf02c
(svn r13564) -Codechange: do not use SetPixel in PaletteAnimate, access destination directly instead. Makes palette animation ~40% faster.
smatz
parents:
9111
diff
changeset
|
415 |
|
eae9545bf02c
(svn r13564) -Codechange: do not use SetPixel in PaletteAnimate, access destination directly instead. Makes palette animation ~40% faster.
smatz
parents:
9111
diff
changeset
|
416 |
const uint8 *anim = this->anim_buf; |
eae9545bf02c
(svn r13564) -Codechange: do not use SetPixel in PaletteAnimate, access destination directly instead. Makes palette animation ~40% faster.
smatz
parents:
9111
diff
changeset
|
417 |
uint32 *dst = (uint32 *)_screen.dst_ptr; |
6979
c4abd9b85a7a
(svn r10235) -Fix: the 32bpp-anim blitter repainted pixel color 0, which is transparency and therefor should never be repainted (spotted by Rubidium)
truelight
parents:
6971
diff
changeset
|
418 |
|
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
419 |
/* Let's walk the anim buffer and try to find the pixels */ |
9548
eae9545bf02c
(svn r13564) -Codechange: do not use SetPixel in PaletteAnimate, access destination directly instead. Makes palette animation ~40% faster.
smatz
parents:
9111
diff
changeset
|
420 |
for (int y = this->anim_buf_height; y != 0 ; y--) { |
eae9545bf02c
(svn r13564) -Codechange: do not use SetPixel in PaletteAnimate, access destination directly instead. Makes palette animation ~40% faster.
smatz
parents:
9111
diff
changeset
|
421 |
for (int x = this->anim_buf_width; x != 0 ; x--) { |
eae9545bf02c
(svn r13564) -Codechange: do not use SetPixel in PaletteAnimate, access destination directly instead. Makes palette animation ~40% faster.
smatz
parents:
9111
diff
changeset
|
422 |
uint colour = *anim; |
eae9545bf02c
(svn r13564) -Codechange: do not use SetPixel in PaletteAnimate, access destination directly instead. Makes palette animation ~40% faster.
smatz
parents:
9111
diff
changeset
|
423 |
if (IsInsideBS(colour, start, count)) { |
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
424 |
/* Update this pixel */ |
9548
eae9545bf02c
(svn r13564) -Codechange: do not use SetPixel in PaletteAnimate, access destination directly instead. Makes palette animation ~40% faster.
smatz
parents:
9111
diff
changeset
|
425 |
*dst = LookupColourInPalette(colour); |
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
426 |
} |
9548
eae9545bf02c
(svn r13564) -Codechange: do not use SetPixel in PaletteAnimate, access destination directly instead. Makes palette animation ~40% faster.
smatz
parents:
9111
diff
changeset
|
427 |
dst++; |
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
428 |
anim++; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
429 |
} |
9550
89a9d945b97d
(svn r13568) -Fix (r13564): Windows build asserts where I wouldn't expect it to
smatz
parents:
9548
diff
changeset
|
430 |
dst += _screen.pitch - this->anim_buf_width; |
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
431 |
} |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
432 |
|
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
433 |
/* Make sure the backend redraws the whole screen */ |
7170
923946ec324f
(svn r10444) -Codechange: switch to c++ classes and inheritance for sound/music/video drivers, using self-registration based on the blitter-model.
peter1138
parents:
7138
diff
changeset
|
434 |
_video_driver->MakeDirty(0, 0, _screen.width, _screen.height); |
6971
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
435 |
} |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
436 |
|
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
437 |
Blitter::PaletteAnimation Blitter_32bppAnim::UsePaletteAnimation() |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
438 |
{ |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
439 |
return Blitter::PALETTE_ANIMATION_BLITTER; |
6dd4632b7c1d
(svn r10227) -Add: added 32bpp-anim blitter, a 32bpp blitter that does palette animation (at the cost of an animation-buffer to keep track of the 'm'-channel of all sprites)
truelight
parents:
diff
changeset
|
440 |
} |