diff --git a/include/core/advdumper.hpp b/include/core/advdumper.hpp index 057b9f52..b9920f9c 100644 --- a/include/core/advdumper.hpp +++ b/include/core/advdumper.hpp @@ -118,9 +118,9 @@ private: * Parameter fn: Function to call between running lua hooks and actually rendering. * Returns: True if frame should be dumped, false if not. */ -template bool render_video_hud(struct framebuffer& target, struct framebuffer_raw& source, uint32_t hscl, - uint32_t vscl, uint32_t roffset, uint32_t goffset, uint32_t boffset, uint32_t lgap, uint32_t tgap, - uint32_t rgap, uint32_t bgap, void(*fn)()); +template bool render_video_hud(struct framebuffer::fb& target, struct framebuffer::raw& source, + uint32_t hscl, uint32_t vscl, uint32_t roffset, uint32_t goffset, uint32_t boffset, uint32_t lgap, + uint32_t tgap, uint32_t rgap, uint32_t bgap, void(*fn)()); /** * Calculate number of sound samples to drop due to dropped frame. diff --git a/include/core/dispatch.hpp b/include/core/dispatch.hpp index 3af66fe3..18a9af1c 100644 --- a/include/core/dispatch.hpp +++ b/include/core/dispatch.hpp @@ -110,13 +110,13 @@ public: * Parameter fps_n: Numerator of current video fps. * Parameter fps_d: Denominator of current video fps. */ - virtual void on_frame(struct framebuffer_raw& _frame, uint32_t fps_n, uint32_t fps_d); + virtual void on_frame(struct framebuffer::raw& _frame, uint32_t fps_n, uint32_t fps_d); /** * Call all on_frame() handlers. * * Calls on_new_dumper() on dumpers that had that not yet called. */ - static void do_frame(struct framebuffer_raw& _frame, uint32_t fps_n, uint32_t fps_d) throw(); + static void do_frame(struct framebuffer::raw& _frame, uint32_t fps_n, uint32_t fps_d) throw(); /** * A sample has been received. * @@ -258,7 +258,7 @@ extern struct dispatch::source<> notify_autohold_reconfigure; extern struct dispatch::source notify_autohold_update; extern struct dispatch::source notify_autofire_update; extern struct dispatch::source<> notify_close; -extern struct dispatch::source&> notify_set_screen; +extern struct dispatch::source&> notify_set_screen; extern struct dispatch::source> notify_sound_change; extern struct dispatch::source<> notify_screen_update; extern struct dispatch::source<> notify_status_update; diff --git a/include/core/framebuffer.hpp b/include/core/framebuffer.hpp index c96e1cbf..3bc932d4 100644 --- a/include/core/framebuffer.hpp +++ b/include/core/framebuffer.hpp @@ -54,15 +54,15 @@ private: /** * The main framebuffer. */ -extern framebuffer_raw main_framebuffer; +extern framebuffer::raw main_framebuffer; /** * Special screen: "SYSTEM STATE CORRUPT". */ -extern framebuffer_raw screen_corrupt; +extern framebuffer::raw screen_corrupt; /** * The main screen to draw on. */ -extern framebuffer main_screen; +extern framebuffer::fb main_screen; /** * Initialize special screens. * @@ -72,7 +72,7 @@ void init_special_screens() throw(std::bad_alloc); /** * Copy framebuffer to backing store, running Lua hooks if any. */ -void redraw_framebuffer(framebuffer_raw& torender, bool no_lua = false, bool spontaneous = false); +void redraw_framebuffer(framebuffer::raw& torender, bool no_lua = false, bool spontaneous = false); /** * Redraw the framebuffer, reusing contents from last redraw. Runs lua hooks if last redraw ran them. */ @@ -80,7 +80,7 @@ void redraw_framebuffer(); /** * Return last complete framebuffer. */ -framebuffer_raw get_framebuffer() throw(std::bad_alloc); +framebuffer::raw get_framebuffer() throw(std::bad_alloc); /** * Render framebuffer to main screen. */ @@ -100,7 +100,7 @@ void render_kill_request(void* obj); /** * Get latest screen received from core. */ -framebuffer_raw& render_get_latest_screen(); +framebuffer::raw& render_get_latest_screen(); void render_get_latest_screen_end(); #endif diff --git a/include/fonts/wrapper.hpp b/include/fonts/wrapper.hpp index 41e45266..8809e9df 100644 --- a/include/fonts/wrapper.hpp +++ b/include/fonts/wrapper.hpp @@ -3,7 +3,7 @@ #include "library/framebuffer.hpp" -extern bitmap_font main_font; +extern framebuffer::font main_font; void do_init_font(); diff --git a/include/interface/callbacks.hpp b/include/interface/callbacks.hpp index 66885f77..6c3d8b33 100644 --- a/include/interface/callbacks.hpp +++ b/include/interface/callbacks.hpp @@ -50,7 +50,7 @@ public: /** * Output a frame. Call once for each call to emulate(). */ - virtual void output_frame(framebuffer_raw& screen, uint32_t fps_n, uint32_t fps_d) = 0; + virtual void output_frame(framebuffer::raw& screen, uint32_t fps_n, uint32_t fps_d) = 0; /** * Notify that action states have been updated. */ diff --git a/include/interface/romtype.hpp b/include/interface/romtype.hpp index f9a076f5..b117cde8 100644 --- a/include/interface/romtype.hpp +++ b/include/interface/romtype.hpp @@ -318,7 +318,7 @@ struct core_core void runtosave(); bool get_pflag(); void set_pflag(bool pflag); - framebuffer_raw& draw_cover(); + framebuffer::raw& draw_cover(); std::vector get_port_types() { return port_types; } std::string get_core_shortname(); void pre_emulate_frame(controller_frame& cf); @@ -435,7 +435,7 @@ protected: * * Should display information about the ROM loaded. */ - virtual framebuffer_raw& c_draw_cover() = 0; + virtual framebuffer::raw& c_draw_cover() = 0; /** * Get shortened name of the core. */ @@ -572,7 +572,7 @@ public: void runtosave() { core->runtosave(); } bool get_pflag() { return core->get_pflag(); } void set_pflag(bool pflag) { core->set_pflag(pflag); } - framebuffer_raw& draw_cover() { return core->draw_cover(); } + framebuffer::raw& draw_cover() { return core->draw_cover(); } std::string get_systemmenu_name() { return sysname; } void execute_action(unsigned id, const std::vector& p) { diff --git a/include/library/customfont.hpp b/include/library/customfont.hpp index cae69f8a..a6e6c206 100644 --- a/include/library/customfont.hpp +++ b/include/library/customfont.hpp @@ -17,10 +17,10 @@ struct font_glyph_data unsigned height; unsigned stride; std::vector glyph; //Bitpacked, element breaks between rows. - void render(framebuffer& fb, int32_t x, int32_t y, premultiplied_color fg, premultiplied_color bg, - premultiplied_color hl) const; - void render(framebuffer& fb, int32_t x, int32_t y, premultiplied_color fg, premultiplied_color bg, - premultiplied_color hl) const; + void render(framebuffer::fb& fb, int32_t x, int32_t y, framebuffer::color fg, framebuffer::color bg, + framebuffer::color hl) const; + void render(framebuffer::fb& fb, int32_t x, int32_t y, framebuffer::color fg, framebuffer::color bg, + framebuffer::color hl) const; }; struct custom_font @@ -28,7 +28,7 @@ struct custom_font public: custom_font(); custom_font(const std::string& file); - custom_font(struct bitmap_font& bfont); + custom_font(struct framebuffer::font& bfont); void add(const std::u32string& key, const font_glyph_data& glyph) throw(std::bad_alloc); std::u32string best_ligature_match(const std::u32string& codepoints, size_t start) const throw(std::bad_alloc); diff --git a/include/library/framebuffer.hpp b/include/library/framebuffer.hpp index d005fc5f..a04c1305 100644 --- a/include/library/framebuffer.hpp +++ b/include/library/framebuffer.hpp @@ -7,17 +7,19 @@ #include #include -template struct framebufferelem {}; -template<> struct framebufferelem { typedef uint32_t t; }; -template<> struct framebufferelem { typedef uint64_t t; }; +namespace framebuffer +{ +template struct elem {}; +template<> struct elem { typedef uint32_t t; }; +template<> struct elem { typedef uint64_t t; }; /** * Pixel format auxillary palette. */ template -struct pixel_format_aux_palette +struct auxpalette { - typedef typename framebufferelem::t element_t; + typedef typename elem::t element_t; uint8_t rshift; //Red shift. uint8_t gshift; //Green shift. uint8_t bshift; //Blue shift. @@ -27,14 +29,14 @@ struct pixel_format_aux_palette /** * Pixel format. */ -class pixel_format +class pixfmt { public: - virtual ~pixel_format() throw(); + virtual ~pixfmt() throw(); /** * Register the pixel format. */ - pixel_format() throw(std::bad_alloc); + pixfmt() throw(std::bad_alloc); /** * Decode pixel format data into RGB data (0, R, G, B). */ @@ -44,21 +46,21 @@ public: * Decode pixel format data into RGB (with specified byte order). */ virtual void decode(uint32_t* target, const uint8_t* src, size_t width, - const pixel_format_aux_palette& auxp) throw() = 0; + const auxpalette& auxp) throw() = 0; /** * Decode pixel format data into RGB (with specified byte order). */ virtual void decode(uint64_t* target, const uint8_t* src, size_t width, - const pixel_format_aux_palette& auxp) throw() = 0; + const auxpalette& auxp) throw() = 0; /** * Create aux palette. */ - virtual void set_palette(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, + virtual void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) = 0; /** * Create aux palette. */ - virtual void set_palette(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, + virtual void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) = 0; /** * Bytes per pixel in data. @@ -77,12 +79,12 @@ public: /** * Game framebuffer information. */ -struct framebuffer_info +struct info { /** * Pixel format of framebuffer. */ - pixel_format* type; + pixfmt* type; /** * The physical memory backing the framebuffer. */ @@ -130,7 +132,7 @@ template struct framebuffer; * * Any copying only preserves the visible part. */ -struct framebuffer_raw +struct raw { /** * Create a new framebuffer backed by temporary buffer. @@ -139,13 +141,13 @@ struct framebuffer_raw * * Parameter info: The framebuffer info. */ - framebuffer_raw(const framebuffer_info& info) throw(std::bad_alloc); + raw(const info& finfo) throw(std::bad_alloc); /** * Create a new framebuffer backed by memory buffer. * * The resulting framebuffer can be written to. */ - framebuffer_raw() throw(std::bad_alloc); + raw() throw(std::bad_alloc); /** * Copy a framebuffer. * @@ -153,14 +155,14 @@ struct framebuffer_raw * * Parameter f: The framebuffer. */ - framebuffer_raw(const framebuffer_raw& f) throw(std::bad_alloc); + raw(const raw& f) throw(std::bad_alloc); /** * Assign a framebuffer. * * Parameter f: The framebuffer. * Throws std::runtime_error: The target framebuffer is not writable. */ - framebuffer_raw& operator=(const framebuffer_raw& f) throw(std::bad_alloc, std::runtime_error); + raw& operator=(const raw& f) throw(std::bad_alloc, std::runtime_error); /** * Load contents of framebuffer. * @@ -204,24 +206,24 @@ struct framebuffer_raw /** * Get pixel format. */ - pixel_format* get_format() const throw(); + pixfmt* get_format() const throw(); /** * Destructor. */ - ~framebuffer_raw(); + ~raw(); private: bool user_memory; //True if allocated in user memory, false if aliases framebuffer. char* addr; //Address of framebuffer start. - pixel_format* fmt; //Format of framebuffer. + pixfmt* fmt; //Format of framebuffer. size_t width; //Width of framebuffer. size_t height; //Height of framebuffer. size_t stride; //Stride in pixels. size_t allocated; //Amount of memory allocated (only meaningful if user_memory=true). - template friend class framebuffer; + template friend class fb; }; -struct premultiplied_color; +struct color; /** * Rendered framebuffer. @@ -229,18 +231,18 @@ struct premultiplied_color; * This framebuffer is in RGB32/RGB64 format, and is always backed by memory buffer. */ template -struct framebuffer +struct fb { - typedef typename framebufferelem::t element_t; + typedef typename elem::t element_t; /** * Creates framebuffer. The framebuffer dimensions are initially 0x0. */ - framebuffer() throw(); + fb() throw(); /** * Destructor. */ - ~framebuffer() throw(); + ~fb() throw(); /** * Sets the backing memory for framebuffer. The specified memory is not freed if framebuffer is reallocated or @@ -292,7 +294,7 @@ struct framebuffer * parameter hscale Horizontal scale factor. * parameter vscale Vertical scale factor. */ - void copy_from(framebuffer_raw& scr, size_t hscale, size_t vscale) throw(); + void copy_from(raw& scr, size_t hscale, size_t vscale) throw(); /** * Get pointer into specified row. @@ -353,8 +355,8 @@ struct framebuffer */ uint8_t get_palette_b() const throw(); private: - framebuffer(const framebuffer& f); - framebuffer& operator=(const framebuffer& f); + fb(const fb& f); + fb& operator=(const fb& f); size_t width; //Width of framebuffer. size_t height; //Height of framebuffer. size_t stride; //Stride in pixels. @@ -363,31 +365,31 @@ private: size_t last_blit_w; //Width of last blit. size_t last_blit_h; //Height of last blit. element_t* mem; //The memory of framebuffer. - pixel_format* current_fmt; //Current format of framebuffer. - pixel_format_aux_palette auxpal; //Aux palette. + pixfmt* current_fmt; //Current format of framebuffer. + auxpalette auxpal; //Aux palette. bool user_mem; //True if internal memory is used. bool upside_down; //Upside down flag. uint8_t active_rshift; //Red shift. uint8_t active_gshift; //Green shift. uint8_t active_bshift; //Blue shift. - friend struct premultiplied_color; + friend struct color; }; -struct render_queue; +struct queue; /** * Base class for objects to render. */ -struct render_object +struct object { /** * Constructor. */ - render_object() throw(); + object() throw(); /** * Destructor. */ - virtual ~render_object() throw(); + virtual ~object() throw(); /** * Kill object function. If it returns true, kill the request. Default is to return false. */ @@ -401,18 +403,18 @@ struct render_object * * parameter scr: The screen to draw it on. */ - virtual void operator()(struct framebuffer& scr) throw() = 0; - virtual void operator()(struct framebuffer& scr) throw() = 0; + virtual void operator()(struct fb& scr) throw() = 0; + virtual void operator()(struct fb& scr) throw() = 0; /** * Clone the object. */ - virtual void clone(struct render_queue& q) const throw(std::bad_alloc) = 0; + virtual void clone(struct queue& q) const throw(std::bad_alloc) = 0; }; /** * Premultiplied color. */ -struct premultiplied_color +struct color { uint32_t hi; uint32_t lo; @@ -426,7 +428,7 @@ struct premultiplied_color operator bool() const throw() { return (origa != 0); } bool operator!() const throw() { return (origa == 0); } - premultiplied_color() throw() + color() throw() { hi = lo = 0; hiHI = loHI = 0; @@ -436,7 +438,7 @@ struct premultiplied_color invHI = 65536; } - premultiplied_color(int64_t color) throw() + color(int64_t color) throw() { if(color < 0) { //Transparent. @@ -454,7 +456,7 @@ struct premultiplied_color //std::cerr << "Color " << color << " -> hi=" << hi << " lo=" << lo << " inv=" << inv << std::endl; } void set_palette(unsigned rshift, unsigned gshift, unsigned bshift, bool X) throw(); - template void set_palette(struct framebuffer& s) throw() + template void set_palette(struct fb& s) throw() { set_palette(s.active_rshift, s.active_gshift, s.active_bshift, X); } @@ -474,7 +476,8 @@ struct premultiplied_color uint64_t a, b; a = color & 0xFFFF0000FFFFULL; b = (color & 0xFFFF0000FFFF0000ULL) >> 16; - return (((a * invHI + hiHI) >> 16) & 0xFFFF0000FFFFULL) | ((b * invHI + loHI) & 0xFFFF0000FFFF0000ULL); + return (((a * invHI + hiHI) >> 16) & 0xFFFF0000FFFFULL) | ((b * invHI + loHI) & + 0xFFFF0000FFFF0000ULL); } void apply(uint64_t& x) throw() { @@ -486,7 +489,7 @@ struct premultiplied_color /** * Bitmap font (8x16). */ -struct bitmap_font +struct font { /** * Bitmap font glyph. @@ -510,7 +513,7 @@ struct bitmap_font /** * Constructor. */ - bitmap_font() throw(std::bad_alloc); + font() throw(std::bad_alloc); /** * Load a .hex format font. * @@ -560,8 +563,8 @@ struct bitmap_font * Parameter hdbl: If set, double width horizontally. * Parameter vdbl: If set, double height vertically. */ - template void render(struct framebuffer& scr, int32_t x, int32_t y, const std::string& text, - premultiplied_color fg, premultiplied_color bg, bool hdbl, bool vdbl) throw(); + template void render(struct fb& scr, int32_t x, int32_t y, const std::string& text, + color fg, color bg, bool hdbl, bool vdbl) throw(); private: glyph bad_glyph; uint32_t bad_glyph_data[4]; @@ -577,14 +580,14 @@ private: /** * Queue of render operations. */ -struct render_queue +struct queue { /** * Applies all objects in the queue in order. * * parameter scr: The screen to apply queue to. */ - template void run(struct framebuffer& scr) throw(); + template void run(struct fb& scr) throw(); /** * Frees all objects in the queue without applying them. @@ -609,7 +612,7 @@ struct render_queue /** * Copy objects from another render queue. */ - void copy_from(render_queue& q) throw(std::bad_alloc); + void copy_from(queue& q) throw(std::bad_alloc); /** * Helper for clone. */ @@ -633,14 +636,14 @@ struct render_queue /** * Constructor. */ - render_queue() throw(); + queue() throw(); /** * Destructor. */ - ~render_queue() throw(); + ~queue() throw(); private: - void add(struct render_object& obj) throw(std::bad_alloc); - struct node { struct render_object* obj; struct node* next; bool killed; }; + void add(struct object& obj) throw(std::bad_alloc); + struct node { struct object* obj; struct node* next; bool killed; }; struct page { char content[RENDER_PAGE_SIZE]; }; struct node* queue_head; struct node* queue_tail; @@ -659,6 +662,6 @@ private: * parameter maxc: Maximum coordinate relative to base. Updated. */ void clip_range(uint32_t origin, uint32_t size, int32_t base, int32_t& minc, int32_t& maxc) throw(); - +} #endif diff --git a/include/library/lua-framebuffer.hpp b/include/library/lua-framebuffer.hpp index 33aafde2..6224a91d 100644 --- a/include/library/lua-framebuffer.hpp +++ b/include/library/lua-framebuffer.hpp @@ -7,7 +7,7 @@ struct lua_render_context uint32_t right_gap; uint32_t top_gap; uint32_t bottom_gap; - struct render_queue* queue; + struct framebuffer::queue* queue; uint32_t width; uint32_t height; }; diff --git a/include/library/pixfmt-lrgb.hpp b/include/library/pixfmt-lrgb.hpp index fba9e02f..2dd84013 100644 --- a/include/library/pixfmt-lrgb.hpp +++ b/include/library/pixfmt-lrgb.hpp @@ -6,19 +6,19 @@ /** * Pixel format LRGB (bsnes). */ -class pixel_format_lrgb : public pixel_format +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 pixel_format_aux_palette& auxp) throw(); + const framebuffer::auxpalette& auxp) throw(); void decode(uint64_t* target, const uint8_t* src, size_t width, - const pixel_format_aux_palette& auxp) throw(); - void set_palette(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, + 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(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, + 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(); diff --git a/include/library/pixfmt-rgb15.hpp b/include/library/pixfmt-rgb15.hpp index 35545d0e..496de980 100644 --- a/include/library/pixfmt-rgb15.hpp +++ b/include/library/pixfmt-rgb15.hpp @@ -7,19 +7,19 @@ * Pixel format RGB15 (5:5:5). */ template -class pixel_format_rgb15 : public pixel_format +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 pixel_format_aux_palette& auxp) throw(); + const framebuffer::auxpalette& auxp) throw(); void decode(uint64_t* target, const uint8_t* src, size_t width, - const pixel_format_aux_palette& auxp) throw(); - void set_palette(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, + 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(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, + 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(); diff --git a/include/library/pixfmt-rgb16.hpp b/include/library/pixfmt-rgb16.hpp index ca9024f0..6a38fd4d 100644 --- a/include/library/pixfmt-rgb16.hpp +++ b/include/library/pixfmt-rgb16.hpp @@ -7,19 +7,19 @@ * Pixel format RGB16 (5:6:5). */ template -class pixel_format_rgb16 : public pixel_format +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 pixel_format_aux_palette& auxp) throw(); + const framebuffer::auxpalette& auxp) throw(); void decode(uint64_t* target, const uint8_t* src, size_t width, - const pixel_format_aux_palette& auxp) throw(); - void set_palette(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, + 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(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, + 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(); diff --git a/include/library/pixfmt-rgb24.hpp b/include/library/pixfmt-rgb24.hpp index 73ffc255..bca5f539 100644 --- a/include/library/pixfmt-rgb24.hpp +++ b/include/library/pixfmt-rgb24.hpp @@ -7,19 +7,19 @@ * Pixel format RGB24. */ template -class pixel_format_rgb24 : public pixel_format +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 pixel_format_aux_palette& auxp) throw(); + const framebuffer::auxpalette& auxp) throw(); void decode(uint64_t* target, const uint8_t* src, size_t width, - const pixel_format_aux_palette& auxp) throw(); - void set_palette(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, + 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(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, + 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(); diff --git a/include/library/pixfmt-rgb32.hpp b/include/library/pixfmt-rgb32.hpp index 5f1d74b9..3df84665 100644 --- a/include/library/pixfmt-rgb32.hpp +++ b/include/library/pixfmt-rgb32.hpp @@ -6,19 +6,19 @@ /** * Pixel format RGB32. */ -class pixel_format_rgb32 : public pixel_format +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 pixel_format_aux_palette& auxp) throw(); + const framebuffer::auxpalette& auxp) throw(); void decode(uint64_t* target, const uint8_t* src, size_t width, - const pixel_format_aux_palette& auxp) throw(); - void set_palette(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, + 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(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, + 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(); diff --git a/include/lua/bitmap.hpp b/include/lua/bitmap.hpp index a4135842..154cb78f 100644 --- a/include/lua/bitmap.hpp +++ b/include/lua/bitmap.hpp @@ -12,7 +12,7 @@ struct lua_palette { - std::vector colors; + std::vector colors; lua_palette(lua_state& L); ~lua_palette(); mutex_class palette_mutex; @@ -36,7 +36,7 @@ struct lua_dbitmap ~lua_dbitmap(); size_t width; size_t height; - std::vector pixels; + std::vector pixels; std::vector save_png() const; std::string print(); }; diff --git a/src/core/advdumper.cpp b/src/core/advdumper.cpp index de054fcb..c8a7ff37 100644 --- a/src/core/advdumper.cpp +++ b/src/core/advdumper.cpp @@ -43,13 +43,13 @@ unsigned adv_dumper::target_type_file = 0; unsigned adv_dumper::target_type_prefix = 1; unsigned adv_dumper::target_type_special = 2; -template bool render_video_hud(struct framebuffer& target, struct framebuffer_raw& source, uint32_t hscl, +template bool render_video_hud(struct framebuffer::fb& target, struct framebuffer::raw& source, uint32_t hscl, uint32_t vscl, uint32_t roffset, uint32_t goffset, uint32_t boffset, uint32_t lgap, uint32_t tgap, uint32_t rgap, uint32_t bgap, void(*fn)()) { bool lua_kill_video = false; struct lua_render_context lrc; - render_queue rq; + framebuffer::queue rq; lrc.left_gap = lgap; lrc.right_gap = rgap; lrc.bottom_gap = bgap; @@ -78,9 +78,9 @@ uint64_t killed_audio_length(uint32_t fps_n, uint32_t fps_d, double& fraction) return y; } -template bool render_video_hud(struct framebuffer& target, struct framebuffer_raw& source, uint32_t hscl, +template bool render_video_hud(struct framebuffer::fb& target, struct framebuffer::raw& source, uint32_t hscl, uint32_t vscl, uint32_t roffset, uint32_t goffset, uint32_t boffset, uint32_t lgap, uint32_t tgap, uint32_t rgap, uint32_t bgap, void(*fn)()); -template bool render_video_hud(struct framebuffer& target, struct framebuffer_raw& source, uint32_t hscl, +template bool render_video_hud(struct framebuffer::fb& target, struct framebuffer::raw& source, uint32_t hscl, uint32_t vscl, uint32_t roffset, uint32_t goffset, uint32_t boffset, uint32_t lgap, uint32_t tgap, uint32_t rgap, uint32_t bgap, void(*fn)()); diff --git a/src/core/dispatch.cpp b/src/core/dispatch.cpp index a9df22cb..e97d6241 100644 --- a/src/core/dispatch.cpp +++ b/src/core/dispatch.cpp @@ -128,12 +128,12 @@ information_dispatch::~information_dispatch() throw() } } -void information_dispatch::on_frame(struct framebuffer_raw& _frame, uint32_t fps_n, uint32_t fps_d) +void information_dispatch::on_frame(struct framebuffer::raw& _frame, uint32_t fps_n, uint32_t fps_d) { //Do nothing. } -void information_dispatch::do_frame(struct framebuffer_raw& _frame, uint32_t fps_n, uint32_t fps_d) throw() +void information_dispatch::do_frame(struct framebuffer::raw& _frame, uint32_t fps_n, uint32_t fps_d) throw() { update_dumpers(); for(auto& i : _dispatch()) { @@ -347,7 +347,7 @@ struct dispatch::source<> notify_autohold_reconfigure("autohold_reconfigure"); struct dispatch::source notify_autohold_update("autohold_update"); struct dispatch::source notify_autofire_update("autofire_update"); struct dispatch::source<> notify_close("notify_close"); -struct dispatch::source&> notify_set_screen("set_screen"); +struct dispatch::source&> notify_set_screen("set_screen"); struct dispatch::source> notify_sound_change("sound_change"); struct dispatch::source<> notify_screen_update("screen_update"); struct dispatch::source<> notify_status_update("status_update"); diff --git a/src/core/framebuffer.cpp b/src/core/framebuffer.cpp index 7fcded4d..fb937026 100644 --- a/src/core/framebuffer.cpp +++ b/src/core/framebuffer.cpp @@ -12,14 +12,14 @@ #include "library/framebuffer.hpp" #include "library/pixfmt-lrgb.hpp" -framebuffer_raw screen_corrupt; +framebuffer::raw screen_corrupt; namespace { struct render_info { - framebuffer_raw fbuf; - render_queue rq; + framebuffer::raw fbuf; + framebuffer::queue rq; uint32_t hscl; uint32_t vscl; uint32_t lgap; @@ -132,7 +132,7 @@ namespace bool last_redraw_no_lua = true; } -framebuffer main_screen; +framebuffer::fb main_screen; void take_screenshot(const std::string& file) throw(std::bad_alloc, std::runtime_error) { @@ -147,7 +147,7 @@ void init_special_screens() throw(std::bad_alloc) std::vector buf; buf.resize(512*448); - framebuffer_info inf; + framebuffer::info inf; inf.type = &_pixel_format_lrgb; inf.mem = reinterpret_cast(&buf[0]); inf.physwidth = 512; @@ -160,10 +160,10 @@ void init_special_screens() throw(std::bad_alloc) inf.offset_y = 0; draw_corrupt(&buf[0]); - screen_corrupt = framebuffer_raw(inf); + screen_corrupt = framebuffer::raw(inf); } -void redraw_framebuffer(framebuffer_raw& todraw, bool no_lua, bool spontaneous) +void redraw_framebuffer(framebuffer::raw& todraw, bool no_lua, bool spontaneous) { uint32_t hscl, vscl; auto g = our_rom.rtype->get_scale_factors(todraw.get_width(), todraw.get_height()); @@ -198,7 +198,7 @@ void redraw_framebuffer(framebuffer_raw& todraw, bool no_lua, bool spontaneous) void redraw_framebuffer() { render_info& ri = get_read_buffer(); - framebuffer_raw copy = ri.fbuf; + framebuffer::raw copy = ri.fbuf; buffering.end_read(); //Redraws are never spontaneous redraw_framebuffer(copy, last_redraw_no_lua, false); @@ -238,10 +238,10 @@ std::pair get_framebuffer_size() return std::make_pair(h, v); } -framebuffer_raw get_framebuffer() throw(std::bad_alloc) +framebuffer::raw get_framebuffer() throw(std::bad_alloc) { render_info& ri = get_read_buffer(); - framebuffer_raw copy = ri.fbuf; + framebuffer::raw copy = ri.fbuf; buffering.end_read(); return copy; } @@ -305,7 +305,7 @@ void render_kill_request(void* obj) buffer3.rq.kill_request(obj); } -framebuffer_raw& render_get_latest_screen() +framebuffer::raw& render_get_latest_screen() { return get_read_buffer().fbuf; } diff --git a/src/core/mainloop.cpp b/src/core/mainloop.cpp index 5ade24c3..cd4845f0 100644 --- a/src/core/mainloop.cpp +++ b/src/core/mainloop.cpp @@ -482,7 +482,7 @@ public: return random_seed_value; } - void output_frame(framebuffer_raw& screen, uint32_t fps_n, uint32_t fps_d) + void output_frame(framebuffer::raw& screen, uint32_t fps_n, uint32_t fps_d) { lua_callback_do_frame_emulated(); location_special = SPECIAL_FRAME_VIDEO; diff --git a/src/core/moviedata.cpp b/src/core/moviedata.cpp index a5d1480c..f78f580e 100644 --- a/src/core/moviedata.cpp +++ b/src/core/moviedata.cpp @@ -535,7 +535,7 @@ void do_load_state(struct moviefile& _movie, int lmode) movb.get_movie().readonly_mode(false); //Paint the screen. { - framebuffer_raw tmp; + framebuffer::raw tmp; if(will_load_state) { tmp.load(_movie.screenshot); redraw_framebuffer(tmp); diff --git a/src/core/rom.cpp b/src/core/rom.cpp index 36cde319..66b4dd22 100644 --- a/src/core/rom.cpp +++ b/src/core/rom.cpp @@ -48,7 +48,7 @@ namespace "Movie‣Loading‣Don't check savestates", false); //Framebuffer. - struct framebuffer_info null_fbinfo = { + struct framebuffer::info null_fbinfo = { &_pixel_format_bgr16, //Format. (char*)null_cover_fbmem, //Memory. 512, 448, 1024, //Physical size. @@ -100,8 +100,8 @@ namespace void c_runtosave() {} bool c_get_pflag() { return false; } void c_set_pflag(bool pflag) {} - framebuffer_raw& c_draw_cover() { - static framebuffer_raw x(null_fbinfo); + framebuffer::raw& c_draw_cover() { + static framebuffer::raw x(null_fbinfo); for(size_t i = 0; i < sizeof(null_cover_fbmem)/sizeof(null_cover_fbmem[0]); i++) null_cover_fbmem[i] = 0x0000; std::string message = "NO ROM LOADED"; diff --git a/src/core/subtitles.cpp b/src/core/subtitles.cpp index 4f6e6da7..e98adf27 100644 --- a/src/core/subtitles.cpp +++ b/src/core/subtitles.cpp @@ -76,26 +76,26 @@ namespace return y; } - struct render_object_subtitle : public render_object + struct render_object_subtitle : public framebuffer::object { render_object_subtitle(int32_t _x, int32_t _y, const std::string& _text) throw() : x(_x), y(_y), text(_text), fg(0xFFFF80), bg(-1) {} ~render_object_subtitle() throw() {} - template void op(struct framebuffer& scr) throw() + template void op(struct framebuffer::fb& scr) throw() { fg.set_palette(scr); bg.set_palette(scr); main_font.render(scr, x, y, text, fg, bg, false, false); } - void operator()(struct framebuffer& scr) throw() { op(scr); } - void operator()(struct framebuffer& scr) throw() { op(scr); } - void clone(render_queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void operator()(struct framebuffer::fb& scr) throw() { op(scr); } + void operator()(struct framebuffer::fb& scr) throw() { op(scr); } + void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } private: int32_t x; int32_t y; std::string text; - premultiplied_color fg; - premultiplied_color bg; + framebuffer::color fg; + framebuffer::color bg; }; diff --git a/src/core/window.cpp b/src/core/window.cpp index 8c9ba266..69fb0326 100644 --- a/src/core/window.cpp +++ b/src/core/window.cpp @@ -516,7 +516,7 @@ void platform::system_thread_available(bool av) throw() namespace { mutex_class _msgbuf_lock; - framebuffer* our_screen; + framebuffer::fb* our_screen; struct painter_listener { @@ -524,12 +524,12 @@ namespace { screenupdate.set(notify_screen_update, []() { graphics_driver_notify_screen(); }); statusupdate.set(notify_status_update, []() { graphics_driver_notify_status(); }); - setscreen.set(notify_set_screen, [](framebuffer& scr) { our_screen = &scr; }); + setscreen.set(notify_set_screen, [](framebuffer::fb& scr) { our_screen = &scr; }); } private: struct dispatch::target<> screenupdate; struct dispatch::target<> statusupdate; - struct dispatch::target&> setscreen; + struct dispatch::target&> setscreen; } x; } diff --git a/src/emulation/bsnes-legacy/bitmap.cpp b/src/emulation/bsnes-legacy/bitmap.cpp index 3ada9678..bc299c5f 100644 --- a/src/emulation/bsnes-legacy/bitmap.cpp +++ b/src/emulation/bsnes-legacy/bitmap.cpp @@ -66,7 +66,7 @@ namespace lua_palette* p = lua_class::create(L); for(unsigned j = 0; j < ps; j++) { if(j == 0 && ftrans) - p->colors.push_back(premultiplied_color(-1)); + p->colors.push_back(framebuffer::color(-1)); else { uint64_t val = 0; uint16_t c = lsnes_memory.read(addr + j * 2); @@ -75,7 +75,7 @@ namespace uint64_t b = (c >> 10) & 0x1F; val = (r << 19) | ((r << 14) & 0xFF0000) | (g << 11) | ((g << 6) & 0xFF00) | (b << 3) | (b >> 2); - p->colors.push_back(premultiplied_color(val)); + p->colors.push_back(framebuffer::color(val)); } } return 1; diff --git a/src/emulation/bsnes-legacy/core.cpp b/src/emulation/bsnes-legacy/core.cpp index 3a81c060..eb76e06c 100644 --- a/src/emulation/bsnes-legacy/core.cpp +++ b/src/emulation/bsnes-legacy/core.cpp @@ -91,7 +91,7 @@ namespace unsigned long long delayreset_cycles_target; //Framebuffer. - struct framebuffer_info cover_fbinfo = { + struct framebuffer::info cover_fbinfo = { &_pixel_format_lrgb, //Format. (char*)cover_fbmem, //Memory. 512, 448, 2048, //Physical size. @@ -880,8 +880,8 @@ again2: } bool c_get_pflag() { return SNES::cpu.controller_flag; } void c_set_pflag(bool pflag) { SNES::cpu.controller_flag = pflag; } - framebuffer_raw& c_draw_cover() { - static framebuffer_raw x(cover_fbinfo); + framebuffer::raw& c_draw_cover() { + static framebuffer::raw x(cover_fbinfo); redraw_cover_fbinfo(); return x; } @@ -1240,7 +1240,7 @@ again2: fps_n /= g; fps_d /= g; - framebuffer_info inf; + framebuffer::info inf; inf.type = &_pixel_format_lrgb; inf.mem = const_cast(reinterpret_cast(data)); inf.physwidth = 512; @@ -1251,7 +1251,7 @@ again2: inf.stride = interlace ? 2048 : 4096; inf.offset_x = 0; inf.offset_y = (region ? (overscan ? 9 : 1) : (overscan ? 16 : 9)) * 2; - framebuffer_raw ls(inf); + framebuffer::raw ls(inf); ecore_callbacks->output_frame(ls, fps_n, fps_d); if(soundbuf_fill > 0) { diff --git a/src/emulation/gambatte/core.cpp b/src/emulation/gambatte/core.cpp index cc938110..9bbd357f 100644 --- a/src/emulation/gambatte/core.cpp +++ b/src/emulation/gambatte/core.cpp @@ -109,7 +109,7 @@ namespace }; //Framebuffer. - struct framebuffer_info cover_fbinfo = { + struct framebuffer::info cover_fbinfo = { &_pixel_format_rgb32, //Format. (char*)cover_fbmem, //Memory. 480, 432, 1920, //Physical size. @@ -631,7 +631,7 @@ namespace break; } } - framebuffer_info inf; + framebuffer::info inf; inf.type = &_pixel_format_rgb32; inf.mem = const_cast(reinterpret_cast(primary_framebuffer)); inf.physwidth = 160; @@ -643,15 +643,15 @@ namespace inf.offset_x = 0; inf.offset_y = 0; - framebuffer_raw ls(inf); + framebuffer::raw ls(inf); ecore_callbacks->output_frame(ls, 262144, 4389); audioapi_submit_buffer(soundbuf, emitted / 2, true, native_rate ? 2097152 : 32768); } void c_runtosave() {} bool c_get_pflag() { return pflag; } void c_set_pflag(bool _pflag) { pflag = _pflag; } - framebuffer_raw& c_draw_cover() { - static framebuffer_raw x(cover_fbinfo); + framebuffer::raw& c_draw_cover() { + static framebuffer::raw x(cover_fbinfo); redraw_cover_fbinfo(); return x; } diff --git a/src/emulation/sky/sky.cpp b/src/emulation/sky/sky.cpp index 3ea0d576..f408e4ee 100644 --- a/src/emulation/sky/sky.cpp +++ b/src/emulation/sky/sky.cpp @@ -27,7 +27,7 @@ namespace sky //Framebuffer. uint32_t cover_fbmem[320*200]; - struct framebuffer_info cover_fbinfo = { + struct framebuffer::info cover_fbinfo = { &_pixel_format_rgb32, //Format. (char*)cover_fbmem, //Memory. 320, 200, 1280, //Physical size. @@ -308,7 +308,7 @@ namespace sky pflag = true; simulate_frame(corei, x); uint32_t* fb = corei.get_framebuffer(); - framebuffer_info inf; + framebuffer::info inf; inf.type = &_pixel_format_rgb32; inf.mem = const_cast(reinterpret_cast(fb)); inf.physwidth = FB_WIDTH; @@ -320,7 +320,7 @@ namespace sky inf.offset_x = 0; inf.offset_y = 0; - framebuffer_raw ls(inf); + framebuffer::raw ls(inf); ecore_callbacks->output_frame(ls, 656250, 18227); ecore_callbacks->timer_tick(18227, 656250); size_t samples = 1333; @@ -332,8 +332,8 @@ namespace sky void c_runtosave() {} bool c_get_pflag() { return pflag; } void c_set_pflag(bool _pflag) { pflag = _pflag; } - framebuffer_raw& c_draw_cover() { - static framebuffer_raw x(cover_fbinfo); + framebuffer::raw& c_draw_cover() { + static framebuffer::raw x(cover_fbinfo); return x; } std::string c_get_core_shortname() { return "sky"; } diff --git a/src/emulation/test/test.cpp b/src/emulation/test/test.cpp index 60027133..2875070d 100644 --- a/src/emulation/test/test.cpp +++ b/src/emulation/test/test.cpp @@ -44,7 +44,7 @@ namespace bool pflag = false; //Framebuffer. - struct framebuffer_info cover_fbinfo = { + struct framebuffer::info cover_fbinfo = { &_pixel_format_rgb32, //Format. (char*)cover_fbmem, //Memory. 480, 432, 1920, //Physical size. @@ -149,7 +149,7 @@ namespace int16_t audio[800] = {0}; pflag = false; redraw_screen(); - framebuffer_info inf; + framebuffer::info inf; inf.type = &_pixel_format_rgb32; inf.mem = const_cast(reinterpret_cast(cover_fbmem)); inf.physwidth = 480; @@ -160,15 +160,15 @@ namespace inf.stride = 1920; inf.offset_x = 0; inf.offset_y = 0; - framebuffer_raw ls(inf); + framebuffer::raw ls(inf); ecore_callbacks->output_frame(ls, 60,1); audioapi_submit_buffer(audio, 800, false, 48000); } void c_runtosave() {} bool c_get_pflag() { return pflag; } void c_set_pflag(bool _pflag) { pflag = _pflag; } - framebuffer_raw& c_draw_cover() { - static framebuffer_raw x(cover_fbinfo); + framebuffer::raw& c_draw_cover() { + static framebuffer::raw x(cover_fbinfo); redraw_cover_fbinfo(); return x; } diff --git a/src/fonts/wrapper.cpp b/src/fonts/wrapper.cpp index 20890d64..f9353de7 100644 --- a/src/fonts/wrapper.cpp +++ b/src/fonts/wrapper.cpp @@ -3,7 +3,7 @@ #include extern const char* font_hex_data; -bitmap_font main_font; +framebuffer::font main_font; void do_init_font() { diff --git a/src/interface/cover.cpp b/src/interface/cover.cpp index 9e30ff7b..1f777734 100644 --- a/src/interface/cover.cpp +++ b/src/interface/cover.cpp @@ -16,7 +16,7 @@ namespace unsigned char* _bg = reinterpret_cast(&bg); if(x >= w || y >= h) return; - const bitmap_font::glyph& g = main_font.get_glyph(ch); + const framebuffer::font::glyph& g = main_font.get_glyph(ch); unsigned maxw = min((size_t)(g.wide ? 16 : 8), (size_t)(w - x)); unsigned maxh = min((size_t)16, (size_t)(h - y)); unsigned char* cellbase = reinterpret_cast(fb) + y * istride + pstride * x; @@ -99,7 +99,7 @@ void cover_next_position(uint32_t ch, unsigned& x, unsigned& y) x = 0; y = y + 16; } else { - const bitmap_font::glyph& g = main_font.get_glyph(ch); + const framebuffer::font::glyph& g = main_font.get_glyph(ch); x = x + (g.wide ? 16 : 8); } } diff --git a/src/interface/romtype.cpp b/src/interface/romtype.cpp index 3faf63b3..f8c46d2f 100644 --- a/src/interface/romtype.cpp +++ b/src/interface/romtype.cpp @@ -511,7 +511,7 @@ void core_core::set_pflag(bool pflag) return c_set_pflag(pflag); } -framebuffer_raw& core_core::draw_cover() +framebuffer::raw& core_core::draw_cover() { return c_draw_cover(); } diff --git a/src/library/customfont.cpp b/src/library/customfont.cpp index 67a38e30..f4a977cc 100644 --- a/src/library/customfont.cpp +++ b/src/library/customfont.cpp @@ -37,8 +37,8 @@ namespace return ((glyph.glyph[ge] >> gb) & 1); } - template void _render(const font_glyph_data& glyph, framebuffer& fb, int32_t x, int32_t y, - premultiplied_color fg, premultiplied_color bg, premultiplied_color hl) + template void _render(const font_glyph_data& glyph, framebuffer::fb& fb, int32_t x, int32_t y, + framebuffer::color fg, framebuffer::color bg, framebuffer::color hl) { uint32_t xdc, xoff, xsize; uint32_t ydc, yoff, ysize; @@ -172,14 +172,14 @@ font_glyph_data::font_glyph_data(std::istream& s) } } -void font_glyph_data::render(framebuffer& fb, int32_t x, int32_t y, premultiplied_color fg, - premultiplied_color bg, premultiplied_color hl) const +void font_glyph_data::render(framebuffer::fb& fb, int32_t x, int32_t y, framebuffer::color fg, + framebuffer::color bg, framebuffer::color hl) const { _render(*this, fb, x, y, fg, bg, hl); } -void font_glyph_data::render(framebuffer& fb, int32_t x, int32_t y, premultiplied_color fg, - premultiplied_color bg, premultiplied_color hl) const +void font_glyph_data::render(framebuffer::fb& fb, int32_t x, int32_t y, framebuffer::color fg, + framebuffer::color bg, framebuffer::color hl) const { _render(*this, fb, x, y, fg, bg, hl); } @@ -236,11 +236,11 @@ custom_font::custom_font(const std::string& file) } } -custom_font::custom_font(struct bitmap_font& bfont) +custom_font::custom_font(struct framebuffer::font& bfont) { auto s = bfont.get_glyphs_set(); for(auto i = s.begin();;i++) { - const bitmap_font::glyph& j = (i != s.end()) ? bfont.get_glyph(*i) : bfont.get_bad_glyph(); + const framebuffer::font::glyph& j = (i != s.end()) ? bfont.get_glyph(*i) : bfont.get_bad_glyph(); font_glyph_data k; k.width = j.wide ? 16 : 8; k.height = 16; diff --git a/src/library/framebuffer.cpp b/src/library/framebuffer.cpp index 7f45cb73..627687a0 100644 --- a/src/library/framebuffer.cpp +++ b/src/library/framebuffer.cpp @@ -10,11 +10,13 @@ #define TABSTOPS 64 #define SCREENSHOT_RGB_MAGIC 0x74212536U +namespace framebuffer +{ namespace { - std::list& pixel_formats() + std::list& pixfmts() { - static std::list x; + static std::list x; return x; } @@ -93,21 +95,21 @@ namespace } } -pixel_format::pixel_format() throw(std::bad_alloc) +pixfmt::pixfmt() throw(std::bad_alloc) { - pixel_formats().push_back(this); + pixfmts().push_back(this); } -pixel_format::~pixel_format() throw() +pixfmt::~pixfmt() throw() { - for(auto i = pixel_formats().begin(); i != pixel_formats().end(); i++) + for(auto i = pixfmts().begin(); i != pixfmts().end(); i++) if(*i == this) { - pixel_formats().erase(i); + pixfmts().erase(i); break; } } -framebuffer_raw::framebuffer_raw(const framebuffer_info& info) throw(std::bad_alloc) +raw::raw(const info& info) throw(std::bad_alloc) { size_t unit = info.type->get_bpp(); size_t pixel_offset = info.offset_y * info.physstride + unit * info.offset_x; @@ -120,7 +122,7 @@ framebuffer_raw::framebuffer_raw(const framebuffer_info& info) throw(std::bad_al allocated = 0; } -framebuffer_raw::framebuffer_raw() throw(std::bad_alloc) +raw::raw() throw(std::bad_alloc) { user_memory = true; fmt = NULL; @@ -131,7 +133,7 @@ framebuffer_raw::framebuffer_raw() throw(std::bad_alloc) allocated = 0; } -framebuffer_raw::framebuffer_raw(const framebuffer_raw& f) throw(std::bad_alloc) +raw::raw(const raw& f) throw(std::bad_alloc) { user_memory = true; fmt = f.fmt; @@ -145,7 +147,7 @@ framebuffer_raw::framebuffer_raw(const framebuffer_raw& f) throw(std::bad_alloc) memcpy(addr + stride * i, f.addr + f.stride * i, unit * width); } -framebuffer_raw& framebuffer_raw::operator=(const framebuffer_raw& f) throw(std::bad_alloc, std::runtime_error) +raw& raw::operator=(const raw& f) throw(std::bad_alloc, std::runtime_error) { if(!user_memory) throw std::runtime_error("Target framebuffer is not writable"); @@ -168,19 +170,19 @@ framebuffer_raw& framebuffer_raw::operator=(const framebuffer_raw& f) throw(std: return *this; } -framebuffer_raw::~framebuffer_raw() +raw::~raw() { if(user_memory) delete[] addr; } -void framebuffer_raw::load(const std::vector& data) throw(std::bad_alloc, std::runtime_error) +void raw::load(const std::vector& data) throw(std::bad_alloc, std::runtime_error) { if(data.size() < 2) throw std::runtime_error("Bad screenshot data"); if(!user_memory) throw std::runtime_error("Target framebuffer is not writable"); - pixel_format* nfmt = NULL; + pixfmt* nfmt = NULL; const uint8_t* data2 = reinterpret_cast(&data[0]); size_t legacy_width = read16ube(data2); size_t dataoffset; @@ -189,7 +191,7 @@ void framebuffer_raw::load(const std::vector& data) throw(std::bad_alloc, if(legacy_width > 0 && data.size() % (3 * legacy_width) == 2) { //Legacy screenshot. - for(pixel_format* f : pixel_formats()) + for(pixfmt* f : pixfmts()) if(f->get_magic() == 0) nfmt = f; if(!nfmt) @@ -203,7 +205,7 @@ void framebuffer_raw::load(const std::vector& data) throw(std::bad_alloc, throw std::runtime_error("Bad screenshot data"); dataoffset = 8; uint32_t magic = read32ube(data2 + 2); - for(pixel_format* f : pixel_formats()) + for(pixfmt* f : pixfmts()) if(f->get_magic() == magic) nfmt = f; if(!nfmt) @@ -240,7 +242,7 @@ void framebuffer_raw::load(const std::vector& data) throw(std::bad_alloc, decode_words<4>(reinterpret_cast(addr), data2 + dataoffset, data.size() - dataoffset); } -void framebuffer_raw::save(std::vector& data) throw(std::bad_alloc) +void raw::save(std::vector& data) throw(std::bad_alloc) { uint8_t* memory = reinterpret_cast(addr); unsigned m; @@ -284,7 +286,7 @@ void framebuffer_raw::save(std::vector& data) throw(std::bad_alloc) } } -void framebuffer_raw::save_png(const std::string& file) throw(std::bad_alloc, std::runtime_error) +void raw::save_png(const std::string& file) throw(std::bad_alloc, std::runtime_error) { uint8_t* memory = reinterpret_cast(addr); png_encodedable_image img; @@ -302,13 +304,13 @@ void framebuffer_raw::save_png(const std::string& file) throw(std::bad_alloc, st } } -size_t framebuffer_raw::get_stride() const throw() { return stride; } -unsigned char* framebuffer_raw::get_start() const throw() { return reinterpret_cast(addr); } -pixel_format* framebuffer_raw::get_format() const throw() { return fmt; } +size_t raw::get_stride() const throw() { return stride; } +unsigned char* raw::get_start() const throw() { return reinterpret_cast(addr); } +pixfmt* raw::get_format() const throw() { return fmt; } template -framebuffer::framebuffer() throw() +fb::fb() throw() { width = 0; height = 0; @@ -328,7 +330,7 @@ framebuffer::framebuffer() throw() template -framebuffer::~framebuffer() throw() +fb::~fb() throw() { if(user_mem) delete[] mem; @@ -337,15 +339,15 @@ framebuffer::~framebuffer() throw() #define DECBUF_SIZE 4096 template -void framebuffer::copy_from(framebuffer_raw& scr, size_t hscale, size_t vscale) throw() +void fb::copy_from(raw& scr, size_t hscale, size_t vscale) throw() { - typename framebuffer::element_t decbuf[DECBUF_SIZE]; + typename fb::element_t decbuf[DECBUF_SIZE]; last_blit_w = scr.width * hscale; last_blit_h = scr.height * vscale; if(!scr.fmt) { for(size_t y = 0; y < height; y++) - memset(rowptr(y), 0, sizeof(typename framebuffer::element_t) * width); + memset(rowptr(y), 0, sizeof(typename fb::element_t) * width); return; } if(scr.fmt != current_fmt || active_rshift != auxpal.rshift || active_gshift != auxpal.gshift || @@ -355,7 +357,7 @@ void framebuffer::copy_from(framebuffer_raw& scr, size_t hscale, size_t vscal } for(size_t y = 0; y < height; y++) - memset(rowptr(y), 0, sizeof(typename framebuffer::element_t) * width); + memset(rowptr(y), 0, sizeof(typename fb::element_t) * width); if(width < offset_x || height < offset_y) { //Just clear the screen. return; @@ -371,7 +373,7 @@ void framebuffer::copy_from(framebuffer_raw& scr, size_t hscale, size_t vscal for(size_t y = 0; y < copyable_height; y++) { size_t line = y * vscale + offset_y; const uint8_t* sbase = reinterpret_cast(scr.addr) + y * scr.stride; - typename framebuffer::element_t* ptr = rowptr(line) + offset_x; + typename fb::element_t* ptr = rowptr(line) + offset_x; size_t bpp = scr.fmt->get_bpp(); size_t xptr = 0; size_t old_copyable_width = copyable_width; @@ -390,18 +392,18 @@ void framebuffer::copy_from(framebuffer_raw& scr, size_t hscale, size_t vscal copyable_width = old_copyable_width; for(size_t j = 1; j < vscale; j++) memcpy(rowptr(line + j) + offset_x, rowptr(line) + offset_x, - sizeof(typename framebuffer::element_t) * hscale * copyable_width); + sizeof(typename fb::element_t) * hscale * copyable_width); }; } template -void framebuffer::set_palette(uint32_t r, uint32_t g, uint32_t b) throw(std::bad_alloc) +void fb::set_palette(uint32_t r, uint32_t g, uint32_t b) throw(std::bad_alloc) { - typename framebuffer::element_t R, G, B; + typename fb::element_t R, G, B; if(r == active_rshift && g == active_gshift && b == active_bshift) return; for(size_t i = 0; i < static_cast(width) * height; i++) { - typename framebuffer::element_t word = mem[i]; + typename fb::element_t word = mem[i]; R = (word >> active_rshift) & (X ? 0xFFFF : 0xFF); G = (word >> active_gshift) & (X ? 0xFFFF : 0xFF); B = (word >> active_bshift) & (X ? 0xFFFF : 0xFF); @@ -413,7 +415,7 @@ void framebuffer::set_palette(uint32_t r, uint32_t g, uint32_t b) throw(std:: } template -void framebuffer::set(element_t* _memory, size_t _width, size_t _height, size_t _pitch) throw() +void fb::set(element_t* _memory, size_t _width, size_t _height, size_t _pitch) throw() { if(user_mem && mem) delete[] mem; @@ -426,7 +428,7 @@ void framebuffer::set(element_t* _memory, size_t _width, size_t _height, size } template -void framebuffer::reallocate(size_t _width, size_t _height, bool _upside_down) throw(std::bad_alloc) +void fb::reallocate(size_t _width, size_t _height, bool _upside_down) throw(std::bad_alloc) { if(width != _width || height != _height) { if(user_mem) { @@ -445,39 +447,39 @@ void framebuffer::reallocate(size_t _width, size_t _height, bool _upside_down } template -void framebuffer::set_origin(size_t _offset_x, size_t _offset_y) throw() +void fb::set_origin(size_t _offset_x, size_t _offset_y) throw() { offset_x = _offset_x; offset_y = _offset_y; } template -size_t framebuffer::get_width() const throw() +size_t fb::get_width() const throw() { return width; } template -size_t framebuffer::get_height() const throw() +size_t fb::get_height() const throw() { return height; } template -size_t framebuffer::get_last_blit_width() const throw() +size_t fb::get_last_blit_width() const throw() { return last_blit_w; } template -size_t framebuffer::get_last_blit_height() const throw() +size_t fb::get_last_blit_height() const throw() { return last_blit_h; } template -typename framebuffer::element_t* framebuffer::rowptr(size_t row) throw() +typename fb::element_t* fb::rowptr(size_t row) throw() { if(upside_down) row = height - row - 1; @@ -485,21 +487,21 @@ typename framebuffer::element_t* framebuffer::rowptr(size_t row) throw() } template -const typename framebuffer::element_t* framebuffer::rowptr(size_t row) const throw() +const typename fb::element_t* fb::rowptr(size_t row) const throw() { if(upside_down) row = height - row - 1; return mem + stride * row; } -template uint8_t framebuffer::get_palette_r() const throw() { return auxpal.rshift; } -template uint8_t framebuffer::get_palette_g() const throw() { return auxpal.gshift; } -template uint8_t framebuffer::get_palette_b() const throw() { return auxpal.bshift; } +template uint8_t fb::get_palette_r() const throw() { return auxpal.rshift; } +template uint8_t fb::get_palette_g() const throw() { return auxpal.gshift; } +template uint8_t fb::get_palette_b() const throw() { return auxpal.bshift; } -size_t framebuffer_raw::get_width() const throw() { return width; } -size_t framebuffer_raw::get_height() const throw() { return height; } -template size_t framebuffer::get_origin_x() const throw() { return offset_x; } -template size_t framebuffer::get_origin_y() const throw() { return offset_y; } +size_t raw::get_width() const throw() { return width; } +size_t raw::get_height() const throw() { return height; } +template size_t fb::get_origin_x() const throw() { return offset_x; } +template size_t fb::get_origin_y() const throw() { return offset_y; } void clip_range(uint32_t origin, uint32_t size, int32_t base, int32_t& minc, int32_t& maxc) throw() { @@ -523,7 +525,7 @@ void clip_range(uint32_t origin, uint32_t size, int32_t base, int32_t& minc, int } } -void render_queue::add(struct render_object& obj) throw(std::bad_alloc) +void queue::add(struct object& obj) throw(std::bad_alloc) { struct node* n = reinterpret_cast(alloc(sizeof(node))); n->obj = &obj; @@ -535,7 +537,7 @@ void render_queue::add(struct render_object& obj) throw(std::bad_alloc) queue_head = queue_tail = n; } -void render_queue::copy_from(render_queue& q) throw(std::bad_alloc) +void queue::copy_from(queue& q) throw(std::bad_alloc) { struct node* tmp = q.queue_head; while(tmp) { @@ -547,7 +549,7 @@ void render_queue::copy_from(render_queue& q) throw(std::bad_alloc) } } -template void render_queue::run(struct framebuffer& scr) throw() +template void queue::run(struct fb& scr) throw() { struct node* tmp = queue_head; while(tmp) { @@ -560,11 +562,11 @@ template void render_queue::run(struct framebuffer& scr) throw() } } -void render_queue::clear() throw() +void queue::clear() throw() { while(queue_head) { if(!queue_head->killed) - queue_head->obj->~render_object(); + queue_head->obj->~object(); queue_head = queue_head->next; } //Release all memory for reuse. @@ -573,7 +575,7 @@ void render_queue::clear() throw() queue_tail = NULL; } -void* render_queue::alloc(size_t block) throw(std::bad_alloc) +void* queue::alloc(size_t block) throw(std::bad_alloc) { block = (block + 15) / 16 * 16; if(block > RENDER_PAGE_SIZE) @@ -587,7 +589,7 @@ void* render_queue::alloc(size_t block) throw(std::bad_alloc) return mem; } -void render_queue::kill_request(void* obj) throw() +void queue::kill_request(void* obj) throw() { struct node* tmp = queue_head; while(tmp) { @@ -595,7 +597,7 @@ void render_queue::kill_request(void* obj) throw() if(!tmp->killed && tmp->obj->kill_request(obj)) { //Kill this request. tmp->killed = true; - tmp->obj->~render_object(); + tmp->obj->~object(); } tmp = tmp->next; } catch(...) { @@ -603,7 +605,7 @@ void render_queue::kill_request(void* obj) throw() } } -render_queue::render_queue() throw() +queue::queue() throw() { queue_head = NULL; queue_tail = NULL; @@ -611,20 +613,20 @@ render_queue::render_queue() throw() pages = 0; } -render_queue::~render_queue() throw() +queue::~queue() throw() { clear(); } -render_object::render_object() throw() +object::object() throw() { } -render_object::~render_object() throw() +object::~object() throw() { } -bool render_object::kill_request_ifeq(void* myobj, void* killobj) +bool object::kill_request_ifeq(void* myobj, void* killobj) { if(!killobj) return false; @@ -633,12 +635,12 @@ bool render_object::kill_request_ifeq(void* myobj, void* killobj) return false; } -bool render_object::kill_request(void* obj) throw() +bool object::kill_request(void* obj) throw() { return false; } -bitmap_font::bitmap_font() throw(std::bad_alloc) +font::font() throw(std::bad_alloc) { bad_glyph_data[0] = 0x018001AAU; bad_glyph_data[1] = 0x01800180U; @@ -648,7 +650,7 @@ bitmap_font::bitmap_font() throw(std::bad_alloc) bad_glyph.data = bad_glyph_data; } -void bitmap_font::load_hex_glyph(const char* data, size_t size) throw(std::bad_alloc, std::runtime_error) +void font::load_hex_glyph(const char* data, size_t size) throw(std::bad_alloc, std::runtime_error) { char buf2[8]; std::string line(data, data + size); @@ -678,7 +680,7 @@ void bitmap_font::load_hex_glyph(const char* data, size_t size) throw(std::bad_a glyphs[cp].offset = p; } -void bitmap_font::load_hex(const char* data, size_t size) throw(std::bad_alloc, std::runtime_error) +void font::load_hex(const char* data, size_t size) throw(std::bad_alloc, std::runtime_error) { const char* enddata = data + size; while(data != enddata) { @@ -701,7 +703,7 @@ void bitmap_font::load_hex(const char* data, size_t size) throw(std::bad_alloc, i.second.data = &memory[i.second.offset]; } -const bitmap_font::glyph& bitmap_font::get_glyph(uint32_t glyph) throw() +const font::glyph& font::get_glyph(uint32_t glyph) throw() { if(glyphs.count(glyph)) return glyphs[glyph]; @@ -709,7 +711,7 @@ const bitmap_font::glyph& bitmap_font::get_glyph(uint32_t glyph) throw() return bad_glyph; } -std::set bitmap_font::get_glyphs_set() +std::set font::get_glyphs_set() { std::set out; for(auto& i : glyphs) @@ -717,12 +719,12 @@ std::set bitmap_font::get_glyphs_set() return out; } -const bitmap_font::glyph& bitmap_font::get_bad_glyph() throw() +const font::glyph& font::get_bad_glyph() throw() { return bad_glyph; } -std::pair bitmap_font::get_metrics(const std::string& string) throw() +std::pair font::get_metrics(const std::string& string) throw() { size_t commit_width = 0; size_t commit_height = 0; @@ -760,7 +762,7 @@ std::pair bitmap_font::get_metrics(const std::string& string) th return std::make_pair(commit_width, commit_height); } -std::vector bitmap_font::dolayout(const std::string& string) throw(std::bad_alloc) +std::vector font::dolayout(const std::string& string) throw(std::bad_alloc) { //First, calculate the number of glyphs to draw. uint16_t utfstate = utf8_initial_state; @@ -807,8 +809,8 @@ std::vector bitmap_font::dolayout(const std::string& string return l; } -template void bitmap_font::render(struct framebuffer& scr, int32_t x, int32_t y, const std::string& text, - premultiplied_color fg, premultiplied_color bg, bool hdbl, bool vdbl) throw() +template void font::render(struct fb& scr, int32_t x, int32_t y, const std::string& text, + color fg, color bg, bool hdbl, bool vdbl) throw() { x += scr.get_origin_x(); y += scr.get_origin_y(); @@ -855,7 +857,7 @@ template void bitmap_font::render(struct framebuffer& scr, int32_t x, if(gy + ystart + ylength > sheight) ylength = sheight - (gy + ystart); if(g.data) for(size_t i = 0; i < ylength; i++) { - typename framebuffer::element_t* r = scr.rowptr(gy + ystart + i) + + typename fb::element_t* r = scr.rowptr(gy + ystart + i) + (gx + xstart); uint32_t _y = (i + ystart) >> (vdbl ? 1 : 0); uint32_t d = g.data[_y >> (g.wide ? 1 : 2)]; @@ -882,7 +884,7 @@ template void bitmap_font::render(struct framebuffer& scr, int32_t x, } else for(size_t i = 0; i < ylength; i++) { - typename framebuffer::element_t* r = scr.rowptr(gy + ystart + i) + + typename fb::element_t* r = scr.rowptr(gy + ystart + i) + (gx + xstart); for(size_t j = 0; j < xlength; j++) bg.apply(r[j]); @@ -892,7 +894,7 @@ template void bitmap_font::render(struct framebuffer& scr, int32_t x, } } -void premultiplied_color::set_palette(unsigned rshift, unsigned gshift, unsigned bshift, bool X) throw() +void color::set_palette(unsigned rshift, unsigned gshift, unsigned bshift, bool X) throw() { if(X) { uint64_t r = ((orig >> 16) & 0xFF) * 257; @@ -915,11 +917,12 @@ void premultiplied_color::set_palette(unsigned rshift, unsigned gshift, unsigned } } -template class framebuffer; -template class framebuffer; -template void render_queue::run(struct framebuffer&); -template void render_queue::run(struct framebuffer&); -template void bitmap_font::render(struct framebuffer& scr, int32_t x, int32_t y, const std::string& text, - premultiplied_color fg, premultiplied_color bg, bool hdbl, bool vdbl) throw(); -template void bitmap_font::render(struct framebuffer& scr, int32_t x, int32_t y, const std::string& text, - premultiplied_color fg, premultiplied_color bg, bool hdbl, bool vdbl) throw(); +template class fb; +template class fb; +template void queue::run(struct fb&); +template void queue::run(struct fb&); +template void font::render(struct fb& scr, int32_t x, int32_t y, const std::string& text, + color fg, color bg, bool hdbl, bool vdbl) throw(); +template void font::render(struct fb& scr, int32_t x, int32_t y, const std::string& text, + color fg, color bg, bool hdbl, bool vdbl) throw(); +} diff --git a/src/library/pixfmt-lrgb.cpp b/src/library/pixfmt-lrgb.cpp index aa3040ca..42fb80ff 100644 --- a/src/library/pixfmt-lrgb.cpp +++ b/src/library/pixfmt-lrgb.cpp @@ -22,7 +22,7 @@ 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 pixel_format_aux_palette& auxp) throw() + const framebuffer::auxpalette& auxp) throw() { const uint32_t* _src = reinterpret_cast(src); for(size_t i = 0; i < width; i++) @@ -30,14 +30,14 @@ void pixel_format_lrgb::decode(uint32_t* target, const uint8_t* src, size_t widt } void pixel_format_lrgb::decode(uint64_t* target, const uint8_t* src, size_t width, - const pixel_format_aux_palette& auxp) throw() + const framebuffer::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(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, +void pixel_format_lrgb::set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) { auxp.pcache.resize(0x80000); @@ -55,7 +55,7 @@ void pixel_format_lrgb::set_palette(pixel_format_aux_palette& auxp, uint8 auxp.bshift = bshift; } -void pixel_format_lrgb::set_palette(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, +void pixel_format_lrgb::set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) { auxp.pcache.resize(0x80000); diff --git a/src/library/pixfmt-rgb15.cpp b/src/library/pixfmt-rgb15.cpp index b858048f..b62be6ed 100644 --- a/src/library/pixfmt-rgb15.cpp +++ b/src/library/pixfmt-rgb15.cpp @@ -23,7 +23,7 @@ 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 pixel_format_aux_palette& auxp) throw() + const framebuffer::auxpalette& auxp) throw() { const uint16_t* _src = reinterpret_cast(src); for(size_t i = 0; i < width; i++) @@ -32,7 +32,7 @@ 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 pixel_format_aux_palette& auxp) throw() + const framebuffer::auxpalette& auxp) throw() { const uint16_t* _src = reinterpret_cast(src); for(size_t i = 0; i < width; i++) @@ -40,7 +40,7 @@ void pixel_format_rgb15::decode(uint64_t* target, const uint8_t* src, si } template -void pixel_format_rgb15::set_palette(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, +void pixel_format_rgb15::set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) { auxp.pcache.resize(0x8000); @@ -58,7 +58,7 @@ void pixel_format_rgb15::set_palette(pixel_format_aux_palette& au } template -void pixel_format_rgb15::set_palette(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, +void pixel_format_rgb15::set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) { auxp.pcache.resize(0x8000); diff --git a/src/library/pixfmt-rgb16.cpp b/src/library/pixfmt-rgb16.cpp index eb88bd10..4fd86597 100644 --- a/src/library/pixfmt-rgb16.cpp +++ b/src/library/pixfmt-rgb16.cpp @@ -22,7 +22,7 @@ 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 pixel_format_aux_palette& auxp) throw() + const framebuffer::auxpalette& auxp) throw() { const uint16_t* _src = reinterpret_cast(src); for(size_t i = 0; i < width; i++) @@ -31,7 +31,7 @@ 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 pixel_format_aux_palette& auxp) throw() + const framebuffer::auxpalette& auxp) throw() { const uint16_t* _src = reinterpret_cast(src); for(size_t i = 0; i < width; i++) @@ -39,7 +39,7 @@ void pixel_format_rgb16::decode(uint64_t* target, const uint8_t* src, si } template -void pixel_format_rgb16::set_palette(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, +void pixel_format_rgb16::set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) { auxp.pcache.resize(0x10000); @@ -57,7 +57,7 @@ void pixel_format_rgb16::set_palette(pixel_format_aux_palette& au } template -void pixel_format_rgb16::set_palette(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, +void pixel_format_rgb16::set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) { auxp.pcache.resize(0x10000); diff --git a/src/library/pixfmt-rgb24.cpp b/src/library/pixfmt-rgb24.cpp index 5ba3e667..28dfe353 100644 --- a/src/library/pixfmt-rgb24.cpp +++ b/src/library/pixfmt-rgb24.cpp @@ -24,7 +24,7 @@ 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 pixel_format_aux_palette& auxp) throw() + const framebuffer::auxpalette& auxp) throw() { for(size_t i = 0; i < width; i++) { target[i] = static_cast(src[3 * i + (uvswap ? 2 : 0)]) << auxp.rshift; @@ -35,7 +35,7 @@ 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 pixel_format_aux_palette& auxp) throw() + const framebuffer::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 +46,7 @@ void pixel_format_rgb24::decode(uint64_t* target, const uint8_t* src, si } template -void pixel_format_rgb24::set_palette(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, +void pixel_format_rgb24::set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) { auxp.rshift = rshift; @@ -56,7 +56,7 @@ void pixel_format_rgb24::set_palette(pixel_format_aux_palette& au } template -void pixel_format_rgb24::set_palette(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, +void pixel_format_rgb24::set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) { auxp.rshift = rshift; diff --git a/src/library/pixfmt-rgb32.cpp b/src/library/pixfmt-rgb32.cpp index 271b5d73..6914ee0c 100644 --- a/src/library/pixfmt-rgb32.cpp +++ b/src/library/pixfmt-rgb32.cpp @@ -10,7 +10,7 @@ void pixel_format_rgb32::decode(uint32_t* target, const uint8_t* src, size_t wid } void pixel_format_rgb32::decode(uint32_t* target, const uint8_t* src, size_t width, - const pixel_format_aux_palette& auxp) throw() + const framebuffer::auxpalette& auxp) throw() { const uint32_t* _src = reinterpret_cast(src); for(size_t i = 0; i < width; i++) { @@ -21,7 +21,7 @@ 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 pixel_format_aux_palette& auxp) throw() + const framebuffer::auxpalette& auxp) throw() { const uint32_t* _src = reinterpret_cast(src); for(size_t i = 0; i < width; i++) { @@ -32,7 +32,7 @@ void pixel_format_rgb32::decode(uint64_t* target, const uint8_t* src, size_t wid } } -void pixel_format_rgb32::set_palette(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, +void pixel_format_rgb32::set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) { auxp.rshift = rshift; @@ -41,7 +41,7 @@ void pixel_format_rgb32::set_palette(pixel_format_aux_palette& auxp, uint auxp.pcache.clear(); } -void pixel_format_rgb32::set_palette(pixel_format_aux_palette& auxp, uint8_t rshift, uint8_t gshift, +void pixel_format_rgb32::set_palette(framebuffer::auxpalette& auxp, uint8_t rshift, uint8_t gshift, uint8_t bshift) throw(std::bad_alloc) { auxp.rshift = rshift; diff --git a/src/lua/gui-arrow.cpp b/src/lua/gui-arrow.cpp index f2e78a5b..097639a5 100644 --- a/src/lua/gui-arrow.cpp +++ b/src/lua/gui-arrow.cpp @@ -10,15 +10,15 @@ namespace int _dyn[8] = { 1, 1, 0, 0,-1,-1, 0, 0}; int _dxp[8] = { 0, 1, 1, 0, 0,-1,-1, 0}; int _dyp[8] = { 1, 0, 0,-1,-1, 0, 0, 1}; - struct render_object_arrow : public render_object + struct render_object_arrow : public framebuffer::object { render_object_arrow(int32_t _x, int32_t _y, uint32_t _length, uint32_t _width, uint32_t _headwidth, uint32_t _headthickness, int _direction, bool _fill, - premultiplied_color _color) throw() + framebuffer::color _color) throw() : x(_x), y(_y), length(_length), width(_width), headwidth(_headwidth), headthickness(_headthickness), direction(_direction), fill(_fill), color(_color) {} ~render_object_arrow() throw() {} - template void op(struct framebuffer& scr) throw() + template void op(struct framebuffer::fb& scr) throw() { color.set_palette(scr); uint32_t originx = scr.get_origin_x(); @@ -42,9 +42,9 @@ namespace } } } - void operator()(struct framebuffer& scr) throw() { op(scr); } - void operator()(struct framebuffer& scr) throw() { op(scr); } - void clone(render_queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void operator()(struct framebuffer::fb& scr) throw() { op(scr); } + void operator()(struct framebuffer::fb& scr) throw() { op(scr); } + void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } private: std::pair offsetrange() { @@ -85,7 +85,7 @@ namespace uint32_t headthickness; int direction; bool fill; - premultiplied_color color; + framebuffer::color color; }; function_ptr_luafun gui_box(lua_func_misc, "gui.arrow", [](lua_state& L, const std::string& fname) -> int { diff --git a/src/lua/gui-bitmap.cpp b/src/lua/gui-bitmap.cpp index f647c6d4..99cef5b1 100644 --- a/src/lua/gui-bitmap.cpp +++ b/src/lua/gui-bitmap.cpp @@ -69,7 +69,7 @@ std::vector lua_dbitmap::save_png() const img.has_alpha = false; img.data.resize(width * height); for(size_t i = 0; i < width * height; i++) { - const premultiplied_color& c = pixels[i]; + const framebuffer::color& c = pixels[i]; if(c.origa != 256) img.has_alpha = true; img.data[i] = c.orig + ((uint32_t)(c.origa - (c.origa >> 7) + (c.origa >> 8)) << 24); @@ -93,7 +93,7 @@ std::vector lua_bitmap::save_png(const lua_palette& pal) const img.data[i] = pixels[i]; } for(size_t i = 0; i < pal.colors.size(); i++) { - const premultiplied_color& c = pal.colors[i]; + const framebuffer::color& c = pal.colors[i]; if(c.origa != 256) img.has_alpha = true; img.palette[i] = c.orig + ((uint32_t)(c.origa - (c.origa >> 7) + (c.origa >> 8)) << 24); @@ -108,7 +108,7 @@ namespace { const char* base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - struct render_object_bitmap : public render_object + struct render_object_bitmap : public framebuffer::object { render_object_bitmap(int32_t _x, int32_t _y, lua_obj_pin _bitmap, lua_obj_pin _palette) throw() @@ -137,7 +137,7 @@ namespace kill_request_ifeq(b2.object(), obj); } - template void composite_op(struct framebuffer& scr) throw() + template void composite_op(struct framebuffer::fb& scr) throw() { if(p) p->palette_mutex.lock(); @@ -145,7 +145,7 @@ namespace uint32_t originy = scr.get_origin_y(); size_t pallim = 0; size_t w, h; - premultiplied_color* palette; + framebuffer::color* palette; if(b) { palette = &p->colors[0]; for(auto& c : p->colors) @@ -164,10 +164,10 @@ namespace int32_t xmax = w; int32_t ymin = 0; int32_t ymax = h; - clip_range(originx, scr.get_width(), x, xmin, xmax); - clip_range(originy, scr.get_height(), y, ymin, ymax); + framebuffer::clip_range(originx, scr.get_width(), x, xmin, xmax); + framebuffer::clip_range(originy, scr.get_height(), y, ymin, ymax); for(int32_t r = ymin; r < ymax; r++) { - typename framebuffer::element_t* rptr = scr.rowptr(y + r + originy); + typename framebuffer::fb::element_t* rptr = scr.rowptr(y + r + originy); size_t eptr = x + xmin + originx; if(b) for(int32_t c = xmin; c < xmax; c++, eptr++) { @@ -182,9 +182,9 @@ namespace if(p) p->palette_mutex.unlock(); } - void operator()(struct framebuffer& x) throw() { composite_op(x); } - void operator()(struct framebuffer& x) throw() { composite_op(x); } - void clone(render_queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void operator()(struct framebuffer::fb& x) throw() { composite_op(x); } + void operator()(struct framebuffer::fb& x) throw() { composite_op(x); } + void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } private: int32_t x; int32_t y; @@ -230,7 +230,7 @@ namespace L.get_numeric_argument(4, c, fname.c_str()); lua_dbitmap* b = lua_class::create(L, w, h); for(size_t i = 0; i < b->width * b->height; i++) - b->pixels[i] = premultiplied_color(c); + b->pixels[i] = framebuffer::color(c); } else { uint16_t c = 0; L.get_numeric_argument(4, c, fname.c_str()); @@ -246,7 +246,7 @@ namespace lua_palette* p = lua_class::get(L, 1, fname.c_str()); uint16_t c = L.get_numeric_argument(2, fname.c_str()); int64_t nval = L.get_numeric_argument(3, fname.c_str()); - premultiplied_color nc(nval); + framebuffer::color nc(nval); //The mutex lock protects only the internals of colors array. if(p->colors.size() <= c) { p->palette_mutex.lock(); @@ -272,13 +272,13 @@ namespace int64_t c = L.get_numeric_argument(4, fname.c_str()); if(x >= b->width || y >= b->height) return 0; - b->pixels[y * b->width + x] = premultiplied_color(c); + b->pixels[y * b->width + x] = framebuffer::color(c); } else throw std::runtime_error("Expected BITMAP or DBITMAP as argument 1 for gui.bitmap_pset."); return 0; }); - inline int64_t demultiply_color(const premultiplied_color& c) + inline int64_t demultiply_color(const framebuffer::color& c) { if(!c.origa) return -1; @@ -391,18 +391,18 @@ namespace struct colorkey_none { bool iskey(uint16_t& c) const { return false; } - bool iskey(premultiplied_color& c) const { return false; } + bool iskey(framebuffer::color& c) const { return false; } }; struct colorkey_direct { colorkey_direct(uint64_t _ck) { - premultiplied_color c(_ck); + framebuffer::color c(_ck); ck = c.orig; cka = c.origa; } - bool iskey(premultiplied_color& c) const { return (c.orig == ck && c.origa == cka); } + bool iskey(framebuffer::color& c) const { return (c.orig == ck && c.origa == cka); } uint32_t ck; uint16_t cka; }; @@ -428,14 +428,14 @@ namespace } void copy(size_t didx, size_t sidx) { - premultiplied_color c = sarray[sidx]; + framebuffer::color c = sarray[sidx]; if(!ckey.iskey(c)) darray[didx] = c; } size_t swidth, sheight, dwidth, dheight; private: - premultiplied_color* sarray; - premultiplied_color* darray; + framebuffer::color* sarray; + framebuffer::color* darray; const colorkey& ckey; }; @@ -466,7 +466,7 @@ namespace template struct srcdest_paletted { - typedef premultiplied_color ptype; + typedef framebuffer::color ptype; srcdest_paletted(lua_dbitmap& dest, lua_bitmap& src, lua_palette& palette, const colorkey& _ckey) : ckey(_ckey), transparent(-1) { @@ -488,10 +488,10 @@ namespace size_t swidth, sheight, dwidth, dheight; private: uint16_t* sarray; - premultiplied_color* darray; - premultiplied_color* pal; + framebuffer::color* darray; + framebuffer::color* pal; uint32_t limit; - premultiplied_color transparent; + framebuffer::color transparent; const colorkey& ckey; }; @@ -580,7 +580,7 @@ namespace if(bitmap.d) { lua_dbitmap* b = lua_class::create(L, bitmap.w, bitmap.h); for(size_t i = 0; i < bitmap.w * bitmap.h; i++) - b->pixels[i] = premultiplied_color(bitmap.bitmap[i]); + b->pixels[i] = framebuffer::color(bitmap.bitmap[i]); return 1; } else { lua_bitmap* b = lua_class::create(L, bitmap.w, bitmap.h); @@ -589,7 +589,7 @@ namespace b->pixels[i] = bitmap.bitmap[i]; p->colors.resize(bitmap.palette.size()); for(size_t i = 0; i < bitmap.palette.size(); i++) - p->colors[i] = premultiplied_color(bitmap.palette[i]); + p->colors[i] = framebuffer::color(bitmap.palette[i]); return 2; } } @@ -723,12 +723,12 @@ namespace b->pixels[i] = img.data[i]; p->colors.resize(img.palette.size()); for(size_t i = 0; i < img.palette.size(); i++) - p->colors[i] = premultiplied_color(mangle_color(img.palette[i])); + p->colors[i] = framebuffer::color(mangle_color(img.palette[i])); return 2; } else { lua_dbitmap* b = lua_class::create(L, img.width, img.height); for(size_t i = 0; i < img.width * img.height; i++) - b->pixels[i] = premultiplied_color(mangle_color(img.data[i])); + b->pixels[i] = framebuffer::color(mangle_color(img.data[i])); return 1; } } @@ -815,18 +815,18 @@ namespace ca = 256 - parse_value(r[4]); int64_t clr; if(ca == 256) - p->colors.push_back(premultiplied_color(-1)); + p->colors.push_back(framebuffer::color(-1)); else - p->colors.push_back(premultiplied_color((ca << 24) | (cr << 16) + p->colors.push_back(framebuffer::color((ca << 24) | (cr << 16) | (cg << 8) | cb)); } else if(r = regex("[ \t]*([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]*", line)) { int64_t cr, cg, cb; cr = parse_value(r[1]); cg = parse_value(r[2]); cb = parse_value(r[3]); - p->colors.push_back(premultiplied_color((cr << 16) | (cg << 8) | cb)); + p->colors.push_back(framebuffer::color((cr << 16) | (cg << 8) | cb)); } else if(regex_match("[ \t]*transparent[ \t]*", line)) { - p->colors.push_back(premultiplied_color(-1)); + p->colors.push_back(framebuffer::color(-1)); } else if(!regex_match("[ \t]*(#.*)?", line)) throw std::runtime_error("Invalid line format (" + line + ")"); } @@ -866,7 +866,7 @@ namespace return 0; }); - inline premultiplied_color tadjust(premultiplied_color c, uint16_t adj) + inline framebuffer::color tadjust(framebuffer::color c, uint16_t adj) { uint32_t rgb = c.orig; uint32_t a = c.origa; @@ -874,9 +874,9 @@ namespace if(a > 256) a = 256; if(a == 0) - return premultiplied_color(-1); + return framebuffer::color(-1); else - return premultiplied_color(rgb | ((uint32_t)(256 - a) << 24)); + return framebuffer::color(rgb | ((uint32_t)(256 - a) << 24)); } function_ptr_luafun adjust_trans(lua_func_misc, "gui.adjust_transparency", [](lua_state& L, diff --git a/src/lua/gui-box.cpp b/src/lua/gui-box.cpp index c4ca03c9..919ac356 100644 --- a/src/lua/gui-box.cpp +++ b/src/lua/gui-box.cpp @@ -3,15 +3,15 @@ namespace { - struct render_object_box : public render_object + struct render_object_box : public framebuffer::object { render_object_box(int32_t _x, int32_t _y, int32_t _width, int32_t _height, - premultiplied_color _outline1, premultiplied_color _outline2, premultiplied_color _fill, + framebuffer::color _outline1, framebuffer::color _outline2, framebuffer::color _fill, int32_t _thickness) throw() : x(_x), y(_y), width(_width), height(_height), outline1(_outline1), outline2(_outline2), fill(_fill), thickness(_thickness) {} ~render_object_box() throw() {} - template void op(struct framebuffer& scr) throw() + template void op(struct framebuffer::fb& scr) throw() { outline1.set_palette(scr); outline2.set_palette(scr); @@ -22,10 +22,10 @@ namespace int32_t xmax = width; int32_t ymin = 0; int32_t ymax = height; - clip_range(originx, scr.get_width(), x, xmin, xmax); - clip_range(originy, scr.get_height(), y, ymin, ymax); + framebuffer::clip_range(originx, scr.get_width(), x, xmin, xmax); + framebuffer::clip_range(originy, scr.get_height(), y, ymin, ymax); for(int32_t r = ymin; r < ymax; r++) { - typename framebuffer::element_t* rptr = scr.rowptr(y + r + originy); + typename framebuffer::fb::element_t* rptr = scr.rowptr(y + r + originy); size_t eptr = x + xmin + originx; for(int32_t c = xmin; c < xmax; c++, eptr++) if((r < thickness && r <= (width - c)) || (c < thickness && c < (height - r))) @@ -37,17 +37,17 @@ namespace fill.apply(rptr[eptr]); } } - void operator()(struct framebuffer& scr) throw() { op(scr); } - void operator()(struct framebuffer& scr) throw() { op(scr); } - void clone(render_queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void operator()(struct framebuffer::fb& scr) throw() { op(scr); } + void operator()(struct framebuffer::fb& scr) throw() { op(scr); } + void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } private: int32_t x; int32_t y; int32_t width; int32_t height; - premultiplied_color outline1; - premultiplied_color outline2; - premultiplied_color fill; + framebuffer::color outline1; + framebuffer::color outline2; + framebuffer::color fill; int32_t thickness; }; @@ -66,9 +66,9 @@ namespace L.get_numeric_argument(6, outline1, fname.c_str()); L.get_numeric_argument(7, outline2, fname.c_str()); L.get_numeric_argument(8, fill, fname.c_str()); - premultiplied_color poutline1(outline1); - premultiplied_color poutline2(outline2); - premultiplied_color pfill(fill); + framebuffer::color poutline1(outline1); + framebuffer::color poutline2(outline2); + framebuffer::color pfill(fill); lua_render_ctx->queue->create_add(x, y, width, height, poutline1, poutline2, pfill, thickness); return 0; diff --git a/src/lua/gui-circle.cpp b/src/lua/gui-circle.cpp index 96b044e0..7ec49131 100644 --- a/src/lua/gui-circle.cpp +++ b/src/lua/gui-circle.cpp @@ -3,10 +3,10 @@ namespace { - struct render_object_circle : public render_object + struct render_object_circle : public framebuffer::object { render_object_circle(int32_t _x, int32_t _y, uint32_t _radius, - premultiplied_color _outline, premultiplied_color _fill, uint32_t _thickness) throw() + framebuffer::color _outline, framebuffer::color _fill, uint32_t _thickness) throw() : x(_x), y(_y), outline(_outline), fill(_fill) { radius = _radius; @@ -18,7 +18,7 @@ namespace (_radius - _thickness); } ~render_object_circle() throw() {} - template void op(struct framebuffer& scr) throw() + template void op(struct framebuffer::fb& scr) throw() { outline.set_palette(scr); fill.set_palette(scr); @@ -28,11 +28,11 @@ namespace int32_t xmax = radius; int32_t ymin = -radius; int32_t ymax = radius; - clip_range(originx, scr.get_width(), x, xmin, xmax); - clip_range(originy, scr.get_height(), y, ymin, ymax); + framebuffer::clip_range(originx, scr.get_width(), x, xmin, xmax); + framebuffer::clip_range(originy, scr.get_height(), y, ymin, ymax); for(int32_t r = ymin; r < ymax; r++) { uint64_t pd2 = static_cast(r) * r; - typename framebuffer::element_t* rptr = scr.rowptr(y + r + originy); + typename framebuffer::fb::element_t* rptr = scr.rowptr(y + r + originy); size_t eptr = x + xmin + originx; for(int32_t c = xmin; c < xmax; c++, eptr++) { uint64_t fd2 = pd2 + static_cast(c) * c; @@ -45,17 +45,17 @@ namespace } } } - void operator()(struct framebuffer& scr) throw() { op(scr); } - void operator()(struct framebuffer& scr) throw() { op(scr); } - void clone(render_queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void operator()(struct framebuffer::fb& scr) throw() { op(scr); } + void operator()(struct framebuffer::fb& scr) throw() { op(scr); } + void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } private: int32_t x; int32_t y; int32_t radius; uint64_t radius2; uint64_t iradius2; - premultiplied_color outline; - premultiplied_color fill; + framebuffer::color outline; + framebuffer::color fill; }; function_ptr_luafun gui_rectangle(lua_func_misc, "gui.circle", [](lua_state& L, const std::string& fname) @@ -71,8 +71,8 @@ namespace L.get_numeric_argument(4, thickness, fname.c_str()); L.get_numeric_argument(5, outline, fname.c_str()); L.get_numeric_argument(6, fill, fname.c_str()); - premultiplied_color poutline(outline); - premultiplied_color pfill(fill); + framebuffer::color poutline(outline); + framebuffer::color pfill(fill); lua_render_ctx->queue->create_add(x, y, radius, poutline, pfill, thickness); return 0; }); diff --git a/src/lua/gui-crosshair.cpp b/src/lua/gui-crosshair.cpp index 54b3e839..e7696a62 100644 --- a/src/lua/gui-crosshair.cpp +++ b/src/lua/gui-crosshair.cpp @@ -3,12 +3,12 @@ namespace { - struct render_object_crosshair : public render_object + struct render_object_crosshair : public framebuffer::object { - render_object_crosshair(int32_t _x, int32_t _y, premultiplied_color _color, uint32_t _length) throw() + render_object_crosshair(int32_t _x, int32_t _y, framebuffer::color _color, uint32_t _length) throw() : x(_x), y(_y), color(_color), length(_length) {} ~render_object_crosshair() throw() {} - template void op(struct framebuffer& scr) throw() + template void op(struct framebuffer::fb& scr) throw() { color.set_palette(scr); uint32_t originx = scr.get_origin_x(); @@ -17,8 +17,8 @@ namespace int32_t xmax = static_cast(length + 1); int32_t ymin = -static_cast(length); int32_t ymax = static_cast(length + 1); - clip_range(originx, scr.get_width(), x, xmin, xmax); - clip_range(originy, scr.get_height(), y, ymin, ymax); + framebuffer::clip_range(originx, scr.get_width(), x, xmin, xmax); + framebuffer::clip_range(originy, scr.get_height(), y, ymin, ymax); if(xmin <= 0 && xmax > 0) for(int32_t r = ymin; r < ymax; r++) color.apply(scr.rowptr(y + r + originy)[x + originx]); @@ -26,13 +26,13 @@ namespace for(int32_t r = xmin; r < xmax; r++) color.apply(scr.rowptr(y + originy)[x + r + originx]); } - void operator()(struct framebuffer& scr) throw() { op(scr); } - void operator()(struct framebuffer& scr) throw() { op(scr); } - void clone(render_queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void operator()(struct framebuffer::fb& scr) throw() { op(scr); } + void operator()(struct framebuffer::fb& scr) throw() { op(scr); } + void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } private: int32_t x; int32_t y; - premultiplied_color color; + framebuffer::color color; uint32_t length; }; @@ -46,7 +46,7 @@ namespace int32_t y = L.get_numeric_argument(2, fname.c_str()); L.get_numeric_argument(3, length, fname.c_str()); L.get_numeric_argument(4, color, fname.c_str()); - premultiplied_color pcolor(color); + framebuffer::color pcolor(color); lua_render_ctx->queue->create_add(x, y, pcolor, length); return 0; }); diff --git a/src/lua/gui-line.cpp b/src/lua/gui-line.cpp index 198569f0..528ba078 100644 --- a/src/lua/gui-line.cpp +++ b/src/lua/gui-line.cpp @@ -3,13 +3,13 @@ namespace { - struct render_object_line : public render_object + struct render_object_line : public framebuffer::object { - render_object_line(int32_t _x1, int32_t _x2, int32_t _y1, int32_t _y2, premultiplied_color _color) + render_object_line(int32_t _x1, int32_t _x2, int32_t _y1, int32_t _y2, framebuffer::color _color) throw() : x1(_x1), y1(_y1), x2(_x2), y2(_y2), color(_color) {} ~render_object_line() throw() {} - template void op(struct framebuffer& scr) throw() + template void op(struct framebuffer::fb& scr) throw() { size_t swidth = scr.get_width(); size_t sheight = scr.get_height(); @@ -78,15 +78,15 @@ nodraw2: } } } - void operator()(struct framebuffer& scr) throw() { op(scr); } - void operator()(struct framebuffer& scr) throw() { op(scr); } - void clone(render_queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void operator()(struct framebuffer::fb& scr) throw() { op(scr); } + void operator()(struct framebuffer::fb& scr) throw() { op(scr); } + void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } private: int32_t x1; int32_t y1; int32_t x2; int32_t y2; - premultiplied_color color; + framebuffer::color color; }; function_ptr_luafun gui_pixel(lua_func_misc, "gui.line", [](lua_state& L, const std::string& fname) -> int { @@ -98,7 +98,7 @@ nodraw2: int32_t x2 = L.get_numeric_argument(3, fname.c_str()); int32_t y2 = L.get_numeric_argument(4, fname.c_str()); L.get_numeric_argument(5, color, fname.c_str()); - premultiplied_color pcolor(color); + framebuffer::color pcolor(color); lua_render_ctx->queue->create_add(x1, x2, y1, y2, pcolor); return 0; }); diff --git a/src/lua/gui-pixel.cpp b/src/lua/gui-pixel.cpp index 6b8d72f3..0baa4b6c 100644 --- a/src/lua/gui-pixel.cpp +++ b/src/lua/gui-pixel.cpp @@ -3,12 +3,12 @@ namespace { - struct render_object_pixel : public render_object + struct render_object_pixel : public framebuffer::object { - render_object_pixel(int32_t _x, int32_t _y, premultiplied_color _color) throw() + render_object_pixel(int32_t _x, int32_t _y, framebuffer::color _color) throw() : x(_x), y(_y), color(_color) {} ~render_object_pixel() throw() {} - template void op(struct framebuffer& scr) throw() + template void op(struct framebuffer::fb& scr) throw() { color.set_palette(scr); int32_t _x = x + scr.get_origin_x(); @@ -19,13 +19,13 @@ namespace return; color.apply(scr.rowptr(_y)[_x]); } - void operator()(struct framebuffer& scr) throw() { op(scr); } - void operator()(struct framebuffer& scr) throw() { op(scr); } - void clone(render_queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void operator()(struct framebuffer::fb& scr) throw() { op(scr); } + void operator()(struct framebuffer::fb& scr) throw() { op(scr); } + void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } private: int32_t x; int32_t y; - premultiplied_color color; + framebuffer::color color; }; function_ptr_luafun gui_pixel(lua_func_misc, "gui.pixel", [](lua_state& L, const std::string& fname) -> int { @@ -35,7 +35,7 @@ namespace int32_t x = L.get_numeric_argument(1, fname.c_str()); int32_t y = L.get_numeric_argument(2, fname.c_str()); L.get_numeric_argument(3, color, fname.c_str()); - premultiplied_color pcolor(color); + framebuffer::color pcolor(color); lua_render_ctx->queue->create_add(x, y, pcolor); return 0; }); diff --git a/src/lua/gui-rectangle.cpp b/src/lua/gui-rectangle.cpp index 69c465ab..c92f4fe0 100644 --- a/src/lua/gui-rectangle.cpp +++ b/src/lua/gui-rectangle.cpp @@ -3,14 +3,14 @@ namespace { - struct render_object_rectangle : public render_object + struct render_object_rectangle : public framebuffer::object { render_object_rectangle(int32_t _x, int32_t _y, int32_t _width, int32_t _height, - premultiplied_color _outline, premultiplied_color _fill, int32_t _thickness) throw() + framebuffer::color _outline, framebuffer::color _fill, int32_t _thickness) throw() : x(_x), y(_y), width(_width), height(_height), outline(_outline), fill(_fill), thickness(_thickness) {} ~render_object_rectangle() throw() {} - template void op(struct framebuffer& scr) throw() + template void op(struct framebuffer::fb& scr) throw() { outline.set_palette(scr); fill.set_palette(scr); @@ -20,10 +20,10 @@ namespace int32_t xmax = width; int32_t ymin = 0; int32_t ymax = height; - clip_range(originx, scr.get_width(), x, xmin, xmax); - clip_range(originy, scr.get_height(), y, ymin, ymax); + framebuffer::clip_range(originx, scr.get_width(), x, xmin, xmax); + framebuffer::clip_range(originy, scr.get_height(), y, ymin, ymax); for(int32_t r = ymin; r < ymax; r++) { - typename framebuffer::element_t* rptr = scr.rowptr(y + r + originy); + typename framebuffer::fb::element_t* rptr = scr.rowptr(y + r + originy); size_t eptr = x + xmin + originx; for(int32_t c = xmin; c < xmax; c++, eptr++) if(r < thickness || c < thickness || r >= height - thickness || @@ -33,16 +33,16 @@ namespace fill.apply(rptr[eptr]); } } - void operator()(struct framebuffer& scr) throw() { op(scr); } - void operator()(struct framebuffer& scr) throw() { op(scr); } - void clone(render_queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void operator()(struct framebuffer::fb& scr) throw() { op(scr); } + void operator()(struct framebuffer::fb& scr) throw() { op(scr); } + void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } private: int32_t x; int32_t y; int32_t width; int32_t height; - premultiplied_color outline; - premultiplied_color fill; + framebuffer::color outline; + framebuffer::color fill; int32_t thickness; }; @@ -60,8 +60,8 @@ namespace L.get_numeric_argument(5, thickness, fname.c_str()); L.get_numeric_argument(6, outline, fname.c_str()); L.get_numeric_argument(7, fill, fname.c_str()); - premultiplied_color poutline(outline); - premultiplied_color pfill(fill); + framebuffer::color poutline(outline); + framebuffer::color pfill(fill); lua_render_ctx->queue->create_add(x, y, width, height, poutline, pfill, thickness); return 0; diff --git a/src/lua/gui-rqueue.cpp b/src/lua/gui-rqueue.cpp index 7b743bb7..126b76bf 100644 --- a/src/lua/gui-rqueue.cpp +++ b/src/lua/gui-rqueue.cpp @@ -28,7 +28,7 @@ namespace return (stringfmt() << s << " " << ((s != 1) ? "objects" : "object")).str(); } private: - render_queue rqueue; + framebuffer::queue rqueue; lua_render_context lctx; }; diff --git a/src/lua/gui-text-cf.cpp b/src/lua/gui-text-cf.cpp index a4e07841..1ac7952b 100644 --- a/src/lua/gui-text-cf.cpp +++ b/src/lua/gui-text-cf.cpp @@ -32,15 +32,15 @@ DECLARE_LUACLASS(lua_customfont, "CUSTOMFONT"); namespace { - struct render_object_text_cf : public render_object + struct render_object_text_cf : public framebuffer::object { - render_object_text_cf(int32_t _x, int32_t _y, const std::string& _text, premultiplied_color _fg, - premultiplied_color _bg, premultiplied_color _hl, lua_obj_pin _font) throw() + render_object_text_cf(int32_t _x, int32_t _y, const std::string& _text, framebuffer::color _fg, + framebuffer::color _bg, framebuffer::color _hl, lua_obj_pin _font) throw() : x(_x), y(_y), text(_text), fg(_fg), bg(_bg), hl(_hl), font(_font) {} ~render_object_text_cf() throw() { } - template void op(struct framebuffer& scr) throw() + template void op(struct framebuffer::fb& scr) throw() { fg.set_palette(scr); bg.set_palette(scr); @@ -79,16 +79,16 @@ namespace { return kill_request_ifeq(font.object(), obj); } - void operator()(struct framebuffer& scr) throw() { op(scr); } - void operator()(struct framebuffer& scr) throw() { op(scr); } - void clone(render_queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void operator()(struct framebuffer::fb& scr) throw() { op(scr); } + void operator()(struct framebuffer::fb& scr) throw() { op(scr); } + void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } private: int32_t x; int32_t y; std::string text; - premultiplied_color fg; - premultiplied_color bg; - premultiplied_color hl; + framebuffer::color fg; + framebuffer::color bg; + framebuffer::color hl; lua_obj_pin font; }; @@ -132,9 +132,9 @@ namespace L.get_numeric_argument(7, hlc, fname.c_str()); std::string text = L.get_string(4, fname.c_str()); auto f = lua_class::pin(L, 1, fname.c_str()); - premultiplied_color fg(fgc); - premultiplied_color bg(bgc); - premultiplied_color hl(hlc); + framebuffer::color fg(fgc); + framebuffer::color bg(bgc); + framebuffer::color hl(hlc); lua_render_ctx->queue->create_add(_x, _y, text, fg, bg, hl, f); return 0; } diff --git a/src/lua/gui-text.cpp b/src/lua/gui-text.cpp index a32ba381..c65d6108 100644 --- a/src/lua/gui-text.cpp +++ b/src/lua/gui-text.cpp @@ -4,27 +4,27 @@ namespace { - struct render_object_text : public render_object + struct render_object_text : public framebuffer::object { - render_object_text(int32_t _x, int32_t _y, const std::string& _text, premultiplied_color _fg, - premultiplied_color _bg, bool _hdbl = false, bool _vdbl = false) throw() + render_object_text(int32_t _x, int32_t _y, const std::string& _text, framebuffer::color _fg, + framebuffer::color _bg, bool _hdbl = false, bool _vdbl = false) throw() : x(_x), y(_y), text(_text), fg(_fg), bg(_bg), hdbl(_hdbl), vdbl(_vdbl) {} ~render_object_text() throw() {} - template void op(struct framebuffer& scr) throw() + template void op(struct framebuffer::fb& scr) throw() { fg.set_palette(scr); bg.set_palette(scr); main_font.render(scr, x, y, text, fg, bg, hdbl, vdbl); } - void operator()(struct framebuffer& scr) throw() { op(scr); } - void operator()(struct framebuffer& scr) throw() { op(scr); } - void clone(render_queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void operator()(struct framebuffer::fb& scr) throw() { op(scr); } + void operator()(struct framebuffer::fb& scr) throw() { op(scr); } + void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } private: int32_t x; int32_t y; std::string text; - premultiplied_color fg; - premultiplied_color bg; + framebuffer::color fg; + framebuffer::color bg; bool hdbl; bool vdbl; }; @@ -40,8 +40,8 @@ namespace L.get_numeric_argument(4, fgc, fname.c_str()); L.get_numeric_argument(5, bgc, fname.c_str()); std::string text = L.get_string(3, fname.c_str()); - premultiplied_color fg(fgc); - premultiplied_color bg(bgc); + framebuffer::color fg(fgc); + framebuffer::color bg(bgc); lua_render_ctx->queue->create_add(_x, _y, text, fg, bg, hdbl, vdbl); return 0; } diff --git a/src/lua/gui-tilemap.cpp b/src/lua/gui-tilemap.cpp index cd135d16..0ac3ecea 100644 --- a/src/lua/gui-tilemap.cpp +++ b/src/lua/gui-tilemap.cpp @@ -160,7 +160,7 @@ namespace mutex_class mutex; }; - struct render_object_tilemap : public render_object + struct render_object_tilemap : public framebuffer::object { render_object_tilemap(int32_t _x, int32_t _y, int32_t _x0, int32_t _y0, uint32_t _w, uint32_t _h, lua_obj_pin _map) @@ -172,7 +172,7 @@ namespace { return kill_request_ifeq(map.object(), obj); } - template void composite_op(struct framebuffer& scr) throw() + template void composite_op(struct framebuffer::fb& scr) throw() { tilemap& _map = *map; umutex_class h(_map.mutex); @@ -184,7 +184,7 @@ namespace } } } - template void composite_op(struct framebuffer& scr, int32_t xp, + template void composite_op(struct framebuffer::fb& scr, int32_t xp, int32_t yp, int32_t xmin, int32_t xmax, int32_t ymin, int32_t ymax, lua_dbitmap& d) throw() { if(xmin >= xmax || ymin >= ymax) return; @@ -192,26 +192,26 @@ namespace c.set_palette(scr); for(int32_t r = ymin; r < ymax; r++) { - typename framebuffer::element_t* rptr = scr.rowptr(yp + r); + typename framebuffer::fb::element_t* rptr = scr.rowptr(yp + r); size_t eptr = xp + xmin; for(int32_t c = xmin; c < xmax; c++, eptr++) d.pixels[r * d.width + c].apply(rptr[eptr]); } } - template void composite_op(struct framebuffer& scr, int32_t xp, + template void composite_op(struct framebuffer::fb& scr, int32_t xp, int32_t yp, int32_t xmin, int32_t xmax, int32_t ymin, int32_t ymax, lua_bitmap& b, lua_palette& p) throw() { if(xmin >= xmax || ymin >= ymax) return; p.palette_mutex.lock(); - premultiplied_color* palette = &p.colors[0]; + framebuffer::color* palette = &p.colors[0]; for(auto& c : p.colors) c.set_palette(scr); size_t pallim = p.colors.size(); for(int32_t r = ymin; r < ymax; r++) { - typename framebuffer::element_t* rptr = scr.rowptr(yp + r); + typename framebuffer::fb::element_t* rptr = scr.rowptr(yp + r); size_t eptr = xp + xmin; for(int32_t c = xmin; c < xmax; c++, eptr++) { uint16_t i = b.pixels[r * b.width + c]; @@ -221,7 +221,7 @@ namespace } p.palette_mutex.unlock(); } - template void composite_op(struct framebuffer& scr, tilemap_entry& e, int32_t bx, + template void composite_op(struct framebuffer::fb& scr, tilemap_entry& e, int32_t bx, int32_t by) throw() { size_t _w, _h; @@ -262,9 +262,9 @@ namespace if(scrc + cmax > bc + d) cmax = bc + d - scrc; } - void operator()(struct framebuffer& x) throw() { composite_op(x); } - void operator()(struct framebuffer& x) throw() { composite_op(x); } - void clone(render_queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void operator()(struct framebuffer::fb& x) throw() { composite_op(x); } + void operator()(struct framebuffer::fb& x) throw() { composite_op(x); } + void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } private: int32_t x; int32_t y; diff --git a/src/lua/screenshot.cpp b/src/lua/screenshot.cpp index 7093b12e..aaffd149 100644 --- a/src/lua/screenshot.cpp +++ b/src/lua/screenshot.cpp @@ -13,7 +13,7 @@ namespace function_ptr_luafun lua_gui_screenshot_b(lua_func_misc, "gui.screenshot_bitmap", [](lua_state& L, const std::string& fname) -> int { - framebuffer_raw& _fb = render_get_latest_screen(); + framebuffer::raw& _fb = render_get_latest_screen(); try { auto osize = std::make_pair(_fb.get_width(), _fb.get_height()); std::vector tmp(_fb.get_width()); @@ -22,7 +22,7 @@ namespace _fb.get_format()->decode(&tmp[0], _fb.get_start() + _fb.get_stride() * y, _fb.get_width()); for(size_t x = 0; x < osize.first; x++) - b->pixels[y * b->width + x] = premultiplied_color(tmp[x]); + b->pixels[y * b->width + x] = framebuffer::color(tmp[x]); } } catch(...) { render_get_latest_screen_end(); diff --git a/src/platform/wxwidgets/editor-movie.cpp b/src/platform/wxwidgets/editor-movie.cpp index 76dd925a..03ea0516 100644 --- a/src/platform/wxwidgets/editor-movie.cpp +++ b/src/platform/wxwidgets/editor-movie.cpp @@ -1397,8 +1397,8 @@ void wxeditor_movie::_moviepanel::popup_axis_panel(uint64_t row, control_info ci }); signal_repaint(); } else if(ci.axistype == port_controller_button::TYPE_LIGHTGUN) { - framebuffer_raw& _fb = render_get_latest_screen(); - framebuffer fb; + framebuffer::raw& _fb = render_get_latest_screen(); + framebuffer::fb fb; auto osize = std::make_pair(_fb.get_width(), _fb.get_height()); auto size = our_rom.rtype->lightgun_scale(); fb.reallocate(osize.first, osize.second, false); diff --git a/src/platform/wxwidgets/editor-tasinput.cpp b/src/platform/wxwidgets/editor-tasinput.cpp index f5f2505d..cf596608 100644 --- a/src/platform/wxwidgets/editor-tasinput.cpp +++ b/src/platform/wxwidgets/editor-tasinput.cpp @@ -248,8 +248,8 @@ void wxeditor_tasinput::xypanel::on_paint(wxPaintEvent& e) wxPaintDC dc(graphics); if(lightgun) { //Draw the current screen. - framebuffer_raw& _fb = render_get_latest_screen(); - framebuffer fb; + framebuffer::raw& _fb = render_get_latest_screen(); + framebuffer::fb fb; auto osize = std::make_pair(_fb.get_width(), _fb.get_height()); auto size = our_rom.rtype->lightgun_scale(); fb.reallocate(osize.first, osize.second, false); diff --git a/src/platform/wxwidgets/textrender.cpp b/src/platform/wxwidgets/textrender.cpp index b6f44bf7..cb62f11a 100644 --- a/src/platform/wxwidgets/textrender.cpp +++ b/src/platform/wxwidgets/textrender.cpp @@ -58,7 +58,7 @@ void text_framebuffer::render(char* tbuffer) break; //No more space in row. char* cellbase = tbuffer + y * (16 * stride) + xp * cellstride; const element& e = buffer[y * width + x]; - const bitmap_font::glyph& g = main_font.get_glyph(e.ch); + const framebuffer::font::glyph& g = main_font.get_glyph(e.ch); char bgb = (e.bg >> 16); char bgg = (e.bg >> 8); char bgr = (e.bg >> 0); @@ -155,7 +155,7 @@ size_t text_framebuffer::write(const std::string& str, size_t w, size_t x, size_ continue; } //Okay, got u to write... - const bitmap_font::glyph& g = main_font.get_glyph(u); + const framebuffer::font::glyph& g = main_font.get_glyph(u); if(x < width) { element& e = buffer[y * width + x]; e.ch = u; @@ -190,7 +190,7 @@ size_t text_framebuffer::write(const std::u32string& str, size_t w, size_t x, si size_t slen = str.length(); size_t pused = 0; for(auto u : str) { - const bitmap_font::glyph& g = main_font.get_glyph(u); + const framebuffer::font::glyph& g = main_font.get_glyph(u); if(x < width) { element& e = buffer[y * width + x]; e.ch = u; diff --git a/src/util/lsnes-dumpavi.cpp b/src/util/lsnes-dumpavi.cpp index 03b4aa7c..eb7a6807 100644 --- a/src/util/lsnes-dumpavi.cpp +++ b/src/util/lsnes-dumpavi.cpp @@ -63,7 +63,7 @@ namespace { } - void on_frame(struct framebuffer_raw& _frame, uint32_t fps_n, uint32_t fps_d) + void on_frame(struct framebuffer::raw& _frame, uint32_t fps_n, uint32_t fps_d) { frames_dumped++; if(frames_dumped % 100 == 0) { diff --git a/src/video/avi.cpp b/src/video/avi.cpp index 48ad9348..df71a102 100644 --- a/src/video/avi.cpp +++ b/src/video/avi.cpp @@ -344,7 +344,7 @@ again: delete soxdumper; } - void on_frame(struct framebuffer_raw& _frame, uint32_t fps_n, uint32_t fps_d) + void on_frame(struct framebuffer::raw& _frame, uint32_t fps_n, uint32_t fps_d) { uint32_t hscl = 1; uint32_t vscl = 1; @@ -419,7 +419,7 @@ again: resample_worker* resampler_w; private: sox_dumper* soxdumper; - framebuffer dscr; + framebuffer::fb dscr; unsigned dcounter; bool have_dumped_frame; std::pair soundrate; diff --git a/src/video/jmd.cpp b/src/video/jmd.cpp index 3ee63f37..263983bd 100644 --- a/src/video/jmd.cpp +++ b/src/video/jmd.cpp @@ -90,7 +90,7 @@ namespace } } - void on_frame(struct framebuffer_raw& _frame, uint32_t fps_n, uint32_t fps_d) + void on_frame(struct framebuffer::raw& _frame, uint32_t fps_n, uint32_t fps_d) { if(!render_video_hud(dscr, _frame, 1, 1, 0, 8, 16, 0, 0, 0, 0, NULL)) { akill += killed_audio_length(fps_n, fps_d, akillfrac); @@ -184,7 +184,7 @@ namespace return ret; } - framebuffer dscr; + framebuffer::fb dscr; unsigned dcounter; bool have_dumped_frame; uint64_t audio_w; diff --git a/src/video/pipedec.cpp b/src/video/pipedec.cpp index cf948dc7..9d23f25e 100644 --- a/src/video/pipedec.cpp +++ b/src/video/pipedec.cpp @@ -135,7 +135,7 @@ namespace pclose(video); } - void on_frame(struct framebuffer_raw& _frame, uint32_t fps_n, uint32_t fps_d) + void on_frame(struct framebuffer::raw& _frame, uint32_t fps_n, uint32_t fps_d) { unsigned r, g, b; unsigned short magic = 258; @@ -216,7 +216,7 @@ namespace FILE* video; sox_dumper* audio; bool have_dumped_frame; - struct framebuffer dscr; + struct framebuffer::fb dscr; bool upsidedown; bool bits32; std::string cmd; diff --git a/src/video/raw.cpp b/src/video/raw.cpp index 2281c874..b06a1d95 100644 --- a/src/video/raw.cpp +++ b/src/video/raw.cpp @@ -76,7 +76,7 @@ namespace deleter(audio); } - void on_frame(struct framebuffer_raw& _frame, uint32_t fps_n, uint32_t fps_d) + void on_frame(struct framebuffer::raw& _frame, uint32_t fps_n, uint32_t fps_d) { if(!video) return; @@ -146,8 +146,8 @@ namespace std::ostream* video; void (*deleter)(void* f); bool have_dumped_frame; - struct framebuffer dscr; - struct framebuffer dscr2; + struct framebuffer::fb dscr; + struct framebuffer::fb dscr2; bool swap; bool bits64; };