libfreerdp-gdi: add bitmap updates, make use of it through freerdp-test
This commit is contained in:
parent
70ebd47cc4
commit
6a13313c50
@ -17,6 +17,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
include_directories(../../libfreerdp-gdi)
|
||||||
include_directories(../../libfreerdp-core)
|
include_directories(../../libfreerdp-core)
|
||||||
|
|
||||||
add_executable(freerdp-test
|
add_executable(freerdp-test
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "gdi.h"
|
||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
|
|
||||||
#include <freerdp/freerdp.h>
|
#include <freerdp/freerdp.h>
|
||||||
@ -190,23 +191,11 @@ boolean freerdp_process_params(int argc, char* argv[], rdpSettings* settings, in
|
|||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bitmap_update(rdpUpdate* update, BITMAP_UPDATE* bitmap)
|
|
||||||
{
|
|
||||||
printf("received bitmap update from core\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void register_update_callbacks(rdpUpdate* update)
|
|
||||||
{
|
|
||||||
update->Bitmap = bitmap_update;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int index = 1;
|
int index = 1;
|
||||||
|
|
||||||
instance = freerdp_new();
|
instance = freerdp_new();
|
||||||
register_update_callbacks(instance->update);
|
|
||||||
|
|
||||||
settings = instance->settings;
|
settings = instance->settings;
|
||||||
rdp = (rdpRdp*) instance->rdp;
|
rdp = (rdpRdp*) instance->rdp;
|
||||||
@ -217,8 +206,7 @@ int main(int argc, char* argv[])
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("hostname:%s username:%s password:%s\n",
|
gdi_init(instance, 0);
|
||||||
settings->hostname, settings->username, settings->password);
|
|
||||||
|
|
||||||
rdp_client_connect(rdp);
|
rdp_client_connect(rdp);
|
||||||
|
|
||||||
|
@ -407,6 +407,8 @@ typedef int (*pcGlyphIndex)(rdpUpdate* update, GLYPH_INDEX_ORDER* glyph_index);
|
|||||||
struct rdp_update
|
struct rdp_update
|
||||||
{
|
{
|
||||||
void* rdp;
|
void* rdp;
|
||||||
|
void* param1;
|
||||||
|
void* param2;
|
||||||
|
|
||||||
pcSynchronize Synchronize;
|
pcSynchronize Synchronize;
|
||||||
pcBitmap Bitmap;
|
pcBitmap Bitmap;
|
||||||
|
@ -1065,6 +1065,24 @@ gdi_ui_decode(struct rdp_inst * inst, uint8 * data, int size)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int gdi_bitmap_update(rdpUpdate* update, BITMAP_UPDATE* bitmap)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
BITMAP_DATA* bmp;
|
||||||
|
GDI_IMAGE* gdi_bmp;
|
||||||
|
GDI* gdi = GET_GDI(update);
|
||||||
|
|
||||||
|
for (i = 0; i < bitmap->number; i++)
|
||||||
|
{
|
||||||
|
bmp = &bitmap->bitmaps[i];
|
||||||
|
gdi_bmp = gdi_bitmap_new(gdi, bmp->width, bmp->height, gdi->dstBpp, bmp->data);
|
||||||
|
gdi_BitBlt(gdi->primary->hdc, bmp->left, bmp->top, bmp->width, bmp->height, gdi_bmp->hdc, 0, 0, GDI_SRCCOPY);
|
||||||
|
gdi_bitmap_free((GDI_IMAGE*) gdi_bmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register GDI callbacks with libfreerdp.
|
* Register GDI callbacks with libfreerdp.
|
||||||
* @param inst current instance
|
* @param inst current instance
|
||||||
@ -1073,7 +1091,7 @@ gdi_ui_decode(struct rdp_inst * inst, uint8 * data, int size)
|
|||||||
|
|
||||||
void gdi_register_update_callbacks(rdpUpdate* update)
|
void gdi_register_update_callbacks(rdpUpdate* update)
|
||||||
{
|
{
|
||||||
update->Bitmap = NULL;
|
update->Bitmap = gdi_bitmap_update;
|
||||||
update->Palette = NULL;
|
update->Palette = NULL;
|
||||||
update->DstBlt = NULL;
|
update->DstBlt = NULL;
|
||||||
update->PatBlt = NULL;
|
update->PatBlt = NULL;
|
||||||
@ -1109,7 +1127,7 @@ int gdi_init(freerdp* instance, uint32 flags)
|
|||||||
{
|
{
|
||||||
GDI *gdi = (GDI*) malloc(sizeof(GDI));
|
GDI *gdi = (GDI*) malloc(sizeof(GDI));
|
||||||
memset(gdi, 0, sizeof(GDI));
|
memset(gdi, 0, sizeof(GDI));
|
||||||
SET_GDI(instance, gdi);
|
SET_GDI(instance->update, gdi);
|
||||||
|
|
||||||
gdi->width = instance->settings->width;
|
gdi->width = instance->settings->width;
|
||||||
gdi->height = instance->settings->height;
|
gdi->height = instance->settings->height;
|
||||||
|
@ -256,8 +256,8 @@ void gdi_bitmap_free(GDI_IMAGE *gdi_bmp);
|
|||||||
int gdi_init(freerdp* instance, uint32 flags);
|
int gdi_init(freerdp* instance, uint32 flags);
|
||||||
void gdi_free(freerdp* instance);
|
void gdi_free(freerdp* instance);
|
||||||
|
|
||||||
#define SET_GDI(_inst, _gdi) (_inst)->param2 = _gdi
|
#define SET_GDI(_instance, _gdi) (_instance)->param1 = _gdi
|
||||||
#define GET_GDI(_inst) ((GDI*) ((_inst)->param2))
|
#define GET_GDI(_instance) ((GDI*) ((_instance)->param1))
|
||||||
|
|
||||||
#ifdef WITH_DEBUG_GDI
|
#ifdef WITH_DEBUG_GDI
|
||||||
#define DEBUG_GDI(fmt, ...) DEBUG_CLASS(GDI, fmt, ## __VA_ARGS__)
|
#define DEBUG_GDI(fmt, ...) DEBUG_CLASS(GDI, fmt, ## __VA_ARGS__)
|
||||||
|
Loading…
Reference in New Issue
Block a user