diff options
author | Jim Grandy <jgrandy@authentic8.com> | 2013-07-05 14:55:31 -0700 |
---|---|---|
committer | Jim Grandy <jgrandy@authentic8.com> | 2013-08-22 12:52:31 -0700 |
commit | 4e9516e00c3a1653bdb3e0134aa7ee97ed049757 (patch) | |
tree | 8f3fe75419cf78f755d88d3480bd46874a130ea8 /xorg | |
parent | bd8083d7e2be0421d99ba2ba24d7fb7221988a30 (diff) | |
download | xrdp-proprietary-4e9516e00c3a1653bdb3e0134aa7ee97ed049757.tar.gz xrdp-proprietary-4e9516e00c3a1653bdb3e0134aa7ee97ed049757.zip |
Hand-apply patches (glphy cache) from Authetnic8 branch: 1048147 3fc5974 0552905 00b08a0
Diffstat (limited to 'xorg')
-rw-r--r-- | xorg/X11R7.6/rdp/rdpglyph.c | 64 | ||||
-rw-r--r-- | xorg/X11R7.6/rdp/rdpmain.c | 2 | ||||
-rw-r--r-- | xorg/X11R7.6/rdp/rdpup.c | 7 |
3 files changed, 47 insertions, 26 deletions
diff --git a/xorg/X11R7.6/rdp/rdpglyph.c b/xorg/X11R7.6/rdp/rdpglyph.c index 32811389..3da30737 100644 --- a/xorg/X11R7.6/rdp/rdpglyph.c +++ b/xorg/X11R7.6/rdp/rdpglyph.c @@ -92,6 +92,26 @@ set_mono_pixel(char* data, int x, int y, int width, int pixel) } } +/*****************************************************************************/ +static int +lget_pixel(char* data, int x, int y, int depth, int stride_bytes) +{ + int start; + int shift; + + if (depth == 1) + { + start = (y * stride_bytes) + x / 8; + shift = x % 8; + return (data[start] & (0x01 << shift)) ? 0xff : 0; + } + else if (depth == 8) + { + return data[y * stride_bytes + x]; + } + return 0; +} + /******************************************************************************/ static int glyph_get_data(ScreenPtr pScreen, GlyphPtr glyph, struct rdp_font_char* rfd) @@ -100,11 +120,11 @@ glyph_get_data(ScreenPtr pScreen, GlyphPtr glyph, struct rdp_font_char* rfd) int j; int src_xoff; int src_yoff; - int stride_bytes; + int src_stride_bytes; + int dst_stride_bytes; int hh; int ww; - int ss; - int depth; + int src_depth; unsigned char pixel; PicturePtr pPicture; pixman_image_t *src; @@ -122,49 +142,43 @@ glyph_get_data(ScreenPtr pScreen, GlyphPtr glyph, struct rdp_font_char* rfd) return 0; } - depth = pixman_image_get_depth(src); - stride_bytes = pixman_image_get_stride(src); - ww = pixman_image_get_width(src); - hh = pixman_image_get_height(src); - ss = (glyph->info.width + 3) & ~3; - if ((ww != glyph->info.width) || (hh != glyph->info.height) || - (depth != 8) || (stride_bytes != ss)) - { - LLOGLN(10, ("glyph_get_data: error w %d w %d h %d h %d " - "stride %d stride %d depth %d", ww, - glyph->info.width, hh, glyph->info.height, - stride_bytes, ss, depth)); - free_pixman_pict(pPicture, src); - return 0; - } - + src_stride_bytes = pixman_image_get_stride(src); if (g_do_alpha_glyphs) { - rfd->data_bytes = glyph->info.height * stride_bytes; + dst_stride_bytes = (glyph->info.width + 3) & ~3; rfd->bpp = 8; } else { - rfd->data_bytes = (((glyph->info.height * - ((glyph->info.width + 7) / 8)) + 3) & ~3); + dst_stride_bytes = (((glyph->info.width + 7) / 8) + 3) & ~3; rfd->bpp = 1; } + src_depth = pixman_image_get_depth(src); + ww = pixman_image_get_width(src); + hh = pixman_image_get_height(src); + if ((ww != glyph->info.width) || (hh != glyph->info.height) || + ((src_depth != 1) && (src_depth != 8))) + { + LLOGLN(0, ("glyph_get_data: bad glyph")); + free_pixman_pict(pPicture, src); + return 0; + } + rfd->data_bytes = glyph->info.height * dst_stride_bytes; rfd->data = (char*)g_malloc(rfd->data_bytes, 1); rfd->offset = -glyph->info.x; rfd->baseline = -glyph->info.y; rfd->width = glyph->info.width; rfd->height = glyph->info.height; - pi32 = pixman_image_get_data(src); pi8 = (char*)pi32; for (j = 0; j < rfd->height; j++) { for (i = 0; i < rfd->width; i++) { - pixel = pi8[j * stride_bytes + i]; + pixel = lget_pixel(pi8, i, j, src_depth, src_stride_bytes); if (g_do_alpha_glyphs) { - rfd->data[j * stride_bytes + i] = pixel; + rfd->data[j * dst_stride_bytes + i] = pixel; } else { diff --git a/xorg/X11R7.6/rdp/rdpmain.c b/xorg/X11R7.6/rdp/rdpmain.c index 7eb1bcde..281c3e38 100644 --- a/xorg/X11R7.6/rdp/rdpmain.c +++ b/xorg/X11R7.6/rdp/rdpmain.c @@ -48,7 +48,7 @@ int g_can_do_pix_to_pix = 0; int g_do_dirty_os = 1; /* delay remoting off screen bitmaps */ int g_do_dirty_ons = 0; /* delay remoting screen */ -int g_do_glyph_cache = 1; +int g_do_glyph_cache = 0; int g_do_alpha_glyphs = 1; Bool g_wrapWindow = 1; Bool g_wrapPixmap = 1; diff --git a/xorg/X11R7.6/rdp/rdpup.c b/xorg/X11R7.6/rdp/rdpup.c index 451b552c..aa5035ef 100644 --- a/xorg/X11R7.6/rdp/rdpup.c +++ b/xorg/X11R7.6/rdp/rdpup.c @@ -54,6 +54,7 @@ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp_mask; /* from rdpmain.c */ extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */ +extern int g_do_glyph_cache; /* from rdpmain.c */ extern int g_can_do_pix_to_pix; /* from rdpmain.c */ extern int g_use_rail; /* from rdpmain.c */ @@ -157,6 +158,7 @@ rdpup_disconnect(void) g_free(g_os_bitmaps); g_os_bitmaps = 0; g_use_rail = 0; + g_do_glyph_cache = 0; return 0; } @@ -765,6 +767,11 @@ rdpup_process_msg(struct stream *s) rdpup_send_rail(); #endif } + if (g_rdpScreen.client_info.orders[0x1b]) /* 27 NEG_GLYPH_INDEX_INDEX */ + { + LLOGLN(0, (" using glyph cache")); + g_do_glyph_cache = 1; + } if (g_rdpScreen.client_info.offscreen_cache_entries == 2000) { LLOGLN(0, (" client can do offscreen to offscreen blits")); |