12 #include "../stdafx.h"
13 #include "../video/video_driver.hpp"
16 #include "../table/sprites.h"
18 #include "../safeguards.h"
23 Blitter_32bppAnim::~Blitter_32bppAnim()
28 template <BlitterMode mode>
34 const uint16 *src_n = (
const uint16 *)(src->
data + src->
offset[zoom][1]);
36 for (uint i = bp->
skip_top; i != 0; i--) {
37 src_px = (
const Colour *)((
const byte *)src_px + *(
const uint32 *)src_px);
38 src_n = (
const uint16 *)((
const byte *)src_n + *(
const uint32 *)src_n);
42 uint16 *anim = this->anim_buf + ((uint32 *)bp->
dst - (uint32 *)_screen.dst_ptr) + bp->
top * this->
anim_buf_width + bp->
left;
44 const byte *remap = bp->
remap;
46 for (
int y = 0; y < bp->
height; y++) {
50 const Colour *src_px_ln = (
const Colour *)((
const byte *)src_px + *(
const uint32 *)src_px);
53 const uint16 *src_n_ln = (
const uint16 *)((
const byte *)src_n + *(
const uint32 *)src_n);
60 while (dst < dst_end) {
68 if (dst > dst_end) anim += dst - dst_end;
70 if (dst + n > dst_end) {
71 uint d = dst_end - dst;
76 dst_end = dst + bp->
width;
78 n = min<uint>(n - d, (uint)bp->
width);
92 while (dst < dst_end) {
93 n = min<uint>(*src_n++, (uint)(dst_end - dst));
107 if (src_px->a == 255) {
115 uint r = remap[
GB(m, 0, 8)];
116 *anim = r | (m & 0xFF00);
131 uint r = remap[
GB(m, 0, 8)];
144 if (src_px->a == 255) {
148 uint8 g =
MakeDark(src_px->r, src_px->g, src_px->b);
152 uint r = remap[
GB(m, 0, 8)];
153 *anim = r | (m & 0xFF00);
165 if (src_px->a != 0) {
166 uint8 g =
MakeDark(src_px->r, src_px->g, src_px->b);
171 uint r = remap[
GB(m, 0, 8)];
200 if (src_px->a == 255) {
220 if (src_px->a == 255) {
223 uint m =
GB(*src_n, 0, 8);
232 uint m =
GB(*src_n, 0, 8);
264 default: NOT_REACHED();
265 case BM_NORMAL: Draw<BM_NORMAL> (bp, zoom);
return;
284 anim = this->
anim_buf + ((uint32 *)dst - (uint32 *)_screen.dst_ptr);
288 for (
int i = 0; i != width; i++) {
294 udst = udst - width + _screen.pitch;
301 for (
int i = 0; i != width; i++) {
307 udst = udst - width + _screen.pitch;
313 DEBUG(misc, 0,
"32bpp blitter doesn't know how to draw this colour table ('%d')", pal);
322 this->
anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->
anim_buf_width] = colour | (DEFAULT_BRIGHTNESS << 8);
336 anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->
anim_buf;
340 uint16 *anim = anim_line;
342 for (
int i = width; i > 0; i--) {
345 *anim = colour | (DEFAULT_BRIGHTNESS << 8);
349 video = (uint32 *)video + _screen.pitch;
350 anim_line += this->anim_buf_width;
357 assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
359 const uint32 *usrc = (
const uint32 *)src;
360 uint16 *anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->
anim_buf;
362 for (; height > 0; height--) {
365 uint16 *anim_pal = anim_line;
367 memcpy(dst, usrc, width *
sizeof(uint32));
369 dst += _screen.pitch;
371 memcpy(anim_line, usrc, width *
sizeof(uint16));
372 usrc = (
const uint32 *)((
const uint16 *)usrc + width);
382 for (
int i = 0; i < width; i++) {
383 uint colour =
GB(*anim_pal, 0, 8);
397 assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
398 uint32 *udst = (uint32 *)dst;
399 const uint32 *src = (
const uint32 *)video;
400 const uint16 *anim_line;
404 anim_line = ((
const uint32 *)video - (uint32 *)_screen.dst_ptr) + this->
anim_buf;
406 for (; height > 0; height--) {
407 memcpy(udst, src, width *
sizeof(uint32));
408 src += _screen.pitch;
411 memcpy(udst, anim_line, width *
sizeof(uint16));
412 udst = (uint32 *)((uint16 *)udst + width);
420 assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
435 uint tw = width + (scroll_x >= 0 ? -scroll_x : scroll_x);
436 uint th = height - scroll_y;
437 for (; th > 0; th--) {
438 memcpy(dst, src, tw *
sizeof(uint16));
456 uint tw = width + (scroll_x >= 0 ? -scroll_x : scroll_x);
457 uint th = height + scroll_y;
458 for (; th > 0; th--) {
459 memmove(dst, src, tw *
sizeof(uint16));
470 return width * height * (
sizeof(uint32) +
sizeof(uint16));
483 const uint16 *anim = this->
anim_buf;
489 uint colour =
GB(*anim, 0, 8);
511 if (_screen.width != this->anim_buf_width || _screen.height != this->anim_buf_height) {
514 this->
anim_buf = CallocT<uint16>(_screen.width * _screen.height);