ReactOS 0.4.15-dev-7918-g2a2556c
vnc.h File Reference
#include <rfb/rfb.h>
Include dependency graph for vnc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  vncBuffer
 
struct  vncColour
 

Macros

#define BOOL   rfb_BOOL
 

Typedefs

typedef unsigned int vncPixel
 

Functions

vncBuffervncNewBuffer (int w, int h, int depth)
 
vncBuffervncDupBuffer (vncBuffer *b)
 
void vncDeleteBuffer (vncBuffer *b)
 
void vncSetColourMap (rfbScreenInfoPtr s, rfbColourMap *m)
 
rfbColourMap * vncNewColourMap (rfbScreenInfoPtr s, int n)
 
void vncSetColourMapEntry (rfbColourMap *m, int i, vncPixel r, vncPixel g, vncPixel b)
 
void vncDeleteColourMap (rfbColourMap *m)
 
vncPixel vncGetPixel (vncBuffer *b, int x, int y)
 
void vncSetPixel (vncBuffer *b, int x, int y, vncPixel c)
 
void vncSetRect (rfbScreenInfoPtr s, int x, int y, int w, int h, vncPixel c)
 
void vncCopyBlit (rfbScreenInfoPtr s, int x, int y, int w, int h, int srcx, int srcy)
 
void vncCopyBlitFrom (rfbScreenInfoPtr s, int x, int y, int w, int h, vncBuffer *b, int srcx, int srcy)
 
void vncTransBlitFrom (rfbScreenInfoPtr s, int x, int y, int w, int h, vncBuffer *b, int srcx, int srcy, int bg)
 
void vncXorBlitFrom (rfbScreenInfoPtr s, int x, int y, int w, int h, vncBuffer *b, int srcx, int srcy)
 
void vncAndBlitFrom (rfbScreenInfoPtr s, int x, int y, int w, int h, vncBuffer *b, int srcx, int srcy)
 
vncBuffervncGetRect (rfbScreenInfoPtr s, int x, int y, int w, int h)
 
void vncQueueCopyRect (rfbScreenInfoPtr s, int x, int y, int w, int h, int src_x, int src_y)
 
void vncQueueUpdate (rfbScreenInfoPtr s, int x, int y, int w, int h)
 
rfbCursorPtr vncNewCursor (vncBuffer *mask, vncBuffer *pointer, int hotx, int hoty)
 
void vncSetCursor (rfbScreenInfoPtr s, rfbCursorPtr c)
 
int vncListenAtTcpAddr (unsigned short port)
 
void vncPrintStats ()
 

Variables

int vncPreparedClientSocket
 
int vncPreparedServerSocket
 

Macro Definition Documentation

◆ BOOL

#define BOOL   rfb_BOOL

Definition at line 4 of file vnc.h.

Typedef Documentation

◆ vncPixel

Definition at line 8 of file vnc.h.

Function Documentation

◆ vncAndBlitFrom()

void vncAndBlitFrom ( rfbScreenInfoPtr  s,
int  x,
int  y,
int  w,
int  h,
vncBuffer b,
int  srcx,
int  srcy 
)

Definition at line 1141 of file vnc.c.

1142{
1143 int xx, yy;
1144
1145 vncHideCursor();
1146
1147 // xsrc,ysrc provide tiling copy support.
1148 for (yy = y; yy < y + h; yy++)
1149 {
1150 int ysrc = srcy + yy - y;
1151 while (ysrc >= src->h)
1152 ysrc -= src->h;
1153 for (xx = x; xx < x + w; xx++)
1154 {
1155 vncPixel p, pp;
1156 int xsrc = srcx + xx - x;
1157 while (xsrc >= src->linew)
1158 xsrc -= src->linew;
1159 p = GETPIXEL(src, xsrc, ysrc);
1160 pp = GETPIXEL(frameBuffer, xx, yy);
1161 // and blit!
1162 SETPIXEL(frameBuffer, xx, yy, p & pp);
1163 }
1164 }
1165
1166 rfbMarkRectAsModified(s, x, y, x + w, y + h);
1167}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLdouble s
Definition: gl.h:2039
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLenum src
Definition: glext.h:6340
GLfloat GLfloat p
Definition: glext.h:8902
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
int xx
Definition: npserver.c:29
#define GETPIXEL(buf, x, y)
Definition: vnc.c:1019
#define SETPIXEL(buf, x, y, p)
Definition: vnc.c:1021
void vncHideCursor()
Definition: vnc.c:85
static vncBuffer * frameBuffer
Definition: vnc.c:75
unsigned int vncPixel
Definition: vnc.h:8

Referenced by ui_memblt().

◆ vncCopyBlit()

void vncCopyBlit ( rfbScreenInfoPtr  s,
int  x,
int  y,
int  w,
int  h,
int  srcx,
int  srcy 
)

Definition at line 1068 of file vnc.c.

1069{
1070 /* LibVNCServer already knows how to copy the data. */
1071 rfbDoCopyRect(s, x, y, x + w, y + h, x - srcx, y - srcy);
1072}

Referenced by ui_screenblt().

◆ vncCopyBlitFrom()

void vncCopyBlitFrom ( rfbScreenInfoPtr  s,
int  x,
int  y,
int  w,
int  h,
vncBuffer b,
int  srcx,
int  srcy 
)

Definition at line 1075 of file vnc.c.

1076{
1077 vncCopyBlitFromNoEncode(s, x, y, w, h, src, srcx, srcy);
1078 rfbMarkRectAsModified(s, x, y, x + w, y + h);
1079}
void vncCopyBlitFromNoEncode(rfbScreenInfoPtr s, int x, int y, int w, int h, vncBuffer *src, int srcx, int srcy)
Definition: vnc.c:1025

Referenced by ui_desktop_restore(), ui_draw_glyph(), ui_memblt(), ui_paint_bitmap(), and ui_patblt().

◆ vncDeleteBuffer()

void vncDeleteBuffer ( vncBuffer b)

Definition at line 1170 of file vnc.c.

1171{
1172 if (b->owner)
1173 xfree(b->data);
1174 xfree(b);
1175}
void xfree(void *mem)
Definition: uimain.c:758
GLboolean GLboolean GLboolean b
Definition: glext.h:6204

Referenced by ui_desktop_restore(), ui_destroy_bitmap(), ui_draw_glyph(), ui_paint_bitmap(), and vncNewCursor().

◆ vncDeleteColourMap()

void vncDeleteColourMap ( rfbColourMap *  m)

Definition at line 1333 of file vnc.c.

1334{
1335 if (m->data.bytes)
1336 free(m->data.bytes);
1337 m->count = 0;
1338}
#define free
Definition: debug_ros.c:5
const GLfloat * m
Definition: glext.h:10848

Referenced by ui_destroy_colourmap(), and vncSetColourMap().

◆ vncDupBuffer()

vncBuffer * vncDupBuffer ( vncBuffer b)

Definition at line 1003 of file vnc.c.

1004{
1005 vncBuffer *buf = vncNewBuffer(b->w, b->h, b->format->depth);
1006 memcpy(buf->data, b->data, b->linew * b->h * b->format->bitsPerPixel / 8);
1007 return buf;
1008}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: vnc.h:11
vncBuffer * vncNewBuffer(int w, int h, int depth)
Definition: vnc.c:990

Referenced by ui_draw_glyph().

◆ vncGetPixel()

vncPixel vncGetPixel ( vncBuffer b,
int  x,
int  y 
)

Definition at line 1218 of file vnc.c.

1219{
1220 unsigned long offset = (x + (y * (b->linew))) * (b->format->bitsPerPixel >> 3);
1221 return ((uint8_t *) (b->data))[offset];
1222}
GLintptr offset
Definition: glext.h:5920
BYTE uint8_t
Definition: msvideo1.c:66

Referenced by ui_draw_glyph(), and ui_patblt().

◆ vncGetRect()

vncBuffer * vncGetRect ( rfbScreenInfoPtr  s,
int  x,
int  y,
int  w,
int  h 
)

Definition at line 1272 of file vnc.c.

1273{
1274 int xx, yy;
1275 vncBuffer *b = vncNewBuffer(w, h, s->serverFormat.depth);
1276
1277 vncHideCursor();
1278
1279 if (s->serverFormat.bitsPerPixel == 8)
1280 {
1281 //simple copy
1282 int srcstep, dststep;
1283 char *srcdata, *dstdata;
1284 srcstep = s->paddedWidthInBytes * s->serverFormat.bitsPerPixel / 8;
1285 dststep = w * s->serverFormat.bitsPerPixel / 8;
1286 dstdata = b->data;
1287 srcdata = s->frameBuffer + (y * srcstep + x * s->serverFormat.bitsPerPixel / 8);
1288 for (yy = 0; yy < h; yy++)
1289 {
1290 memcpy(dstdata, srcdata, dststep);
1291 dstdata += dststep;
1292 srcdata += srcstep;
1293 }
1294 }
1295 else
1296 {
1297 for (yy = y; yy < y + h; yy++)
1298 {
1299 for (xx = x; xx < x + w; xx++)
1300 {
1301 SETPIXEL(b, xx - x, yy - y, GETPIXEL(frameBuffer, xx, yy));
1302 }
1303 }
1304 }
1305
1306 return b;
1307}
#define b
Definition: ke_i.h:79

Referenced by ui_desktop_save(), and ui_destblt().

◆ vncListenAtTcpAddr()

int vncListenAtTcpAddr ( unsigned short  port)

◆ vncNewBuffer()

vncBuffer * vncNewBuffer ( int  w,
int  h,
int  depth 
)

Definition at line 990 of file vnc.c.

991{
992 vncBuffer *b = (vncBuffer *) xmalloc(sizeof(vncBuffer));
993 b->format = vncNewFormat(depth);
994 b->data = (void *) xmalloc(w * h * (b->format->bitsPerPixel / 8));
995 b->owner = 1;
996 b->w = w;
997 b->h = h;
998 b->linew = w;
999 return b;
1000}
void * xmalloc(int size)
Definition: uimain.c:747
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
rfbPixelFormat * vncNewFormat(int depth)
Definition: vnc.c:984

Referenced by ui_create_bitmap(), ui_create_glyph(), ui_desktop_restore(), ui_patblt(), vncDupBuffer(), and vncGetRect().

◆ vncNewColourMap()

rfbColourMap * vncNewColourMap ( rfbScreenInfoPtr  s,
int  n 
)

Definition at line 1312 of file vnc.c.

1313{
1314 rfbColourMap *m = (rfbColourMap *) xmalloc(sizeof(rfbColourMap));
1315 m->is16 = FALSE;
1316 m->count = n;
1317 m->data.bytes = (uint8_t *) xmalloc(n * 3);
1318 return m;
1319}
#define FALSE
Definition: types.h:117
GLdouble n
Definition: glext.h:7729

Referenced by ui_create_colourmap().

◆ vncNewCursor()

rfbCursorPtr vncNewCursor ( vncBuffer mask,
vncBuffer pointer,
int  hotx,
int  hoty 
)

Definition at line 1179 of file vnc.c.

1180{
1181 int i, j, w = (mask->w + 7) / 8, mask_size = w * mask->h,
1182 pointer_size = pointer->w * pointer->h;
1183 rfbCursorPtr c = (rfbCursorPtr) xmalloc(sizeof(rfbCursor));
1184
1185 if (mask->w != pointer->w || mask->h != pointer->h)
1186 error("ERROR! Mask is %dx%d, Pointer is %dx%d\n",
1187 mask->w, mask->h, pointer->w, pointer->h);
1188
1189 c->xhot = hotx;
1190 c->yhot = hoty;
1191 c->width = mask->w;
1192 c->height = mask->h;
1193
1194 c->mask = (char *) xmalloc(mask_size);
1195 for (j = 0; j < c->height; j++)
1196 for (i = 0; i < w; i++)
1197 c->mask[j * w + i] =
1198 reverseByte[((unsigned char *) mask->data)[(j) * w + i]];
1200
1201 c->source = 0;
1202 c->richSource = (char *) xmalloc(pointer_size);
1203 memcpy(c->richSource, pointer->data, pointer_size);
1205
1206 return c;
1207}
const GLubyte * c
Definition: glext.h:8905
GLsizei const GLvoid * pointer
Definition: glext.h:5848
GLenum GLint GLuint mask
Definition: glext.h:6028
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define c
Definition: ke_i.h:80
#define error(str)
Definition: mkdosfs.c:1605
static uint8_t reverseByte[0x100]
Definition: vnc.c:76
void vncDeleteBuffer(vncBuffer *b)
Definition: vnc.c:1170
unsigned int pointer_size
Definition: widl.c:158

◆ vncPrintStats()

void vncPrintStats ( )

Definition at line 1011 of file vnc.c.

1012{
1013 if (server && server->clientHead)
1014 rfbPrintStats(server->clientHead);
1015}
static rfbScreenInfoPtr server
Definition: vnc.c:74

◆ vncQueueCopyRect()

void vncQueueCopyRect ( rfbScreenInfoPtr  s,
int  x,
int  y,
int  w,
int  h,
int  src_x,
int  src_y 
)

◆ vncQueueUpdate()

void vncQueueUpdate ( rfbScreenInfoPtr  s,
int  x,
int  y,
int  w,
int  h 
)

◆ vncSetColourMap()

void vncSetColourMap ( rfbScreenInfoPtr  s,
rfbColourMap *  m 
)

Definition at line 1341 of file vnc.c.

1342{
1343 vncDeleteColourMap(&s->colourMap);
1344 s->colourMap = *m;
1345 rfbSetClientColourMaps(s, 0, 0);
1346}
void vncDeleteColourMap(rfbColourMap *m)
Definition: vnc.c:1333

Referenced by ui_set_colourmap().

◆ vncSetColourMapEntry()

void vncSetColourMapEntry ( rfbColourMap *  m,
int  i,
vncPixel  r,
vncPixel  g,
vncPixel  b 
)

Definition at line 1322 of file vnc.c.

1323{
1324 if (i < m->count)
1325 {
1326 m->data.bytes[3 * i + 0] = r;
1327 m->data.bytes[3 * i + 1] = g;
1328 m->data.bytes[3 * i + 2] = b;
1329 }
1330}
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLboolean g
Definition: glext.h:6204

Referenced by ui_create_colourmap().

◆ vncSetCursor()

void vncSetCursor ( rfbScreenInfoPtr  s,
rfbCursorPtr  c 
)

Definition at line 1211 of file vnc.c.

1212{
1213 rfbSetCursor(s, c, FALSE);
1214}

◆ vncSetPixel()

void vncSetPixel ( vncBuffer b,
int  x,
int  y,
vncPixel  c 
)

Definition at line 1225 of file vnc.c.

1226{
1227 unsigned long offset = (x + (y * (b->linew))) * (b->format->bitsPerPixel >> 3);
1228 ((uint8_t *) (b->data))[offset] = c;
1229}

Referenced by ui_create_glyph(), ui_draw_glyph(), and ui_patblt().

◆ vncSetRect()

void vncSetRect ( rfbScreenInfoPtr  s,
int  x,
int  y,
int  w,
int  h,
vncPixel  c 
)

Definition at line 1232 of file vnc.c.

1233{
1234 int xx, yy;
1235
1236 if (x + w > s->width)
1237 w = s->width - x;
1238 if (y + h > s->height)
1239 h = s->height - y;
1240 if (w <= 0 || h <= 0)
1241 return;
1242
1243 vncHideCursor();
1244
1245 // - Fill the rect in the local framebuffer
1246 if (s->serverFormat.bitsPerPixel == 8)
1247 {
1248 // - Simple 8-bit fill
1249 uint8_t *dstdata;
1250 dstdata = s->frameBuffer + (y * s->paddedWidthInBytes + x);
1251 for (yy = 0; yy < h; yy++)
1252 {
1253 memset(dstdata, c, w);
1254 dstdata += s->paddedWidthInBytes;
1255 }
1256 }
1257 else
1258 {
1259 for (yy = y; yy < y + h; yy++)
1260 {
1261 for (xx = x; xx < x + w; xx++)
1262 {
1263 SETPIXEL(frameBuffer, xx, yy, c);
1264 }
1265 }
1266 }
1267
1268 rfbMarkRectAsModified(s, x, y, x + w, y + h);
1269}
#define memset(x, y, z)
Definition: compat.h:39

Referenced by ui_patblt(), and ui_rect().

◆ vncTransBlitFrom()

void vncTransBlitFrom ( rfbScreenInfoPtr  s,
int  x,
int  y,
int  w,
int  h,
vncBuffer b,
int  srcx,
int  srcy,
int  bg 
)

Definition at line 1082 of file vnc.c.

1084{
1085 int xx, yy;
1086
1087 vncHideCursor();
1088
1089 // xsrc,ysrc provide tiling copy support.
1090 for (yy = y; yy < y + h; yy++)
1091 {
1092 int ysrc = srcy + yy - y;
1093 while (ysrc >= src->h)
1094 ysrc -= src->h;
1095 for (xx = x; xx < x + w; xx++)
1096 {
1097 vncPixel p;
1098 int xsrc = srcx + xx - x;
1099 while (xsrc >= src->linew)
1100 xsrc -= src->linew;
1101 p = GETPIXEL(src, xsrc, ysrc);
1102 // transparent blit!
1103 if (p != bg)
1104 SETPIXEL(frameBuffer, xx, yy, p);
1105 }
1106 }
1107
1108 rfbMarkRectAsModified(s, x, y, x + w, y + h);
1109}

Referenced by ui_draw_glyph(), and ui_memblt().

◆ vncXorBlitFrom()

void vncXorBlitFrom ( rfbScreenInfoPtr  s,
int  x,
int  y,
int  w,
int  h,
vncBuffer b,
int  srcx,
int  srcy 
)

Definition at line 1112 of file vnc.c.

1113{
1114 int xx, yy;
1115
1116 vncHideCursor();
1117
1118 // xsrc,ysrc provide tiling copy support.
1119 for (yy = y; yy < y + h; yy++)
1120 {
1121 int ysrc = srcy + yy - y;
1122 while (ysrc >= src->h)
1123 ysrc -= src->h;
1124 for (xx = x; xx < x + w; xx++)
1125 {
1126 vncPixel p, pp;
1127 int xsrc = srcx + xx - x;
1128 while (xsrc >= src->linew)
1129 xsrc -= src->linew;
1130 p = GETPIXEL(src, xsrc, ysrc);
1131 pp = GETPIXEL(frameBuffer, xx, yy);
1132 // xor blit!
1133 SETPIXEL(frameBuffer, xx, yy, p ^ pp);
1134 }
1135 }
1136
1137 rfbMarkRectAsModified(s, x, y, x + w, y + h);
1138}

Referenced by ui_memblt(), and ui_patblt().

Variable Documentation

◆ vncPreparedClientSocket

int vncPreparedClientSocket
extern

◆ vncPreparedServerSocket

int vncPreparedServerSocket
extern