lcd 显示(二)

CdrDisplay::CdrDisplay(int disp_id,    ViewInfo *sur)
{
 mCD = new CedarDisplay(disp_id);
 mHlay = mCD->requestSurface(sur);
 mLayerOpened = true;
}

int CdrDisplay::getHandle()
{
 return mHlay; 
}

CdrDisplay::CdrDisplay(int disp_id)
{
 ViewInfo sur;
 memset(&sur, 0, sizeof(ViewInfo));
 CdrDisplay(disp_id, &sur);
}

CdrDisplay::~CdrDisplay()
{
 db_msg("CdrDisplay Destructor\n");
 mCD->releaseSurface(mHlay);
 delete mCD;
 mCD = NULL;
}

void CdrDisplay::setBottom()
{
 }

void CdrDisplay::setRect(CDR_RECT &rect)
{
 ViewInfo vi;
 if(mCD) {
  vi.x = rect.x;
  vi.y = rect.y;
  vi.w = rect.w;
  vi.h = rect.h;

  db_msg("[richard ]x=%d,y=%d,w=%d,h=%d\n",vi.x,vi.y,vi.w,vi.h);
  
  mCD->setPreviewRect(&vi);
 } else {
  db_error("mCD is invalid\n"); 
 }
}

void CdrDisplay::open()               // UI图层2,0默认就是打开的                  
{

 db_msg("<**CdrDisplay::open**>");
 if(mLayerOpened == true)
  return;
 if (mCD) {
  int ret;
  ret = mCD->open(mHlay, 1);
  db_msg("ret is %d\n", ret);
  if(ret == 0)
   mLayerOpened = true;
 }
}

void CdrDisplay::openAdasScreen()
{
 db_msg("<**CdrDisplay::openAdasScreen**>");
 if (mCD) {
  int ret;
  ret = mCD->open(9, 1);                                              //  2*4+1  ,adas图层是2,1

  db_msg("ret is %d\n", ret);
  if(ret != 0)
   db_msg("<****openAdasScreen failed****>");
 }
}

void CdrDisplay::close()
{
// if(mLayerOpened == false)
//  return;
 if (mCD) {
  int ret;
  ret = mCD->open(mHlay, 0);
  db_msg("ret is %d\n", ret);
  if(ret == 0)
   mLayerOpened = false;
 }
}

void CdrDisplay::closeAdasScreen()
{
 db_msg("<**CdrDisplay::closeAdasScreen**>");
 if (mCD) {
  int ret;
  ret = mCD->open(9, 0);
  db_msg("ret is %d\n", ret);
  if(ret != 0)
   db_msg("<****closeAdasScreen failed****>");
 }
}

void CdrDisplay::exchange(int hlay, int flag)
{
 mCD->exchangeSurface(mHlay, hlay, flag);
}

void CdrDisplay::otherScreen(int screen, int hlay)
{
 mCD->otherScreen(screen, mHlay, hlay);
}

void CdrDisplay::clean(void)
{
 mCD->clearSurface(mHlay);
}

你可能感兴趣的:(lcd 显示(二))