diff options
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | libxrdp/Makefile.am | 7 | ||||
-rw-r--r-- | libxrdp/xrdp_jpeg_compress.c | 82 | ||||
-rw-r--r-- | xorg/X11R7.6/rdp/rdpPolyFillRect.c | 27 | ||||
-rw-r--r-- | xorg/X11R7.6/rdp/rdpPutImage.c | 2 | ||||
-rw-r--r-- | xorg/X11R7.6/rdp/rdpdraw.c | 8 |
6 files changed, 115 insertions, 15 deletions
diff --git a/configure.ac b/configure.ac index 11188d36..e8823350 100644 --- a/configure.ac +++ b/configure.ac @@ -39,6 +39,10 @@ AC_ARG_ENABLE(jpeg, AS_HELP_STRING([--enable-jpeg], [Build jpeg module (default: no)]), [jpeg=true], [jpeg=false]) AM_CONDITIONAL(XRDP_JPEG, [test x$jpeg = xtrue]) +AC_ARG_ENABLE(tjpeg, AS_HELP_STRING([--enable-tjpeg], + [Build turbo jpeg module(assumes /opt/libjpeg-turbo) (default: no)]), + [tjpeg=true], [tjpeg=false]) +AM_CONDITIONAL(XRDP_TJPEG, [test x$tjpeg = xtrue]) AC_ARG_ENABLE(simplesound, AS_HELP_STRING([--enable-simplesound], [Build simple pulse audio interface (default: no)]), [simplesound=true], [simplesound=false]) diff --git a/libxrdp/Makefile.am b/libxrdp/Makefile.am index 279113b8..6564da36 100644 --- a/libxrdp/Makefile.am +++ b/libxrdp/Makefile.am @@ -16,10 +16,17 @@ EXTRA_DEFINES += -DXRDP_NEUTRINORDP EXTRA_LIBS += $(FREERDP_LIBS) endif +if XRDP_TJPEG +EXTRA_DEFINES += -DXRDP_JPEG -DXRDP_TJPEG +EXTRA_INCLUDES += -I/opt/libjpeg-turbo/include +EXTRA_FLAGS += -L/opt/libjpeg-turbo/lib -Wl,-rpath -Wl,/opt/libjpeg-turbo/lib +EXTRA_LIBS += -lturbojpeg +else if XRDP_JPEG EXTRA_DEFINES += -DXRDP_JPEG EXTRA_LIBS += -ljpeg endif +endif if GOT_PREFIX EXTRA_INCLUDES += -I$(prefix)/include diff --git a/libxrdp/xrdp_jpeg_compress.c b/libxrdp/xrdp_jpeg_compress.c index 82a816a0..e402f7d0 100644 --- a/libxrdp/xrdp_jpeg_compress.c +++ b/libxrdp/xrdp_jpeg_compress.c @@ -20,7 +20,87 @@ #include "libxrdp.h" -#if defined(XRDP_JPEG) +#if defined(XRDP_TJPEG) + +/* turbo jpeg */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <turbojpeg.h> + +static tjhandle g_tj_han = 0; /* turbojpeg handle */ + +/*****************************************************************************/ +int APP_CC +xrdp_jpeg_compress(char *in_data, int width, int height, + struct stream *s, int bpp, int byte_limit, + int start_line, struct stream *temp_s, + int e, int quality) +{ + int error; + int i; + int j; + unsigned int pixel; + unsigned int *src32; + unsigned int *dst32; + unsigned long cdata_bytes; + unsigned char *src_buf; + unsigned char *dst_buf; + char *temp_buf; + + if (bpp != 24) + { + g_writeln("bpp wrong %d", bpp); + return height; + } + if (g_tj_han == 0) + { + g_tj_han = tjInitCompress(); + } + cdata_bytes = byte_limit; + src_buf = (unsigned char *) in_data; + dst_buf = (unsigned char *) (s->p); + temp_buf = 0; + if (e == 0) + { + src_buf = (unsigned char*)in_data; + } + else + { + temp_buf = (char *) g_malloc((width + e) * height * 4, 0); + dst32 = (unsigned int *) temp_buf; + src32 = (unsigned int *) in_data; + for (j = 0; j < height; j++) + { + for (i = 0; i < width; i++) + { + pixel = *src32; + src32++; + *dst32 = pixel; + dst32++; + } + for (i = 0; i < e; i++) + { + *dst32 = pixel; + dst32++; + } + } + src_buf = (unsigned char *) temp_buf; + } + dst_buf = (unsigned char*)(s->p); + error = tjCompress(g_tj_han, src_buf, width + e, (width + e) * 4, height, + TJPF_XBGR, dst_buf, &cdata_bytes, + TJSAMP_420, quality, 0); + //g_writeln("error %d %d %d %d", error, width, e, height); + s->p += cdata_bytes; + g_free(temp_buf); + return height; +} + +#elif defined(XRDP_JPEG) + +/* libjpeg */ #include <stdio.h> #include <stdlib.h> diff --git a/xorg/X11R7.6/rdp/rdpPolyFillRect.c b/xorg/X11R7.6/rdp/rdpPolyFillRect.c index 1043a5d9..af68e83f 100644 --- a/xorg/X11R7.6/rdp/rdpPolyFillRect.c +++ b/xorg/X11R7.6/rdp/rdpPolyFillRect.c @@ -108,7 +108,8 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, LLOGLN(10, ("rdpPolyFillRect: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; - dirty_type = RDI_IMGLL; + dirty_type = (FillTiled == pGC->fillStyle) ? + RDI_IMGLY : RDI_IMGLL; } else { @@ -125,7 +126,8 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, LLOGLN(10, ("rdpPolyFillRect: getting dirty")); pDstPriv->is_dirty = 1; pDirtyPriv = pDstPriv; - dirty_type = RDI_FILL; + dirty_type = (FillTiled == pGC->fillStyle) ? + RDI_IMGLY : RDI_IMGLL; } else { @@ -151,7 +153,8 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, LLOGLN(10, ("rdpPolyFillRect: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; - dirty_type = RDI_IMGLL; + dirty_type = (FillTiled == pGC->fillStyle) ? + RDI_IMGLY : RDI_IMGLL; } else { @@ -192,7 +195,8 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, } else { - draw_item_add_img_region(pDirtyPriv, fill_reg, GXcopy, RDI_IMGLL, 2); + draw_item_add_img_region(pDirtyPriv, fill_reg, GXcopy, + dirty_type, 2); } } else if (got_id) @@ -214,7 +218,8 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, for (j = REGION_NUM_RECTS(fill_reg) - 1; j >= 0; j--) { box = REGION_RECTS(fill_reg)[j]; - rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + rdpup_fill_rect(box.x1, box.y1, + box.x2 - box.x1, box.y2 - box.y1); } rdpup_set_opcode(GXcopy); @@ -251,13 +256,15 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */ { LLOGLN(10, ("rdpPolyFillRect: 3")); - draw_item_add_fill_region(pDirtyPriv, &clip_reg, pGC->fgPixel, + draw_item_add_fill_region(pDirtyPriv, &clip_reg, + pGC->fgPixel, pGC->alu); } else { LLOGLN(10, ("rdpPolyFillRect: 4")); - draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, RDI_IMGLL, 2); + draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, + dirty_type, 2); } } else if (got_id) @@ -281,7 +288,8 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, for (j = num_clips - 1; j >= 0; j--) { box = REGION_RECTS(&clip_reg)[j]; - rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + rdpup_fill_rect(box.x1, box.y1, + box.x2 - box.x1, box.y2 - box.y1); } rdpup_set_opcode(GXcopy); @@ -291,7 +299,8 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, for (j = num_clips - 1; j >= 0; j--) { box = REGION_RECTS(&clip_reg)[j]; - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + rdpup_send_area(&id, box.x1, box.y1, + box.x2 - box.x1, box.y2 - box.y1); } } diff --git a/xorg/X11R7.6/rdp/rdpPutImage.c b/xorg/X11R7.6/rdp/rdpPutImage.c index ffc179d5..050f5f5f 100644 --- a/xorg/X11R7.6/rdp/rdpPutImage.c +++ b/xorg/X11R7.6/rdp/rdpPutImage.c @@ -135,7 +135,7 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, LLOGLN(10, ("rdpPutImage: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; - dirty_type = RDI_IMGLL; + dirty_type = RDI_IMGLY; } else { diff --git a/xorg/X11R7.6/rdp/rdpdraw.c b/xorg/X11R7.6/rdp/rdpdraw.c index f9dff80a..2bb6ccc4 100644 --- a/xorg/X11R7.6/rdp/rdpdraw.c +++ b/xorg/X11R7.6/rdp/rdpdraw.c @@ -827,7 +827,7 @@ xrdp_is_os(PixmapPtr pix, rdpPixmapPtr priv) LLOGLN(10, ("xrdp_is_os: queuing invalidating all")); draw_item_remove_all(priv); RegionInit(®1, &box, 0); - draw_item_add_img_region(priv, ®1, GXcopy, RDI_IMGLL, 16); + draw_item_add_img_region(priv, ®1, GXcopy, RDI_IMGLY, 16); RegionUninit(®1); priv->is_dirty = 1; priv->con_number = g_con_number; @@ -1212,7 +1212,7 @@ rdpClearToBackground(WindowPtr pWin, int x, int y, int w, int h, if (g_do_dirty_ons) { - draw_item_add_img_region(&g_screenPriv, ®, GXcopy, RDI_IMGLL, 16); + draw_item_add_img_region(&g_screenPriv, ®, GXcopy, RDI_IMGLY, 16); } else { @@ -1250,7 +1250,7 @@ rdpRestoreAreas(WindowPtr pWin, RegionPtr prgnExposed) if (g_do_dirty_ons) { - draw_item_add_img_region(&g_screenPriv, ®, GXcopy, RDI_IMGLL, 16); + draw_item_add_img_region(&g_screenPriv, ®, GXcopy, RDI_IMGLY, 16); } else { @@ -1415,7 +1415,7 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, LLOGLN(10, ("rdpComposite: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; - dirty_type = RDI_IMGLL; + dirty_type = g_doing_font ? RDI_IMGLL : RDI_IMGLY; } else { |