#include "render_device.hpp"

#include <linux/fb.h>

class Fbdev : public Render_device
{
private:
  Imlib_Image resized;

  char *fb_dev_name;

  int fb_dev_fd;
  int fb_depth;
  size_t fb_size;
  int fb_line_len;
  int y_offset;

  struct fb_var_screeninfo fb_orig_vinfo;
  struct fb_fix_screeninfo fb_finfo;

  int initialized;
  int verbose;

  void fbdev_draw(UINT8 *dataptr);

  void fbdev_draw_32(unsigned char * frame);
  void fbdev_draw_24(unsigned char * frame);
  void fbdev_draw_16(unsigned char * frame);
public:
  Fbdev();
  ~Fbdev() { terminate(); /* thread */ };
  
  void init();
  void deinit();

  void redraw();

 private:
  void run();
};
