#ifndef GCENVADAPTOR_H_
#define GCENVADAPTOR_H_

#include <stdint.h>

class GcEnvAdaptor
{
public:
  typedef void* release_cookie_t;

  struct framebuffer_descriptor_t
  {
	  uint8_t* buffer;
	  unsigned int dx;
	  unsigned int dy;
	  unsigned int stride;

	  release_cookie_t releaseCookie;
  };


  static void ggUpdateOpeative(const uint8_t* src, unsigned int rows, unsigned int cols, unsigned int pitch);

  typedef void (*post_operative_handler_t)(void* cookie, const uint8_t* src, unsigned int rows, unsigned int cols, unsigned int pitch);

  static void ggSetPostOperativeHandler(post_operative_handler_t handler, void* cookie);

  static void ggUpdate(const uint8_t* src, unsigned int rows, unsigned int cols, unsigned int pitch);
  static void ggPhyUpdate(const uint8_t* src, unsigned int rows, unsigned int cols, unsigned int pitch);

  static void ggPaletUpdate(const uint32_t*);

  static bool ggIsVisible();

  static void ggSetVisible(bool visible=true);

  static void ggSetColor(int index, uint32_t rgba);
  static void ggSetColorSC(int index, uint32_t rgba);
  static void ggCommintPalet();
  static void ggCommitPaletSC();

  //
  static unsigned int ggGeometrySetup(unsigned int pdx, unsigned int pdy, unsigned int ldx, unsigned int ldy); //return the pitch

  static void* ggGetBackingStore();
  static void* ggGetDefaultBackingStore();
  static void ggCommitBackingStore(unsigned int rows, unsigned int cols, unsigned int pitch=0);

  typedef void (*framebuffer_handler_t)(const framebuffer_descriptor_t&);

  static void ggSetBackgroundPrepareHandler(framebuffer_handler_t handler);
  static void ggSetFrameCommitHandler(framebuffer_handler_t handler);

  static void ggSoftScanConverterEnable(bool enable);
  static void ggRemoteDisplayEnable(bool enable);

  static void ggRemoteRelease(const void* p);

  static void ggSetFinalOverlayHandler(framebuffer_handler_t handler);

  static void ggSetRisEnabed(bool enable);
  static void ggSetRisActivated(bool active);

  static void ggPrepareSurface();
};

#endif /*GCENVADAPTOR_H_*/
