commit
c1b7cbd657
File diff suppressed because it is too large
Load Diff
@ -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
|
@ -0,0 +1,835 @@
|
||||
/*
|
||||
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_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;
|
||||
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, 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);
|
||||
}
|
||||
}
|
@ -0,0 +1,860 @@
|
||||
/*
|
||||
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));
|
||||
|
||||
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;
|
||||
}
|
@ -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
|
Loading…
Reference in new issue