2014-06-05 02:03:25 +04:00
|
|
|
/**
|
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
|
|
|
* X11 Graphics Pipeline
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
2014-09-12 19:13:01 +04:00
|
|
|
#include <freerdp/log.h>
|
2014-06-05 02:03:25 +04:00
|
|
|
#include "xf_gfx.h"
|
|
|
|
|
2014-09-12 19:13:01 +04:00
|
|
|
#define TAG CLIENT_TAG("x11")
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_ResetGraphics(RdpgfxClientContext* context, RDPGFX_RESET_GRAPHICS_PDU* resetGraphics)
|
2015-02-07 01:46:15 +03:00
|
|
|
{
|
2015-02-11 00:32:07 +03:00
|
|
|
int index;
|
2015-10-13 21:49:30 +03:00
|
|
|
UINT16 count;
|
2015-02-11 00:32:07 +03:00
|
|
|
xfGfxSurface* surface;
|
|
|
|
UINT16* pSurfaceIds = NULL;
|
|
|
|
xfContext* xfc = (xfContext*) context->custom;
|
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
context->GetSurfaceIds(context, &pSurfaceIds, &count);
|
2015-02-07 01:46:15 +03:00
|
|
|
|
2015-02-11 00:32:07 +03:00
|
|
|
for (index = 0; index < count; index++)
|
2015-02-07 01:46:15 +03:00
|
|
|
{
|
2015-02-11 00:32:07 +03:00
|
|
|
surface = (xfGfxSurface*) context->GetSurfaceData(context, pSurfaceIds[index]);
|
2015-02-07 01:46:15 +03:00
|
|
|
|
2015-02-11 00:32:07 +03:00
|
|
|
if (!surface || !surface->outputMapped)
|
2015-02-07 01:46:15 +03:00
|
|
|
continue;
|
|
|
|
|
2015-10-13 21:49:30 +03:00
|
|
|
freerdp_client_codecs_reset(surface->codecs, FREERDP_CODEC_ALL);
|
|
|
|
|
2015-02-11 00:32:07 +03:00
|
|
|
region16_clear(&surface->invalidRegion);
|
2015-02-07 01:46:15 +03:00
|
|
|
}
|
|
|
|
|
2015-02-11 00:32:07 +03:00
|
|
|
free(pSurfaceIds);
|
2014-06-05 06:49:03 +04:00
|
|
|
|
2015-10-13 21:49:30 +03:00
|
|
|
freerdp_client_codecs_reset(xfc->codecs, FREERDP_CODEC_ALL);
|
|
|
|
|
2014-06-13 00:13:12 +04:00
|
|
|
xfc->graphicsReset = TRUE;
|
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-05 02:03:25 +04:00
|
|
|
}
|
|
|
|
|
2015-02-07 01:46:15 +03:00
|
|
|
int xf_OutputUpdate(xfContext* xfc, xfGfxSurface* surface)
|
2014-06-05 02:03:25 +04:00
|
|
|
{
|
2014-06-05 06:49:03 +04:00
|
|
|
UINT16 width, height;
|
2015-02-07 01:46:15 +03:00
|
|
|
UINT32 surfaceX, surfaceY;
|
2014-06-05 20:36:01 +04:00
|
|
|
RECTANGLE_16 surfaceRect;
|
2014-06-05 06:49:03 +04:00
|
|
|
const RECTANGLE_16* extents;
|
2014-06-05 20:36:01 +04:00
|
|
|
|
2015-02-11 00:32:07 +03:00
|
|
|
surfaceX = surface->outputOriginX;
|
|
|
|
surfaceY = surface->outputOriginY;
|
2014-06-05 20:36:01 +04:00
|
|
|
|
2015-02-07 01:46:15 +03:00
|
|
|
surfaceRect.left = surfaceX;
|
|
|
|
surfaceRect.top = surfaceY;
|
|
|
|
surfaceRect.right = surfaceX + surface->width;
|
|
|
|
surfaceRect.bottom = surfaceY + surface->height;
|
2014-06-05 06:49:03 +04:00
|
|
|
|
2014-06-13 00:13:12 +04:00
|
|
|
XSetClipMask(xfc->display, xfc->gc, None);
|
|
|
|
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
|
|
|
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
|
|
|
|
2015-02-07 01:46:15 +03:00
|
|
|
if (!region16_is_empty(&surface->invalidRegion))
|
2014-06-05 06:49:03 +04:00
|
|
|
{
|
2015-02-07 01:46:15 +03:00
|
|
|
extents = region16_extents(&surface->invalidRegion);
|
2014-06-05 06:49:03 +04:00
|
|
|
|
2014-06-20 01:08:50 +04:00
|
|
|
width = extents->right - extents->left;
|
|
|
|
height = extents->bottom - extents->top;
|
2014-06-05 06:49:03 +04:00
|
|
|
|
2015-02-07 01:46:15 +03:00
|
|
|
if (width > surface->width)
|
|
|
|
width = surface->width;
|
2014-06-05 20:36:01 +04:00
|
|
|
|
2015-02-07 01:46:15 +03:00
|
|
|
if (height > surface->height)
|
|
|
|
height = surface->height;
|
2014-06-05 20:36:01 +04:00
|
|
|
|
2014-09-17 22:29:56 +04:00
|
|
|
if (surface->stage)
|
|
|
|
{
|
|
|
|
freerdp_image_copy(surface->stage, xfc->format, surface->stageStep, 0, 0,
|
2014-09-18 02:30:09 +04:00
|
|
|
surface->width, surface->height, surface->data, surface->format, surface->scanline, 0, 0, NULL);
|
2014-09-17 22:29:56 +04:00
|
|
|
}
|
|
|
|
|
2014-12-01 13:56:44 +03:00
|
|
|
#ifdef WITH_XRENDER
|
|
|
|
if (xfc->settings->SmartSizing || xfc->settings->MultiTouchGestures)
|
|
|
|
{
|
|
|
|
XPutImage(xfc->display, xfc->primary, xfc->gc, surface->image,
|
2015-02-07 01:46:15 +03:00
|
|
|
extents->left, extents->top, extents->left + surfaceX, extents->top + surfaceY, width, height);
|
2014-12-01 13:56:44 +03:00
|
|
|
|
|
|
|
xf_draw_screen(xfc, extents->left, extents->top, width, height);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
XPutImage(xfc->display, xfc->drawable, xfc->gc, surface->image,
|
2015-02-07 01:46:15 +03:00
|
|
|
extents->left, extents->top, extents->left + surfaceX, extents->top + surfaceY, width, height);
|
2014-12-01 13:56:44 +03:00
|
|
|
}
|
2014-06-05 06:49:03 +04:00
|
|
|
}
|
2014-06-05 20:36:01 +04:00
|
|
|
|
2015-02-07 01:46:15 +03:00
|
|
|
region16_clear(&surface->invalidRegion);
|
2014-06-05 20:36:01 +04:00
|
|
|
|
2014-06-13 00:13:12 +04:00
|
|
|
XSetClipMask(xfc->display, xfc->gc, None);
|
2015-06-30 12:41:23 +03:00
|
|
|
XSync(xfc->display, False);
|
2014-06-05 21:13:47 +04:00
|
|
|
|
2014-06-05 20:36:01 +04:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-02-11 00:32:07 +03:00
|
|
|
int xf_UpdateSurfaces(xfContext* xfc)
|
2015-02-07 01:46:15 +03:00
|
|
|
{
|
2015-06-09 16:22:26 +03:00
|
|
|
UINT16 count;
|
2015-02-11 00:32:07 +03:00
|
|
|
int index;
|
2015-02-07 01:46:15 +03:00
|
|
|
int status = 1;
|
2015-02-11 00:32:07 +03:00
|
|
|
xfGfxSurface* surface;
|
|
|
|
UINT16* pSurfaceIds = NULL;
|
|
|
|
RdpgfxClientContext* context = xfc->gfx;
|
2015-02-07 01:46:15 +03:00
|
|
|
|
|
|
|
if (!xfc->graphicsReset)
|
|
|
|
return 1;
|
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
context->GetSurfaceIds(context, &pSurfaceIds, &count);
|
2015-02-07 01:46:15 +03:00
|
|
|
|
2015-02-11 00:32:07 +03:00
|
|
|
for (index = 0; index < count; index++)
|
2015-02-07 01:46:15 +03:00
|
|
|
{
|
2015-02-11 00:32:07 +03:00
|
|
|
surface = (xfGfxSurface*) context->GetSurfaceData(context, pSurfaceIds[index]);
|
2015-02-07 01:46:15 +03:00
|
|
|
|
2015-02-11 00:32:07 +03:00
|
|
|
if (!surface || !surface->outputMapped)
|
|
|
|
continue;
|
2015-02-07 01:46:15 +03:00
|
|
|
|
2015-02-11 00:32:07 +03:00
|
|
|
status = xf_OutputUpdate(xfc, surface);
|
2015-02-07 01:46:15 +03:00
|
|
|
|
2015-02-11 00:32:07 +03:00
|
|
|
if (status < 0)
|
|
|
|
break;
|
2015-02-07 01:46:15 +03:00
|
|
|
}
|
|
|
|
|
2015-02-11 00:32:07 +03:00
|
|
|
free(pSurfaceIds);
|
|
|
|
|
|
|
|
return status;
|
2015-02-07 01:46:15 +03:00
|
|
|
}
|
|
|
|
|
2014-06-13 00:13:12 +04:00
|
|
|
int xf_OutputExpose(xfContext* xfc, int x, int y, int width, int height)
|
|
|
|
{
|
2015-06-09 16:22:26 +03:00
|
|
|
UINT16 count;
|
2015-02-11 00:32:07 +03:00
|
|
|
int index;
|
2015-02-07 01:46:15 +03:00
|
|
|
int status = 1;
|
2015-02-11 00:32:07 +03:00
|
|
|
xfGfxSurface* surface;
|
2014-06-13 00:13:12 +04:00
|
|
|
RECTANGLE_16 invalidRect;
|
2015-02-11 00:32:07 +03:00
|
|
|
RECTANGLE_16 surfaceRect;
|
|
|
|
RECTANGLE_16 intersection;
|
|
|
|
UINT16* pSurfaceIds = NULL;
|
|
|
|
RdpgfxClientContext* context = xfc->gfx;
|
2014-06-13 00:13:12 +04:00
|
|
|
|
|
|
|
invalidRect.left = x;
|
|
|
|
invalidRect.top = y;
|
2014-06-20 01:08:50 +04:00
|
|
|
invalidRect.right = x + width;
|
|
|
|
invalidRect.bottom = y + height;
|
2014-06-13 00:13:12 +04:00
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
context->GetSurfaceIds(context, &pSurfaceIds, &count);
|
2015-02-11 00:32:07 +03:00
|
|
|
|
|
|
|
for (index = 0; index < count; index++)
|
|
|
|
{
|
|
|
|
surface = (xfGfxSurface*) context->GetSurfaceData(context, pSurfaceIds[index]);
|
|
|
|
|
|
|
|
if (!surface || !surface->outputMapped)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
surfaceRect.left = surface->outputOriginX;
|
|
|
|
surfaceRect.top = surface->outputOriginY;
|
|
|
|
surfaceRect.right = surface->outputOriginX + surface->width;
|
|
|
|
surfaceRect.bottom = surface->outputOriginY + surface->height;
|
|
|
|
|
|
|
|
if (rectangles_intersection(&invalidRect, &surfaceRect, &intersection))
|
|
|
|
{
|
|
|
|
/* Invalid rects are specified relative to surface origin */
|
|
|
|
intersection.left -= surfaceRect.left;
|
|
|
|
intersection.top -= surfaceRect.top;
|
|
|
|
intersection.right -= surfaceRect.left;
|
|
|
|
intersection.bottom -= surfaceRect.top;
|
|
|
|
|
|
|
|
region16_union_rect(&surface->invalidRegion, &surface->invalidRegion, &intersection);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
free(pSurfaceIds);
|
2014-06-13 00:13:12 +04:00
|
|
|
|
2015-02-07 01:46:15 +03:00
|
|
|
if (xf_UpdateSurfaces(xfc) < 0)
|
|
|
|
status = -1;
|
2014-06-13 00:13:12 +04:00
|
|
|
|
2015-02-07 01:46:15 +03:00
|
|
|
return status;
|
2014-06-13 00:13:12 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_StartFrame(RdpgfxClientContext* context, RDPGFX_START_FRAME_PDU* startFrame)
|
2014-06-05 20:36:01 +04:00
|
|
|
{
|
|
|
|
xfContext* xfc = (xfContext*) context->custom;
|
|
|
|
|
|
|
|
xfc->inGfxFrame = TRUE;
|
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-05 20:36:01 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_EndFrame(RdpgfxClientContext* context, RDPGFX_END_FRAME_PDU* endFrame)
|
2014-06-05 20:36:01 +04:00
|
|
|
{
|
|
|
|
xfContext* xfc = (xfContext*) context->custom;
|
|
|
|
|
2015-02-07 01:46:15 +03:00
|
|
|
xf_UpdateSurfaces(xfc);
|
2014-06-05 20:36:01 +04:00
|
|
|
|
|
|
|
xfc->inGfxFrame = FALSE;
|
2014-06-05 06:49:03 +04:00
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-05 02:03:25 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_SurfaceCommand_Uncompressed(xfContext* xfc, RdpgfxClientContext* context, RDPGFX_SURFACE_COMMAND* cmd)
|
2014-06-05 02:03:25 +04:00
|
|
|
{
|
2014-06-13 00:13:12 +04:00
|
|
|
xfGfxSurface* surface;
|
2014-06-05 06:49:03 +04:00
|
|
|
RECTANGLE_16 invalidRect;
|
2014-06-05 02:03:25 +04:00
|
|
|
|
2014-06-13 00:13:12 +04:00
|
|
|
surface = (xfGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
|
2014-06-05 02:03:25 +04:00
|
|
|
|
2014-06-13 00:13:12 +04:00
|
|
|
if (!surface)
|
2015-06-09 16:22:26 +03:00
|
|
|
return ERROR_INTERNAL_ERROR;
|
2014-06-05 02:03:25 +04:00
|
|
|
|
2014-09-17 22:29:56 +04:00
|
|
|
freerdp_image_copy(surface->data, surface->format, surface->scanline, cmd->left, cmd->top,
|
2014-09-18 02:30:09 +04:00
|
|
|
cmd->width, cmd->height, cmd->data, PIXEL_FORMAT_XRGB32, -1, 0, 0, NULL);
|
2014-06-05 02:03:25 +04:00
|
|
|
|
2014-06-05 06:49:03 +04:00
|
|
|
invalidRect.left = cmd->left;
|
|
|
|
invalidRect.top = cmd->top;
|
|
|
|
invalidRect.right = cmd->right;
|
|
|
|
invalidRect.bottom = cmd->bottom;
|
|
|
|
|
2015-02-07 01:46:15 +03:00
|
|
|
region16_union_rect(&surface->invalidRegion, &surface->invalidRegion, &invalidRect);
|
2014-06-05 02:03:25 +04:00
|
|
|
|
2014-06-05 20:36:01 +04:00
|
|
|
if (!xfc->inGfxFrame)
|
2015-02-07 01:46:15 +03:00
|
|
|
xf_UpdateSurfaces(xfc);
|
2014-06-05 20:36:01 +04:00
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-05 02:03:25 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_SurfaceCommand_RemoteFX(xfContext* xfc, RdpgfxClientContext* context, RDPGFX_SURFACE_COMMAND* cmd)
|
2014-06-05 02:03:25 +04:00
|
|
|
{
|
2014-06-13 02:23:51 +04:00
|
|
|
int j;
|
|
|
|
UINT16 i;
|
2014-06-05 20:36:01 +04:00
|
|
|
RFX_RECT* rect;
|
|
|
|
RFX_TILE* tile;
|
2014-06-13 00:13:12 +04:00
|
|
|
int nXDst, nYDst;
|
|
|
|
int nWidth, nHeight;
|
2014-06-13 02:23:51 +04:00
|
|
|
int nbUpdateRects;
|
2014-06-05 02:03:25 +04:00
|
|
|
RFX_MESSAGE* message;
|
2014-06-13 00:13:12 +04:00
|
|
|
xfGfxSurface* surface;
|
2014-06-13 02:23:51 +04:00
|
|
|
REGION16 updateRegion;
|
|
|
|
RECTANGLE_16 updateRect;
|
|
|
|
RECTANGLE_16* updateRects;
|
|
|
|
REGION16 clippingRects;
|
|
|
|
RECTANGLE_16 clippingRect;
|
2014-06-05 20:36:01 +04:00
|
|
|
|
2014-06-13 00:13:12 +04:00
|
|
|
surface = (xfGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
|
|
|
|
|
|
|
|
if (!surface)
|
2015-06-09 16:22:26 +03:00
|
|
|
return ERROR_INTERNAL_ERROR;
|
2014-06-05 20:36:01 +04:00
|
|
|
|
2015-10-13 21:49:30 +03:00
|
|
|
if (!freerdp_client_codecs_prepare(surface->codecs, FREERDP_CODEC_REMOTEFX))
|
|
|
|
return ERROR_INTERNAL_ERROR;
|
|
|
|
|
|
|
|
if (!(message = rfx_process_message(surface->codecs->rfx, cmd->data, cmd->length)))
|
2015-04-23 16:42:21 +03:00
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "Failed to process RemoteFX message");
|
2015-06-09 16:22:26 +03:00
|
|
|
return ERROR_INTERNAL_ERROR;
|
2015-04-23 16:42:21 +03:00
|
|
|
}
|
2014-06-05 02:03:25 +04:00
|
|
|
|
2014-06-13 02:23:51 +04:00
|
|
|
region16_init(&clippingRects);
|
|
|
|
|
|
|
|
for (i = 0; i < message->numRects; i++)
|
2014-06-05 02:03:25 +04:00
|
|
|
{
|
2014-06-13 02:23:51 +04:00
|
|
|
rect = &(message->rects[i]);
|
2014-06-05 02:03:25 +04:00
|
|
|
|
2014-06-13 02:23:51 +04:00
|
|
|
clippingRect.left = cmd->left + rect->x;
|
|
|
|
clippingRect.top = cmd->top + rect->y;
|
2014-06-20 01:08:50 +04:00
|
|
|
clippingRect.right = clippingRect.left + rect->width;
|
|
|
|
clippingRect.bottom = clippingRect.top + rect->height;
|
2014-06-05 20:36:01 +04:00
|
|
|
|
2014-06-13 02:23:51 +04:00
|
|
|
region16_union_rect(&clippingRects, &clippingRects, &clippingRect);
|
2014-06-05 02:03:25 +04:00
|
|
|
}
|
|
|
|
|
2014-06-13 02:23:51 +04:00
|
|
|
for (i = 0; i < message->numTiles; i++)
|
2014-06-05 02:03:25 +04:00
|
|
|
{
|
2014-06-13 02:23:51 +04:00
|
|
|
tile = message->tiles[i];
|
|
|
|
|
|
|
|
updateRect.left = cmd->left + tile->x;
|
|
|
|
updateRect.top = cmd->top + tile->y;
|
2014-06-20 01:08:50 +04:00
|
|
|
updateRect.right = updateRect.left + 64;
|
|
|
|
updateRect.bottom = updateRect.top + 64;
|
2014-06-05 02:03:25 +04:00
|
|
|
|
2014-06-13 02:23:51 +04:00
|
|
|
region16_init(&updateRegion);
|
|
|
|
region16_intersect_rect(&updateRegion, &clippingRects, &updateRect);
|
|
|
|
updateRects = (RECTANGLE_16*) region16_rects(&updateRegion, &nbUpdateRects);
|
2014-06-05 06:49:03 +04:00
|
|
|
|
2014-06-13 02:23:51 +04:00
|
|
|
for (j = 0; j < nbUpdateRects; j++)
|
|
|
|
{
|
|
|
|
nXDst = updateRects[j].left;
|
|
|
|
nYDst = updateRects[j].top;
|
2014-06-20 01:08:50 +04:00
|
|
|
nWidth = updateRects[j].right - updateRects[j].left;
|
|
|
|
nHeight = updateRects[j].bottom - updateRects[j].top;
|
2014-06-05 20:36:01 +04:00
|
|
|
|
2014-09-17 22:29:56 +04:00
|
|
|
freerdp_image_copy(surface->data, surface->format, surface->scanline,
|
2014-06-13 02:23:51 +04:00
|
|
|
nXDst, nYDst, nWidth, nHeight,
|
2014-09-18 02:30:09 +04:00
|
|
|
tile->data, PIXEL_FORMAT_XRGB32, 64 * 4, 0, 0, NULL);
|
2014-06-05 02:03:25 +04:00
|
|
|
|
2015-02-07 01:46:15 +03:00
|
|
|
region16_union_rect(&surface->invalidRegion, &surface->invalidRegion, &updateRects[j]);
|
2014-06-13 02:23:51 +04:00
|
|
|
}
|
2014-06-13 00:13:12 +04:00
|
|
|
|
2014-06-13 02:23:51 +04:00
|
|
|
region16_uninit(&updateRegion);
|
2014-06-13 00:13:12 +04:00
|
|
|
}
|
2014-06-05 20:36:01 +04:00
|
|
|
|
2015-10-13 21:49:30 +03:00
|
|
|
rfx_message_free(surface->codecs->rfx, message);
|
2014-06-05 02:03:25 +04:00
|
|
|
|
2014-12-28 02:53:27 +03:00
|
|
|
region16_uninit(&clippingRects);
|
|
|
|
|
2014-06-05 20:36:01 +04:00
|
|
|
if (!xfc->inGfxFrame)
|
2015-02-07 01:46:15 +03:00
|
|
|
xf_UpdateSurfaces(xfc);
|
2014-06-05 06:49:03 +04:00
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-05 06:49:03 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_SurfaceCommand_ClearCodec(xfContext* xfc, RdpgfxClientContext* context, RDPGFX_SURFACE_COMMAND* cmd)
|
2014-06-05 06:49:03 +04:00
|
|
|
{
|
2014-06-14 01:30:13 +04:00
|
|
|
int status;
|
2014-06-26 02:39:28 +04:00
|
|
|
BYTE* DstData = NULL;
|
2014-06-14 01:30:13 +04:00
|
|
|
xfGfxSurface* surface;
|
|
|
|
RECTANGLE_16 invalidRect;
|
|
|
|
|
|
|
|
surface = (xfGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
|
|
|
|
|
|
|
|
if (!surface)
|
2015-06-09 16:22:26 +03:00
|
|
|
return ERROR_INTERNAL_ERROR;
|
2014-06-14 01:30:13 +04:00
|
|
|
|
2015-10-13 21:49:30 +03:00
|
|
|
if (!freerdp_client_codecs_prepare(xfc->codecs, FREERDP_CODEC_CLEARCODEC))
|
|
|
|
return ERROR_INTERNAL_ERROR;
|
|
|
|
|
2014-06-26 02:39:28 +04:00
|
|
|
DstData = surface->data;
|
2014-06-14 01:30:13 +04:00
|
|
|
|
2014-09-10 08:42:41 +04:00
|
|
|
status = clear_decompress(xfc->codecs->clear, cmd->data, cmd->length, &DstData,
|
2014-09-17 22:29:56 +04:00
|
|
|
surface->format, surface->scanline, cmd->left, cmd->top, cmd->width, cmd->height);
|
2014-06-14 01:30:13 +04:00
|
|
|
|
2014-07-02 00:32:36 +04:00
|
|
|
if (status < 0)
|
|
|
|
{
|
2015-10-13 21:49:30 +03:00
|
|
|
WLog_ERR(TAG, "clear_decompress failure: %d", status);
|
2015-06-09 16:22:26 +03:00
|
|
|
return ERROR_INTERNAL_ERROR;
|
2014-07-02 00:32:36 +04:00
|
|
|
}
|
|
|
|
|
2014-06-14 01:30:13 +04:00
|
|
|
invalidRect.left = cmd->left;
|
|
|
|
invalidRect.top = cmd->top;
|
|
|
|
invalidRect.right = cmd->right;
|
|
|
|
invalidRect.bottom = cmd->bottom;
|
|
|
|
|
2015-02-07 01:46:15 +03:00
|
|
|
region16_union_rect(&surface->invalidRegion, &surface->invalidRegion, &invalidRect);
|
2014-06-14 01:30:13 +04:00
|
|
|
|
2014-06-05 20:36:01 +04:00
|
|
|
if (!xfc->inGfxFrame)
|
2015-02-07 01:46:15 +03:00
|
|
|
xf_UpdateSurfaces(xfc);
|
2014-06-05 20:36:01 +04:00
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-05 06:49:03 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_SurfaceCommand_Planar(xfContext* xfc, RdpgfxClientContext* context, RDPGFX_SURFACE_COMMAND* cmd)
|
2014-06-05 06:49:03 +04:00
|
|
|
{
|
2014-06-18 00:15:30 +04:00
|
|
|
int status;
|
|
|
|
BYTE* DstData = NULL;
|
|
|
|
xfGfxSurface* surface;
|
|
|
|
RECTANGLE_16 invalidRect;
|
|
|
|
|
|
|
|
surface = (xfGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
|
|
|
|
|
|
|
|
if (!surface)
|
2015-06-09 16:22:26 +03:00
|
|
|
return ERROR_INTERNAL_ERROR;
|
2014-06-18 00:15:30 +04:00
|
|
|
|
2015-10-13 21:49:30 +03:00
|
|
|
if (!freerdp_client_codecs_prepare(surface->codecs, FREERDP_CODEC_PLANAR))
|
|
|
|
return ERROR_INTERNAL_ERROR;
|
|
|
|
|
2014-06-19 21:55:34 +04:00
|
|
|
DstData = surface->data;
|
2014-06-18 00:15:30 +04:00
|
|
|
|
2015-10-13 21:49:30 +03:00
|
|
|
status = planar_decompress(surface->codecs->planar, cmd->data, cmd->length, &DstData,
|
2014-09-17 22:29:56 +04:00
|
|
|
surface->format, surface->scanline, cmd->left, cmd->top, cmd->width, cmd->height, FALSE);
|
2014-06-18 00:15:30 +04:00
|
|
|
|
|
|
|
invalidRect.left = cmd->left;
|
|
|
|
invalidRect.top = cmd->top;
|
|
|
|
invalidRect.right = cmd->right;
|
|
|
|
invalidRect.bottom = cmd->bottom;
|
|
|
|
|
2015-02-07 01:46:15 +03:00
|
|
|
region16_union_rect(&surface->invalidRegion, &surface->invalidRegion, &invalidRect);
|
2014-06-18 00:15:30 +04:00
|
|
|
|
2014-06-05 20:36:01 +04:00
|
|
|
if (!xfc->inGfxFrame)
|
2015-02-07 01:46:15 +03:00
|
|
|
xf_UpdateSurfaces(xfc);
|
2014-06-05 20:36:01 +04:00
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-05 02:03:25 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_SurfaceCommand_H264(xfContext* xfc, RdpgfxClientContext* context, RDPGFX_SURFACE_COMMAND* cmd)
|
2014-07-02 07:28:09 +04:00
|
|
|
{
|
|
|
|
int status;
|
2014-09-03 00:16:56 +04:00
|
|
|
UINT32 i;
|
2014-07-02 07:28:09 +04:00
|
|
|
BYTE* DstData = NULL;
|
|
|
|
xfGfxSurface* surface;
|
2014-07-09 02:04:24 +04:00
|
|
|
RDPGFX_H264_METABLOCK* meta;
|
2014-07-10 00:41:36 +04:00
|
|
|
RDPGFX_H264_BITMAP_STREAM* bs;
|
2014-07-09 01:37:29 +04:00
|
|
|
|
2015-10-13 21:49:30 +03:00
|
|
|
surface = (xfGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
|
|
|
|
|
|
|
|
if (!surface)
|
2015-06-09 16:22:26 +03:00
|
|
|
return ERROR_INTERNAL_ERROR;
|
2014-07-29 23:42:04 +04:00
|
|
|
|
2015-10-13 21:49:30 +03:00
|
|
|
if (!freerdp_client_codecs_prepare(surface->codecs, FREERDP_CODEC_H264))
|
|
|
|
return ERROR_INTERNAL_ERROR;
|
2014-07-09 01:37:29 +04:00
|
|
|
|
2014-07-10 00:41:36 +04:00
|
|
|
bs = (RDPGFX_H264_BITMAP_STREAM*) cmd->extra;
|
|
|
|
|
|
|
|
if (!bs)
|
2015-06-09 16:22:26 +03:00
|
|
|
return ERROR_INTERNAL_ERROR;
|
2014-07-02 07:28:09 +04:00
|
|
|
|
2014-07-10 00:41:36 +04:00
|
|
|
meta = &(bs->meta);
|
2014-07-09 02:04:24 +04:00
|
|
|
|
2014-07-02 07:28:09 +04:00
|
|
|
DstData = surface->data;
|
|
|
|
|
2015-10-13 21:49:30 +03:00
|
|
|
status = h264_decompress(surface->codecs->h264, bs->data, bs->length, &DstData,
|
|
|
|
surface->format, surface->scanline , surface->width,
|
|
|
|
surface->height, meta->regionRects, meta->numRegionRects);
|
2014-07-02 07:28:09 +04:00
|
|
|
|
2014-08-13 22:56:40 +04:00
|
|
|
if (status < 0)
|
|
|
|
{
|
2015-09-03 13:05:02 +03:00
|
|
|
WLog_WARN(TAG, "h264_decompress failure: %d, ignoring update.", status);
|
|
|
|
return CHANNEL_RC_OK;
|
2014-08-13 22:56:40 +04:00
|
|
|
}
|
2014-07-02 07:28:09 +04:00
|
|
|
|
2014-07-09 02:04:24 +04:00
|
|
|
for (i = 0; i < meta->numRegionRects; i++)
|
|
|
|
{
|
2015-02-07 01:46:15 +03:00
|
|
|
region16_union_rect(&surface->invalidRegion, &surface->invalidRegion, (RECTANGLE_16*) &(meta->regionRects[i]));
|
2014-07-09 02:04:24 +04:00
|
|
|
}
|
|
|
|
|
2014-08-13 22:56:40 +04:00
|
|
|
if (!xfc->inGfxFrame)
|
2015-02-07 01:46:15 +03:00
|
|
|
xf_UpdateSurfaces(xfc);
|
2014-07-02 07:28:09 +04:00
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-07-02 07:28:09 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_SurfaceCommand_Alpha(xfContext* xfc, RdpgfxClientContext* context, RDPGFX_SURFACE_COMMAND* cmd)
|
2014-07-02 07:28:09 +04:00
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
xfGfxSurface* surface;
|
|
|
|
RECTANGLE_16 invalidRect;
|
|
|
|
|
|
|
|
surface = (xfGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
|
|
|
|
|
|
|
|
if (!surface)
|
2015-06-09 16:22:26 +03:00
|
|
|
return ERROR_INTERNAL_ERROR;
|
2014-07-02 07:28:09 +04:00
|
|
|
|
2015-10-13 21:49:30 +03:00
|
|
|
if (!freerdp_client_codecs_prepare(surface->codecs, FREERDP_CODEC_ALPHACODEC))
|
|
|
|
return ERROR_INTERNAL_ERROR;
|
|
|
|
|
2015-07-06 23:28:52 +03:00
|
|
|
WLog_DBG(TAG, "xf_SurfaceCommand_Alpha: status: %d", status);
|
2014-07-02 07:28:09 +04:00
|
|
|
/* fill with green for now to distinguish from the rest */
|
|
|
|
|
|
|
|
freerdp_image_fill(surface->data, PIXEL_FORMAT_XRGB32, surface->scanline,
|
|
|
|
cmd->left, cmd->top, cmd->width, cmd->height, 0x00FF00);
|
|
|
|
|
|
|
|
invalidRect.left = cmd->left;
|
|
|
|
invalidRect.top = cmd->top;
|
|
|
|
invalidRect.right = cmd->right;
|
|
|
|
invalidRect.bottom = cmd->bottom;
|
|
|
|
|
2015-02-07 01:46:15 +03:00
|
|
|
region16_union_rect(&surface->invalidRegion, &surface->invalidRegion, &invalidRect);
|
2014-07-02 07:28:09 +04:00
|
|
|
|
|
|
|
if (!xfc->inGfxFrame)
|
2015-02-07 01:46:15 +03:00
|
|
|
xf_UpdateSurfaces(xfc);
|
2014-07-02 07:28:09 +04:00
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-07-02 07:28:09 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_SurfaceCommand_Progressive(xfContext* xfc, RdpgfxClientContext* context, RDPGFX_SURFACE_COMMAND* cmd)
|
2014-07-02 07:28:09 +04:00
|
|
|
{
|
2014-08-19 22:48:09 +04:00
|
|
|
int i, j;
|
|
|
|
int status;
|
|
|
|
BYTE* DstData;
|
|
|
|
RFX_RECT* rect;
|
|
|
|
int nXDst, nYDst;
|
2014-08-26 03:50:42 +04:00
|
|
|
int nXSrc, nYSrc;
|
2014-08-19 22:48:09 +04:00
|
|
|
int nWidth, nHeight;
|
|
|
|
int nbUpdateRects;
|
2014-07-02 07:28:09 +04:00
|
|
|
xfGfxSurface* surface;
|
2014-08-19 22:48:09 +04:00
|
|
|
REGION16 updateRegion;
|
|
|
|
RECTANGLE_16 updateRect;
|
|
|
|
RECTANGLE_16* updateRects;
|
|
|
|
REGION16 clippingRects;
|
|
|
|
RECTANGLE_16 clippingRect;
|
|
|
|
RFX_PROGRESSIVE_TILE* tile;
|
|
|
|
PROGRESSIVE_BLOCK_REGION* region;
|
2014-07-02 07:28:09 +04:00
|
|
|
|
|
|
|
surface = (xfGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
|
|
|
|
|
|
|
|
if (!surface)
|
2015-06-09 16:22:26 +03:00
|
|
|
return ERROR_INTERNAL_ERROR;
|
2014-07-02 07:28:09 +04:00
|
|
|
|
2015-10-13 21:49:30 +03:00
|
|
|
if (!freerdp_client_codecs_prepare(surface->codecs, FREERDP_CODEC_PROGRESSIVE))
|
|
|
|
return ERROR_INTERNAL_ERROR;
|
|
|
|
|
|
|
|
progressive_create_surface_context(surface->codecs->progressive, cmd->surfaceId, surface->width, surface->height);
|
2014-08-27 00:15:22 +04:00
|
|
|
|
2014-07-29 07:41:16 +04:00
|
|
|
DstData = surface->data;
|
|
|
|
|
2015-10-13 21:49:30 +03:00
|
|
|
status = progressive_decompress(surface->codecs->progressive, cmd->data, cmd->length, &DstData,
|
2014-09-17 22:29:56 +04:00
|
|
|
surface->format, surface->scanline, cmd->left, cmd->top, cmd->width, cmd->height, cmd->surfaceId);
|
2014-07-29 07:41:16 +04:00
|
|
|
|
|
|
|
if (status < 0)
|
|
|
|
{
|
2014-09-12 19:13:01 +04:00
|
|
|
WLog_ERR(TAG, "progressive_decompress failure: %d", status);
|
2015-06-09 16:22:26 +03:00
|
|
|
return ERROR_INTERNAL_ERROR;
|
2014-07-29 07:41:16 +04:00
|
|
|
}
|
|
|
|
|
2015-10-13 21:49:30 +03:00
|
|
|
region = &(surface->codecs->progressive->region);
|
2014-07-02 07:28:09 +04:00
|
|
|
|
2014-08-19 22:48:09 +04:00
|
|
|
region16_init(&clippingRects);
|
2014-07-02 07:28:09 +04:00
|
|
|
|
2014-08-19 22:48:09 +04:00
|
|
|
for (i = 0; i < region->numRects; i++)
|
|
|
|
{
|
|
|
|
rect = &(region->rects[i]);
|
2014-07-02 07:28:09 +04:00
|
|
|
|
2014-08-19 22:48:09 +04:00
|
|
|
clippingRect.left = cmd->left + rect->x;
|
|
|
|
clippingRect.top = cmd->top + rect->y;
|
|
|
|
clippingRect.right = clippingRect.left + rect->width;
|
|
|
|
clippingRect.bottom = clippingRect.top + rect->height;
|
2014-07-02 07:28:09 +04:00
|
|
|
|
2014-08-19 22:48:09 +04:00
|
|
|
region16_union_rect(&clippingRects, &clippingRects, &clippingRect);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < region->numTiles; i++)
|
|
|
|
{
|
2014-08-27 00:15:22 +04:00
|
|
|
tile = region->tiles[i];
|
2014-08-19 22:48:09 +04:00
|
|
|
|
|
|
|
updateRect.left = cmd->left + tile->x;
|
|
|
|
updateRect.top = cmd->top + tile->y;
|
|
|
|
updateRect.right = updateRect.left + 64;
|
|
|
|
updateRect.bottom = updateRect.top + 64;
|
|
|
|
|
|
|
|
region16_init(&updateRegion);
|
|
|
|
region16_intersect_rect(&updateRegion, &clippingRects, &updateRect);
|
|
|
|
updateRects = (RECTANGLE_16*) region16_rects(&updateRegion, &nbUpdateRects);
|
|
|
|
|
|
|
|
for (j = 0; j < nbUpdateRects; j++)
|
|
|
|
{
|
|
|
|
nXDst = updateRects[j].left;
|
|
|
|
nYDst = updateRects[j].top;
|
|
|
|
nWidth = updateRects[j].right - updateRects[j].left;
|
|
|
|
nHeight = updateRects[j].bottom - updateRects[j].top;
|
|
|
|
|
2014-08-26 03:50:42 +04:00
|
|
|
nXSrc = nXDst - (cmd->left + tile->x);
|
|
|
|
nYSrc = nYDst - (cmd->top + tile->y);
|
|
|
|
|
|
|
|
freerdp_image_copy(surface->data, PIXEL_FORMAT_XRGB32,
|
|
|
|
surface->scanline, nXDst, nYDst, nWidth, nHeight,
|
2014-09-18 02:30:09 +04:00
|
|
|
tile->data, PIXEL_FORMAT_XRGB32, 64 * 4, nXSrc, nYSrc, NULL);
|
2014-08-19 22:48:09 +04:00
|
|
|
|
2015-02-07 01:46:15 +03:00
|
|
|
region16_union_rect(&surface->invalidRegion, &surface->invalidRegion, &updateRects[j]);
|
2014-08-19 22:48:09 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
region16_uninit(&updateRegion);
|
|
|
|
}
|
2014-07-02 07:28:09 +04:00
|
|
|
|
2014-12-28 02:53:27 +03:00
|
|
|
region16_uninit(&clippingRects);
|
|
|
|
|
2014-07-02 07:28:09 +04:00
|
|
|
if (!xfc->inGfxFrame)
|
2015-02-07 01:46:15 +03:00
|
|
|
xf_UpdateSurfaces(xfc);
|
2014-07-02 07:28:09 +04:00
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-07-02 07:28:09 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_SurfaceCommand(RdpgfxClientContext* context, RDPGFX_SURFACE_COMMAND* cmd)
|
2014-06-05 02:03:25 +04:00
|
|
|
{
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT status = CHANNEL_RC_OK;
|
2014-06-05 02:03:25 +04:00
|
|
|
xfContext* xfc = (xfContext*) context->custom;
|
|
|
|
|
|
|
|
switch (cmd->codecId)
|
|
|
|
{
|
|
|
|
case RDPGFX_CODECID_UNCOMPRESSED:
|
|
|
|
status = xf_SurfaceCommand_Uncompressed(xfc, context, cmd);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RDPGFX_CODECID_CAVIDEO:
|
|
|
|
status = xf_SurfaceCommand_RemoteFX(xfc, context, cmd);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RDPGFX_CODECID_CLEARCODEC:
|
2014-06-05 06:49:03 +04:00
|
|
|
status = xf_SurfaceCommand_ClearCodec(xfc, context, cmd);
|
2014-06-05 02:03:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RDPGFX_CODECID_PLANAR:
|
2014-06-05 06:49:03 +04:00
|
|
|
status = xf_SurfaceCommand_Planar(xfc, context, cmd);
|
2014-06-05 02:03:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RDPGFX_CODECID_H264:
|
2014-07-02 07:28:09 +04:00
|
|
|
status = xf_SurfaceCommand_H264(xfc, context, cmd);
|
2014-06-05 02:03:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RDPGFX_CODECID_ALPHA:
|
2014-07-02 07:28:09 +04:00
|
|
|
status = xf_SurfaceCommand_Alpha(xfc, context, cmd);
|
2014-06-05 02:03:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RDPGFX_CODECID_CAPROGRESSIVE:
|
2014-07-02 07:28:09 +04:00
|
|
|
status = xf_SurfaceCommand_Progressive(xfc, context, cmd);
|
2014-06-05 02:03:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RDPGFX_CODECID_CAPROGRESSIVE_V2:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
return status;
|
2014-06-05 02:03:25 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_DeleteEncodingContext(RdpgfxClientContext* context, RDPGFX_DELETE_ENCODING_CONTEXT_PDU* deleteEncodingContext)
|
2014-06-05 02:03:25 +04:00
|
|
|
{
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-05 02:03:25 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_CreateSurface(RdpgfxClientContext* context, RDPGFX_CREATE_SURFACE_PDU* createSurface)
|
2014-06-05 02:03:25 +04:00
|
|
|
{
|
2014-09-17 22:29:56 +04:00
|
|
|
size_t size;
|
|
|
|
UINT32 bytesPerPixel;
|
2014-06-12 01:48:04 +04:00
|
|
|
xfGfxSurface* surface;
|
|
|
|
xfContext* xfc = (xfContext*) context->custom;
|
|
|
|
|
|
|
|
surface = (xfGfxSurface*) calloc(1, sizeof(xfGfxSurface));
|
|
|
|
|
|
|
|
if (!surface)
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_NO_MEMORY;
|
2014-06-12 01:48:04 +04:00
|
|
|
|
2015-10-13 21:49:30 +03:00
|
|
|
surface->codecs = codecs_new((rdpContext*) xfc);
|
|
|
|
|
|
|
|
if (!surface->codecs)
|
|
|
|
return CHANNEL_RC_NO_MEMORY;
|
|
|
|
|
2014-06-12 01:48:04 +04:00
|
|
|
surface->surfaceId = createSurface->surfaceId;
|
|
|
|
surface->width = (UINT32) createSurface->width;
|
|
|
|
surface->height = (UINT32) createSurface->height;
|
|
|
|
surface->alpha = (createSurface->pixelFormat == PIXEL_FORMAT_ARGB_8888) ? TRUE : FALSE;
|
2014-09-17 22:29:56 +04:00
|
|
|
surface->format = PIXEL_FORMAT_XRGB32;
|
2014-06-12 01:48:04 +04:00
|
|
|
|
2014-09-17 22:29:56 +04:00
|
|
|
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);
|
2014-06-12 01:48:04 +04:00
|
|
|
|
|
|
|
if (!surface->data)
|
2014-11-17 02:36:01 +03:00
|
|
|
{
|
2015-10-13 21:49:30 +03:00
|
|
|
free(surface);
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_NO_MEMORY;
|
2014-11-17 02:36:01 +03:00
|
|
|
}
|
2014-06-12 01:48:04 +04:00
|
|
|
|
2014-09-17 22:29:56 +04:00
|
|
|
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)
|
2014-11-17 02:36:01 +03:00
|
|
|
{
|
2015-10-13 21:49:30 +03:00
|
|
|
free(surface->data);
|
|
|
|
free(surface);
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_NO_MEMORY;
|
2014-11-17 02:36:01 +03:00
|
|
|
}
|
2014-09-17 22:29:56 +04:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2014-06-12 01:48:04 +04:00
|
|
|
|
2015-02-11 00:32:07 +03:00
|
|
|
surface->outputMapped = FALSE;
|
2015-02-07 01:46:15 +03:00
|
|
|
|
|
|
|
region16_init(&surface->invalidRegion);
|
|
|
|
|
2014-06-12 01:48:04 +04:00
|
|
|
context->SetSurfaceData(context, surface->surfaceId, (void*) surface);
|
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-05 02:03:25 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_DeleteSurface(RdpgfxClientContext* context, RDPGFX_DELETE_SURFACE_PDU* deleteSurface)
|
2014-06-05 02:03:25 +04:00
|
|
|
{
|
2015-10-13 21:49:30 +03:00
|
|
|
rdpCodecs* codecs = NULL;
|
2014-06-12 01:48:04 +04:00
|
|
|
xfGfxSurface* surface = NULL;
|
|
|
|
|
|
|
|
surface = (xfGfxSurface*) context->GetSurfaceData(context, deleteSurface->surfaceId);
|
|
|
|
|
|
|
|
if (surface)
|
|
|
|
{
|
|
|
|
XFree(surface->image);
|
2014-09-17 22:29:56 +04:00
|
|
|
_aligned_free(surface->data);
|
|
|
|
_aligned_free(surface->stage);
|
2015-02-07 01:46:15 +03:00
|
|
|
region16_uninit(&surface->invalidRegion);
|
2015-10-13 21:49:30 +03:00
|
|
|
codecs = surface->codecs;
|
2014-06-12 01:48:04 +04:00
|
|
|
free(surface);
|
|
|
|
}
|
|
|
|
|
|
|
|
context->SetSurfaceData(context, deleteSurface->surfaceId, NULL);
|
|
|
|
|
2015-10-13 21:49:30 +03:00
|
|
|
if (codecs && codecs->progressive)
|
|
|
|
progressive_delete_surface_context(codecs->progressive, deleteSurface->surfaceId);
|
|
|
|
|
|
|
|
codecs_free(codecs);
|
2014-08-27 00:15:22 +04:00
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-05 02:03:25 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_SolidFill(RdpgfxClientContext* context, RDPGFX_SOLID_FILL_PDU* solidFill)
|
2014-06-05 02:03:25 +04:00
|
|
|
{
|
2014-06-05 06:49:03 +04:00
|
|
|
UINT16 index;
|
|
|
|
UINT32 color;
|
|
|
|
BYTE a, r, g, b;
|
2014-06-13 16:36:09 +04:00
|
|
|
int nWidth, nHeight;
|
2014-06-05 06:49:03 +04:00
|
|
|
RDPGFX_RECT16* rect;
|
2014-06-13 16:36:09 +04:00
|
|
|
xfGfxSurface* surface;
|
2014-06-05 06:49:03 +04:00
|
|
|
RECTANGLE_16 invalidRect;
|
|
|
|
xfContext* xfc = (xfContext*) context->custom;
|
|
|
|
|
2014-06-13 16:36:09 +04:00
|
|
|
surface = (xfGfxSurface*) context->GetSurfaceData(context, solidFill->surfaceId);
|
|
|
|
|
|
|
|
if (!surface)
|
2015-06-09 16:22:26 +03:00
|
|
|
return ERROR_INTERNAL_ERROR;
|
2014-06-13 16:36:09 +04:00
|
|
|
|
2014-06-05 06:49:03 +04:00
|
|
|
b = solidFill->fillPixel.B;
|
|
|
|
g = solidFill->fillPixel.G;
|
|
|
|
r = solidFill->fillPixel.R;
|
|
|
|
a = solidFill->fillPixel.XA;
|
|
|
|
|
|
|
|
color = ARGB32(a, r, g, b);
|
|
|
|
|
|
|
|
for (index = 0; index < solidFill->fillRectCount; index++)
|
|
|
|
{
|
|
|
|
rect = &(solidFill->fillRects[index]);
|
|
|
|
|
2014-06-13 16:36:09 +04:00
|
|
|
nWidth = rect->right - rect->left;
|
|
|
|
nHeight = rect->bottom - rect->top;
|
2014-06-05 06:49:03 +04:00
|
|
|
|
|
|
|
invalidRect.left = rect->left;
|
|
|
|
invalidRect.top = rect->top;
|
|
|
|
invalidRect.right = rect->right;
|
|
|
|
invalidRect.bottom = rect->bottom;
|
|
|
|
|
2014-09-17 22:29:56 +04:00
|
|
|
freerdp_image_fill(surface->data, surface->format, surface->scanline,
|
2014-06-13 16:36:09 +04:00
|
|
|
rect->left, rect->top, nWidth, nHeight, color);
|
|
|
|
|
2015-02-07 01:46:15 +03:00
|
|
|
region16_union_rect(&surface->invalidRegion, &surface->invalidRegion, &invalidRect);
|
2014-06-05 06:49:03 +04:00
|
|
|
}
|
|
|
|
|
2014-06-05 20:36:01 +04:00
|
|
|
if (!xfc->inGfxFrame)
|
2015-02-07 01:46:15 +03:00
|
|
|
xf_UpdateSurfaces(xfc);
|
2014-06-05 20:36:01 +04:00
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-05 02:03:25 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_SurfaceToSurface(RdpgfxClientContext* context, RDPGFX_SURFACE_TO_SURFACE_PDU* surfaceToSurface)
|
2014-06-05 02:03:25 +04:00
|
|
|
{
|
2014-06-13 00:13:12 +04:00
|
|
|
UINT16 index;
|
2014-09-17 01:41:24 +04:00
|
|
|
BOOL sameSurface;
|
2014-06-13 00:13:12 +04:00
|
|
|
int nWidth, nHeight;
|
|
|
|
RDPGFX_RECT16* rectSrc;
|
|
|
|
RDPGFX_POINT16* destPt;
|
|
|
|
RECTANGLE_16 invalidRect;
|
|
|
|
xfGfxSurface* surfaceSrc;
|
|
|
|
xfGfxSurface* surfaceDst;
|
|
|
|
xfContext* xfc = (xfContext*) context->custom;
|
|
|
|
|
|
|
|
rectSrc = &(surfaceToSurface->rectSrc);
|
|
|
|
destPt = &surfaceToSurface->destPts[0];
|
|
|
|
|
|
|
|
surfaceSrc = (xfGfxSurface*) context->GetSurfaceData(context, surfaceToSurface->surfaceIdSrc);
|
|
|
|
|
2014-09-17 01:41:24 +04:00
|
|
|
sameSurface = (surfaceToSurface->surfaceIdSrc == surfaceToSurface->surfaceIdDest) ? TRUE : FALSE;
|
|
|
|
|
|
|
|
if (!sameSurface)
|
2014-06-13 00:13:12 +04:00
|
|
|
surfaceDst = (xfGfxSurface*) context->GetSurfaceData(context, surfaceToSurface->surfaceIdDest);
|
|
|
|
else
|
|
|
|
surfaceDst = surfaceSrc;
|
|
|
|
|
|
|
|
if (!surfaceSrc || !surfaceDst)
|
2015-06-09 16:22:26 +03:00
|
|
|
return ERROR_INTERNAL_ERROR;
|
2014-06-13 00:13:12 +04:00
|
|
|
|
2014-06-26 02:00:48 +04:00
|
|
|
nWidth = rectSrc->right - rectSrc->left;
|
|
|
|
nHeight = rectSrc->bottom - rectSrc->top;
|
2014-06-13 00:13:12 +04:00
|
|
|
|
|
|
|
for (index = 0; index < surfaceToSurface->destPtsCount; index++)
|
|
|
|
{
|
|
|
|
destPt = &surfaceToSurface->destPts[index];
|
|
|
|
|
2014-09-17 01:41:24 +04:00
|
|
|
if (sameSurface)
|
|
|
|
{
|
2014-09-17 22:29:56 +04:00
|
|
|
freerdp_image_move(surfaceDst->data, surfaceDst->format, surfaceDst->scanline,
|
2014-09-17 01:41:24 +04:00
|
|
|
destPt->x, destPt->y, nWidth, nHeight, rectSrc->left, rectSrc->top);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-17 22:29:56 +04:00
|
|
|
freerdp_image_copy(surfaceDst->data, surfaceDst->format, surfaceDst->scanline,
|
|
|
|
destPt->x, destPt->y, nWidth, nHeight, surfaceSrc->data, surfaceSrc->format,
|
2014-09-18 02:30:09 +04:00
|
|
|
surfaceSrc->scanline, rectSrc->left, rectSrc->top, NULL);
|
2014-09-17 01:41:24 +04:00
|
|
|
}
|
2014-06-13 00:13:12 +04:00
|
|
|
|
|
|
|
invalidRect.left = destPt->x;
|
|
|
|
invalidRect.top = destPt->y;
|
2014-06-13 05:02:25 +04:00
|
|
|
invalidRect.right = destPt->x + rectSrc->right;
|
|
|
|
invalidRect.bottom = destPt->y + rectSrc->bottom;
|
2014-06-13 00:13:12 +04:00
|
|
|
|
2015-02-07 01:46:15 +03:00
|
|
|
region16_union_rect(&surfaceDst->invalidRegion, &surfaceDst->invalidRegion, &invalidRect);
|
2014-06-13 00:13:12 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!xfc->inGfxFrame)
|
2015-02-07 01:46:15 +03:00
|
|
|
xf_UpdateSurfaces(xfc);
|
2014-06-13 00:13:12 +04:00
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-05 02:03:25 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_SurfaceToCache(RdpgfxClientContext* context, RDPGFX_SURFACE_TO_CACHE_PDU* surfaceToCache)
|
2014-06-05 02:03:25 +04:00
|
|
|
{
|
2014-09-17 22:29:56 +04:00
|
|
|
size_t size;
|
2014-06-13 16:36:09 +04:00
|
|
|
RDPGFX_RECT16* rect;
|
|
|
|
xfGfxSurface* surface;
|
|
|
|
xfGfxCacheEntry* cacheEntry;
|
2014-09-17 03:12:26 +04:00
|
|
|
xfContext* xfc = (xfContext*) context->custom;
|
2014-06-13 16:36:09 +04:00
|
|
|
|
|
|
|
rect = &(surfaceToCache->rectSrc);
|
|
|
|
|
|
|
|
surface = (xfGfxSurface*) context->GetSurfaceData(context, surfaceToCache->surfaceId);
|
|
|
|
|
|
|
|
if (!surface)
|
2015-06-09 16:22:26 +03:00
|
|
|
return ERROR_INTERNAL_ERROR;
|
2014-06-13 16:36:09 +04:00
|
|
|
|
|
|
|
cacheEntry = (xfGfxCacheEntry*) calloc(1, sizeof(xfGfxCacheEntry));
|
|
|
|
|
|
|
|
if (!cacheEntry)
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_NO_MEMORY;
|
2014-06-13 16:36:09 +04:00
|
|
|
|
|
|
|
cacheEntry->width = (UINT32) (rect->right - rect->left);
|
|
|
|
cacheEntry->height = (UINT32) (rect->bottom - rect->top);
|
|
|
|
cacheEntry->alpha = surface->alpha;
|
2014-09-17 22:29:56 +04:00
|
|
|
cacheEntry->format = surface->format;
|
2014-06-13 16:36:09 +04:00
|
|
|
|
2014-09-17 22:29:56 +04:00
|
|
|
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);
|
2014-06-13 16:36:09 +04:00
|
|
|
|
|
|
|
if (!cacheEntry->data)
|
2014-11-17 02:36:01 +03:00
|
|
|
{
|
2015-10-13 21:49:30 +03:00
|
|
|
free(cacheEntry);
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_NO_MEMORY;
|
2014-11-17 02:36:01 +03:00
|
|
|
}
|
2014-06-13 16:36:09 +04:00
|
|
|
|
2014-09-17 22:29:56 +04:00
|
|
|
ZeroMemory(cacheEntry->data, size);
|
|
|
|
|
|
|
|
freerdp_image_copy(cacheEntry->data, cacheEntry->format, cacheEntry->scanline,
|
2014-06-13 16:36:09 +04:00
|
|
|
0, 0, cacheEntry->width, cacheEntry->height, surface->data,
|
2014-09-18 02:30:09 +04:00
|
|
|
surface->format, surface->scanline, rect->left, rect->top, NULL);
|
2014-06-13 16:36:09 +04:00
|
|
|
|
|
|
|
context->SetCacheSlotData(context, surfaceToCache->cacheSlot, (void*) cacheEntry);
|
2014-06-13 00:13:12 +04:00
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-05 02:03:25 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_CacheToSurface(RdpgfxClientContext* context, RDPGFX_CACHE_TO_SURFACE_PDU* cacheToSurface)
|
2014-06-05 02:03:25 +04:00
|
|
|
{
|
2014-06-13 16:36:09 +04:00
|
|
|
UINT16 index;
|
|
|
|
RDPGFX_POINT16* destPt;
|
|
|
|
xfGfxSurface* surface;
|
|
|
|
xfGfxCacheEntry* cacheEntry;
|
|
|
|
RECTANGLE_16 invalidRect;
|
|
|
|
xfContext* xfc = (xfContext*) context->custom;
|
|
|
|
|
|
|
|
surface = (xfGfxSurface*) context->GetSurfaceData(context, cacheToSurface->surfaceId);
|
|
|
|
cacheEntry = (xfGfxCacheEntry*) context->GetCacheSlotData(context, cacheToSurface->cacheSlot);
|
|
|
|
|
|
|
|
if (!surface || !cacheEntry)
|
2015-06-09 16:22:26 +03:00
|
|
|
return ERROR_INTERNAL_ERROR;
|
2014-06-13 16:36:09 +04:00
|
|
|
|
|
|
|
for (index = 0; index < cacheToSurface->destPtsCount; index++)
|
|
|
|
{
|
|
|
|
destPt = &cacheToSurface->destPts[index];
|
|
|
|
|
2014-09-17 22:29:56 +04:00
|
|
|
freerdp_image_copy(surface->data, surface->format, surface->scanline,
|
2014-06-13 16:36:09 +04:00
|
|
|
destPt->x, destPt->y, cacheEntry->width, cacheEntry->height,
|
2014-09-18 02:30:09 +04:00
|
|
|
cacheEntry->data, cacheEntry->format, cacheEntry->scanline, 0, 0, NULL);
|
2014-06-13 16:36:09 +04:00
|
|
|
|
|
|
|
invalidRect.left = destPt->x;
|
|
|
|
invalidRect.top = destPt->y;
|
|
|
|
invalidRect.right = destPt->x + cacheEntry->width - 1;
|
|
|
|
invalidRect.bottom = destPt->y + cacheEntry->height - 1;
|
|
|
|
|
2015-02-07 01:46:15 +03:00
|
|
|
region16_union_rect(&surface->invalidRegion, &surface->invalidRegion, &invalidRect);
|
2014-06-13 16:36:09 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!xfc->inGfxFrame)
|
2015-02-07 01:46:15 +03:00
|
|
|
xf_UpdateSurfaces(xfc);
|
2014-06-13 00:13:12 +04:00
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-05 02:03:25 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_CacheImportReply(RdpgfxClientContext* context, RDPGFX_CACHE_IMPORT_REPLY_PDU* cacheImportReply)
|
2014-06-05 02:03:25 +04:00
|
|
|
{
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-05 02:03:25 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_EvictCacheEntry(RdpgfxClientContext* context, RDPGFX_EVICT_CACHE_ENTRY_PDU* evictCacheEntry)
|
2014-06-05 02:03:25 +04:00
|
|
|
{
|
2014-06-20 01:08:50 +04:00
|
|
|
xfGfxCacheEntry* cacheEntry;
|
|
|
|
|
|
|
|
cacheEntry = (xfGfxCacheEntry*) context->GetCacheSlotData(context, evictCacheEntry->cacheSlot);
|
|
|
|
|
|
|
|
if (cacheEntry)
|
|
|
|
{
|
2014-09-17 22:29:56 +04:00
|
|
|
_aligned_free(cacheEntry->data);
|
2014-06-20 01:08:50 +04:00
|
|
|
free(cacheEntry);
|
|
|
|
}
|
|
|
|
|
|
|
|
context->SetCacheSlotData(context, evictCacheEntry->cacheSlot, NULL);
|
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-05 02:03:25 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_MapSurfaceToOutput(RdpgfxClientContext* context, RDPGFX_MAP_SURFACE_TO_OUTPUT_PDU* surfaceToOutput)
|
2014-06-05 02:03:25 +04:00
|
|
|
{
|
2015-02-07 01:46:15 +03:00
|
|
|
xfGfxSurface* surface;
|
2014-06-13 00:13:12 +04:00
|
|
|
|
2015-02-07 01:46:15 +03:00
|
|
|
surface = (xfGfxSurface*) context->GetSurfaceData(context, surfaceToOutput->surfaceId);
|
|
|
|
|
2015-10-13 22:50:39 +03:00
|
|
|
if (!surface)
|
|
|
|
return ERROR_INTERNAL_ERROR;
|
|
|
|
|
2015-02-11 00:32:07 +03:00
|
|
|
surface->outputMapped = TRUE;
|
|
|
|
surface->outputOriginX = surfaceToOutput->outputOriginX;
|
|
|
|
surface->outputOriginY = surfaceToOutput->outputOriginY;
|
2015-02-07 01:46:15 +03:00
|
|
|
|
|
|
|
region16_clear(&surface->invalidRegion);
|
|
|
|
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-05 02:03:25 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT xf_MapSurfaceToWindow(RdpgfxClientContext* context, RDPGFX_MAP_SURFACE_TO_WINDOW_PDU* surfaceToWindow)
|
2014-06-05 02:03:25 +04:00
|
|
|
{
|
2015-06-09 16:22:26 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-05 02:03:25 +04:00
|
|
|
}
|
|
|
|
|
2014-06-20 21:52:13 +04:00
|
|
|
void xf_graphics_pipeline_init(xfContext* xfc, RdpgfxClientContext* gfx)
|
2014-06-05 02:03:25 +04:00
|
|
|
{
|
|
|
|
xfc->gfx = gfx;
|
|
|
|
gfx->custom = (void*) xfc;
|
|
|
|
|
|
|
|
gfx->ResetGraphics = xf_ResetGraphics;
|
|
|
|
gfx->StartFrame = xf_StartFrame;
|
|
|
|
gfx->EndFrame = xf_EndFrame;
|
|
|
|
gfx->SurfaceCommand = xf_SurfaceCommand;
|
|
|
|
gfx->DeleteEncodingContext = xf_DeleteEncodingContext;
|
|
|
|
gfx->CreateSurface = xf_CreateSurface;
|
|
|
|
gfx->DeleteSurface = xf_DeleteSurface;
|
|
|
|
gfx->SolidFill = xf_SolidFill;
|
|
|
|
gfx->SurfaceToSurface = xf_SurfaceToSurface;
|
|
|
|
gfx->SurfaceToCache = xf_SurfaceToCache;
|
|
|
|
gfx->CacheToSurface = xf_CacheToSurface;
|
|
|
|
gfx->CacheImportReply = xf_CacheImportReply;
|
|
|
|
gfx->EvictCacheEntry = xf_EvictCacheEntry;
|
|
|
|
gfx->MapSurfaceToOutput = xf_MapSurfaceToOutput;
|
|
|
|
gfx->MapSurfaceToWindow = xf_MapSurfaceToWindow;
|
|
|
|
}
|
2014-06-20 21:52:13 +04:00
|
|
|
|
|
|
|
void xf_graphics_pipeline_uninit(xfContext* xfc, RdpgfxClientContext* gfx)
|
|
|
|
{
|
2015-02-11 00:32:07 +03:00
|
|
|
|
2014-06-20 21:52:13 +04:00
|
|
|
}
|