OpenTTD Source 20250205-master-gfd85ab1e2c
32bpp_anim.cpp
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
10#include "../stdafx.h"
11#include "../video/video_driver.hpp"
12#include "../palette_func.h"
13#include "32bpp_anim.hpp"
14#include "common.hpp"
15
16#include "../table/sprites.h"
17
18#include "../safeguards.h"
19
22
23template <BlitterMode mode>
25{
26 const SpriteData *src = (const SpriteData *)bp->sprite;
27
28 const Colour *src_px = (const Colour *)(src->data + src->offset[zoom][0]);
29 const uint16_t *src_n = (const uint16_t *)(src->data + src->offset[zoom][1]);
30
31 for (uint i = bp->skip_top; i != 0; i--) {
32 src_px = (const Colour *)((const uint8_t *)src_px + *(const uint32_t *)src_px);
33 src_n = (const uint16_t *)((const uint8_t *)src_n + *(const uint32_t *)src_n);
34 }
35
36 Colour *dst = (Colour *)bp->dst + bp->top * bp->pitch + bp->left;
37 uint16_t *anim = this->anim_buf + this->ScreenToAnimOffset((uint32_t *)bp->dst) + bp->top * this->anim_buf_pitch + bp->left;
38
39 const uint8_t *remap = bp->remap; // store so we don't have to access it via bp every time
40
41 for (int y = 0; y < bp->height; y++) {
42 Colour *dst_ln = dst + bp->pitch;
43 uint16_t *anim_ln = anim + this->anim_buf_pitch;
44
45 const Colour *src_px_ln = (const Colour *)((const uint8_t *)src_px + *(const uint32_t *)src_px);
46 src_px++;
47
48 const uint16_t *src_n_ln = (const uint16_t *)((const uint8_t *)src_n + *(const uint32_t *)src_n);
49 src_n += 2;
50
51 Colour *dst_end = dst + bp->skip_left;
52
53 uint n;
54
55 while (dst < dst_end) {
56 n = *src_n++;
57
58 if (src_px->a == 0) {
59 dst += n;
60 src_px ++;
61 src_n++;
62
63 if (dst > dst_end) anim += dst - dst_end;
64 } else {
65 if (dst + n > dst_end) {
66 uint d = dst_end - dst;
67 src_px += d;
68 src_n += d;
69
70 dst = dst_end - bp->skip_left;
71 dst_end = dst + bp->width;
72
73 n = std::min(n - d, (uint)bp->width);
74 goto draw;
75 }
76 dst += n;
77 src_px += n;
78 src_n += n;
79 }
80 }
81
82 dst -= bp->skip_left;
83 dst_end -= bp->skip_left;
84
85 dst_end += bp->width;
86
87 while (dst < dst_end) {
88 n = std::min<uint>(*src_n++, dst_end - dst);
89
90 if (src_px->a == 0) {
91 anim += n;
92 dst += n;
93 src_px++;
94 src_n++;
95 continue;
96 }
97
98 draw:;
99
100 switch (mode) {
102 if (src_px->a == 255) {
103 do {
104 uint m = *src_n;
105 /* In case the m-channel is zero, do not remap this pixel in any way */
106 if (m == 0) {
107 *dst = src_px->data;
108 *anim = 0;
109 } else {
110 uint r = remap[GB(m, 0, 8)];
111 *anim = r | (m & 0xFF00);
112 if (r != 0) *dst = AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8));
113 }
114 anim++;
115 dst++;
116 src_px++;
117 src_n++;
118 } while (--n != 0);
119 } else {
120 do {
121 uint m = *src_n;
122 if (m == 0) {
123 *dst = ComposeColourRGBANoCheck(src_px->r, src_px->g, src_px->b, src_px->a, *dst);
124 *anim = 0;
125 } else {
126 uint r = remap[GB(m, 0, 8)];
127 *anim = 0;
128 if (r != 0) *dst = ComposeColourPANoCheck(AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8)), src_px->a, *dst);
129 }
130 anim++;
131 dst++;
132 src_px++;
133 src_n++;
134 } while (--n != 0);
135 }
136 break;
137
139 if (src_px->a == 255) {
140 do {
141 uint m = *src_n;
142 if (m == 0) {
143 uint8_t g = MakeDark(src_px->r, src_px->g, src_px->b);
144 *dst = ComposeColourRGBA(g, g, g, src_px->a, *dst);
145 *anim = 0;
146 } else {
147 uint r = remap[GB(m, 0, 8)];
148 *anim = r | (m & 0xFF00);
149 if (r != 0) *dst = AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8));
150 }
151 anim++;
152 dst++;
153 src_px++;
154 src_n++;
155 } while (--n != 0);
156 } else {
157 do {
158 uint m = *src_n;
159 if (m == 0) {
160 if (src_px->a != 0) {
161 uint8_t g = MakeDark(src_px->r, src_px->g, src_px->b);
162 *dst = ComposeColourRGBA(g, g, g, src_px->a, *dst);
163 *anim = 0;
164 }
165 } else {
166 uint r = remap[GB(m, 0, 8)];
167 *anim = 0;
168 if (r != 0) *dst = ComposeColourPANoCheck(AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8)), src_px->a, *dst);
169 }
170 anim++;
171 dst++;
172 src_px++;
173 src_n++;
174 } while (--n != 0);
175 }
176 break;
177
178
180 do {
181 *dst++ = Colour(0, 0, 0);
182 *anim++ = 0;
183 src_px++;
184 src_n++;
185 } while (--n != 0);
186 break;
187
189 /* Make the current colour a bit more black, so it looks like this image is transparent */
190 src_n += n;
191 if (src_px->a == 255) {
192 src_px += n;
193 do {
194 *dst = MakeTransparent(*dst, 3, 4);
195 *anim = 0;
196 anim++;
197 dst++;
198 } while (--n != 0);
199 } else {
200 do {
201 *dst = MakeTransparent(*dst, (256 * 4 - src_px->a), 256 * 4);
202 *anim = 0;
203 anim++;
204 dst++;
205 src_px++;
206 } while (--n != 0);
207 }
208 break;
209
211 /* Apply custom transparency remap. */
212 src_n += n;
213 if (src_px->a != 0) {
214 src_px += n;
215 do {
216 *dst = this->LookupColourInPalette(remap[GetNearestColourIndex(*dst)]);
217 *anim = 0;
218 anim++;
219 dst++;
220 } while (--n != 0);
221 } else {
222 dst += n;
223 anim += n;
224 src_px += n;
225 }
226 break;
227
228 default:
229 if (src_px->a == 255) {
230 do {
231 /* Compiler assumes pointer aliasing, can't optimise this on its own */
232 uint m = GB(*src_n, 0, 8);
233 /* Above PALETTE_ANIM_START is palette animation */
234 *anim++ = *src_n;
235 *dst++ = (m >= PALETTE_ANIM_START) ? AdjustBrightness(this->LookupColourInPalette(m), GB(*src_n, 8, 8)) : src_px->data;
236 src_px++;
237 src_n++;
238 } while (--n != 0);
239 } else {
240 do {
241 uint m = GB(*src_n, 0, 8);
242 *anim++ = 0;
243 if (m >= PALETTE_ANIM_START) {
244 *dst = ComposeColourPANoCheck(AdjustBrightness(this->LookupColourInPalette(m), GB(*src_n, 8, 8)), src_px->a, *dst);
245 } else {
246 *dst = ComposeColourRGBANoCheck(src_px->r, src_px->g, src_px->b, src_px->a, *dst);
247 }
248 dst++;
249 src_px++;
250 src_n++;
251 } while (--n != 0);
252 }
253 break;
254 }
255 }
256
257 anim = anim_ln;
258 dst = dst_ln;
259 src_px = src_px_ln;
260 src_n = src_n_ln;
261 }
262}
263
265{
267 /* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent Draw() */
268 Blitter_32bppOptimized::Draw(bp, mode, zoom);
269 return;
270 }
271
272 switch (mode) {
273 default: NOT_REACHED();
274 case BlitterMode::Normal: Draw<BlitterMode::Normal>(bp, zoom); return;
275 case BlitterMode::ColourRemap: Draw<BlitterMode::ColourRemap>(bp, zoom); return;
276 case BlitterMode::Transparent: Draw<BlitterMode::Transparent>(bp, zoom); return;
277 case BlitterMode::TransparentRemap: Draw<BlitterMode::TransparentRemap>(bp, zoom); return;
278 case BlitterMode::CrashRemap: Draw<BlitterMode::CrashRemap>(bp, zoom); return;
279 case BlitterMode::BlackRemap: Draw<BlitterMode::BlackRemap>(bp, zoom); return;
280 }
281}
282
283void Blitter_32bppAnim::DrawColourMappingRect(void *dst, int width, int height, PaletteID pal)
284{
286 /* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawColourMappingRect() */
287 Blitter_32bppOptimized::DrawColourMappingRect(dst, width, height, pal);
288 return;
289 }
290
291 Colour *udst = (Colour *)dst;
292 uint16_t *anim = this->anim_buf + this->ScreenToAnimOffset((uint32_t *)dst);
293
294 if (pal == PALETTE_TO_TRANSPARENT) {
295 do {
296 for (int i = 0; i != width; i++) {
297 *udst = MakeTransparent(*udst, 154);
298 *anim = 0;
299 udst++;
300 anim++;
301 }
302 udst = udst - width + _screen.pitch;
303 anim = anim - width + this->anim_buf_pitch;
304 } while (--height);
305 return;
306 }
307 if (pal == PALETTE_NEWSPAPER) {
308 do {
309 for (int i = 0; i != width; i++) {
310 *udst = MakeGrey(*udst);
311 *anim = 0;
312 udst++;
313 anim++;
314 }
315 udst = udst - width + _screen.pitch;
316 anim = anim - width + this->anim_buf_pitch;
317 } while (--height);
318 return;
319 }
320
321 Debug(misc, 0, "32bpp blitter doesn't know how to draw this colour table ('{}')", pal);
322}
323
324void Blitter_32bppAnim::SetPixel(void *video, int x, int y, uint8_t colour)
325{
326 *((Colour *)video + x + y * _screen.pitch) = LookupColourInPalette(colour);
327
328 /* Set the colour in the anim-buffer too, if we are rendering to the screen */
329 if (_screen_disable_anim) return;
330
331 this->anim_buf[this->ScreenToAnimOffset((uint32_t *)video) + x + y * this->anim_buf_pitch] = colour | (DEFAULT_BRIGHTNESS << 8);
332}
333
334void Blitter_32bppAnim::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8_t colour, int width, int dash)
335{
336 const Colour c = LookupColourInPalette(colour);
337
339 this->DrawLineGeneric(x, y, x2, y2, screen_width, screen_height, width, dash, [&](int x, int y) {
340 *((Colour *)video + x + y * _screen.pitch) = c;
341 });
342 } else {
343 uint16_t * const offset_anim_buf = this->anim_buf + this->ScreenToAnimOffset((uint32_t *)video);
344 const uint16_t anim_colour = colour | (DEFAULT_BRIGHTNESS << 8);
345 this->DrawLineGeneric(x, y, x2, y2, screen_width, screen_height, width, dash, [&](int x, int y) {
346 *((Colour *)video + x + y * _screen.pitch) = c;
347 offset_anim_buf[x + y * this->anim_buf_pitch] = anim_colour;
348 });
349 }
350}
351
352void Blitter_32bppAnim::DrawRect(void *video, int width, int height, uint8_t colour)
353{
355 /* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawRect() */
356 Blitter_32bppOptimized::DrawRect(video, width, height, colour);
357 return;
358 }
359
360 Colour colour32 = LookupColourInPalette(colour);
361 uint16_t *anim_line = this->ScreenToAnimOffset((uint32_t *)video) + this->anim_buf;
362
363 do {
364 Colour *dst = (Colour *)video;
365 uint16_t *anim = anim_line;
366
367 for (int i = width; i > 0; i--) {
368 *dst = colour32;
369 /* Set the colour in the anim-buffer too */
370 *anim = colour | (DEFAULT_BRIGHTNESS << 8);
371 dst++;
372 anim++;
373 }
374 video = (uint32_t *)video + _screen.pitch;
375 anim_line += this->anim_buf_pitch;
376 } while (--height);
377}
378
379void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width, int height)
380{
381 assert(!_screen_disable_anim);
382 assert(video >= _screen.dst_ptr && video <= (uint32_t *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
383 Colour *dst = (Colour *)video;
384 const uint32_t *usrc = (const uint32_t *)src;
385 uint16_t *anim_line = this->ScreenToAnimOffset((uint32_t *)video) + this->anim_buf;
386
387 for (; height > 0; height--) {
388 /* We need to keep those for palette animation. */
389 Colour *dst_pal = dst;
390 uint16_t *anim_pal = anim_line;
391
392 memcpy(static_cast<void *>(dst), usrc, width * sizeof(uint32_t));
393 usrc += width;
394 dst += _screen.pitch;
395 /* Copy back the anim-buffer */
396 memcpy(anim_line, usrc, width * sizeof(uint16_t));
397 usrc = (const uint32_t *)&((const uint16_t *)usrc)[width];
398 anim_line += this->anim_buf_pitch;
399
400 /* Okay, it is *very* likely that the image we stored is using
401 * the wrong palette animated colours. There are two things we
402 * can do to fix this. The first is simply reviewing the whole
403 * screen after we copied the buffer, i.e. run PaletteAnimate,
404 * however that forces a full screen redraw which is expensive
405 * for just the cursor. This just copies the implementation of
406 * palette animation, much cheaper though slightly nastier. */
407 for (int i = 0; i < width; i++) {
408 uint colour = GB(*anim_pal, 0, 8);
409 if (colour >= PALETTE_ANIM_START) {
410 /* Update this pixel */
411 *dst_pal = AdjustBrightness(LookupColourInPalette(colour), GB(*anim_pal, 8, 8));
412 }
413 dst_pal++;
414 anim_pal++;
415 }
416 }
417}
418
419void Blitter_32bppAnim::CopyToBuffer(const void *video, void *dst, int width, int height)
420{
421 assert(!_screen_disable_anim);
422 assert(video >= _screen.dst_ptr && video <= (uint32_t *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
423 uint32_t *udst = (uint32_t *)dst;
424 const uint32_t *src = (const uint32_t *)video;
425
426 if (this->anim_buf == nullptr) return;
427
428 const uint16_t *anim_line = this->ScreenToAnimOffset((const uint32_t *)video) + this->anim_buf;
429
430 for (; height > 0; height--) {
431 memcpy(udst, src, width * sizeof(uint32_t));
432 src += _screen.pitch;
433 udst += width;
434 /* Copy the anim-buffer */
435 memcpy(udst, anim_line, width * sizeof(uint16_t));
436 udst = (uint32_t *)&((uint16_t *)udst)[width];
437 anim_line += this->anim_buf_pitch;
438 }
439}
440
441void Blitter_32bppAnim::ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y)
442{
443 assert(!_screen_disable_anim);
444 assert(video >= _screen.dst_ptr && video <= (uint32_t *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
445 uint16_t *dst, *src;
446
447 /* We need to scroll the anim-buffer too */
448 if (scroll_y > 0) {
449 dst = this->anim_buf + left + (top + height - 1) * this->anim_buf_pitch;
450 src = dst - scroll_y * this->anim_buf_pitch;
451
452 /* Adjust left & width */
453 if (scroll_x >= 0) {
454 dst += scroll_x;
455 } else {
456 src -= scroll_x;
457 }
458
459 uint tw = width + (scroll_x >= 0 ? -scroll_x : scroll_x);
460 uint th = height - scroll_y;
461 for (; th > 0; th--) {
462 memcpy(dst, src, tw * sizeof(uint16_t));
463 src -= this->anim_buf_pitch;
464 dst -= this->anim_buf_pitch;
465 }
466 } else {
467 /* Calculate pointers */
468 dst = this->anim_buf + left + top * this->anim_buf_pitch;
469 src = dst - scroll_y * this->anim_buf_pitch;
470
471 /* Adjust left & width */
472 if (scroll_x >= 0) {
473 dst += scroll_x;
474 } else {
475 src -= scroll_x;
476 }
477
478 /* the y-displacement may be 0 therefore we have to use memmove,
479 * because source and destination may overlap */
480 uint tw = width + (scroll_x >= 0 ? -scroll_x : scroll_x);
481 uint th = height + scroll_y;
482 for (; th > 0; th--) {
483 memmove(dst, src, tw * sizeof(uint16_t));
484 src += this->anim_buf_pitch;
485 dst += this->anim_buf_pitch;
486 }
487 }
488
489 Blitter_32bppBase::ScrollBuffer(video, left, top, width, height, scroll_x, scroll_y);
490}
491
492size_t Blitter_32bppAnim::BufferSize(uint width, uint height)
493{
494 return (sizeof(uint32_t) + sizeof(uint16_t)) * width * height;
495}
496
498{
499 assert(!_screen_disable_anim);
500
501 this->palette = palette;
502 /* If first_dirty is 0, it is for 8bpp indication to send the new
503 * palette. However, only the animation colours might possibly change.
504 * Especially when going between toyland and non-toyland. */
505 assert(this->palette.first_dirty == PALETTE_ANIM_START || this->palette.first_dirty == 0);
506
507 const uint16_t *anim = this->anim_buf;
508 Colour *dst = (Colour *)_screen.dst_ptr;
509
510 /* Let's walk the anim buffer and try to find the pixels */
511 const int width = this->anim_buf_width;
512 const int pitch_offset = _screen.pitch - width;
513 const int anim_pitch_offset = this->anim_buf_pitch - width;
514 for (int y = this->anim_buf_height; y != 0 ; y--) {
515 for (int x = width; x != 0 ; x--) {
516 uint16_t value = *anim;
517 uint8_t colour = GB(value, 0, 8);
518 if (colour >= PALETTE_ANIM_START) {
519 /* Update this pixel */
520 *dst = AdjustBrightness(LookupColourInPalette(colour), GB(value, 8, 8));
521 }
522 dst++;
523 anim++;
524 }
525 dst += pitch_offset;
526 anim += anim_pitch_offset;
527 }
528
529 /* Make sure the backend redraws the whole screen */
530 VideoDriver::GetInstance()->MakeDirty(0, 0, _screen.width, _screen.height);
531}
532
537
539{
540 if (_screen.width != this->anim_buf_width || _screen.height != this->anim_buf_height ||
541 _screen.pitch != this->anim_buf_pitch) {
542 /* The size of the screen changed; we can assume we can wipe all data from our buffer */
543 this->anim_buf_width = _screen.width;
544 this->anim_buf_height = _screen.height;
545 this->anim_buf_pitch = (_screen.width + 7) & ~7;
546 this->anim_alloc = std::make_unique<uint16_t[]>(this->anim_buf_pitch * this->anim_buf_height + 8);
547
548 /* align buffer to next 16 byte boundary */
549 this->anim_buf = reinterpret_cast<uint16_t *>((reinterpret_cast<uintptr_t>(this->anim_alloc.get()) + 0xF) & (~0xF));
550 }
551}
static FBlitter_32bppAnim iFBlitter_32bppAnim
Instantiation of the 32bpp with animation blitter factory.
A 32 bpp blitter with animation support.
BlitterMode
The modes of blitting we can do.
Definition base.hpp:17
@ Transparent
Perform transparency darkening remapping.
@ CrashRemap
Perform a crash remapping.
@ BlackRemap
Perform remapping to a completely blackened sprite.
@ Normal
Perform the simple blitting.
@ TransparentRemap
Perform transparency colour remapping.
@ ColourRemap
Perform a colour remapping.
debug_inline static constexpr uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
void CopyFromBuffer(void *video, const void *src, int width, int height) override
Copy from a buffer to the screen.
Palette palette
The current palette.
std::unique_ptr< uint16_t[]> anim_alloc
The raw allocated buffer, not necessarily aligned correctly.
Blitter::PaletteAnimation UsePaletteAnimation() override
Check if the blitter uses palette animation at all.
int anim_buf_width
The width of the animation buffer.
void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) override
Scroll the videobuffer some 'x' and 'y' value.
Colour LookupColourInPalette(uint index)
Look up the colour in the current palette.
void SetPixel(void *video, int x, int y, uint8_t colour) override
Draw a pixel with a given colour on the video-buffer.
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override
Draw a colourtable to the screen.
size_t BufferSize(uint width, uint height) override
Calculate how much memory there is needed for an image of this size in the video-buffer.
uint16_t * anim_buf
In this buffer we keep track of the 8bpp indexes so we can do palette animation.
void DrawRect(void *video, int width, int height, uint8_t colour) override
Make a single horizontal line in a single colour on the video-buffer.
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8_t colour, int width, int dash) override
Draw a line with a given colour.
void PaletteAnimate(const Palette &palette) override
Called when the 8bpp palette is changed; you should redraw all pixels on the screen that are equal to...
void PostResize() override
Post resize event.
void CopyToBuffer(const void *video, void *dst, int width, int height) override
Copy from the screen to a buffer.
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override
Draw an image to the screen, given an amount of params defined above.
int anim_buf_height
The height of the animation buffer.
int anim_buf_pitch
The pitch of the animation buffer (width rounded up to 16 byte boundary).
static Colour ComposeColourRGBANoCheck(uint r, uint g, uint b, uint a, Colour current)
Compose a colour based on RGBA values and the current pixel value.
static Colour ComposeColourPANoCheck(Colour colour, uint a, Colour current)
Compose a colour based on Pixel value, alpha value, and the current pixel value.
void DrawRect(void *video, int width, int height, uint8_t colour) override
Make a single horizontal line in a single colour on the video-buffer.
static Colour MakeTransparent(Colour colour, uint nom, uint denom=256)
Make a pixel looks like it is transparent.
static Colour MakeGrey(Colour colour)
Make a colour grey - based.
static uint8_t MakeDark(uint8_t r, uint8_t g, uint8_t b)
Make a colour dark grey, for specialized 32bpp remapping.
void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) override
Scroll the videobuffer some 'x' and 'y' value.
static Colour ComposeColourRGBA(uint r, uint g, uint b, uint a, Colour current)
Compose a colour based on RGBA values and the current pixel value.
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override
Draws a sprite to a (screen) buffer.
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override
Draw a colourtable to the screen.
PaletteAnimation
Types of palette animation.
Definition base.hpp:50
@ Blitter
The blitter takes care of the palette animation.
Factory for the 32bpp blitter with animation.
virtual void MakeDirty(int left, int top, int width, int height)=0
Mark a particular area dirty.
static VideoDriver * GetInstance()
Get the currently active instance of the video driver.
Common functionality for all blitter implementations.
#define Debug(category, level, format_string,...)
Ouptut a line of debugging information.
Definition debug.h:37
bool _screen_disable_anim
Disable palette animation (important for 32bpp-anim blitter during giant screenshot)
Definition gfx.cpp:46
uint32_t PaletteID
The number of the palette.
Definition gfx_type.h:18
static constexpr uint8_t PALETTE_ANIM_START
Index in the _palettes array from which all animations are taking places (table/palettes....
Definition gfx_type.h:328
uint8_t GetNearestColourIndex(uint8_t r, uint8_t g, uint8_t b)
Get nearest colour palette index from an RGB colour.
Definition palette.cpp:151
static const PaletteID PALETTE_TO_TRANSPARENT
This sets the sprite to transparent.
Definition sprites.h:1602
static const PaletteID PALETTE_NEWSPAPER
Recolour sprite for newspaper-greying.
Definition sprites.h:1604
Parameters related to blitting.
Definition base.hpp:32
int skip_top
How much pixels of the source to skip on the top (based on zoom of dst)
Definition base.hpp:37
void * dst
Destination buffer.
Definition base.hpp:45
int left
The left offset in the 'dst' in pixels to start drawing.
Definition base.hpp:42
int pitch
The pitch of the destination buffer.
Definition base.hpp:46
int skip_left
How much pixels of the source to skip on the left (based on zoom of dst)
Definition base.hpp:36
int height
The height in pixels that needs to be drawn to dst.
Definition base.hpp:39
const uint8_t * remap
XXX – Temporary storage for remap array.
Definition base.hpp:34
int width
The width in pixels that needs to be drawn to dst.
Definition base.hpp:38
const void * sprite
Pointer to the sprite how ever the encoder stored it.
Definition base.hpp:33
int top
The top offset in the 'dst' in pixels to start drawing.
Definition base.hpp:43
Information about the currently used palette.
Definition gfx_type.h:360
int first_dirty
The first dirty element.
Definition gfx_type.h:362
ZoomLevel
All zoom levels we know.
Definition zoom_type.h:16