diff --git a/include/library/framebuffer-pixfmt-lrgb.hpp b/include/library/framebuffer-pixfmt-lrgb.hpp new file mode 100644 index 00000000..98398a21 --- /dev/null +++ b/include/library/framebuffer-pixfmt-lrgb.hpp @@ -0,0 +1,33 @@ +#ifndef _library__framebuffer_pixfmt_lrgb__hpp__included__ +#define _library__framebuffer_pixfmt_lrgb__hpp__included__ + +#include "framebuffer.hpp" + +namespace framebuffer +{ +/** + * Pixel format LRGB (bsnes). + */ +class _pixfmt_lrgb : public pixfmt +{ +public: + ~_pixfmt_lrgb() throw(); + void decode(uint32_t* target, const uint8_t* src, size_t width) + throw(); + void decode(uint32_t* target, const uint8_t* src, size_t width, + const auxpalette& auxp) throw(); + void decode(uint64_t* target, const uint8_t* src, size_t width, + const auxpalette& auxp) throw(); + void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, + uint8_t bshift) throw(std::bad_alloc); + void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, + uint8_t bshift) throw(std::bad_alloc); + uint8_t get_bpp() throw(); + uint8_t get_ss_bpp() throw(); + uint32_t get_magic() throw(); +}; + +extern _pixfmt_lrgb pixfmt_lrgb; +} + +#endif diff --git a/include/library/framebuffer-pixfmt-rgb15.hpp b/include/library/framebuffer-pixfmt-rgb15.hpp new file mode 100644 index 00000000..057e00eb --- /dev/null +++ b/include/library/framebuffer-pixfmt-rgb15.hpp @@ -0,0 +1,35 @@ +#ifndef _library__framebuffer_pixfmt_rgb15__hpp__included__ +#define _library__framebuffer_pixfmt_rgb15__hpp__included__ + +#include "framebuffer.hpp" + +namespace framebuffer +{ +/** + * Pixel format RGB15 (5:5:5). + */ +template +class _pixfmt_rgb15 : public pixfmt +{ +public: + ~_pixfmt_rgb15() throw(); + void decode(uint32_t* target, const uint8_t* src, size_t width) + throw(); + void decode(uint32_t* target, const uint8_t* src, size_t width, + const auxpalette& auxp) throw(); + void decode(uint64_t* target, const uint8_t* src, size_t width, + const auxpalette& auxp) throw(); + void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, + uint8_t bshift) throw(std::bad_alloc); + void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, + uint8_t bshift) throw(std::bad_alloc); + uint8_t get_bpp() throw(); + uint8_t get_ss_bpp() throw(); + uint32_t get_magic() throw(); +}; + +extern _pixfmt_rgb15 pixfmt_rgb15; +extern _pixfmt_rgb15 pixfmt_bgr15; +} + +#endif diff --git a/include/library/framebuffer-pixfmt-rgb16.hpp b/include/library/framebuffer-pixfmt-rgb16.hpp new file mode 100644 index 00000000..0adedb68 --- /dev/null +++ b/include/library/framebuffer-pixfmt-rgb16.hpp @@ -0,0 +1,35 @@ +#ifndef _library__framebuffer_pixfmt_rgb16__hpp__included__ +#define _library__framebuffer_pixfmt_rgb16__hpp__included__ + +#include "framebuffer.hpp" + +namespace framebuffer +{ +/** + * Pixel format RGB16 (5:6:5). + */ +template +class _pixfmt_rgb16 : public pixfmt +{ +public: + ~_pixfmt_rgb16() throw(); + void decode(uint32_t* target, const uint8_t* src, size_t width) + throw(); + void decode(uint32_t* target, const uint8_t* src, size_t width, + const auxpalette& auxp) throw(); + void decode(uint64_t* target, const uint8_t* src, size_t width, + const auxpalette& auxp) throw(); + void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, + uint8_t bshift) throw(std::bad_alloc); + void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, + uint8_t bshift) throw(std::bad_alloc); + uint8_t get_bpp() throw(); + uint8_t get_ss_bpp() throw(); + uint32_t get_magic() throw(); +}; + +extern _pixfmt_rgb16 pixfmt_rgb16; +extern _pixfmt_rgb16 pixfmt_bgr16; +} + +#endif diff --git a/include/library/framebuffer-pixfmt-rgb24.hpp b/include/library/framebuffer-pixfmt-rgb24.hpp new file mode 100644 index 00000000..c4369ff4 --- /dev/null +++ b/include/library/framebuffer-pixfmt-rgb24.hpp @@ -0,0 +1,35 @@ +#ifndef _library__framebuffer_pixfmt_rgb24__hpp__included__ +#define _library__framebuffer_pixfmt_rgb24__hpp__included__ + +#include "framebuffer.hpp" + +namespace framebuffer +{ +/** + * Pixel format RGB24. + */ +template +class _pixfmt_rgb24 : public pixfmt +{ +public: + ~_pixfmt_rgb24() throw(); + void decode(uint32_t* target, const uint8_t* src, size_t width) + throw(); + void decode(uint32_t* target, const uint8_t* src, size_t width, + const auxpalette& auxp) throw(); + void decode(uint64_t* target, const uint8_t* src, size_t width, + const auxpalette& auxp) throw(); + void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, + uint8_t bshift) throw(std::bad_alloc); + void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, + uint8_t bshift) throw(std::bad_alloc); + uint8_t get_bpp() throw(); + uint8_t get_ss_bpp() throw(); + uint32_t get_magic() throw(); +}; + +extern _pixfmt_rgb24 pixfmt_rgb24; +extern _pixfmt_rgb24 pixfmt_bgr24; +} + +#endif diff --git a/include/library/framebuffer-pixfmt-rgb32.hpp b/include/library/framebuffer-pixfmt-rgb32.hpp new file mode 100644 index 00000000..c59e8784 --- /dev/null +++ b/include/library/framebuffer-pixfmt-rgb32.hpp @@ -0,0 +1,33 @@ +#ifndef _library__framebuffer_pixfmt_rgb32__hpp__included__ +#define _library__framebuffer_pixfmt_rgb32__hpp__included__ + +#include "framebuffer.hpp" + +namespace framebuffer +{ +/** + * Pixel format RGB32. + */ +class _pixfmt_rgb32 : public pixfmt +{ +public: + ~_pixfmt_rgb32() throw(); + void decode(uint32_t* target, const uint8_t* src, size_t width) + throw(); + void decode(uint32_t* target, const uint8_t* src, size_t width, + const auxpalette& auxp) throw(); + void decode(uint64_t* target, const uint8_t* src, size_t width, + const auxpalette& auxp) throw(); + void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, + uint8_t bshift) throw(std::bad_alloc); + void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, + uint8_t bshift) throw(std::bad_alloc); + uint8_t get_bpp() throw(); + uint8_t get_ss_bpp() throw(); + uint32_t get_magic() throw(); +}; + +extern _pixfmt_rgb32 pixfmt_rgb32; +} + +#endif diff --git a/include/library/pixfmt-lrgb.hpp b/include/library/pixfmt-lrgb.hpp deleted file mode 100644 index 2dd84013..00000000 --- a/include/library/pixfmt-lrgb.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef _library__pixfmt_lrgb__hpp__included__ -#define _library__pixfmt_lrgb__hpp__included__ - -#include "framebuffer.hpp" - -/** - * Pixel format LRGB (bsnes). - */ -class pixel_format_lrgb : public framebuffer::pixfmt -{ -public: - ~pixel_format_lrgb() throw(); - void decode(uint32_t* target, const uint8_t* src, size_t width) - throw(); - void decode(uint32_t* target, const uint8_t* src, size_t width, - const framebuffer::auxpalette& auxp) throw(); - void decode(uint64_t* target, const uint8_t* src, size_t width, - const framebuffer::auxpalette& auxp) throw(); - void set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc); - void set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc); - uint8_t get_bpp() throw(); - uint8_t get_ss_bpp() throw(); - uint32_t get_magic() throw(); -}; - -extern pixel_format_lrgb _pixel_format_lrgb; - -#endif diff --git a/include/library/pixfmt-rgb15.hpp b/include/library/pixfmt-rgb15.hpp deleted file mode 100644 index 496de980..00000000 --- a/include/library/pixfmt-rgb15.hpp +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef _library__pixfmt_rgb15__hpp__included__ -#define _library__pixfmt_rgb15__hpp__included__ - -#include "framebuffer.hpp" - -/** - * Pixel format RGB15 (5:5:5). - */ -template -class pixel_format_rgb15 : public framebuffer::pixfmt -{ -public: - ~pixel_format_rgb15() throw(); - void decode(uint32_t* target, const uint8_t* src, size_t width) - throw(); - void decode(uint32_t* target, const uint8_t* src, size_t width, - const framebuffer::auxpalette& auxp) throw(); - void decode(uint64_t* target, const uint8_t* src, size_t width, - const framebuffer::auxpalette& auxp) throw(); - void set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc); - void set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc); - uint8_t get_bpp() throw(); - uint8_t get_ss_bpp() throw(); - uint32_t get_magic() throw(); -}; - -extern pixel_format_rgb15 _pixel_format_rgb15; -extern pixel_format_rgb15 _pixel_format_bgr15; - -#endif diff --git a/include/library/pixfmt-rgb16.hpp b/include/library/pixfmt-rgb16.hpp deleted file mode 100644 index 6a38fd4d..00000000 --- a/include/library/pixfmt-rgb16.hpp +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef _library__pixfmt_rgb16__hpp__included__ -#define _library__pixfmt_rgb16__hpp__included__ - -#include "framebuffer.hpp" - -/** - * Pixel format RGB16 (5:6:5). - */ -template -class pixel_format_rgb16 : public framebuffer::pixfmt -{ -public: - ~pixel_format_rgb16() throw(); - void decode(uint32_t* target, const uint8_t* src, size_t width) - throw(); - void decode(uint32_t* target, const uint8_t* src, size_t width, - const framebuffer::auxpalette& auxp) throw(); - void decode(uint64_t* target, const uint8_t* src, size_t width, - const framebuffer::auxpalette& auxp) throw(); - void set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc); - void set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc); - uint8_t get_bpp() throw(); - uint8_t get_ss_bpp() throw(); - uint32_t get_magic() throw(); -}; - -extern pixel_format_rgb16 _pixel_format_rgb16; -extern pixel_format_rgb16 _pixel_format_bgr16; - -#endif diff --git a/include/library/pixfmt-rgb24.hpp b/include/library/pixfmt-rgb24.hpp deleted file mode 100644 index bca5f539..00000000 --- a/include/library/pixfmt-rgb24.hpp +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef _library__pixfmt_rgb24__hpp__included__ -#define _library__pixfmt_rgb24__hpp__included__ - -#include "framebuffer.hpp" - -/** - * Pixel format RGB24. - */ -template -class pixel_format_rgb24 : public framebuffer::pixfmt -{ -public: - ~pixel_format_rgb24() throw(); - void decode(uint32_t* target, const uint8_t* src, size_t width) - throw(); - void decode(uint32_t* target, const uint8_t* src, size_t width, - const framebuffer::auxpalette& auxp) throw(); - void decode(uint64_t* target, const uint8_t* src, size_t width, - const framebuffer::auxpalette& auxp) throw(); - void set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc); - void set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc); - uint8_t get_bpp() throw(); - uint8_t get_ss_bpp() throw(); - uint32_t get_magic() throw(); -}; - -extern pixel_format_rgb24 _pixel_format_rgb24; -extern pixel_format_rgb24 _pixel_format_bgr24; - -#endif diff --git a/include/library/pixfmt-rgb32.hpp b/include/library/pixfmt-rgb32.hpp deleted file mode 100644 index 3df84665..00000000 --- a/include/library/pixfmt-rgb32.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef _library__pixfmt_rgb32__hpp__included__ -#define _library__pixfmt_rgb32__hpp__included__ - -#include "framebuffer.hpp" - -/** - * Pixel format RGB32. - */ -class pixel_format_rgb32 : public framebuffer::pixfmt -{ -public: - ~pixel_format_rgb32() throw(); - void decode(uint32_t* target, const uint8_t* src, size_t width) - throw(); - void decode(uint32_t* target, const uint8_t* src, size_t width, - const framebuffer::auxpalette& auxp) throw(); - void decode(uint64_t* target, const uint8_t* src, size_t width, - const framebuffer::auxpalette& auxp) throw(); - void set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc); - void set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc); - uint8_t get_bpp() throw(); - uint8_t get_ss_bpp() throw(); - uint32_t get_magic() throw(); -}; - -extern pixel_format_rgb32 _pixel_format_rgb32; - -#endif diff --git a/src/core/framebuffer.cpp b/src/core/framebuffer.cpp index fb937026..db576d58 100644 --- a/src/core/framebuffer.cpp +++ b/src/core/framebuffer.cpp @@ -10,7 +10,7 @@ #include "lua/lua.hpp" #include "fonts/wrapper.hpp" #include "library/framebuffer.hpp" -#include "library/pixfmt-lrgb.hpp" +#include "library/framebuffer-pixfmt-lrgb.hpp" framebuffer::raw screen_corrupt; @@ -148,7 +148,7 @@ void init_special_screens() throw(std::bad_alloc) buf.resize(512*448); framebuffer::info inf; - inf.type = &_pixel_format_lrgb; + inf.type = &framebuffer::pixfmt_lrgb; inf.mem = reinterpret_cast(&buf[0]); inf.physwidth = 512; inf.physheight = 448; diff --git a/src/core/mainloop.cpp b/src/core/mainloop.cpp index cd4845f0..bfd5f67f 100644 --- a/src/core/mainloop.cpp +++ b/src/core/mainloop.cpp @@ -27,7 +27,6 @@ #include "interface/callbacks.hpp" #include "interface/romtype.hpp" #include "library/framebuffer.hpp" -#include "library/pixfmt-lrgb.hpp" #include "library/zip.hpp" #include diff --git a/src/core/rom.cpp b/src/core/rom.cpp index 66b4dd22..ce809cbb 100644 --- a/src/core/rom.cpp +++ b/src/core/rom.cpp @@ -13,7 +13,7 @@ #include "interface/cover.hpp" #include "interface/romtype.hpp" #include "interface/callbacks.hpp" -#include "library/pixfmt-rgb16.hpp" +#include "library/framebuffer-pixfmt-rgb16.hpp" #include "library/controller-data.hpp" #include "library/patch.hpp" #include "library/sha256.hpp" @@ -49,7 +49,7 @@ namespace //Framebuffer. struct framebuffer::info null_fbinfo = { - &_pixel_format_bgr16, //Format. + &framebuffer::pixfmt_bgr16, //Format. (char*)null_cover_fbmem, //Memory. 512, 448, 1024, //Physical size. 512, 448, 1024, //Logical size. diff --git a/src/emulation/bsnes-legacy/core.cpp b/src/emulation/bsnes-legacy/core.cpp index eb76e06c..cfd97095 100644 --- a/src/emulation/bsnes-legacy/core.cpp +++ b/src/emulation/bsnes-legacy/core.cpp @@ -34,7 +34,7 @@ #include "interface/romtype.hpp" #include "interface/setting.hpp" #include "interface/callbacks.hpp" -#include "library/pixfmt-lrgb.hpp" +#include "library/framebuffer-pixfmt-lrgb.hpp" #include "library/string.hpp" #include "library/controller-data.hpp" #include "library/framebuffer.hpp" @@ -92,7 +92,7 @@ namespace //Framebuffer. struct framebuffer::info cover_fbinfo = { - &_pixel_format_lrgb, //Format. + &framebuffer::pixfmt_lrgb, //Format. (char*)cover_fbmem, //Memory. 512, 448, 2048, //Physical size. 512, 448, 2048, //Logical size. @@ -1241,7 +1241,7 @@ again2: fps_d /= g; framebuffer::info inf; - inf.type = &_pixel_format_lrgb; + inf.type = &framebuffer::pixfmt_lrgb; inf.mem = const_cast(reinterpret_cast(data)); inf.physwidth = 512; inf.physheight = 512; diff --git a/src/emulation/gambatte/core.cpp b/src/emulation/gambatte/core.cpp index 9bbd357f..e1ee3d74 100644 --- a/src/emulation/gambatte/core.cpp +++ b/src/emulation/gambatte/core.cpp @@ -33,7 +33,7 @@ #include "interface/callbacks.hpp" #include "interface/cover.hpp" #include "interface/romtype.hpp" -#include "library/pixfmt-rgb32.hpp" +#include "library/framebuffer-pixfmt-rgb32.hpp" #include "library/string.hpp" #include "library/controller-data.hpp" #include "library/serialization.hpp" @@ -110,7 +110,7 @@ namespace //Framebuffer. struct framebuffer::info cover_fbinfo = { - &_pixel_format_rgb32, //Format. + &framebuffer::pixfmt_rgb32, //Format. (char*)cover_fbmem, //Memory. 480, 432, 1920, //Physical size. 480, 432, 1920, //Logical size. @@ -632,7 +632,7 @@ namespace } } framebuffer::info inf; - inf.type = &_pixel_format_rgb32; + inf.type = &framebuffer::pixfmt_rgb32; inf.mem = const_cast(reinterpret_cast(primary_framebuffer)); inf.physwidth = 160; inf.physheight = 144; diff --git a/src/emulation/sky/sky.cpp b/src/emulation/sky/sky.cpp index f408e4ee..7d715e87 100644 --- a/src/emulation/sky/sky.cpp +++ b/src/emulation/sky/sky.cpp @@ -9,7 +9,7 @@ #include "core/window.hpp" #include "interface/romtype.hpp" #include "interface/callbacks.hpp" -#include "library/pixfmt-rgb32.hpp" +#include "library/framebuffer-pixfmt-rgb32.hpp" namespace sky { @@ -28,7 +28,7 @@ namespace sky //Framebuffer. uint32_t cover_fbmem[320*200]; struct framebuffer::info cover_fbinfo = { - &_pixel_format_rgb32, //Format. + &framebuffer::pixfmt_rgb32, //Format. (char*)cover_fbmem, //Memory. 320, 200, 1280, //Physical size. 320, 200, 1280, //Logical size. @@ -309,7 +309,7 @@ namespace sky simulate_frame(corei, x); uint32_t* fb = corei.get_framebuffer(); framebuffer::info inf; - inf.type = &_pixel_format_rgb32; + inf.type = &framebuffer::pixfmt_rgb32; inf.mem = const_cast(reinterpret_cast(fb)); inf.physwidth = FB_WIDTH; inf.physheight = FB_HEIGHT; diff --git a/src/emulation/test/test.cpp b/src/emulation/test/test.cpp index 2875070d..87aae1ef 100644 --- a/src/emulation/test/test.cpp +++ b/src/emulation/test/test.cpp @@ -31,7 +31,7 @@ #include "interface/callbacks.hpp" #include "interface/cover.hpp" #include "interface/romtype.hpp" -#include "library/pixfmt-rgb32.hpp" +#include "library/framebuffer-pixfmt-rgb32.hpp" #include "library/string.hpp" #include "library/controller-data.hpp" #include "library/serialization.hpp" @@ -45,7 +45,7 @@ namespace //Framebuffer. struct framebuffer::info cover_fbinfo = { - &_pixel_format_rgb32, //Format. + &framebuffer::pixfmt_rgb32, //Format. (char*)cover_fbmem, //Memory. 480, 432, 1920, //Physical size. 480, 432, 1920, //Logical size. @@ -150,7 +150,7 @@ namespace pflag = false; redraw_screen(); framebuffer::info inf; - inf.type = &_pixel_format_rgb32; + inf.type = &framebuffer::pixfmt_rgb32; inf.mem = const_cast(reinterpret_cast(cover_fbmem)); inf.physwidth = 480; inf.physheight = 432; diff --git a/src/library/pixfmt-lrgb.cpp b/src/library/framebuffer-pixfmt-lrgb.cpp similarity index 69% rename from src/library/pixfmt-lrgb.cpp rename to src/library/framebuffer-pixfmt-lrgb.cpp index 42fb80ff..5b861bad 100644 --- a/src/library/pixfmt-lrgb.cpp +++ b/src/library/framebuffer-pixfmt-lrgb.cpp @@ -1,10 +1,12 @@ -#include "pixfmt-lrgb.hpp" +#include "framebuffer-pixfmt-lrgb.hpp" -pixel_format_lrgb::~pixel_format_lrgb() throw() +namespace framebuffer +{ +_pixfmt_lrgb::~_pixfmt_lrgb() throw() { } -void pixel_format_lrgb::decode(uint32_t* target, const uint8_t* src, size_t width) +void _pixfmt_lrgb::decode(uint32_t* target, const uint8_t* src, size_t width) throw() { const uint32_t* _src = reinterpret_cast(src); @@ -21,23 +23,23 @@ void pixel_format_lrgb::decode(uint32_t* target, const uint8_t* src, size_t widt } } -void pixel_format_lrgb::decode(uint32_t* target, const uint8_t* src, size_t width, - const framebuffer::auxpalette& auxp) throw() +void _pixfmt_lrgb::decode(uint32_t* target, const uint8_t* src, size_t width, + const auxpalette& auxp) throw() { const uint32_t* _src = reinterpret_cast(src); for(size_t i = 0; i < width; i++) target[i] = auxp.pcache[_src[i] & 0x7FFFF]; } -void pixel_format_lrgb::decode(uint64_t* target, const uint8_t* src, size_t width, - const framebuffer::auxpalette& auxp) throw() +void _pixfmt_lrgb::decode(uint64_t* target, const uint8_t* src, size_t width, + const auxpalette& auxp) throw() { const uint32_t* _src = reinterpret_cast(src); for(size_t i = 0; i < width; i++) target[i] = auxp.pcache[_src[i] & 0x7FFFF]; } -void pixel_format_lrgb::set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, +void _pixfmt_lrgb::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) { auxp.pcache.resize(0x80000); @@ -55,7 +57,7 @@ void pixel_format_lrgb::set_palette(framebuffer::auxpalette& auxp, uint8_ auxp.bshift = bshift; } -void pixel_format_lrgb::set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, +void _pixfmt_lrgb::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) { auxp.pcache.resize(0x80000); @@ -73,19 +75,20 @@ void pixel_format_lrgb::set_palette(framebuffer::auxpalette& auxp, uint8_t auxp.bshift = bshift; } -uint8_t pixel_format_lrgb::get_bpp() throw() +uint8_t _pixfmt_lrgb::get_bpp() throw() { return 4; } -uint8_t pixel_format_lrgb::get_ss_bpp() throw() +uint8_t _pixfmt_lrgb::get_ss_bpp() throw() { return 3; } -uint32_t pixel_format_lrgb::get_magic() throw() +uint32_t _pixfmt_lrgb::get_magic() throw() { return 0; } -pixel_format_lrgb _pixel_format_lrgb; +_pixfmt_lrgb pixfmt_lrgb; +} diff --git a/src/library/pixfmt-rgb15.cpp b/src/library/framebuffer-pixfmt-rgb15.cpp similarity index 67% rename from src/library/pixfmt-rgb15.cpp rename to src/library/framebuffer-pixfmt-rgb15.cpp index b62be6ed..293bc805 100644 --- a/src/library/pixfmt-rgb15.cpp +++ b/src/library/framebuffer-pixfmt-rgb15.cpp @@ -1,12 +1,14 @@ -#include "pixfmt-rgb15.hpp" +#include "framebuffer-pixfmt-rgb15.hpp" +namespace framebuffer +{ template -pixel_format_rgb15::~pixel_format_rgb15() throw() +_pixfmt_rgb15::~_pixfmt_rgb15() throw() { } template -void pixel_format_rgb15::decode(uint32_t* target, const uint8_t* src, size_t width) +void _pixfmt_rgb15::decode(uint32_t* target, const uint8_t* src, size_t width) throw() { const uint16_t* _src = reinterpret_cast(src); @@ -22,8 +24,8 @@ void pixel_format_rgb15::decode(uint32_t* target, const uint8_t* src, si } template -void pixel_format_rgb15::decode(uint32_t* target, const uint8_t* src, size_t width, - const framebuffer::auxpalette& auxp) throw() +void _pixfmt_rgb15::decode(uint32_t* target, const uint8_t* src, size_t width, + const auxpalette& auxp) throw() { const uint16_t* _src = reinterpret_cast(src); for(size_t i = 0; i < width; i++) @@ -31,8 +33,8 @@ void pixel_format_rgb15::decode(uint32_t* target, const uint8_t* src, si } template -void pixel_format_rgb15::decode(uint64_t* target, const uint8_t* src, size_t width, - const framebuffer::auxpalette& auxp) throw() +void _pixfmt_rgb15::decode(uint64_t* target, const uint8_t* src, size_t width, + const auxpalette& auxp) throw() { const uint16_t* _src = reinterpret_cast(src); for(size_t i = 0; i < width; i++) @@ -40,7 +42,7 @@ void pixel_format_rgb15::decode(uint64_t* target, const uint8_t* src, si } template -void pixel_format_rgb15::set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, +void _pixfmt_rgb15::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) { auxp.pcache.resize(0x8000); @@ -58,7 +60,7 @@ void pixel_format_rgb15::set_palette(framebuffer::auxpalette& aux } template -void pixel_format_rgb15::set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, +void _pixfmt_rgb15::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) { auxp.pcache.resize(0x8000); @@ -76,19 +78,19 @@ void pixel_format_rgb15::set_palette(framebuffer::auxpalette& auxp } template -uint8_t pixel_format_rgb15::get_bpp() throw() +uint8_t _pixfmt_rgb15::get_bpp() throw() { return 2; } template -uint8_t pixel_format_rgb15::get_ss_bpp() throw() +uint8_t _pixfmt_rgb15::get_ss_bpp() throw() { return 2; } template -uint32_t pixel_format_rgb15::get_magic() throw() +uint32_t _pixfmt_rgb15::get_magic() throw() { if(uvswap) return 0x16326322; @@ -96,5 +98,6 @@ uint32_t pixel_format_rgb15::get_magic() throw() return 0x74324563; } -pixel_format_rgb15 _pixel_format_rgb15; -pixel_format_rgb15 _pixel_format_bgr15; +_pixfmt_rgb15 pixfmt_rgb15; +_pixfmt_rgb15 pixfmt_bgr15; +} diff --git a/src/library/pixfmt-rgb16.cpp b/src/library/framebuffer-pixfmt-rgb16.cpp similarity index 67% rename from src/library/pixfmt-rgb16.cpp rename to src/library/framebuffer-pixfmt-rgb16.cpp index 4fd86597..eb604d49 100644 --- a/src/library/pixfmt-rgb16.cpp +++ b/src/library/framebuffer-pixfmt-rgb16.cpp @@ -1,12 +1,14 @@ -#include "pixfmt-rgb16.hpp" +#include "framebuffer-pixfmt-rgb16.hpp" +namespace framebuffer +{ template -pixel_format_rgb16::~pixel_format_rgb16() throw() +_pixfmt_rgb16::~_pixfmt_rgb16() throw() { } template -void pixel_format_rgb16::decode(uint32_t* target, const uint8_t* src, size_t width) throw() +void _pixfmt_rgb16::decode(uint32_t* target, const uint8_t* src, size_t width) throw() { const uint16_t* _src = reinterpret_cast(src); for(size_t i = 0; i < width; i++) { @@ -21,8 +23,8 @@ void pixel_format_rgb16::decode(uint32_t* target, const uint8_t* src, si } template -void pixel_format_rgb16::decode(uint32_t* target, const uint8_t* src, size_t width, - const framebuffer::auxpalette& auxp) throw() +void _pixfmt_rgb16::decode(uint32_t* target, const uint8_t* src, size_t width, + const auxpalette& auxp) throw() { const uint16_t* _src = reinterpret_cast(src); for(size_t i = 0; i < width; i++) @@ -30,8 +32,8 @@ void pixel_format_rgb16::decode(uint32_t* target, const uint8_t* src, si } template -void pixel_format_rgb16::decode(uint64_t* target, const uint8_t* src, size_t width, - const framebuffer::auxpalette& auxp) throw() +void _pixfmt_rgb16::decode(uint64_t* target, const uint8_t* src, size_t width, + const auxpalette& auxp) throw() { const uint16_t* _src = reinterpret_cast(src); for(size_t i = 0; i < width; i++) @@ -39,7 +41,7 @@ void pixel_format_rgb16::decode(uint64_t* target, const uint8_t* src, si } template -void pixel_format_rgb16::set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, +void _pixfmt_rgb16::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) { auxp.pcache.resize(0x10000); @@ -57,7 +59,7 @@ void pixel_format_rgb16::set_palette(framebuffer::auxpalette& aux } template -void pixel_format_rgb16::set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, +void _pixfmt_rgb16::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) { auxp.pcache.resize(0x10000); @@ -75,19 +77,19 @@ void pixel_format_rgb16::set_palette(framebuffer::auxpalette& auxp } template -uint8_t pixel_format_rgb16::get_bpp() throw() +uint8_t _pixfmt_rgb16::get_bpp() throw() { return 2; } template -uint8_t pixel_format_rgb16::get_ss_bpp() throw() +uint8_t _pixfmt_rgb16::get_ss_bpp() throw() { return 2; } template -uint32_t pixel_format_rgb16::get_magic() throw() +uint32_t _pixfmt_rgb16::get_magic() throw() { if(uvswap) return 0x74234643; @@ -95,5 +97,6 @@ uint32_t pixel_format_rgb16::get_magic() throw() return 0x32642474; } -pixel_format_rgb16 _pixel_format_rgb16; -pixel_format_rgb16 _pixel_format_bgr16; +_pixfmt_rgb16 pixfmt_rgb16; +_pixfmt_rgb16 pixfmt_bgr16; +} diff --git a/src/library/pixfmt-rgb24.cpp b/src/library/framebuffer-pixfmt-rgb24.cpp similarity index 61% rename from src/library/pixfmt-rgb24.cpp rename to src/library/framebuffer-pixfmt-rgb24.cpp index 28dfe353..c788f33b 100644 --- a/src/library/pixfmt-rgb24.cpp +++ b/src/library/framebuffer-pixfmt-rgb24.cpp @@ -1,11 +1,13 @@ -#include "pixfmt-rgb24.hpp" +#include "framebuffer-pixfmt-rgb24.hpp" #include +namespace framebuffer +{ template -pixel_format_rgb24::~pixel_format_rgb24() throw() {} +_pixfmt_rgb24::~_pixfmt_rgb24() throw() {} template -void pixel_format_rgb24::decode(uint32_t* target, const uint8_t* src, size_t width) throw() +void _pixfmt_rgb24::decode(uint32_t* target, const uint8_t* src, size_t width) throw() { if(uvswap) { for(size_t i = 0; i < width; i++) { @@ -23,8 +25,8 @@ void pixel_format_rgb24::decode(uint32_t* target, const uint8_t* src, si } template -void pixel_format_rgb24::decode(uint32_t* target, const uint8_t* src, size_t width, - const framebuffer::auxpalette& auxp) throw() +void _pixfmt_rgb24::decode(uint32_t* target, const uint8_t* src, size_t width, + const auxpalette& auxp) throw() { for(size_t i = 0; i < width; i++) { target[i] = static_cast(src[3 * i + (uvswap ? 2 : 0)]) << auxp.rshift; @@ -34,8 +36,8 @@ void pixel_format_rgb24::decode(uint32_t* target, const uint8_t* src, si } template -void pixel_format_rgb24::decode(uint64_t* target, const uint8_t* src, size_t width, - const framebuffer::auxpalette& auxp) throw() +void _pixfmt_rgb24::decode(uint64_t* target, const uint8_t* src, size_t width, + const auxpalette& auxp) throw() { for(size_t i = 0; i < width; i++) { target[i] = static_cast(src[3 * i + (uvswap ? 2 : 0)]) << auxp.rshift; @@ -46,7 +48,7 @@ void pixel_format_rgb24::decode(uint64_t* target, const uint8_t* src, si } template -void pixel_format_rgb24::set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, +void _pixfmt_rgb24::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) { auxp.rshift = rshift; @@ -56,7 +58,7 @@ void pixel_format_rgb24::set_palette(framebuffer::auxpalette& aux } template -void pixel_format_rgb24::set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, +void _pixfmt_rgb24::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) { auxp.rshift = rshift; @@ -66,19 +68,19 @@ void pixel_format_rgb24::set_palette(framebuffer::auxpalette& auxp } template -uint8_t pixel_format_rgb24::get_bpp() throw() +uint8_t _pixfmt_rgb24::get_bpp() throw() { return 3; } template -uint8_t pixel_format_rgb24::get_ss_bpp() throw() +uint8_t _pixfmt_rgb24::get_ss_bpp() throw() { return 3; } template -uint32_t pixel_format_rgb24::get_magic() throw() +uint32_t _pixfmt_rgb24::get_magic() throw() { if(uvswap) return 0x25642332U; @@ -86,5 +88,6 @@ uint32_t pixel_format_rgb24::get_magic() throw() return 0x85433684U; } -pixel_format_rgb24 _pixel_format_rgb24; -pixel_format_rgb24 _pixel_format_bgr24; +_pixfmt_rgb24 pixfmt_rgb24; +_pixfmt_rgb24 pixfmt_bgr24; +} diff --git a/src/library/pixfmt-rgb32.cpp b/src/library/framebuffer-pixfmt-rgb32.cpp similarity index 56% rename from src/library/pixfmt-rgb32.cpp rename to src/library/framebuffer-pixfmt-rgb32.cpp index 6914ee0c..1db043f6 100644 --- a/src/library/pixfmt-rgb32.cpp +++ b/src/library/framebuffer-pixfmt-rgb32.cpp @@ -1,16 +1,18 @@ -#include "pixfmt-rgb32.hpp" +#include "framebuffer-pixfmt-rgb32.hpp" -pixel_format_rgb32::~pixel_format_rgb32() throw() {} +namespace framebuffer +{ +_pixfmt_rgb32::~_pixfmt_rgb32() throw() {} -void pixel_format_rgb32::decode(uint32_t* target, const uint8_t* src, size_t width) throw() +void _pixfmt_rgb32::decode(uint32_t* target, const uint8_t* src, size_t width) throw() { const uint32_t* _src = reinterpret_cast(src); for(size_t i = 0; i < width; i++) target[i] = _src[i]; } -void pixel_format_rgb32::decode(uint32_t* target, const uint8_t* src, size_t width, - const framebuffer::auxpalette& auxp) throw() +void _pixfmt_rgb32::decode(uint32_t* target, const uint8_t* src, size_t width, + const auxpalette& auxp) throw() { const uint32_t* _src = reinterpret_cast(src); for(size_t i = 0; i < width; i++) { @@ -20,8 +22,8 @@ void pixel_format_rgb32::decode(uint32_t* target, const uint8_t* src, size_t wid } } -void pixel_format_rgb32::decode(uint64_t* target, const uint8_t* src, size_t width, - const framebuffer::auxpalette& auxp) throw() +void _pixfmt_rgb32::decode(uint64_t* target, const uint8_t* src, size_t width, + const auxpalette& auxp) throw() { const uint32_t* _src = reinterpret_cast(src); for(size_t i = 0; i < width; i++) { @@ -32,7 +34,7 @@ void pixel_format_rgb32::decode(uint64_t* target, const uint8_t* src, size_t wid } } -void pixel_format_rgb32::set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, +void _pixfmt_rgb32::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) { auxp.rshift = rshift; @@ -41,7 +43,7 @@ void pixel_format_rgb32::set_palette(framebuffer::auxpalette& auxp, uint8 auxp.pcache.clear(); } -void pixel_format_rgb32::set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, +void _pixfmt_rgb32::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) { auxp.rshift = rshift; @@ -50,19 +52,20 @@ void pixel_format_rgb32::set_palette(framebuffer::auxpalette& auxp, uint8_ auxp.pcache.clear(); } -uint8_t pixel_format_rgb32::get_bpp() throw() +uint8_t _pixfmt_rgb32::get_bpp() throw() { return 4; } -uint8_t pixel_format_rgb32::get_ss_bpp() throw() +uint8_t _pixfmt_rgb32::get_ss_bpp() throw() { return 3; } -uint32_t pixel_format_rgb32::get_magic() throw() +uint32_t _pixfmt_rgb32::get_magic() throw() { return 0x74212536U; } -pixel_format_rgb32 _pixel_format_rgb32; +_pixfmt_rgb32 pixfmt_rgb32; +}