Movie editor: Fix compilation on Win32
[lsnes.git] / src / library / pixfmt-rgb32.cpp
blob9aa08f5dd8e949bd35053e713c5f2fa26abcfec8
1 #include "pixfmt-rgb32.hpp"
3 pixel_format_rgb32::~pixel_format_rgb32() throw() {}
5 void pixel_format_rgb32::decode(uint8_t* target, const uint8_t* src, size_t width) throw()
7 const uint32_t* _src = reinterpret_cast<const uint32_t*>(src);
8 for(size_t i = 0; i < width; i++) {
9 target[3 * i + 0] = _src[i] >> 16;
10 target[3 * i + 1] = _src[i] >> 8;
11 target[3 * i + 2] = _src[i];
15 void pixel_format_rgb32::decode(uint32_t* target, const uint8_t* src, size_t width,
16 const pixel_format_aux_palette<false>& auxp) throw()
18 const uint32_t* _src = reinterpret_cast<const uint32_t*>(src);
19 for(size_t i = 0; i < width; i++) {
20 target[i] = ((_src[i] >> 16) & 0xFF) << auxp.rshift;
21 target[i] |= ((_src[i] >> 8) & 0xFF) << auxp.gshift;
22 target[i] |= (_src[i] & 0xFF) << auxp.bshift;
26 void pixel_format_rgb32::decode(uint64_t* target, const uint8_t* src, size_t width,
27 const pixel_format_aux_palette<true>& auxp) throw()
29 const uint32_t* _src = reinterpret_cast<const uint32_t*>(src);
30 for(size_t i = 0; i < width; i++) {
31 target[i] = static_cast<uint64_t>((_src[i] >> 16) & 0xFF) << auxp.rshift;
32 target[i] |= static_cast<uint64_t>((_src[i] >> 8) & 0xFF) << auxp.gshift;
33 target[i] |= static_cast<uint64_t>(_src[i] & 0xFF) << auxp.bshift;
34 target[i] += (target[i] << 8);
38 void pixel_format_rgb32::set_palette(pixel_format_aux_palette<false>& auxp, uint8_t rshift, uint8_t gshift,
39 uint8_t bshift) throw(std::bad_alloc)
41 auxp.rshift = rshift;
42 auxp.gshift = gshift;
43 auxp.bshift = bshift;
44 auxp.pcache.clear();
47 void pixel_format_rgb32::set_palette(pixel_format_aux_palette<true>& auxp, uint8_t rshift, uint8_t gshift,
48 uint8_t bshift) throw(std::bad_alloc)
50 auxp.rshift = rshift;
51 auxp.gshift = gshift;
52 auxp.bshift = bshift;
53 auxp.pcache.clear();
56 uint8_t pixel_format_rgb32::get_bpp() throw()
58 return 4;
61 uint8_t pixel_format_rgb32::get_ss_bpp() throw()
63 return 3;
66 uint32_t pixel_format_rgb32::get_magic() throw()
68 return 0x74212536U;
71 pixel_format_rgb32 _pixel_format_rgb32;