summaryrefslogtreecommitdiffstats
path: root/libxrdp/xrdp_surface.c
diff options
context:
space:
mode:
authorLaxmikant Rashinkar <LK.Rashinkar@gmail.com>2012-09-19 20:51:34 -0700
committerLaxmikant Rashinkar <LK.Rashinkar@gmail.com>2012-09-19 20:51:34 -0700
commit1123323fda6d128fb98b0427e0ea5f6a2dc9e632 (patch)
tree3407a3771a069f812554312ce7c36db625139cc2 /libxrdp/xrdp_surface.c
parent3cedfae76a2351bc8b1e5bd2ee33bbf8630dbacf (diff)
downloadxrdp-proprietary-1123323fda6d128fb98b0427e0ea5f6a2dc9e632.tar.gz
xrdp-proprietary-1123323fda6d128fb98b0427e0ea5f6a2dc9e632.zip
o moved from GNU General Public License to Apache License, Version 2.0
o applied new coding standards to all .c files o moved some files around
Diffstat (limited to 'libxrdp/xrdp_surface.c')
-rw-r--r--libxrdp/xrdp_surface.c211
1 files changed, 107 insertions, 104 deletions
diff --git a/libxrdp/xrdp_surface.c b/libxrdp/xrdp_surface.c
index efc640ee..34ab9f48 100644
--- a/libxrdp/xrdp_surface.c
+++ b/libxrdp/xrdp_surface.c
@@ -21,141 +21,144 @@
#include "freerdp/codec/rfx.h"
/*****************************************************************************/
-struct xrdp_surface* APP_CC
-xrdp_surface_create(struct xrdp_session* session, struct xrdp_fastpath* fastpath)
+struct xrdp_surface *APP_CC
+xrdp_surface_create(struct xrdp_session *session, struct xrdp_fastpath *fastpath)
{
- struct xrdp_surface* self;
-
- self = (struct xrdp_surface*)g_malloc(sizeof(struct xrdp_surface), 1);
- self->session = session;
- self->fastpath = fastpath;
- self->rfx_context = rfx_context_new();
- self->s = stream_new(16384);
- return self;
+ struct xrdp_surface *self;
+
+ self = (struct xrdp_surface *)g_malloc(sizeof(struct xrdp_surface), 1);
+ self->session = session;
+ self->fastpath = fastpath;
+ self->rfx_context = rfx_context_new();
+ self->s = stream_new(16384);
+ return self;
}
/*****************************************************************************/
void APP_CC
-xrdp_surface_delete(struct xrdp_surface* self)
+xrdp_surface_delete(struct xrdp_surface *self)
{
- STREAM* s;
- RFX_CONTEXT* rfx_context;
-
- if (self == 0)
- {
- return;
- }
- s = (STREAM*)(self->s);
- rfx_context = (RFX_CONTEXT*)(self->rfx_context);
- free_stream(self->out_s);
- stream_free(s);
- rfx_context_free(rfx_context);
- g_free(self);
+ STREAM *s;
+ RFX_CONTEXT *rfx_context;
+
+ if (self == 0)
+ {
+ return;
+ }
+
+ s = (STREAM *)(self->s);
+ rfx_context = (RFX_CONTEXT *)(self->rfx_context);
+ free_stream(self->out_s);
+ stream_free(s);
+ rfx_context_free(rfx_context);
+ g_free(self);
}
/*****************************************************************************/
/* returns error */
int APP_CC
-xrdp_surface_reset(struct xrdp_surface* self)
+xrdp_surface_reset(struct xrdp_surface *self)
{
- return 0;
+ return 0;
}
/*****************************************************************************/
int APP_CC
-xrdp_surface_init(struct xrdp_surface* self)
+xrdp_surface_init(struct xrdp_surface *self)
{
- int width;
- int height;
- RFX_CONTEXT* rfx_context;
+ int width;
+ int height;
+ RFX_CONTEXT *rfx_context;
- rfx_context = (RFX_CONTEXT*)(self->rfx_context);
- width = self->session->client_info->width;
- height= self->session->client_info->height;
+ rfx_context = (RFX_CONTEXT *)(self->rfx_context);
+ width = self->session->client_info->width;
+ height = self->session->client_info->height;
- rfx_context->mode = self->session->client_info->rfx_entropy;
- rfx_context->width = width;
- rfx_context->height= height;
+ rfx_context->mode = self->session->client_info->rfx_entropy;
+ rfx_context->width = width;
+ rfx_context->height = height;
- make_stream(self->out_s);
- init_stream(self->out_s, 2 * 3 * width * height + 22);
+ make_stream(self->out_s);
+ init_stream(self->out_s, 2 * 3 * width * height + 22);
- return 0;
+ return 0;
}
/*****************************************************************************/
int APP_CC
-xrdp_surface_send_surface_bits(struct xrdp_surface* self,int bpp, char* data,
+xrdp_surface_send_surface_bits(struct xrdp_surface *self, int bpp, char *data,
int x, int y, int cx, int cy)
{
- RFX_RECT rect;
- char* buf;
- int Bpp;
- int i;
- int j;
- int codecId;
- uint32 bitmapDataLength;
- STREAM* s;
- RFX_CONTEXT* rfx_context;
-
- s = (STREAM*)(self->s);
- rfx_context = (RFX_CONTEXT*)(self->rfx_context);
- if ((bpp == 24) || (bpp == 32))
- {
- }
- else
- {
- g_writeln("bpp = %d is not supported\n", bpp);
- return 1;
- }
- Bpp = 4;
-
- rect.x = 0;
- rect.y = 0;
- rect.width = cx;
- rect.height = cy;
-
- init_stream(self->out_s, 0);
-
- stream_set_pos(s, 0);
- rfx_compose_message(rfx_context, s, &rect, 1, data, cx, cy, Bpp * cx);
-
- codecId = self->session->client_info->rfx_codecId;
- /* surface_bits_command */
- out_uint16_le(self->out_s, CMDTYPE_STREAM_SURFACE_BITS); /* cmdType */
- out_uint16_le(self->out_s, x); /* destLeft */
- out_uint16_le(self->out_s, y); /* destTop */
- out_uint16_le(self->out_s, x + cx); /* destRight */
- out_uint16_le(self->out_s, y + cy); /* destBottom */
- out_uint8(self->out_s, 32); /* bpp */
- out_uint8(self->out_s, 0); /* reserved1 */
- out_uint8(self->out_s, 0); /* reserved2 */
- out_uint8(self->out_s, codecId); /* codecId */
- out_uint16_le(self->out_s, cx); /* width */
- out_uint16_le(self->out_s, cy); /* height */
- bitmapDataLength = stream_get_length(s);
- out_uint32_le(self->out_s, bitmapDataLength); /* bitmapDataLength */
-
- /* rfx bit stream */
- out_uint8p(self->out_s, s->data, bitmapDataLength);
-
- s_mark_end(self->out_s);
- return xrdp_fastpath_send_update_pdu(self->fastpath,
- FASTPATH_UPDATETYPE_SURFCMDS,
- self->out_s);
+ RFX_RECT rect;
+ char *buf;
+ int Bpp;
+ int i;
+ int j;
+ int codecId;
+ uint32 bitmapDataLength;
+ STREAM *s;
+ RFX_CONTEXT *rfx_context;
+
+ s = (STREAM *)(self->s);
+ rfx_context = (RFX_CONTEXT *)(self->rfx_context);
+
+ if ((bpp == 24) || (bpp == 32))
+ {
+ }
+ else
+ {
+ g_writeln("bpp = %d is not supported\n", bpp);
+ return 1;
+ }
+
+ Bpp = 4;
+
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = cx;
+ rect.height = cy;
+
+ init_stream(self->out_s, 0);
+
+ stream_set_pos(s, 0);
+ rfx_compose_message(rfx_context, s, &rect, 1, data, cx, cy, Bpp * cx);
+
+ codecId = self->session->client_info->rfx_codecId;
+ /* surface_bits_command */
+ out_uint16_le(self->out_s, CMDTYPE_STREAM_SURFACE_BITS); /* cmdType */
+ out_uint16_le(self->out_s, x); /* destLeft */
+ out_uint16_le(self->out_s, y); /* destTop */
+ out_uint16_le(self->out_s, x + cx); /* destRight */
+ out_uint16_le(self->out_s, y + cy); /* destBottom */
+ out_uint8(self->out_s, 32); /* bpp */
+ out_uint8(self->out_s, 0); /* reserved1 */
+ out_uint8(self->out_s, 0); /* reserved2 */
+ out_uint8(self->out_s, codecId); /* codecId */
+ out_uint16_le(self->out_s, cx); /* width */
+ out_uint16_le(self->out_s, cy); /* height */
+ bitmapDataLength = stream_get_length(s);
+ out_uint32_le(self->out_s, bitmapDataLength); /* bitmapDataLength */
+
+ /* rfx bit stream */
+ out_uint8p(self->out_s, s->data, bitmapDataLength);
+
+ s_mark_end(self->out_s);
+ return xrdp_fastpath_send_update_pdu(self->fastpath,
+ FASTPATH_UPDATETYPE_SURFCMDS,
+ self->out_s);
}
/*****************************************************************************/
int APP_CC
-xrdp_surface_send_frame_marker(struct xrdp_surface* self,
+xrdp_surface_send_frame_marker(struct xrdp_surface *self,
uint16 frameAction, uint32 frameId)
{
- init_stream(self->out_s, 0);
- out_uint16_le(self->out_s, CMDTYPE_FRAME_MARKER);
- out_uint16_le(self->out_s, frameAction);
- out_uint32_le(self->out_s, frameId);
- s_mark_end(self->out_s);
- return xrdp_fastpath_send_update_pdu(self->fastpath,
- FASTPATH_UPDATETYPE_SURFCMDS,
- self->out_s);
+ init_stream(self->out_s, 0);
+ out_uint16_le(self->out_s, CMDTYPE_FRAME_MARKER);
+ out_uint16_le(self->out_s, frameAction);
+ out_uint32_le(self->out_s, frameId);
+ s_mark_end(self->out_s);
+ return xrdp_fastpath_send_update_pdu(self->fastpath,
+ FASTPATH_UPDATETYPE_SURFCMDS,
+ self->out_s);
}