parent
d210c0cefd
commit
2e7d413693
@ -0,0 +1,482 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2005-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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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 GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||||
|
|
||||||
|
extern int g_con_number; /* in rdpup.c */
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
static RegionPtr
|
||||||
|
rdpCopyAreaOrg(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
|
||||||
|
int srcx, int srcy, int w, int h, int dstx, int dsty)
|
||||||
|
{
|
||||||
|
rdpGCPtr priv;
|
||||||
|
GCFuncs* oldFuncs;
|
||||||
|
RegionPtr rv;
|
||||||
|
|
||||||
|
GC_OP_PROLOGUE(pGC);
|
||||||
|
rv = pGC->ops->CopyArea(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
|
||||||
|
GC_OP_EPILOGUE(pGC);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
static RegionPtr
|
||||||
|
rdpCopyAreaWndToWnd(WindowPtr pSrcWnd, WindowPtr pDstWnd, GCPtr pGC,
|
||||||
|
int srcx, int srcy, int w, int h,
|
||||||
|
int dstx, int dsty)
|
||||||
|
{
|
||||||
|
int cd;
|
||||||
|
int lsrcx;
|
||||||
|
int lsrcy;
|
||||||
|
int ldstx;
|
||||||
|
int ldsty;
|
||||||
|
int num_clips;
|
||||||
|
int dx;
|
||||||
|
int dy;
|
||||||
|
int j;
|
||||||
|
BoxRec box;
|
||||||
|
RegionPtr rv;
|
||||||
|
RegionRec clip_reg;
|
||||||
|
|
||||||
|
LLOGLN(10, ("rdpCopyAreaWndToWnd:"));
|
||||||
|
|
||||||
|
rv = rdpCopyAreaOrg(&(pSrcWnd->drawable), &(pDstWnd->drawable),
|
||||||
|
pGC, srcx, srcy, w, h, dstx, dsty);
|
||||||
|
RegionInit(&clip_reg, NullBox, 0);
|
||||||
|
cd = rdp_get_clip(&clip_reg, &(pDstWnd->drawable), pGC);
|
||||||
|
lsrcx = pSrcWnd->drawable.x + srcx;
|
||||||
|
lsrcy = pSrcWnd->drawable.y + srcy;
|
||||||
|
ldstx = pDstWnd->drawable.x + dstx;
|
||||||
|
ldsty = pDstWnd->drawable.y + dsty;
|
||||||
|
if (cd == 1)
|
||||||
|
{
|
||||||
|
rdpup_begin_update();
|
||||||
|
rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
|
||||||
|
rdpup_end_update();
|
||||||
|
}
|
||||||
|
else if (cd == 2)
|
||||||
|
{
|
||||||
|
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||||
|
if (num_clips > 0)
|
||||||
|
{
|
||||||
|
rdpup_begin_update();
|
||||||
|
dx = dstx - srcx;
|
||||||
|
dy = dsty - srcy;
|
||||||
|
if ((dy < 0) || ((dy == 0) && (dx < 0)))
|
||||||
|
{
|
||||||
|
for (j = 0; j < num_clips; j++)
|
||||||
|
{
|
||||||
|
box = REGION_RECTS(&clip_reg)[j];
|
||||||
|
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||||
|
rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (j = num_clips - 1; j >= 0; j--)
|
||||||
|
{
|
||||||
|
box = REGION_RECTS(&clip_reg)[j];
|
||||||
|
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||||
|
rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rdpup_reset_clip();
|
||||||
|
rdpup_end_update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RegionUninit(&clip_reg);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
static RegionPtr
|
||||||
|
rdpCopyAreaWndToPixmap(WindowPtr pSrcWnd,
|
||||||
|
PixmapPtr pDstPixmap, rdpPixmapRec* pDstPriv,
|
||||||
|
GCPtr pGC, int srcx, int srcy, int w, int h,
|
||||||
|
int dstx, int dsty)
|
||||||
|
{
|
||||||
|
int cd;
|
||||||
|
int lsrcx;
|
||||||
|
int lsrcy;
|
||||||
|
int ldstx;
|
||||||
|
int ldsty;
|
||||||
|
int num_clips;
|
||||||
|
int dx;
|
||||||
|
int dy;
|
||||||
|
int j;
|
||||||
|
BoxRec box;
|
||||||
|
RegionPtr rv;
|
||||||
|
RegionRec clip_reg;
|
||||||
|
|
||||||
|
LLOGLN(10, ("rdpCopyAreaWndToPixmap:"));
|
||||||
|
|
||||||
|
rv = rdpCopyAreaOrg(&(pSrcWnd->drawable), &(pDstPixmap->drawable),
|
||||||
|
pGC, srcx, srcy, w, h, dstx, dsty);
|
||||||
|
RegionInit(&clip_reg, NullBox, 0);
|
||||||
|
cd = rdp_get_clip(&clip_reg, &(pDstPixmap->drawable), pGC);
|
||||||
|
lsrcx = pSrcWnd->drawable.x + srcx;
|
||||||
|
lsrcy = pSrcWnd->drawable.y + srcy;
|
||||||
|
ldstx = pDstPixmap->drawable.x + dstx;
|
||||||
|
ldsty = pDstPixmap->drawable.y + dsty;
|
||||||
|
if (cd == 1)
|
||||||
|
{
|
||||||
|
rdpup_switch_os_surface(pDstPriv->rdpid);
|
||||||
|
rdpup_begin_update();
|
||||||
|
rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
|
||||||
|
rdpup_end_update();
|
||||||
|
rdpup_switch_os_surface(-1);
|
||||||
|
}
|
||||||
|
else if (cd == 2)
|
||||||
|
{
|
||||||
|
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||||
|
if (num_clips > 0)
|
||||||
|
{
|
||||||
|
rdpup_switch_os_surface(pDstPriv->rdpid);
|
||||||
|
rdpup_begin_update();
|
||||||
|
dx = dstx - srcx;
|
||||||
|
dy = dsty - srcy;
|
||||||
|
if ((dy < 0) || ((dy == 0) && (dx < 0)))
|
||||||
|
{
|
||||||
|
for (j = 0; j < num_clips; j++)
|
||||||
|
{
|
||||||
|
box = REGION_RECTS(&clip_reg)[j];
|
||||||
|
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||||
|
rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (j = num_clips - 1; j >= 0; j--)
|
||||||
|
{
|
||||||
|
box = REGION_RECTS(&clip_reg)[j];
|
||||||
|
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||||
|
rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rdpup_reset_clip();
|
||||||
|
rdpup_end_update();
|
||||||
|
rdpup_switch_os_surface(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RegionUninit(&clip_reg);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* draw from an off screen pixmap to a visible window */
|
||||||
|
static RegionPtr
|
||||||
|
rdpCopyAreaPixmapToWnd(PixmapPtr pSrcPixmap, rdpPixmapRec* pSrcPriv,
|
||||||
|
WindowPtr pDstWnd, GCPtr pGC,
|
||||||
|
int srcx, int srcy, int w, int h,
|
||||||
|
int dstx, int dsty)
|
||||||
|
{
|
||||||
|
int lsrcx;
|
||||||
|
int lsrcy;
|
||||||
|
int ldstx;
|
||||||
|
int ldsty;
|
||||||
|
int cd;
|
||||||
|
int j;
|
||||||
|
int num_clips;
|
||||||
|
RegionPtr rv;
|
||||||
|
RegionRec clip_reg;
|
||||||
|
BoxRec box;
|
||||||
|
|
||||||
|
LLOGLN(10, ("rdpCopyAreaPixmapToWnd:"));
|
||||||
|
|
||||||
|
rv = rdpCopyAreaOrg(&(pSrcPixmap->drawable), &(pDstWnd->drawable),
|
||||||
|
pGC, srcx, srcy, w, h, dstx, dsty);
|
||||||
|
RegionInit(&clip_reg, NullBox, 0);
|
||||||
|
cd = rdp_get_clip(&clip_reg, &(pDstWnd->drawable), pGC);
|
||||||
|
ldstx = pDstWnd->drawable.x + dstx;
|
||||||
|
ldsty = pDstWnd->drawable.y + dsty;
|
||||||
|
lsrcx = pSrcPixmap->drawable.x + srcx;
|
||||||
|
lsrcy = pSrcPixmap->drawable.y + srcy;
|
||||||
|
if (cd == 1)
|
||||||
|
{
|
||||||
|
rdpup_begin_update();
|
||||||
|
rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpid, lsrcx, lsrcy);
|
||||||
|
rdpup_end_update();
|
||||||
|
}
|
||||||
|
else if (cd == 2)
|
||||||
|
{
|
||||||
|
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||||
|
if (num_clips > 0)
|
||||||
|
{
|
||||||
|
rdpup_begin_update();
|
||||||
|
for (j = 0; j < num_clips; j++)
|
||||||
|
{
|
||||||
|
box = REGION_RECTS(&clip_reg)[j];
|
||||||
|
LLOGLN(10, ("rdpCopyAreaPixmapToWnd: %d %d %d %d", box.x1, box.y1, box.x2, box.y2));
|
||||||
|
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||||
|
rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpid, lsrcx, lsrcy);
|
||||||
|
}
|
||||||
|
rdpup_reset_clip();
|
||||||
|
rdpup_end_update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RegionUninit(&clip_reg);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* draw from an off screen pixmap to an off screen pixmap */
|
||||||
|
static RegionPtr
|
||||||
|
rdpCopyAreaPixmapToPixmap(PixmapPtr pSrcPixmap, rdpPixmapRec* pSrcPriv,
|
||||||
|
PixmapPtr pDstPixmap, rdpPixmapRec* pDstPriv,
|
||||||
|
GCPtr pGC, int srcx, int srcy, int w, int h,
|
||||||
|
int dstx, int dsty)
|
||||||
|
{
|
||||||
|
int lsrcx;
|
||||||
|
int lsrcy;
|
||||||
|
int ldstx;
|
||||||
|
int ldsty;
|
||||||
|
int cd;
|
||||||
|
int j;
|
||||||
|
int num_clips;
|
||||||
|
RegionPtr rv;
|
||||||
|
RegionRec clip_reg;
|
||||||
|
BoxRec box;
|
||||||
|
|
||||||
|
LLOGLN(10, ("rdpCopyAreaPixmapToPixmap:"));
|
||||||
|
|
||||||
|
rv = rdpCopyAreaOrg(&(pSrcPixmap->drawable), &(pDstPixmap->drawable),
|
||||||
|
pGC, srcx, srcy, w, h, dstx, dsty);
|
||||||
|
RegionInit(&clip_reg, NullBox, 0);
|
||||||
|
cd = rdp_get_clip(&clip_reg, &(pDstPixmap->drawable), pGC);
|
||||||
|
ldstx = pDstPixmap->drawable.x + dstx;
|
||||||
|
ldsty = pDstPixmap->drawable.y + dsty;
|
||||||
|
lsrcx = pSrcPixmap->drawable.x + srcx;
|
||||||
|
lsrcy = pSrcPixmap->drawable.y + srcy;
|
||||||
|
if (cd == 1)
|
||||||
|
{
|
||||||
|
rdpup_switch_os_surface(pDstPriv->rdpid);
|
||||||
|
rdpup_begin_update();
|
||||||
|
rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpid, lsrcx, lsrcy);
|
||||||
|
rdpup_end_update();
|
||||||
|
rdpup_switch_os_surface(-1);
|
||||||
|
}
|
||||||
|
else if (cd == 2)
|
||||||
|
{
|
||||||
|
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||||
|
if (num_clips > 0)
|
||||||
|
{
|
||||||
|
rdpup_switch_os_surface(pDstPriv->rdpid);
|
||||||
|
rdpup_begin_update();
|
||||||
|
for (j = 0; j < num_clips; j++)
|
||||||
|
{
|
||||||
|
box = REGION_RECTS(&clip_reg)[j];
|
||||||
|
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||||
|
rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpid, lsrcx, lsrcy);
|
||||||
|
}
|
||||||
|
rdpup_reset_clip();
|
||||||
|
rdpup_end_update();
|
||||||
|
rdpup_switch_os_surface(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RegionUninit(&clip_reg);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
RegionPtr
|
||||||
|
rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
|
||||||
|
int srcx, int srcy, int w, int h, int dstx, int dsty)
|
||||||
|
{
|
||||||
|
RegionPtr rv;
|
||||||
|
RegionRec clip_reg;
|
||||||
|
RegionRec box_reg;
|
||||||
|
int num_clips;
|
||||||
|
int cd;
|
||||||
|
int j;
|
||||||
|
int can_do_screen_blt;
|
||||||
|
int got_id;
|
||||||
|
struct image_data id;
|
||||||
|
BoxRec box;
|
||||||
|
BoxPtr pbox;
|
||||||
|
PixmapPtr pSrcPixmap;
|
||||||
|
PixmapPtr pDstPixmap;
|
||||||
|
rdpPixmapRec* pSrcPriv;
|
||||||
|
rdpPixmapRec* pDstPriv;
|
||||||
|
WindowPtr pDstWnd;
|
||||||
|
WindowPtr pSrcWnd;
|
||||||
|
|
||||||
|
LLOGLN(10, ("rdpCopyArea:"));
|
||||||
|
|
||||||
|
if (pSrc->type == DRAWABLE_WINDOW)
|
||||||
|
{
|
||||||
|
pSrcWnd = (WindowPtr)pSrc;
|
||||||
|
if (pSrcWnd->viewable)
|
||||||
|
{
|
||||||
|
if (pDst->type == DRAWABLE_WINDOW)
|
||||||
|
{
|
||||||
|
pDstWnd = (WindowPtr)pDst;
|
||||||
|
if (pDstWnd->viewable)
|
||||||
|
{
|
||||||
|
can_do_screen_blt = pGC->alu == GXcopy;
|
||||||
|
if (can_do_screen_blt)
|
||||||
|
{
|
||||||
|
return rdpCopyAreaWndToWnd(pSrcWnd, pDstWnd, pGC,
|
||||||
|
srcx, srcy, w, h, dstx, dsty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (pDst->type == DRAWABLE_PIXMAP)
|
||||||
|
{
|
||||||
|
pDstPixmap = (PixmapPtr)pDst;
|
||||||
|
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||||
|
if (XRDP_IS_OS(pDstPriv))
|
||||||
|
{
|
||||||
|
can_do_screen_blt = pGC->alu == GXcopy;
|
||||||
|
if (can_do_screen_blt)
|
||||||
|
{
|
||||||
|
return rdpCopyAreaWndToPixmap(pSrcWnd, pDstPixmap, pDstPriv, pGC,
|
||||||
|
srcx, srcy, w, h, dstx, dsty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pSrc->type == DRAWABLE_PIXMAP)
|
||||||
|
{
|
||||||
|
pSrcPixmap = (PixmapPtr)pSrc;
|
||||||
|
pSrcPriv = GETPIXPRIV(pSrcPixmap);
|
||||||
|
if (XRDP_IS_OS(pSrcPriv))
|
||||||
|
{
|
||||||
|
if (pDst->type == DRAWABLE_WINDOW)
|
||||||
|
{
|
||||||
|
pDstWnd = (WindowPtr)pDst;
|
||||||
|
if (pDstWnd->viewable)
|
||||||
|
{
|
||||||
|
return rdpCopyAreaPixmapToWnd(pSrcPixmap, pSrcPriv, pDstWnd, pGC,
|
||||||
|
srcx, srcy, w, h, dstx, dsty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (pDst->type == DRAWABLE_PIXMAP)
|
||||||
|
{
|
||||||
|
pDstPixmap = (PixmapPtr)pDst;
|
||||||
|
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||||
|
if (XRDP_IS_OS(pDstPriv))
|
||||||
|
{
|
||||||
|
return rdpCopyAreaPixmapToPixmap(pSrcPixmap, pSrcPriv,
|
||||||
|
pDstPixmap, pDstPriv,
|
||||||
|
pGC, srcx, srcy, w, h,
|
||||||
|
dstx, dsty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* do original call */
|
||||||
|
rv = rdpCopyAreaOrg(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
|
||||||
|
|
||||||
|
got_id = 0;
|
||||||
|
if (pDst->type == DRAWABLE_PIXMAP)
|
||||||
|
{
|
||||||
|
pDstPixmap = (PixmapPtr)pDst;
|
||||||
|
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||||
|
if (XRDP_IS_OS(pDstPriv))
|
||||||
|
{
|
||||||
|
rdpup_switch_os_surface(pDstPriv->rdpid);
|
||||||
|
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||||
|
got_id = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pDst->type == DRAWABLE_WINDOW)
|
||||||
|
{
|
||||||
|
pDstWnd = (WindowPtr)pDst;
|
||||||
|
if (pDstWnd->viewable)
|
||||||
|
{
|
||||||
|
rdpup_get_screen_image_rect(&id);
|
||||||
|
got_id = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!got_id)
|
||||||
|
{
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
RegionInit(&clip_reg, NullBox, 0);
|
||||||
|
cd = rdp_get_clip(&clip_reg, pDst, pGC);
|
||||||
|
if (cd == 1)
|
||||||
|
{
|
||||||
|
rdpup_begin_update();
|
||||||
|
rdpup_send_area(&id, pDst->x + dstx, pDst->y + dsty, w, h);
|
||||||
|
rdpup_end_update();
|
||||||
|
}
|
||||||
|
else if (cd == 2)
|
||||||
|
{
|
||||||
|
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||||
|
if (num_clips > 0)
|
||||||
|
{
|
||||||
|
rdpup_begin_update();
|
||||||
|
box.x1 = pDst->x + dstx;
|
||||||
|
box.y1 = pDst->y + dsty;
|
||||||
|
box.x2 = box.x1 + w;
|
||||||
|
box.y2 = box.y1 + h;
|
||||||
|
RegionInit(&box_reg, &box, 0);
|
||||||
|
RegionIntersect(&clip_reg, &clip_reg, &box_reg);
|
||||||
|
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||||
|
if (num_clips < 10)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pbox = RegionExtents(&clip_reg);
|
||||||
|
rdpup_send_area(&id, pbox->x1, pbox->y1, pbox->x2 - pbox->x1,
|
||||||
|
pbox->y2 - pbox->y1);
|
||||||
|
}
|
||||||
|
RegionUninit(&box_reg);
|
||||||
|
rdpup_end_update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RegionUninit(&clip_reg);
|
||||||
|
rdpup_switch_os_surface(-1);
|
||||||
|
return rv;
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2005-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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __RDPCOPYAREA_H
|
||||||
|
#define __RDPCOPYAREA_H
|
||||||
|
|
||||||
|
RegionPtr
|
||||||
|
rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
|
||||||
|
int srcx, int srcy, int w, int h, int dstx, int dsty);
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,186 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2005-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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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 GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||||
|
|
||||||
|
extern int g_con_number; /* in rdpup.c */
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
static void
|
||||||
|
rdpPolyFillRectOrg(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
|
||||||
|
xRectangle* prectInit)
|
||||||
|
{
|
||||||
|
rdpGCPtr priv;
|
||||||
|
GCFuncs* oldFuncs;
|
||||||
|
|
||||||
|
GC_OP_PROLOGUE(pGC);
|
||||||
|
pGC->ops->PolyFillRect(pDrawable, pGC, nrectFill, prectInit);
|
||||||
|
GC_OP_EPILOGUE(pGC);
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
void
|
||||||
|
rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
|
||||||
|
xRectangle* prectInit)
|
||||||
|
{
|
||||||
|
int j;
|
||||||
|
int cd;
|
||||||
|
int num_clips;
|
||||||
|
RegionRec clip_reg;
|
||||||
|
RegionPtr fill_reg;
|
||||||
|
BoxRec box;
|
||||||
|
|
||||||
|
int got_id;
|
||||||
|
struct image_data id;
|
||||||
|
WindowPtr pDstWnd;
|
||||||
|
PixmapPtr pDstPixmap;
|
||||||
|
rdpPixmapRec* pDstPriv;
|
||||||
|
|
||||||
|
LLOGLN(10, ("rdpPolyFillRect:"));
|
||||||
|
|
||||||
|
/* make a copy of rects */
|
||||||
|
fill_reg = RegionFromRects(nrectFill, prectInit, CT_NONE);
|
||||||
|
|
||||||
|
/* do original call */
|
||||||
|
rdpPolyFillRectOrg(pDrawable, pGC, nrectFill, prectInit);
|
||||||
|
|
||||||
|
got_id = 0;
|
||||||
|
if (pDrawable->type == DRAWABLE_PIXMAP)
|
||||||
|
{
|
||||||
|
pDstPixmap = (PixmapPtr)pDrawable;
|
||||||
|
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||||
|
if (XRDP_IS_OS(pDstPriv))
|
||||||
|
{
|
||||||
|
rdpup_switch_os_surface(pDstPriv->rdpid);
|
||||||
|
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||||
|
got_id = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||||
|
{
|
||||||
|
pDstWnd = (WindowPtr)pDrawable;
|
||||||
|
if (pDstWnd->viewable)
|
||||||
|
{
|
||||||
|
rdpup_get_screen_image_rect(&id);
|
||||||
|
got_id = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!got_id)
|
||||||
|
{
|
||||||
|
RegionDestroy(fill_reg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
RegionTranslate(fill_reg, pDrawable->x, pDrawable->y);
|
||||||
|
RegionInit(&clip_reg, NullBox, 0);
|
||||||
|
cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
|
||||||
|
if (cd == 1) /* no clip */
|
||||||
|
{
|
||||||
|
rdpup_begin_update();
|
||||||
|
if (pGC->fillStyle == 0 && /* solid fill */
|
||||||
|
(pGC->alu == GXclear ||
|
||||||
|
pGC->alu == GXset ||
|
||||||
|
pGC->alu == GXinvert ||
|
||||||
|
pGC->alu == GXnoop ||
|
||||||
|
pGC->alu == GXand ||
|
||||||
|
pGC->alu == GXcopy /*||
|
||||||
|
pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
|
||||||
|
{
|
||||||
|
rdpup_set_fgcolor(pGC->fgPixel);
|
||||||
|
rdpup_set_opcode(pGC->alu);
|
||||||
|
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_set_opcode(GXcopy);
|
||||||
|
}
|
||||||
|
else /* non solid fill */
|
||||||
|
{
|
||||||
|
for (j = REGION_NUM_RECTS(fill_reg) - 1; j >= 0; j--)
|
||||||
|
{
|
||||||
|
box = REGION_RECTS(fill_reg)[j];
|
||||||
|
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rdpup_end_update();
|
||||||
|
}
|
||||||
|
else if (cd == 2) /* clip */
|
||||||
|
{
|
||||||
|
RegionIntersect(&clip_reg, &clip_reg, fill_reg);
|
||||||
|
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||||
|
if (num_clips > 0)
|
||||||
|
{
|
||||||
|
rdpup_begin_update();
|
||||||
|
if (pGC->fillStyle == 0 && /* solid fill */
|
||||||
|
(pGC->alu == GXclear ||
|
||||||
|
pGC->alu == GXset ||
|
||||||
|
pGC->alu == GXinvert ||
|
||||||
|
pGC->alu == GXnoop ||
|
||||||
|
pGC->alu == GXand ||
|
||||||
|
pGC->alu == GXcopy /*||
|
||||||
|
pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
|
||||||
|
{
|
||||||
|
rdpup_set_fgcolor(pGC->fgPixel);
|
||||||
|
rdpup_set_opcode(pGC->alu);
|
||||||
|
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_set_opcode(GXcopy);
|
||||||
|
}
|
||||||
|
else /* non solid fill */
|
||||||
|
{
|
||||||
|
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_end_update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RegionUninit(&clip_reg);
|
||||||
|
RegionDestroy(fill_reg);
|
||||||
|
rdpup_switch_os_surface(-1);
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2005-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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __RDPPOLYFILLRECT_H
|
||||||
|
#define __RDPPOLYFILLRECT_H
|
||||||
|
|
||||||
|
void
|
||||||
|
rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
|
||||||
|
xRectangle* prectInit);
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,228 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2005-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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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 GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||||
|
|
||||||
|
extern int g_con_number; /* in rdpup.c */
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
static void
|
||||||
|
rdpPolyRectangleOrg(DrawablePtr pDrawable, GCPtr pGC, int nrects,
|
||||||
|
xRectangle* rects)
|
||||||
|
{
|
||||||
|
rdpGCPtr priv;
|
||||||
|
GCFuncs* oldFuncs;
|
||||||
|
|
||||||
|
GC_OP_PROLOGUE(pGC);
|
||||||
|
pGC->ops->PolyRectangle(pDrawable, pGC, nrects, rects);
|
||||||
|
GC_OP_EPILOGUE(pGC);
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* tested with pGC->lineWidth = 0, 1, 2, 4 and opcodes 3 and 6 */
|
||||||
|
void
|
||||||
|
rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
|
||||||
|
xRectangle* rects)
|
||||||
|
{
|
||||||
|
RegionRec clip_reg;
|
||||||
|
RegionPtr fill_reg;
|
||||||
|
int num_clips;
|
||||||
|
int cd;
|
||||||
|
int lw;
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
int up;
|
||||||
|
int down;
|
||||||
|
int got_id;
|
||||||
|
xRectangle* regRects;
|
||||||
|
xRectangle* r;
|
||||||
|
xRectangle* rect1;
|
||||||
|
BoxRec box;
|
||||||
|
struct image_data id;
|
||||||
|
|
||||||
|
WindowPtr pDstWnd;
|
||||||
|
PixmapPtr pDstPixmap;
|
||||||
|
rdpPixmapRec* pDstPriv;
|
||||||
|
|
||||||
|
LLOGLN(10, ("rdpPolyRectangle:"));
|
||||||
|
|
||||||
|
/* make a copy of rects */
|
||||||
|
rect1 = (xRectangle*)g_malloc(sizeof(xRectangle) * nrects, 0);
|
||||||
|
for (i = 0; i < nrects; i++)
|
||||||
|
{
|
||||||
|
rect1[i] = rects[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* do original call */
|
||||||
|
rdpPolyRectangleOrg(pDrawable, pGC, nrects, rects);
|
||||||
|
|
||||||
|
got_id = 0;
|
||||||
|
if (pDrawable->type == DRAWABLE_PIXMAP)
|
||||||
|
{
|
||||||
|
pDstPixmap = (PixmapPtr)pDrawable;
|
||||||
|
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||||
|
if (XRDP_IS_OS(pDstPriv))
|
||||||
|
{
|
||||||
|
rdpup_switch_os_surface(pDstPriv->rdpid);
|
||||||
|
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||||
|
got_id = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||||
|
{
|
||||||
|
pDstWnd = (WindowPtr)pDrawable;
|
||||||
|
if (pDstWnd->viewable)
|
||||||
|
{
|
||||||
|
rdpup_get_screen_image_rect(&id);
|
||||||
|
got_id = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!got_id)
|
||||||
|
{
|
||||||
|
g_free(rect1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RegionInit(&clip_reg, NullBox, 0);
|
||||||
|
cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
|
||||||
|
regRects = 0;
|
||||||
|
if ((cd != 0) && (nrects > 0))
|
||||||
|
{
|
||||||
|
regRects = (xRectangle*)g_malloc(nrects * 4 * sizeof(xRectangle), 0);
|
||||||
|
lw = pGC->lineWidth;
|
||||||
|
if (lw < 1)
|
||||||
|
{
|
||||||
|
lw = 1;
|
||||||
|
}
|
||||||
|
up = lw / 2;
|
||||||
|
down = 1 + (lw - 1) / 2;
|
||||||
|
for (i = 0; i < nrects; i++)
|
||||||
|
{
|
||||||
|
r = regRects + i * 4;
|
||||||
|
r->x = (rect1[i].x + pDrawable->x) - up;
|
||||||
|
r->y = (rect1[i].y + pDrawable->y) - up;
|
||||||
|
r->width = rect1[i].width + up + down;
|
||||||
|
r->height = lw;
|
||||||
|
r++;
|
||||||
|
r->x = (rect1[i].x + pDrawable->x) - up;
|
||||||
|
r->y = (rect1[i].y + pDrawable->y) + down;
|
||||||
|
r->width = lw;
|
||||||
|
r->height = MAX(rect1[i].height - (up + down), 0);
|
||||||
|
r++;
|
||||||
|
r->x = ((rect1[i].x + rect1[i].width) + pDrawable->x) - up;
|
||||||
|
r->y = (rect1[i].y + pDrawable->y) + down;
|
||||||
|
r->width = lw;
|
||||||
|
r->height = MAX(rect1[i].height - (up + down), 0);
|
||||||
|
r++;
|
||||||
|
r->x = (rect1[i].x + pDrawable->x) - up;
|
||||||
|
r->y = ((rect1[i].y + rect1[i].height) + pDrawable->y) - up;
|
||||||
|
r->width = rect1[i].width + up + down;
|
||||||
|
r->height = lw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cd == 1)
|
||||||
|
{
|
||||||
|
if (regRects != 0)
|
||||||
|
{
|
||||||
|
rdpup_begin_update();
|
||||||
|
if (pGC->lineStyle == LineSolid)
|
||||||
|
{
|
||||||
|
rdpup_set_fgcolor(pGC->fgPixel);
|
||||||
|
rdpup_set_opcode(pGC->alu);
|
||||||
|
for (i = 0; i < nrects * 4; i++)
|
||||||
|
{
|
||||||
|
r = regRects + i;
|
||||||
|
rdpup_fill_rect(r->x, r->y, r->width, r->height);
|
||||||
|
}
|
||||||
|
rdpup_set_opcode(GXcopy);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (i = 0; i < nrects * 4; i++)
|
||||||
|
{
|
||||||
|
r = regRects + i;
|
||||||
|
rdpup_send_area(&id, r->x, r->y, r->width, r->height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rdpup_end_update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (cd == 2)
|
||||||
|
{
|
||||||
|
if (regRects != 0)
|
||||||
|
{
|
||||||
|
fill_reg = RegionFromRects(nrects * 4, regRects, CT_NONE);
|
||||||
|
RegionIntersect(&clip_reg, &clip_reg, fill_reg);
|
||||||
|
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||||
|
if (num_clips > 0)
|
||||||
|
{
|
||||||
|
rdpup_begin_update();
|
||||||
|
if (pGC->lineStyle == LineSolid)
|
||||||
|
{
|
||||||
|
rdpup_set_fgcolor(pGC->fgPixel);
|
||||||
|
rdpup_set_opcode(pGC->alu);
|
||||||
|
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_set_opcode(GXcopy);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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_end_update();
|
||||||
|
}
|
||||||
|
RegionDestroy(fill_reg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RegionUninit(&clip_reg);
|
||||||
|
g_free(regRects);
|
||||||
|
g_free(rect1);
|
||||||
|
rdpup_switch_os_surface(-1);
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2005-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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __RDPPOLYRECTANGLE_H
|
||||||
|
#define __RDPPOLYRECTANGLE_H
|
||||||
|
|
||||||
|
void
|
||||||
|
rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
|
||||||
|
xRectangle* rects);
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,164 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2005-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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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 GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||||
|
|
||||||
|
extern int g_con_number; /* in rdpup.c */
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
void
|
||||||
|
rdpPolySegmentOrg(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
|
||||||
|
{
|
||||||
|
rdpGCPtr priv;
|
||||||
|
GCFuncs* oldFuncs;
|
||||||
|
|
||||||
|
GC_OP_PROLOGUE(pGC);
|
||||||
|
pGC->ops->PolySegment(pDrawable, pGC, nseg, pSegs);
|
||||||
|
GC_OP_EPILOGUE(pGC);
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
void
|
||||||
|
rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
|
||||||
|
{
|
||||||
|
RegionRec clip_reg;
|
||||||
|
int cd;
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
int got_id;
|
||||||
|
xSegment* segs;
|
||||||
|
BoxRec box;
|
||||||
|
struct image_data id;
|
||||||
|
WindowPtr pDstWnd;
|
||||||
|
PixmapPtr pDstPixmap;
|
||||||
|
rdpPixmapRec* pDstPriv;
|
||||||
|
|
||||||
|
LLOGLN(10, ("rdpPolySegment:"));
|
||||||
|
|
||||||
|
segs = 0;
|
||||||
|
if (nseg) /* get the rects */
|
||||||
|
{
|
||||||
|
segs = (xSegment*)g_malloc(nseg * sizeof(xSegment), 0);
|
||||||
|
for (i = 0; i < nseg; i++)
|
||||||
|
{
|
||||||
|
segs[i].x1 = pSegs[i].x1 + pDrawable->x;
|
||||||
|
segs[i].y1 = pSegs[i].y1 + pDrawable->y;
|
||||||
|
segs[i].x2 = pSegs[i].x2 + pDrawable->x;
|
||||||
|
segs[i].y2 = pSegs[i].y2 + pDrawable->y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* do original call */
|
||||||
|
rdpPolySegmentOrg(pDrawable, pGC, nseg, pSegs);
|
||||||
|
|
||||||
|
got_id = 0;
|
||||||
|
if (pDrawable->type == DRAWABLE_PIXMAP)
|
||||||
|
{
|
||||||
|
pDstPixmap = (PixmapPtr)pDrawable;
|
||||||
|
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||||
|
if (XRDP_IS_OS(pDstPriv))
|
||||||
|
{
|
||||||
|
rdpup_switch_os_surface(pDstPriv->rdpid);
|
||||||
|
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||||
|
got_id = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||||
|
{
|
||||||
|
pDstWnd = (WindowPtr)pDrawable;
|
||||||
|
if (pDstWnd->viewable)
|
||||||
|
{
|
||||||
|
rdpup_get_screen_image_rect(&id);
|
||||||
|
got_id = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!got_id)
|
||||||
|
{
|
||||||
|
g_free(segs);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RegionInit(&clip_reg, NullBox, 0);
|
||||||
|
cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
|
||||||
|
if (cd == 1) /* no clip */
|
||||||
|
{
|
||||||
|
if (segs != 0)
|
||||||
|
{
|
||||||
|
rdpup_begin_update();
|
||||||
|
rdpup_set_fgcolor(pGC->fgPixel);
|
||||||
|
rdpup_set_opcode(pGC->alu);
|
||||||
|
rdpup_set_pen(0, pGC->lineWidth);
|
||||||
|
for (i = 0; i < nseg; i++)
|
||||||
|
{
|
||||||
|
rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
|
||||||
|
}
|
||||||
|
rdpup_set_opcode(GXcopy);
|
||||||
|
rdpup_end_update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (cd == 2) /* clip */
|
||||||
|
{
|
||||||
|
if (segs != 0)
|
||||||
|
{
|
||||||
|
rdpup_begin_update();
|
||||||
|
rdpup_set_fgcolor(pGC->fgPixel);
|
||||||
|
rdpup_set_opcode(pGC->alu);
|
||||||
|
rdpup_set_pen(0, pGC->lineWidth);
|
||||||
|
for (j = REGION_NUM_RECTS(&clip_reg) - 1; j >= 0; j--)
|
||||||
|
{
|
||||||
|
box = REGION_RECTS(&clip_reg)[j];
|
||||||
|
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||||
|
for (i = 0; i < nseg; i++)
|
||||||
|
{
|
||||||
|
rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rdpup_reset_clip();
|
||||||
|
rdpup_set_opcode(GXcopy);
|
||||||
|
rdpup_end_update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g_free(segs);
|
||||||
|
RegionUninit(&clip_reg);
|
||||||
|
rdpup_switch_os_surface(-1);
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2005-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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __RDPPOLYSEGMENT_H
|
||||||
|
#define __RDPPOLYSEGMENT_H
|
||||||
|
|
||||||
|
void
|
||||||
|
rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs);
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,197 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2005-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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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 GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||||
|
|
||||||
|
extern int g_con_number; /* in rdpup.c */
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
static void
|
||||||
|
rdpPolylinesOrg(DrawablePtr pDrawable, GCPtr pGC, int mode,
|
||||||
|
int npt, DDXPointPtr pptInit)
|
||||||
|
{
|
||||||
|
rdpGCPtr priv;
|
||||||
|
GCFuncs* oldFuncs;
|
||||||
|
|
||||||
|
GC_OP_PROLOGUE(pGC);
|
||||||
|
pGC->ops->Polylines(pDrawable, pGC, mode, npt, pptInit);
|
||||||
|
GC_OP_EPILOGUE(pGC);
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
void
|
||||||
|
rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
|
||||||
|
int npt, DDXPointPtr pptInit)
|
||||||
|
{
|
||||||
|
RegionRec clip_reg;
|
||||||
|
int num_clips;
|
||||||
|
int cd;
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
int x1;
|
||||||
|
int y1;
|
||||||
|
int x2;
|
||||||
|
int y2;
|
||||||
|
int got_id;
|
||||||
|
BoxRec box;
|
||||||
|
DDXPointPtr ppts;
|
||||||
|
struct image_data id;
|
||||||
|
WindowPtr pDstWnd;
|
||||||
|
PixmapPtr pDstPixmap;
|
||||||
|
rdpPixmapRec* pDstPriv;
|
||||||
|
|
||||||
|
LLOGLN(10, ("rdpPolylines:"));
|
||||||
|
|
||||||
|
ppts = 0;
|
||||||
|
if (npt > 0)
|
||||||
|
{
|
||||||
|
ppts = (DDXPointPtr)g_malloc(sizeof(DDXPointRec) * npt, 0);
|
||||||
|
for (i = 0; i < npt; i++)
|
||||||
|
{
|
||||||
|
ppts[i] = pptInit[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* do original call */
|
||||||
|
rdpPolylinesOrg(pDrawable, pGC, mode, npt, pptInit);
|
||||||
|
|
||||||
|
got_id = 0;
|
||||||
|
if (pDrawable->type == DRAWABLE_PIXMAP)
|
||||||
|
{
|
||||||
|
pDstPixmap = (PixmapPtr)pDrawable;
|
||||||
|
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||||
|
if (XRDP_IS_OS(pDstPriv))
|
||||||
|
{
|
||||||
|
rdpup_switch_os_surface(pDstPriv->rdpid);
|
||||||
|
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||||
|
got_id = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||||
|
{
|
||||||
|
pDstWnd = (WindowPtr)pDrawable;
|
||||||
|
if (pDstWnd->viewable)
|
||||||
|
{
|
||||||
|
rdpup_get_screen_image_rect(&id);
|
||||||
|
got_id = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!got_id)
|
||||||
|
{
|
||||||
|
g_free(ppts);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RegionInit(&clip_reg, NullBox, 0);
|
||||||
|
cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
|
||||||
|
if (cd == 1)
|
||||||
|
{
|
||||||
|
if (ppts != 0)
|
||||||
|
{
|
||||||
|
rdpup_begin_update();
|
||||||
|
rdpup_set_fgcolor(pGC->fgPixel);
|
||||||
|
rdpup_set_opcode(pGC->alu);
|
||||||
|
rdpup_set_pen(0, pGC->lineWidth);
|
||||||
|
x1 = ppts[0].x + pDrawable->x;
|
||||||
|
y1 = ppts[0].y + pDrawable->y;
|
||||||
|
for (i = 1; i < npt; i++)
|
||||||
|
{
|
||||||
|
if (mode == CoordModeOrigin)
|
||||||
|
{
|
||||||
|
x2 = pDrawable->x + ppts[i].x;
|
||||||
|
y2 = pDrawable->y + ppts[i].y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x2 = x1 + ppts[i].x;
|
||||||
|
y2 = y1 + ppts[i].y;
|
||||||
|
}
|
||||||
|
rdpup_draw_line(x1, y1, x2, y2);
|
||||||
|
x1 = x2;
|
||||||
|
y1 = y2;
|
||||||
|
}
|
||||||
|
rdpup_set_opcode(GXcopy);
|
||||||
|
rdpup_end_update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (cd == 2)
|
||||||
|
{
|
||||||
|
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||||
|
if (ppts != 0 && num_clips > 0)
|
||||||
|
{
|
||||||
|
rdpup_begin_update();
|
||||||
|
rdpup_set_fgcolor(pGC->fgPixel);
|
||||||
|
rdpup_set_opcode(pGC->alu);
|
||||||
|
rdpup_set_pen(0, pGC->lineWidth);
|
||||||
|
for (j = num_clips - 1; j >= 0; j--)
|
||||||
|
{
|
||||||
|
box = REGION_RECTS(&clip_reg)[j];
|
||||||
|
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||||
|
x1 = ppts[0].x + pDrawable->x;
|
||||||
|
y1 = ppts[0].y + pDrawable->y;
|
||||||
|
for (i = 1; i < npt; i++)
|
||||||
|
{
|
||||||
|
if (mode == CoordModeOrigin)
|
||||||
|
{
|
||||||
|
x2 = pDrawable->x + ppts[i].x;
|
||||||
|
y2 = pDrawable->y + ppts[i].y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x2 = x1 + ppts[i].x;
|
||||||
|
y2 = y1 + ppts[i].y;
|
||||||
|
}
|
||||||
|
rdpup_draw_line(x1, y1, x2, y2);
|
||||||
|
x1 = x2;
|
||||||
|
y1 = y2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rdpup_reset_clip();
|
||||||
|
rdpup_set_opcode(GXcopy);
|
||||||
|
rdpup_end_update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RegionUninit(&clip_reg);
|
||||||
|
g_free(ppts);
|
||||||
|
rdpup_switch_os_surface(-1);
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2005-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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __RDPPOLYLINES_H
|
||||||
|
#define __RDPPOLYLINES_H
|
||||||
|
|
||||||
|
void
|
||||||
|
rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
|
||||||
|
int npt, DDXPointPtr pptInit);
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,130 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2005-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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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 GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||||
|
|
||||||
|
extern int g_con_number; /* in rdpup.c */
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
static void
|
||||||
|
rdpPutImageOrg(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
|
||||||
|
int w, int h, int leftPad, int format, char* pBits)
|
||||||
|
{
|
||||||
|
rdpGCPtr priv;
|
||||||
|
GCFuncs* oldFuncs;
|
||||||
|
|
||||||
|
GC_OP_PROLOGUE(pGC);
|
||||||
|
pGC->ops->PutImage(pDst, pGC, depth, x, y, w, h, leftPad,
|
||||||
|
format, pBits);
|
||||||
|
GC_OP_EPILOGUE(pGC);
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
void
|
||||||
|
rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
|
||||||
|
int w, int h, int leftPad, int format, char* pBits)
|
||||||
|
{
|
||||||
|
RegionRec clip_reg;
|
||||||
|
int cd;
|
||||||
|
int j;
|
||||||
|
int got_id;
|
||||||
|
BoxRec box;
|
||||||
|
struct image_data id;
|
||||||
|
|
||||||
|
WindowPtr pDstWnd;
|
||||||
|
PixmapPtr pDstPixmap;
|
||||||
|
rdpPixmapRec* pDstPriv;
|
||||||
|
|
||||||
|
LLOGLN(10, ("rdpPutImage:"));
|
||||||
|
LLOGLN(10, ("rdpPutImage: drawable id 0x%x", pDst->id));
|
||||||
|
|
||||||
|
/* do original call */
|
||||||
|
rdpPutImageOrg(pDst, pGC, depth, x, y, w, h, leftPad, format, pBits);
|
||||||
|
got_id = 0;
|
||||||
|
if (pDst->type == DRAWABLE_PIXMAP)
|
||||||
|
{
|
||||||
|
pDstPixmap = (PixmapPtr)pDst;
|
||||||
|
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||||
|
if (XRDP_IS_OS(pDstPriv))
|
||||||
|
{
|
||||||
|
rdpup_switch_os_surface(pDstPriv->rdpid);
|
||||||
|
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||||
|
got_id = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pDst->type == DRAWABLE_WINDOW)
|
||||||
|
{
|
||||||
|
pDstWnd = (WindowPtr)pDst;
|
||||||
|
if (pDstWnd->viewable)
|
||||||
|
{
|
||||||
|
rdpup_get_screen_image_rect(&id);
|
||||||
|
got_id = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!got_id)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
RegionInit(&clip_reg, NullBox, 0);
|
||||||
|
cd = rdp_get_clip(&clip_reg, pDst, pGC);
|
||||||
|
if (cd == 1)
|
||||||
|
{
|
||||||
|
rdpup_begin_update();
|
||||||
|
rdpup_send_area(&id, pDst->x + x, pDst->y + y, w, h);
|
||||||
|
rdpup_end_update();
|
||||||
|
}
|
||||||
|
else if (cd == 2)
|
||||||
|
{
|
||||||
|
rdpup_begin_update();
|
||||||
|
for (j = REGION_NUM_RECTS(&clip_reg) - 1; j >= 0; j--)
|
||||||
|
{
|
||||||
|
box = REGION_RECTS(&clip_reg)[j];
|
||||||
|
rdpup_set_clip(box.x1, box.y1, (box.x2 - box.x1), (box.y2 - box.y1));
|
||||||
|
rdpup_send_area(&id, pDst->x + x, pDst->y + y, w, h);
|
||||||
|
}
|
||||||
|
rdpup_reset_clip();
|
||||||
|
rdpup_end_update();
|
||||||
|
}
|
||||||
|
RegionUninit(&clip_reg);
|
||||||
|
rdpup_switch_os_surface(-1);
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2005-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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __RDPPUTIMAGE_H
|
||||||
|
#define __RDPPUTIMAGE_H
|
||||||
|
|
||||||
|
void
|
||||||
|
rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
|
||||||
|
int w, int h, int leftPad, int format, char* pBits);
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2005-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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __RDPDRAW_H
|
||||||
|
#define __RDPDRAW_H
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
#define GC_OP_PROLOGUE(_pGC) \
|
||||||
|
{ \
|
||||||
|
priv = (rdpGCPtr)dixGetPrivateAddr(&(pGC->devPrivates), &g_rdpGCIndex); \
|
||||||
|
oldFuncs = _pGC->funcs; \
|
||||||
|
(_pGC)->funcs = priv->funcs; \
|
||||||
|
(_pGC)->ops = priv->ops; \
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
#define GC_OP_EPILOGUE(_pGC) \
|
||||||
|
{ \
|
||||||
|
priv->ops = (_pGC)->ops; \
|
||||||
|
(_pGC)->funcs = oldFuncs; \
|
||||||
|
(_pGC)->ops = &g_rdpGCOps; \
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
rdp_get_clip(RegionPtr pRegion, DrawablePtr pDrawable, GCPtr pGC);
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in new issue