diff options
Diffstat (limited to 'xorg/X11R7.6')
31 files changed, 3511 insertions, 408 deletions
diff --git a/xorg/X11R7.6/cleanx.sh b/xorg/X11R7.6/cleanx.sh new file mode 100755 index 00000000..7ec804e0 --- /dev/null +++ b/xorg/X11R7.6/cleanx.sh @@ -0,0 +1,102 @@ +#!/bin/sh +# +# all directories can be read only except +# Read Write +# share/X11/xkb/compiled/ + +if test $# -lt 1 +then + echo "" + echo "usage: clean_build_dir.sh <installation dir>" + echo "" + exit 1 +fi + +BASEDIR=$1 + +if ! test -d $BASEDIR +then + echo "error directory $BASEDIR does not exist" + exit 1 +fi + +if ! test -w $BASEDIR +then + echo "error directory $BASEDIR is not writable" + exit 1 +fi + +echo cleaning $BASEDIR + +if ! test -x $BASEDIR/bin/X11rdp +then + echo "error $BASEDIR/bin/X11rdp does not exist" +fi + +bin_check_file() +{ + if [ "$1" = "X11rdp" ] + then + return 0 + fi + if [ "$1" = "xkbcomp" ] + then + return 0 + fi + rm -f $1 + return 0 +} + +HOLDPATH=$PWD +cd $BASEDIR + +# remove unused directories +rm -fr man/ +rm -fr include/ +rm -fr lib/python2.7/ +rm -fr lib/pkgconfig/ +rm -fr share/pkgconfig/ +rm -fr share/gtk-doc +rm -fr share/doc +rm -fr share/man +rm -fr share/aclocal +rm -fr share/intltool +rm -fr share/util-macros + +# remove development files +rm -f lib/*.a +rm -f lib/*.la +rm -f lib/xorg/modules/*.a +rm -f lib/xorg/modules/*.la + +# remove symbols +#strip lib/*.so +#strip lib/xorg/modules/*.so + +# remove hardware specific files +rm -f lib/dri/i915_dri.so +rm -f lib/dri/i965_dri.so +rm -f lib/dri/mach64_dri.so +rm -f lib/dri/mga_dri.so +rm -f lib/dri/r128_dri.so +rm -f lib/dri/r200_dri.so +rm -f lib/dri/r300_dri.so +rm -f lib/dri/r600_dri.so +rm -f lib/dri/radeon_dri.so +rm -f lib/dri/savage_dri.so +#strip lib/dri/swrast_dri.so +rm -f lib/dri/tdfx_dri.so +rm -f lib/dri/unichrome_dri.so + +# remove extra bin tools +cd bin +for i in * +do + if ! test -d "$i" + then + bin_check_file $i + fi +done +cd .. + +cd $HOLDPATH diff --git a/xorg/X11R7.6/rdp/Makefile b/xorg/X11R7.6/rdp/Makefile index e40b7473..3b84c43c 100644 --- a/xorg/X11R7.6/rdp/Makefile +++ b/xorg/X11R7.6/rdp/Makefile @@ -13,7 +13,7 @@ rdpPolylines.o rdpPolySegment.o rdpFillSpans.o rdpSetSpans.o \ rdpCopyPlane.o rdpPolyPoint.o rdpPolyArc.o rdpFillPolygon.o \ rdpPolyFillArc.o rdpPolyText8.o rdpPolyText16.o \ rdpImageText8.o rdpImageText16.o rdpImageGlyphBlt.o rdpPolyGlyphBlt.o \ -rdpPushPixels.o rdpxv.o \ +rdpPushPixels.o rdpxv.o rdpglyph.o rdpComposite.o \ miinitext.o \ fbcmap_mi.o @@ -43,7 +43,7 @@ LIBS = $(XSRCBASE)/dbe/.libs/libdbe.a \ LLIBS = -Wl,-rpath=$(LIBBASE) -lfreetype -lz -lm -lXfont -lXau \ -lXdmcp -lpixman-1 -lrt -ldl -lcrypto -lGL -lXdamage -CFLAGS = -O2 -Wall -fno-strength-reduce \ +CFLAGS = -g -O2 -Wall -fno-strength-reduce \ -I../../include \ -I../../cfb \ -I../../mfb \ diff --git a/xorg/X11R7.6/rdp/rdp.h b/xorg/X11R7.6/rdp/rdp.h index 6fd7c38a..32d05d6a 100644 --- a/xorg/X11R7.6/rdp/rdp.h +++ b/xorg/X11R7.6/rdp/rdp.h @@ -95,6 +95,23 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define PixelDPI 100 #define PixelToMM(_size) (((_size) * 254 + (PixelDPI) * 5) / ((PixelDPI) * 10)) +#define TAG_COMPOSITE 0 +#define TAG_COPYAREA 1 +#define TAG_POLYFILLRECT 2 +#define TAG_PUTIMAGE 3 +#define TAG_POLYRECTANGLE 4 +#define TAG_COPYPLANE 5 +#define TAG_POLYARC 6 +#define TAG_FILLPOLYGON 7 +#define TAG_POLYFILLARC 8 +#define TAG_IMAGETEXT8 9 +#define TAG_POLYTEXT8 10 +#define TAG_POLYTEXT16 11 +#define TAG_IMAGETEXT16 12 +#define TAG_IMAGEGLYPHBLT 13 +#define TAG_POLYGLYPHBLT 14 +#define TAG_PUSHPIXELS 15 + struct image_data { int width; @@ -103,6 +120,10 @@ struct image_data int Bpp; int lineBytes; char* pixels; + char* shmem_pixels; + int shmem_id; + int shmem_offset; + int shmem_lineBytes; }; /* Per-screen (framebuffer) structure. There is only one of these, since we @@ -114,7 +135,9 @@ struct _rdpScreenInfoRec int height; int depth; int bitsPerPixel; - int sizeInBytes; + int sizeInBytes; /* size of current used frame buffer */ + int sizeInBytesAlloc; /* size of current alloc frame buffer, + always >= sizeInBytes */ char* pfbMemory; Pixel blackPixel; Pixel whitePixel; @@ -142,6 +165,8 @@ struct _rdpScreenInfoRec CopyWindowProcPtr CopyWindow; ClearToBackgroundProcPtr ClearToBackground; ScreenWakeupHandlerProcPtr WakeupHandler; + CreatePictureProcPtr CreatePicture; + DestroyPictureProcPtr DestroyPicture; CompositeProcPtr Composite; GlyphsProcPtr Glyphs; /* Backing store procedures */ @@ -198,6 +223,7 @@ typedef rdpWindowRec* rdpWindowPtr; #define RDI_IMGLY 3 /* lossy */ #define RDI_LINE 4 #define RDI_SCRBLT 5 +#define RDI_TEXT 6 struct urdp_draw_item_fill { @@ -234,17 +260,25 @@ struct urdp_draw_item_scrblt int cy; }; +struct urdp_draw_item_text +{ + int opcode; + int fg_color; + struct rdp_text* rtext; /* in rdpglyph.h */ +}; + union urdp_draw_item { struct urdp_draw_item_fill fill; struct urdp_draw_item_img img; struct urdp_draw_item_line line; struct urdp_draw_item_scrblt scrblt; + struct urdp_draw_item_text text; }; struct rdp_draw_item { - int type; + int type; /* RDI_FILL, RDI_IMGLL, ... */ int flags; struct rdp_draw_item* prev; struct rdp_draw_item* next; @@ -252,6 +286,8 @@ struct rdp_draw_item union urdp_draw_item u; }; +#define XRDP_USE_COUNT_THRESHOLD 1 + struct _rdpPixmapRec { int status; @@ -259,6 +295,11 @@ struct _rdpPixmapRec int con_number; int is_dirty; int is_scratch; + int is_alpha_dirty_not; + /* number of times used in a remote operation + if this gets above XRDP_USE_COUNT_THRESHOLD + then we force remote the pixmap */ + int use_count; int kind_width; struct rdp_draw_item* draw_item_head; struct rdp_draw_item* draw_item_tail; @@ -325,6 +366,8 @@ void hexdump(unsigned char *p, unsigned int len); void RegionAroundSegs(RegionPtr reg, xSegment* segs, int nseg); +int +get_crc(char* data, int data_bytes); /* rdpdraw.c */ Bool @@ -353,6 +396,9 @@ int draw_item_add_srcblt_region(rdpPixmapRec* priv, RegionPtr reg, int srcx, int srcy, int dstx, int dsty, int cx, int cy); +int +draw_item_add_text_region(rdpPixmapRec* priv, RegionPtr reg, int color, + int opcode, struct rdp_text* rtext); PixmapPtr rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, @@ -411,15 +457,19 @@ rdpDisplayCursor(ScreenPtr pScreen, CursorPtr pCursor); void rdpRecolorCursor(ScreenPtr pScreen, CursorPtr pCursor, Bool displayed); + +/* rdpglyph.c */ +/* look in rdpglyph.h */ + +/* rdpComposite.c */ +int +rdpCreatePicture(PicturePtr pPicture); +void +rdpDestroyPicture(PicturePtr pPicture); void rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); -void -rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, - PictFormatPtr maskFormat, - INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists, - GlyphPtr* glyphs); /* rdpinput.c */ int @@ -461,6 +511,8 @@ int rdpup_add_os_bitmap(PixmapPtr pixmap, rdpPixmapPtr priv); int rdpup_remove_os_bitmap(int rdpindex); +int +rdpup_update_os_use(int rdpindex); void rdpup_get_screen_image_rect(struct image_data* id); void @@ -504,6 +556,8 @@ rdpup_set_cursor_ex(short x, short y, char *cur_data, char *cur_mask, int bpp); int rdpup_create_os_surface(int rdpindexd, int width, int height); int +rdpup_create_os_surface_bpp(int rdpindexd, int width, int height, int bpp); +int rdpup_switch_os_surface(int rdpindex); int rdpup_delete_os_surface(int rdpindex); @@ -520,7 +574,29 @@ rdpup_delete_window(WindowPtr pWindow, rdpWindowRec* priv); int rdpup_check_dirty(PixmapPtr pDirtyPixmap, rdpPixmapRec* pDirtyPriv); int +rdpup_check_alpha_dirty(PixmapPtr pDirtyPixmap, rdpPixmapRec* pDirtyPriv); +int rdpup_check_dirty_screen(rdpPixmapRec* pDirtyPriv); +int +rdpup_add_char(int font, int charactor, short x, short y, int cx, int cy, + char* bmpdata, int bmpdata_bytes); +int +rdpup_add_char_alpha(int font, int charactor, short x, short y, int cx, int cy, + char* bmpdata, int bmpdata_bytes); +int +rdpup_draw_text(int font, int flags, int mixmode, + short clip_left, short clip_top, + short clip_right, short clip_bottom, + short box_left, short box_top, + short box_right, short box_bottom, short x, short y, + char* data, int data_bytes); +int +rdpup_composite(short srcidx, int srcformat, short srcwidth, CARD8 srcrepeat, + PictTransform* srctransform, CARD8 mskflags, + short mskidx, int mskformat, short mskwidth, CARD8 mskrepeat, + CARD8 op, short srcx, short srcy, short mskx, short msky, + short dstx, short dsty, short width, short height, + int dstformat); void rdpScheduleDeferredUpdate(void); @@ -592,6 +668,13 @@ struct stream #endif /******************************************************************************/ +#define out_uint8(s, v) \ +{ \ + *((s)->p) = (unsigned char)((v) >> 0); \ + (s)->p++; \ +} + +/******************************************************************************/ #define init_stream(s, v) \ { \ if ((v) > (s)->size) \ @@ -619,6 +702,13 @@ struct stream } /******************************************************************************/ +#define out_uint8s(s, n) do \ +{ \ + memset((s)->p, 0, (n)); \ + (s)->p += (n); \ +} while (0) + +/******************************************************************************/ #if defined(B_ENDIAN) || defined(NEED_ALIGN) #define out_uint32_le(s, v) \ { \ diff --git a/xorg/X11R7.6/rdp/rdpComposite.c b/xorg/X11R7.6/rdp/rdpComposite.c new file mode 100644 index 00000000..f763783e --- /dev/null +++ b/xorg/X11R7.6/rdp/rdpComposite.c @@ -0,0 +1,846 @@ +/* + Copyright 2012-2013 Jay Sorg + + Permission to use, copy, modify, distribute, and sell this software and its + documentation for any purpose is hereby granted without fee, provided that + the above copyright notice appear in all copies and that both that + copyright notice and this permission notice appear in supporting + documentation. + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + */ + +#include "rdp.h" +#include "rdpdraw.h" + +#define LDEBUG 0 + +#define LOG_LEVEL 1 +#define LLOG(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0) +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */ +extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */ +extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */ +extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ +extern int g_Bpp; /* from rdpmain.c */ +extern ScreenPtr g_pScreen; /* from rdpmain.c */ +extern Bool g_wrapPixmap; /* from rdpmain.c */ +extern int g_can_do_pix_to_pix; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ +extern int g_do_dirty_ons; /* in rdpmain.c */ +extern rdpPixmapRec g_screenPriv; /* in rdpmain.c */ +extern int g_do_glyph_cache; /* in rdpmain.c */ +extern int g_doing_font; /* in rdpmain.c */ +extern int g_do_composite; /* in rdpmain.c */ + +extern GCOps g_rdpGCOps; /* from rdpdraw.c */ + +extern int g_con_number; /* in rdpup.c */ + +extern int g_crc_seed; /* in rdpmisc.c */ +extern int g_crc_table[]; /* in rdpmisc.c */ + +/******************************************************************************/ +int +rdpCreatePicture(PicturePtr pPicture) +{ + PictureScreenPtr ps; + int rv; + + LLOGLN(10, ("rdpCreatePicture:")); + ps = GetPictureScreen(g_pScreen); + ps->CreatePicture = g_rdpScreen.CreatePicture; + rv = ps->CreatePicture(pPicture); + ps->CreatePicture = rdpCreatePicture; + return rv; +} + +/******************************************************************************/ +void +rdpDestroyPicture(PicturePtr pPicture) +{ + PictureScreenPtr ps; + + LLOGLN(10, ("rdpDestroyPicture:")); + ps = GetPictureScreen(g_pScreen); + ps->DestroyPicture = g_rdpScreen.DestroyPicture; + ps->DestroyPicture(pPicture); + ps->DestroyPicture = rdpDestroyPicture; +} + +/******************************************************************************/ +static int +print_format(PictFormatShort format) +{ + switch (format) + { + case PIXMAN_a2r10g10b10: + LLOGLN(0, (" PIXMAN_x2r10g10b10")); + break; + case PIXMAN_x2r10g10b10: + LLOGLN(0, (" PIXMAN_x2r10g10b10")); + break; + case PIXMAN_a2b10g10r10: + LLOGLN(0, (" PIXMAN_a2b10g10r10")); + break; + case PIXMAN_x2b10g10r10: + LLOGLN(0, (" PIXMAN_x2b10g10r10")); + break; + + case PIXMAN_a8r8g8b8: + LLOGLN(0, (" PIXMAN_a8r8g8b8")); + break; + case PIXMAN_x8r8g8b8: + LLOGLN(0, (" PIXMAN_x8r8g8b8")); + break; + case PIXMAN_a8b8g8r8: + LLOGLN(0, (" PIXMAN_a8b8g8r8")); + break; + case PIXMAN_x8b8g8r8: + LLOGLN(0, (" PIXMAN_x8b8g8r8")); + break; + case PIXMAN_b8g8r8a8: + LLOGLN(0, (" PIXMAN_b8g8r8a8")); + break; + case PIXMAN_b8g8r8x8: + LLOGLN(0, (" PIXMAN_b8g8r8x8")); + break; + + /* 24bpp formats */ + case PIXMAN_r8g8b8: + LLOGLN(0, (" PIXMAN_r8g8b8")); + break; + case PIXMAN_b8g8r8: + LLOGLN(0, (" PIXMAN_b8g8r8")); + break; + + /* 16bpp formats */ + case PIXMAN_r5g6b5: + LLOGLN(0, (" PIXMAN_r5g6b5")); + break; + case PIXMAN_b5g6r5: + LLOGLN(0, (" PIXMAN_b5g6r5")); + break; + + case PIXMAN_a1r5g5b5: + LLOGLN(0, (" PIXMAN_a1r5g5b5")); + break; + case PIXMAN_x1r5g5b5: + LLOGLN(0, (" PIXMAN_x1r5g5b5")); + break; + case PIXMAN_a1b5g5r5: + LLOGLN(0, (" PIXMAN_a1b5g5r5")); + break; + case PIXMAN_x1b5g5r5: + LLOGLN(0, (" PIXMAN_x1b5g5r5")); + break; + case PIXMAN_a4r4g4b4: + LLOGLN(0, (" PIXMAN_a4r4g4b4")); + break; + case PIXMAN_x4r4g4b4: + LLOGLN(0, (" PIXMAN_x4r4g4b4")); + break; + case PIXMAN_a4b4g4r4: + LLOGLN(0, (" PIXMAN_a4b4g4r4")); + break; + case PIXMAN_x4b4g4r4: + LLOGLN(0, (" PIXMAN_x4b4g4r4")); + break; + + /* 8bpp formats */ + case PIXMAN_a8: + LLOGLN(0, (" PIXMAN_a8")); + break; + case PIXMAN_r3g3b2: + LLOGLN(0, (" PIXMAN_r3g3b2")); + break; + case PIXMAN_b2g3r3: + LLOGLN(0, (" PIXMAN_b2g3r3")); + break; + case PIXMAN_a2r2g2b2: + LLOGLN(0, (" PIXMAN_a2r2g2b2")); + break; + case PIXMAN_a2b2g2r2: + LLOGLN(0, (" PIXMAN_a2b2g2r2")); + break; + + case PIXMAN_c8: + LLOGLN(0, (" PIXMAN_c8")); + break; + case PIXMAN_g8: + LLOGLN(0, (" PIXMAN_g8")); + break; + + case PIXMAN_x4a4: + LLOGLN(0, (" PIXMAN_x4a4")); + break; + + /* 4bpp formats */ + case PIXMAN_a4: + LLOGLN(0, (" PIXMAN_a4")); + break; + case PIXMAN_r1g2b1: + LLOGLN(0, (" PIXMAN_r1g2b1")); + break; + case PIXMAN_b1g2r1: + LLOGLN(0, (" PIXMAN_b1g2r1")); + break; + case PIXMAN_a1r1g1b1: + LLOGLN(0, (" PIXMAN_a1r1g1b1")); + break; + case PIXMAN_a1b1g1r1: + LLOGLN(0, (" PIXMAN_a1b1g1r1")); + break; + + case PIXMAN_c4: + LLOGLN(0, (" PIXMAN_c4")); + break; + case PIXMAN_g4: + LLOGLN(0, (" PIXMAN_g4")); + break; + + /* 1bpp formats */ + case PIXMAN_a1: + LLOGLN(0, (" PIXMAN_a1")); + break; + case PIXMAN_g1: + LLOGLN(0, (" PIXMAN_g1")); + break; + } + return 0; +} + +/******************************************************************************/ +static int +compsoite_print(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, + INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, + INT16 yDst, CARD16 width, CARD16 height) +{ + PixmapPtr pSrcPixmap; + PixmapPtr pDstPixmap; + rdpPixmapRec* pSrcPriv; + rdpPixmapRec* pDstPriv; + + LLOGLN(0, ("compsoite_print: op %d xSrc %d ySrc %d xDst %d yDst %d " + "width %d height %d", + op, xSrc, ySrc, xDst, yDst, width, height)); + + if (pSrc != 0) + { + LLOGLN(0, (" src depth %d width %d height %d repeat %d repeatType %d " + "dither %d filter %d alphaMap %p componentAlpha %d", pSrc->pDrawable->depth, + pSrc->pDrawable->width, pSrc->pDrawable->height, + pSrc->repeat, pSrc->repeatType, pSrc->dither, pSrc->filter, + pSrc->alphaMap, pSrc->componentAlpha)); + LLOGLN(0, (" transform %p", pSrc->transform)); + LLOGLN(0, (" detail format red %d red mask %d green %d green mask %d " + "blue %d blue mask %d", + pSrc->pFormat->direct.red, pSrc->pFormat->direct.redMask, + pSrc->pFormat->direct.green, pSrc->pFormat->direct.greenMask, + pSrc->pFormat->direct.blue, pSrc->pFormat->direct.blueMask)); + print_format(pSrc->format); + if (pSrc->pDrawable->type == DRAWABLE_PIXMAP) + { + pSrcPixmap = (PixmapPtr)(pSrc->pDrawable); + pSrcPriv = GETPIXPRIV(pSrcPixmap); + LLOGLN(0, (" DRAWABLE_PIXMAP pSrcPriv %p status %d", pSrcPriv, pSrcPriv->status)); + } + else if (pSrc->pDrawable->type == DRAWABLE_WINDOW) + { + LLOGLN(0, (" DRAWABLE_WINDOW")); + } + else + { + LLOGLN(0, (" OTHER")); + } + } + if (pMask != 0) + { + LLOGLN(0, (" msk depth %d width %d height %d repeat %d repeatType %d", + pMask->pDrawable->depth, + pMask->pDrawable->width, + pMask->pDrawable->height, pMask->repeat, pMask->repeatType)); + print_format(pMask->format); + } + if (pDst != 0) + { + LLOGLN(0, (" dst depth %d width %d height %d repeat %d repeatType %d " + "dither %d filter %d alphaMap %p", pDst->pDrawable->depth, + pDst->pDrawable->width, pDst->pDrawable->height, + pDst->repeat, pDst->repeatType, pDst->dither, pDst->filter, + pDst->alphaMap)); + LLOGLN(0, (" transform %p", pDst->transform)); + print_format(pDst->format); + if (pDst->pDrawable->type == DRAWABLE_PIXMAP) + { + pDstPixmap = (PixmapPtr)(pDst->pDrawable); + pDstPriv = GETPIXPRIV(pDstPixmap); + LLOGLN(0, (" DRAWABLE_PIXMAP pDstPriv %p status %d", pDstPriv, pDstPriv->status)); + } + else if (pDst->pDrawable->type == DRAWABLE_WINDOW) + { + LLOGLN(0, (" DRAWABLE_WINDOW")); + } + else + { + LLOGLN(0, (" OTHER")); + } + } + return 0; +} + +/******************************************************************************/ +static int +src_alpha_needed(CARD8 op) +{ + int rv; + + rv = 0; + switch (op) + { + case 3: /* Over */ + case 6: /* InReverse */ + case 8: /* OutReverse */ + case 9: /* Atop */ + case 10: /* AtopReverse */ + case 11: /* Xor */ + case 13: /* Saturate */ + case 17: /* DisjointOver */ + case 18: /* DisjointOverReverse */ + case 19: /* DisjointIn */ + case 20: /* DisjointInReverse */ + case 21: /* DisjointOut */ + case 22: /* DisjointOutReverse */ + case 23: /* DisjointAtop */ + case 24: /* DisjointAtopReverse */ + case 25: /* DisjointXor */ + case 29: /* ConjointOver */ + case 30: /* ConjointOverReverse */ + case 31: /* ConjointIn */ + case 32: /* ConjointInReverse */ + case 33: /* ConjointOut */ + case 34: /* ConjointOutReverse */ + case 35: /* ConjointAtop */ + case 36: /* ConjointAtopReverse */ + case 37: /* ConjointXor */ + rv = 1; + break; + } + return rv; +} + +/******************************************************************************/ +static int +dst_alpha_needed(CARD8 op) +{ + int rv; + + rv = 0; + switch (op) + { + case 4: /* OverReverse */ + case 5: /* In */ + case 7: /* Out */ + case 9: /* Atop */ + case 10: /* AtopReverse */ + case 11: /* Xor */ + case 13: /* Saturate */ + case 17: /* DisjointOver */ + case 18: /* DisjointOverReverse */ + case 19: /* DisjointIn */ + case 20: /* DisjointInReverse */ + case 21: /* DisjointOut */ + case 22: /* DisjointOutReverse */ + case 23: /* DisjointAtop */ + case 24: /* DisjointAtopReverse */ + case 25: /* DisjointXor */ + case 29: /* ConjointOver */ + case 30: /* ConjointOverReverse */ + case 31: /* ConjointIn */ + case 32: /* ConjointInReverse */ + case 33: /* ConjointOut */ + case 34: /* ConjointOutReverse */ + case 35: /* ConjointAtop */ + case 36: /* ConjointAtopReverse */ + case 37: /* ConjointXor */ + rv = 1; + break; + } + return rv; +} + +struct msk_info +{ + int flags; + int idx; + int format; + int width; + int repeat; +}; + +static char g_com_fail_strings[][128] = +{ + "OK", + "src not remotable", + "dst not remotable", + "msk not remotable" +}; + +/******************************************************************************/ +/* returns boolean */ +static int +check_drawables(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, + INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, + INT16 yDst, CARD16 width, CARD16 height, struct msk_info* msk) +{ + int rv; + int fail_reason; + PixmapPtr pSrcPixmap; + PixmapPtr pDstPixmap; + PixmapPtr pMskPixmap; + rdpPixmapRec* pSrcPriv; + rdpPixmapRec* pDstPriv; + rdpPixmapRec* pMskPriv; + + fail_reason = 0; + pSrcPixmap = 0; + pDstPixmap = 0; + pMskPixmap = 0; + pSrcPriv = 0; + pDstPriv = 0; + pMskPriv = 0; + rv = 0; + if (pSrc != 0) + { + if (pSrc->pDrawable != 0) + { + if (pSrc->pDrawable->type == DRAWABLE_PIXMAP) + { + pSrcPixmap = (PixmapPtr)(pSrc->pDrawable); + pSrcPriv = GETPIXPRIV(pSrcPixmap); + if (xrdp_is_os(pSrcPixmap, pSrcPriv)) + { + if (pDst != 0) + { + if (pDst->pDrawable != 0) + { + if (pDst->pDrawable->type == DRAWABLE_PIXMAP) + { + pDstPixmap = (PixmapPtr)(pDst->pDrawable); + pDstPriv = GETPIXPRIV(pDstPixmap); + if (xrdp_is_os(pDstPixmap, pDstPriv)) + { + rv = 1; + } + else + { + fail_reason = 2; + } + } + } + } + } + else + { + fail_reason = 1; + } + } + } + } + if (rv) + { + if (pMask != 0) + { +#if 1 + rv = 0; + if (pMask->pDrawable != 0) + { + if (pMask->pDrawable->type == DRAWABLE_PIXMAP) + { + pMskPixmap = (PixmapPtr)(pMask->pDrawable); + pMskPriv = GETPIXPRIV(pMskPixmap); + if (xrdp_is_os(pMskPixmap, pMskPriv)) + { + rv = 1; + msk->flags = 1; + msk->idx = pMskPriv->rdpindex; + msk->format = pMask->format; + msk->width = pMask->pDrawable->width; + msk->repeat = pMask->repeatType; + } + else + { + fail_reason = 3; + } + } + } +#endif + } + } + if (rv == 0) + { + LLOGLN(10, ("check_drawables: can not remote [%s]", g_com_fail_strings[fail_reason])); +#if 0 + compsoite_print(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, + xDst, yDst, width, height); +#endif + } + else + { + LLOGLN(10, ("check_drawables: can remote [%s]", g_com_fail_strings[fail_reason])); +#if 0 + compsoite_print(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, + xDst, yDst, width, height); +#endif + } + return rv; +} + +/******************************************************************************/ +static int +rdpRemoteComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, + INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, + INT16 yDst, CARD16 width, CARD16 height) +{ + int ok_to_remote; + PixmapPtr pSrcPixmap; + PixmapPtr pMskPixmap; + PixmapPtr pDstPixmap; + rdpPixmapRec* pSrcPriv; + rdpPixmapRec* pMskPriv; + rdpPixmapRec* pDstPriv; + BoxRec box; + RegionRec reg1; + RegionRec reg2; + DrawablePtr p; + int j; + int num_clips; + struct msk_info msk; + + LLOGLN(10, ("rdpRemoteComposite:")); + + memset(&msk, 0, sizeof(msk)); + ok_to_remote = check_drawables(op, pSrc, pMask, pDst, xSrc, ySrc, + xMask, yMask, xDst, yDst, width, height, + &msk); + if (!ok_to_remote) + { + return 1; + } + + ValidatePicture(pSrc); + pSrcPixmap = (PixmapPtr)(pSrc->pDrawable); + pSrcPriv = GETPIXPRIV(pSrcPixmap); + rdpup_check_dirty(pSrcPixmap, pSrcPriv); + if (PIXMAN_FORMAT_A(pSrc->format) > 0) + { + if (src_alpha_needed(op)) + { + rdpup_check_alpha_dirty(pSrcPixmap, pSrcPriv); + } + } + + ValidatePicture(pDst); + pDstPixmap = (PixmapPtr)(pDst->pDrawable); + pDstPriv = GETPIXPRIV(pDstPixmap); + rdpup_check_dirty(pDstPixmap, pDstPriv); + + if (PIXMAN_FORMAT_A(pDst->format) > 0) + { + if (dst_alpha_needed(op)) + { + rdpup_check_alpha_dirty(pDstPixmap, pDstPriv); + } + } + + if (pMask != 0) + { + ValidatePicture(pMask); + pMskPixmap = (PixmapPtr)(pMask->pDrawable); + pMskPriv = GETPIXPRIV(pMskPixmap); + rdpup_check_dirty(pMskPixmap, pMskPriv); + if (PIXMAN_FORMAT_A(msk.format) > 0) + { + rdpup_check_alpha_dirty(pMskPixmap, pMskPriv); + } + } + + p = pDst->pDrawable; + rdpup_switch_os_surface(pDstPriv->rdpindex); + if (pDst->pCompositeClip != 0) + { + box.x1 = xDst; + box.y1 = yDst; + box.x2 = box.x1 + width; + box.y2 = box.y1 + height; + RegionInit(®1, &box, 0); + RegionInit(®2, NullBox, 0); + RegionCopy(®2, pDst->pCompositeClip); + RegionIntersect(®1, ®1, ®2); + RegionTranslate(®1, p->x, p->y); + num_clips = REGION_NUM_RECTS(®1); + if (num_clips > 0) + { + LLOGLN(10, ("num_clips %d", num_clips)); + rdpup_begin_update(); + for (j = num_clips - 1; j >= 0; j--) + { + box = REGION_RECTS(®1)[j]; + rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + LLOGLN(10, ("pSrc->format 0x%x 0x%x 0x%x %d %d %d %d %d %d %d %d", + pSrc->format, msk.format, pDst->format, xSrc, ySrc, + xMask, yMask, xDst, yDst, width, height)); + rdpup_composite(pSrcPriv->rdpindex, pSrc->format, + pSrc->pDrawable->width, pSrc->repeatType, + pSrc->transform, msk.flags, msk.idx, msk.format, + msk.width, msk.repeat, op, xSrc, ySrc, + xMask, yMask, xDst, yDst, width, height, pDst->format); + } + rdpup_reset_clip(); + rdpup_end_update(); + } + RegionUninit(®1); + RegionUninit(®2); + } + else + { + rdpup_begin_update(); + rdpup_composite(pSrcPriv->rdpindex, pSrc->format, + pSrc->pDrawable->width, pSrc->repeatType, + pSrc->transform, msk.flags, msk.idx, msk.format, + msk.width, msk.repeat, op, xSrc, ySrc, + xMask, yMask, xDst, yDst, width, height, pDst->format); + rdpup_end_update(); + } + rdpup_switch_os_surface(-1); + + return 0; +} + +/******************************************************************************/ +static void +rdpCompositeOrg(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, + INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, + INT16 yDst, CARD16 width, CARD16 height) +{ + PictureScreenPtr ps; + + ps = GetPictureScreen(g_pScreen); + ps->Composite = g_rdpScreen.Composite; + ps->Composite(op, pSrc, pMask, pDst, xSrc, ySrc, + xMask, yMask, xDst, yDst, width, height); + ps->Composite = rdpComposite; +} + +/******************************************************************************/ +/* it looks like all the antialias draws go through here + op is one of the following + #define PictOpMinimum 0 + #define PictOpClear 0 + #define PictOpSrc 1 + #define PictOpDst 2 + #define PictOpOver 3 + #define PictOpOverReverse 4 + #define PictOpIn 5 + #define PictOpInReverse 6 + #define PictOpOut 7 + #define PictOpOutReverse 8 + #define PictOpAtop 9 + #define PictOpAtopReverse 10 + #define PictOpXor 11 + #define PictOpAdd 12 + #define PictOpSaturate 13 + #define PictOpMaximum 13 + + see for porter duff + http://www.svgopen.org/2005/papers/abstractsvgopen/ + + */ +void +rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, + INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, + INT16 yDst, CARD16 width, CARD16 height) +{ + BoxRec box; + RegionRec reg1; + RegionRec reg2; + DrawablePtr p; + int dirty_type; + int j; + int num_clips; + int post_process; + int reset_surface; + int got_id; + WindowPtr pDstWnd; + PixmapPtr pDstPixmap; + rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; + struct image_data id; + + LLOGLN(10, ("rdpComposite:")); + + if (g_doing_font == 2) + { + rdpCompositeOrg(op, pSrc, pMask, pDst, xSrc, ySrc, + xMask, yMask, xDst, yDst, width, height); + + return; + } + +#if 0 + if (g_do_glyph_cache && g_do_alpha_glyphs) + { + if (pSrc->pDrawable->width == 1 && + pSrc->pDrawable->height == 1) + { + if (pMask != 0) + { + /* TODO: here we can try to send it as a gylph */ + } + } + } +#endif + + /* try to remote the composite call */ + if (g_do_composite && + rdpRemoteComposite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, + xDst, yDst, width, height) == 0) + { + rdpCompositeOrg(op, pSrc, pMask, pDst, xSrc, ySrc, + xMask, yMask, xDst, yDst, width, height); + return; + } + + rdpCompositeOrg(op, pSrc, pMask, pDst, xSrc, ySrc, + xMask, yMask, xDst, yDst, width, height); + + LLOGLN(10, ("rdpComposite: op %d %p %p %p w %d h %d", op, pSrc, pMask, pDst, width, height)); + + p = pDst->pDrawable; + + pDstPriv = 0; + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; + got_id = 0; + if (p->type == DRAWABLE_PIXMAP) + { + pDstPixmap = (PixmapPtr)p; + pDstPriv = GETPIXPRIV(pDstPixmap); + if (XRDP_IS_OS(pDstPriv)) + { + post_process = 1; + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpComposite: gettig dirty")); + pDstPriv->is_dirty = 1; + dirty_type = g_doing_font ? RDI_IMGLL : RDI_IMGLY; + pDirtyPriv = pDstPriv; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + LLOGLN(10, ("rdpComposite: offscreen")); + } + } + } + else + { + if (p->type == DRAWABLE_WINDOW) + { + pDstWnd = (WindowPtr)p; + if (pDstWnd->viewable) + { + post_process = 1; + if (g_do_dirty_ons) + { + LLOGLN(10, ("rdpComposite: getting dirty")); + g_screenPriv.is_dirty = 1; + pDirtyPriv = &g_screenPriv; + dirty_type = g_doing_font ? RDI_IMGLL : RDI_IMGLY; + } + else + { + rdpup_get_screen_image_rect(&id); + got_id = 1; + } + } + } + } + + if (!post_process) + { + return; + } + + if (pDst->pCompositeClip != 0) + { + box.x1 = p->x + xDst; + box.y1 = p->y + yDst; + box.x2 = box.x1 + width; + box.y2 = box.y1 + height; + RegionInit(®1, &box, 0); + RegionInit(®2, NullBox, 0); + RegionCopy(®2, pDst->pCompositeClip); + RegionIntersect(®1, ®1, ®2); + if (dirty_type != 0) + { + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, TAG_COMPOSITE); + } + else if (got_id) + { + num_clips = REGION_NUM_RECTS(®1); + if (num_clips > 0) + { + rdpup_begin_update(); + for (j = num_clips - 1; j >= 0; j--) + { + box = REGION_RECTS(®1)[j]; + rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + } + rdpup_end_update(); + } + } + RegionUninit(®1); + RegionUninit(®2); + } + else + { + box.x1 = p->x + xDst; + box.y1 = p->y + yDst; + box.x2 = box.x1 + width; + box.y2 = box.y1 + height; + if (dirty_type != 0) + { + RegionInit(®1, &box, 0); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, TAG_COMPOSITE); + RegionUninit(®1); + } + else if (got_id) + { + rdpup_begin_update(); + rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + rdpup_end_update(); + } + } + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } +} diff --git a/xorg/X11R7.6/rdp/rdpCopyArea.c b/xorg/X11R7.6/rdp/rdpCopyArea.c index a97aaf56..4718a89c 100644 --- a/xorg/X11R7.6/rdp/rdpCopyArea.c +++ b/xorg/X11R7.6/rdp/rdpCopyArea.c @@ -429,6 +429,8 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, pSrcPixmap = (PixmapPtr)pSrc; pSrcPriv = GETPIXPRIV(pSrcPixmap); + LLOGLN(10, ("rdpCopyArea: 3 %d %d", pSrcPixmap->usage_hint, pSrcPriv->is_scratch)); + if (xrdp_is_os(pSrcPixmap, pSrcPriv)) { if (pDst->type == DRAWABLE_WINDOW) @@ -468,10 +470,12 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, } else { - LLOGLN(10, ("rdpCopyArea: 2")); + LLOGLN(10, ("rdpCopyArea: 2 %d %d", pSrcPixmap->usage_hint, pSrcPriv->is_scratch)); } } + LLOGLN(10, ("rdpCopyArea: fallback")); + /* do original call */ rv = rdpCopyAreaOrg(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); @@ -492,10 +496,10 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, if (g_do_dirty_os) { - LLOGLN(10, ("rdpCopyArea: gettig dirty")); + LLOGLN(10, ("rdpCopyArea: getting dirty")); pDstPriv->is_dirty = 1; pDirtyPriv = pDstPriv; - dirty_type = RDI_IMGLL; + dirty_type = RDI_IMGLY; } else { @@ -522,10 +526,10 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, if (g_do_dirty_ons) { - LLOGLN(10, ("rdpCopyArea: gettig dirty")); + LLOGLN(10, ("rdpCopyArea: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; - dirty_type = RDI_IMGLL; + dirty_type = RDI_IMGLY; } else { @@ -541,6 +545,8 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, return rv; } + LLOGLN(10, ("rdpCopyArea: post_process")); + RegionInit(&clip_reg, NullBox, 0); cd = rdp_get_clip(&clip_reg, pDst, pGC); @@ -553,7 +559,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, box.x2 = box.x1 + w; box.y2 = box.y1 + h; RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, 1); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, TAG_COPYAREA); RegionUninit(®1); } else if (got_id) @@ -577,7 +583,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, box.y2 = box.y1 + h; RegionInit(&box_reg, &box, 0); RegionIntersect(&clip_reg, &clip_reg, &box_reg); - draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type, 1); + draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type, TAG_COPYAREA); RegionUninit(&box_reg); } else if (got_id) diff --git a/xorg/X11R7.6/rdp/rdpCopyPlane.c b/xorg/X11R7.6/rdp/rdpCopyPlane.c index aac03287..063766ee 100644 --- a/xorg/X11R7.6/rdp/rdpCopyPlane.c +++ b/xorg/X11R7.6/rdp/rdpCopyPlane.c @@ -111,7 +111,7 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, if (g_do_dirty_os) { - LLOGLN(10, ("rdpCopyPlane: gettig dirty")); + LLOGLN(10, ("rdpCopyPlane: getting dirty")); pDstPriv->is_dirty = 1; pDirtyPriv = pDstPriv; dirty_type = RDI_IMGLL; @@ -137,7 +137,7 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, if (g_do_dirty_ons) { - LLOGLN(0, ("rdpCopyPlane: gettig dirty")); + LLOGLN(10, ("rdpCopyPlane: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; dirty_type = RDI_IMGLL; @@ -168,7 +168,7 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, box.x2 = box.x1 + w; box.y2 = box.y1 + h; RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, 5); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, TAG_COPYPLANE); RegionUninit(®1); } else if (got_id) @@ -194,7 +194,7 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, RegionInit(®2, NullBox, 0); RegionCopy(®2, &clip_reg); RegionIntersect(®1, ®1, ®2); - draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, 5); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, TAG_COPYPLANE); RegionUninit(®1); RegionUninit(®2); } diff --git a/xorg/X11R7.6/rdp/rdpFillPolygon.c b/xorg/X11R7.6/rdp/rdpFillPolygon.c index 4c54f447..960f619e 100644 --- a/xorg/X11R7.6/rdp/rdpFillPolygon.c +++ b/xorg/X11R7.6/rdp/rdpFillPolygon.c @@ -150,7 +150,7 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC, if (g_do_dirty_os) { - LLOGLN(10, ("rdpFillPolygon: gettig dirty")); + LLOGLN(10, ("rdpFillPolygon: getting dirty")); pDstPriv->is_dirty = 1; pDirtyPriv = pDstPriv; dirty_type = RDI_IMGLL; @@ -176,7 +176,7 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC, if (g_do_dirty_ons) { - LLOGLN(0, ("rdpFillPolygon: gettig dirty")); + LLOGLN(10, ("rdpFillPolygon: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; dirty_type = RDI_IMGLL; @@ -203,7 +203,7 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC, if (dirty_type != 0) { RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, 7); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, TAG_FILLPOLYGON); RegionUninit(®1); } else if (got_id) @@ -223,7 +223,7 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC, { if (dirty_type != 0) { - draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type, 7); + draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type, TAG_FILLPOLYGON); } else if (got_id) { diff --git a/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c b/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c index c5fcfaa7..d425a30b 100644 --- a/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c +++ b/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c @@ -108,7 +108,7 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, if (g_do_dirty_os) { - LLOGLN(10, ("rdpImageGlyphBlt: gettig dirty")); + LLOGLN(10, ("rdpImageGlyphBlt: getting dirty")); pDstPriv->is_dirty = 1; pDirtyPriv = pDstPriv; dirty_type = RDI_IMGLL; @@ -134,7 +134,7 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, if (g_do_dirty_ons) { - LLOGLN(0, ("rdpImageGlyphBlt: gettig dirty")); + LLOGLN(10, ("rdpImageGlyphBlt: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; dirty_type = RDI_IMGLL; @@ -169,7 +169,7 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, if (dirty_type != 0) { RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, 13); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, TAG_IMAGEGLYPHBLT); RegionUninit(®1); } else if (got_id) @@ -189,7 +189,7 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, { if (dirty_type != 0) { - draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type, 13); + draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type, TAG_IMAGEGLYPHBLT); } else if (got_id) { diff --git a/xorg/X11R7.6/rdp/rdpImageText16.c b/xorg/X11R7.6/rdp/rdpImageText16.c index e6048095..604d85e3 100644 --- a/xorg/X11R7.6/rdp/rdpImageText16.c +++ b/xorg/X11R7.6/rdp/rdpImageText16.c @@ -106,7 +106,7 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC, if (g_do_dirty_os) { - LLOGLN(10, ("rdpImageText16: gettig dirty")); + LLOGLN(10, ("rdpImageText16: getting dirty")); pDstPriv->is_dirty = 1; pDirtyPriv = pDstPriv; dirty_type = RDI_IMGLY; @@ -132,7 +132,7 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC, if (g_do_dirty_ons) { - LLOGLN(10, ("rdpImageText16: gettig dirty")); + LLOGLN(10, ("rdpImageText16: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; dirty_type = RDI_IMGLL; @@ -167,7 +167,7 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC, if (dirty_type != 0) { RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, 12); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, TAG_IMAGETEXT16); RegionUninit(®1); } else if (got_id) @@ -187,7 +187,7 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC, { if (dirty_type != 0) { - draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type, 12); + draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type, TAG_IMAGETEXT16); } else if (got_id) { diff --git a/xorg/X11R7.6/rdp/rdpImageText8.c b/xorg/X11R7.6/rdp/rdpImageText8.c index 641637e0..08dead18 100644 --- a/xorg/X11R7.6/rdp/rdpImageText8.c +++ b/xorg/X11R7.6/rdp/rdpImageText8.c @@ -106,7 +106,7 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC, if (g_do_dirty_os) { - LLOGLN(10, ("rdpImageText8: gettig dirty")); + LLOGLN(10, ("rdpImageText8: getting dirty")); pDstPriv->is_dirty = 1; pDirtyPriv = pDstPriv; dirty_type = RDI_IMGLL; @@ -132,7 +132,7 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC, if (g_do_dirty_ons) { - LLOGLN(0, ("rdpImageText8: gettig dirty")); + LLOGLN(10, ("rdpImageText8: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; dirty_type = RDI_IMGLL; @@ -167,7 +167,7 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC, if (dirty_type != 0) { RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, 9); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, TAG_IMAGETEXT8); RegionUninit(®1); } else if (got_id) @@ -187,7 +187,7 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC, { if (dirty_type != 0) { - draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type, 9); + draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type, TAG_IMAGETEXT8); } else if (got_id) { diff --git a/xorg/X11R7.6/rdp/rdpPolyArc.c b/xorg/X11R7.6/rdp/rdpPolyArc.c index 6d6651f1..84a85587 100644 --- a/xorg/X11R7.6/rdp/rdpPolyArc.c +++ b/xorg/X11R7.6/rdp/rdpPolyArc.c @@ -125,7 +125,7 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs) if (g_do_dirty_os) { - LLOGLN(10, ("rdpPolyArc: gettig dirty")); + LLOGLN(10, ("rdpPolyArc: getting dirty")); pDstPriv->is_dirty = 1; pDirtyPriv = pDstPriv; dirty_type = RDI_IMGLL; @@ -151,7 +151,7 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs) if (g_do_dirty_ons) { - LLOGLN(0, ("rdpPolyArc: gettig dirty")); + LLOGLN(10, ("rdpPolyArc: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; dirty_type = RDI_IMGLL; @@ -185,7 +185,7 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs) { if (dirty_type != 0) { - draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type, 6); + draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type, TAG_POLYARC); } else if (got_id) { @@ -217,7 +217,7 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs) { if (dirty_type != 0) { - draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type, 6); + draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type, TAG_POLYARC); } else if (got_id) { diff --git a/xorg/X11R7.6/rdp/rdpPolyFillArc.c b/xorg/X11R7.6/rdp/rdpPolyFillArc.c index 6582f69e..e3822215 100644 --- a/xorg/X11R7.6/rdp/rdpPolyFillArc.c +++ b/xorg/X11R7.6/rdp/rdpPolyFillArc.c @@ -125,7 +125,7 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs) if (g_do_dirty_os) { - LLOGLN(10, ("rdpPolyFillArc: gettig dirty")); + LLOGLN(10, ("rdpPolyFillArc: getting dirty")); pDstPriv->is_dirty = 1; pDirtyPriv = pDstPriv; dirty_type = RDI_IMGLY; @@ -151,7 +151,7 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs) if (g_do_dirty_ons) { - LLOGLN(0, ("rdpPolyFillArc: gettig dirty")); + LLOGLN(10, ("rdpPolyFillArc: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; dirty_type = RDI_IMGLL; @@ -185,7 +185,7 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs) { if (dirty_type != 0) { - draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type, 8); + draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type, TAG_POLYFILLARC); } else if (got_id) { @@ -217,7 +217,7 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs) { if (dirty_type != 0) { - draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type, 8); + draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type, TAG_POLYFILLARC); } else if (got_id) { diff --git a/xorg/X11R7.6/rdp/rdpPolyFillRect.c b/xorg/X11R7.6/rdp/rdpPolyFillRect.c index e51fca4c..7db4be69 100644 --- a/xorg/X11R7.6/rdp/rdpPolyFillRect.c +++ b/xorg/X11R7.6/rdp/rdpPolyFillRect.c @@ -105,10 +105,11 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, if (g_do_dirty_ons) { - LLOGLN(10, ("rdpPolyFillRect: gettig dirty")); + 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 { @@ -122,10 +123,11 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, if (g_do_dirty_os) { - LLOGLN(10, ("rdpPolyFillRect: gettig dirty")); + 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 { @@ -148,10 +150,11 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, if (g_do_dirty_ons) { - LLOGLN(10, ("rdpPolyFillRect: gettig dirty")); + 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, TAG_POLYFILLRECT); } } 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, TAG_POLYFILLRECT); } } 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/rdpPolyGlyphBlt.c b/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c index 298b4b98..8ce1db08 100644 --- a/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c +++ b/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c @@ -108,7 +108,7 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, if (g_do_dirty_os) { - LLOGLN(10, ("rdpPolyGlyphBlt: gettig dirty")); + LLOGLN(10, ("rdpPolyGlyphBlt: getting dirty")); pDstPriv->is_dirty = 1; pDirtyPriv = pDstPriv; dirty_type = RDI_IMGLY; @@ -134,7 +134,7 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, if (g_do_dirty_ons) { - LLOGLN(0, ("rdpPolyGlyphBlt: gettig dirty")); + LLOGLN(10, ("rdpPolyGlyphBlt: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; dirty_type = RDI_IMGLL; @@ -169,7 +169,7 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, if (dirty_type != 0) { RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, 14); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, TAG_POLYGLYPHBLT); RegionUninit(®1); } else if (got_id) @@ -189,7 +189,7 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, { if (dirty_type != 0) { - draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type, 14); + draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type, TAG_POLYGLYPHBLT); } else if (got_id) { diff --git a/xorg/X11R7.6/rdp/rdpPolyPoint.c b/xorg/X11R7.6/rdp/rdpPolyPoint.c index 28db831a..e2eadafd 100644 --- a/xorg/X11R7.6/rdp/rdpPolyPoint.c +++ b/xorg/X11R7.6/rdp/rdpPolyPoint.c @@ -156,7 +156,7 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, if (g_do_dirty_os) { - LLOGLN(10, ("rdpPolyPoint: gettig dirty")); + LLOGLN(10, ("rdpPolyPoint: getting dirty")); pDstPriv->is_dirty = 1; pDirtyPriv = pDstPriv; dirty_type = RDI_IMGLL; @@ -182,7 +182,7 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, if (g_do_dirty_ons) { - LLOGLN(0, ("rdpPolyPoint: gettig dirty")); + LLOGLN(10, ("rdpPolyPoint: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; dirty_type = RDI_IMGLL; diff --git a/xorg/X11R7.6/rdp/rdpPolyRectangle.c b/xorg/X11R7.6/rdp/rdpPolyRectangle.c index 85bef306..c1a5c971 100644 --- a/xorg/X11R7.6/rdp/rdpPolyRectangle.c +++ b/xorg/X11R7.6/rdp/rdpPolyRectangle.c @@ -118,7 +118,7 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, if (g_do_dirty_os) { - LLOGLN(10, ("rdpPolyRectangle: gettig dirty")); + LLOGLN(10, ("rdpPolyRectangle: getting dirty")); pDstPriv->is_dirty = 1; pDirtyPriv = pDstPriv; dirty_type = RDI_IMGLL; @@ -144,7 +144,7 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, if (g_do_dirty_ons) { - LLOGLN(10, ("rdpPolyRectangle: gettig dirty")); + LLOGLN(10, ("rdpPolyRectangle: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; dirty_type = RDI_IMGLL; @@ -221,7 +221,7 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, } else { - draw_item_add_img_region(pDirtyPriv, fill_reg, GXcopy, dirty_type, 4); + draw_item_add_img_region(pDirtyPriv, fill_reg, GXcopy, dirty_type, TAG_POLYRECTANGLE); } RegionDestroy(fill_reg); @@ -275,7 +275,7 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, } else { - draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type, 4); + draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type, TAG_POLYRECTANGLE); } } else if (got_id) diff --git a/xorg/X11R7.6/rdp/rdpPolySegment.c b/xorg/X11R7.6/rdp/rdpPolySegment.c index 623ec748..f4bcfe31 100644 --- a/xorg/X11R7.6/rdp/rdpPolySegment.c +++ b/xorg/X11R7.6/rdp/rdpPolySegment.c @@ -115,7 +115,7 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs) if (g_do_dirty_os) { - LLOGLN(10, ("rdpPolySegment: gettig dirty")); + LLOGLN(10, ("rdpPolySegment: getting dirty")); pDstPriv->is_dirty = 1; pDirtyPriv = pDstPriv; dirty_type = RDI_IMGLL; @@ -141,7 +141,7 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs) if (g_do_dirty_ons) { - LLOGLN(10, ("rdpPolySegment: gettig dirty")); + LLOGLN(10, ("rdpPolySegment: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; dirty_type = RDI_IMGLL; diff --git a/xorg/X11R7.6/rdp/rdpPolyText16.c b/xorg/X11R7.6/rdp/rdpPolyText16.c index 9a253464..a28030f0 100644 --- a/xorg/X11R7.6/rdp/rdpPolyText16.c +++ b/xorg/X11R7.6/rdp/rdpPolyText16.c @@ -109,7 +109,7 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC, if (g_do_dirty_os) { - LLOGLN(10, ("rdpPolyText16: gettig dirty")); + LLOGLN(10, ("rdpPolyText16: getting dirty")); pDstPriv->is_dirty = 1; pDirtyPriv = pDstPriv; dirty_type = RDI_IMGLY; @@ -135,7 +135,7 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC, if (g_do_dirty_ons) { - LLOGLN(0, ("rdpPolyText16: gettig dirty")); + LLOGLN(10, ("rdpPolyText16: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; dirty_type = RDI_IMGLL; @@ -170,7 +170,7 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC, if (dirty_type != 0) { RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, 11); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, TAG_POLYTEXT16); RegionUninit(®1); } else if (got_id) @@ -190,7 +190,7 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC, { if (dirty_type != 0) { - draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type, 11); + draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type, TAG_POLYTEXT16); } else if (got_id) { diff --git a/xorg/X11R7.6/rdp/rdpPolyText8.c b/xorg/X11R7.6/rdp/rdpPolyText8.c index 59f04d78..3157a538 100644 --- a/xorg/X11R7.6/rdp/rdpPolyText8.c +++ b/xorg/X11R7.6/rdp/rdpPolyText8.c @@ -109,7 +109,7 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC, if (g_do_dirty_os) { - LLOGLN(10, ("rdpPolyText8: gettig dirty")); + LLOGLN(10, ("rdpPolyText8: getting dirty")); pDstPriv->is_dirty = 1; pDirtyPriv = pDstPriv; dirty_type = RDI_IMGLY; @@ -135,7 +135,7 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC, if (g_do_dirty_ons) { - LLOGLN(0, ("rdpPolyText8: gettig dirty")); + LLOGLN(10, ("rdpPolyText8: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; dirty_type = RDI_IMGLL; @@ -170,7 +170,7 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC, if (dirty_type != 0) { RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, 10); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, TAG_POLYTEXT8); RegionUninit(®1); } else if (got_id) @@ -190,7 +190,7 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC, { if (dirty_type != 0) { - draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type, 10); + draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type, TAG_POLYTEXT8); } else if (got_id) { diff --git a/xorg/X11R7.6/rdp/rdpPolylines.c b/xorg/X11R7.6/rdp/rdpPolylines.c index 759d1ff9..ba6381b8 100644 --- a/xorg/X11R7.6/rdp/rdpPolylines.c +++ b/xorg/X11R7.6/rdp/rdpPolylines.c @@ -166,7 +166,7 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, if (g_do_dirty_os) { - LLOGLN(10, ("rdpPolylines: gettig dirty")); + LLOGLN(10, ("rdpPolylines: getting dirty")); pDstPriv->is_dirty = 1; pDirtyPriv = pDstPriv; dirty_type = RDI_IMGLL; @@ -192,7 +192,7 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, if (g_do_dirty_ons) { - LLOGLN(10, ("rdpPolylines: gettig dirty")); + LLOGLN(10, ("rdpPolylines: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; dirty_type = RDI_IMGLL; diff --git a/xorg/X11R7.6/rdp/rdpPushPixels.c b/xorg/X11R7.6/rdp/rdpPushPixels.c index 6a353977..e7d330d1 100644 --- a/xorg/X11R7.6/rdp/rdpPushPixels.c +++ b/xorg/X11R7.6/rdp/rdpPushPixels.c @@ -102,7 +102,7 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, if (g_do_dirty_os) { - LLOGLN(10, ("rdpPushPixels: gettig dirty")); + LLOGLN(10, ("rdpPushPixels: getting dirty")); pDstPriv->is_dirty = 1; pDirtyPriv = pDstPriv; dirty_type = RDI_IMGLY; @@ -128,7 +128,7 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, if (g_do_dirty_ons) { - LLOGLN(0, ("rdpPushPixels: gettig dirty")); + LLOGLN(10, ("rdpPushPixels: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; dirty_type = RDI_IMGLL; @@ -160,7 +160,7 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, box.x2 = box.x1 + w; box.y2 = box.y1 + h; RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, 15); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, TAG_PUSHPIXELS); RegionUninit(®1); } else if (got_id) @@ -185,7 +185,7 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, if (dirty_type != 0) { RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type, 15); + draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type, TAG_PUSHPIXELS); RegionUninit(®1); } else if (got_id) diff --git a/xorg/X11R7.6/rdp/rdpPutImage.c b/xorg/X11R7.6/rdp/rdpPutImage.c index 737e4b31..d244d895 100644 --- a/xorg/X11R7.6/rdp/rdpPutImage.c +++ b/xorg/X11R7.6/rdp/rdpPutImage.c @@ -106,7 +106,7 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, if (g_do_dirty_os) { - LLOGLN(10, ("rdpPutImage: gettig dirty")); + LLOGLN(10, ("rdpPutImage: getting dirty")); pDstPriv->is_dirty = 1; pDirtyPriv = pDstPriv; dirty_type = RDI_IMGLY; @@ -132,10 +132,10 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, if (g_do_dirty_ons) { - LLOGLN(10, ("rdpPutImage: gettig dirty")); + LLOGLN(10, ("rdpPutImage: getting dirty")); g_screenPriv.is_dirty = 1; pDirtyPriv = &g_screenPriv; - dirty_type = RDI_IMGLL; + dirty_type = RDI_IMGLY; } else { @@ -163,7 +163,7 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, box.x2 = box.x1 + w; box.y2 = box.y1 + h; RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, 3); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, TAG_PUTIMAGE); RegionUninit(®1); } else if (got_id) @@ -185,7 +185,7 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, RegionInit(®2, NullBox, 0); RegionCopy(®2, &clip_reg); RegionIntersect(®1, ®1, ®2); - draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, 3); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, TAG_PUTIMAGE); RegionUninit(®1); RegionUninit(®2); } diff --git a/xorg/X11R7.6/rdp/rdpSetSpans.c b/xorg/X11R7.6/rdp/rdpSetSpans.c index 2b650e94..62dd8c5c 100644 --- a/xorg/X11R7.6/rdp/rdpSetSpans.c +++ b/xorg/X11R7.6/rdp/rdpSetSpans.c @@ -38,6 +38,8 @@ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ extern int g_do_dirty_os; /* in rdpmain.c */ +extern int g_do_dirty_ons; /* in rdpmain.c */ +extern rdpPixmapRec g_screenPriv; /* in rdpmain.c */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */ @@ -95,7 +97,7 @@ rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc, if (g_do_dirty_os) { - LLOGLN(10, ("rdpSetSpans: gettig dirty")); + LLOGLN(10, ("rdpSetSpans: getting dirty")); pDstPriv->is_dirty = 1; pDirtyPriv = pDstPriv; dirty_type = RDI_IMGLY; @@ -118,8 +120,18 @@ rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc, if (pDstWnd->viewable) { post_process = 1; - rdpup_get_screen_image_rect(&id); - got_id = 1; + if (g_do_dirty_ons) + { + LLOGLN(10, ("rdpSetSpans: getting dirty")); + g_screenPriv.is_dirty = 1; + pDirtyPriv = &g_screenPriv; + dirty_type = RDI_IMGLL; + } + else + { + rdpup_get_screen_image_rect(&id); + got_id = 1; + } } } } diff --git a/xorg/X11R7.6/rdp/rdpdraw.c b/xorg/X11R7.6/rdp/rdpdraw.c index 4b900f4e..e276c0b7 100644 --- a/xorg/X11R7.6/rdp/rdpdraw.c +++ b/xorg/X11R7.6/rdp/rdpdraw.c @@ -45,6 +45,7 @@ Xserver drawing ops and funcs #include "rdpImageGlyphBlt.h" #include "rdpPolyGlyphBlt.h" #include "rdpPushPixels.h" +#include "rdpglyph.h" #define LOG_LEVEL 1 #define LLOG(_level, _args) \ @@ -65,11 +66,10 @@ extern int g_do_dirty_os; /* in rdpmain.c */ extern int g_do_dirty_ons; /* in rdpmain.c */ extern rdpPixmapRec g_screenPriv; /* in rdpmain.c */ extern int g_con_number; /* in rdpmain.c */ +extern int g_do_glyph_cache; /* in rdpmain.c */ ColormapPtr g_rdpInstalledColormap; -static int g_doing_font = 0; - GCFuncs g_rdpGCFuncs = { rdpValidateGC, rdpChangeGC, rdpCopyGC, rdpDestroyGC, rdpChangeClip, @@ -407,6 +407,8 @@ rdpCloseScreen(int i, ScreenPtr pScreen) int draw_item_add(rdpPixmapRec *priv, struct rdp_draw_item *di) { + priv->is_alpha_dirty_not = 0; + if (priv->draw_item_tail == 0) { priv->draw_item_tail = di; @@ -458,6 +460,11 @@ draw_item_remove(rdpPixmapRec *priv, struct rdp_draw_item *di) g_free(di->u.line.segs); } } + + if (di->type == RDI_TEXT) + { + delete_rdp_text(di->u.text.rtext); + } RegionDestroy(di->reg); g_free(di); @@ -483,13 +490,175 @@ draw_item_remove_all(rdpPixmapRec *priv) /******************************************************************************/ int +region_get_pixel_count(RegionPtr reg) +{ + int index; + int count; + int pixels; + int width; + int height; + BoxRec box; + + pixels = 0; + count = REGION_NUM_RECTS(reg); + for (index = 0; index < count; index++) + { + box = REGION_RECTS(reg)[index]; + width = box.x2 - box.x1; + height = box.y2 - box.y1; + pixels += width * height; + } + return pixels; +} + +/******************************************************************************/ +/* returns boolean */ +int +region_in_region(RegionPtr reg_small, int sreg_pcount, RegionPtr reg_big) +{ + int rv; + RegionRec reg; + + rv = 0; + RegionInit(®, NullBox, 0); + RegionIntersect(®, reg_small, reg_big); + if (sreg_pcount == -1) + { + sreg_pcount = region_get_pixel_count(reg_small); + } + if (sreg_pcount == 0) + { + /* empty region not even in */ + return 0; + } + if (region_get_pixel_count(®) == sreg_pcount) + { + rv = 1; + } + RegionUninit(®); + return rv; +} + +/******************************************************************************/ +static int +remove_empties(rdpPixmapRec* priv) +{ + struct rdp_draw_item* di; + struct rdp_draw_item* di_prev; + int rv; + + rv = 0; + /* remove draw items with empty regions */ + di = priv->draw_item_head; + di_prev = 0; + while (di != 0) + { + if (!RegionNotEmpty(di->reg)) + { + LLOGLN(10, ("remove_empties: removing empty item type %d", di->type)); + draw_item_remove(priv, di); + di = di_prev == 0 ? priv->draw_item_head : di_prev->next; + rv++; + } + else + { + di_prev = di; + di = di->next; + } + } + return rv; +} + +/******************************************************************************/ +static int +dump_draw_list(rdpPixmapRec* priv) +{ + struct rdp_draw_item* di; + int index; + int count; + BoxRec box; + + LLOGLN(0, ("dump_draw_list:")); + di = priv->draw_item_head; + while (di != 0) + { + LLOGLN(0, (" type %d", di->type)); + count = REGION_NUM_RECTS(di->reg); + if (count == 0) + { + LLOGLN(0, (" empty region")); + } + else + { + box = RegionExtents(di->reg)[0]; + LLOGLN(0, (" region list follows extents x1 %d y1 %d x2 %d y2 %d", + box.x1, box.y1, box.x2, box.y2)); + for (index = 0; index < count; index++) + { + box = REGION_RECTS(di->reg)[index]; + LLOGLN(0, (" index %d x1 %d y1 %d x2 %d y2 %d", + index, box.x1, box.y1, box.x2, box.y2)); + } + } + di = di->next; + } + return 0; +} + +/******************************************************************************/ +/* returns boolean */ +static int +region_interect_at_all(RegionPtr reg_small, RegionPtr reg_big) +{ + int rv; + RegionRec reg; + + if (!RegionNotEmpty(reg_small)) + { + return 0; + } + rv = 0; + RegionInit(®, NullBox, 0); + RegionIntersect(®, reg_big, reg_big); + if (RegionNotEmpty(®)) + { + rv = 1; + } + RegionUninit(®); + return rv; +} + +/******************************************************************************/ +int draw_item_pack(PixmapPtr pix, rdpPixmapRec *priv) { struct rdp_draw_item *di; struct rdp_draw_item *di_prev; + BoxRec box; + RegionRec treg; #if 1 + if (pix != 0) + { + box.x1 = 0; + box.x2 = pix->drawable.width; + box.y1 = 0; + box.y2 = pix->drawable.height; + RegionInit(&treg, &box, 0); + di = priv->draw_item_head; + di_prev = 0; + while (di != 0) + { + RegionIntersect(di->reg, di->reg, &treg); + di_prev = di; + di = di->next; + } + RegionUninit(&treg); + remove_empties(priv); + } +#endif +#if 1 /* look for repeating draw types */ if (priv->draw_item_head != 0) { @@ -500,6 +669,17 @@ draw_item_pack(PixmapPtr pix, rdpPixmapRec *priv) while (di != 0) { +#if 0 + if ((di_prev->type == RDI_IMGLL || di_prev->type == RDI_IMGLY) && + (di->type == RDI_IMGLL || di->type == RDI_IMGLY)) + { + LLOGLN(10, ("draw_item_pack: packing RDI_IMGLL and RDI_IMGLY")); + di_prev->type = RDI_IMGLY; + RegionUnion(di_prev->reg, di_prev->reg, di->reg); + draw_item_remove(priv, di); + di = di_prev->next; + } +#else if ((di_prev->type == RDI_IMGLL) && (di->type == RDI_IMGLL)) { LLOGLN(10, ("draw_item_pack: packing RDI_IMGLL")); @@ -507,6 +687,7 @@ draw_item_pack(PixmapPtr pix, rdpPixmapRec *priv) draw_item_remove(priv, di); di = di_prev->next; } +#endif else if ((di_prev->type == RDI_IMGLY) && (di->type == RDI_IMGLY)) { LLOGLN(10, ("draw_item_pack: packing RDI_IMGLY")); @@ -522,10 +703,37 @@ draw_item_pack(PixmapPtr pix, rdpPixmapRec *priv) } } } - + remove_empties(priv); #endif + #if 0 + if (priv->draw_item_tail != 0) + { + if (priv->draw_item_tail->prev != 0) + { + di = priv->draw_item_tail; + while (di->prev != 0) + { + di_prev = di->prev; + while (di_prev != 0) + { + if ((di->type == RDI_TEXT) && (di_prev->type == RDI_IMGLY)) + { + if (region_interect_at_all(di->reg, di_prev->reg)) + { + di_prev->type = RDI_IMGLL; + } + } + di_prev = di_prev->prev; + } + di = di->prev; + } + } + } + remove_empties(priv); +#endif +#if 0 /* subtract regions */ if (priv->draw_item_tail != 0) { @@ -546,8 +754,11 @@ draw_item_pack(PixmapPtr pix, rdpPixmapRec *priv) while (di_prev != 0) { - /* D = M - S */ - RegionSubtract(di_prev->reg, di_prev->reg, di->reg); + if (region_in_region(di_prev->reg, -1, di->reg)) + { + /* empty region so this draw item will get removed below */ + RegionEmpty(di_prev->reg); + } di_prev = di_prev->prev; } } @@ -556,30 +767,9 @@ draw_item_pack(PixmapPtr pix, rdpPixmapRec *priv) } } } - + remove_empties(priv); #endif -#if 1 - /* remove draw items with empty regions */ - di = priv->draw_item_head; - di_prev = 0; - - while (di != 0) - { - if (!RegionNotEmpty(di->reg)) - { - LLOGLN(10, ("draw_item_pack: removing empty item type %d", di->type)); - draw_item_remove(priv, di); - di = di_prev == 0 ? priv->draw_item_head : di_prev->next; - } - else - { - di_prev = di; - di = di->next; - } - } - -#endif return 0; } @@ -693,6 +883,25 @@ draw_item_add_srcblt_region(rdpPixmapRec *priv, RegionPtr reg, } /******************************************************************************/ +int +draw_item_add_text_region(rdpPixmapRec* priv, RegionPtr reg, int color, + int opcode, struct rdp_text* rtext) +{ + struct rdp_draw_item* di; + + LLOGLN(10, ("draw_item_add_text_region:")); + di = (struct rdp_draw_item*)g_malloc(sizeof(struct rdp_draw_item), 1); + di->type = RDI_TEXT; + di->u.text.fg_color = color; + di->u.text.opcode = opcode; + di->u.text.rtext = rtext; + di->reg = RegionCreate(NullBox, 0); + RegionCopy(di->reg, reg); + draw_item_add(priv, di); + return 0; +} + +/******************************************************************************/ PixmapPtr rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, unsigned usage_hint) @@ -708,14 +917,14 @@ rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, width, org_width, depth, g_rdpScreen.depth)); pScreen->CreatePixmap = g_rdpScreen.CreatePixmap; rv = pScreen->CreatePixmap(pScreen, width, height, depth, usage_hint); + pScreen->CreatePixmap = rdpCreatePixmap; priv = GETPIXPRIV(rv); priv->rdpindex = -1; - priv->con_number = g_con_number; priv->kind_width = width; pScreen->ModifyPixmapHeader(rv, org_width, 0, 0, 0, 0, 0); - pScreen->CreatePixmap = rdpCreatePixmap; - if (org_width == 0 && height == 0) + if ((org_width == 0) && (height == 0)) { + LLOGLN(10, ("rdpCreatePixmap: setting is_scratch")); priv->is_scratch = 1; } return rv; @@ -739,9 +948,11 @@ rdpDestroyPixmap(PixmapPtr pPixmap) { if (XRDP_IS_OS(priv)) { - rdpup_remove_os_bitmap(priv->rdpindex); - rdpup_delete_os_surface(priv->rdpindex); - draw_item_remove_all(priv); + if (priv->rdpindex >= 0) + { + rdpup_remove_os_bitmap(priv->rdpindex); + rdpup_delete_os_surface(priv->rdpindex); + } } } @@ -762,33 +973,41 @@ xrdp_is_os(PixmapPtr pix, rdpPixmapPtr priv) int height; struct image_data id; - if (!XRDP_IS_OS(priv)) + if (XRDP_IS_OS(priv)) + { + /* update time stamp */ + rdpup_update_os_use(priv->rdpindex); + } + else { width = pix->drawable.width; height = pix->drawable.height; if ((pix->usage_hint == 0) && (pix->drawable.depth >= g_rdpScreen.depth) && (width > 0) && (height > 0) && (priv->kind_width > 0) && - (priv->is_scratch == 0)) + (priv->is_scratch == 0) && (priv->use_count >= 0)) { - LLOGLN(10, ("%d %d", priv->kind_width, pix->drawable.width)); + width = (width + 3) & ~3; priv->rdpindex = rdpup_add_os_bitmap(pix, priv); if (priv->rdpindex >= 0) { priv->status = 1; - rdpup_create_os_surface(priv->rdpindex, - priv->kind_width, height); + rdpup_create_os_surface(priv->rdpindex, width, height); box.x1 = 0; box.y1 = 0; box.x2 = width; box.y2 = height; if (g_do_dirty_os) { + LLOGLN(10, ("xrdp_is_os: priv->con_number %d g_con_number %d", + priv->con_number, g_con_number)); + LLOGLN(10, ("xrdp_is_os: priv->use_count %d", priv->use_count)); if (priv->con_number != g_con_number) { + 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; @@ -804,11 +1023,18 @@ xrdp_is_os(PixmapPtr pix, rdpPixmapPtr priv) rdpup_end_update(); rdpup_switch_os_surface(-1); } + priv->use_count++; return 1; } + else + { + LLOGLN(10, ("xrdp_is_os: rdpup_add_os_bitmap failed")); + } } + priv->use_count++; return 0; } + priv->use_count++; return 1; } @@ -852,6 +1078,10 @@ rdpDestroyWindow(WindowPtr pWindow) if (g_use_rail) { +#ifdef XRDP_WM_RDPUP + LLOGLN(10, (" rdpup_delete_window")); + rdpup_delete_window(pWindow, priv); +#endif } return rv; @@ -913,7 +1143,9 @@ rdpRealizeWindow(WindowPtr pWindow) pWindow->drawable.x, pWindow->drawable.y, pWindow->drawable.width, pWindow->drawable.height)); priv->status = 1; +#ifdef XRDP_WM_RDPUP rdpup_create_window(pWindow, priv); +#endif } } } @@ -942,7 +1174,18 @@ rdpUnrealizeWindow(WindowPtr pWindow) { LLOGLN(10, ("rdpUnrealizeWindow:")); priv->status = 0; - rdpup_delete_window(pWindow, priv); + if (pWindow->overrideRedirect) { +#ifdef XRDP_WM_RDPUP + /* + * Popups are unmapped by X server, so probably + * they will be mapped again. Thereby we should + * just hide those popups instead of destroying + * them. + */ + LLOGLN(10, (" rdpup_show_window")); + rdpup_show_window(pWindow, priv, 0x0); /* 0x0 - do not show the window */ +#endif + } } } @@ -1035,7 +1278,9 @@ rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion) BoxRec box2; BoxPtr box3; - LLOGLN(10, ("in rdpCopyWindow")); + LLOGLN(10, ("rdpCopyWindow:")); + LLOGLN(10, ("rdpCopyWindow: new x %d new y %d old x %d old y %d", + pWin->drawable.x, pWin->drawable.y, ptOldOrg.x, ptOldOrg.y)); RegionInit(®, NullBox, 0); RegionCopy(®, pOldRegion); RegionInit(&clip, NullBox, 0); @@ -1047,18 +1292,28 @@ rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion) { rdpup_check_dirty_screen(&g_screenPriv); } - rdpup_begin_update(); + + g_pScreen->CopyWindow = g_rdpScreen.CopyWindow; + g_pScreen->CopyWindow(pWin, ptOldOrg, pOldRegion); + g_pScreen->CopyWindow = rdpCopyWindow; + num_clip_rects = REGION_NUM_RECTS(&clip); num_reg_rects = REGION_NUM_RECTS(®); LLOGLN(10, ("rdpCopyWindow: num_clip_rects %d num_reg_rects %d", num_clip_rects, num_reg_rects)); + if ((num_clip_rects == 0) || (num_reg_rects == 0)) + { + return; + } + rdpup_begin_update(); + /* when there is a huge list of screen copies, just send as bitmap firefox dragging test does this */ if ((num_clip_rects > 16) && (num_reg_rects > 16)) { box3 = RegionExtents(®); - rdpup_send_area(0, box3->x1, box3->y1, + rdpup_send_area(0, box3->x1 + dx, box3->y1 + dy, box3->x2 - box3->x1, box3->y2 - box3->y1); } @@ -1073,6 +1328,8 @@ rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion) for (j = 0; j < num_clip_rects; j++) { box1 = REGION_RECTS(&clip)[j]; + LLOGLN(10, ("clip x %d y %d w %d h %d", box1.x1, box1.y1, + box1.x2 - box1.x1, box1.y2 - box1.y1)); rdpup_set_clip(box1.x1, box1.y1, box1.x2 - box1.x1, box1.y2 - box1.y1); @@ -1080,6 +1337,8 @@ rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion) for (i = 0; i < num_reg_rects; i++) { box2 = REGION_RECTS(®)[i]; + LLOGLN(10, ("reg x %d y %d w %d h %d", box2.x1, box2.y1, + box2.x2 - box2.x1, box2.y2 - box2.y1)); rdpup_screen_blt(box2.x1 + dx, box2.y1 + dy, box2.x2 - box2.x1, box2.y2 - box2.y1, @@ -1092,6 +1351,8 @@ rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion) for (j = num_clip_rects - 1; j >= 0; j--) { box1 = REGION_RECTS(&clip)[j]; + LLOGLN(10, ("clip x %d y %d w %d h %d", box1.x1, box1.y1, + box1.x2 - box1.x1, box1.y2 - box1.y1)); rdpup_set_clip(box1.x1, box1.y1, box1.x2 - box1.x1, box1.y2 - box1.y1); @@ -1099,6 +1360,8 @@ rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion) for (i = num_reg_rects - 1; i >= 0; i--) { box2 = REGION_RECTS(®)[i]; + LLOGLN(10, ("reg x %d y %d w %d h %d", box2.x1, box2.y1, + box2.x2 - box2.x1, box2.y2 - box2.y1)); rdpup_screen_blt(box2.x1 + dx, box2.y1 + dy, box2.x2 - box2.x1, box2.y2 - box2.y1, @@ -1113,9 +1376,6 @@ rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion) RegionUninit(®); RegionUninit(&clip); - g_pScreen->CopyWindow = g_rdpScreen.CopyWindow; - g_pScreen->CopyWindow(pWin, ptOldOrg, pOldRegion); - g_pScreen->CopyWindow = rdpCopyWindow; } /******************************************************************************/ @@ -1153,7 +1413,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 { @@ -1191,7 +1451,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 { @@ -1274,196 +1534,3 @@ rdpSaveScreen(ScreenPtr pScreen, int on) { return 1; } - -/******************************************************************************/ -/* it looks like all the antialias draws go through here */ -void -rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, - INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, - INT16 yDst, CARD16 width, CARD16 height) -{ - BoxRec box; - PictureScreenPtr ps; - RegionRec reg1; - RegionRec reg2; - DrawablePtr p; - int dirty_type; - int j; - int num_clips; - int post_process; - int reset_surface; - int got_id; - WindowPtr pDstWnd; - PixmapPtr pDstPixmap; - rdpPixmapRec *pDstPriv; - rdpPixmapRec *pDirtyPriv; - struct image_data id; - - LLOGLN(10, ("rdpComposite:")); - ps = GetPictureScreen(g_pScreen); - ps->Composite = g_rdpScreen.Composite; - ps->Composite(op, pSrc, pMask, pDst, xSrc, ySrc, - xMask, yMask, xDst, yDst, width, height); - ps->Composite = rdpComposite; - - p = pDst->pDrawable; - - dirty_type = 0; - pDirtyPriv = 0; - post_process = 0; - reset_surface = 0; - got_id = 0; - - if (p->type == DRAWABLE_PIXMAP) - { - pDstPixmap = (PixmapPtr)p; - pDstPriv = GETPIXPRIV(pDstPixmap); - - if (xrdp_is_os(pDstPixmap, pDstPriv)) - { - post_process = 1; - - if (g_do_dirty_os) - { - LLOGLN(10, ("rdpComposite: gettig dirty")); - pDstPriv->is_dirty = 1; - dirty_type = g_doing_font ? RDI_IMGLL : RDI_IMGLY; - pDirtyPriv = pDstPriv; - - } - else - { - rdpup_switch_os_surface(pDstPriv->rdpindex); - reset_surface = 1; - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; - LLOGLN(10, ("rdpComposite: offscreen")); - } - } - } - else - { - if (p->type == DRAWABLE_WINDOW) - { - pDstWnd = (WindowPtr)p; - - if (pDstWnd->viewable) - { - post_process = 1; - - if (g_do_dirty_ons) - { - LLOGLN(10, ("rdpComposite: gettig dirty")); - g_screenPriv.is_dirty = 1; - pDirtyPriv = &g_screenPriv; - dirty_type = RDI_IMGLL; - } - else - { - rdpup_get_screen_image_rect(&id); - got_id = 1; - LLOGLN(10, ("rdpComposite: screen")); - } - } - } - } - - if (!post_process) - { - return; - } - - if (pDst->pCompositeClip != 0) - { - box.x1 = p->x + xDst; - box.y1 = p->y + yDst; - box.x2 = box.x1 + width; - box.y2 = box.y1 + height; - RegionInit(®1, &box, 0); - RegionInit(®2, NullBox, 0); - RegionCopy(®2, pDst->pCompositeClip); - RegionIntersect(®1, ®1, ®2); - - if (dirty_type != 0) - { - draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, 0); - } - else if (got_id) - { - num_clips = REGION_NUM_RECTS(®1); - - if (num_clips > 0) - { - rdpup_begin_update(); - - for (j = num_clips - 1; j >= 0; j--) - { - box = REGION_RECTS(®1)[j]; - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); - } - - rdpup_end_update(); - } - } - - RegionUninit(®1); - RegionUninit(®2); - } - else - { - box.x1 = p->x + xDst; - box.y1 = p->y + yDst; - box.x2 = box.x1 + width; - box.y2 = box.y1 + height; - - if (dirty_type != 0) - { - RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, 0); - RegionUninit(®1); - } - else if (got_id) - { - rdpup_begin_update(); - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); - rdpup_end_update(); - } - } - - if (reset_surface) - { - rdpup_switch_os_surface(-1); - } -} - -/******************************************************************************/ -void -rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, - PictFormatPtr maskFormat, - INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists, - GlyphPtr *glyphs) -{ - PictureScreenPtr ps; - int index; - - LLOGLN(10, ("rdpGlyphs:")); - LLOGLN(10, ("rdpGlyphs: nlists %d len %d", nlists, lists->len)); - rdpup_set_hints(1, 1); - g_doing_font = 1; - - for (index = 0; index < lists->len; index++) - { - LLOGLN(10, (" index %d size %d refcnt %d width %d height %d", - index, (int)(glyphs[index]->size), (int)(glyphs[index]->refcnt), - glyphs[index]->info.width, glyphs[index]->info.height)); - } - - ps = GetPictureScreen(g_pScreen); - ps->Glyphs = g_rdpScreen.Glyphs; - ps->Glyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, - nlists, lists, glyphs); - ps->Glyphs = rdpGlyphs; - rdpup_set_hints(0, 1); - g_doing_font = 0; - LLOGLN(10, ("rdpGlyphs: out")); -} diff --git a/xorg/X11R7.6/rdp/rdpglyph.c b/xorg/X11R7.6/rdp/rdpglyph.c new file mode 100644 index 00000000..cb895ae5 --- /dev/null +++ b/xorg/X11R7.6/rdp/rdpglyph.c @@ -0,0 +1,862 @@ +/* + Copyright 2012 Jay Sorg + + Permission to use, copy, modify, distribute, and sell this software and its + documentation for any purpose is hereby granted without fee, provided that + the above copyright notice appear in all copies and that both that + copyright notice and this permission notice appear in supporting + documentation. + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + */ + +/* + http://msdn.microsoft.com/en-us/library/cc241863(v=prot.20).aspx + 4.6.1 "d" Character + This topic has not yet been rated - Rate this topic + The following shows glyph image data (1 bpp format) for character + "d" extracted from a Cache Glyph (Revision 2) (section 2.2.2.2.1.2.6) + Secondary Drawing Order. + + Glyph width = 5 pixels + Glyph height = 9 pixels + Glyph origin = (0, -9), marked with an "X" on the image grid + Bitmap = { 0x08, 0x08, 0x08, 0x78, 0x88, 0x88, 0x88, 0x88, 0x78 } + + http://msdn.microsoft.com/en-us/library/cc241864(v=prot.20).aspx + 4.6.2 "p" Character + This topic has not yet been rated - Rate this topic + The following shows glyph image data (1 bpp format) for character + "p" extracted from a Cache Glyph (Revision 2) (section 2.2.2.2.1.2.6) + Secondary Drawing Order. + + Glyph width = 5 pixels + Glyph height = 8 pixels + Glyph origin = (0, -6), marked with an "X" on the image grid + Bitmap = { 0xF0, 0x88, 0x88, 0x88, 0x88, 0xF0, 0x80, 0x80 } + */ + +#include "rdp.h" +#include "rdpdraw.h" +#include "rdpglyph.h" + +extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ +extern int g_do_alpha_glyphs; /* in rdpmain.c */ +extern int g_do_glyph_cache; /* in rdpmain.c */ +extern int g_doing_font; /* in rdpmain.c */ +extern ScreenPtr g_pScreen; /* in rdpmain.c */ +extern rdpScreenInfoRec g_rdpScreen; /* in rdpmain.c */ + + +#define LOG_LEVEL 1 +#define LLOG(_level, _args) \ +do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0) +#define LLOGLN(_level, _args) \ +do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +struct font_cache +{ + int offset; + int baseline; + int width; + int height; + int crc; + int stamp; +}; + +static struct font_cache g_font_cache[12][256]; +static int g_stamp = 0; + +/*****************************************************************************/ +static void +set_mono_pixel(char* data, int x, int y, int width, int pixel) +{ + int start; + int shift; + + width = (width + 7) / 8; + start = (y * width) + x / 8; + shift = x % 8; + if (pixel != 0) + { + data[start] = data[start] | (0x80 >> shift); + } + else + { + data[start] = data[start] & ~(0x80 >> shift); + } +} + +/*****************************************************************************/ +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) +{ + int i; + int j; + int src_xoff; + int src_yoff; + int src_stride_bytes; + int dst_stride_bytes; + int hh; + int ww; + int src_depth; + unsigned char pixel; + PicturePtr pPicture; + pixman_image_t *src; + uint32_t* pi32; + char* pi8; + + pPicture = GlyphPicture(glyph)[pScreen->myNum]; + if (pPicture == 0) + { + return 0; + } + src = image_from_pict(pPicture, FALSE, &src_xoff, &src_yoff); + if (src == 0) + { + return 0; + } + + src_stride_bytes = pixman_image_get_stride(src); + if (g_do_alpha_glyphs) + { + dst_stride_bytes = (glyph->info.width + 3) & ~3; + rfd->bpp = 8; + } + else + { + 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 = lget_pixel(pi8, i, j, src_depth, src_stride_bytes); + if (g_do_alpha_glyphs) + { + rfd->data[j * dst_stride_bytes + i] = pixel; + } + else + { + if (pixel > 0x7f) + { + set_mono_pixel(rfd->data, i, j, rfd->width, 1); + } + else + { + set_mono_pixel(rfd->data, i, j, rfd->width, 0); + } + } + } + } + free_pixman_pict(pPicture, src); + return 0; +} + +/******************************************************************************/ +struct rdp_text* +create_rdp_text(ScreenPtr pScreen, int nlists, GlyphListPtr lists, + GlyphPtr* glyphs) +{ + struct rdp_text* rv; + struct rdp_text* rtext; + struct rdp_text* last_rtext; + BoxRec box; + RegionRec reg1; + int n; + int lxoff; + int lyoff; + int count; + int lx; + int ly; + int font_index; + int max_height; + int min_height; + int force_new; + GlyphPtr glyph; + struct rdp_font_char* rfd; + + LLOGLN(10, ("create_rdp_text: nlists %d", nlists)); + + max_height = 0; + min_height = 0x7fffffff; + lx = lists->xOff; + ly = lists->yOff; + lxoff = 0; + lyoff = 0; + force_new = 0; + + rtext = (struct rdp_text*)g_malloc(sizeof(struct rdp_text), 1); + rtext->reg = RegionCreate(NullBox, 0); + rtext->flags = 3; + rtext->mixmode = 0; + rtext->x = lx; + rtext->y = ly; + + rv = rtext; + last_rtext = rtext; + + count = 0; + while (nlists--) + { + LLOGLN(10, ("lists->xOff %d lists->yOff %d", lists->xOff, lists->yOff)); + if (count != 0) + { + lx += lists->xOff; + ly += lists->yOff; + force_new = 1; + } + count++; + n = lists->len; + lists++; + while (n--) + { + glyph = *glyphs++; + /* process glyph here */ + if ((glyph->info.width > 0) && (glyph->info.height > 0)) + { + if (force_new) + { + LLOGLN(10, ("create_rdp_text: too many chars")); + force_new = 0; + rtext = (struct rdp_text*)g_malloc(sizeof(struct rdp_text), 1); + rtext->reg = RegionCreate(NullBox, 0); + rtext->flags = 3; + rtext->mixmode = 0; + rtext->x = lx; + rtext->y = ly; + last_rtext->next = rtext; + last_rtext = rtext; + lxoff = 0; + lyoff = 0; + } + LLOGLN(10, ("x %d y %d width %d height %d xOff %d yOff %d " + "num_chars %d lxoff %d lyoff %d lx %d ly %d", + glyph->info.x, glyph->info.y, + glyph->info.width, glyph->info.height, + glyph->info.xOff, glyph->info.yOff, rtext->num_chars, + lxoff, lyoff, lx, ly)); + rfd = (struct rdp_font_char*)g_malloc(sizeof(struct rdp_font_char), 1); + rtext->chars[rtext->num_chars] = rfd; + box.x1 = lx - glyph->info.x; + box.y1 = ly - glyph->info.y; + box.x2 = box.x1 + glyph->info.width; + box.y2 = box.y1 + glyph->info.height; + if (glyph->info.height > max_height) + { + max_height = glyph->info.height; + } + if (glyph->info.height < min_height) + { + min_height = glyph->info.height; + } + RegionInit(®1, &box, 0); + RegionUnion(rtext->reg, ®1, rtext->reg); + RegionUninit(®1); + + glyph_get_data(pScreen, glyph, rfd); + + rfd->incby = lxoff; + lxoff = glyph->info.xOff; + lyoff = glyph->info.yOff; + rtext->num_chars++; + if (rtext->num_chars > 63) + { + force_new = 1; + } + } + else + { + lxoff += glyph->info.xOff; + lyoff += glyph->info.yOff; + } + lx += glyph->info.xOff; + ly += glyph->info.yOff; + } + } + if (max_height > 10) + { + font_index = 8; + } + else if (max_height < 7) + { + font_index = 6; + } + else + { + font_index = 7; + } + LLOGLN(10, ("create_rdp_text: min_height %d max_height %d font_index %d", + min_height, max_height, font_index)); + rtext = rv; + while (rtext != 0) + { + rtext->font = font_index; + rtext = rtext->next; + } + return rv; +} + +/******************************************************************************/ +int +delete_rdp_text(struct rdp_text* rtext) +{ + int index; + + if (rtext == 0) + { + return 0; + } + for (index = 0; index < rtext->num_chars; index++) + { + if (rtext->chars[index] != 0) + { + g_free(rtext->chars[index]->data); + g_free(rtext->chars[index]); + } + } + RegionDestroy(rtext->reg); + delete_rdp_text(rtext->next); + g_free(rtext); + return 0; +} + +/******************************************************************************/ +static int +get_color(PicturePtr pPicture) +{ + int src_xoff; + int src_yoff; + int rv; + uint32_t* pi32; + pixman_image_t *src; + + src = image_from_pict(pPicture, FALSE, &src_xoff, &src_yoff); + if (src == 0) + { + return 0; + } + pi32 = pixman_image_get_data(src); + if (pi32 == 0) + { + return 0; + } + rv = *pi32; + LLOGLN(10, ("get_color: 0x%8.8x width %d height %d ", rv, + pixman_image_get_width(src), + pixman_image_get_height(src))); + free_pixman_pict(pPicture, src); + return rv; +} + +/******************************************************************************/ +static int +find_or_add_char(int font, struct rdp_font_char* rfd) +{ + int crc; + int index; + int char_index; + int oldest; + + crc = get_crc(rfd->data, rfd->data_bytes); + LLOGLN(10, ("find_or_add_char: crc 0x%8.8x", crc)); + char_index = 0; + oldest = 0x7fffffff; + for (index = 0; index < 250; index++) + { + if ((g_font_cache[font][index].crc == crc) && + (g_font_cache[font][index].width == rfd->width) && + (g_font_cache[font][index].height == rfd->height) && + (g_font_cache[font][index].offset == rfd->offset) && + (g_font_cache[font][index].baseline == rfd->baseline)) + { + g_stamp++; + g_font_cache[font][index].stamp = g_stamp; + LLOGLN(10, ("find_or_add_char: found char at %d %d", font, index)); + return index; + } + if (g_font_cache[font][index].stamp < oldest) + { + oldest = g_font_cache[font][index].stamp; + char_index = index; + } + } + g_stamp++; + g_font_cache[font][char_index].stamp = g_stamp; + g_font_cache[font][char_index].crc = crc; + g_font_cache[font][char_index].width = rfd->width; + g_font_cache[font][char_index].height = rfd->height; + g_font_cache[font][char_index].offset = rfd->offset; + g_font_cache[font][char_index].baseline = rfd->baseline; + LLOGLN(10, ("find_or_add_char: adding char at %d %d", font, char_index)); + if (rfd->bpp == 8) + { + rdpup_add_char_alpha(font, char_index, rfd->offset, rfd->baseline, + rfd->width, rfd->height, + rfd->data, rfd->data_bytes); + } + else + { + rdpup_add_char(font, char_index, rfd->offset, rfd->baseline, + rfd->width, rfd->height, + rfd->data, rfd->data_bytes); + } + return char_index; +} + +/******************************************************************************/ +int +rdp_text_chars_to_data(struct rdp_text* rtext) +{ + int index; + int data_bytes; + int char_index; + struct rdp_font_char* rfd; + + LLOGLN(10, ("rdp_text_chars_to_data: rtext->num_chars %d", rtext->num_chars)); + data_bytes = 0; + for (index = 0; index < rtext->num_chars; index++) + { + rfd = rtext->chars[index]; + if (rfd == 0) + { + LLOGLN(0, ("rdp_text_chars_to_data: error rfd is nil")); + continue; + } + char_index = find_or_add_char(rtext->font, rfd); + rtext->data[data_bytes] = char_index; + data_bytes++; + if (rfd->incby > 127) + { + rtext->data[data_bytes] = 0x80; + data_bytes++; + rtext->data[data_bytes] = (rfd->incby >> 0) & 0xff; + data_bytes++; + rtext->data[data_bytes] = (rfd->incby >> 8) & 0xff; + data_bytes++; + } + else + { + rtext->data[data_bytes] = rfd->incby; + data_bytes++; + } + } + rtext->data_bytes = data_bytes; + return 0; +} + +/******************************************************************************/ +/* + typedef struct _GlyphList { + INT16 xOff; + INT16 yOff; + CARD8 len; + PictFormatPtr format; + } GlyphListRec, *GlyphListPtr; + */ +/* see ghyphstr.h but the follow is not in there + typedef struct _XGlyphInfo { + unsigned short width; + unsigned short height; + short x; + short y; + short xOff; + short yOff; + } XGlyphInfo; + */ +static void +rdpGlyphu(CARD8 op, PicturePtr pSrc, PicturePtr pDst, + PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, + int nlists, GlyphListPtr lists, GlyphPtr* glyphs, + BoxPtr extents) +{ + BoxRec box; + RegionRec reg1; + RegionRec reg2; + DrawablePtr p; + int dirty_type; + int j; + int num_clips; + int post_process; + int reset_surface; + int got_id; + int fg_color; + WindowPtr pDstWnd; + PixmapPtr pDstPixmap; + rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; + struct image_data id; + struct rdp_text* rtext; + struct rdp_text* trtext; + + LLOGLN(10, ("rdpGlyphu: xSrc %d ySrc %d", xSrc, ySrc)); + + p = pDst->pDrawable; + + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; + got_id = 0; + if (p->type == DRAWABLE_PIXMAP) + { + pDstPixmap = (PixmapPtr)p; + pDstPriv = GETPIXPRIV(pDstPixmap); + if (XRDP_IS_OS(pDstPriv)) + { + rdpup_check_dirty(pDstPixmap, pDstPriv); + post_process = 1; + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpGlyphu: gettig dirty")); + pDstPriv->is_dirty = 1; + dirty_type = RDI_IMGLL; + pDirtyPriv = pDstPriv; + + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + LLOGLN(10, ("rdpGlyphu: offscreen")); + } + } + } + else + { + if (p->type == DRAWABLE_WINDOW) + { + pDstWnd = (WindowPtr)p; + if (pDstWnd->viewable) + { + post_process = 1; + rdpup_get_screen_image_rect(&id); + got_id = 1; + LLOGLN(10, ("rdpGlyphu: screen")); + } + } + } + if (!post_process) + { + return; + } + + rtext = create_rdp_text(pDst->pDrawable->pScreen, nlists, lists, glyphs); + if (rtext == 0) + { + LLOGLN(0, ("rdpGlyphu: create_rdp_text failed")); + return; + } + fg_color = get_color(pSrc); + + LLOGLN(10, ("rdpGlyphu: pDst->clientClipType %d pCompositeClip %p", + pDst->clientClipType, pDst->pCompositeClip)); + + if (pDst->pCompositeClip != 0) + { + box.x1 = p->x + extents->x1; + box.y1 = p->y + extents->y1; + box.x2 = p->x + extents->x2; + box.y2 = p->y + extents->y2; + RegionInit(®1, &box, 0); + RegionInit(®2, NullBox, 0); + RegionCopy(®2, pDst->pCompositeClip); + RegionIntersect(®1, ®1, ®2); + if (dirty_type != 0) + { + LLOGLN(10, ("1")); + draw_item_add_text_region(pDirtyPriv, ®1, fg_color, GXcopy, rtext); + rtext = 0; + } + else if (got_id) + { + num_clips = REGION_NUM_RECTS(®1); + if (num_clips > 0) + { + LLOGLN(10, (" num_clips %d", num_clips)); + rdpup_begin_update(); + rdpup_set_fgcolor(fg_color); + trtext = rtext; + while (trtext != 0) + { + rdp_text_chars_to_data(trtext); + for (j = num_clips - 1; j >= 0; j--) + { + box = REGION_RECTS(®1)[j]; + LLOGLN(10, ("2")); + rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + LLOGLN(10, ("rdpGlyphu: rdpup_draw_text")); + box = RegionExtents(trtext->reg)[0]; + rdpup_draw_text(trtext->font, trtext->flags, trtext->mixmode, + box.x1 + p->x, box.y1 + p->y, + box.x2 + p->x, box.y2 + p->y, + //box.x1 + p->x, box.y1 + p->y, + //box.x2 + p->x, box.y2 + p->y, + 0, 0, 0, 0, + trtext->x + p->x, trtext->y + p->y, + trtext->data, trtext->data_bytes); + } + trtext = trtext->next; + } + rdpup_reset_clip(); + rdpup_end_update(); + } + } + RegionUninit(®1); + RegionUninit(®2); + } + else + { + box.x1 = p->x + extents->x1; + box.y1 = p->y + extents->y1; + box.x2 = p->x + extents->x2; + box.y2 = p->y + extents->y2; + if (dirty_type != 0) + { + RegionInit(®1, &box, 0); + LLOGLN(10, ("3")); + draw_item_add_text_region(pDirtyPriv, ®1, fg_color, GXcopy, rtext); + rtext = 0; + RegionUninit(®1); + } + else if (got_id) + { + rdpup_begin_update(); + LLOGLN(10, ("4")); + rdpup_set_fgcolor(fg_color); + trtext = rtext; + while (trtext != 0) + { + LLOGLN(10, ("rdpGlyphu: rdpup_draw_text")); + rdp_text_chars_to_data(trtext); + box = RegionExtents(trtext->reg)[0]; + rdpup_draw_text(trtext->font, trtext->flags, trtext->mixmode, + box.x1 + p->x, box.y1 + p->y, + box.x2 + p->x, box.y2 + p->y, + //box.x1 + p->x, box.y1 + p->y, + //box.x2 + p->x, box.y2 + p->y, + 0, 0, 0, 0, + trtext->x + p->x, trtext->y + p->y, + trtext->data, trtext->data_bytes); + trtext = trtext->next; + } + rdpup_end_update(); + } + } + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } + delete_rdp_text(rtext); +} + +/******************************************************************************/ +static void +GlyphExtents(int nlist, GlyphListPtr list, GlyphPtr* glyphs, BoxPtr extents) +{ + int x1; + int x2; + int y1; + int y2; + int n; + int x; + int y; + GlyphPtr glyph; + + x = 0; + y = 0; + extents->x1 = MAXSHORT; + extents->x2 = MINSHORT; + extents->y1 = MAXSHORT; + extents->y2 = MINSHORT; + while (nlist--) + { + x += list->xOff; + y += list->yOff; + n = list->len; + list++; + while (n--) + { + glyph = *glyphs++; + x1 = x - glyph->info.x; + if (x1 < MINSHORT) + { + x1 = MINSHORT; + } + y1 = y - glyph->info.y; + if (y1 < MINSHORT) + { + y1 = MINSHORT; + } + x2 = x1 + glyph->info.width; + if (x2 > MAXSHORT) + { + x2 = MAXSHORT; + } + y2 = y1 + glyph->info.height; + if (y2 > MAXSHORT) + { + y2 = MAXSHORT; + } + if (x1 < extents->x1) + { + extents->x1 = x1; + } + if (x2 > extents->x2) + { + extents->x2 = x2; + } + if (y1 < extents->y1) + { + extents->y1 = y1; + } + if (y2 > extents->y2) + { + extents->y2 = y2; + } + x += glyph->info.xOff; + y += glyph->info.yOff; + } + } +} + +/******************************************************************************/ +static void +rdpGlypht(CARD8 op, PicturePtr pSrc, PicturePtr pDst, + PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, + int nlists, GlyphListPtr lists, GlyphPtr* glyphs) +{ + BoxRec extents; + + GlyphExtents(nlists, lists, glyphs, &extents); + if ((extents.x2 <= extents.x1) || (extents.y2 <= extents.y1)) + { + return; + } + rdpGlyphu(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlists, lists, + glyphs, &extents); +} + +/******************************************************************************/ +/* make sure no glyph is too big */ +/* returns boolean */ +static int +rdpGlyphCheck(int nlist, GlyphListPtr list, GlyphPtr* glyphs) +{ + int n; + GlyphPtr glyph; + + while (nlist--) + { + n = list->len; + list++; + while (n--) + { + glyph = *glyphs++; + if ((glyph->info.width * glyph->info.height) > 8192) + { + LLOGLN(10, ("rdpGlyphCheck: too big")); + return 0; + } + } + } + return 1; +} + +/******************************************************************************/ +void +rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists, + GlyphPtr* glyphs) +{ + PictureScreenPtr ps; + + LLOGLN(10, ("rdpGlyphs: op %d xSrc %d ySrc %d maskFormat %p", + op, xSrc, ySrc, maskFormat)); + + LLOGLN(10, ("rdpGlyphs: g_do_glyph_cache %d", g_do_glyph_cache)); + + if (g_do_glyph_cache && rdpGlyphCheck(nlists, lists, glyphs)) + { + g_doing_font = 2; + rdpGlypht(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlists, lists, glyphs); + ps = GetPictureScreen(g_pScreen); + ps->Glyphs = g_rdpScreen.Glyphs; + ps->Glyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, + nlists, lists, glyphs); + ps->Glyphs = rdpGlyphs; + } + else + { + g_doing_font = 1; + rdpup_set_hints(1, 1); + ps = GetPictureScreen(g_pScreen); + ps->Glyphs = g_rdpScreen.Glyphs; + ps->Glyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, + nlists, lists, glyphs); + ps->Glyphs = rdpGlyphs; + rdpup_set_hints(0, 1); + } + g_doing_font = 0; + LLOGLN(10, ("rdpGlyphs: out")); +} + +/******************************************************************************/ +int +rdpGlyphInit(void) +{ + memset(&g_font_cache, 0, sizeof(g_font_cache)); + return 0; +} diff --git a/xorg/X11R7.6/rdp/rdpglyph.h b/xorg/X11R7.6/rdp/rdpglyph.h new file mode 100644 index 00000000..6907f9e7 --- /dev/null +++ b/xorg/X11R7.6/rdp/rdpglyph.h @@ -0,0 +1,64 @@ +/* +Copyright 2012-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef __RDPGLYPH_H +#define __RDPGLYPH_H + +struct rdp_font_char +{ + int offset; /* x */ + int baseline; /* y */ + int width; /* cx */ + int height; /* cy */ + int incby; + int bpp; + char* data; + int data_bytes; +}; + +struct rdp_text +{ + RegionPtr reg; + int font; + int x; + int y; + int flags; + int mixmode; + char data[256]; + int data_bytes; + struct rdp_font_char* chars[256]; + int num_chars; + struct rdp_text* next; +}; + +int +delete_rdp_text(struct rdp_text* rtext); +int +rdp_text_chars_to_data(struct rdp_text* rtext); + +void +rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, + PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, + int nlists, GlyphListPtr lists, GlyphPtr* glyphs); +int +rdpGlyphInit(void); + +#endif diff --git a/xorg/X11R7.6/rdp/rdpinput.c b/xorg/X11R7.6/rdp/rdpinput.c index 39cd78dd..c8739ba0 100644 --- a/xorg/X11R7.6/rdp/rdpinput.c +++ b/xorg/X11R7.6/rdp/rdpinput.c @@ -44,6 +44,12 @@ keyboard and mouse stuff #define DEBUG_OUT_INPUT(arg) ErrorF arg #endif +#define LOG_LEVEL 1 +#define LLOG(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0) +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + extern ScreenPtr g_pScreen; /* in rdpmain.c */ extern DeviceIntPtr g_pointer; /* in rdpmain.c */ extern DeviceIntPtr g_keyboard; /* in rdpmain.c */ @@ -58,6 +64,13 @@ static int g_tab_down = 0; /* this is toggled every time num lock key is released, not like the above *_down vars */ static int g_scroll_lock_down = 0; +static OsTimerPtr g_kbtimer = 0; + +static OsTimerPtr g_timer = 0; +static int g_x = 0; +static int g_y = 0; +static int g_timer_schedualed = 0; +static int g_delay_motion = 1; /* turn on or off */ #define MIN_KEY_CODE 8 #define MAX_KEY_CODE 255 @@ -315,10 +328,57 @@ rdpBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls) } /******************************************************************************/ +static CARD32 +rdpInDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg) +{ + //ErrorF("rdpInDeferredUpdateCallback:\n"); + + /* our keyboard device */ + XkbSetRepeatKeys(g_keyboard, -1, AutoRepeatModeOff); + /* the main one for the server */ + XkbSetRepeatKeys(inputInfo.keyboard, -1, AutoRepeatModeOff); + + return 0; +} + +/******************************************************************************/ void rdpChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl) { + XkbControlsPtr ctrls; + ErrorF("rdpChangeKeyboardControl:\n"); + ctrls = 0; + if (pDev != 0) + { + if (pDev->key != 0) + { + if (pDev->key->xkbInfo != 0) + { + if (pDev->key->xkbInfo->desc != 0) + { + if (pDev->key->xkbInfo->desc->ctrls != 0) + { + ctrls = pDev->key->xkbInfo->desc->ctrls; + } + } + } + } + } + if (ctrls != 0) + { + if (ctrls->enabled_ctrls & XkbRepeatKeysMask) + { + //ErrorF("rdpChangeKeyboardControl: autoRepeat on\n"); + /* schedual to turn off the autorepeat after 100 ms so any app + * polling it will be happy it's on */ + g_kbtimer = TimerSet(g_kbtimer, 0, 100, rdpInDeferredUpdateCallback, 0);\ + } + else + { + //ErrorF("rdpChangeKeyboardControl: autoRepeat off\n"); + } + } } /******************************************************************************/ @@ -407,9 +467,9 @@ rdpMouseCtrl(DeviceIntPtr pDevice, PtrCtrl *pCtrl) int rdpMouseProc(DeviceIntPtr pDevice, int onoff) { - BYTE map[6]; + BYTE map[8]; DevicePtr pDev; - Atom btn_labels[6]; + Atom btn_labels[8]; Atom axes_labels[2]; DEBUG_OUT_INPUT(("rdpMouseProc\n")); @@ -425,17 +485,21 @@ rdpMouseProc(DeviceIntPtr pDevice, int onoff) map[3] = 3; map[4] = 4; map[5] = 5; + map[6] = 6; + map[7] = 7; btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT); btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE); btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP); btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN); + btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT); + btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT); axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X); axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); - InitPointerDeviceStruct(pDev, map, 5, btn_labels, rdpMouseCtrl, + InitPointerDeviceStruct(pDev, map, 7, btn_labels, rdpMouseCtrl, GetMotionHistorySize(), 2, axes_labels); break; @@ -744,12 +808,13 @@ rdpEnqueueMotion(int x, int y) EventListPtr rdp_events; xEvent *pev; + LLOGLN(10, ("rdpEnqueueMotion: x %d y %d", x, y)); # if 0 if (x < 128) { rdpup_begin_update(); - rdpup_send_area(0, 0, 1024, 768); + rdpup_send_area(0, 0, 0, 1024, 768); rdpup_end_update(); } @@ -779,6 +844,7 @@ rdpEnqueueButton(int type, int buttons) EventListPtr rdp_events; xEvent *pev; + LLOGLN(10, ("rdpEnqueueButton:")); i = GetEventList(&rdp_events); n = GetPointerEvents(rdp_events, g_pointer, type, buttons, 0, 0, 0, 0); @@ -809,35 +875,66 @@ rdpEnqueueKey(int type, int scancode) } /******************************************************************************/ +static CARD32 +rdpDeferredInputCallback(OsTimerPtr timer, CARD32 now, pointer arg) +{ + LLOGLN(10, ("rdpDeferredInputCallback:")); + g_timer_schedualed = 0; + rdpEnqueueMotion(g_x, g_y); + return 0; +} + +/******************************************************************************/ void PtrAddEvent(int buttonMask, int x, int y) { int i; int type; int buttons; + int send_now; - rdpEnqueueMotion(x, y); - - for (i = 0; i < 5; i++) + LLOGLN(10, ("PtrAddEvent: x %d y %d", x, y)); + send_now = (buttonMask ^ g_old_button_mask) || (g_delay_motion == 0); + LLOGLN(10, ("PtrAddEvent: send_now %d g_timer_schedualed %d", + send_now, g_timer_schedualed)); + if (send_now) { - if ((buttonMask ^ g_old_button_mask) & (1 << i)) + if (g_timer_schedualed) { - if (buttonMask & (1 << i)) - { - type = ButtonPress; - buttons = i + 1; - rdpEnqueueButton(type, buttons); - } - else + g_timer_schedualed = 0; + TimerCancel(g_timer); + } + rdpEnqueueMotion(x, y); + for (i = 0; i < 5; i++) + { + if ((buttonMask ^ g_old_button_mask) & (1 << i)) { - type = ButtonRelease; - buttons = i + 1; - rdpEnqueueButton(type, buttons); + if (buttonMask & (1 << i)) + { + type = ButtonPress; + buttons = i + 1; + rdpEnqueueButton(type, buttons); + } + else + { + type = ButtonRelease; + buttons = i + 1; + rdpEnqueueButton(type, buttons); + } } } + g_old_button_mask = buttonMask; + } + else + { + g_x = x; + g_y = y; + if (!g_timer_schedualed) + { + g_timer_schedualed = 1; + g_timer = TimerSet(g_timer, 0, 60, rdpDeferredInputCallback, 0); + } } - - g_old_button_mask = buttonMask; } /******************************************************************************/ @@ -916,9 +1013,13 @@ KbdAddEvent(int down, int param1, int param2, int param3, int param4) if (x_scancode > 0) { + /* left or right shift */ + if ((rdp_scancode == 42) || (rdp_scancode == 54)) + { + g_shift_down = down ? x_scancode : 0; + } rdpEnqueueKey(type, x_scancode); } - break; case 56: /* left - right alt button */ @@ -932,6 +1033,7 @@ KbdAddEvent(int down, int param1, int param2, int param3, int param4) x_scancode = 64; /* left alt button */ } + g_alt_down = down ? x_scancode : 0; rdpEnqueueKey(type, x_scancode); break; @@ -1065,6 +1167,14 @@ KbdAddEvent(int down, int param1, int param2, int param3, int param4) rdpEnqueueKey(type, 117); break; + case 89: /* left meta */ + rdpEnqueueKey(type, 156); + break; + + case 90: /* right meta */ + rdpEnqueueKey(type, 156); + break; + default: x_scancode = rdp_scancode + MIN_KEY_CODE; diff --git a/xorg/X11R7.6/rdp/rdpmain.c b/xorg/X11R7.6/rdp/rdpmain.c index f1645cfe..1b924db7 100644 --- a/xorg/X11R7.6/rdp/rdpmain.c +++ b/xorg/X11R7.6/rdp/rdpmain.c @@ -24,6 +24,7 @@ Sets up the functions #include "rdp.h" #include "rdprandr.h" +#include "rdpglyph.h" #if 1 #define DEBUG_OUT(arg) @@ -47,6 +48,9 @@ int g_can_do_pix_to_pix = 0; int g_do_dirty_os = 1; /* delay remoting off screen bitmaps */ int g_do_dirty_ons = 1; /* delay remoting screen */ +int g_do_glyph_cache = 0; /* rdpup.c may set this */ +int g_do_alpha_glyphs = 1; +int g_do_composite = 0; /* rdpup.c may set this */ Bool g_wrapWindow = 1; Bool g_wrapPixmap = 1; @@ -60,6 +64,7 @@ int g_use_rail = 0; int g_con_number = 0; /* increments for each connection */ WindowPtr g_invalidate_window = 0; +int g_doing_font = 0; /* if true, use a unix domain socket instead of a tcp socket */ int g_use_uds = 0; @@ -273,7 +278,8 @@ rdpScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) g_rdpScreen.sizeInBytes = (g_rdpScreen.paddedWidthInBytes * g_rdpScreen.height); ErrorF("buffer size %d\n", g_rdpScreen.sizeInBytes); - g_rdpScreen.pfbMemory = (char *)g_malloc(2048 * 2048 * 4, 1); + g_rdpScreen.pfbMemory = (char *)g_malloc(g_rdpScreen.sizeInBytes, 1); + g_rdpScreen.sizeInBytesAlloc = g_rdpScreen.sizeInBytes; } if (g_rdpScreen.pfbMemory == 0) @@ -397,6 +403,8 @@ rdpScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) if (ps) { + g_rdpScreen.CreatePicture = ps->CreatePicture; + g_rdpScreen.DestroyPicture = ps->DestroyPicture; g_rdpScreen.Composite = ps->Composite; g_rdpScreen.Glyphs = ps->Glyphs; @@ -410,6 +418,8 @@ rdpScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) if (ps) { + ps->CreatePicture = rdpCreatePicture; + ps->DestroyPicture = rdpDestroyPicture; ps->Composite = rdpComposite; ps->Glyphs = rdpGlyphs; } @@ -529,6 +539,8 @@ rdpScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) } + rdpGlyphInit(); + //rdpXvInit(pScreen); ErrorF("rdpScreenInit: ret %d\n", ret); diff --git a/xorg/X11R7.6/rdp/rdpmisc.c b/xorg/X11R7.6/rdp/rdpmisc.c index dc54581a..eb5bedad 100644 --- a/xorg/X11R7.6/rdp/rdpmisc.c +++ b/xorg/X11R7.6/rdp/rdpmisc.c @@ -27,6 +27,59 @@ the rest Bool noFontCacheExtension = 1; +static int g_crc_seed = 0xffffffff; +static int g_crc_table[256] = +{ + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, + 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, + 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, + 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, + 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, + 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, + 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, + 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, + 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, + 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, + 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, + 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, + 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, + 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, + 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, + 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, + 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, + 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d +}; + +#define CRC_START(in_crc) (in_crc) = g_crc_seed +#define CRC_PASS(in_pixel, in_crc) \ + (in_crc) = g_crc_table[((in_crc) ^ (in_pixel)) & 0xff] ^ ((in_crc) >> 8) +#define CRC_END(in_crc) (in_crc) = ((in_crc) ^ g_crc_seed) + /******************************************************************************/ /* print a time-stamped message to the log file (stderr). */ void @@ -599,3 +652,19 @@ RegionAroundSegs(RegionPtr reg, xSegment *segs, int nseg) index++; } } + +/******************************************************************************/ +int +get_crc(char* data, int data_bytes) +{ + int crc; + int index; + + CRC_START(crc); + for (index = 0; index < data_bytes; index++) + { + CRC_PASS(data[index], crc); + } + CRC_END(crc); + return crc; +} diff --git a/xorg/X11R7.6/rdp/rdprandr.c b/xorg/X11R7.6/rdp/rdprandr.c index a767b1d8..8b3eb582 100644 --- a/xorg/X11R7.6/rdp/rdprandr.c +++ b/xorg/X11R7.6/rdp/rdprandr.c @@ -156,6 +156,13 @@ rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, ErrorF(" resizing screenPixmap [%p] to %dx%d, currently at %dx%d\n", (void *)screenPixmap, width, height, screenPixmap->drawable.width, screenPixmap->drawable.height); + if (g_rdpScreen.sizeInBytes > g_rdpScreen.sizeInBytesAlloc) + { + g_free(g_rdpScreen.pfbMemory); + g_rdpScreen.pfbMemory = (char*)g_malloc(g_rdpScreen.sizeInBytes, 1); + g_rdpScreen.sizeInBytesAlloc = g_rdpScreen.sizeInBytes; + ErrorF("new buffer size %d\n", g_rdpScreen.sizeInBytes); + } pScreen->ModifyPixmapHeader(screenPixmap, width, height, g_rdpScreen.depth, g_rdpScreen.bitsPerPixel, g_rdpScreen.paddedWidthInBytes, diff --git a/xorg/X11R7.6/rdp/rdpup.c b/xorg/X11R7.6/rdp/rdpup.c index 06c8bd73..52472121 100644 --- a/xorg/X11R7.6/rdp/rdpup.c +++ b/xorg/X11R7.6/rdp/rdpup.c @@ -21,6 +21,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "rdp.h" #include "xrdp_rail.h" +#include "rdpglyph.h" + +#include <signal.h> +#include <sys/ipc.h> +#include <sys/shm.h> +#include <sys/types.h> #define LOG_LEVEL 1 #define LLOG(_level, _args) \ @@ -28,6 +34,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define LLOGLN(_level, _args) \ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) +static int g_use_shmem = 1; /* turns on or off */ +static int g_shmemid = 0; +static char *g_shmemptr = 0; +static int g_shmem_lineBytes = 0; +static RegionPtr g_shm_reg = 0; + +static int g_rect_id_ack = 0; +static int g_rect_id = 0; + static int g_listen_sck = 0; static int g_sck = 0; static int g_sck_closed = 0; @@ -53,8 +68,10 @@ 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 */ +extern int g_do_composite; /* from rdpmain.c */ /* true is to use unix domain socket */ extern int g_use_uds; /* in rdpmain.c */ @@ -71,9 +88,12 @@ struct rdpup_os_bitmap int stamp; }; +#define USE_MAX_OS_BYTES 1 +#define MAX_OS_BYTES (16 * 1024 * 1024) static struct rdpup_os_bitmap *g_os_bitmaps = 0; static int g_max_os_bitmaps = 0; static int g_os_bitmap_stamp = 0; +static int g_os_bitmap_alloc_size = 0; static int g_pixmap_byte_total = 0; static int g_pixmap_num_used = 0; @@ -123,12 +143,70 @@ static int g_rdp_opcodes[16] = 0xff /* GXset 0xf 1 */ }; +static int g_do_kill_disconnected = 0; /* turn on or off */ +static OsTimerPtr g_dis_timer = 0; +static int g_disconnect_scheduled = 0; +static CARD32 g_disconnect_timeout_s = 60; /* 60 seconds */ +static CARD32 g_disconnect_time_ms = 0; /* time of disconnect in milliseconds */ + +static int g_do_multimon = 0; /* multimon - turn on or off */ + +/******************************************************************************/ +static CARD32 +rdpDeferredDisconnectCallback(OsTimerPtr timer, CARD32 now, pointer arg) +{ + CARD32 lnow_ms; + + LLOGLN(10, ("rdpDeferredDisconnectCallback")); + if (g_connected) + { + /* this should not happen */ + LLOGLN(0, ("rdpDeferredDisconnectCallback: connected")); + if (g_dis_timer != 0) + { + LLOGLN(0, ("rdpDeferredDisconnectCallback: canceling g_dis_timer")); + TimerCancel(g_dis_timer); + TimerFree(g_dis_timer); + g_dis_timer = 0; + } + g_disconnect_scheduled = 0; + return 0; + } + else + { + LLOGLN(10, ("rdpDeferredDisconnectCallback: not connected")); + } + lnow_ms = GetTimeInMillis(); + if (lnow_ms - g_disconnect_time_ms > g_disconnect_timeout_s * 1000) + { + LLOGLN(0, ("rdpDeferredDisconnectCallback: exit X11rdp")); + kill(getpid(), SIGTERM); + return 0; + } + g_dis_timer = TimerSet(g_dis_timer, 0, 1000 * 10, + rdpDeferredDisconnectCallback, 0); + return 0; +} + /*****************************************************************************/ static int rdpup_disconnect(void) { int index; + LLOGLN(0, ("rdpup_disconnect:")); + if (g_do_kill_disconnected) + { + if (!g_disconnect_scheduled) + { + LLOGLN(0, ("rdpup_disconnect: starting g_dis_timer")); + g_dis_timer = TimerSet(g_dis_timer, 0, 1000 * 10, + rdpDeferredDisconnectCallback, 0); + g_disconnect_scheduled = 1; + } + g_disconnect_time_ms = GetTimeInMillis(); + } + RemoveEnabledDevice(g_sck); g_connected = 0; g_tcp_close(g_sck); @@ -151,15 +229,19 @@ rdpup_disconnect(void) } } } + g_os_bitmap_alloc_size = 0; g_max_os_bitmaps = 0; g_free(g_os_bitmaps); g_os_bitmaps = 0; g_use_rail = 0; + g_do_glyph_cache = 0; + g_do_composite = 0; return 0; } /*****************************************************************************/ +/* returns -1 on error */ int rdpup_add_os_bitmap(PixmapPtr pixmap, rdpPixmapPtr priv) { @@ -167,17 +249,32 @@ rdpup_add_os_bitmap(PixmapPtr pixmap, rdpPixmapPtr priv) int rv; int oldest; int oldest_index; + int this_bytes; + LLOGLN(10, ("rdpup_add_os_bitmap:")); if (!g_connected) { + LLOGLN(10, ("rdpup_add_os_bitmap: test error 1")); return -1; } if (g_os_bitmaps == 0) { + LLOGLN(10, ("rdpup_add_os_bitmap: test error 2")); + return -1; + } + + this_bytes = pixmap->devKind * pixmap->drawable.height; + if (this_bytes > MAX_OS_BYTES) + { + LLOGLN(10, ("rdpup_add_os_bitmap: error, too big this_bytes %d " + "width %d height %d", this_bytes, + pixmap->drawable.height, pixmap->drawable.height)); return -1; } + oldest = 0x7fffffff; + oldest_index = -1; rv = -1; index = 0; @@ -194,42 +291,83 @@ rdpup_add_os_bitmap(PixmapPtr pixmap, rdpPixmapPtr priv) rv = index; break; } - + else + { + if (g_os_bitmaps[index].stamp < oldest) + { + oldest = g_os_bitmaps[index].stamp; + oldest_index = index; + } + } index++; } if (rv == -1) { + if (oldest_index == -1) + { + LLOGLN(0, ("rdpup_add_os_bitmap: error")); + } + else + { + LLOGLN(10, ("rdpup_add_os_bitmap: too many pixmaps removing " + "oldest_index %d", oldest_index)); + rdpup_remove_os_bitmap(oldest_index); + rdpup_delete_os_surface(oldest_index); + g_os_bitmaps[oldest_index].used = 1; + g_os_bitmaps[oldest_index].pixmap = pixmap; + g_os_bitmaps[oldest_index].priv = priv; + g_os_bitmaps[oldest_index].stamp = g_os_bitmap_stamp; + g_os_bitmap_stamp++; + g_pixmap_num_used++; + rv = oldest_index; + } + } + + if (rv < 0) + { + LLOGLN(10, ("rdpup_add_os_bitmap: test error 3")); + return rv; + } + + g_os_bitmap_alloc_size += this_bytes; + LLOGLN(10, ("rdpup_add_os_bitmap: this_bytes %d g_os_bitmap_alloc_size %d", + this_bytes, g_os_bitmap_alloc_size)); +#if USE_MAX_OS_BYTES + while (g_os_bitmap_alloc_size > MAX_OS_BYTES) + { + LLOGLN(10, ("rdpup_add_os_bitmap: must delete g_pixmap_num_used %d", + g_pixmap_num_used)); /* find oldest */ oldest = 0x7fffffff; - oldest_index = 0; + oldest_index = -1; index = 0; - while (index < g_max_os_bitmaps) { - if (g_os_bitmaps[index].stamp < oldest) + if (g_os_bitmaps[index].used && (g_os_bitmaps[index].stamp < oldest)) { oldest = g_os_bitmaps[index].stamp; oldest_index = index; } - index++; } - - LLOGLN(10, ("rdpup_add_os_bitmap: evicting old, oldest_index %d", oldest_index)); - /* evict old */ - g_os_bitmaps[oldest_index].priv->status = 0; - g_os_bitmaps[oldest_index].priv->con_number = 0; - /* set new */ - g_os_bitmaps[oldest_index].pixmap = pixmap; - g_os_bitmaps[oldest_index].priv = priv; - g_os_bitmaps[oldest_index].stamp = g_os_bitmap_stamp; - g_os_bitmap_stamp++; - rv = oldest_index; + if (oldest_index == -1) + { + LLOGLN(0, ("rdpup_add_os_bitmap: error 1")); + break; + } + if (oldest_index == rv) + { + LLOGLN(0, ("rdpup_add_os_bitmap: error 2")); + break; + } + rdpup_remove_os_bitmap(oldest_index); + rdpup_delete_os_surface(oldest_index); } - +#endif LLOGLN(10, ("rdpup_add_os_bitmap: new bitmap index %d", rv)); - LLOGLN(10, (" g_pixmap_num_used %d", g_pixmap_num_used)); + LLOGLN(10, ("rdpup_add_os_bitmap: g_pixmap_num_used %d " + "g_os_bitmap_stamp 0x%8.8x", g_pixmap_num_used, g_os_bitmap_stamp)); return rv; } @@ -237,31 +375,84 @@ rdpup_add_os_bitmap(PixmapPtr pixmap, rdpPixmapPtr priv) int rdpup_remove_os_bitmap(int rdpindex) { + PixmapPtr pixmap; + rdpPixmapPtr priv; + int this_bytes; + LLOGLN(10, ("rdpup_remove_os_bitmap: index %d stamp %d", - rdpindex, g_os_bitmaps[rdpindex].stamp)); + rdpindex, g_os_bitmaps[rdpindex].stamp)); if (g_os_bitmaps == 0) { + LLOGLN(10, ("rdpup_remove_os_bitmap: test error 1")); return 1; } if ((rdpindex < 0) && (rdpindex >= g_max_os_bitmaps)) { + LLOGLN(10, ("rdpup_remove_os_bitmap: test error 2")); return 1; } if (g_os_bitmaps[rdpindex].used) { + pixmap = g_os_bitmaps[rdpindex].pixmap; + priv = g_os_bitmaps[rdpindex].priv; + draw_item_remove_all(priv); + this_bytes = pixmap->devKind * pixmap->drawable.height; + g_os_bitmap_alloc_size -= this_bytes; + LLOGLN(10, ("rdpup_remove_os_bitmap: this_bytes %d " + "g_os_bitmap_alloc_size %d", this_bytes, + g_os_bitmap_alloc_size)); g_os_bitmaps[rdpindex].used = 0; g_os_bitmaps[rdpindex].pixmap = 0; g_os_bitmaps[rdpindex].priv = 0; g_pixmap_num_used--; + priv->status = 0; + priv->con_number = 0; + priv->use_count = 0; + } + else + { + LLOGLN(0, ("rdpup_remove_os_bitmap: error")); + } + + LLOGLN(10, ("rdpup_remove_os_bitmap: g_pixmap_num_used %d", + g_pixmap_num_used)); + return 0; +} + +/*****************************************************************************/ +int +rdpup_update_os_use(int rdpindex) +{ + LLOGLN(10, ("rdpup_update_use: index %d stamp %d", + rdpindex, g_os_bitmaps[rdpindex].stamp)); + + if (g_os_bitmaps == 0) + { + return 1; + } + + if ((rdpindex < 0) && (rdpindex >= g_max_os_bitmaps)) + { + return 1; + } + + if (g_os_bitmaps[rdpindex].used) + { + g_os_bitmaps[rdpindex].stamp = g_os_bitmap_stamp; + g_os_bitmap_stamp++; + } + else + { + LLOGLN(0, ("rdpup_update_use: error rdpindex %d", rdpindex)); } - LLOGLN(10, (" g_pixmap_num_used %d", g_pixmap_num_used)); return 0; } + /*****************************************************************************/ /* returns error */ static int @@ -288,12 +479,14 @@ rdpup_send(char *data, int len) } else { + LLOGLN(0, ("rdpup_send: g_tcp_send failed(returned -1)")); rdpup_disconnect(); return 1; } } else if (sent == 0) { + LLOGLN(0, ("rdpup_send: g_tcp_send failed(returned zero)")); rdpup_disconnect(); return 1; } @@ -344,6 +537,9 @@ rdpup_send_msg(struct stream *s) static int rdpup_send_pending(void) { + int rv; + + rv = 0; if (g_connected && g_begin) { LLOGLN(10, ("end %d", g_count)); @@ -351,12 +547,16 @@ rdpup_send_pending(void) out_uint16_le(g_out_s, 4); g_count++; s_mark_end(g_out_s); - rdpup_send_msg(g_out_s); + if (rdpup_send_msg(g_out_s) != 0) + { + LLOGLN(0, ("rdpup_send_pending: rdpup_send_msg failed")); + rv = 1; + } } g_count = 0; g_begin = 0; - return 0; + return rv; } /******************************************************************************/ @@ -367,7 +567,14 @@ rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg) if (g_do_dirty_ons) { - rdpup_check_dirty_screen(&g_screenPriv); + if (g_rect_id == g_rect_id_ack) + { + rdpup_check_dirty_screen(&g_screenPriv); + } + else + { + LLOGLN(0, ("rdpDeferredUpdateCallback: skipping")); + } } else { @@ -413,12 +620,14 @@ rdpup_recv(char *data, int len) } else { + LLOGLN(0, ("rdpup_recv: g_tcp_recv failed(returned -1)")); rdpup_disconnect(); return 1; } } else if (rcvd == 0) { + LLOGLN(0, ("rdpup_recv: g_tcp_recv failed(returned 0)")); rdpup_disconnect(); return 1; } @@ -466,6 +675,34 @@ rdpup_recv_msg(struct stream *s) return rv; } +/*****************************************************************************/ +/* wait 'millis' milliseconds for the socket to be able to receive */ +/* returns boolean */ +static int +sck_can_recv(int sck, int millis) +{ + fd_set rfds; + struct timeval time; + int rv; + + time.tv_sec = millis / 1000; + time.tv_usec = (millis * 1000) % 1000000; + FD_ZERO(&rfds); + + if (sck > 0) + { + FD_SET(((unsigned int)sck), &rfds); + rv = select(sck + 1, &rfds, 0, 0, &time); + + if (rv > 0) + { + return 1; + } + } + + return 0; +} + /******************************************************************************/ /* this from miScreenInit @@ -478,6 +715,7 @@ process_screen_size_msg(int width, int height, int bpp) RRScreenSizePtr pSize; int mmwidth; int mmheight; + int bytes; Bool ok; LLOGLN(0, ("process_screen_size_msg: set width %d height %d bpp %d", @@ -507,6 +745,28 @@ process_screen_size_msg(int width, int height, int bpp) g_rdpScreen.rdp_Bpp_mask = 0xffffff; } + if (g_use_shmem) + { + if (g_shmemptr != 0) + { + shmdt(g_shmemptr); + } + bytes = g_rdpScreen.rdp_width * g_rdpScreen.rdp_height * + g_rdpScreen.rdp_Bpp; + g_shmemid = shmget(IPC_PRIVATE, bytes, IPC_CREAT | 0777); + g_shmemptr = shmat(g_shmemid, 0, 0); + shmctl(g_shmemid, IPC_RMID, NULL); + LLOGLN(0, ("process_screen_size_msg: g_shmemid %d g_shmemptr %p", + g_shmemid, g_shmemptr)); + g_shmem_lineBytes = g_rdpScreen.rdp_Bpp * g_rdpScreen.rdp_width; + + if (g_shm_reg != 0) + { + RegionDestroy(g_shm_reg); + } + g_shm_reg = RegionCreate(NullBox, 0); + } + mmwidth = PixelToMM(width); mmheight = PixelToMM(height); @@ -631,6 +891,14 @@ rdpup_send_rail(void) return 0; } +#define XR_BUTTON1 1 +#define XR_BUTTON2 2 +#define XR_BUTTON3 4 +#define XR_BUTTON4 8 +#define XR_BUTTON5 16 +#define XR_BUTTON6 32 +#define XR_BUTTON7 64 + /******************************************************************************/ static int rdpup_process_msg(struct stream *s) @@ -643,6 +911,13 @@ rdpup_process_msg(struct stream *s) int param4; int bytes; int i1; + int flags; + int x; + int y; + int cx; + int cy; + RegionRec reg; + BoxRec box; in_uint16_le(s, msg_type); @@ -672,44 +947,74 @@ rdpup_process_msg(struct stream *s) g_cursor_y = l_bound_by(param2, 0, g_rdpScreen.height - 2); PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); break; - case 101: - g_button_mask = g_button_mask & (~1); + case 101: /* left button up */ + g_button_mask = g_button_mask & (~XR_BUTTON1); + PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); + break; + case 102: /* left button down */ + g_cursor_x = l_bound_by(param1, 0, g_rdpScreen.width - 2); + g_cursor_y = l_bound_by(param2, 0, g_rdpScreen.height - 2); + g_button_mask = g_button_mask | XR_BUTTON1; + PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); + break; + case 103: /* right button up */ + g_button_mask = g_button_mask & (~XR_BUTTON3); PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); break; - case 102: - g_button_mask = g_button_mask | 1; + case 104: /* right button down */ + g_cursor_x = l_bound_by(param1, 0, g_rdpScreen.width - 2); + g_cursor_y = l_bound_by(param2, 0, g_rdpScreen.height - 2); + g_button_mask = g_button_mask | XR_BUTTON3; PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); break; - case 103: - g_button_mask = g_button_mask & (~4); + case 105: /* middle button down */ + g_button_mask = g_button_mask & (~XR_BUTTON2); PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); break; - case 104: - g_button_mask = g_button_mask | 4; + case 106: /* middle button up */ + g_cursor_x = l_bound_by(param1, 0, g_rdpScreen.width - 2); + g_cursor_y = l_bound_by(param2, 0, g_rdpScreen.height - 2); + g_button_mask = g_button_mask | XR_BUTTON2; PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); break; - case 105: - g_button_mask = g_button_mask & (~2); + case 107: /* button 4 up */ + g_button_mask = g_button_mask & (~XR_BUTTON4); PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); break; - case 106: - g_button_mask = g_button_mask | 2; + case 108: /* button 4 down */ + g_cursor_x = l_bound_by(param1, 0, g_rdpScreen.width - 2); + g_cursor_y = l_bound_by(param2, 0, g_rdpScreen.height - 2); + g_button_mask = g_button_mask | XR_BUTTON4; PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); break; - case 107: - g_button_mask = g_button_mask & (~8); + case 109: /* button 5 up */ + g_button_mask = g_button_mask & (~XR_BUTTON5); PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); break; - case 108: - g_button_mask = g_button_mask | 8; + case 110: /* button 5 down */ + g_cursor_x = l_bound_by(param1, 0, g_rdpScreen.width - 2); + g_cursor_y = l_bound_by(param2, 0, g_rdpScreen.height - 2); + g_button_mask = g_button_mask | XR_BUTTON5; + PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); + break; + case 111: /* button 6 up */ + g_button_mask = g_button_mask & (~XR_BUTTON6); PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); break; - case 109: - g_button_mask = g_button_mask & (~16); + case 112: /* button 6 down */ + g_cursor_x = l_bound_by(param1, 0, g_rdpScreen.width - 2); + g_cursor_y = l_bound_by(param2, 0, g_rdpScreen.height - 2); + g_button_mask = g_button_mask | XR_BUTTON6; PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); break; - case 110: - g_button_mask = g_button_mask | 16; + case 113: /* button 7 up */ + g_button_mask = g_button_mask & (~XR_BUTTON7); + PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); + break; + case 114: /* button 7 down */ + g_cursor_x = l_bound_by(param1, 0, g_rdpScreen.width - 2); + g_cursor_y = l_bound_by(param2, 0, g_rdpScreen.height - 2); + g_button_mask = g_button_mask | XR_BUTTON7; PtrAddEvent(g_button_mask, g_cursor_x, g_cursor_y); break; case 200: @@ -760,8 +1065,28 @@ rdpup_process_msg(struct stream *s) if (g_rdpScreen.client_info.rail_support_level > 0) { g_use_rail = 1; +#ifdef XRDP_WM_RDPUP rdpup_send_rail(); +#endif + } + if (g_rdpScreen.client_info.orders[0x1b]) /* 27 NEG_GLYPH_INDEX_INDEX */ + { + LLOGLN(0, (" client supports glyph cache but server disabled")); + //g_do_glyph_cache = 1; + } + if (g_rdpScreen.client_info.order_flags_ex & 0x100) + { + g_do_composite = 1; + } + if (g_do_glyph_cache) + { + LLOGLN(0, (" using glyph cache")); + } + if (g_do_composite) + { + LLOGLN(0, (" using client composite")); } + LLOGLN(10, ("order_flags_ex 0x%x", g_rdpScreen.client_info.order_flags_ex)); if (g_rdpScreen.client_info.offscreen_cache_entries == 2000) { LLOGLN(0, (" client can do offscreen to offscreen blits")); @@ -780,7 +1105,43 @@ rdpup_process_msg(struct stream *s) { LLOGLN(0, (" client can not do new(color) cursor")); } + if (g_rdpScreen.client_info.monitorCount > 0) + { + LLOGLN(0, (" client can do multimon")); + LLOGLN(0, (" client monitor data, monitorCount= %d", g_rdpScreen.client_info.monitorCount)); + g_do_multimon = 1; + } + else + { + LLOGLN(0, (" client can not do multimon")); + g_do_multimon = 0; + } } + else if (msg_type == 105) + { + LLOGLN(10, ("rdpup_process_msg: got msg 105")); + in_uint32_le(s, flags); + in_uint32_le(s, g_rect_id_ack); + in_uint32_le(s, x); + in_uint32_le(s, y); + in_uint32_le(s, cx); + in_uint32_le(s, cy); + LLOGLN(10, ("rdpup_process_msg: %d %d %d %d", x, y, cx ,cy)); + LLOGLN(10, ("rdpup_process_msg: rect_id %d rect_id_ack %d", g_rect_id, g_rect_id_ack)); + + box.x1 = x; + box.y1 = y; + box.x2 = box.x1 + cx; + box.y2 = box.y1 + cy; + + RegionInit(®, &box, 0); + LLOGLN(10, ("rdpup_process_msg: %d %d %d %d", box.x1, box.y1, box.x2, box.y2)); + RegionSubtract(g_shm_reg, g_shm_reg, ®); + RegionUninit(®); + + } + + else { rdpLog("unknown message type in rdpup_process_msg %d\n", msg_type); @@ -799,6 +1160,10 @@ rdpup_get_screen_image_rect(struct image_data *id) id->Bpp = g_rdpScreen.rdp_Bpp; id->lineBytes = g_rdpScreen.paddedWidthInBytes; id->pixels = g_rdpScreen.pfbMemory; + id->shmem_pixels = g_shmemptr; + id->shmem_id = g_shmemid; + id->shmem_offset = 0; + id->shmem_lineBytes = g_shmem_lineBytes; } /******************************************************************************/ @@ -811,6 +1176,10 @@ rdpup_get_pixmap_image_rect(PixmapPtr pPixmap, struct image_data *id) id->Bpp = g_rdpScreen.rdp_Bpp; id->lineBytes = pPixmap->devKind; id->pixels = (char *)(pPixmap->devPrivate.ptr); + id->shmem_pixels = 0; + id->shmem_id = 0; + id->shmem_offset = 0; + id->shmem_lineBytes = 0; } /******************************************************************************/ @@ -818,6 +1187,7 @@ int rdpup_init(void) { char text[256]; + char *ptext; int i; if (!g_directory_exist("/tmp/.xrdp")) @@ -902,6 +1272,39 @@ rdpup_init(void) } } + ptext = getenv("XRDP_SESMAN_MAX_IDLE_TIME"); + if (ptext != 0) + { + } + ptext = getenv("XRDP_SESMAN_MAX_DISC_TIME"); + if (ptext != 0) + { + i = atoi(ptext); + if (i > 0) + { + g_do_kill_disconnected = 1; + g_disconnect_timeout_s = atoi(ptext); + } + } + ptext = getenv("XRDP_SESMAN_KILL_DISCONNECTED"); + if (ptext != 0) + { + i = atoi(ptext); + if (i != 0) + { + g_do_kill_disconnected = 1; + g_disconnect_timeout_s = 0; + } + } + + if (g_do_kill_disconnected && (g_disconnect_timeout_s < 60)) + { + g_disconnect_timeout_s = 60; + } + + rdpLog("kill disconencted [%d] timeout [%d] sec\n", g_do_kill_disconnected, + g_disconnect_timeout_s); + return 1; } @@ -939,7 +1342,18 @@ rdpup_check(void) g_sck_closed = 0; g_begin = 0; g_con_number++; + rdpGlyphInit(); AddEnabledDevice(g_sck); + + if (g_dis_timer != 0) + { + LLOGLN(0, ("rdpup_check: canceling g_dis_timer")); + TimerCancel(g_dis_timer); + TimerFree(g_dis_timer); + g_dis_timer = 0; + } + g_disconnect_scheduled = 0; + } } @@ -1016,6 +1430,9 @@ rdpup_end_update(void) int rdpup_pre_check(int in_size) { + int rv; + + rv = 0; if (!g_begin) { rdpup_begin_update(); @@ -1024,13 +1441,17 @@ rdpup_pre_check(int in_size) if ((g_out_s->p - g_out_s->data) > (g_out_s->size - (in_size + 20))) { s_mark_end(g_out_s); - rdpup_send_msg(g_out_s); + if (rdpup_send_msg(g_out_s) != 0) + { + LLOGLN(0, ("rdpup_pre_check: rdpup_send_msg failed")); + rv = 1; + } g_count = 0; init_stream(g_out_s, 0); s_push_layer(g_out_s, iso_hdr, 8); } - return 0; + return rv; } /******************************************************************************/ @@ -1256,6 +1677,25 @@ convert_pixels(void *src, void *dst, int num_pixels) /******************************************************************************/ int +alpha_pixels(void* src, void* dst, int num_pixels) +{ + unsigned int* src32; + unsigned char* dst8; + int index; + + src32 = (unsigned int*)src; + dst8 = (unsigned char*)dst; + for (index = 0; index < num_pixels; index++) + { + *dst8 = (*src32) >> 24; + dst8++; + src32++; + } + return 0; +} + +/******************************************************************************/ +int rdpup_set_fgcolor(int fgcolor) { if (g_connected) @@ -1427,6 +1867,26 @@ rdpup_create_os_surface(int rdpindex, int width, int height) /******************************************************************************/ int +rdpup_create_os_surface_bpp(int rdpindex, int width, int height, int bpp) +{ + LLOGLN(10, ("rdpup_create_os_surface_bpp:")); + if (g_connected) + { + LLOGLN(10, (" width %d height %d bpp %d", width, height, bpp)); + rdpup_pre_check(13); + out_uint16_le(g_out_s, 31); + out_uint16_le(g_out_s, 13); + g_count++; + out_uint32_le(g_out_s, rdpindex); + out_uint16_le(g_out_s, width); + out_uint16_le(g_out_s, height); + out_uint8(g_out_s, bpp); + } + return 0; +} + +/******************************************************************************/ +int rdpup_switch_os_surface(int rdpindex) { LLOGLN(10, ("rdpup_switch_os_surface:")); @@ -1559,11 +2019,13 @@ get_single_color(struct image_data *id, int x, int y, int w, int h) } /******************************************************************************/ -/* split the bitmap up into 64 x 64 pixel areas */ +/* split the bitmap up into 64 x 64 pixel areas + or send using shared memory */ void rdpup_send_area(struct image_data *id, int x, int y, int w, int h) { char *s; + char *d; int i; int single_color; int lx; @@ -1571,7 +2033,10 @@ rdpup_send_area(struct image_data *id, int x, int y, int w, int h) int lh; int lw; int size; + int safety; struct image_data lid; + BoxRec box; + RegionRec reg; LLOGLN(10, ("rdpup_send_area: id %p x %d y %d w %d h %d", id, x, y, w, h)); @@ -1628,9 +2093,76 @@ rdpup_send_area(struct image_data *id, int x, int y, int w, int h) if (g_connected && g_begin) { LLOGLN(10, (" rdpup_send_area")); - ly = y; - while (ly < y + h) + if (id->shmem_pixels != 0) + { + LLOGLN(10, ("rdpup_send_area: using shmem")); + box.x1 = x; + box.y1 = y; + box.x2 = box.x1 + w; + box.y2 = box.y1 + h; + LLOGLN(10, ("rdpup_send_area: 1 x %d y %d w %d h %d", x, y, w, h)); + safety = 0; + while (RegionContainsRect(g_shm_reg, &box)) + { + /* instread of rdpup_end_update, call rdpup_send_pending */ + rdpup_send_pending(); + rdpup_begin_update(); + safety++; + if (safety > 100) + { + LLOGLN(0, ("rdpup_send_area: shmem timeout")); + break; + } + if (sck_can_recv(g_sck, 100)) + { + if (rdpup_recv_msg(g_in_s) == 0) + { + rdpup_process_msg(g_in_s); + } + } + } + s = id->pixels; + s += y * id->lineBytes; + s += x * g_Bpp; + d = id->shmem_pixels + id->shmem_offset; + d += y * id->shmem_lineBytes; + d += x * g_rdpScreen.rdp_Bpp; + ly = y; + while (ly < y + h) + { + convert_pixels(s, d, w); + s += id->lineBytes; + d += id->shmem_lineBytes; + ly += 1; + } + size = 36; + rdpup_pre_check(size); + out_uint16_le(g_out_s, 60); + out_uint16_le(g_out_s, size); + g_count++; + LLOGLN(10, ("rdpup_send_area: 2 x %d y %d w %d h %d", x, y, w, h)); + out_uint16_le(g_out_s, x); + out_uint16_le(g_out_s, y); + out_uint16_le(g_out_s, w); + out_uint16_le(g_out_s, h); + out_uint32_le(g_out_s, 0); + g_rect_id++; + out_uint32_le(g_out_s, g_rect_id); + out_uint32_le(g_out_s, id->shmem_id); + out_uint32_le(g_out_s, id->shmem_offset); + out_uint16_le(g_out_s, id->width); + out_uint16_le(g_out_s, id->height); + out_uint16_le(g_out_s, x); + out_uint16_le(g_out_s, y); + RegionInit(®, &box, 0); + RegionUnion(g_shm_reg, g_shm_reg, ®); + RegionUninit(®); + return; + } + + ly = y; + while ((ly < y + h) && g_connected) { lx = x; @@ -1682,6 +2214,103 @@ rdpup_send_area(struct image_data *id, int x, int y, int w, int h) } /******************************************************************************/ +/* split the bitmap up into 64 x 64 pixel areas */ +void +rdpup_send_alpha_area(struct image_data* id, int x, int y, int w, int h) +{ + char* s; + int i; + int lx; + int ly; + int lh; + int lw; + int size; + struct image_data lid; + + LLOGLN(10, ("rdpup_send_alpha_area: id %p x %d y %d w %d h %d", + id, x, y, w, h)); + if (id == 0) + { + rdpup_get_screen_image_rect(&lid); + id = &lid; + } + + if (x >= id->width) + { + return; + } + if (y >= id->height) + { + return; + } + if (x < 0) + { + w += x; + x = 0; + } + if (y < 0) + { + h += y; + y = 0; + } + if (w <= 0) + { + return; + } + if (h <= 0) + { + return; + } + if (x + w > id->width) + { + w = id->width - x; + } + if (y + h > id->height) + { + h = id->height - y; + } + LLOGLN(10, ("%d", w * h)); + if (g_connected && g_begin) + { + LLOGLN(10, (" rdpup_send_area")); + ly = y; + while ((ly < y + h) && g_connected) + { + lx = x; + while ((lx < x + w) && g_connected) + { + lw = MIN(64, (x + w) - lx); + lh = MIN(64, (y + h) - ly); + size = lw * lh + 25; + rdpup_pre_check(size); + out_uint16_le(g_out_s, 32); /* server_paint_rect_bpp */ + out_uint16_le(g_out_s, size); + g_count++; + out_uint16_le(g_out_s, lx); + out_uint16_le(g_out_s, ly); + out_uint16_le(g_out_s, lw); + out_uint16_le(g_out_s, lh); + out_uint32_le(g_out_s, lw * lh); + for (i = 0; i < lh; i++) + { + s = (id->pixels + + ((ly + i) * id->lineBytes) + (lx * g_Bpp)); + alpha_pixels(s, g_out_s->p, lw); + g_out_s->p += lw; + } + out_uint16_le(g_out_s, lw); + out_uint16_le(g_out_s, lh); + out_uint16_le(g_out_s, 0); + out_uint16_le(g_out_s, 0); + out_uint8(g_out_s, 8); + lx += 64; + } + ly += 64; + } + } +} + +/******************************************************************************/ void rdpup_paint_rect_os(int x, int y, int cx, int cy, int rdpindex, int srcx, int srcy) @@ -1772,7 +2401,7 @@ rdpup_create_window(WindowPtr pWindow, rdpWindowRec *priv) out_uint32_le(g_out_s, style); /* style */ out_uint32_le(g_out_s, ext_style); /* extended_style */ flags |= WINDOW_ORDER_FIELD_STYLE; - out_uint32_le(g_out_s, 0); /* show_state */ + out_uint32_le(g_out_s, 0x05); /* show_state */ flags |= WINDOW_ORDER_FIELD_SHOW; out_uint16_le(g_out_s, title_bytes); /* title_info */ out_uint8a(g_out_s, title, title_bytes); @@ -1843,6 +2472,27 @@ rdpup_delete_window(WindowPtr pWindow, rdpWindowRec *priv) } /******************************************************************************/ +void +rdpup_show_window(WindowPtr pWindow, rdpWindowRec* priv, int showState) +{ + LLOGLN(10, ("rdpup_show_window: id 0x%8.8x state 0x%x", pWindow->drawable.id, + showState)); + if (g_connected) + { + int flags = WINDOW_ORDER_TYPE_WINDOW; + + rdpup_pre_check(16); + out_uint16_le(g_out_s, 27); + out_uint16_le(g_out_s, 16); + g_count++; + out_uint32_le(g_out_s, pWindow->drawable.id); + flags |= WINDOW_ORDER_FIELD_SHOW; + out_uint32_le(g_out_s, flags); + out_uint32_le(g_out_s, showState); + } +} + +/******************************************************************************/ int rdpup_check_dirty(PixmapPtr pDirtyPixmap, rdpPixmapRec *pDirtyPriv) { @@ -1854,6 +2504,8 @@ rdpup_check_dirty(PixmapPtr pDirtyPixmap, rdpPixmapRec *pDirtyPriv) xSegment *seg; struct image_data id; struct rdp_draw_item *di; + struct rdp_text* rtext; + struct rdp_text* trtext; if (pDirtyPriv == 0) { @@ -1865,10 +2517,6 @@ rdpup_check_dirty(PixmapPtr pDirtyPixmap, rdpPixmapRec *pDirtyPriv) return 0; } - /* update use time / count */ - g_os_bitmaps[pDirtyPriv->rdpindex].stamp = g_os_bitmap_stamp; - g_os_bitmap_stamp++; - LLOGLN(10, ("rdpup_check_dirty: got dirty")); rdpup_switch_os_surface(pDirtyPriv->rdpindex); rdpup_get_pixmap_image_rect(pDirtyPixmap, &id); @@ -1960,6 +2608,37 @@ rdpup_check_dirty(PixmapPtr pDirtyPixmap, rdpPixmapRec *pDirtyPriv) case RDI_SCRBLT: LLOGLN(10, (" RDI_SCRBLT")); break; + case RDI_TEXT: + LLOGLN(10, (" RDI_TEXT")); + num_clips = REGION_NUM_RECTS(di->reg); + if (num_clips > 0) + { + LLOGLN(10, (" num_clips %d", num_clips)); + rdpup_set_fgcolor(di->u.text.fg_color); + rdpup_set_opcode(di->u.text.opcode); + rtext = di->u.text.rtext; + trtext = rtext; + while (trtext != 0) + { + rdp_text_chars_to_data(trtext); + for (clip_index = num_clips - 1; clip_index >= 0; clip_index--) + { + box = REGION_RECTS(di->reg)[clip_index]; + rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + LLOGLN(10, (" %d %d %d %d", box.x1, box.y1, box.x2, box.y2)); + box = RegionExtents(trtext->reg)[0]; + rdpup_draw_text(trtext->font, trtext->flags, trtext->mixmode, + box.x1, box.y1, box.x2, box.y2, + //box.x1, box.y1, box.x2, box.y2, + 0, 0, 0, 0, + trtext->x, trtext->y, trtext->data, trtext->data_bytes); + } + trtext = trtext->next; + } + } + rdpup_reset_clip(); + rdpup_set_opcode(GXcopy); + break; } di = di->next; @@ -2030,8 +2709,8 @@ rdpup_check_dirty_screen(rdpPixmapRec *pDirtyPriv) for (index = 0; index < count; index++) { box = REGION_RECTS(di->reg)[index]; - LLOGLN(10, (" RDI_IMGLL %d %d %d %d", box.x1, box.y1, - box.x2, box.y2)); + LLOGLN(10, (" RDI_IMGLL x %d y %d w %d h %d", 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); } @@ -2095,3 +2774,171 @@ rdpup_check_dirty_screen(rdpPixmapRec *pDirtyPriv) pDirtyPriv->is_dirty = 0; return 0; } + +/******************************************************************************/ +int +rdpup_check_alpha_dirty(PixmapPtr pDirtyPixmap, rdpPixmapRec* pDirtyPriv) +{ + struct image_data id; + + LLOGLN(10, ("rdpup_check_alpha_dirty: width %d height %d", + pDirtyPixmap->drawable.width, pDirtyPixmap->drawable.height)); + if (pDirtyPriv == 0) + { + return 0; + } + LLOGLN(10, ("rdpup_check_alpha_dirty: is_alpha_dirty_not %d", + pDirtyPriv->is_alpha_dirty_not)); + if (pDirtyPriv->is_alpha_dirty_not) + { + return 0; + } + pDirtyPriv->is_alpha_dirty_not = 1; + rdpup_switch_os_surface(pDirtyPriv->rdpindex); + rdpup_get_pixmap_image_rect(pDirtyPixmap, &id); + rdpup_begin_update(); + rdpup_send_alpha_area(&id, 0, 0, pDirtyPixmap->drawable.width, + pDirtyPixmap->drawable.height); + rdpup_end_update(); + rdpup_switch_os_surface(-1); + return 0; +} + +/******************************************************************************/ +int +rdpup_add_char(int font, int charactor, short x, short y, int cx, int cy, + char* bmpdata, int bmpdata_bytes) +{ + if (g_connected) + { + LLOGLN(10, (" rdpup_add_char")); + rdpup_pre_check(18 + bmpdata_bytes); + out_uint16_le(g_out_s, 28); /* add char */ + out_uint16_le(g_out_s, 18 + bmpdata_bytes); /* size */ + g_count++; + out_uint16_le(g_out_s, font); + out_uint16_le(g_out_s, charactor); + out_uint16_le(g_out_s, x); + out_uint16_le(g_out_s, y); + out_uint16_le(g_out_s, cx); + out_uint16_le(g_out_s, cy); + out_uint16_le(g_out_s, bmpdata_bytes); + out_uint8a(g_out_s, bmpdata, bmpdata_bytes); + } + return 0; +} + +/******************************************************************************/ +int +rdpup_add_char_alpha(int font, int charactor, short x, short y, int cx, int cy, + char* bmpdata, int bmpdata_bytes) +{ + if (g_connected) + { + LLOGLN(10, (" rdpup_add_char_alpha")); + rdpup_pre_check(18 + bmpdata_bytes); + out_uint16_le(g_out_s, 29); /* add char alpha */ + out_uint16_le(g_out_s, 18 + bmpdata_bytes); /* size */ + g_count++; + out_uint16_le(g_out_s, font); + out_uint16_le(g_out_s, charactor); + out_uint16_le(g_out_s, x); + out_uint16_le(g_out_s, y); + out_uint16_le(g_out_s, cx); + out_uint16_le(g_out_s, cy); + out_uint16_le(g_out_s, bmpdata_bytes); + out_uint8a(g_out_s, bmpdata, bmpdata_bytes); + } + return 0; +} + +/******************************************************************************/ +int +rdpup_draw_text(int font, int flags, int mixmode, + short clip_left, short clip_top, + short clip_right, short clip_bottom, + short box_left, short box_top, + short box_right, short box_bottom, short x, short y, + char* data, int data_bytes) +{ + if (g_connected) + { + LLOGLN(10, (" rdpup_draw_text")); + rdpup_pre_check(32 + data_bytes); + out_uint16_le(g_out_s, 30); /* draw text */ + out_uint16_le(g_out_s, 32 + data_bytes); /* size */ + g_count++; + out_uint16_le(g_out_s, font); + out_uint16_le(g_out_s, flags); + out_uint16_le(g_out_s, mixmode); + out_uint16_le(g_out_s, clip_left); + out_uint16_le(g_out_s, clip_top); + out_uint16_le(g_out_s, clip_right); + out_uint16_le(g_out_s, clip_bottom); + out_uint16_le(g_out_s, box_left); + out_uint16_le(g_out_s, box_top); + out_uint16_le(g_out_s, box_right); + out_uint16_le(g_out_s, box_bottom); + out_uint16_le(g_out_s, x); + out_uint16_le(g_out_s, y); + out_uint16_le(g_out_s, data_bytes); + out_uint8a(g_out_s, data, data_bytes); + } + return 0; +} + +/******************************************************************************/ +int +rdpup_composite(short srcidx, int srcformat, short srcwidth, CARD8 srcrepeat, + PictTransform* srctransform, CARD8 mskflags, + short mskidx, int mskformat, short mskwidth, CARD8 mskrepeat, + CARD8 op, short srcx, short srcy, short mskx, short msky, + short dstx, short dsty, short width, short height, + int dstformat) +{ + if (g_connected) + { + LLOGLN(10, (" rdpup_composite")); + rdpup_pre_check(84); + out_uint16_le(g_out_s, 33); + out_uint16_le(g_out_s, 84); /* size */ + g_count++; + out_uint16_le(g_out_s, srcidx); + out_uint32_le(g_out_s, srcformat); + out_uint16_le(g_out_s, srcwidth); + out_uint8(g_out_s, srcrepeat); + if (srctransform == 0) + { + out_uint8s(g_out_s, 10 * 4); + } + else + { + out_uint32_le(g_out_s, 1); + out_uint32_le(g_out_s, srctransform->matrix[0][0]); + out_uint32_le(g_out_s, srctransform->matrix[0][1]); + out_uint32_le(g_out_s, srctransform->matrix[0][2]); + out_uint32_le(g_out_s, srctransform->matrix[1][0]); + out_uint32_le(g_out_s, srctransform->matrix[1][1]); + out_uint32_le(g_out_s, srctransform->matrix[1][2]); + out_uint32_le(g_out_s, srctransform->matrix[2][0]); + out_uint32_le(g_out_s, srctransform->matrix[2][1]); + out_uint32_le(g_out_s, srctransform->matrix[2][2]); + } + out_uint8(g_out_s, mskflags); + out_uint16_le(g_out_s, mskidx); + out_uint32_le(g_out_s, mskformat); + out_uint16_le(g_out_s, mskwidth); + out_uint8(g_out_s, mskrepeat); + out_uint8(g_out_s, op); + out_uint16_le(g_out_s, srcx); + out_uint16_le(g_out_s, srcy); + out_uint16_le(g_out_s, mskx); + out_uint16_le(g_out_s, msky); + out_uint16_le(g_out_s, dstx); + out_uint16_le(g_out_s, dsty); + out_uint16_le(g_out_s, width); + out_uint16_le(g_out_s, height); + out_uint32_le(g_out_s, dstformat); + } + return 0; +} |