nscodec in hw and sw gdi

This commit is contained in:
qubit 2011-10-03 00:46:22 +05:30
parent c8a8d54304
commit 2be57ad628
7 changed files with 67 additions and 4 deletions

View File

@ -19,6 +19,7 @@
#include <freerdp/gdi/gdi.h>
#include <freerdp/rfx/rfx.h>
#include <freerdp/nsc/nsc.h>
#include <freerdp/constants.h>
#include <freerdp/utils/memory.h>
#include <freerdp/common/color.h>
@ -778,6 +779,7 @@ void xf_gdi_surface_bits(rdpUpdate* update, SURFACE_BITS_COMMAND* surface_bits_c
RFX_MESSAGE* message;
xfInfo* xfi = GET_XFI(update);
RFX_CONTEXT* context = (RFX_CONTEXT*) xfi->rfx_context;
NSC_CONTEXT* ncontext = (NSC_CONTEXT*) xfi->nsc_context;
if (surface_bits_command->codecID == CODEC_ID_REMOTEFX)
{
@ -821,6 +823,41 @@ void xf_gdi_surface_bits(rdpUpdate* update, SURFACE_BITS_COMMAND* surface_bits_c
XSetClipMask(xfi->display, xfi->gc, None);
rfx_message_free(context, message);
}
else if (surface_bits_command->codecID == CODEC_ID_NSCODEC)
{
ncontext->width = surface_bits_command->width;
ncontext->height = surface_bits_command->height;
nsc_process_message(ncontext, surface_bits_command->bitmapData, surface_bits_command->bitmapDataLength);
XSetFunction(xfi->display, xfi->gc, GXcopy);
XSetFillStyle(xfi->display, xfi->gc, FillSolid);
xfi->bmp_codec_nsc = (uint8*) xrealloc(xfi->bmp_codec_nsc,
surface_bits_command->width * surface_bits_command->height * 4);
freerdp_image_invert(ncontext->bmpdata, xfi->bmp_codec_nsc,
surface_bits_command->width, surface_bits_command->height, 32);
image = XCreateImage(xfi->display, xfi->visual, 24, ZPixmap, 0,
(char*) xfi->bmp_codec_nsc, surface_bits_command->width, surface_bits_command->height, 32, 0);
XPutImage(xfi->display, xfi->primary, xfi->gc, image, 0, 0,
surface_bits_command->destLeft, surface_bits_command->destTop,
surface_bits_command->width, surface_bits_command->height);
if (xfi->remote_app != True)
{
XCopyArea(xfi->display, xfi->primary, xfi->window->handle, xfi->gc,
surface_bits_command->destLeft, surface_bits_command->destTop,
surface_bits_command->width, surface_bits_command->height,
surface_bits_command->destLeft, surface_bits_command->destTop);
}
gdi_InvalidateRegion(xfi->hdc, surface_bits_command->destLeft, surface_bits_command->destTop,
surface_bits_command->width, surface_bits_command->height);
XSetClipMask(xfi->display, xfi->gc, None);
nsc_context_destroy(ncontext);
}
else if (surface_bits_command->codecID == CODEC_ID_NONE)
{
XSetFunction(xfi->display, xfi->gc, GXcopy);

View File

@ -99,10 +99,11 @@ struct xf_info
boolean complex_regions;
VIRTUAL_SCREEN vscreen;
uint8* bmp_codec_none;
uint8* bmp_codec_nsc;
void* rfx_context;
void* nsc_context;
void* xv_context;
void* clipboard_context;
Atom _NET_WM_ICON;
Atom _MOTIF_WM_HINTS;
Atom _NET_CURRENT_DESKTOP;

View File

@ -247,6 +247,7 @@ struct _GDI
uint8* primary_buffer;
GDI_COLOR textColor;
void* rfx_context;
void* nsc_context;
GDI_IMAGE* tile;
GDI_IMAGE* image;

View File

@ -307,7 +307,9 @@ struct rdp_settings
boolean desktop_composition;
boolean rfx_codec;
boolean ns_codec;
uint8 rfx_codec_id;
uint8 ns_codec_id;
boolean frame_acknowledge;
boolean dump_rfx;

View File

@ -9,7 +9,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ -115,6 +115,10 @@ FREERDP_API void stream_extend(STREAM* stream, int request_size);
memset(_s->p, '\0', (_n)); \
_s->p += (_n); \
} while (0)
#define stream_set_byte(_s, _v, _n) do { \
memset(_s->p, _v, (_n)); \
_s->p += (_n); \
} while (0)
#define stream_peek_uint8(_s, _v) do { _v = *_s->p; } while (0)
#define stream_peek_uint16(_s, _v) do { _v = \

View File

@ -37,7 +37,7 @@ add_library(freerdp-gdi ${FREERDP_GDI_SRCS})
target_link_libraries(freerdp-gdi freerdp-cache)
target_link_libraries(freerdp-gdi freerdp-common)
target_link_libraries(freerdp-gdi freerdp-rfx)
target_link_libraries(freerdp-gdi freerdp-rfx freerdp-nsc)
set_target_properties(freerdp-gdi PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")

View File

@ -8,7 +8,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ -26,6 +26,7 @@
#include <freerdp/utils/bitmap.h>
#include <freerdp/common/color.h>
#include <freerdp/rfx/rfx.h>
#include <freerdp/nsc/nsc.h>
#include <freerdp/gdi/dc.h>
#include <freerdp/gdi/pen.h>
@ -842,6 +843,8 @@ void gdi_surface_bits(rdpUpdate* update, SURFACE_BITS_COMMAND* surface_bits_comm
RFX_MESSAGE* message;
GDI* gdi = GET_GDI(update);
RFX_CONTEXT* context = (RFX_CONTEXT*) gdi->rfx_context;
NSC_CONTEXT* ncontext = (NSC_CONTEXT*) gdi->nsc_context;
DEBUG_GDI("destLeft %d destTop %d destRight %d destBottom %d "
"bpp %d codecID %d width %d height %d length %d",
@ -886,6 +889,20 @@ void gdi_surface_bits(rdpUpdate* update, SURFACE_BITS_COMMAND* surface_bits_comm
gdi_SetNullClipRgn(gdi->primary->hdc);
rfx_message_free(context, message);
}
else if (surface_bits_command->codecID == CODEC_ID_NSCODEC)
{
ncontext->width = surface_bits_command->width;
ncontext->height = surface_bits_command->height;
nsc_process_message(ncontext, surface_bits_command->bitmapData, surface_bits_command->bitmapDataLength);
gdi->image->bitmap->width = surface_bits_command->width;
gdi->image->bitmap->height = surface_bits_command->height;
gdi->image->bitmap->bitsPerPixel = surface_bits_command->bpp;
gdi->image->bitmap->bytesPerPixel = gdi->image->bitmap->bitsPerPixel / 8;
gdi->image->bitmap->data = (uint8*) xrealloc(gdi->image->bitmap->data, gdi->image->bitmap->width * gdi->image->bitmap->height * 4);
freerdp_image_invert(ncontext->bmpdata, gdi->image->bitmap->data, gdi->image->bitmap->width, gdi->image->bitmap->height, 32);
gdi_BitBlt(gdi->primary->hdc, surface_bits_command->destLeft, surface_bits_command->destTop, surface_bits_command->width, surface_bits_command->height, gdi->image->hdc, 0, 0, GDI_SRCCOPY);
nsc_context_destroy(ncontext);
}
else if (surface_bits_command->codecID == CODEC_ID_NONE)
{
gdi->image->bitmap->width = surface_bits_command->width;
@ -1077,6 +1094,7 @@ int gdi_init(freerdp* instance, uint32 flags)
gdi->cache = cache_new(instance->settings);
gdi->rfx_context = rfx_context_new();
gdi->nsc_context = nsc_context_new();
return 0;
}