rfbBool VncClientThread::newclient(rfbClient *cl) { VncClientThread *t = static_cast<VncClientThread*>(rfbClientGetClientData(cl, 0)); Q_ASSERT(t); switch (t->quality()) { case RemoteView::High: cl->format.bitsPerPixel = MAX_COLOR_DEPTH; cl->appData.useBGR233 = 0; cl->appData.encodingsString = "copyrect hextile raw"; cl->appData.compressLevel = 0; cl->appData.qualityLevel = 9; break; case RemoteView::Medium: cl->format.bitsPerPixel = 16; cl->appData.useBGR233 = 0; cl->appData.encodingsString = "tight zrle ultra copyrect hextile zlib corre rre raw"; cl->appData.compressLevel = 5; cl->appData.qualityLevel = 7; break; case RemoteView::Low: case RemoteView::Unknown: default: cl->format.bitsPerPixel = 16; //TODO: add support for 8bit (needs color map) cl->appData.encodingsString = "tight zrle ultra copyrect hextile zlib corre rre raw"; cl->appData.compressLevel = 9; cl->appData.qualityLevel = 1; } if(cl->format.bitsPerPixel == 16) { cl->format.depth = 16; //number of useful bits in the pixel value cl->format.redShift = 11; cl->format.greenShift = 5; cl->format.blueShift = 0; cl->format.redMax = 0x1f; cl->format.greenMax = 0x3f; cl->format.blueMax = 0x1f; } else { cl->format.depth = 24; //number of useful bits in the pixel value cl->format.redShift = 16; cl->format.greenShift = 8; cl->format.blueShift = 0; cl->format.redMax = 0xff; cl->format.greenMax = 0xff; cl->format.blueMax = 0xff; } delete [] t->m_frameBuffer; // do not leak if we get a new framebuffer size const int size = cl->width * cl->height * (cl->format.bitsPerPixel / 8); t->m_frameBuffer = new uint8_t[size]; cl->frameBuffer = t->m_frameBuffer; memset(cl->frameBuffer, '\0', size); SetFormatAndEncodings(cl); return true; }
rfbBool VncClientThread::newclient(rfbClient *cl) { VncClientThread *t = (VncClientThread*)rfbClientGetClientData(cl, 0); Q_ASSERT(t); const int width = cl->width, height = cl->height, depth = cl->format.bitsPerPixel; const int size = width * height * (depth / 8); if (t->frameBuffer) delete [] t->frameBuffer; // do not leak if we get a new framebuffer size t->frameBuffer = new uint8_t[size]; cl->frameBuffer = t->frameBuffer; memset(cl->frameBuffer, '\0', size); cl->format.bitsPerPixel = 32; cl->format.redShift = 16; cl->format.greenShift = 8; cl->format.blueShift = 0; cl->format.redMax = 0xff; cl->format.greenMax = 0xff; cl->format.blueMax = 0xff; switch (t->quality()) { case RemoteView::High: cl->appData.useBGR233 = 0; cl->appData.encodingsString = "copyrect hextile raw"; cl->appData.compressLevel = 0; cl->appData.qualityLevel = 9; break; case RemoteView::Medium: cl->appData.useBGR233 = 0; cl->appData.encodingsString = "tight zrle ultra copyrect hextile zlib corre rre raw"; cl->appData.compressLevel = 5; cl->appData.qualityLevel = 7; break; case RemoteView::Low: case RemoteView::Unknown: default: cl->appData.useBGR233 = 1; cl->appData.encodingsString = "tight zrle ultra copyrect hextile zlib corre rre raw"; cl->appData.compressLevel = 9; cl->appData.qualityLevel = 1; } SetFormatAndEncodings(cl); return true; }
rfbBool VncClientThread::newclient(rfbClient *cl) { VncClientThread *t = (VncClientThread*)rfbClientGetClientData(cl, 0); Q_ASSERT(t); //8bit color hack for Intel(r) AMT KVM "classic vnc" = vnc server built in in Intel Vpro chipsets. if (INTEL_AMT_KVM_STRING == cl->desktopName) { kDebug(5011) << "Intel(R) AMT KVM: switching to 8 bit color depth (workaround, recent libvncserver needed)"; t->setColorDepth(bpp8); } setClientColorDepth(cl, t->colorDepth()); const int width = cl->width, height = cl->height, depth = cl->format.bitsPerPixel; const int size = width * height * (depth / 8); if (t->frameBuffer) delete [] t->frameBuffer; // do not leak if we get a new framebuffer size t->frameBuffer = new uint8_t[size]; cl->frameBuffer = t->frameBuffer; memset(cl->frameBuffer, '\0', size); switch (t->quality()) { case RemoteView::High: cl->appData.encodingsString = "copyrect zlib hextile raw"; cl->appData.compressLevel = 0; cl->appData.qualityLevel = 9; break; case RemoteView::Medium: cl->appData.encodingsString = "copyrect tight zrle ultra zlib hextile corre rre raw"; cl->appData.compressLevel = 5; cl->appData.qualityLevel = 7; break; case RemoteView::Low: case RemoteView::Unknown: default: cl->appData.encodingsString = "copyrect tight zrle ultra zlib hextile corre rre raw"; cl->appData.compressLevel = 9; cl->appData.qualityLevel = 1; } SetFormatAndEncodings(cl); kDebug(5011) << "Client created"; return true; }