Lines Matching refs:client
53 (((CARD##bpp)(r) & client->format.redMax) << client->format.redShift | \
54 ((CARD##bpp)(g) & client->format.greenMax) << client->format.greenShift | \
55 ((CARD##bpp)(b) & client->format.blueMax) << client->format.blueShift)
58 ((((CARD##bpp)(r) & 0xFF) * client->format.redMax + 127) / 255 \
59 << client->format.redShift | \
60 (((CARD##bpp)(g) & 0xFF) * client->format.greenMax + 127) / 255 \
61 << client->format.greenShift | \
62 (((CARD##bpp)(b) & 0xFF) * client->format.blueMax + 127) / 255 \
63 << client->format.blueShift)
66 (((uint32_t)(r) & 0xFF) << client->format.redShift | \
67 ((uint32_t)(g) & 0xFF) << client->format.greenShift | \
68 ((uint32_t)(b) & 0xFF) << client->format.blueShift)
74 typedef void (*filterPtrBPP)(rfbClient* client, int, CARDBPP *);
78 static int InitFilterCopyBPP (rfbClient* client, int rw, int rh);
79 static int InitFilterPaletteBPP (rfbClient* client, int rw, int rh);
80 static int InitFilterGradientBPP (rfbClient* client, int rw, int rh);
81 static void FilterCopyBPP (rfbClient* client, int numRows, CARDBPP *destBuffer);
82 static void FilterPaletteBPP (rfbClient* client, int numRows, CARDBPP *destBuffer);
83 static void FilterGradientBPP (rfbClient* client, int numRows, CARDBPP *destBuffer);
86 static rfbBool DecompressJpegRectBPP(rfbClient* client, int x, int y, int w, int h);
92 HandleTightBPP (rfbClient* client, int rx, int ry, int rw, int rh) in HandleTightBPP() argument
103 if (!ReadFromRFBServer(client, (char *)&comp_ctl, 1)) in HandleTightBPP()
108 if ((comp_ctl & 1) && client->zlibStreamActive[stream_id]) { in HandleTightBPP()
109 if (inflateEnd (&client->zlibStream[stream_id]) != Z_OK && in HandleTightBPP()
110 client->zlibStream[stream_id].msg != NULL) in HandleTightBPP()
111 rfbClientLog("inflateEnd: %s\n", client->zlibStream[stream_id].msg); in HandleTightBPP()
112 client->zlibStreamActive[stream_id] = FALSE; in HandleTightBPP()
120 if (client->format.depth == 24 && client->format.redMax == 0xFF && in HandleTightBPP()
121 client->format.greenMax == 0xFF && client->format.blueMax == 0xFF) { in HandleTightBPP()
122 if (!ReadFromRFBServer(client, client->buffer, 3)) in HandleTightBPP()
124 fill_colour = RGB24_TO_PIXEL32(client->buffer[0], client->buffer[1], client->buffer[2]); in HandleTightBPP()
126 if (!ReadFromRFBServer(client, (char*)&fill_colour, sizeof(fill_colour))) in HandleTightBPP()
130 if (!ReadFromRFBServer(client, (char*)&fill_colour, sizeof(fill_colour))) in HandleTightBPP()
134 FillRectangle(client, rx, ry, rw, rh, fill_colour); in HandleTightBPP()
146 return DecompressJpegRectBPP(client, rx, ry, rw, rh); in HandleTightBPP()
163 if (!ReadFromRFBServer(client, (char*)&filter_id, 1)) in HandleTightBPP()
169 bitsPixel = InitFilterCopyBPP(client, rw, rh); in HandleTightBPP()
173 bitsPixel = InitFilterPaletteBPP(client, rw, rh); in HandleTightBPP()
177 bitsPixel = InitFilterGradientBPP(client, rw, rh); in HandleTightBPP()
185 bitsPixel = InitFilterCopyBPP(client, rw, rh); in HandleTightBPP()
195 if (!ReadFromRFBServer(client, (char*)client->buffer, rh * rowSize)) in HandleTightBPP()
198 buffer2 = &client->buffer[TIGHT_MIN_TO_COMPRESS * 4]; in HandleTightBPP()
199 filterFn(client, rh, (CARDBPP *)buffer2); in HandleTightBPP()
201 CopyRectangle(client, (uint8_t *)buffer2, rx, ry, rw, rh); in HandleTightBPP()
207 compressedLen = (int)ReadCompactLen(client); in HandleTightBPP()
215 zs = &client->zlibStream[stream_id]; in HandleTightBPP()
216 if (!client->zlibStreamActive[stream_id]) { in HandleTightBPP()
226 client->zlibStreamActive[stream_id] = TRUE; in HandleTightBPP()
232 buffer2 = &client->buffer[bufferSize]; in HandleTightBPP()
248 if (!ReadFromRFBServer(client, (char*)client->zlib_buffer, portionLen)) in HandleTightBPP()
253 zs->next_in = (Bytef *)client->zlib_buffer; in HandleTightBPP()
257 zs->next_out = (Bytef *)&client->buffer[extraBytes]; in HandleTightBPP()
274 filterFn(client, numRows, (CARDBPP *)buffer2); in HandleTightBPP()
278 memcpy(client->buffer, &client->buffer[numRows * rowSize], extraBytes); in HandleTightBPP()
280 CopyRectangle(client, (uint8_t *)buffer2, rx, ry+rowsProcessed, rw, numRows); in HandleTightBPP()
302 InitFilterCopyBPP (rfbClient* client, int rw, int rh) in InitFilterCopyBPP() argument
304 client->rectWidth = rw; in InitFilterCopyBPP()
307 if (client->format.depth == 24 && client->format.redMax == 0xFF && in InitFilterCopyBPP()
308 client->format.greenMax == 0xFF && client->format.blueMax == 0xFF) { in InitFilterCopyBPP()
309 client->cutZeros = TRUE; in InitFilterCopyBPP()
312 client->cutZeros = FALSE; in InitFilterCopyBPP()
320 FilterCopyBPP (rfbClient* client, int numRows, CARDBPP *dst) in FilterCopyBPP() argument
326 if (client->cutZeros) { in FilterCopyBPP()
328 for (x = 0; x < client->rectWidth; x++) { in FilterCopyBPP()
329 dst[y*client->rectWidth+x] = in FilterCopyBPP()
330 RGB24_TO_PIXEL32(client->buffer[(y*client->rectWidth+x)*3], in FilterCopyBPP()
331 client->buffer[(y*client->rectWidth+x)*3+1], in FilterCopyBPP()
332 client->buffer[(y*client->rectWidth+x)*3+2]); in FilterCopyBPP()
339 memcpy (dst, client->buffer, numRows * client->rectWidth * (BPP / 8)); in FilterCopyBPP()
343 InitFilterGradientBPP (rfbClient* client, int rw, int rh) in InitFilterGradientBPP() argument
347 bits = InitFilterCopyBPP(client, rw, rh); in InitFilterGradientBPP()
348 if (client->cutZeros) in InitFilterGradientBPP()
349 memset(client->tightPrevRow, 0, rw * 3); in InitFilterGradientBPP()
351 memset(client->tightPrevRow, 0, rw * 3 * sizeof(uint16_t)); in InitFilterGradientBPP()
359 FilterGradient24 (rfbClient* client, int numRows, uint32_t *dst) in FilterGradient24() argument
370 pix[c] = client->tightPrevRow[c] + client->buffer[y*client->rectWidth*3+c]; in FilterGradient24()
373 dst[y*client->rectWidth] = RGB24_TO_PIXEL32(pix[0], pix[1], pix[2]); in FilterGradient24()
376 for (x = 1; x < client->rectWidth; x++) { in FilterGradient24()
378 est[c] = (int)client->tightPrevRow[x*3+c] + (int)pix[c] - in FilterGradient24()
379 (int)client->tightPrevRow[(x-1)*3+c]; in FilterGradient24()
385 pix[c] = (uint8_t)est[c] + client->buffer[(y*client->rectWidth+x)*3+c]; in FilterGradient24()
388 dst[y*client->rectWidth+x] = RGB24_TO_PIXEL32(pix[0], pix[1], pix[2]); in FilterGradient24()
391 memcpy(client->tightPrevRow, thisRow, client->rectWidth * 3); in FilterGradient24()
398 FilterGradientBPP (rfbClient* client, int numRows, CARDBPP *dst) in FilterGradientBPP() argument
401 CARDBPP *src = (CARDBPP *)client->buffer; in FilterGradientBPP()
402 uint16_t *thatRow = (uint16_t *)client->tightPrevRow; in FilterGradientBPP()
410 if (client->cutZeros) { in FilterGradientBPP()
411 FilterGradient24(client, numRows, dst); in FilterGradientBPP()
416 max[0] = client->format.redMax; in FilterGradientBPP()
417 max[1] = client->format.greenMax; in FilterGradientBPP()
418 max[2] = client->format.blueMax; in FilterGradientBPP()
420 shift[0] = client->format.redShift; in FilterGradientBPP()
421 shift[1] = client->format.greenShift; in FilterGradientBPP()
422 shift[2] = client->format.blueShift; in FilterGradientBPP()
428 pix[c] = (uint16_t)(((src[y*client->rectWidth] >> shift[c]) + thatRow[c]) & max[c]); in FilterGradientBPP()
431 dst[y*client->rectWidth] = RGB_TO_PIXEL(BPP, pix[0], pix[1], pix[2]); in FilterGradientBPP()
434 for (x = 1; x < client->rectWidth; x++) { in FilterGradientBPP()
442 pix[c] = (uint16_t)(((src[y*client->rectWidth+x] >> shift[c]) + est[c]) & max[c]); in FilterGradientBPP()
445 dst[y*client->rectWidth+x] = RGB_TO_PIXEL(BPP, pix[0], pix[1], pix[2]); in FilterGradientBPP()
447 memcpy(thatRow, thisRow, client->rectWidth * 3 * sizeof(uint16_t)); in FilterGradientBPP()
452 InitFilterPaletteBPP (rfbClient* client, int rw, int rh) in InitFilterPaletteBPP() argument
457 CARDBPP *palette = (CARDBPP *)client->tightPalette; in InitFilterPaletteBPP()
460 client->rectWidth = rw; in InitFilterPaletteBPP()
462 if (!ReadFromRFBServer(client, (char*)&numColors, 1)) in InitFilterPaletteBPP()
465 client->rectColors = (int)numColors; in InitFilterPaletteBPP()
466 if (++client->rectColors < 2) in InitFilterPaletteBPP()
470 if (client->format.depth == 24 && client->format.redMax == 0xFF && in InitFilterPaletteBPP()
471 client->format.greenMax == 0xFF && client->format.blueMax == 0xFF) { in InitFilterPaletteBPP()
472 if (!ReadFromRFBServer(client, (char*)&client->tightPalette, client->rectColors * 3)) in InitFilterPaletteBPP()
474 for (i = client->rectColors - 1; i >= 0; i--) { in InitFilterPaletteBPP()
475 palette[i] = RGB24_TO_PIXEL32(client->tightPalette[i*3], in InitFilterPaletteBPP()
476 client->tightPalette[i*3+1], in InitFilterPaletteBPP()
477 client->tightPalette[i*3+2]); in InitFilterPaletteBPP()
479 return (client->rectColors == 2) ? 1 : 8; in InitFilterPaletteBPP()
483 if (!ReadFromRFBServer(client, (char*)&client->tightPalette, client->rectColors * (BPP / 8))) in InitFilterPaletteBPP()
486 return (client->rectColors == 2) ? 1 : 8; in InitFilterPaletteBPP()
490 FilterPaletteBPP (rfbClient* client, int numRows, CARDBPP *dst) in FilterPaletteBPP() argument
493 uint8_t *src = (uint8_t *)client->buffer; in FilterPaletteBPP()
494 CARDBPP *palette = (CARDBPP *)client->tightPalette; in FilterPaletteBPP()
496 if (client->rectColors == 2) { in FilterPaletteBPP()
497 w = (client->rectWidth + 7) / 8; in FilterPaletteBPP()
499 for (x = 0; x < client->rectWidth / 8; x++) { in FilterPaletteBPP()
501 dst[y*client->rectWidth+x*8+7-b] = palette[src[y*w+x] >> b & 1]; in FilterPaletteBPP()
503 for (b = 7; b >= 8 - client->rectWidth % 8; b--) { in FilterPaletteBPP()
504 dst[y*client->rectWidth+x*8+7-b] = palette[src[y*w+x] >> b & 1]; in FilterPaletteBPP()
509 for (x = 0; x < client->rectWidth; x++) in FilterPaletteBPP()
510 dst[y*client->rectWidth+x] = palette[(int)src[y*client->rectWidth+x]]; in FilterPaletteBPP()
523 DecompressJpegRectBPP(rfbClient* client, int x, int y, int w, int h) in DecompressJpegRectBPP() argument
533 compressedLen = (int)ReadCompactLen(client); in DecompressJpegRectBPP()
545 if (!ReadFromRFBServer(client, (char*)compressedData, compressedLen)) { in DecompressJpegRectBPP()
551 cinfo.client_data = client; in DecompressJpegRectBPP()
568 rowPointer[0] = (JSAMPROW)client->buffer; in DecompressJpegRectBPP()
572 if (client->jpegError) { in DecompressJpegRectBPP()
575 pixelPtr = (CARDBPP *)&client->buffer[RFB_BUFFER_SIZE / 2]; in DecompressJpegRectBPP()
578 RGB24_TO_PIXEL(BPP, client->buffer[dx*3], client->buffer[dx*3+1], client->buffer[dx*3+2]); in DecompressJpegRectBPP()
580 CopyRectangle(client, (uint8_t *)&client->buffer[RFB_BUFFER_SIZE / 2], x, y + dy, w, 1); in DecompressJpegRectBPP()
584 if (!client->jpegError) in DecompressJpegRectBPP()
590 return !client->jpegError; in DecompressJpegRectBPP()
596 ReadCompactLen (rfbClient* client) in ReadCompactLen() argument
601 if (!ReadFromRFBServer(client, (char *)&b, 1)) in ReadCompactLen()
605 if (!ReadFromRFBServer(client, (char *)&b, 1)) in ReadCompactLen()
609 if (!ReadFromRFBServer(client, (char *)&b, 1)) in ReadCompactLen()
624 rfbClient* client=(rfbClient*)cinfo->client_data; in JpegInitSource() local
625 client->jpegError = FALSE; in JpegInitSource()
631 rfbClient* client=(rfbClient*)cinfo->client_data; in JpegFillInputBuffer() local
632 client->jpegError = TRUE; in JpegFillInputBuffer()
633 client->jpegSrcManager->bytes_in_buffer = client->jpegBufferLen; in JpegFillInputBuffer()
634 client->jpegSrcManager->next_input_byte = (JOCTET *)client->jpegBufferPtr; in JpegFillInputBuffer()
642 rfbClient* client=(rfbClient*)cinfo->client_data; in JpegSkipInputData() local
643 if (num_bytes < 0 || num_bytes > client->jpegSrcManager->bytes_in_buffer) { in JpegSkipInputData()
644 client->jpegError = TRUE; in JpegSkipInputData()
645 client->jpegSrcManager->bytes_in_buffer = client->jpegBufferLen; in JpegSkipInputData()
646 client->jpegSrcManager->next_input_byte = (JOCTET *)client->jpegBufferPtr; in JpegSkipInputData()
648 client->jpegSrcManager->next_input_byte += (size_t) num_bytes; in JpegSkipInputData()
649 client->jpegSrcManager->bytes_in_buffer -= (size_t) num_bytes; in JpegSkipInputData()
664 rfbClient* client=(rfbClient*)cinfo->client_data; in JpegSetSrcManager() local
665 client->jpegBufferPtr = compressedData; in JpegSetSrcManager()
666 client->jpegBufferLen = (size_t)compressedLen; in JpegSetSrcManager()
668 if(client->jpegSrcManager == NULL) in JpegSetSrcManager()
669 client->jpegSrcManager = malloc(sizeof(struct jpeg_source_mgr)); in JpegSetSrcManager()
670 client->jpegSrcManager->init_source = JpegInitSource; in JpegSetSrcManager()
671 client->jpegSrcManager->fill_input_buffer = JpegFillInputBuffer; in JpegSetSrcManager()
672 client->jpegSrcManager->skip_input_data = JpegSkipInputData; in JpegSetSrcManager()
673 client->jpegSrcManager->resync_to_restart = jpeg_resync_to_restart; in JpegSetSrcManager()
674 client->jpegSrcManager->term_source = JpegTermSource; in JpegSetSrcManager()
675 client->jpegSrcManager->next_input_byte = (JOCTET*)client->jpegBufferPtr; in JpegSetSrcManager()
676 client->jpegSrcManager->bytes_in_buffer = client->jpegBufferLen; in JpegSetSrcManager()
678 cinfo->src = client->jpegSrcManager; in JpegSetSrcManager()