Merge pull request #2111 from awakecoding/egfx
Exhaustive Color Format Support
This commit is contained in:
commit
f7d21655fa
@ -57,7 +57,7 @@ if(WITH_GSTREAMER_0_10 OR WITH_GSTREAMER_1_0)
|
||||
find_feature(XRandR ${XRANDR_FEATURE_TYPE} ${XRANDR_FEATURE_PURPOSE} ${XRANDR_FEATURE_DESCRIPTION})
|
||||
if (WITH_XRANDR)
|
||||
add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "gstreamer" "decoder")
|
||||
else()
|
||||
else()
|
||||
message(WARNING "Disabling tsmf gstreamer because XRandR wasn't found")
|
||||
endif()
|
||||
endif()
|
||||
|
@ -508,7 +508,7 @@ static void tsmf_ffmpeg_free(ITSMFDecoder *decoder)
|
||||
static BOOL initialized = FALSE;
|
||||
|
||||
#ifdef STATIC_CHANNELS
|
||||
#define freerdp_tsmf_client_subsystem_entry ffmpeg_freerdp_tsmf_client_subsystem_entry
|
||||
#define freerdp_tsmf_client_subsystem_entry ffmpeg_freerdp_tsmf_client_decoder_subsystem_entry
|
||||
#endif
|
||||
|
||||
ITSMFDecoder *freerdp_tsmf_client_subsystem_entry(void)
|
||||
|
@ -748,7 +748,7 @@ BOOL tsmf_gstreamer_sync(ITSMFDecoder *decoder, void (*cb)(void *), void *stream
|
||||
}
|
||||
|
||||
#ifdef STATIC_CHANNELS
|
||||
#define freerdp_tsmf_client_subsystem_entry gstreamer_freerdp_tsmf_client_subsystem_entry
|
||||
#define freerdp_tsmf_client_subsystem_entry gstreamer_freerdp_tsmf_client_decoder_subsystem_entry
|
||||
#endif
|
||||
|
||||
ITSMFDecoder *freerdp_tsmf_client_subsystem_entry(void)
|
||||
|
@ -823,6 +823,44 @@ DWORD fixKeyCode(DWORD keyCode, unichar keyChar, enum APPLE_KEYBOARD_TYPE type)
|
||||
mfc->client_width = width;
|
||||
}
|
||||
|
||||
void mac_OnChannelConnectedEventHandler(rdpContext* context, ChannelConnectedEventArgs* e)
|
||||
{
|
||||
rdpSettings* settings = context->settings;
|
||||
|
||||
if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
|
||||
{
|
||||
|
||||
}
|
||||
else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
|
||||
{
|
||||
if (settings->SoftwareGdi)
|
||||
gdi_graphics_pipeline_init(context->gdi, (RdpgfxClientContext*) e->pInterface);
|
||||
}
|
||||
else if (strcmp(e->name, ENCOMSP_SVC_CHANNEL_NAME) == 0)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void mac_OnChannelDisconnectedEventHandler(rdpContext* context, ChannelDisconnectedEventArgs* e)
|
||||
{
|
||||
rdpSettings* settings = context->settings;
|
||||
|
||||
if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
|
||||
{
|
||||
|
||||
}
|
||||
else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
|
||||
{
|
||||
if (settings->SoftwareGdi)
|
||||
gdi_graphics_pipeline_uninit(context->gdi, (RdpgfxClientContext*) e->pInterface);
|
||||
}
|
||||
else if (strcmp(e->name, ENCOMSP_SVC_CHANNEL_NAME) == 0)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
BOOL mac_pre_connect(freerdp* instance)
|
||||
{
|
||||
rdpSettings* settings;
|
||||
@ -870,6 +908,12 @@ BOOL mac_pre_connect(freerdp* instance)
|
||||
settings->OrderSupport[NEG_POLYGON_CB_INDEX] = FALSE;
|
||||
settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = FALSE;
|
||||
settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = FALSE;
|
||||
|
||||
PubSub_SubscribeChannelConnected(instance->context->pubSub,
|
||||
(pChannelConnectedEventHandler) mac_OnChannelConnectedEventHandler);
|
||||
|
||||
PubSub_SubscribeChannelDisconnected(instance->context->pubSub,
|
||||
(pChannelDisconnectedEventHandler) mac_OnChannelDisconnectedEventHandler);
|
||||
|
||||
freerdp_client_load_addins(instance->context->channels, instance->settings);
|
||||
|
||||
|
@ -10,11 +10,17 @@ typedef struct mf_context mfContext;
|
||||
|
||||
#include <freerdp/gdi/gdi.h>
|
||||
#include <freerdp/gdi/dc.h>
|
||||
#include <freerdp/gdi/gfx.h>
|
||||
#include <freerdp/gdi/region.h>
|
||||
#include <freerdp/rail/rail.h>
|
||||
#include <freerdp/cache/cache.h>
|
||||
#include <freerdp/channels/channels.h>
|
||||
|
||||
#include <freerdp/client/channels.h>
|
||||
#include <freerdp/client/rdpei.h>
|
||||
#include <freerdp/client/rdpgfx.h>
|
||||
#include <freerdp/client/encomsp.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/synch.h>
|
||||
#include <winpr/thread.h>
|
||||
|
@ -29,16 +29,16 @@ set(${MODULE_PREFIX}_SRCS
|
||||
wf_gdi.h
|
||||
wf_event.c
|
||||
wf_event.h
|
||||
wf_channels.c
|
||||
wf_channels.h
|
||||
wf_graphics.c
|
||||
wf_graphics.h
|
||||
wf_cliprdr.c
|
||||
wf_cliprdr.h
|
||||
wf_window.c
|
||||
wf_window.h
|
||||
wf_rail.c
|
||||
wf_rail.h
|
||||
wf_interface.c
|
||||
wf_interface.h
|
||||
wf_client.c
|
||||
wf_client.h
|
||||
wf_floatbar.c
|
||||
wf_floatbar.h
|
||||
wfreerdp.rc
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#include "wf_interface.h"
|
||||
#include "wf_client.h"
|
||||
|
||||
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
|
||||
{
|
||||
|
65
client/Windows/wf_channels.c
Normal file
65
client/Windows/wf_channels.c
Normal file
@ -0,0 +1,65 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
*
|
||||
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* 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
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "wf_channels.h"
|
||||
|
||||
#include <freerdp/gdi/gfx.h>
|
||||
|
||||
void wf_OnChannelConnectedEventHandler(rdpContext* context, ChannelConnectedEventArgs* e)
|
||||
{
|
||||
wfContext* wfc = (wfContext*) context;
|
||||
rdpSettings* settings = context->settings;
|
||||
|
||||
if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
|
||||
{
|
||||
|
||||
}
|
||||
else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
|
||||
{
|
||||
if (settings->SoftwareGdi)
|
||||
gdi_graphics_pipeline_init(context->gdi, (RdpgfxClientContext*) e->pInterface);
|
||||
}
|
||||
else if (strcmp(e->name, ENCOMSP_SVC_CHANNEL_NAME) == 0)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void wf_OnChannelDisconnectedEventHandler(rdpContext* context, ChannelDisconnectedEventArgs* e)
|
||||
{
|
||||
wfContext* wfc = (wfContext*) context;
|
||||
rdpSettings* settings = context->settings;
|
||||
|
||||
if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
|
||||
{
|
||||
|
||||
}
|
||||
else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
|
||||
{
|
||||
if (settings->SoftwareGdi)
|
||||
gdi_graphics_pipeline_uninit(context->gdi, (RdpgfxClientContext*) e->pInterface);
|
||||
}
|
||||
else if (strcmp(e->name, ENCOMSP_SVC_CHANNEL_NAME) == 0)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,8 +1,7 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Windows RAIL
|
||||
*
|
||||
* Copyright 2012 Jason Champion <jchampion@zetacentauri.com>
|
||||
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -17,11 +16,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __WF_WINDOW_H
|
||||
#define __WF_WINDOW_H
|
||||
#ifndef __WF_CHANNELS_H
|
||||
#define __WF_CHANNELS_H
|
||||
|
||||
#include <freerdp/freerdp.h>
|
||||
#include <freerdp/client/channels.h>
|
||||
#include <freerdp/client/rdpei.h>
|
||||
#include <freerdp/client/rdpgfx.h>
|
||||
#include <freerdp/client/encomsp.h>
|
||||
|
||||
#include "wf_interface.h"
|
||||
#include "wf_client.h"
|
||||
|
||||
void wf_OnChannelConnectedEventHandler(rdpContext* context, ChannelConnectedEventArgs* e);
|
||||
void wf_OnChannelDisconnectedEventHandler(rdpContext* context, ChannelDisconnectedEventArgs* e);
|
||||
|
||||
#endif
|
@ -47,10 +47,11 @@
|
||||
#include <freerdp/event.h>
|
||||
|
||||
#include "wf_gdi.h"
|
||||
#include "wf_channels.h"
|
||||
#include "wf_graphics.h"
|
||||
#include "wf_cliprdr.h"
|
||||
|
||||
#include "wf_interface.h"
|
||||
#include "wf_client.h"
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
@ -292,6 +293,13 @@ BOOL wf_pre_connect(freerdp* instance)
|
||||
}
|
||||
|
||||
freerdp_set_param_uint32(settings, FreeRDP_KeyboardLayout, (int) GetKeyboardLayout(0) & 0x0000FFFF);
|
||||
|
||||
PubSub_SubscribeChannelConnected(instance->context->pubSub,
|
||||
(pChannelConnectedEventHandler) wf_OnChannelConnectedEventHandler);
|
||||
|
||||
PubSub_SubscribeChannelDisconnected(instance->context->pubSub,
|
||||
(pChannelDisconnectedEventHandler) wf_OnChannelDisconnectedEventHandler);
|
||||
|
||||
freerdp_channels_pre_connect(instance->context->channels, instance);
|
||||
|
||||
return TRUE;
|
@ -20,11 +20,13 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/stream.h>
|
||||
|
||||
#include <freerdp/utils/event.h>
|
||||
#include <winpr/stream.h>
|
||||
#include <freerdp/client/cliprdr.h>
|
||||
#include <freerdp/log.h>
|
||||
#include <freerdp/utils/event.h>
|
||||
|
@ -24,7 +24,8 @@
|
||||
|
||||
#include <Ole2.h>
|
||||
#include <ShlObj.h>
|
||||
#include "wf_interface.h"
|
||||
|
||||
#include "wf_client.h"
|
||||
#include <freerdp/log.h>
|
||||
|
||||
#define TAG CLIENT_TAG(WIN_CLIPRDR_TAG)
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "wf_cliprdr_EnumFORMATETC.h"
|
||||
|
||||
static void cliprdr_format_deep_copy(FORMATETC *dest, FORMATETC *source)
|
||||
|
@ -27,11 +27,12 @@
|
||||
|
||||
#include <freerdp/freerdp.h>
|
||||
|
||||
#include "wf_interface.h"
|
||||
#include "wf_client.h"
|
||||
|
||||
#include "wf_gdi.h"
|
||||
#include "wf_event.h"
|
||||
#include "freerdp/event.h"
|
||||
|
||||
#include <freerdp/event.h>
|
||||
|
||||
static HWND g_focus_hWnd;
|
||||
|
||||
|
@ -22,10 +22,9 @@
|
||||
#ifndef __WF_EVENT_H
|
||||
#define __WF_EVENT_H
|
||||
|
||||
#include "wf_client.h"
|
||||
#include <freerdp/log.h>
|
||||
|
||||
#include "wf_interface.h"
|
||||
|
||||
LRESULT CALLBACK wf_ll_kbd_proc(int nCode, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
|
@ -17,15 +17,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <Windows.h>
|
||||
#include <stdlib.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/windows.h>
|
||||
|
||||
#include "wf_interface.h"
|
||||
#include "wf_floatbar.h"
|
||||
#include "wf_window.h"
|
||||
#include "wf_gdi.h"
|
||||
#include "resource.h"
|
||||
|
||||
#include "wf_client.h"
|
||||
#include "wf_floatbar.h"
|
||||
#include "wf_gdi.h"
|
||||
|
||||
typedef struct _Button Button;
|
||||
|
||||
/* TIMERs */
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include <freerdp/codec/rfx.h>
|
||||
#include <freerdp/codec/nsc.h>
|
||||
|
||||
#include "wf_interface.h"
|
||||
#include "wf_client.h"
|
||||
#include "wf_graphics.h"
|
||||
#include "wf_gdi.h"
|
||||
|
||||
@ -407,14 +407,14 @@ void wf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
|
||||
freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_INTERLEAVED);
|
||||
|
||||
status = interleaved_decompress(codecs->interleaved, pSrcData, SrcSize, bitsPerPixel,
|
||||
&pDstData, PIXEL_FORMAT_XRGB32, nWidth * 4, 0, 0, nWidth, nHeight);
|
||||
&pDstData, PIXEL_FORMAT_XRGB32, nWidth * 4, 0, 0, nWidth, nHeight, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_PLANAR);
|
||||
|
||||
status = planar_decompress(codecs->planar, pSrcData, SrcSize, &pDstData,
|
||||
PIXEL_FORMAT_XRGB32, nWidth * 4, 0, 0, nWidth, nHeight);
|
||||
PIXEL_FORMAT_XRGB32, nWidth * 4, 0, 0, nWidth, nHeight, TRUE);
|
||||
}
|
||||
|
||||
if (status < 0)
|
||||
|
@ -22,7 +22,7 @@
|
||||
#ifndef __WF_GDI_H
|
||||
#define __WF_GDI_H
|
||||
|
||||
#include "wf_interface.h"
|
||||
#include "wf_client.h"
|
||||
|
||||
void wf_invalidate_region(wfContext* wfc, int x, int y, int width, int height);
|
||||
wfBitmap* wf_image_new(wfContext* wfc, int width, int height, int bpp, BYTE* data);
|
||||
|
@ -174,14 +174,14 @@ void wf_Bitmap_Decompress(wfContext* wfc, rdpBitmap* bitmap,
|
||||
freerdp_client_codecs_prepare(wfc->codecs, FREERDP_CODEC_INTERLEAVED);
|
||||
|
||||
status = interleaved_decompress(wfc->codecs->interleaved, pSrcData, SrcSize, bpp,
|
||||
&pDstData, PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height);
|
||||
&pDstData, PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
freerdp_client_codecs_prepare(wfc->codecs, FREERDP_CODEC_PLANAR);
|
||||
|
||||
status = planar_decompress(wfc->codecs->planar, pSrcData, SrcSize, &pDstData,
|
||||
PIXEL_FORMAT_XRGB32_VF, width * 4, 0, 0, width, height);
|
||||
PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height, TRUE);
|
||||
}
|
||||
|
||||
if (status < 0)
|
||||
@ -195,7 +195,7 @@ void wf_Bitmap_Decompress(wfContext* wfc, rdpBitmap* bitmap,
|
||||
SrcFormat = gdi_get_pixel_format(bpp, TRUE);
|
||||
|
||||
status = freerdp_image_copy(pDstData, PIXEL_FORMAT_XRGB32, width * 4, 0, 0,
|
||||
width, height, pSrcData, SrcFormat, width * bytesPerPixel, 0, 0);
|
||||
width, height, pSrcData, SrcFormat, width * bytesPerPixel, 0, 0, NULL);
|
||||
}
|
||||
|
||||
bitmap->compressed = FALSE;
|
||||
|
@ -20,7 +20,7 @@
|
||||
#ifndef __WF_GRAPHICS_H
|
||||
#define __WF_GRAPHICS_H
|
||||
|
||||
#include "wf_interface.h"
|
||||
#include "wf_client.h"
|
||||
|
||||
HBITMAP wf_create_dib(wfContext* wfc, int width, int height, int bpp, BYTE* data, BYTE** pdata);
|
||||
wfBitmap* wf_image_new(wfContext* wfc, int width, int height, int bpp, BYTE* data);
|
||||
|
@ -21,12 +21,12 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freerdp/utils/event.h>
|
||||
#include <winpr/print.h>
|
||||
|
||||
#include <freerdp/utils/event.h>
|
||||
#include <freerdp/utils/rail.h>
|
||||
#include <freerdp/rail/rail.h>
|
||||
|
||||
#include "wf_window.h"
|
||||
#include "wf_rail.h"
|
||||
|
||||
void wf_rail_paint(wfContext* wfc, rdpRail* rail, INT32 uleft, INT32 utop, UINT32 uright, UINT32 ubottom)
|
||||
|
@ -19,7 +19,7 @@
|
||||
#ifndef __WF_RAIL_H
|
||||
#define __WF_RAIL_H
|
||||
|
||||
#include "wf_interface.h"
|
||||
#include "wf_client.h"
|
||||
|
||||
void wf_rail_paint(wfContext* wfc, rdpRail* rail, INT32 uleft, INT32 utop, UINT32 uright, UINT32 ubottom);
|
||||
void wf_rail_register_callbacks(wfContext* wfc, rdpRail* rail);
|
||||
|
@ -1,24 +0,0 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Windows RAIL
|
||||
*
|
||||
* Copyright 2012 Jason Champion <jchampion@zetacentauri.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* 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
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "wf_window.h"
|
@ -241,7 +241,6 @@ void xf_sw_end_paint(rdpContext *context)
|
||||
w = cinvalid[i].w;
|
||||
h = cinvalid[i].h;
|
||||
|
||||
//combine xfc->primary with xfc->image
|
||||
XPutImage(xfc->display, xfc->primary, xfc->gc, xfc->image, x, y, x, y, w, h);
|
||||
|
||||
if ((xfc->settings->ScalingFactor != 1.0) || (xfc->offset_x) || (xfc->offset_y))
|
||||
@ -272,25 +271,24 @@ void xf_sw_end_paint(rdpContext *context)
|
||||
}
|
||||
}
|
||||
|
||||
void xf_sw_desktop_resize(rdpContext *context)
|
||||
void xf_sw_desktop_resize(rdpContext* context)
|
||||
{
|
||||
rdpSettings *settings;
|
||||
xfContext *xfc = (xfContext *) context;
|
||||
settings = xfc->instance->settings;
|
||||
rdpGdi* gdi = context->gdi;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
xf_lock_x11(xfc, TRUE);
|
||||
|
||||
if (!xfc->fullscreen)
|
||||
{
|
||||
rdpGdi *gdi = context->gdi;
|
||||
gdi_resize(gdi, xfc->width, xfc->height);
|
||||
|
||||
if (xfc->image)
|
||||
{
|
||||
xfc->image->data = NULL;
|
||||
XDestroyImage(xfc->image);
|
||||
|
||||
xfc->image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
|
||||
(char *) gdi->primary_buffer, gdi->width, gdi->height, xfc->scanline_pad, 0);
|
||||
(char*) gdi->primary_buffer, gdi->width, gdi->height, xfc->scanline_pad, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -299,7 +297,7 @@ void xf_sw_desktop_resize(rdpContext *context)
|
||||
|
||||
void xf_hw_begin_paint(rdpContext *context)
|
||||
{
|
||||
xfContext *xfc = (xfContext *) context;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
xfc->hdc->hwnd->invalid->null = 1;
|
||||
xfc->hdc->hwnd->ninvalid = 0;
|
||||
}
|
||||
@ -308,19 +306,23 @@ void xf_hw_end_paint(rdpContext *context)
|
||||
{
|
||||
INT32 x, y;
|
||||
UINT32 w, h;
|
||||
xfContext *xfc = (xfContext *) context;
|
||||
if(!xfc->remote_app)
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
if (!xfc->remote_app)
|
||||
{
|
||||
if(!xfc->complex_regions)
|
||||
if (!xfc->complex_regions)
|
||||
{
|
||||
if(xfc->hdc->hwnd->invalid->null)
|
||||
if (xfc->hdc->hwnd->invalid->null)
|
||||
return;
|
||||
|
||||
x = xfc->hdc->hwnd->invalid->x;
|
||||
y = xfc->hdc->hwnd->invalid->y;
|
||||
w = xfc->hdc->hwnd->invalid->w;
|
||||
h = xfc->hdc->hwnd->invalid->h;
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
if((xfc->settings->ScalingFactor != 1.0) || (xfc->offset_x) || (xfc->offset_y))
|
||||
|
||||
if ((xfc->settings->ScalingFactor != 1.0) || (xfc->offset_x) || (xfc->offset_y))
|
||||
{
|
||||
xf_draw_screen_scaled(xfc, x, y, w, h, TRUE);
|
||||
}
|
||||
@ -328,6 +330,7 @@ void xf_hw_end_paint(rdpContext *context)
|
||||
{
|
||||
XCopyArea(xfc->display, xfc->primary, xfc->drawable, xfc->gc, x, y, w, h, x, y);
|
||||
}
|
||||
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
}
|
||||
else
|
||||
@ -335,18 +338,23 @@ void xf_hw_end_paint(rdpContext *context)
|
||||
int i;
|
||||
int ninvalid;
|
||||
HGDI_RGN cinvalid;
|
||||
if(xfc->hdc->hwnd->ninvalid < 1)
|
||||
|
||||
if (xfc->hdc->hwnd->ninvalid < 1)
|
||||
return;
|
||||
|
||||
ninvalid = xfc->hdc->hwnd->ninvalid;
|
||||
cinvalid = xfc->hdc->hwnd->cinvalid;
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
for(i = 0; i < ninvalid; i++)
|
||||
|
||||
for (i = 0; i < ninvalid; i++)
|
||||
{
|
||||
x = cinvalid[i].x;
|
||||
y = cinvalid[i].y;
|
||||
w = cinvalid[i].w;
|
||||
h = cinvalid[i].h;
|
||||
if((xfc->settings->ScalingFactor != 1.0) || (xfc->offset_x) || (xfc->offset_y))
|
||||
|
||||
if ((xfc->settings->ScalingFactor != 1.0) || (xfc->offset_x) || (xfc->offset_y))
|
||||
{
|
||||
xf_draw_screen_scaled(xfc, x, y, w, h, TRUE);
|
||||
}
|
||||
@ -355,20 +363,26 @@ void xf_hw_end_paint(rdpContext *context)
|
||||
XCopyArea(xfc->display, xfc->primary, xfc->drawable, xfc->gc, x, y, w, h, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
XFlush(xfc->display);
|
||||
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(xfc->hdc->hwnd->invalid->null)
|
||||
if (xfc->hdc->hwnd->invalid->null)
|
||||
return;
|
||||
|
||||
x = xfc->hdc->hwnd->invalid->x;
|
||||
y = xfc->hdc->hwnd->invalid->y;
|
||||
w = xfc->hdc->hwnd->invalid->w;
|
||||
h = xfc->hdc->hwnd->invalid->h;
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
xf_rail_paint(xfc, context->rail, x, y, x + w - 1, y + h - 1);
|
||||
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
}
|
||||
}
|
||||
@ -379,19 +393,24 @@ void xf_hw_desktop_resize(rdpContext *context)
|
||||
rdpSettings *settings;
|
||||
xfContext *xfc = (xfContext *) context;
|
||||
settings = xfc->instance->settings;
|
||||
|
||||
xf_lock_x11(xfc, TRUE);
|
||||
if(!xfc->fullscreen)
|
||||
|
||||
if (!xfc->fullscreen)
|
||||
{
|
||||
xfc->width = settings->DesktopWidth;
|
||||
xfc->height = settings->DesktopHeight;
|
||||
if(xfc->window)
|
||||
|
||||
if (xfc->window)
|
||||
xf_ResizeDesktopWindow(xfc, xfc->window, settings->DesktopWidth, settings->DesktopHeight);
|
||||
if(xfc->primary)
|
||||
|
||||
if (xfc->primary)
|
||||
{
|
||||
same = (xfc->primary == xfc->drawing) ? TRUE : FALSE;
|
||||
XFreePixmap(xfc->display, xfc->primary);
|
||||
xfc->primary = XCreatePixmap(xfc->display, xfc->drawable,
|
||||
xfc->width, xfc->height, xfc->depth);
|
||||
|
||||
xfc->primary = XCreatePixmap(xfc->display, xfc->drawable, xfc->width, xfc->height, xfc->depth);
|
||||
|
||||
if(same)
|
||||
xfc->drawing = xfc->primary;
|
||||
}
|
||||
@ -403,6 +422,7 @@ void xf_hw_desktop_resize(rdpContext *context)
|
||||
XSetForeground(xfc->display, xfc->gc, 0);
|
||||
XFillRectangle(xfc->display, xfc->drawable, xfc->gc, 0, 0, xfc->width, xfc->height);
|
||||
}
|
||||
|
||||
xf_unlock_x11(xfc, TRUE);
|
||||
}
|
||||
|
||||
@ -738,8 +758,10 @@ BOOL xf_pre_connect(freerdp* instance)
|
||||
settings->OrderSupport[NEG_POLYGON_CB_INDEX] = (settings->SoftwareGdi) ? FALSE : TRUE;
|
||||
settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = FALSE;
|
||||
settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = FALSE;
|
||||
|
||||
xfc->UseXThreads = TRUE;
|
||||
if(xfc->UseXThreads)
|
||||
|
||||
if (xfc->UseXThreads)
|
||||
{
|
||||
if(!XInitThreads())
|
||||
{
|
||||
@ -747,43 +769,51 @@ BOOL xf_pre_connect(freerdp* instance)
|
||||
xfc->UseXThreads = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
xfc->display = XOpenDisplay(NULL);
|
||||
if(!xfc->display)
|
||||
|
||||
if (!xfc->display)
|
||||
{
|
||||
WLog_ERR(TAG, "failed to open display: %s", XDisplayName(NULL));
|
||||
WLog_ERR(TAG, "Please check that the $DISPLAY environment variable is properly set.");
|
||||
return FALSE;
|
||||
}
|
||||
if(xfc->debug)
|
||||
|
||||
if (xfc->debug)
|
||||
{
|
||||
WLog_INFO(TAG, "Enabling X11 debug mode.");
|
||||
XSynchronize(xfc->display, TRUE);
|
||||
_def_error_handler = XSetErrorHandler(_xf_error_handler);
|
||||
}
|
||||
|
||||
xfc->mutex = CreateMutex(NULL, FALSE, NULL);
|
||||
|
||||
PubSub_SubscribeChannelConnected(instance->context->pubSub,
|
||||
(pChannelConnectedEventHandler) xf_OnChannelConnectedEventHandler);
|
||||
(pChannelConnectedEventHandler) xf_OnChannelConnectedEventHandler);
|
||||
PubSub_SubscribeChannelDisconnected(instance->context->pubSub,
|
||||
(pChannelDisconnectedEventHandler) xf_OnChannelDisconnectedEventHandler);
|
||||
(pChannelDisconnectedEventHandler) xf_OnChannelDisconnectedEventHandler);
|
||||
|
||||
freerdp_client_load_addins(channels, instance->settings);
|
||||
freerdp_channels_pre_connect(channels, instance);
|
||||
if(settings->AuthenticationOnly)
|
||||
|
||||
if (settings->AuthenticationOnly)
|
||||
{
|
||||
/* Check --authonly has a username and password. */
|
||||
if(settings->Username == NULL)
|
||||
if (!settings->Username)
|
||||
{
|
||||
WLog_INFO(TAG, "--authonly, but no -u username. Please provide one.");
|
||||
WLog_INFO(TAG, "--authonly, but no -u username. Please provide one.");
|
||||
return FALSE;
|
||||
}
|
||||
if(settings->Password == NULL)
|
||||
|
||||
if (!settings->Password)
|
||||
{
|
||||
WLog_INFO(TAG, "--authonly, but no -p password. Please provide one.");
|
||||
WLog_INFO(TAG, "--authonly, but no -p password. Please provide one.");
|
||||
return FALSE;
|
||||
}
|
||||
WLog_INFO(TAG, "Authentication only. Don't connect to X.");
|
||||
/* Avoid XWindows initialization and configuration below. */
|
||||
return TRUE;
|
||||
|
||||
WLog_INFO(TAG, "Authentication only. Don't connect to X.");
|
||||
}
|
||||
|
||||
xfc->_NET_WM_ICON = XInternAtom(xfc->display, "_NET_WM_ICON", False);
|
||||
xfc->_MOTIF_WM_HINTS = XInternAtom(xfc->display, "_MOTIF_WM_HINTS", False);
|
||||
xfc->_NET_CURRENT_DESKTOP = XInternAtom(xfc->display, "_NET_CURRENT_DESKTOP", False);
|
||||
@ -803,21 +833,39 @@ BOOL xf_pre_connect(freerdp* instance)
|
||||
xfc->WM_PROTOCOLS = XInternAtom(xfc->display, "WM_PROTOCOLS", False);
|
||||
xfc->WM_DELETE_WINDOW = XInternAtom(xfc->display, "WM_DELETE_WINDOW", False);
|
||||
xfc->WM_STATE = XInternAtom(xfc->display, "WM_STATE", False);
|
||||
|
||||
xf_keyboard_init(xfc);
|
||||
|
||||
xfc->clrconv = freerdp_clrconv_new(CLRCONV_ALPHA);
|
||||
instance->context->cache = cache_new(instance->settings);
|
||||
|
||||
xfc->xfds = ConnectionNumber(xfc->display);
|
||||
xfc->screen_number = DefaultScreen(xfc->display);
|
||||
xfc->screen = ScreenOfDisplay(xfc->display, xfc->screen_number);
|
||||
xfc->depth = DefaultDepthOfScreen(xfc->screen);
|
||||
xfc->big_endian = (ImageByteOrder(xfc->display) == MSBFirst);
|
||||
xfc->invert = (ImageByteOrder(xfc->display) == MSBFirst) ? TRUE : FALSE;
|
||||
xfc->complex_regions = TRUE;
|
||||
xfc->fullscreen = settings->Fullscreen;
|
||||
xfc->grab_keyboard = settings->GrabKeyboard;
|
||||
xfc->fullscreen_toggle = settings->ToggleFullscreen;
|
||||
|
||||
xf_detect_monitors(xfc, settings);
|
||||
xfc->colormap = DefaultColormap(xfc->display, xfc->screen_number);
|
||||
|
||||
xfc->format = PIXEL_FORMAT_XRGB32;
|
||||
|
||||
if (xfc->depth == 32)
|
||||
xfc->format = (!xfc->invert) ? PIXEL_FORMAT_XRGB32 : PIXEL_FORMAT_XBGR32;
|
||||
else if (xfc->depth == 24)
|
||||
xfc->format = (!xfc->invert) ? PIXEL_FORMAT_XRGB32 : PIXEL_FORMAT_XBGR32;
|
||||
else if (xfc->depth == 16)
|
||||
xfc->format = (!xfc->invert) ? PIXEL_FORMAT_RGB565 : PIXEL_FORMAT_BGR565;
|
||||
else if (xfc->depth == 15)
|
||||
xfc->format = (!xfc->invert) ? PIXEL_FORMAT_RGB555 : PIXEL_FORMAT_BGR555;
|
||||
else
|
||||
xfc->format = PIXEL_FORMAT_XRGB32;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -850,7 +898,7 @@ BOOL xf_post_connect(freerdp *instance)
|
||||
UINT32 flags;
|
||||
flags = CLRCONV_ALPHA;
|
||||
|
||||
if(xfc->bpp > 16)
|
||||
if (xfc->bpp > 16)
|
||||
flags |= CLRBUF_32BPP;
|
||||
else
|
||||
flags |= CLRBUF_16BPP;
|
||||
@ -898,9 +946,9 @@ BOOL xf_post_connect(freerdp *instance)
|
||||
XSetForeground(xfc->display, xfc->gc, BlackPixelOfScreen(xfc->screen));
|
||||
XFillRectangle(xfc->display, xfc->primary, xfc->gc, 0, 0, xfc->width, xfc->height);
|
||||
XFlush(xfc->display);
|
||||
|
||||
xfc->image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
|
||||
(char*) xfc->primary_buffer, xfc->width, xfc->height, xfc->scanline_pad, 0);
|
||||
xfc->bmp_codec_none = (BYTE *) malloc(64 * 64 * 4);
|
||||
|
||||
if (settings->SoftwareGdi)
|
||||
{
|
||||
@ -1593,9 +1641,6 @@ static void xfreerdp_client_free(freerdp* instance, rdpContext* context)
|
||||
{
|
||||
xf_window_free(xfc);
|
||||
|
||||
if (xfc->bmp_codec_none)
|
||||
free(xfc->bmp_codec_none);
|
||||
|
||||
if (xfc->bitmap_buffer)
|
||||
_aligned_free(xfc->bitmap_buffer);
|
||||
|
||||
|
@ -247,7 +247,7 @@ Pixmap xf_brush_new(xfContext* xfc, int width, int height, int bpp, BYTE* data)
|
||||
|
||||
bitmap = XCreatePixmap(xfc->display, xfc->drawable, width, height, xfc->depth);
|
||||
|
||||
if (data != NULL)
|
||||
if (data)
|
||||
{
|
||||
GC gc;
|
||||
|
||||
@ -350,14 +350,14 @@ void xf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
|
||||
freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_INTERLEAVED);
|
||||
|
||||
status = interleaved_decompress(codecs->interleaved, pSrcData, SrcSize, bitsPerPixel,
|
||||
&pDstData, PIXEL_FORMAT_XRGB32, nWidth * 4, 0, 0, nWidth, nHeight);
|
||||
&pDstData, xfc->format, -1, 0, 0, nWidth, nHeight, xfc->palette);
|
||||
}
|
||||
else
|
||||
{
|
||||
freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_PLANAR);
|
||||
|
||||
status = planar_decompress(codecs->planar, pSrcData, SrcSize, &pDstData,
|
||||
PIXEL_FORMAT_XRGB32_VF, nWidth * 4, 0, 0, nWidth, nHeight);
|
||||
xfc->format, -1, 0, 0, nWidth, nHeight, TRUE);
|
||||
}
|
||||
|
||||
if (status < 0)
|
||||
@ -368,6 +368,15 @@ void xf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
|
||||
|
||||
pSrcData = xfc->bitmap_buffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
pDstData = xfc->bitmap_buffer;
|
||||
|
||||
status = freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
|
||||
nWidth, nHeight, pSrcData, SrcFormat, -1, 0, 0, xfc->palette);
|
||||
|
||||
pSrcData = xfc->bitmap_buffer;
|
||||
}
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
@ -392,12 +401,23 @@ void xf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
|
||||
|
||||
void xf_gdi_palette_update(rdpContext* context, PALETTE_UPDATE* palette)
|
||||
{
|
||||
int index;
|
||||
PALETTE_ENTRY* pe;
|
||||
UINT32* palette32;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
CopyMemory(xfc->clrconv->palette, palette, sizeof(rdpPalette));
|
||||
|
||||
palette32 = (UINT32*) xfc->palette;
|
||||
|
||||
for (index = 0; index < palette->number; index++)
|
||||
{
|
||||
pe = &(palette->entries[index]);
|
||||
palette32[index] = RGB32(pe->red, pe->green, pe->blue);
|
||||
}
|
||||
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
}
|
||||
|
||||
@ -408,7 +428,7 @@ void xf_gdi_set_bounds(rdpContext* context, rdpBounds* bounds)
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
if (bounds != NULL)
|
||||
if (bounds)
|
||||
{
|
||||
clip.x = bounds->left;
|
||||
clip.y = bounds->top;
|
||||
@ -439,7 +459,7 @@ void xf_gdi_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt)
|
||||
|
||||
if (xfc->drawing == xfc->primary)
|
||||
{
|
||||
if (xfc->remote_app != TRUE)
|
||||
if (!xfc->remote_app)
|
||||
{
|
||||
XFillRectangle(xfc->display, xfc->drawable, xfc->gc, dstblt->nLeftRect, dstblt->nTopRect, dstblt->nWidth, dstblt->nHeight);
|
||||
}
|
||||
@ -464,9 +484,9 @@ void xf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
brush = &patblt->brush;
|
||||
xf_set_rop3(xfc, gdi_rop3_code(patblt->bRop));
|
||||
|
||||
foreColor = freerdp_color_convert_drawing_order_color_to_gdi_color(patblt->foreColor, context->settings->ColorDepth, xfc->clrconv);
|
||||
foreColor = freerdp_convert_gdi_order_color(patblt->foreColor, context->settings->ColorDepth, xfc->format, xfc->palette);
|
||||
foreColor = xf_gdi_get_color(xfc, foreColor);
|
||||
backColor = freerdp_color_convert_drawing_order_color_to_gdi_color(patblt->backColor, context->settings->ColorDepth, xfc->clrconv);
|
||||
backColor = freerdp_convert_gdi_order_color(patblt->backColor, context->settings->ColorDepth, xfc->format, xfc->palette);
|
||||
backColor = xf_gdi_get_color(xfc, backColor);
|
||||
|
||||
if (brush->style == GDI_BS_SOLID)
|
||||
@ -533,7 +553,7 @@ void xf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
if (xfc->drawing == xfc->primary)
|
||||
{
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
if (xfc->remote_app != TRUE)
|
||||
if (!xfc->remote_app)
|
||||
{
|
||||
XCopyArea(xfc->display, xfc->primary, xfc->drawable, xfc->gc, patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight, patblt->nLeftRect, patblt->nTopRect);
|
||||
}
|
||||
@ -558,7 +578,7 @@ void xf_gdi_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt)
|
||||
|
||||
if (xfc->drawing == xfc->primary)
|
||||
{
|
||||
if (xfc->remote_app != TRUE)
|
||||
if (!xfc->remote_app)
|
||||
{
|
||||
if (xfc->unobscured)
|
||||
{
|
||||
@ -586,7 +606,7 @@ void xf_gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
color = freerdp_color_convert_drawing_order_color_to_gdi_color(opaque_rect->color, context->settings->ColorDepth, xfc->clrconv);
|
||||
color = freerdp_convert_gdi_order_color(opaque_rect->color, context->settings->ColorDepth, xfc->format, xfc->palette);
|
||||
color = xf_gdi_get_color(xfc, color);
|
||||
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
@ -599,12 +619,13 @@ void xf_gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
|
||||
|
||||
if (xfc->drawing == xfc->primary)
|
||||
{
|
||||
if (xfc->remote_app != TRUE)
|
||||
if (!xfc->remote_app)
|
||||
{
|
||||
XFillRectangle(xfc->display, xfc->drawable, xfc->gc,
|
||||
opaque_rect->nLeftRect, opaque_rect->nTopRect,
|
||||
opaque_rect->nWidth, opaque_rect->nHeight);
|
||||
}
|
||||
|
||||
gdi_InvalidateRegion(xfc->hdc, opaque_rect->nLeftRect, opaque_rect->nTopRect,
|
||||
opaque_rect->nWidth, opaque_rect->nHeight);
|
||||
}
|
||||
@ -621,7 +642,7 @@ void xf_gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* mult
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
color = freerdp_color_convert_drawing_order_color_to_gdi_color(multi_opaque_rect->color, context->settings->ColorDepth, xfc->clrconv);
|
||||
color = freerdp_convert_gdi_order_color(multi_opaque_rect->color, context->settings->ColorDepth, xfc->format, xfc->palette);
|
||||
color = xf_gdi_get_color(xfc, color);
|
||||
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
@ -638,7 +659,7 @@ void xf_gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* mult
|
||||
|
||||
if (xfc->drawing == xfc->primary)
|
||||
{
|
||||
if (xfc->remote_app != TRUE)
|
||||
if (!xfc->remote_app)
|
||||
{
|
||||
XFillRectangle(xfc->display, xfc->drawable, xfc->gc,
|
||||
rectangle->left, rectangle->top,
|
||||
@ -664,7 +685,7 @@ void xf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
xf_set_rop2(xfc, line_to->bRop2);
|
||||
color = freerdp_color_convert_drawing_order_color_to_gdi_color(line_to->penColor, context->settings->ColorDepth, xfc->clrconv);
|
||||
color = freerdp_convert_gdi_order_color(line_to->penColor, context->settings->ColorDepth, xfc->format, xfc->palette);
|
||||
color = xf_gdi_get_color(xfc, color);
|
||||
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
@ -675,7 +696,7 @@ void xf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
|
||||
|
||||
if (xfc->drawing == xfc->primary)
|
||||
{
|
||||
if (xfc->remote_app != TRUE)
|
||||
if (!xfc->remote_app)
|
||||
{
|
||||
XDrawLine(xfc->display, xfc->drawable, xfc->gc,
|
||||
line_to->nXStart, line_to->nYStart, line_to->nXEnd, line_to->nYEnd);
|
||||
@ -715,7 +736,7 @@ void xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
xf_set_rop2(xfc, polyline->bRop2);
|
||||
color = freerdp_color_convert_drawing_order_color_to_gdi_color(polyline->penColor, context->settings->ColorDepth, xfc->clrconv);
|
||||
color = freerdp_convert_gdi_order_color(polyline->penColor, context->settings->ColorDepth, xfc->format, xfc->palette);
|
||||
color = xf_gdi_get_color(xfc, color);
|
||||
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
@ -737,7 +758,7 @@ void xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
|
||||
|
||||
if (xfc->drawing == xfc->primary)
|
||||
{
|
||||
if (xfc->remote_app != TRUE)
|
||||
if (!xfc->remote_app)
|
||||
{
|
||||
XDrawLines(xfc->display, xfc->drawable, xfc->gc, points, npoints, CoordModePrevious);
|
||||
}
|
||||
@ -784,12 +805,13 @@ void xf_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
|
||||
|
||||
if (xfc->drawing == xfc->primary)
|
||||
{
|
||||
if (xfc->remote_app != TRUE)
|
||||
if (!xfc->remote_app)
|
||||
{
|
||||
XCopyArea(xfc->display, bitmap->pixmap, xfc->drawable, xfc->gc,
|
||||
memblt->nXSrc, memblt->nYSrc, memblt->nWidth, memblt->nHeight,
|
||||
memblt->nLeftRect, memblt->nTopRect);
|
||||
}
|
||||
|
||||
gdi_InvalidateRegion(xfc->hdc, memblt->nLeftRect, memblt->nTopRect, memblt->nWidth, memblt->nHeight);
|
||||
}
|
||||
|
||||
@ -812,9 +834,9 @@ void xf_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
|
||||
brush = &mem3blt->brush;
|
||||
bitmap = (xfBitmap*) mem3blt->bitmap;
|
||||
xf_set_rop3(xfc, gdi_rop3_code(mem3blt->bRop));
|
||||
foreColor = freerdp_color_convert_drawing_order_color_to_gdi_color(mem3blt->foreColor, context->settings->ColorDepth, xfc->clrconv);
|
||||
foreColor = freerdp_convert_gdi_order_color(mem3blt->foreColor, context->settings->ColorDepth, xfc->format, xfc->palette);
|
||||
foreColor = xf_gdi_get_color(xfc, foreColor);
|
||||
backColor = freerdp_color_convert_drawing_order_color_to_gdi_color(mem3blt->backColor, context->settings->ColorDepth, xfc->clrconv);
|
||||
backColor = freerdp_convert_gdi_order_color(mem3blt->backColor, context->settings->ColorDepth, xfc->format, xfc->palette);
|
||||
backColor = xf_gdi_get_color(xfc, backColor);
|
||||
|
||||
if (brush->style == GDI_BS_PATTERN)
|
||||
@ -857,7 +879,7 @@ void xf_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
|
||||
|
||||
if (xfc->drawing == xfc->primary)
|
||||
{
|
||||
if (xfc->remote_app != TRUE)
|
||||
if (!xfc->remote_app)
|
||||
{
|
||||
XCopyArea(xfc->display, bitmap->pixmap, xfc->drawable, xfc->gc,
|
||||
mem3blt->nXSrc, mem3blt->nYSrc, mem3blt->nWidth, mem3blt->nHeight,
|
||||
@ -887,7 +909,7 @@ void xf_gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc)
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
xf_set_rop2(xfc, polygon_sc->bRop2);
|
||||
brush_color = freerdp_color_convert_drawing_order_color_to_gdi_color(polygon_sc->brushColor, context->settings->ColorDepth, xfc->clrconv);
|
||||
brush_color = freerdp_convert_gdi_order_color(polygon_sc->brushColor, context->settings->ColorDepth, xfc->format, xfc->palette);
|
||||
brush_color = xf_gdi_get_color(xfc, brush_color);
|
||||
|
||||
npoints = polygon_sc->numPoints + 1;
|
||||
@ -949,9 +971,9 @@ void xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb)
|
||||
|
||||
brush = &(polygon_cb->brush);
|
||||
xf_set_rop2(xfc, polygon_cb->bRop2);
|
||||
foreColor = freerdp_color_convert_drawing_order_color_to_gdi_color(polygon_cb->foreColor, context->settings->ColorDepth, xfc->clrconv);
|
||||
foreColor = freerdp_convert_gdi_order_color(polygon_cb->foreColor, context->settings->ColorDepth, xfc->format, xfc->palette);
|
||||
foreColor = xf_gdi_get_color(xfc, foreColor);
|
||||
backColor = freerdp_color_convert_drawing_order_color_to_gdi_color(polygon_cb->backColor, context->settings->ColorDepth, xfc->clrconv);
|
||||
backColor = freerdp_convert_gdi_order_color(polygon_cb->backColor, context->settings->ColorDepth, xfc->format, xfc->palette);
|
||||
backColor = xf_gdi_get_color(xfc, backColor);
|
||||
|
||||
npoints = polygon_cb->numPoints + 1;
|
||||
@ -1130,6 +1152,8 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
|
||||
{
|
||||
int i, tx, ty;
|
||||
XImage* image;
|
||||
BYTE* pSrcData;
|
||||
BYTE* pDstData;
|
||||
RFX_MESSAGE* message;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
@ -1139,21 +1163,39 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
|
||||
{
|
||||
freerdp_client_codecs_prepare(xfc->codecs, FREERDP_CODEC_REMOTEFX);
|
||||
|
||||
message = rfx_process_message(xfc->codecs->rfx,
|
||||
cmd->bitmapData, cmd->bitmapDataLength);
|
||||
message = rfx_process_message(xfc->codecs->rfx, cmd->bitmapData, cmd->bitmapDataLength);
|
||||
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
|
||||
XSetClipRectangles(xfc->display, xfc->gc,
|
||||
cmd->destLeft, cmd->destTop,
|
||||
XSetClipRectangles(xfc->display, xfc->gc, cmd->destLeft, cmd->destTop,
|
||||
(XRectangle*) message->rects, message->numRects, YXBanded);
|
||||
|
||||
if (xfc->bitmap_size < (64 * 64 * 4))
|
||||
{
|
||||
xfc->bitmap_size = 64 * 64 * 4;
|
||||
xfc->bitmap_buffer = (BYTE*) _aligned_realloc(xfc->bitmap_buffer, xfc->bitmap_size, 16);
|
||||
|
||||
if (!xfc->bitmap_buffer)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Draw the tiles to primary surface, each is 64x64. */
|
||||
for (i = 0; i < message->numTiles; i++)
|
||||
{
|
||||
image = XCreateImage(xfc->display, xfc->visual, 24, ZPixmap, 0,
|
||||
(char*) message->tiles[i]->data, 64, 64, 32, 0);
|
||||
pSrcData = message->tiles[i]->data;
|
||||
pDstData = pSrcData;
|
||||
|
||||
if ((xfc->depth != 24) || (xfc->depth != 32))
|
||||
{
|
||||
pDstData = xfc->bitmap_buffer;
|
||||
|
||||
freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
|
||||
64, 64, pSrcData, PIXEL_FORMAT_XRGB32, -1, 0, 0, xfc->palette);
|
||||
}
|
||||
|
||||
image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
|
||||
(char*) pDstData, 64, 64, xfc->scanline_pad, 0);
|
||||
|
||||
tx = message->tiles[i]->x + cmd->destLeft;
|
||||
ty = message->tiles[i]->y + cmd->destTop;
|
||||
@ -1167,9 +1209,11 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
|
||||
{
|
||||
tx = message->rects[i].x + cmd->destLeft;
|
||||
ty = message->rects[i].y + cmd->destTop;
|
||||
if (xfc->remote_app != TRUE)
|
||||
|
||||
if (!xfc->remote_app)
|
||||
{
|
||||
XCopyArea(xfc->display, xfc->primary, xfc->drawable, xfc->gc, tx, ty, message->rects[i].width, message->rects[i].height, tx, ty);
|
||||
XCopyArea(xfc->display, xfc->primary, xfc->drawable, xfc->gc,
|
||||
tx, ty, message->rects[i].width, message->rects[i].height, tx, ty);
|
||||
}
|
||||
|
||||
xf_gdi_surface_update_frame(xfc, tx, ty, message->rects[i].width, message->rects[i].height);
|
||||
@ -1182,39 +1226,42 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
|
||||
{
|
||||
freerdp_client_codecs_prepare(xfc->codecs, FREERDP_CODEC_NSCODEC);
|
||||
|
||||
nsc_process_message(xfc->codecs->nsc, cmd->bpp, cmd->width, cmd->height,
|
||||
cmd->bitmapData, cmd->bitmapDataLength);
|
||||
nsc_process_message(xfc->codecs->nsc, cmd->bpp, cmd->width, cmd->height, cmd->bitmapData, cmd->bitmapDataLength);
|
||||
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
|
||||
xfc->bmp_codec_nsc = (BYTE*) realloc(xfc->bmp_codec_nsc,
|
||||
cmd->width * cmd->height * 4);
|
||||
if (xfc->bitmap_size < (cmd->width * cmd->height * 4))
|
||||
{
|
||||
xfc->bitmap_size = cmd->width * cmd->height * 4;
|
||||
xfc->bitmap_buffer = (BYTE*) _aligned_realloc(xfc->bitmap_buffer, xfc->bitmap_size, 16);
|
||||
|
||||
freerdp_image_flip(xfc->codecs->nsc->BitmapData, xfc->bmp_codec_nsc,
|
||||
cmd->width, cmd->height, 32);
|
||||
if (!xfc->bitmap_buffer)
|
||||
return;
|
||||
}
|
||||
|
||||
image = XCreateImage(xfc->display, xfc->visual, 24, ZPixmap, 0,
|
||||
(char*) xfc->bmp_codec_nsc, cmd->width, cmd->height, 32, 0);
|
||||
pSrcData = xfc->codecs->nsc->BitmapData;
|
||||
pDstData = xfc->bitmap_buffer;
|
||||
|
||||
freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
|
||||
cmd->width, cmd->height, pSrcData, PIXEL_FORMAT_XRGB32_VF, -1, 0, 0, xfc->palette);
|
||||
|
||||
image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
|
||||
(char*) pDstData, cmd->width, cmd->height, xfc->scanline_pad, 0);
|
||||
|
||||
XPutImage(xfc->display, xfc->primary, xfc->gc, image, 0, 0,
|
||||
cmd->destLeft, cmd->destTop,
|
||||
cmd->width, cmd->height);
|
||||
cmd->destLeft, cmd->destTop, cmd->width, cmd->height);
|
||||
|
||||
XFree(image);
|
||||
free(xfc->bmp_codec_nsc);
|
||||
xfc->bmp_codec_nsc = NULL;
|
||||
|
||||
if (!xfc->remote_app)
|
||||
{
|
||||
XCopyArea(xfc->display, xfc->primary, xfc->window->handle, xfc->gc,
|
||||
cmd->destLeft, cmd->destTop,
|
||||
cmd->width, cmd->height,
|
||||
cmd->destLeft, cmd->destTop, cmd->width, cmd->height,
|
||||
cmd->destLeft, cmd->destTop);
|
||||
}
|
||||
|
||||
xf_gdi_surface_update_frame(xfc,
|
||||
cmd->destLeft, cmd->destTop,
|
||||
cmd->width, cmd->height);
|
||||
xf_gdi_surface_update_frame(xfc, cmd->destLeft, cmd->destTop, cmd->width, cmd->height);
|
||||
|
||||
XSetClipMask(xfc->display, xfc->gc, None);
|
||||
}
|
||||
@ -1223,43 +1270,39 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
|
||||
/* Validate that the data received is large enough */
|
||||
if ((cmd->width * cmd->height * cmd->bpp / 8) <= (cmd->bitmapDataLength))
|
||||
if (xfc->bitmap_size < (cmd->width * cmd->height * 4))
|
||||
{
|
||||
xfc->bmp_codec_none = (BYTE*) realloc(xfc->bmp_codec_none,
|
||||
cmd->width * cmd->height * 4);
|
||||
xfc->bitmap_size = cmd->width * cmd->height * 4;
|
||||
xfc->bitmap_buffer = (BYTE*) _aligned_realloc(xfc->bitmap_buffer, xfc->bitmap_size, 16);
|
||||
|
||||
freerdp_image_flip(cmd->bitmapData, xfc->bmp_codec_none,
|
||||
cmd->width, cmd->height, 32);
|
||||
if (!xfc->bitmap_buffer)
|
||||
return;
|
||||
}
|
||||
|
||||
image = XCreateImage(xfc->display, xfc->visual, 24, ZPixmap, 0,
|
||||
(char*) xfc->bmp_codec_none, cmd->width, cmd->height, 32, 0);
|
||||
pSrcData = cmd->bitmapData;
|
||||
pDstData = xfc->bitmap_buffer;
|
||||
|
||||
XPutImage(xfc->display, xfc->primary, xfc->gc, image, 0, 0,
|
||||
cmd->destLeft, cmd->destTop,
|
||||
cmd->width, cmd->height);
|
||||
XFree(image);
|
||||
free(xfc->bmp_codec_none);
|
||||
xfc->bmp_codec_none = NULL;
|
||||
freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
|
||||
cmd->width, cmd->height, pSrcData, PIXEL_FORMAT_XRGB32_VF, -1, 0, 0, xfc->palette);
|
||||
|
||||
if (xfc->remote_app != TRUE)
|
||||
{
|
||||
XCopyArea(xfc->display, xfc->primary, xfc->window->handle, xfc->gc,
|
||||
cmd->destLeft, cmd->destTop,
|
||||
cmd->width, cmd->height,
|
||||
cmd->destLeft, cmd->destTop);
|
||||
}
|
||||
xf_gdi_surface_update_frame(xfc,
|
||||
image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
|
||||
(char*) pDstData, cmd->width, cmd->height, xfc->scanline_pad, 0);
|
||||
|
||||
XPutImage(xfc->display, xfc->primary, xfc->gc, image, 0, 0,
|
||||
cmd->destLeft, cmd->destTop,
|
||||
cmd->width, cmd->height);
|
||||
XFree(image);
|
||||
|
||||
XSetClipMask(xfc->display, xfc->gc, None);
|
||||
}
|
||||
else
|
||||
if (!xfc->remote_app)
|
||||
{
|
||||
WLog_ERR(TAG, "Invalid bitmap size - data is %d bytes for %dx%d update",
|
||||
cmd->bitmapDataLength, cmd->width, cmd->height);
|
||||
XCopyArea(xfc->display, xfc->primary, xfc->window->handle, xfc->gc,
|
||||
cmd->destLeft, cmd->destTop,
|
||||
cmd->width, cmd->height, cmd->destLeft, cmd->destTop);
|
||||
}
|
||||
|
||||
xf_gdi_surface_update_frame(xfc, cmd->destLeft, cmd->destTop, cmd->width, cmd->height);
|
||||
|
||||
XSetClipMask(xfc->display, xfc->gc, None);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -78,9 +78,14 @@ int xf_OutputUpdate(xfContext* xfc)
|
||||
if (height > xfc->height)
|
||||
height = xfc->height;
|
||||
|
||||
if (surface->stage)
|
||||
{
|
||||
freerdp_image_copy(surface->stage, xfc->format, surface->stageStep, 0, 0,
|
||||
surface->width, surface->height, surface->data, surface->format, surface->scanline, 0, 0, NULL);
|
||||
}
|
||||
|
||||
XPutImage(xfc->display, xfc->drawable, xfc->gc, surface->image,
|
||||
extents->left, extents->top,
|
||||
extents->left, extents->top, width, height);
|
||||
extents->left, extents->top, extents->left, extents->top, width, height);
|
||||
}
|
||||
|
||||
region16_clear(&(xfc->invalidRegion));
|
||||
@ -93,9 +98,6 @@ int xf_OutputUpdate(xfContext* xfc)
|
||||
|
||||
int xf_OutputExpose(xfContext* xfc, int x, int y, int width, int height)
|
||||
{
|
||||
/** *********************************
|
||||
* to be improved?
|
||||
* *********************************/
|
||||
RECTANGLE_16 invalidRect;
|
||||
|
||||
invalidRect.left = x;
|
||||
@ -140,8 +142,8 @@ int xf_SurfaceCommand_Uncompressed(xfContext* xfc, RdpgfxClientContext* context,
|
||||
if (!surface)
|
||||
return -1;
|
||||
|
||||
freerdp_image_copy(surface->data, PIXEL_FORMAT_XRGB32, surface->scanline, cmd->left, cmd->top,
|
||||
cmd->width, cmd->height, cmd->data, PIXEL_FORMAT_XRGB32, cmd->width * 4, 0, 0);
|
||||
freerdp_image_copy(surface->data, surface->format, surface->scanline, cmd->left, cmd->top,
|
||||
cmd->width, cmd->height, cmd->data, PIXEL_FORMAT_XRGB32, -1, 0, 0, NULL);
|
||||
|
||||
invalidRect.left = cmd->left;
|
||||
invalidRect.top = cmd->top;
|
||||
@ -219,9 +221,9 @@ int xf_SurfaceCommand_RemoteFX(xfContext* xfc, RdpgfxClientContext* context, RDP
|
||||
nWidth = updateRects[j].right - updateRects[j].left;
|
||||
nHeight = updateRects[j].bottom - updateRects[j].top;
|
||||
|
||||
freerdp_image_copy(surface->data, PIXEL_FORMAT_XRGB32, surface->scanline,
|
||||
freerdp_image_copy(surface->data, surface->format, surface->scanline,
|
||||
nXDst, nYDst, nWidth, nHeight,
|
||||
tile->data, PIXEL_FORMAT_XRGB32, 64 * 4, 0, 0);
|
||||
tile->data, PIXEL_FORMAT_XRGB32, 64 * 4, 0, 0, NULL);
|
||||
|
||||
region16_union_rect(&(xfc->invalidRegion), &(xfc->invalidRegion), &updateRects[j]);
|
||||
}
|
||||
@ -254,7 +256,7 @@ int xf_SurfaceCommand_ClearCodec(xfContext* xfc, RdpgfxClientContext* context, R
|
||||
DstData = surface->data;
|
||||
|
||||
status = clear_decompress(xfc->codecs->clear, cmd->data, cmd->length, &DstData,
|
||||
PIXEL_FORMAT_XRGB32, surface->scanline, cmd->left, cmd->top, cmd->width, cmd->height);
|
||||
surface->format, surface->scanline, cmd->left, cmd->top, cmd->width, cmd->height);
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
@ -269,7 +271,6 @@ int xf_SurfaceCommand_ClearCodec(xfContext* xfc, RdpgfxClientContext* context, R
|
||||
|
||||
region16_union_rect(&(xfc->invalidRegion), &(xfc->invalidRegion), &invalidRect);
|
||||
|
||||
|
||||
if (!xfc->inGfxFrame)
|
||||
xf_OutputUpdate(xfc);
|
||||
|
||||
@ -293,7 +294,7 @@ int xf_SurfaceCommand_Planar(xfContext* xfc, RdpgfxClientContext* context, RDPGF
|
||||
DstData = surface->data;
|
||||
|
||||
status = planar_decompress(xfc->codecs->planar, cmd->data, cmd->length, &DstData,
|
||||
PIXEL_FORMAT_XRGB32, surface->scanline, cmd->left, cmd->top, cmd->width, cmd->height);
|
||||
surface->format, surface->scanline, cmd->left, cmd->top, cmd->width, cmd->height, FALSE);
|
||||
|
||||
invalidRect.left = cmd->left;
|
||||
invalidRect.top = cmd->top;
|
||||
@ -337,7 +338,7 @@ int xf_SurfaceCommand_H264(xfContext* xfc, RdpgfxClientContext* context, RDPGFX_
|
||||
DstData = surface->data;
|
||||
|
||||
status = h264_decompress(xfc->codecs->h264, bs->data, bs->length, &DstData,
|
||||
PIXEL_FORMAT_XRGB32, surface->scanline , surface->height, meta->regionRects, meta->numRegionRects);
|
||||
surface->format, surface->scanline , surface->height, meta->regionRects, meta->numRegionRects);
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
@ -419,7 +420,7 @@ int xf_SurfaceCommand_Progressive(xfContext* xfc, RdpgfxClientContext* context,
|
||||
DstData = surface->data;
|
||||
|
||||
status = progressive_decompress(xfc->codecs->progressive, cmd->data, cmd->length, &DstData,
|
||||
PIXEL_FORMAT_XRGB32, surface->scanline, cmd->left, cmd->top, cmd->width, cmd->height, cmd->surfaceId);
|
||||
surface->format, surface->scanline, cmd->left, cmd->top, cmd->width, cmd->height, cmd->surfaceId);
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
@ -468,7 +469,7 @@ int xf_SurfaceCommand_Progressive(xfContext* xfc, RdpgfxClientContext* context,
|
||||
|
||||
freerdp_image_copy(surface->data, PIXEL_FORMAT_XRGB32,
|
||||
surface->scanline, nXDst, nYDst, nWidth, nHeight,
|
||||
tile->data, PIXEL_FORMAT_XRGB32, 64 * 4, nXSrc, nYSrc);
|
||||
tile->data, PIXEL_FORMAT_XRGB32, 64 * 4, nXSrc, nYSrc, NULL);
|
||||
|
||||
region16_union_rect(&(xfc->invalidRegion), &(xfc->invalidRegion), &updateRects[j]);
|
||||
}
|
||||
@ -531,6 +532,8 @@ int xf_DeleteEncodingContext(RdpgfxClientContext* context, RDPGFX_DELETE_ENCODIN
|
||||
|
||||
int xf_CreateSurface(RdpgfxClientContext* context, RDPGFX_CREATE_SURFACE_PDU* createSurface)
|
||||
{
|
||||
size_t size;
|
||||
UINT32 bytesPerPixel;
|
||||
xfGfxSurface* surface;
|
||||
xfContext* xfc = (xfContext*) context->custom;
|
||||
|
||||
@ -543,15 +546,41 @@ int xf_CreateSurface(RdpgfxClientContext* context, RDPGFX_CREATE_SURFACE_PDU* cr
|
||||
surface->width = (UINT32) createSurface->width;
|
||||
surface->height = (UINT32) createSurface->height;
|
||||
surface->alpha = (createSurface->pixelFormat == PIXEL_FORMAT_ARGB_8888) ? TRUE : FALSE;
|
||||
surface->format = PIXEL_FORMAT_XRGB32;
|
||||
|
||||
surface->scanline = (surface->width + (surface->width % 4)) * 4;
|
||||
surface->data = (BYTE*) calloc(1, surface->scanline * surface->height);
|
||||
surface->scanline = surface->width * 4;
|
||||
surface->scanline += (surface->scanline % (xfc->scanline_pad / 8));
|
||||
|
||||
size = surface->scanline * surface->height;
|
||||
surface->data = (BYTE*) _aligned_malloc(size, 16);
|
||||
|
||||
if (!surface->data)
|
||||
return -1;
|
||||
|
||||
surface->image = XCreateImage(xfc->display, xfc->visual, 24, ZPixmap, 0,
|
||||
(char*) surface->data, surface->width, surface->height, 32, surface->scanline);
|
||||
ZeroMemory(surface->data, size);
|
||||
|
||||
if ((xfc->depth == 24) || (xfc->depth == 32))
|
||||
{
|
||||
surface->image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
|
||||
(char*) surface->data, surface->width, surface->height, xfc->scanline_pad, surface->scanline);
|
||||
}
|
||||
else
|
||||
{
|
||||
bytesPerPixel = (FREERDP_PIXEL_FORMAT_BPP(xfc->format) / 8);
|
||||
surface->stageStep = surface->width * bytesPerPixel;
|
||||
surface->stageStep += (surface->stageStep % (xfc->scanline_pad / 8));
|
||||
size = surface->stageStep * surface->height;
|
||||
|
||||
surface->stage = (BYTE*) _aligned_malloc(size, 16);
|
||||
|
||||
if (!surface->stage)
|
||||
return -1;
|
||||
|
||||
ZeroMemory(surface->stage, size);
|
||||
|
||||
surface->image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
|
||||
(char*) surface->stage, surface->width, surface->height, xfc->scanline_pad, surface->stageStep);
|
||||
}
|
||||
|
||||
context->SetSurfaceData(context, surface->surfaceId, (void*) surface);
|
||||
|
||||
@ -568,7 +597,8 @@ int xf_DeleteSurface(RdpgfxClientContext* context, RDPGFX_DELETE_SURFACE_PDU* de
|
||||
if (surface)
|
||||
{
|
||||
XFree(surface->image);
|
||||
free(surface->data);
|
||||
_aligned_free(surface->data);
|
||||
_aligned_free(surface->stage);
|
||||
free(surface);
|
||||
}
|
||||
|
||||
@ -615,7 +645,7 @@ int xf_SolidFill(RdpgfxClientContext* context, RDPGFX_SOLID_FILL_PDU* solidFill)
|
||||
invalidRect.right = rect->right;
|
||||
invalidRect.bottom = rect->bottom;
|
||||
|
||||
freerdp_image_fill(surface->data, PIXEL_FORMAT_XRGB32, surface->scanline,
|
||||
freerdp_image_fill(surface->data, surface->format, surface->scanline,
|
||||
rect->left, rect->top, nWidth, nHeight, color);
|
||||
|
||||
region16_union_rect(&(xfc->invalidRegion), &(xfc->invalidRegion), &invalidRect);
|
||||
@ -630,6 +660,7 @@ int xf_SolidFill(RdpgfxClientContext* context, RDPGFX_SOLID_FILL_PDU* solidFill)
|
||||
int xf_SurfaceToSurface(RdpgfxClientContext* context, RDPGFX_SURFACE_TO_SURFACE_PDU* surfaceToSurface)
|
||||
{
|
||||
UINT16 index;
|
||||
BOOL sameSurface;
|
||||
int nWidth, nHeight;
|
||||
RDPGFX_RECT16* rectSrc;
|
||||
RDPGFX_POINT16* destPt;
|
||||
@ -640,11 +671,12 @@ int xf_SurfaceToSurface(RdpgfxClientContext* context, RDPGFX_SURFACE_TO_SURFACE_
|
||||
|
||||
rectSrc = &(surfaceToSurface->rectSrc);
|
||||
destPt = &surfaceToSurface->destPts[0];
|
||||
/**not needed?*/
|
||||
|
||||
surfaceSrc = (xfGfxSurface*) context->GetSurfaceData(context, surfaceToSurface->surfaceIdSrc);
|
||||
|
||||
if (surfaceToSurface->surfaceIdSrc != surfaceToSurface->surfaceIdDest)
|
||||
sameSurface = (surfaceToSurface->surfaceIdSrc == surfaceToSurface->surfaceIdDest) ? TRUE : FALSE;
|
||||
|
||||
if (!sameSurface)
|
||||
surfaceDst = (xfGfxSurface*) context->GetSurfaceData(context, surfaceToSurface->surfaceIdDest);
|
||||
else
|
||||
surfaceDst = surfaceSrc;
|
||||
@ -659,16 +691,22 @@ int xf_SurfaceToSurface(RdpgfxClientContext* context, RDPGFX_SURFACE_TO_SURFACE_
|
||||
{
|
||||
destPt = &surfaceToSurface->destPts[index];
|
||||
|
||||
freerdp_image_copy(surfaceDst->data, PIXEL_FORMAT_XRGB32, surfaceDst->scanline,
|
||||
destPt->x, destPt->y, nWidth, nHeight, surfaceSrc->data, PIXEL_FORMAT_XRGB32,
|
||||
surfaceSrc->scanline, rectSrc->left, rectSrc->top);
|
||||
if (sameSurface)
|
||||
{
|
||||
freerdp_image_move(surfaceDst->data, surfaceDst->format, surfaceDst->scanline,
|
||||
destPt->x, destPt->y, nWidth, nHeight, rectSrc->left, rectSrc->top);
|
||||
}
|
||||
else
|
||||
{
|
||||
freerdp_image_copy(surfaceDst->data, surfaceDst->format, surfaceDst->scanline,
|
||||
destPt->x, destPt->y, nWidth, nHeight, surfaceSrc->data, surfaceSrc->format,
|
||||
surfaceSrc->scanline, rectSrc->left, rectSrc->top, NULL);
|
||||
}
|
||||
|
||||
invalidRect.left = destPt->x;
|
||||
invalidRect.top = destPt->y;
|
||||
invalidRect.right = destPt->x + rectSrc->right;
|
||||
invalidRect.bottom = destPt->y + rectSrc->bottom;
|
||||
|
||||
/**width,height?*/
|
||||
|
||||
region16_union_rect(&(xfc->invalidRegion), &(xfc->invalidRegion), &invalidRect);
|
||||
}
|
||||
@ -681,9 +719,11 @@ int xf_SurfaceToSurface(RdpgfxClientContext* context, RDPGFX_SURFACE_TO_SURFACE_
|
||||
|
||||
int xf_SurfaceToCache(RdpgfxClientContext* context, RDPGFX_SURFACE_TO_CACHE_PDU* surfaceToCache)
|
||||
{
|
||||
size_t size;
|
||||
RDPGFX_RECT16* rect;
|
||||
xfGfxSurface* surface;
|
||||
xfGfxCacheEntry* cacheEntry;
|
||||
xfContext* xfc = (xfContext*) context->custom;
|
||||
|
||||
rect = &(surfaceToCache->rectSrc);
|
||||
|
||||
@ -700,16 +740,22 @@ int xf_SurfaceToCache(RdpgfxClientContext* context, RDPGFX_SURFACE_TO_CACHE_PDU*
|
||||
cacheEntry->width = (UINT32) (rect->right - rect->left);
|
||||
cacheEntry->height = (UINT32) (rect->bottom - rect->top);
|
||||
cacheEntry->alpha = surface->alpha;
|
||||
cacheEntry->format = surface->format;
|
||||
|
||||
cacheEntry->scanline = (cacheEntry->width + (cacheEntry->width % 4)) * 4;
|
||||
cacheEntry->data = (BYTE*) calloc(1, cacheEntry->scanline * cacheEntry->height);
|
||||
cacheEntry->scanline = cacheEntry->width * 4;
|
||||
cacheEntry->scanline += (cacheEntry->scanline % (xfc->scanline_pad / 8));
|
||||
|
||||
size = cacheEntry->scanline * cacheEntry->height;
|
||||
cacheEntry->data = (BYTE*) _aligned_malloc(size, 16);
|
||||
|
||||
if (!cacheEntry->data)
|
||||
return -1;
|
||||
|
||||
freerdp_image_copy(cacheEntry->data, PIXEL_FORMAT_XRGB32, cacheEntry->scanline,
|
||||
ZeroMemory(cacheEntry->data, size);
|
||||
|
||||
freerdp_image_copy(cacheEntry->data, cacheEntry->format, cacheEntry->scanline,
|
||||
0, 0, cacheEntry->width, cacheEntry->height, surface->data,
|
||||
PIXEL_FORMAT_XRGB32, surface->scanline, rect->left, rect->top);
|
||||
surface->format, surface->scanline, rect->left, rect->top, NULL);
|
||||
|
||||
context->SetCacheSlotData(context, surfaceToCache->cacheSlot, (void*) cacheEntry);
|
||||
|
||||
@ -735,9 +781,9 @@ int xf_CacheToSurface(RdpgfxClientContext* context, RDPGFX_CACHE_TO_SURFACE_PDU*
|
||||
{
|
||||
destPt = &cacheToSurface->destPts[index];
|
||||
|
||||
freerdp_image_copy(surface->data, PIXEL_FORMAT_XRGB32, surface->scanline,
|
||||
freerdp_image_copy(surface->data, surface->format, surface->scanline,
|
||||
destPt->x, destPt->y, cacheEntry->width, cacheEntry->height,
|
||||
cacheEntry->data, PIXEL_FORMAT_XRGB32, cacheEntry->scanline, 0, 0);
|
||||
cacheEntry->data, cacheEntry->format, cacheEntry->scanline, 0, 0, NULL);
|
||||
|
||||
invalidRect.left = destPt->x;
|
||||
invalidRect.top = destPt->y;
|
||||
@ -766,7 +812,7 @@ int xf_EvictCacheEntry(RdpgfxClientContext* context, RDPGFX_EVICT_CACHE_ENTRY_PD
|
||||
|
||||
if (cacheEntry)
|
||||
{
|
||||
free(cacheEntry->data);
|
||||
_aligned_free(cacheEntry->data);
|
||||
free(cacheEntry);
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,11 @@ struct xf_gfx_surface
|
||||
UINT32 height;
|
||||
BOOL alpha;
|
||||
BYTE* data;
|
||||
BYTE* stage;
|
||||
XImage* image;
|
||||
int scanline;
|
||||
int stageStep;
|
||||
UINT32 format;
|
||||
};
|
||||
typedef struct xf_gfx_surface xfGfxSurface;
|
||||
|
||||
@ -45,6 +48,7 @@ struct xf_gfx_cache_entry
|
||||
BOOL alpha;
|
||||
BYTE* data;
|
||||
int scanline;
|
||||
UINT32 format;
|
||||
};
|
||||
typedef struct xf_gfx_cache_entry xfGfxCacheEntry;
|
||||
|
||||
|
@ -43,18 +43,42 @@
|
||||
|
||||
void xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
|
||||
{
|
||||
int depth;
|
||||
BYTE* data;
|
||||
Pixmap pixmap;
|
||||
XImage* image;
|
||||
UINT32 SrcFormat;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
data = bitmap->data;
|
||||
depth = (bitmap->bpp >= 24) ? 24 : bitmap->bpp;
|
||||
|
||||
pixmap = XCreatePixmap(xfc->display, xfc->drawable, bitmap->width, bitmap->height, xfc->depth);
|
||||
|
||||
if (bitmap->data)
|
||||
{
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
|
||||
if (depth != xfc->depth)
|
||||
{
|
||||
data = _aligned_malloc(bitmap->width * bitmap->height * 4, 16);
|
||||
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
SrcFormat = gdi_get_pixel_format(bitmap->bpp, TRUE);
|
||||
|
||||
freerdp_image_copy(data, xfc->format, -1, 0, 0,
|
||||
bitmap->width, bitmap->height, bitmap->data, SrcFormat, -1, 0, 0, xfc->palette);
|
||||
|
||||
_aligned_free(bitmap->data);
|
||||
bitmap->data = data;
|
||||
|
||||
bitmap->bpp = (xfc->depth >= 24) ? 32 : xfc->depth;
|
||||
}
|
||||
|
||||
image = XCreateImage(xfc->display, xfc->visual, xfc->depth,
|
||||
ZPixmap, 0, (char*) bitmap->data, bitmap->width, bitmap->height, xfc->scanline_pad, 0);
|
||||
|
||||
@ -122,10 +146,7 @@ void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
||||
bytesPerPixel = (bpp + 7) / 8;
|
||||
size = width * height * 4;
|
||||
|
||||
if (!bitmap->data)
|
||||
bitmap->data = (BYTE*) _aligned_malloc(size, 16);
|
||||
else
|
||||
bitmap->data = (BYTE*) _aligned_realloc(bitmap->data, size, 16);
|
||||
bitmap->data = (BYTE*) _aligned_malloc(size, 16);
|
||||
|
||||
pSrcData = data;
|
||||
SrcSize = (UINT32) length;
|
||||
@ -138,14 +159,14 @@ void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
||||
freerdp_client_codecs_prepare(xfc->codecs, FREERDP_CODEC_INTERLEAVED);
|
||||
|
||||
status = interleaved_decompress(xfc->codecs->interleaved, pSrcData, SrcSize, bpp,
|
||||
&pDstData, PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height);
|
||||
&pDstData, xfc->format, -1, 0, 0, width, height, xfc->palette);
|
||||
}
|
||||
else
|
||||
{
|
||||
freerdp_client_codecs_prepare(xfc->codecs, FREERDP_CODEC_PLANAR);
|
||||
|
||||
status = planar_decompress(xfc->codecs->planar, pSrcData, SrcSize, &pDstData,
|
||||
PIXEL_FORMAT_XRGB32_VF, width * 4, 0, 0, width, height);
|
||||
status = planar_decompress(xfc->codecs->planar, pSrcData, SrcSize,
|
||||
&pDstData, xfc->format, -1, 0, 0, width, height, TRUE);
|
||||
}
|
||||
|
||||
if (status < 0)
|
||||
@ -158,13 +179,13 @@ void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
||||
{
|
||||
SrcFormat = gdi_get_pixel_format(bpp, TRUE);
|
||||
|
||||
status = freerdp_image_copy(pDstData, PIXEL_FORMAT_XRGB32, width * 4, 0, 0,
|
||||
width, height, pSrcData, SrcFormat, width * bytesPerPixel, 0, 0);
|
||||
status = freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
|
||||
width, height, pSrcData, SrcFormat, -1, 0, 0, xfc->palette);
|
||||
}
|
||||
|
||||
bitmap->compressed = FALSE;
|
||||
bitmap->length = size;
|
||||
bitmap->bpp = 32;
|
||||
bitmap->bpp = (xfc->depth >= 24) ? 32 : xfc->depth;
|
||||
}
|
||||
|
||||
void xf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary)
|
||||
@ -359,9 +380,8 @@ void xf_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height
|
||||
{
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
bgcolor = freerdp_color_convert_drawing_order_color_to_gdi_color(bgcolor, context->settings->ColorDepth, xfc->clrconv);
|
||||
|
||||
fgcolor = freerdp_color_convert_drawing_order_color_to_gdi_color(fgcolor, context->settings->ColorDepth, xfc->clrconv);
|
||||
bgcolor = freerdp_convert_gdi_order_color(bgcolor, context->settings->ColorDepth, xfc->format, xfc->palette);
|
||||
fgcolor = freerdp_convert_gdi_order_color(fgcolor, context->settings->ColorDepth, xfc->format, xfc->palette);
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
|
@ -85,6 +85,8 @@ struct xf_context
|
||||
int height;
|
||||
int srcBpp;
|
||||
GC gc_mono;
|
||||
BOOL invert;
|
||||
UINT32 format;
|
||||
Screen* screen;
|
||||
XImage* image;
|
||||
Pixmap primary;
|
||||
@ -111,6 +113,7 @@ struct xf_context
|
||||
HANDLE mutex;
|
||||
BOOL UseXThreads;
|
||||
BOOL cursorHidden;
|
||||
BYTE palette[256 * 4];
|
||||
|
||||
HGDI_DC hdc;
|
||||
UINT32 bitmap_size;
|
||||
@ -153,8 +156,6 @@ struct xf_context
|
||||
XSetWindowAttributes attribs;
|
||||
BOOL complex_regions;
|
||||
VIRTUAL_SCREEN vscreen;
|
||||
BYTE* bmp_codec_none;
|
||||
BYTE* bmp_codec_nsc;
|
||||
void* xv_context;
|
||||
void* clipboard_context;
|
||||
|
||||
|
@ -26,8 +26,8 @@
|
||||
#define FREERDP_PIXEL_FORMAT_TYPE_A 0
|
||||
#define FREERDP_PIXEL_FORMAT_TYPE_ARGB 1
|
||||
#define FREERDP_PIXEL_FORMAT_TYPE_ABGR 2
|
||||
#define FREERDP_PIXEL_FORMAT_TYPE_BGRA 3
|
||||
#define FREERDP_PIXEL_FORMAT_TYPE_RGBA 4
|
||||
|
||||
#define FREERDP_PIXEL_FORMAT_IS_ABGR(_format) (FREERDP_PIXEL_FORMAT_TYPE(_format) == FREERDP_PIXEL_FORMAT_TYPE_ABGR)
|
||||
|
||||
#define FREERDP_PIXEL_FLIP_NONE 0
|
||||
#define FREERDP_PIXEL_FLIP_VERTICAL 1
|
||||
@ -401,7 +401,6 @@ extern "C" {
|
||||
|
||||
/* Supported Internal Buffer Formats */
|
||||
#define CLRBUF_16BPP 8
|
||||
#define CLRBUF_24BPP 16
|
||||
#define CLRBUF_32BPP 32
|
||||
|
||||
struct _CLRCONV
|
||||
@ -445,14 +444,27 @@ FREERDP_API UINT32 freerdp_color_convert_rgb_bgr(UINT32 srcColor, int srcBpp, in
|
||||
FREERDP_API UINT32 freerdp_color_convert_bgr_rgb(UINT32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);
|
||||
FREERDP_API UINT32 freerdp_color_convert_var_rgb(UINT32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);
|
||||
FREERDP_API UINT32 freerdp_color_convert_var_bgr(UINT32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);
|
||||
FREERDP_API UINT32 freerdp_color_convert_drawing_order_color_to_gdi_color(UINT32 color, int bpp, HCLRCONV clrconv);
|
||||
FREERDP_API UINT32 freerdp_convert_gdi_order_color(UINT32 color, int bpp, UINT32 format, BYTE* palette);
|
||||
|
||||
FREERDP_API HCLRCONV freerdp_clrconv_new(UINT32 flags);
|
||||
FREERDP_API void freerdp_clrconv_free(HCLRCONV clrconv);
|
||||
|
||||
FREERDP_API int freerdp_image_copy(BYTE* pDstData, DWORD dwDstFormat, int nDstStep, int nXDst, int nYDst,
|
||||
int nWidth, int nHeight, BYTE* pSrcData, DWORD dwSrcFormat, int nSrcStep, int nXSrc, int nYSrc);
|
||||
FREERDP_API int freerdp_image_fill(BYTE* pDstData, DWORD dwDstFormat, int nDstStep, int nXDst, int nYDst,
|
||||
FREERDP_API int freerdp_image8_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst,
|
||||
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc, BYTE* palette);
|
||||
FREERDP_API int freerdp_image15_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst,
|
||||
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc, BYTE* palette);
|
||||
FREERDP_API int freerdp_image16_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst,
|
||||
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc, BYTE* palette);
|
||||
FREERDP_API int freerdp_image24_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst,
|
||||
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc, BYTE* palette);
|
||||
FREERDP_API int freerdp_image32_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst,
|
||||
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc, BYTE* palette);
|
||||
|
||||
FREERDP_API int freerdp_image_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst,
|
||||
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc, BYTE* palette);
|
||||
FREERDP_API int freerdp_image_move(BYTE* pData, DWORD Format, int nStep, int nXDst, int nYDst,
|
||||
int nWidth, int nHeight, int nXSrc, int nYSrc);
|
||||
FREERDP_API int freerdp_image_fill(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst,
|
||||
int nWidth, int nHeight, UINT32 color);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -37,7 +37,7 @@ struct _BITMAP_INTERLEAVED_CONTEXT
|
||||
};
|
||||
|
||||
FREERDP_API int interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved, BYTE* pSrcData, UINT32 SrcSize, int bpp,
|
||||
BYTE** ppDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst, int nWidth, int nHeight);
|
||||
BYTE** ppDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst, int nWidth, int nHeight, BYTE* palette);
|
||||
|
||||
FREERDP_API int bitmap_interleaved_context_reset(BITMAP_INTERLEAVED_CONTEXT* interleaved);
|
||||
|
||||
|
@ -92,6 +92,9 @@ struct _BITMAP_PLANAR_CONTEXT
|
||||
|
||||
BYTE* rlePlanes[4];
|
||||
BYTE* rlePlanesBuffer;
|
||||
|
||||
UINT32 TempSize;
|
||||
BYTE* TempBuffer;
|
||||
};
|
||||
|
||||
FREERDP_API int freerdp_split_color_planes(BYTE* data, UINT32 format, int width, int height, int scanline, BYTE* planes[4]);
|
||||
@ -108,7 +111,7 @@ FREERDP_API BITMAP_PLANAR_CONTEXT* freerdp_bitmap_planar_context_new(DWORD flags
|
||||
FREERDP_API void freerdp_bitmap_planar_context_free(BITMAP_PLANAR_CONTEXT* context);
|
||||
|
||||
FREERDP_API int planar_decompress(BITMAP_PLANAR_CONTEXT* planar, BYTE* pSrcData, UINT32 SrcSize,
|
||||
BYTE** ppDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst, int nWidth, int nHeight);
|
||||
BYTE** ppDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst, int nWidth, int nHeight, BOOL vFlip);
|
||||
|
||||
#endif /* FREERDP_CODEC_PLANAR_H */
|
||||
|
||||
|
@ -283,6 +283,8 @@ struct _PROGRESSIVE_CONTEXT
|
||||
{
|
||||
BOOL Compressor;
|
||||
|
||||
BOOL invert;
|
||||
|
||||
wLog* log;
|
||||
wBufferPool* bufferPool;
|
||||
|
||||
|
@ -284,7 +284,9 @@ struct rdp_gdi
|
||||
int bytesPerPixel;
|
||||
rdpCodecs* codecs;
|
||||
|
||||
BOOL invert;
|
||||
HGDI_DC hdc;
|
||||
UINT32 format;
|
||||
HCLRCONV clrconv;
|
||||
gdiBitmap* primary;
|
||||
gdiBitmap* drawing;
|
||||
@ -292,6 +294,7 @@ struct rdp_gdi
|
||||
BYTE* bitmap_buffer;
|
||||
BYTE* primary_buffer;
|
||||
GDI_COLOR textColor;
|
||||
BYTE palette[256 * 4];
|
||||
gdiBitmap* tile;
|
||||
gdiBitmap* image;
|
||||
|
||||
|
@ -31,6 +31,7 @@ struct gdi_gfx_surface
|
||||
BOOL alpha;
|
||||
BYTE* data;
|
||||
int scanline;
|
||||
UINT32 format;
|
||||
};
|
||||
typedef struct gdi_gfx_surface gdiGfxSurface;
|
||||
|
||||
@ -42,6 +43,7 @@ struct gdi_gfx_cache_entry
|
||||
BOOL alpha;
|
||||
BYTE* data;
|
||||
int scanline;
|
||||
UINT32 format;
|
||||
};
|
||||
typedef struct gdi_gfx_cache_entry gdiGfxCacheEntry;
|
||||
|
||||
|
@ -140,6 +140,10 @@ typedef pstatus_t (*__yCbCrToRGB_16s8u_P3AC4R_t)(
|
||||
const INT16* pSrc[3], INT32 srcStep,
|
||||
BYTE* pDst, INT32 dstStep,
|
||||
const prim_size_t* roi);
|
||||
typedef pstatus_t (*__yCbCrToBGR_16s8u_P3AC4R_t)(
|
||||
const INT16* pSrc[3], INT32 srcStep,
|
||||
BYTE* pDst, INT32 dstStep,
|
||||
const prim_size_t* roi);
|
||||
typedef pstatus_t (*__yCbCrToRGB_16s16s_P3P3_t)(
|
||||
const INT16 *pSrc[3], INT32 srcStep,
|
||||
INT16 *pDst[3], INT32 dstStep,
|
||||
@ -208,6 +212,7 @@ typedef struct
|
||||
__sign_16s_t sign_16s;
|
||||
/* Color conversions */
|
||||
__yCbCrToRGB_16s8u_P3AC4R_t yCbCrToRGB_16s8u_P3AC4R;
|
||||
__yCbCrToBGR_16s8u_P3AC4R_t yCbCrToBGR_16s8u_P3AC4R;
|
||||
__yCbCrToRGB_16s16s_P3P3_t yCbCrToRGB_16s16s_P3P3;
|
||||
__RGBToYCbCr_16s16s_P3P3_t RGBToYCbCr_16s16s_P3P3;
|
||||
__RGBToRGB_16s8u_P3AC4R_t RGBToRGB_16s8u_P3AC4R;
|
||||
|
6
libfreerdp/cache/palette.c
vendored
6
libfreerdp/cache/palette.c
vendored
@ -89,15 +89,13 @@ rdpPaletteCache* palette_cache_new(rdpSettings* settings)
|
||||
{
|
||||
rdpPaletteCache* paletteCache;
|
||||
|
||||
paletteCache = (rdpPaletteCache*) malloc(sizeof(rdpPaletteCache));
|
||||
ZeroMemory(paletteCache, sizeof(rdpPaletteCache));
|
||||
paletteCache = (rdpPaletteCache*) calloc(1, sizeof(rdpPaletteCache));
|
||||
|
||||
if (paletteCache)
|
||||
{
|
||||
paletteCache->settings = settings;
|
||||
paletteCache->maxEntries = 6;
|
||||
paletteCache->entries = (PALETTE_TABLE_ENTRY*) malloc(sizeof(PALETTE_TABLE_ENTRY) * paletteCache->maxEntries);
|
||||
ZeroMemory(paletteCache->entries, sizeof(PALETTE_TABLE_ENTRY) * paletteCache->maxEntries);
|
||||
paletteCache->entries = (PALETTE_TABLE_ENTRY*) calloc(paletteCache->maxEntries, sizeof(PALETTE_TABLE_ENTRY));
|
||||
}
|
||||
|
||||
return paletteCache;
|
||||
|
@ -57,6 +57,7 @@ int clear_decompress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize,
|
||||
BYTE** ppDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst, int nWidth, int nHeight)
|
||||
{
|
||||
UINT32 i;
|
||||
BOOL invert;
|
||||
UINT32 x, y;
|
||||
UINT32 count;
|
||||
UINT32 color;
|
||||
@ -95,6 +96,8 @@ int clear_decompress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize,
|
||||
if ((nWidth > 0xFFFF) || (nHeight > 0xFFFF))
|
||||
return -1004;
|
||||
|
||||
invert = FREERDP_PIXEL_FORMAT_IS_ABGR(DstFormat) ? TRUE : FALSE;
|
||||
|
||||
glyphFlags = pSrcData[0];
|
||||
seqNumber = pSrcData[1];
|
||||
offset += 2;
|
||||
@ -195,7 +198,11 @@ int clear_decompress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize,
|
||||
if ((residualByteCount - suboffset) < 4)
|
||||
return -1015;
|
||||
|
||||
color = RGB32(residualData[suboffset + 2], residualData[suboffset + 1], residualData[suboffset + 0]);
|
||||
if (!invert)
|
||||
color = RGB32(residualData[suboffset + 2], residualData[suboffset + 1], residualData[suboffset + 0]);
|
||||
else
|
||||
color = BGR32(residualData[suboffset + 2], residualData[suboffset + 1], residualData[suboffset + 0]);
|
||||
|
||||
suboffset += 3;
|
||||
|
||||
runLengthFactor = (UINT32) residualData[suboffset];
|
||||
@ -288,7 +295,11 @@ int clear_decompress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize,
|
||||
yEnd = *((UINT16*) &bandsData[suboffset + 6]);
|
||||
suboffset += 8;
|
||||
|
||||
colorBkg = RGB32(bandsData[suboffset + 2], bandsData[suboffset + 1], bandsData[suboffset + 0]);
|
||||
if (!invert)
|
||||
colorBkg = RGB32(bandsData[suboffset + 2], bandsData[suboffset + 1], bandsData[suboffset + 0]);
|
||||
else
|
||||
colorBkg = BGR32(bandsData[suboffset + 2], bandsData[suboffset + 1], bandsData[suboffset + 0]);
|
||||
|
||||
suboffset += 3;
|
||||
|
||||
if (xEnd < xStart)
|
||||
@ -376,11 +387,23 @@ int clear_decompress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize,
|
||||
|
||||
pDstPixel32 = vBarShortEntry->pixels;
|
||||
|
||||
for (y = 0; y < vBarShortPixelCount; y++)
|
||||
if (!invert)
|
||||
{
|
||||
*pDstPixel32 = RGB32(pSrcPixel8[2], pSrcPixel8[1], pSrcPixel8[0]);
|
||||
pSrcPixel8 += 3;
|
||||
pDstPixel32++;
|
||||
for (y = 0; y < vBarShortPixelCount; y++)
|
||||
{
|
||||
*pDstPixel32 = RGB32(pSrcPixel8[2], pSrcPixel8[1], pSrcPixel8[0]);
|
||||
pSrcPixel8 += 3;
|
||||
pDstPixel32++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (y = 0; y < vBarShortPixelCount; y++)
|
||||
{
|
||||
*pDstPixel32 = BGR32(pSrcPixel8[2], pSrcPixel8[1], pSrcPixel8[0]);
|
||||
pSrcPixel8 += 3;
|
||||
pDstPixel32++;
|
||||
}
|
||||
}
|
||||
|
||||
suboffset += (vBarShortPixelCount * 3);
|
||||
@ -561,15 +584,32 @@ int clear_decompress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize,
|
||||
|
||||
pSrcPixel8 = bitmapData;
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
if (!invert)
|
||||
{
|
||||
pDstPixel32 = (UINT32*) &pDstData[((nYDstRel + y) * nDstStep) + (nXDstRel * 4)];
|
||||
|
||||
for (x = 0; x < width; x++)
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
*pDstPixel32 = RGB32(pSrcPixel8[2], pSrcPixel8[1], pSrcPixel8[0]);
|
||||
pSrcPixel8 += 3;
|
||||
pDstPixel32++;
|
||||
pDstPixel32 = (UINT32*) &pDstData[((nYDstRel + y) * nDstStep) + (nXDstRel * 4)];
|
||||
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
*pDstPixel32 = RGB32(pSrcPixel8[2], pSrcPixel8[1], pSrcPixel8[0]);
|
||||
pSrcPixel8 += 3;
|
||||
pDstPixel32++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
pDstPixel32 = (UINT32*) &pDstData[((nYDstRel + y) * nDstStep) + (nXDstRel * 4)];
|
||||
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
*pDstPixel32 = BGR32(pSrcPixel8[2], pSrcPixel8[1], pSrcPixel8[0]);
|
||||
pSrcPixel8 += 3;
|
||||
pDstPixel32++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -582,11 +622,33 @@ int clear_decompress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize,
|
||||
pSrcPixel8 = clear->nsc->BitmapData;
|
||||
pDstPixel8 = &pDstData[(nYDstRel * nDstStep) + (nXDstRel * 4)];
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
if (!invert)
|
||||
{
|
||||
CopyMemory(pDstPixel8, pSrcPixel8, nSrcStep);
|
||||
pSrcPixel8 += nSrcStep;
|
||||
pDstPixel8 += nDstStep;
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
CopyMemory(pDstPixel8, pSrcPixel8, nSrcStep);
|
||||
pSrcPixel8 += nSrcStep;
|
||||
pDstPixel8 += nDstStep;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
pDstPixel8[0] = pSrcPixel8[2];
|
||||
pDstPixel8[1] = pSrcPixel8[1];
|
||||
pDstPixel8[2] = pSrcPixel8[0];
|
||||
pDstPixel8[3] = 0xFF;
|
||||
|
||||
pSrcPixel8 += 4;
|
||||
pDstPixel8 += 4;
|
||||
}
|
||||
|
||||
pSrcPixel8 += (nSrcStep - (width * 4));
|
||||
pDstPixel8 += (nDstStep - (width * 4));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (subcodecId == 2) /* CLEARCODEC_SUBCODEC_RLEX */
|
||||
@ -606,10 +668,21 @@ int clear_decompress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize,
|
||||
if (paletteCount > 127)
|
||||
return -1047;
|
||||
|
||||
for (i = 0; i < paletteCount; i++)
|
||||
if (!invert)
|
||||
{
|
||||
palette[i] = RGB32(pSrcPixel8[2], pSrcPixel8[1], pSrcPixel8[0]);
|
||||
pSrcPixel8 += 3;
|
||||
for (i = 0; i < paletteCount; i++)
|
||||
{
|
||||
palette[i] = RGB32(pSrcPixel8[2], pSrcPixel8[1], pSrcPixel8[0]);
|
||||
pSrcPixel8 += 3;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < paletteCount; i++)
|
||||
{
|
||||
palette[i] = BGR32(pSrcPixel8[2], pSrcPixel8[1], pSrcPixel8[0]);
|
||||
pSrcPixel8 += 3;
|
||||
}
|
||||
}
|
||||
|
||||
pixelIndex = 0;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -236,7 +236,7 @@ static INLINE UINT32 ExtractRunLength(UINT32 code, BYTE* pbOrderHdr, UINT32* adv
|
||||
#include "include/bitmap.c"
|
||||
|
||||
int interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved, BYTE* pSrcData, UINT32 SrcSize, int bpp,
|
||||
BYTE** ppDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst, int nWidth, int nHeight)
|
||||
BYTE** ppDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst, int nWidth, int nHeight, BYTE* palette)
|
||||
{
|
||||
int status;
|
||||
BOOL vFlip;
|
||||
@ -255,6 +255,9 @@ int interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved, BYTE* pSrcDa
|
||||
if (!interleaved)
|
||||
return -1;
|
||||
|
||||
if (nDstStep < 0)
|
||||
nDstStep = nWidth * dstBytesPerPixel;
|
||||
|
||||
if (bpp == 24)
|
||||
{
|
||||
scanline = nWidth * 3;
|
||||
@ -280,7 +283,7 @@ int interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved, BYTE* pSrcDa
|
||||
RleDecompress24to24(pSrcData, SrcSize, interleaved->TempBuffer, scanline, nWidth, nHeight);
|
||||
|
||||
status = freerdp_image_copy(pDstData, DstFormat, nDstStep, nXDst, nYDst,
|
||||
nWidth, nHeight, interleaved->TempBuffer, SrcFormat, scanline, 0, 0);
|
||||
nWidth, nHeight, interleaved->TempBuffer, SrcFormat, scanline, 0, 0, palette);
|
||||
}
|
||||
else if ((bpp == 16) || (bpp == 15))
|
||||
{
|
||||
@ -307,7 +310,7 @@ int interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved, BYTE* pSrcDa
|
||||
RleDecompress16to16(pSrcData, SrcSize, interleaved->TempBuffer, scanline, nWidth, nHeight);
|
||||
|
||||
status = freerdp_image_copy(pDstData, DstFormat, nDstStep, nXDst, nYDst,
|
||||
nWidth, nHeight, interleaved->TempBuffer, SrcFormat, scanline, 0, 0);
|
||||
nWidth, nHeight, interleaved->TempBuffer, SrcFormat, scanline, 0, 0, palette);
|
||||
}
|
||||
else if (bpp == 8)
|
||||
{
|
||||
@ -334,7 +337,7 @@ int interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved, BYTE* pSrcDa
|
||||
RleDecompress8to8(pSrcData, SrcSize, interleaved->TempBuffer, scanline, nWidth, nHeight);
|
||||
|
||||
status = freerdp_image_copy(pDstData, DstFormat, nDstStep, nXDst, nYDst,
|
||||
nWidth, nHeight, interleaved->TempBuffer, SrcFormat, scanline, 0, 0);
|
||||
nWidth, nHeight, interleaved->TempBuffer, SrcFormat, scanline, 0, 0, palette);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -277,7 +277,7 @@ static int planar_decompress_planes_raw(const BYTE* pSrcData[4], int nSrcStep, B
|
||||
}
|
||||
|
||||
int planar_decompress(BITMAP_PLANAR_CONTEXT* planar, BYTE* pSrcData, UINT32 SrcSize,
|
||||
BYTE** ppDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst, int nWidth, int nHeight)
|
||||
BYTE** ppDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst, int nWidth, int nHeight, BOOL vFlip)
|
||||
{
|
||||
BOOL cs;
|
||||
BOOL rle;
|
||||
@ -285,7 +285,6 @@ int planar_decompress(BITMAP_PLANAR_CONTEXT* planar, BYTE* pSrcData, UINT32 SrcS
|
||||
BOOL alpha;
|
||||
int status;
|
||||
BYTE* srcp;
|
||||
BOOL vFlip;
|
||||
int subSize;
|
||||
int subWidth;
|
||||
int subHeight;
|
||||
@ -296,14 +295,21 @@ int planar_decompress(BITMAP_PLANAR_CONTEXT* planar, BYTE* pSrcData, UINT32 SrcS
|
||||
int rawWidths[4];
|
||||
int rawHeights[4];
|
||||
BYTE FormatHeader;
|
||||
BOOL useTempBuffer;
|
||||
int dstBitsPerPixel;
|
||||
int dstBytesPerPixel;
|
||||
const BYTE* planes[4];
|
||||
UINT32 UncompressedSize;
|
||||
const primitives_t* prims = primitives_get();
|
||||
|
||||
if ((nWidth * nHeight) <= 0)
|
||||
if ((nWidth < 0) || (nHeight < 0))
|
||||
return -1;
|
||||
|
||||
vFlip = FREERDP_PIXEL_FORMAT_FLIP(DstFormat) ? TRUE : FALSE;
|
||||
dstBitsPerPixel = FREERDP_PIXEL_FORMAT_DEPTH(DstFormat);
|
||||
dstBytesPerPixel = (FREERDP_PIXEL_FORMAT_BPP(DstFormat) / 8);
|
||||
|
||||
if (nDstStep < 0)
|
||||
nDstStep = nWidth * 4;
|
||||
|
||||
srcp = pSrcData;
|
||||
UncompressedSize = nWidth * nHeight * 4;
|
||||
@ -312,7 +318,7 @@ int planar_decompress(BITMAP_PLANAR_CONTEXT* planar, BYTE* pSrcData, UINT32 SrcS
|
||||
|
||||
if (!pDstData)
|
||||
{
|
||||
pDstData = (BYTE*) malloc(UncompressedSize);
|
||||
pDstData = (BYTE*) _aligned_malloc(UncompressedSize, 16);
|
||||
|
||||
if (!pDstData)
|
||||
return -1;
|
||||
@ -320,6 +326,22 @@ int planar_decompress(BITMAP_PLANAR_CONTEXT* planar, BYTE* pSrcData, UINT32 SrcS
|
||||
*ppDstData = pDstData;
|
||||
}
|
||||
|
||||
useTempBuffer = (dstBytesPerPixel != 4) ? TRUE : FALSE;
|
||||
|
||||
if (useTempBuffer)
|
||||
{
|
||||
if (UncompressedSize > planar->TempSize)
|
||||
{
|
||||
planar->TempBuffer = _aligned_realloc(planar->TempBuffer, UncompressedSize, 16);
|
||||
planar->TempSize = UncompressedSize;
|
||||
}
|
||||
|
||||
if (!planar->TempBuffer)
|
||||
return -1;
|
||||
|
||||
pDstData = planar->TempBuffer;
|
||||
}
|
||||
|
||||
FormatHeader = *srcp++;
|
||||
|
||||
cll = (FormatHeader & PLANAR_FORMAT_HEADER_CLL_MASK);
|
||||
@ -578,6 +600,17 @@ int planar_decompress(BITMAP_PLANAR_CONTEXT* planar, BYTE* pSrcData, UINT32 SrcS
|
||||
|
||||
status = (SrcSize == (srcp - pSrcData)) ? 1 : -1;
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
if (useTempBuffer)
|
||||
{
|
||||
pDstData = *ppDstData;
|
||||
|
||||
status = freerdp_image_copy(pDstData, DstFormat, -1, 0, 0, nWidth, nHeight,
|
||||
planar->TempBuffer, PIXEL_FORMAT_XRGB32, -1, 0, 0, NULL);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -815,8 +815,10 @@ int progressive_decompress_tile_first(PROGRESSIVE_CONTEXT* progressive, RFX_PROG
|
||||
progressive_rfx_decode_component(progressive, &shiftCb, tile->cbData, tile->cbLen, pSrcDst[1], pCurrent[1], pSign[1], diff); /* Cb */
|
||||
progressive_rfx_decode_component(progressive, &shiftCr, tile->crData, tile->crLen, pSrcDst[2], pCurrent[2], pSign[2], diff); /* Cr */
|
||||
|
||||
prims->yCbCrToRGB_16s8u_P3AC4R((const INT16**) pSrcDst, 64 * 2,
|
||||
tile->data, 64 * 4, &roi_64x64);
|
||||
if (!progressive->invert)
|
||||
prims->yCbCrToRGB_16s8u_P3AC4R((const INT16**) pSrcDst, 64 * 2, tile->data, 64 * 4, &roi_64x64);
|
||||
else
|
||||
prims->yCbCrToBGR_16s8u_P3AC4R((const INT16**) pSrcDst, 64 * 2, tile->data, 64 * 4, &roi_64x64);
|
||||
|
||||
BufferPool_Return(progressive->bufferPool, pBuffer);
|
||||
|
||||
@ -1234,8 +1236,10 @@ int progressive_decompress_tile_upgrade(PROGRESSIVE_CONTEXT* progressive, RFX_PR
|
||||
if (status < 0)
|
||||
return -1;
|
||||
|
||||
prims->yCbCrToRGB_16s8u_P3AC4R((const INT16**) pSrcDst, 64 * 2,
|
||||
tile->data, 64 * 4, &roi_64x64);
|
||||
if (!progressive->invert)
|
||||
prims->yCbCrToRGB_16s8u_P3AC4R((const INT16**) pSrcDst, 64 * 2, tile->data, 64 * 4, &roi_64x64);
|
||||
else
|
||||
prims->yCbCrToBGR_16s8u_P3AC4R((const INT16**) pSrcDst, 64 * 2, tile->data, 64 * 4, &roi_64x64);
|
||||
|
||||
BufferPool_Return(progressive->bufferPool, pBuffer);
|
||||
|
||||
@ -1546,6 +1550,8 @@ int progressive_decompress(PROGRESSIVE_CONTEXT* progressive, BYTE* pSrcData, UIN
|
||||
RFX_COMPONENT_CODEC_QUANT* quantVal;
|
||||
RFX_PROGRESSIVE_CODEC_QUANT* quantProgVal;
|
||||
|
||||
progressive->invert = FREERDP_PIXEL_FORMAT_IS_ABGR(DstFormat) ? TRUE : FALSE;
|
||||
|
||||
surface = (PROGRESSIVE_SURFACE_CONTEXT*) progressive_get_surface_data(progressive, surfaceId);
|
||||
|
||||
if (!surface)
|
||||
|
@ -3110,7 +3110,7 @@ int TestFreeRDPCodecPlanar(int argc, char* argv[])
|
||||
pDstData = decompressedBitmap;
|
||||
|
||||
if (planar_decompress(planar, compressedBitmap, dstSize, &pDstData,
|
||||
PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height) < 0)
|
||||
PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height, FALSE) < 0)
|
||||
{
|
||||
printf("failed to decompress white bitmap: width: %d height: %d\n", width, height);
|
||||
return -1;
|
||||
@ -3148,7 +3148,7 @@ int TestFreeRDPCodecPlanar(int argc, char* argv[])
|
||||
pDstData = decompressedBitmap;
|
||||
|
||||
if (planar_decompress(planar, compressedBitmap, dstSize, &pDstData,
|
||||
PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height) < 0)
|
||||
PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height, FALSE) < 0)
|
||||
{
|
||||
printf("failed to decompress black bitmap: width: %d height: %d\n", width, height);
|
||||
return -1;
|
||||
@ -3185,7 +3185,7 @@ int TestFreeRDPCodecPlanar(int argc, char* argv[])
|
||||
pDstData = decompressedBitmap;
|
||||
|
||||
if (planar_decompress(planar, compressedBitmap, dstSize, &pDstData,
|
||||
PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height) < 0)
|
||||
PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height, FALSE) < 0)
|
||||
{
|
||||
printf("failed to decompress experimental bitmap 01: width: %d height: %d\n", width, height);
|
||||
return -1;
|
||||
@ -3223,7 +3223,7 @@ int TestFreeRDPCodecPlanar(int argc, char* argv[])
|
||||
pDstData = decompressedBitmap;
|
||||
|
||||
if (planar_decompress(planar, compressedBitmap, dstSize, &pDstData,
|
||||
PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height) < 0)
|
||||
PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height, FALSE) < 0)
|
||||
{
|
||||
printf("failed to decompress experimental bitmap 02: width: %d height: %d\n", width, height);
|
||||
return -1;
|
||||
@ -3268,7 +3268,7 @@ int TestFreeRDPCodecPlanar(int argc, char* argv[])
|
||||
pDstData = decompressedBitmap;
|
||||
|
||||
if (planar_decompress(planar, compressedBitmap, dstSize, &pDstData,
|
||||
PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height) < 0)
|
||||
PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height, FALSE) < 0)
|
||||
{
|
||||
printf("failed to decompress experimental bitmap 03: width: %d height: %d\n", width, height);
|
||||
return -1;
|
||||
|
@ -910,7 +910,7 @@ int test_progressive_decode(PROGRESSIVE_CONTEXT* progressive, EGFX_SAMPLE_FILE f
|
||||
|
||||
freerdp_image_copy(g_DstData, PIXEL_FORMAT_XRGB32, g_DstStep,
|
||||
nXDst, nYDst, nWidth, nHeight, tile->data,
|
||||
PIXEL_FORMAT_XRGB32, 64 * 4, nXSrc, nYSrc);
|
||||
PIXEL_FORMAT_XRGB32, 64 * 4, nXSrc, nYSrc, NULL);
|
||||
}
|
||||
|
||||
size = bitmaps[pass].size;
|
||||
|
@ -506,7 +506,6 @@ void gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
|
||||
BOOL compressed;
|
||||
UINT32 SrcFormat;
|
||||
UINT32 bitsPerPixel;
|
||||
UINT32 bytesPerPixel;
|
||||
BITMAP_DATA* bitmap;
|
||||
rdpGdi* gdi = context->gdi;
|
||||
rdpCodecs* codecs = context->codecs;
|
||||
@ -529,9 +528,6 @@ void gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
|
||||
|
||||
compressed = bitmap->compressed;
|
||||
bitsPerPixel = bitmap->bitsPerPixel;
|
||||
bytesPerPixel = (bitsPerPixel + 7) / 8;
|
||||
|
||||
SrcFormat = gdi_get_pixel_format(bitsPerPixel, TRUE);
|
||||
|
||||
if (gdi->bitmap_size < (nWidth * nHeight * 4))
|
||||
{
|
||||
@ -551,14 +547,14 @@ void gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
|
||||
freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_INTERLEAVED);
|
||||
|
||||
status = interleaved_decompress(codecs->interleaved, pSrcData, SrcSize, bitsPerPixel,
|
||||
&pDstData, SrcFormat, nWidth * bytesPerPixel, 0, 0, nWidth, nHeight);
|
||||
&pDstData, gdi->format, -1, 0, 0, nWidth, nHeight, gdi->palette);
|
||||
}
|
||||
else
|
||||
{
|
||||
freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_PLANAR);
|
||||
|
||||
status = planar_decompress(codecs->planar, pSrcData, SrcSize, &pDstData,
|
||||
PIXEL_FORMAT_XRGB32, nWidth * 4, 0, 0, nWidth, nHeight);
|
||||
gdi->format, -1, 0, 0, nWidth, nHeight, TRUE);
|
||||
}
|
||||
|
||||
if (status < 0)
|
||||
@ -569,17 +565,27 @@ void gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
|
||||
|
||||
pSrcData = gdi->bitmap_buffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
pDstData = gdi->bitmap_buffer;
|
||||
SrcFormat = gdi_get_pixel_format(bitsPerPixel, TRUE);
|
||||
|
||||
nSrcStep = nWidth * bytesPerPixel;
|
||||
status = freerdp_image_copy(pDstData, gdi->format, -1, 0, 0,
|
||||
nWidth, nHeight, pSrcData, SrcFormat, -1, 0, 0, gdi->palette);
|
||||
|
||||
pSrcData = gdi->bitmap_buffer;
|
||||
}
|
||||
|
||||
nSrcStep = nWidth * 4;
|
||||
|
||||
pDstData = gdi->primary_buffer;
|
||||
nDstStep = gdi->width * 4;
|
||||
nDstStep = gdi->width * gdi->bytesPerPixel;
|
||||
|
||||
nWidth = bitmap->destRight - bitmap->destLeft + 1; /* clip width */
|
||||
nHeight = bitmap->destBottom - bitmap->destTop + 1; /* clip height */
|
||||
|
||||
status = freerdp_image_copy(pDstData, PIXEL_FORMAT_XRGB32, nDstStep, nXDst, nYDst,
|
||||
nWidth, nHeight, pSrcData, SrcFormat, nSrcStep, nXSrc, nYSrc);
|
||||
status = freerdp_image_copy(pDstData, gdi->format, nDstStep, nXDst, nYDst,
|
||||
nWidth, nHeight, pSrcData, gdi->format, nSrcStep, nXSrc, nYSrc, gdi->palette);
|
||||
|
||||
gdi_InvalidateRegion(gdi->primary->hdc, nXDst, nYDst, nWidth, nHeight);
|
||||
}
|
||||
@ -587,8 +593,20 @@ void gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
|
||||
|
||||
void gdi_palette_update(rdpContext* context, PALETTE_UPDATE* palette)
|
||||
{
|
||||
int index;
|
||||
PALETTE_ENTRY* pe;
|
||||
UINT32* palette32;
|
||||
rdpGdi* gdi = context->gdi;
|
||||
|
||||
CopyMemory(gdi->clrconv->palette, palette, sizeof(rdpPalette));
|
||||
|
||||
palette32 = (UINT32*) gdi->palette;
|
||||
|
||||
for (index = 0; index < palette->number; index++)
|
||||
{
|
||||
pe = &(palette->entries[index]);
|
||||
palette32[index] = RGB32(pe->red, pe->green, pe->blue);
|
||||
}
|
||||
}
|
||||
|
||||
void gdi_set_bounds(rdpContext* context, rdpBounds* bounds)
|
||||
@ -626,8 +644,8 @@ void gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
|
||||
brush = &patblt->brush;
|
||||
|
||||
foreColor = freerdp_color_convert_drawing_order_color_to_gdi_color(patblt->foreColor, gdi->srcBpp, gdi->clrconv);
|
||||
backColor = freerdp_color_convert_drawing_order_color_to_gdi_color(patblt->backColor, gdi->srcBpp, gdi->clrconv);
|
||||
foreColor = freerdp_convert_gdi_order_color(patblt->foreColor, gdi->srcBpp, gdi->format, gdi->palette);
|
||||
backColor = freerdp_convert_gdi_order_color(patblt->backColor, gdi->srcBpp, gdi->format, gdi->palette);
|
||||
|
||||
originalColor = gdi_SetTextColor(gdi->drawing->hdc, foreColor);
|
||||
|
||||
@ -713,8 +731,7 @@ void gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
|
||||
gdi_CRgnToRect(opaque_rect->nLeftRect, opaque_rect->nTopRect,
|
||||
opaque_rect->nWidth, opaque_rect->nHeight, &rect);
|
||||
|
||||
brush_color = freerdp_color_convert_drawing_order_color_to_gdi_color(
|
||||
opaque_rect->color, gdi->srcBpp, gdi->clrconv);
|
||||
brush_color = freerdp_convert_gdi_order_color(opaque_rect->color, gdi->srcBpp, gdi->format, gdi->palette);
|
||||
|
||||
hBrush = gdi_CreateSolidBrush(brush_color);
|
||||
gdi_FillRect(gdi->drawing->hdc, &rect, hBrush);
|
||||
@ -738,8 +755,7 @@ void gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* multi_o
|
||||
gdi_CRgnToRect(rectangle->left, rectangle->top,
|
||||
rectangle->width, rectangle->height, &rect);
|
||||
|
||||
brush_color = freerdp_color_convert_drawing_order_color_to_gdi_color(
|
||||
multi_opaque_rect->color, gdi->srcBpp, gdi->clrconv);
|
||||
brush_color = freerdp_convert_gdi_order_color(multi_opaque_rect->color, gdi->srcBpp, gdi->format, gdi->palette);
|
||||
|
||||
hBrush = gdi_CreateSolidBrush(brush_color);
|
||||
gdi_FillRect(gdi->drawing->hdc, &rect, hBrush);
|
||||
@ -754,8 +770,7 @@ void gdi_line_to(rdpContext* context, LINE_TO_ORDER* lineTo)
|
||||
HGDI_PEN hPen;
|
||||
rdpGdi* gdi = context->gdi;
|
||||
|
||||
color = freerdp_color_convert_drawing_order_color_to_gdi_color(
|
||||
lineTo->penColor, gdi->srcBpp, gdi->clrconv);
|
||||
color = freerdp_convert_gdi_order_color(lineTo->penColor, gdi->srcBpp, gdi->format, gdi->palette);
|
||||
hPen = gdi_CreatePen(lineTo->penStyle, lineTo->penWidth, (GDI_COLOR) color);
|
||||
gdi_SelectObject(gdi->drawing->hdc, (HGDIOBJECT) hPen);
|
||||
gdi_SetROP2(gdi->drawing->hdc, lineTo->bRop2);
|
||||
@ -776,8 +791,7 @@ void gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
|
||||
DELTA_POINT* points;
|
||||
rdpGdi* gdi = context->gdi;
|
||||
|
||||
color = freerdp_color_convert_drawing_order_color_to_gdi_color(
|
||||
polyline->penColor, gdi->srcBpp, gdi->clrconv);
|
||||
color = freerdp_convert_gdi_order_color(polyline->penColor, gdi->srcBpp, gdi->format, gdi->palette);
|
||||
hPen = gdi_CreatePen(GDI_PS_SOLID, 1, (GDI_COLOR) color);
|
||||
gdi_SelectObject(gdi->drawing->hdc, (HGDIOBJECT) hPen);
|
||||
gdi_SetROP2(gdi->drawing->hdc, polyline->bRop2);
|
||||
@ -824,8 +838,8 @@ void gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
|
||||
brush = &mem3blt->brush;
|
||||
bitmap = (gdiBitmap*) mem3blt->bitmap;
|
||||
|
||||
foreColor = freerdp_color_convert_drawing_order_color_to_gdi_color(mem3blt->foreColor, gdi->srcBpp, gdi->clrconv);
|
||||
backColor = freerdp_color_convert_drawing_order_color_to_gdi_color(mem3blt->backColor, gdi->srcBpp, gdi->clrconv);
|
||||
foreColor = freerdp_convert_gdi_order_color(mem3blt->foreColor, gdi->srcBpp, gdi->format, gdi->palette);
|
||||
backColor = freerdp_convert_gdi_order_color(mem3blt->backColor, gdi->srcBpp, gdi->format, gdi->palette);
|
||||
|
||||
originalColor = gdi_SetTextColor(gdi->drawing->hdc, foreColor);
|
||||
|
||||
@ -926,31 +940,21 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
|
||||
{
|
||||
int i, j;
|
||||
int tx, ty;
|
||||
char* tile_bitmap;
|
||||
BYTE* pSrcData;
|
||||
BYTE* pDstData;
|
||||
RFX_MESSAGE* message;
|
||||
rdpGdi* gdi = context->gdi;
|
||||
|
||||
DEBUG_GDI("destLeft %d destTop %d destRight %d destBottom %d "
|
||||
"bpp %d codecID %d width %d height %d length %d",
|
||||
cmd->destLeft, cmd->destTop,
|
||||
cmd->destRight, cmd->destBottom,
|
||||
cmd->bpp, cmd->codecID,
|
||||
cmd->width, cmd->height,
|
||||
cmd->bitmapDataLength);
|
||||
|
||||
tile_bitmap = (char*) _aligned_malloc(32, 16);
|
||||
|
||||
if (!tile_bitmap)
|
||||
return;
|
||||
cmd->destLeft, cmd->destTop, cmd->destRight, cmd->destBottom,
|
||||
cmd->bpp, cmd->codecID, cmd->width, cmd->height, cmd->bitmapDataLength);
|
||||
|
||||
if (cmd->codecID == RDP_CODEC_ID_REMOTEFX)
|
||||
{
|
||||
freerdp_client_codecs_prepare(gdi->codecs, FREERDP_CODEC_REMOTEFX);
|
||||
|
||||
message = rfx_process_message(gdi->codecs->rfx,
|
||||
cmd->bitmapData, cmd->bitmapDataLength);
|
||||
|
||||
DEBUG_GDI("num_rects %d num_tiles %d", message->numRects, message->numTiles);
|
||||
message = rfx_process_message(gdi->codecs->rfx, cmd->bitmapData, cmd->bitmapDataLength);
|
||||
|
||||
/* blit each tile */
|
||||
for (i = 0; i < message->numTiles; i++)
|
||||
@ -958,7 +962,18 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
|
||||
tx = message->tiles[i]->x + cmd->destLeft;
|
||||
ty = message->tiles[i]->y + cmd->destTop;
|
||||
|
||||
freerdp_image_convert(message->tiles[i]->data, gdi->tile->bitmap->data, 64, 64, 32, 32, gdi->clrconv);
|
||||
pSrcData = message->tiles[i]->data;
|
||||
pDstData = gdi->tile->bitmap->data;
|
||||
|
||||
if (!gdi->invert && (gdi->dstBpp == 32))
|
||||
{
|
||||
gdi->tile->bitmap->data = pSrcData;
|
||||
}
|
||||
else
|
||||
{
|
||||
freerdp_image_copy(pDstData, gdi->format, -1, 0, 0,
|
||||
64, 64, pSrcData, PIXEL_FORMAT_XRGB32, -1, 0, 0, gdi->palette);
|
||||
}
|
||||
|
||||
for (j = 0; j < message->numRects; j++)
|
||||
{
|
||||
@ -969,6 +984,8 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
|
||||
|
||||
gdi_BitBlt(gdi->primary->hdc, tx, ty, 64, 64, gdi->tile->hdc, 0, 0, GDI_SRCCOPY);
|
||||
}
|
||||
|
||||
gdi->tile->bitmap->data = pDstData;
|
||||
}
|
||||
|
||||
gdi_SetNullClipRgn(gdi->primary->hdc);
|
||||
@ -978,61 +995,60 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
|
||||
{
|
||||
freerdp_client_codecs_prepare(gdi->codecs, FREERDP_CODEC_NSCODEC);
|
||||
|
||||
nsc_process_message(gdi->codecs->nsc, cmd->bpp, cmd->width, cmd->height,
|
||||
cmd->bitmapData, cmd->bitmapDataLength);
|
||||
nsc_process_message(gdi->codecs->nsc, cmd->bpp, cmd->width, cmd->height, cmd->bitmapData, cmd->bitmapDataLength);
|
||||
|
||||
if (gdi->bitmap_size < (cmd->width * cmd->height * 4))
|
||||
{
|
||||
gdi->bitmap_size = cmd->width * cmd->height * 4;
|
||||
gdi->bitmap_buffer = (BYTE*) _aligned_realloc(gdi->bitmap_buffer, gdi->bitmap_size, 16);
|
||||
|
||||
if (!gdi->bitmap_buffer)
|
||||
return;
|
||||
}
|
||||
|
||||
pDstData = gdi->bitmap_buffer;
|
||||
pSrcData = gdi->codecs->nsc->BitmapData;
|
||||
|
||||
freerdp_image_copy(pDstData, gdi->format, -1, 0, 0,
|
||||
cmd->width, cmd->height, pSrcData, PIXEL_FORMAT_XRGB32_VF, -1, 0, 0, gdi->palette);
|
||||
|
||||
gdi->image->bitmap->width = cmd->width;
|
||||
gdi->image->bitmap->height = cmd->height;
|
||||
gdi->image->bitmap->bitsPerPixel = cmd->bpp;
|
||||
gdi->image->bitmap->bytesPerPixel = gdi->image->bitmap->bitsPerPixel / 8;
|
||||
gdi->image->bitmap->data = (BYTE*) _aligned_realloc(gdi->image->bitmap->data, gdi->image->bitmap->width * gdi->image->bitmap->height * 4, 16);
|
||||
freerdp_image_convert(gdi->codecs->nsc->BitmapData, gdi->image->bitmap->data,
|
||||
cmd->width, cmd->height,
|
||||
cmd->bpp, gdi->dstBpp, gdi->clrconv);
|
||||
freerdp_image_flip(gdi->image->bitmap->data, gdi->image->bitmap->data, gdi->image->bitmap->width, gdi->image->bitmap->height, gdi->dstBpp);
|
||||
gdi->image->bitmap->bytesPerPixel = cmd->bpp / 8;
|
||||
gdi->image->bitmap->data = gdi->bitmap_buffer;
|
||||
|
||||
gdi_BitBlt(gdi->primary->hdc, cmd->destLeft, cmd->destTop, cmd->width, cmd->height, gdi->image->hdc, 0, 0, GDI_SRCCOPY);
|
||||
}
|
||||
else if (cmd->codecID == RDP_CODEC_ID_NONE)
|
||||
{
|
||||
if (gdi->bitmap_size < (cmd->width * cmd->height * 4))
|
||||
{
|
||||
gdi->bitmap_size = cmd->width * cmd->height * 4;
|
||||
gdi->bitmap_buffer = (BYTE*) _aligned_realloc(gdi->bitmap_buffer, gdi->bitmap_size, 16);
|
||||
|
||||
if (!gdi->bitmap_buffer)
|
||||
return;
|
||||
}
|
||||
|
||||
pDstData = gdi->bitmap_buffer;
|
||||
pSrcData = cmd->bitmapData;
|
||||
|
||||
freerdp_image_copy(pDstData, gdi->format, -1, 0, 0,
|
||||
cmd->width, cmd->height, pSrcData, PIXEL_FORMAT_XRGB32_VF, -1, 0, 0, gdi->palette);
|
||||
|
||||
gdi->image->bitmap->width = cmd->width;
|
||||
gdi->image->bitmap->height = cmd->height;
|
||||
gdi->image->bitmap->bitsPerPixel = cmd->bpp;
|
||||
gdi->image->bitmap->bytesPerPixel = gdi->image->bitmap->bitsPerPixel / 8;
|
||||
gdi->image->bitmap->bytesPerPixel = cmd->bpp / 8;
|
||||
gdi->image->bitmap->data = gdi->bitmap_buffer;
|
||||
|
||||
gdi->image->bitmap->data = (BYTE*) _aligned_realloc(gdi->image->bitmap->data,
|
||||
gdi->image->bitmap->width * gdi->image->bitmap->height * 4, 16);
|
||||
|
||||
if ((cmd->bpp != 32) || (gdi->clrconv->alpha))
|
||||
{
|
||||
BYTE* temp_image;
|
||||
|
||||
freerdp_image_convert(cmd->bitmapData, gdi->image->bitmap->data,
|
||||
gdi->image->bitmap->width, gdi->image->bitmap->height,
|
||||
gdi->image->bitmap->bitsPerPixel, 32, gdi->clrconv);
|
||||
|
||||
cmd->bpp = 32;
|
||||
cmd->bitmapData = gdi->image->bitmap->data;
|
||||
|
||||
temp_image = (BYTE*) _aligned_malloc(gdi->image->bitmap->width * gdi->image->bitmap->height * 4, 16);
|
||||
freerdp_image_flip(gdi->image->bitmap->data, temp_image, gdi->image->bitmap->width, gdi->image->bitmap->height, 32);
|
||||
_aligned_free(gdi->image->bitmap->data);
|
||||
gdi->image->bitmap->data = temp_image;
|
||||
}
|
||||
else
|
||||
{
|
||||
freerdp_image_flip(cmd->bitmapData, gdi->image->bitmap->data,
|
||||
gdi->image->bitmap->width, gdi->image->bitmap->height, 32);
|
||||
}
|
||||
|
||||
gdi_BitBlt(gdi->primary->hdc, cmd->destLeft, cmd->destTop,
|
||||
cmd->width, cmd->height, gdi->image->hdc, 0, 0, GDI_SRCCOPY);
|
||||
gdi_BitBlt(gdi->primary->hdc, cmd->destLeft, cmd->destTop, cmd->width, cmd->height, gdi->image->hdc, 0, 0, GDI_SRCCOPY);
|
||||
}
|
||||
else
|
||||
{
|
||||
WLog_ERR(TAG, "Unsupported codecID %d", cmd->codecID);
|
||||
WLog_ERR(TAG, "Unsupported codecID %d", cmd->codecID);
|
||||
}
|
||||
|
||||
if (tile_bitmap)
|
||||
_aligned_free(tile_bitmap);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1134,6 +1150,7 @@ void gdi_resize(rdpGdi* gdi, int width, int height)
|
||||
|
||||
int gdi_init(freerdp* instance, UINT32 flags, BYTE* buffer)
|
||||
{
|
||||
BOOL rgb555;
|
||||
rdpGdi* gdi;
|
||||
rdpCache* cache;
|
||||
|
||||
@ -1155,6 +1172,12 @@ int gdi_init(freerdp* instance, UINT32 flags, BYTE* buffer)
|
||||
/* default internal buffer format */
|
||||
gdi->dstBpp = 32;
|
||||
gdi->bytesPerPixel = 4;
|
||||
gdi->format = PIXEL_FORMAT_XRGB32;
|
||||
|
||||
if (flags & CLRCONV_INVERT)
|
||||
gdi->invert = TRUE;
|
||||
|
||||
rgb555 = (flags & CLRCONV_RGB555) ? TRUE : FALSE;
|
||||
|
||||
if (gdi->srcBpp > 16)
|
||||
{
|
||||
@ -1163,14 +1186,9 @@ int gdi_init(freerdp* instance, UINT32 flags, BYTE* buffer)
|
||||
gdi->dstBpp = 32;
|
||||
gdi->bytesPerPixel = 4;
|
||||
}
|
||||
else if (flags & CLRBUF_24BPP)
|
||||
{
|
||||
gdi->dstBpp = 24;
|
||||
gdi->bytesPerPixel = 3;
|
||||
}
|
||||
else if (flags & CLRBUF_16BPP)
|
||||
{
|
||||
gdi->dstBpp = 16;
|
||||
gdi->dstBpp = rgb555 ? 15 : 16;
|
||||
gdi->bytesPerPixel = 2;
|
||||
}
|
||||
}
|
||||
@ -1178,7 +1196,7 @@ int gdi_init(freerdp* instance, UINT32 flags, BYTE* buffer)
|
||||
{
|
||||
if (flags & CLRBUF_16BPP)
|
||||
{
|
||||
gdi->dstBpp = 16;
|
||||
gdi->dstBpp = rgb555 ? 15 : 16;
|
||||
gdi->bytesPerPixel = 2;
|
||||
}
|
||||
else if (flags & CLRBUF_32BPP)
|
||||
@ -1188,6 +1206,25 @@ int gdi_init(freerdp* instance, UINT32 flags, BYTE* buffer)
|
||||
}
|
||||
}
|
||||
|
||||
if (!gdi->invert)
|
||||
{
|
||||
if (gdi->bytesPerPixel == 4)
|
||||
gdi->format = PIXEL_FORMAT_XRGB32;
|
||||
else if ((gdi->bytesPerPixel == 2) && (gdi->dstBpp == 16))
|
||||
gdi->format = PIXEL_FORMAT_RGB565;
|
||||
else if ((gdi->bytesPerPixel == 2) && (gdi->dstBpp == 15))
|
||||
gdi->format = PIXEL_FORMAT_RGB555;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gdi->bytesPerPixel == 4)
|
||||
gdi->format = PIXEL_FORMAT_XBGR32;
|
||||
else if ((gdi->bytesPerPixel == 2) && (gdi->dstBpp == 16))
|
||||
gdi->format = PIXEL_FORMAT_BGR565;
|
||||
else if ((gdi->bytesPerPixel == 2) && (gdi->dstBpp == 15))
|
||||
gdi->format = PIXEL_FORMAT_BGR555;
|
||||
}
|
||||
|
||||
gdi->hdc = gdi_GetDC();
|
||||
gdi->hdc->bitsPerPixel = gdi->dstBpp;
|
||||
gdi->hdc->bytesPerPixel = gdi->bytesPerPixel;
|
||||
@ -1197,9 +1234,9 @@ int gdi_init(freerdp* instance, UINT32 flags, BYTE* buffer)
|
||||
if (!gdi->clrconv)
|
||||
return -1;
|
||||
|
||||
gdi->clrconv->alpha = (flags & CLRCONV_ALPHA) ? 1 : 0;
|
||||
gdi->clrconv->invert = (flags & CLRCONV_INVERT) ? 1 : 0;
|
||||
gdi->clrconv->rgb555 = (flags & CLRCONV_RGB555) ? 1 : 0;
|
||||
gdi->clrconv->alpha = (flags & CLRCONV_ALPHA) ? TRUE : FALSE;
|
||||
gdi->clrconv->invert = (flags & CLRCONV_INVERT) ? TRUE : FALSE;
|
||||
gdi->clrconv->rgb555 = (flags & CLRCONV_RGB555) ? TRUE : FALSE;
|
||||
gdi->clrconv->palette = (rdpPalette*) malloc(sizeof(rdpPalette));
|
||||
|
||||
if (!gdi->clrconv->palette)
|
||||
|
@ -55,8 +55,8 @@ int gdi_OutputUpdate(rdpGdi* gdi)
|
||||
if (!gdi->graphicsReset)
|
||||
return 1;
|
||||
|
||||
nDstStep = gdi->width * 4;
|
||||
pDstData = gdi->primary_buffer;
|
||||
nDstStep = gdi->bytesPerPixel * gdi->width;
|
||||
|
||||
surface = (gdiGfxSurface*) gdi->gfx->GetSurfaceData(gdi->gfx, gdi->outputSurfaceId);
|
||||
|
||||
@ -85,8 +85,8 @@ int gdi_OutputUpdate(rdpGdi* gdi)
|
||||
|
||||
update->BeginPaint(gdi->context);
|
||||
|
||||
freerdp_image_copy(pDstData, PIXEL_FORMAT_XRGB32, nDstStep, nXDst, nYDst, nWidth, nHeight,
|
||||
surface->data, PIXEL_FORMAT_XRGB32, surface->scanline, nXSrc, nYSrc);
|
||||
freerdp_image_copy(pDstData, gdi->format, nDstStep, nXDst, nYDst, nWidth, nHeight,
|
||||
surface->data, surface->format, surface->scanline, nXSrc, nYSrc, NULL);
|
||||
|
||||
gdi_InvalidateRegion(gdi->primary->hdc, nXDst, nYDst, nWidth, nHeight);
|
||||
|
||||
@ -144,8 +144,8 @@ int gdi_SurfaceCommand_Uncompressed(rdpGdi* gdi, RdpgfxClientContext* context, R
|
||||
if (!surface)
|
||||
return -1;
|
||||
|
||||
freerdp_image_copy(surface->data, PIXEL_FORMAT_XRGB32, surface->scanline, cmd->left, cmd->top,
|
||||
cmd->width, cmd->height, cmd->data, PIXEL_FORMAT_XRGB32, cmd->width * 4, 0, 0);
|
||||
freerdp_image_copy(surface->data, surface->format, surface->scanline, cmd->left, cmd->top,
|
||||
cmd->width, cmd->height, cmd->data, PIXEL_FORMAT_XRGB32, cmd->width * 4, 0, 0, NULL);
|
||||
|
||||
invalidRect.left = cmd->left;
|
||||
invalidRect.top = cmd->top;
|
||||
@ -223,9 +223,9 @@ int gdi_SurfaceCommand_RemoteFX(rdpGdi* gdi, RdpgfxClientContext* context, RDPGF
|
||||
nWidth = updateRects[j].right - updateRects[j].left;
|
||||
nHeight = updateRects[j].bottom - updateRects[j].top;
|
||||
|
||||
freerdp_image_copy(surface->data, PIXEL_FORMAT_XRGB32, surface->scanline,
|
||||
freerdp_image_copy(surface->data, surface->format, surface->scanline,
|
||||
nXDst, nYDst, nWidth, nHeight,
|
||||
tile->data, PIXEL_FORMAT_XRGB32, 64 * 4, 0, 0);
|
||||
tile->data, PIXEL_FORMAT_XRGB32, 64 * 4, 0, 0, NULL);
|
||||
|
||||
region16_union_rect(&(gdi->invalidRegion), &(gdi->invalidRegion), &updateRects[j]);
|
||||
}
|
||||
@ -258,7 +258,7 @@ int gdi_SurfaceCommand_ClearCodec(rdpGdi* gdi, RdpgfxClientContext* context, RDP
|
||||
DstData = surface->data;
|
||||
|
||||
status = clear_decompress(gdi->codecs->clear, cmd->data, cmd->length, &DstData,
|
||||
PIXEL_FORMAT_XRGB32, surface->scanline, cmd->left, cmd->top, cmd->width, cmd->height);
|
||||
surface->format, surface->scanline, cmd->left, cmd->top, cmd->width, cmd->height);
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
@ -297,7 +297,7 @@ int gdi_SurfaceCommand_Planar(rdpGdi* gdi, RdpgfxClientContext* context, RDPGFX_
|
||||
DstData = surface->data;
|
||||
|
||||
status = planar_decompress(gdi->codecs->planar, cmd->data, cmd->length, &DstData,
|
||||
PIXEL_FORMAT_XRGB32, surface->scanline, cmd->left, cmd->top, cmd->width, cmd->height);
|
||||
PIXEL_FORMAT_XRGB32, surface->scanline, cmd->left, cmd->top, cmd->width, cmd->height, FALSE);
|
||||
|
||||
invalidRect.left = cmd->left;
|
||||
invalidRect.top = cmd->top;
|
||||
@ -471,9 +471,9 @@ int gdi_SurfaceCommand_Progressive(rdpGdi* gdi, RdpgfxClientContext* context, RD
|
||||
nXSrc = nXDst - (cmd->left + tile->x);
|
||||
nYSrc = nYDst - (cmd->top + tile->y);
|
||||
|
||||
freerdp_image_copy(surface->data, PIXEL_FORMAT_XRGB32,
|
||||
freerdp_image_copy(surface->data, surface->format,
|
||||
surface->scanline, nXDst, nYDst, nWidth, nHeight,
|
||||
tile->data, PIXEL_FORMAT_XRGB32, 64 * 4, nXSrc, nYSrc);
|
||||
tile->data, PIXEL_FORMAT_XRGB32, 64 * 4, nXSrc, nYSrc, NULL);
|
||||
|
||||
region16_union_rect(&(gdi->invalidRegion), &(gdi->invalidRegion), &updateRects[j]);
|
||||
}
|
||||
@ -537,6 +537,7 @@ int gdi_DeleteEncodingContext(RdpgfxClientContext* context, RDPGFX_DELETE_ENCODI
|
||||
int gdi_CreateSurface(RdpgfxClientContext* context, RDPGFX_CREATE_SURFACE_PDU* createSurface)
|
||||
{
|
||||
gdiGfxSurface* surface;
|
||||
rdpGdi* gdi = (rdpGdi*) context->custom;
|
||||
|
||||
surface = (gdiGfxSurface*) calloc(1, sizeof(gdiGfxSurface));
|
||||
|
||||
@ -548,6 +549,8 @@ int gdi_CreateSurface(RdpgfxClientContext* context, RDPGFX_CREATE_SURFACE_PDU* c
|
||||
surface->height = (UINT32) createSurface->height;
|
||||
surface->alpha = (createSurface->pixelFormat == PIXEL_FORMAT_ARGB_8888) ? TRUE : FALSE;
|
||||
|
||||
surface->format = (!gdi->invert) ? PIXEL_FORMAT_XRGB32 : PIXEL_FORMAT_XBGR32;
|
||||
|
||||
surface->scanline = (surface->width + (surface->width % 4)) * 4;
|
||||
surface->data = (BYTE*) calloc(1, surface->scanline * surface->height);
|
||||
|
||||
@ -561,7 +564,7 @@ int gdi_CreateSurface(RdpgfxClientContext* context, RDPGFX_CREATE_SURFACE_PDU* c
|
||||
|
||||
int gdi_DeleteSurface(RdpgfxClientContext* context, RDPGFX_DELETE_SURFACE_PDU* deleteSurface)
|
||||
{
|
||||
gdiGfxSurface* surface = NULL;
|
||||
gdiGfxSurface* surface;
|
||||
rdpGdi* gdi = (rdpGdi*) context->custom;
|
||||
|
||||
surface = (gdiGfxSurface*) context->GetSurfaceData(context, deleteSurface->surfaceId);
|
||||
@ -601,7 +604,10 @@ int gdi_SolidFill(RdpgfxClientContext* context, RDPGFX_SOLID_FILL_PDU* solidFill
|
||||
r = solidFill->fillPixel.R;
|
||||
a = solidFill->fillPixel.XA;
|
||||
|
||||
color = ARGB32(a, r, g, b);
|
||||
if (!gdi->invert)
|
||||
color = ARGB32(a, r, g, b);
|
||||
else
|
||||
color = ABGR32(a, r, g, b);
|
||||
|
||||
for (index = 0; index < solidFill->fillRectCount; index++)
|
||||
{
|
||||
@ -615,7 +621,7 @@ int gdi_SolidFill(RdpgfxClientContext* context, RDPGFX_SOLID_FILL_PDU* solidFill
|
||||
invalidRect.right = rect->right;
|
||||
invalidRect.bottom = rect->bottom;
|
||||
|
||||
freerdp_image_fill(surface->data, PIXEL_FORMAT_XRGB32, surface->scanline,
|
||||
freerdp_image_fill(surface->data, surface->format, surface->scanline,
|
||||
rect->left, rect->top, nWidth, nHeight, color);
|
||||
|
||||
region16_union_rect(&(gdi->invalidRegion), &(gdi->invalidRegion), &invalidRect);
|
||||
@ -630,6 +636,7 @@ int gdi_SolidFill(RdpgfxClientContext* context, RDPGFX_SOLID_FILL_PDU* solidFill
|
||||
int gdi_SurfaceToSurface(RdpgfxClientContext* context, RDPGFX_SURFACE_TO_SURFACE_PDU* surfaceToSurface)
|
||||
{
|
||||
UINT16 index;
|
||||
BOOL sameSurface;
|
||||
int nWidth, nHeight;
|
||||
RDPGFX_RECT16* rectSrc;
|
||||
RDPGFX_POINT16* destPt;
|
||||
@ -643,7 +650,9 @@ int gdi_SurfaceToSurface(RdpgfxClientContext* context, RDPGFX_SURFACE_TO_SURFACE
|
||||
|
||||
surfaceSrc = (gdiGfxSurface*) context->GetSurfaceData(context, surfaceToSurface->surfaceIdSrc);
|
||||
|
||||
if (surfaceToSurface->surfaceIdSrc != surfaceToSurface->surfaceIdDest)
|
||||
sameSurface = (surfaceToSurface->surfaceIdSrc == surfaceToSurface->surfaceIdDest) ? TRUE : FALSE;
|
||||
|
||||
if (!sameSurface)
|
||||
surfaceDst = (gdiGfxSurface*) context->GetSurfaceData(context, surfaceToSurface->surfaceIdDest);
|
||||
else
|
||||
surfaceDst = surfaceSrc;
|
||||
@ -658,9 +667,17 @@ int gdi_SurfaceToSurface(RdpgfxClientContext* context, RDPGFX_SURFACE_TO_SURFACE
|
||||
{
|
||||
destPt = &surfaceToSurface->destPts[index];
|
||||
|
||||
freerdp_image_copy(surfaceDst->data, PIXEL_FORMAT_XRGB32, surfaceDst->scanline,
|
||||
destPt->x, destPt->y, nWidth, nHeight, surfaceSrc->data, PIXEL_FORMAT_XRGB32,
|
||||
surfaceSrc->scanline, rectSrc->left, rectSrc->top);
|
||||
if (sameSurface)
|
||||
{
|
||||
freerdp_image_move(surfaceDst->data, surfaceDst->format, surfaceDst->scanline,
|
||||
destPt->x, destPt->y, nWidth, nHeight, rectSrc->left, rectSrc->top);
|
||||
}
|
||||
else
|
||||
{
|
||||
freerdp_image_copy(surfaceDst->data, surfaceDst->format, surfaceDst->scanline,
|
||||
destPt->x, destPt->y, nWidth, nHeight, surfaceSrc->data, surfaceSrc->format,
|
||||
surfaceSrc->scanline, rectSrc->left, rectSrc->top, NULL);
|
||||
}
|
||||
|
||||
invalidRect.left = destPt->x;
|
||||
invalidRect.top = destPt->y;
|
||||
@ -681,6 +698,7 @@ int gdi_SurfaceToCache(RdpgfxClientContext* context, RDPGFX_SURFACE_TO_CACHE_PDU
|
||||
RDPGFX_RECT16* rect;
|
||||
gdiGfxSurface* surface;
|
||||
gdiGfxCacheEntry* cacheEntry;
|
||||
rdpGdi* gdi = (rdpGdi*) context->custom;
|
||||
|
||||
rect = &(surfaceToCache->rectSrc);
|
||||
|
||||
@ -698,15 +716,17 @@ int gdi_SurfaceToCache(RdpgfxClientContext* context, RDPGFX_SURFACE_TO_CACHE_PDU
|
||||
cacheEntry->height = (UINT32) (rect->bottom - rect->top);
|
||||
cacheEntry->alpha = surface->alpha;
|
||||
|
||||
cacheEntry->format = (!gdi->invert) ? PIXEL_FORMAT_XRGB32 : PIXEL_FORMAT_XBGR32;
|
||||
|
||||
cacheEntry->scanline = (cacheEntry->width + (cacheEntry->width % 4)) * 4;
|
||||
cacheEntry->data = (BYTE*) calloc(1, cacheEntry->scanline * cacheEntry->height);
|
||||
|
||||
if (!cacheEntry->data)
|
||||
return -1;
|
||||
|
||||
freerdp_image_copy(cacheEntry->data, PIXEL_FORMAT_XRGB32, cacheEntry->scanline,
|
||||
freerdp_image_copy(cacheEntry->data, cacheEntry->format, cacheEntry->scanline,
|
||||
0, 0, cacheEntry->width, cacheEntry->height, surface->data,
|
||||
PIXEL_FORMAT_XRGB32, surface->scanline, rect->left, rect->top);
|
||||
surface->format, surface->scanline, rect->left, rect->top, NULL);
|
||||
|
||||
context->SetCacheSlotData(context, surfaceToCache->cacheSlot, (void*) cacheEntry);
|
||||
|
||||
@ -732,9 +752,9 @@ int gdi_CacheToSurface(RdpgfxClientContext* context, RDPGFX_CACHE_TO_SURFACE_PDU
|
||||
{
|
||||
destPt = &cacheToSurface->destPts[index];
|
||||
|
||||
freerdp_image_copy(surface->data, PIXEL_FORMAT_XRGB32, surface->scanline,
|
||||
freerdp_image_copy(surface->data, surface->format, surface->scanline,
|
||||
destPt->x, destPt->y, cacheEntry->width, cacheEntry->height,
|
||||
cacheEntry->data, PIXEL_FORMAT_XRGB32, cacheEntry->scanline, 0, 0);
|
||||
cacheEntry->data, cacheEntry->format, cacheEntry->scanline, 0, 0, NULL);
|
||||
|
||||
invalidRect.left = destPt->x;
|
||||
invalidRect.top = destPt->y;
|
||||
|
@ -44,13 +44,63 @@
|
||||
#define TAG FREERDP_TAG("gdi")
|
||||
/* Bitmap Class */
|
||||
|
||||
HGDI_BITMAP gdi_create_bitmap(rdpGdi* gdi, int width, int height, int bpp, BYTE* data)
|
||||
HGDI_BITMAP gdi_create_bitmap(rdpGdi* gdi, int nWidth, int nHeight, int bpp, BYTE* data)
|
||||
{
|
||||
BYTE* bmpData;
|
||||
int nSrcStep;
|
||||
int nDstStep;
|
||||
BYTE* pSrcData;
|
||||
BYTE* pDstData;
|
||||
UINT32 SrcFormat;
|
||||
int bytesPerPixel;
|
||||
HGDI_BITMAP bitmap;
|
||||
|
||||
bmpData = freerdp_image_convert(data, NULL, width, height, 32, 32, gdi->clrconv);
|
||||
bitmap = gdi_CreateBitmap(width, height, gdi->dstBpp, bmpData);
|
||||
nDstStep = nWidth * gdi->bytesPerPixel;
|
||||
pDstData = _aligned_malloc(nHeight * nDstStep, 16);
|
||||
|
||||
if (!pDstData)
|
||||
return NULL;
|
||||
|
||||
pSrcData = data;
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
case 32:
|
||||
bytesPerPixel = 4;
|
||||
SrcFormat = PIXEL_FORMAT_XRGB32;
|
||||
break;
|
||||
|
||||
case 24:
|
||||
bytesPerPixel = 3;
|
||||
SrcFormat = PIXEL_FORMAT_RGB24;
|
||||
break;
|
||||
|
||||
case 16:
|
||||
bytesPerPixel = 2;
|
||||
SrcFormat = PIXEL_FORMAT_RGB565;
|
||||
break;
|
||||
|
||||
case 15:
|
||||
bytesPerPixel = 2;
|
||||
SrcFormat = PIXEL_FORMAT_RGB555;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
bytesPerPixel = 1;
|
||||
SrcFormat = PIXEL_FORMAT_RGB8;
|
||||
break;
|
||||
|
||||
default:
|
||||
SrcFormat = PIXEL_FORMAT_RGB565;
|
||||
bytesPerPixel = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
nSrcStep = nWidth * bytesPerPixel;
|
||||
|
||||
freerdp_image_copy(pDstData, gdi->format, nDstStep, 0, 0,
|
||||
nWidth, nHeight, pSrcData, SrcFormat, nSrcStep, 0, 0, gdi->palette);
|
||||
|
||||
bitmap = gdi_CreateBitmap(nWidth, nHeight, gdi->dstBpp, pDstData);
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
@ -66,7 +116,7 @@ void gdi_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
|
||||
if (!bitmap->data)
|
||||
gdi_bitmap->bitmap = gdi_CreateCompatibleBitmap(gdi->hdc, bitmap->width, bitmap->height);
|
||||
else
|
||||
gdi_bitmap->bitmap = gdi_create_bitmap(gdi, bitmap->width, bitmap->height, gdi->dstBpp, bitmap->data);
|
||||
gdi_bitmap->bitmap = gdi_create_bitmap(gdi, bitmap->width, bitmap->height, bitmap->bpp, bitmap->data);
|
||||
|
||||
gdi_SelectObject(gdi_bitmap->hdc, (HGDIOBJECT) gdi_bitmap->bitmap);
|
||||
gdi_bitmap->org_bitmap = NULL;
|
||||
@ -112,10 +162,7 @@ void gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
||||
bytesPerPixel = (bpp + 7) / 8;
|
||||
size = width * height * 4;
|
||||
|
||||
if (!bitmap->data)
|
||||
bitmap->data = (BYTE*) _aligned_malloc(size, 16);
|
||||
else
|
||||
bitmap->data = (BYTE*) _aligned_realloc(bitmap->data, size, 16);
|
||||
bitmap->data = (BYTE*) _aligned_malloc(size, 16);
|
||||
|
||||
pSrcData = data;
|
||||
SrcSize = (UINT32) length;
|
||||
@ -128,14 +175,14 @@ void gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
||||
freerdp_client_codecs_prepare(gdi->codecs, FREERDP_CODEC_INTERLEAVED);
|
||||
|
||||
status = interleaved_decompress(gdi->codecs->interleaved, pSrcData, SrcSize, bpp,
|
||||
&pDstData, PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height);
|
||||
&pDstData, gdi->format, -1, 0, 0, width, height, gdi->palette);
|
||||
}
|
||||
else
|
||||
{
|
||||
freerdp_client_codecs_prepare(gdi->codecs, FREERDP_CODEC_PLANAR);
|
||||
|
||||
status = planar_decompress(gdi->codecs->planar, pSrcData, SrcSize, &pDstData,
|
||||
PIXEL_FORMAT_XRGB32_VF, width * 4, 0, 0, width, height);
|
||||
gdi->format, -1, 0, 0, width, height, TRUE);
|
||||
}
|
||||
|
||||
if (status < 0)
|
||||
@ -148,13 +195,13 @@ void gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
||||
{
|
||||
SrcFormat = gdi_get_pixel_format(bpp, TRUE);
|
||||
|
||||
status = freerdp_image_copy(pDstData, PIXEL_FORMAT_XRGB32, width * 4, 0, 0,
|
||||
width, height, pSrcData, SrcFormat, width * bytesPerPixel, 0, 0);
|
||||
status = freerdp_image_copy(pDstData, gdi->format, -1, 0, 0,
|
||||
width, height, pSrcData, SrcFormat, -1, 0, 0, gdi->palette);
|
||||
}
|
||||
|
||||
bitmap->compressed = FALSE;
|
||||
bitmap->length = size;
|
||||
bitmap->bpp = 32;
|
||||
bitmap->bpp = gdi->dstBpp;
|
||||
}
|
||||
|
||||
void gdi_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary)
|
||||
@ -220,10 +267,8 @@ void gdi_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int heigh
|
||||
HGDI_BRUSH brush;
|
||||
rdpGdi* gdi = context->gdi;
|
||||
|
||||
bgcolor = freerdp_color_convert_drawing_order_color_to_gdi_color(
|
||||
bgcolor, gdi->srcBpp, gdi->clrconv);
|
||||
fgcolor = freerdp_color_convert_drawing_order_color_to_gdi_color(
|
||||
fgcolor, gdi->srcBpp, gdi->clrconv);
|
||||
bgcolor = freerdp_convert_gdi_order_color(bgcolor, gdi->srcBpp, gdi->format, gdi->palette);
|
||||
fgcolor = freerdp_convert_gdi_order_color(fgcolor, gdi->srcBpp, gdi->format, gdi->palette);
|
||||
|
||||
gdi_CRgnToRect(x, y, width, height, &rect);
|
||||
|
||||
@ -238,8 +283,7 @@ void gdi_Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height,
|
||||
{
|
||||
rdpGdi* gdi = context->gdi;
|
||||
|
||||
bgcolor = freerdp_color_convert_drawing_order_color_to_gdi_color(
|
||||
bgcolor, gdi->srcBpp, gdi->clrconv);
|
||||
bgcolor = freerdp_convert_gdi_order_color(bgcolor, gdi->srcBpp, gdi->format, gdi->palette);
|
||||
gdi->textColor = gdi_SetTextColor(gdi->drawing->hdc, bgcolor);
|
||||
}
|
||||
|
||||
|
@ -93,6 +93,65 @@ pstatus_t general_yCbCrToRGB_16s8u_P3AC4R(const INT16* pSrc[3], int srcStep,
|
||||
return PRIMITIVES_SUCCESS;
|
||||
}
|
||||
|
||||
pstatus_t general_yCbCrToBGR_16s8u_P3AC4R(const INT16* pSrc[3], int srcStep,
|
||||
BYTE* pDst, int dstStep, const prim_size_t* roi)
|
||||
{
|
||||
int x, y;
|
||||
INT16 R, G, B;
|
||||
float Y, Cb, Cr;
|
||||
BYTE* pRGB = pDst;
|
||||
const INT16* pY = pSrc[0];
|
||||
const INT16* pCb = pSrc[1];
|
||||
const INT16* pCr = pSrc[2];
|
||||
int srcPad = (srcStep - (roi->width * 2)) / 2;
|
||||
int dstPad = (dstStep - (roi->width * 4)) / 4;
|
||||
|
||||
for (y = 0; y < roi->height; y++)
|
||||
{
|
||||
for (x = 0; x < roi->width; x++)
|
||||
{
|
||||
Y = (float) (pY[0] + 4096);
|
||||
Cb = (float) (pCb[0]);
|
||||
Cr = (float) (pCr[0]);
|
||||
|
||||
R = ((INT16) (((Cr * 1.402525f) + Y + 16.0f)) >> 5);
|
||||
G = ((INT16) ((Y - (Cb * 0.343730f) - (Cr * 0.714401f) + 16.0f)) >> 5);
|
||||
B = ((INT16) (((Cb * 1.769905f) + Y + 16.0f)) >> 5);
|
||||
|
||||
if (R < 0)
|
||||
R = 0;
|
||||
else if (R > 255)
|
||||
R = 255;
|
||||
|
||||
if (G < 0)
|
||||
G = 0;
|
||||
else if (G > 255)
|
||||
G = 255;
|
||||
|
||||
if (B < 0)
|
||||
B = 0;
|
||||
else if (B > 255)
|
||||
B = 255;
|
||||
|
||||
*pRGB++ = (BYTE) R;
|
||||
*pRGB++ = (BYTE) G;
|
||||
*pRGB++ = (BYTE) B;
|
||||
*pRGB++ = 0xFF;
|
||||
|
||||
pY++;
|
||||
pCb++;
|
||||
pCr++;
|
||||
}
|
||||
|
||||
pY += srcPad;
|
||||
pCb += srcPad;
|
||||
pCr += srcPad;
|
||||
pRGB += dstPad;
|
||||
}
|
||||
|
||||
return PRIMITIVES_SUCCESS;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
pstatus_t general_yCbCrToRGB_16s16s_P3P3(
|
||||
@ -280,6 +339,7 @@ pstatus_t general_RGBToRGB_16s8u_P3AC4R(
|
||||
void primitives_init_colors(primitives_t* prims)
|
||||
{
|
||||
prims->yCbCrToRGB_16s8u_P3AC4R = general_yCbCrToRGB_16s8u_P3AC4R;
|
||||
prims->yCbCrToBGR_16s8u_P3AC4R = general_yCbCrToBGR_16s8u_P3AC4R;
|
||||
prims->yCbCrToRGB_16s16s_P3P3 = general_yCbCrToRGB_16s16s_P3P3;
|
||||
prims->RGBToYCbCr_16s16s_P3P3 = general_RGBToYCbCr_16s16s_P3P3;
|
||||
prims->RGBToRGB_16s8u_P3AC4R = general_RGBToRGB_16s8u_P3AC4R;
|
||||
|
@ -357,31 +357,11 @@ void mf_input_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
CGEventPost(kCGHIDEventTap, kbEvent);
|
||||
CFRelease(kbEvent);
|
||||
CFRelease(source);
|
||||
|
||||
/*
|
||||
if (flags & KBD_FLAGS_EXTENDED)
|
||||
WLog_ERR(TAG, "extended ");
|
||||
WLog_ERR(TAG, "keypress: down = %d, SCAN=%#0X, VK=%#0X", keyDown, code, keymap[code]);
|
||||
*/
|
||||
}
|
||||
|
||||
void mf_input_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
{
|
||||
/*
|
||||
INPUT keyboard_event;
|
||||
|
||||
keyboard_event.type = INPUT_KEYBOARD;
|
||||
keyboard_event.ki.wVk = 0;
|
||||
keyboard_event.ki.wScan = code;
|
||||
keyboard_event.ki.dwFlags = KEYEVENTF_UNICODE;
|
||||
keyboard_event.ki.dwExtraInfo = 0;
|
||||
keyboard_event.ki.time = 0;
|
||||
|
||||
if (flags & KBD_FLAGS_RELEASE)
|
||||
keyboard_event.ki.dwFlags |= KEYEVENTF_KEYUP;
|
||||
|
||||
SendInput(1, &keyboard_event, sizeof(INPUT));
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
void mf_input_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
@ -552,56 +532,7 @@ void mf_input_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
|
||||
void mf_input_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
{
|
||||
WLog_ERR(TAG, "Unhandled mouse event!!!");
|
||||
/*
|
||||
if ((flags & PTR_XFLAGS_BUTTON1) || (flags & PTR_XFLAGS_BUTTON2))
|
||||
{
|
||||
INPUT mouse_event;
|
||||
ZeroMemory(&mouse_event, sizeof(INPUT));
|
||||
|
||||
mouse_event.type = INPUT_MOUSE;
|
||||
|
||||
if (flags & PTR_FLAGS_MOVE)
|
||||
{
|
||||
float width, height;
|
||||
wfInfo * wfi;
|
||||
|
||||
wfi = wf_info_get_instance();
|
||||
//width and height of primary screen (even in multimon setups
|
||||
width = (float) GetSystemMetrics(SM_CXSCREEN);
|
||||
height = (float) GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
x += wfi->servscreen_xoffset;
|
||||
y += wfi->servscreen_yoffset;
|
||||
|
||||
//mouse_event.mi.dx = x * (0xFFFF / width);
|
||||
//mouse_event.mi.dy = y * (0xFFFF / height);
|
||||
mouse_event.mi.dx = (LONG) ((float) x * (65535.0f / width));
|
||||
mouse_event.mi.dy = (LONG) ((float) y * (65535.0f / height));
|
||||
mouse_event.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
|
||||
|
||||
SendInput(1, &mouse_event, sizeof(INPUT));
|
||||
}
|
||||
|
||||
mouse_event.mi.dx = mouse_event.mi.dy = mouse_event.mi.dwFlags = 0;
|
||||
|
||||
if (flags & PTR_XFLAGS_DOWN)
|
||||
mouse_event.mi.dwFlags |= MOUSEEVENTF_XDOWN;
|
||||
else
|
||||
mouse_event.mi.dwFlags |= MOUSEEVENTF_XUP;
|
||||
|
||||
if (flags & PTR_XFLAGS_BUTTON1)
|
||||
mouse_event.mi.mouseData = XBUTTON1;
|
||||
else if (flags & PTR_XFLAGS_BUTTON2)
|
||||
mouse_event.mi.mouseData = XBUTTON2;
|
||||
|
||||
SendInput(1, &mouse_event, sizeof(INPUT));
|
||||
}
|
||||
else
|
||||
{
|
||||
mf_input_mouse_event(input, flags, x, y);
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -230,7 +230,7 @@ int x11_shadow_screen_grab(x11ShadowSubsystem* subsystem)
|
||||
freerdp_image_copy(surface->data, PIXEL_FORMAT_XRGB32,
|
||||
surface->scanline, x - surface->x, y - surface->y, width, height,
|
||||
(BYTE*) image->data, PIXEL_FORMAT_XRGB32,
|
||||
image->bytes_per_line, x, y);
|
||||
image->bytes_per_line, x, y, NULL);
|
||||
|
||||
region16_union_rect(&(subsystem->invalidRegion), &(subsystem->invalidRegion), &invalidRect);
|
||||
|
||||
@ -271,7 +271,7 @@ int x11_shadow_screen_grab(x11ShadowSubsystem* subsystem)
|
||||
freerdp_image_copy(surface->data, PIXEL_FORMAT_XRGB32,
|
||||
surface->scanline, x - surface->x, y - surface->y, width, height,
|
||||
(BYTE*) image->data, PIXEL_FORMAT_XRGB32,
|
||||
image->bytes_per_line, x, y);
|
||||
image->bytes_per_line, x, y, NULL);
|
||||
|
||||
region16_union_rect(&(subsystem->invalidRegion), &(subsystem->invalidRegion), &invalidRect);
|
||||
|
||||
|
@ -489,7 +489,7 @@ int shadow_client_send_bitmap_update(rdpShadowClient* client, rdpShadowSurface*
|
||||
buffer = encoder->grid[k];
|
||||
|
||||
freerdp_image_copy(buffer, dstFormat, -1, 0, 0, nWidth, nHeight,
|
||||
data, srcFormat, nSrcStep, 0, 0);
|
||||
data, srcFormat, nSrcStep, 0, 0, NULL);
|
||||
|
||||
lines = freerdp_bitmap_compress((char*) buffer, nWidth, nHeight, s,
|
||||
settings->ColorDepth, 64 * 64 * 4, nHeight - 1, ts, e);
|
||||
|
@ -211,7 +211,6 @@ SECURITY_STATUS ntlm_read_NegotiateMessage(NTLM_CONTEXT* context, PSecBuffer buf
|
||||
|
||||
if (!((message->NegotiateFlags & NTLMSSP_REQUEST_TARGET) &&
|
||||
(message->NegotiateFlags & NTLMSSP_NEGOTIATE_NTLM) &&
|
||||
(message->NegotiateFlags & NTLMSSP_NEGOTIATE_ALWAYS_SIGN) &&
|
||||
(message->NegotiateFlags & NTLMSSP_NEGOTIATE_UNICODE)))
|
||||
{
|
||||
Stream_Free(s, FALSE);
|
||||
|
Loading…
Reference in New Issue
Block a user