Blame server/proxy/pf_graphics.c

Packit Service 5a9772
/**
Packit Service 5a9772
 * FreeRDP: A Remote Desktop Protocol Implementation
Packit Service 5a9772
 * FreeRDP Proxy Server
Packit Service 5a9772
 *
Packit Service 5a9772
 * Copyright 2019 Mati Shabtay <matishabtay@gmail.com>
Packit Service 5a9772
 * Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.com>
Packit Service 5a9772
 * Copyright 2019 Idan Freiberg <speidy@gmail.com>
Packit Service 5a9772
 *
Packit Service 5a9772
 * Licensed under the Apache License, Version 2.0 (the "License");
Packit Service 5a9772
 * you may not use this file except in compliance with the License.
Packit Service 5a9772
 * You may obtain a copy of the License at
Packit Service 5a9772
 *
Packit Service 5a9772
 *     http://www.apache.org/licenses/LICENSE-2.0
Packit Service 5a9772
 *
Packit Service 5a9772
 * Unless required by applicable law or agreed to in writing, software
Packit Service 5a9772
 * distributed under the License is distributed on an "AS IS" BASIS,
Packit Service 5a9772
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit Service 5a9772
 * See the License for the specific language governing permissions and
Packit Service 5a9772
 * limitations under the License.
Packit Service 5a9772
 */
Packit Service 5a9772
Packit Service 5a9772
#ifdef HAVE_CONFIG_H
Packit Service 5a9772
#include "config.h"
Packit Service 5a9772
#endif
Packit Service 5a9772
Packit Service 5a9772
#include <winpr/crt.h>
Packit Service 5a9772
Packit Service 5a9772
#include <freerdp/codec/bitmap.h>
Packit Service 5a9772
Packit Service 5a9772
#include "pf_graphics.h"
Packit Service 5a9772
#include "pf_log.h"
Packit Service 5a9772
#include "pf_gdi.h"
Packit Service 5a9772
#include "pf_context.h"
Packit Service 5a9772
Packit Service 5a9772
#include <freerdp/gdi/dc.h>
Packit Service 5a9772
#include <freerdp/gdi/shape.h>
Packit Service 5a9772
#include <freerdp/gdi/region.h>
Packit Service 5a9772
#include <freerdp/gdi/bitmap.h>
Packit Service 5a9772
#include <freerdp/gdi/bitmap.h>
Packit Service 5a9772
#include <freerdp/graphics.h>
Packit Service 5a9772
#include <freerdp/log.h>
Packit Service 5a9772
#define TAG PROXY_TAG("graphics")
Packit Service 5a9772
Packit Service 5a9772
/* Bitmap Class */
Packit Service 5a9772
static BOOL pf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
Packit Service 5a9772
{
Packit Service 5a9772
	return TRUE;
Packit Service 5a9772
}
Packit Service 5a9772
Packit Service 5a9772
static void pf_Bitmap_Free(rdpContext* context, rdpBitmap* bitmap)
Packit Service 5a9772
{
Packit Service 5a9772
}
Packit Service 5a9772
Packit Service 5a9772
static BOOL pf_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap)
Packit Service 5a9772
{
Packit Service 5a9772
	return TRUE;
Packit Service 5a9772
}
Packit Service 5a9772
Packit Service 5a9772
static BOOL pf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary)
Packit Service 5a9772
{
Packit Service 5a9772
	return TRUE;
Packit Service 5a9772
}
Packit Service 5a9772
Packit Service 5a9772
/* Pointer Class */
Packit Service 5a9772
static BOOL pf_Pointer_New(rdpContext* context, rdpPointer* pointer)
Packit Service 5a9772
{
Packit Service 5a9772
	return TRUE;
Packit Service 5a9772
}
Packit Service 5a9772
Packit Service 5a9772
static void pf_Pointer_Free(rdpContext* context, rdpPointer* pointer)
Packit Service 5a9772
{
Packit Service 5a9772
}
Packit Service 5a9772
Packit Service 5a9772
static BOOL pf_Pointer_Set(rdpContext* context, const rdpPointer* pointer)
Packit Service 5a9772
{
Packit Service 5a9772
	return TRUE;
Packit Service 5a9772
}
Packit Service 5a9772
Packit Service 5a9772
static BOOL pf_Pointer_SetNull(rdpContext* context)
Packit Service 5a9772
{
Packit Service 5a9772
	return TRUE;
Packit Service 5a9772
}
Packit Service 5a9772
Packit Service 5a9772
static BOOL pf_Pointer_SetDefault(rdpContext* context)
Packit Service 5a9772
{
Packit Service 5a9772
	return TRUE;
Packit Service 5a9772
}
Packit Service 5a9772
Packit Service 5a9772
static BOOL pf_Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y)
Packit Service 5a9772
{
Packit Service 5a9772
	return TRUE;
Packit Service 5a9772
}
Packit Service 5a9772
Packit Service 5a9772
/* Glyph Class */
Packit Service 5a9772
static BOOL pf_Glyph_New(rdpContext* context, const rdpGlyph* glyph)
Packit Service 5a9772
{
Packit Service 5a9772
	return TRUE;
Packit Service 5a9772
}
Packit Service 5a9772
Packit Service 5a9772
static void pf_Glyph_Free(rdpContext* context, rdpGlyph* glyph)
Packit Service 5a9772
{
Packit Service 5a9772
}
Packit Service 5a9772
Packit Service 5a9772
static BOOL pf_Glyph_Draw(rdpContext* context, const rdpGlyph* glyph, INT32 x, INT32 y, INT32 w,
Packit Service 5a9772
                          INT32 h, INT32 sx, INT32 sy, BOOL fOpRedundant)
Packit Service 5a9772
{
Packit Service 5a9772
	return TRUE;
Packit Service 5a9772
}
Packit Service 5a9772
Packit Service 5a9772
static BOOL pf_Glyph_BeginDraw(rdpContext* context, INT32 x, INT32 y, INT32 width, INT32 height,
Packit Service 5a9772
                               UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant)
Packit Service 5a9772
{
Packit Service 5a9772
	return TRUE;
Packit Service 5a9772
}
Packit Service 5a9772
Packit Service 5a9772
static BOOL pf_Glyph_EndDraw(rdpContext* context, INT32 x, INT32 y, INT32 width, INT32 height,
Packit Service 5a9772
                             UINT32 bgcolor, UINT32 fgcolor)
Packit Service 5a9772
{
Packit Service 5a9772
	return TRUE;
Packit Service 5a9772
}
Packit Service 5a9772
Packit Service 5a9772
/* Graphics Module */
Packit Service 5a9772
BOOL pf_register_pointer(rdpGraphics* graphics)
Packit Service 5a9772
{
Packit Service 5a9772
	rdpPointer* pointer = NULL;
Packit Service 5a9772
Packit Service 5a9772
	if (!(pointer = (rdpPointer*)calloc(1, sizeof(rdpPointer))))
Packit Service 5a9772
		return FALSE;
Packit Service 5a9772
Packit Service 5a9772
	pointer->size = sizeof(rdpPointer);
Packit Service 5a9772
	pointer->New = pf_Pointer_New;
Packit Service 5a9772
	pointer->Free = pf_Pointer_Free;
Packit Service 5a9772
	pointer->Set = pf_Pointer_Set;
Packit Service 5a9772
	pointer->SetNull = pf_Pointer_SetNull;
Packit Service 5a9772
	pointer->SetDefault = pf_Pointer_SetDefault;
Packit Service 5a9772
	pointer->SetPosition = pf_Pointer_SetPosition;
Packit Service 5a9772
	graphics_register_pointer(graphics, pointer);
Packit Service 5a9772
	free(pointer);
Packit Service 5a9772
	return TRUE;
Packit Service 5a9772
}
Packit Service 5a9772
Packit Service 5a9772
BOOL pf_register_graphics(rdpGraphics* graphics)
Packit Service 5a9772
{
Packit Service 5a9772
	rdpBitmap bitmap;
Packit Service 5a9772
	rdpGlyph glyph;
Packit Service 5a9772
Packit Service 5a9772
	if (!graphics || !graphics->Bitmap_Prototype || !graphics->Glyph_Prototype)
Packit Service 5a9772
		return FALSE;
Packit Service 5a9772
Packit Service 5a9772
	bitmap = *graphics->Bitmap_Prototype;
Packit Service 5a9772
	glyph = *graphics->Glyph_Prototype;
Packit Service 5a9772
	bitmap.size = sizeof(rdpBitmap);
Packit Service 5a9772
	bitmap.New = pf_Bitmap_New;
Packit Service 5a9772
	bitmap.Free = pf_Bitmap_Free;
Packit Service 5a9772
	bitmap.Paint = pf_Bitmap_Paint;
Packit Service 5a9772
	bitmap.SetSurface = pf_Bitmap_SetSurface;
Packit Service 5a9772
	graphics_register_bitmap(graphics, &bitmap);
Packit Service 5a9772
	glyph.size = sizeof(rdpGlyph);
Packit Service 5a9772
	glyph.New = pf_Glyph_New;
Packit Service 5a9772
	glyph.Free = pf_Glyph_Free;
Packit Service 5a9772
	glyph.Draw = pf_Glyph_Draw;
Packit Service 5a9772
	glyph.BeginDraw = pf_Glyph_BeginDraw;
Packit Service 5a9772
	glyph.EndDraw = pf_Glyph_EndDraw;
Packit Service 5a9772
	graphics_register_glyph(graphics, &glyph);
Packit Service 5a9772
	return TRUE;
Packit Service 5a9772
}