Example #1
0
/* switch to new framebuffer contents */
static void newframebuffer(rfbScreenInfoPtr screen, int width, int height)
{
  unsigned char *oldfb, *newfb;

  maxx = width;
  maxy = height;
  oldfb = (unsigned char*)screen->frameBuffer;
  newfb = (unsigned char*)malloc(maxx * maxy * bpp);
  initBuffer(newfb);
  rfbNewFramebuffer(screen, (char*)newfb, maxx, maxy, 8, 3, bpp);
  free(oldfb);
}
Example #2
0
void VncServer::resize(int viewNum, int w, int h) {

#if 0
    if (w!=-1 && h!=-1) {
        std::cout << "resize: view=" << viewNum << ", w=" << w << ", h=" << h << std::endl;
    }
#endif
    if (viewNum >= numViews()) {
        if (viewNum != 0)
            m_viewData.emplace_back();
        else
            return;
    }

   ViewData &vd = m_viewData[viewNum];
   if (m_resizeBlocked) {
       m_resizeDeferred = true;

       vd.newWidth = w;
       vd.newHeight = h;
       return;
   }

   if (w==-1 && h==-1) {

       w = vd.newWidth;
       h = vd.newHeight;
   }

   if (vd.nparam.width != w || vd.nparam.height != h) {
      vd.nparam.width = w;
      vd.nparam.height = h;

      vd.rgba.resize(w*h*4);
      vd.depth.resize(w*h);

      if (viewNum == 0) {
          m_screen->frameBuffer = reinterpret_cast<char *>(vd.rgba.data());
          rfbNewFramebuffer(m_screen, m_screen->frameBuffer,
                  w, h, 8, 3, 4);
      }
   }
}