MCPcopy Create free account
hub / github.com/bk138/multivnc / thread_alloc_framebuffer

Method thread_alloc_framebuffer

src/VNCConn.cpp:199–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197
198
199rfbBool VNCConn::thread_alloc_framebuffer(rfbClient* client)
200{
201 // get VNCConn object belonging to this client
202 VNCConn* conn = (VNCConn*) rfbClientGetClientData(client, VNCCONN_OBJ_ID);
203
204 wxLogDebug(wxT("VNCConn %p: alloc'ing framebuffer w:%i, h:%i"), conn, client->width, client->height);
205
206 wxCriticalSectionLocker lock(conn->mutex_framebuffer);
207
208 // assert 32bpp, as requested with GetClient() in Init()
209 if(client->format.bitsPerPixel != 32)
210 {
211 conn->err.Printf(_("Failure setting up framebuffer: wrong BPP!"));
212 return false;
213 }
214
215 // ensure that we get the whole framebuffer in case of a resize!
216 client->updateRect.x = client->updateRect.y = 0;
217 client->updateRect.w = client->width; client->updateRect.h = client->height;
218
219 // free
220 if(client->frameBuffer)
221 free(client->frameBuffer);
222
223 // alloc, zeroed
224 client->frameBuffer = (uint8_t*)calloc(1, client->width*client->height*client->format.bitsPerPixel/8);
225
226 // free front framebuffer
227 if(conn->framebuffer_front)
228 free(conn->framebuffer_front);
229
230 // alloc, zeroed
231 conn->framebuffer_front = (uint8_t*)calloc(1, client->width*client->height*client->format.bitsPerPixel/8);
232
233 // notify our parent
234 conn->thread_post_fbresize_notify();
235
236 return (client->frameBuffer && conn->framebuffer_front) ? TRUE : FALSE;
237}
238
239
240

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected