libfreerdp-gdi: started using libfreerdp-cache

This commit is contained in:
Marc-André Moreau 2011-08-04 22:43:36 -04:00
parent 1dcc1c2be2
commit 46126a7d24
12 changed files with 43 additions and 9 deletions

View File

@ -20,6 +20,7 @@
include_directories(../../libfreerdp-gdi)
include_directories(../../libfreerdp-kbd)
include_directories(../../libfreerdp-core)
include_directories(../../libfreerdp-cache)
include_directories(${DIRECTFB_INCLUDE_DIRS})
add_executable(dfreerdp

View File

@ -19,6 +19,7 @@
include_directories(../../libfreerdp-gdi)
include_directories(../../libfreerdp-core)
include_directories(../../libfreerdp-cache)
add_executable(freerdp-test
freerdp.c)

View File

@ -22,6 +22,7 @@ include_directories(${CMAKE_SOURCE_DIR}) # for some internal tests
include_directories(../libfreerdp-core)
include_directories(../libfreerdp-gdi)
include_directories(../libfreerdp-cache)
add_executable(test_freerdp
test_per.c

View File

@ -725,6 +725,8 @@ typedef struct _DRAW_GDIPLUS_CACHE_END_ORDER DRAW_GDIPLUS_CACHE_END_ORDER;
#define STREAM_BITMAP_COMPRESSED 0x02
#define STREAM_BITMAP_V2 0x04
#define SCREEN_BITMAP_SURFACE 0xFFFF
/* Update Interface */
typedef struct rdp_update rdpUpdate;

View File

@ -22,7 +22,7 @@
#include "cache.h"
rdpCache* cache_new()
rdpCache* cache_new(rdpSettings* settings)
{
rdpCache* cache;
@ -30,7 +30,8 @@ rdpCache* cache_new()
if (cache != NULL)
{
cache->offscreen = offscreen_new();
cache->settings = settings;
cache->offscreen = offscreen_new(settings);
}
return cache;

View File

@ -29,10 +29,11 @@ typedef struct rdp_cache rdpCache;
struct rdp_cache
{
rdpSettings* settings;
rdpOffscreen* offscreen;
};
rdpCache* cache_new();
rdpCache* cache_new(rdpSettings* settings);
void cache_free(rdpCache* cache);
#endif /* __CACHE_H */

View File

@ -26,7 +26,7 @@ void* offscreen_get(rdpOffscreen* offscreen, uint16 index)
{
void* bitmap;
if (index < offscreen->maxEntries)
if (index > offscreen->maxEntries)
{
printf("invalid offscreen bitmap index: 0x%04X\n", index);
return NULL;
@ -45,7 +45,7 @@ void* offscreen_get(rdpOffscreen* offscreen, uint16 index)
void offscreen_put(rdpOffscreen* offscreen, uint16 index, void* bitmap)
{
if (index < offscreen->maxEntries)
if (index > offscreen->maxEntries)
{
printf("invalid offscreen bitmap index: 0x%04X\n", index);
return;

View File

@ -41,7 +41,7 @@ typedef struct rdp_offscreen rdpOffscreen;
void* offscreen_get(rdpOffscreen* offscreen, uint16 index);
void offscreen_put(rdpOffscreen* offscreen, uint16 index, void* bitmap);
rdpOffscreen* offscreen_new();
rdpOffscreen* offscreen_new(rdpSettings* settings);
void offscreen_free(rdpOffscreen* offscreen);
#endif /* __OFFSCREEN_CACHE_H */

View File

@ -97,8 +97,6 @@
#define SO_CHAR_INC_EQUAL_BM_BASE 0x20
#define SO_MAXEXT_EQUAL_BM_SIDE 0x40
#define SCREEN_BITMAP_SURFACE 0xFFFF
/* Primary Drawing Orders */
#define ORDER_TYPE_DSTBLT 0x00
#define ORDER_TYPE_PATBLT 0x01

View File

@ -17,6 +17,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
include_directories(../libfreerdp-cache)
set(FREERDP_GDI_SRCS
color.c
color.h
@ -53,6 +55,8 @@ set(FREERDP_GDI_SRCS
add_library(freerdp-gdi SHARED ${FREERDP_GDI_SRCS})
target_link_libraries(freerdp-gdi freerdp-cache)
set_target_properties(freerdp-gdi PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION})
install(TARGETS freerdp-gdi DESTINATION lib)

View File

@ -1262,13 +1262,33 @@ void gdi_polyline(rdpUpdate* update, POLYLINE_ORDER* polyline)
void gdi_create_offscreen_bitmap(rdpUpdate* update, CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap)
{
GDI_IMAGE* gdi_bmp;
GDI* gdi = GET_GDI(update);
printf("create_offscreen_bitmap: id:%d cx:%d cy:%d\n",
create_offscreen_bitmap->id, create_offscreen_bitmap->cx, create_offscreen_bitmap->cy);
gdi_bmp = gdi_bitmap_new(gdi, create_offscreen_bitmap->cx, create_offscreen_bitmap->cy, gdi->dstBpp, NULL);
offscreen_put(gdi->cache->offscreen, create_offscreen_bitmap->id, (void*) gdi_bmp);
}
void gdi_switch_surface(rdpUpdate* update, SWITCH_SURFACE_ORDER* switch_surface)
{
GDI_IMAGE* gdi_bmp;
GDI* gdi = GET_GDI(update);
printf("switch surface: 0x%04X\n", switch_surface->bitmapId);
if (switch_surface->bitmapId == SCREEN_BITMAP_SURFACE)
{
gdi->drawing = (GDI_IMAGE*) gdi->primary;
}
else
{
gdi_bmp = (GDI_IMAGE*) offscreen_get(gdi->cache->offscreen, switch_surface->bitmapId);
gdi->drawing = gdi_bmp;
}
}
/**
@ -1293,7 +1313,7 @@ void gdi_register_update_callbacks(rdpUpdate* update)
update->MultiOpaqueRect = gdi_multi_opaque_rect;
update->MultiDrawNineGrid = NULL;
update->LineTo = gdi_line_to;
update->Polyline = gdi_polyline;
update->Polyline = NULL;
update->MemBlt = NULL;
update->Mem3Blt = NULL;
update->SaveBitmap = NULL;
@ -1381,6 +1401,8 @@ int gdi_init(freerdp* instance, uint32 flags)
gdi_register_update_callbacks(instance->update);
gdi->cache = cache_new(instance->settings);
return 0;
}

View File

@ -20,6 +20,7 @@
#ifndef __GDI_H
#define __GDI_H
#include "cache.h"
#include "color.h"
#include <freerdp/freerdp.h>
#include <freerdp/utils/debug.h>
@ -242,6 +243,8 @@ struct _GDI
GDI_COLOR textColor;
void * rfx_context;
GDI_IMAGE *tile;
rdpCache* cache;
};
typedef struct _GDI GDI;