Some tweaks to Lua docs
[lsnes.git] / src / library / framebuffer-pixfmt-rgb32.cpp
blob1db043f6a9723d90ada996c4b446a69066657d6e
1 #include "framebuffer-pixfmt-rgb32.hpp"
3 namespace framebuffer
5 _pixfmt_rgb32::~_pixfmt_rgb32() throw() {}
7 void _pixfmt_rgb32::decode(uint32_t* target, const uint8_t* src, size_t width) throw()
9 const uint32_t* _src = reinterpret_cast<const uint32_t*>(src);
10 for(size_t i = 0; i < width; i++)
11 target[i] = _src[i];
14 void _pixfmt_rgb32::decode(uint32_t* target, const uint8_t* src, size_t width,
15 const auxpalette<false>& auxp) throw()
17 const uint32_t* _src = reinterpret_cast<const uint32_t*>(src);
18 for(size_t i = 0; i < width; i++) {
19 target[i] = ((_src[i] >> 16) & 0xFF) << auxp.rshift;
20 target[i] |= ((_src[i] >> 8) & 0xFF) << auxp.gshift;
21 target[i] |= (_src[i] & 0xFF) << auxp.bshift;
25 void _pixfmt_rgb32::decode(uint64_t* target, const uint8_t* src, size_t width,
26 const auxpalette<true>& auxp) throw()
28 const uint32_t* _src = reinterpret_cast<const uint32_t*>(src);
29 for(size_t i = 0; i < width; i++) {
30 target[i] = static_cast<uint64_t>((_src[i] >> 16) & 0xFF) << auxp.rshift;
31 target[i] |= static_cast<uint64_t>((_src[i] >> 8) & 0xFF) << auxp.gshift;
32 target[i] |= static_cast<uint64_t>(_src[i] & 0xFF) << auxp.bshift;
33 target[i] += (target[i] << 8);
37 void _pixfmt_rgb32::set_palette(auxpalette<false>& auxp, uint8_t rshift, uint8_t gshift,
38 uint8_t bshift) throw(std::bad_alloc)
40 auxp.rshift = rshift;
41 auxp.gshift = gshift;
42 auxp.bshift = bshift;
43 auxp.pcache.clear();
46 void _pixfmt_rgb32::set_palette(auxpalette<true>& auxp, uint8_t rshift, uint8_t gshift,
47 uint8_t bshift) throw(std::bad_alloc)
49 auxp.rshift = rshift;
50 auxp.gshift = gshift;
51 auxp.bshift = bshift;
52 auxp.pcache.clear();
55 uint8_t _pixfmt_rgb32::get_bpp() throw()
57 return 4;
60 uint8_t _pixfmt_rgb32::get_ss_bpp() throw()
62 return 3;
65 uint32_t _pixfmt_rgb32::get_magic() throw()
67 return 0x74212536U;
70 _pixfmt_rgb32 pixfmt_rgb32;