本文整理汇总了C++中REGION_NUM_RECTS函数的典型用法代码示例。如果您正苦于以下问题:C++ REGION_NUM_RECTS函数的具体用法?C++ REGION_NUM_RECTS怎么用?C++ REGION_NUM_RECTS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了REGION_NUM_RECTS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rdpCopyAreaWndToWnd
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:"));
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 = ldstx - lsrcx;
dy = ldsty - lsrcy;
if ((dy < 0) || ((dy == 0) && (dx < 0)))
{
for (j = 0; j < num_clips; j++)
{
box = REGION_RECTS(&clip_reg)[j];
LLOGLN(10, (" index %d x1 %d y1 %d x2 %d y2 %d", j,
box.x1, box.y1, box.x2, box.y2));
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];
LLOGLN(10, (" index %d x1 %d y1 %d x2 %d y2 %d", j,
box.x1, box.y1, box.x2, box.y2));
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);
rv = rdpCopyAreaOrg(&(pSrcWnd->drawable), &(pDstWnd->drawable),
pGC, srcx, srcy, w, h, dstx, dsty);
return rv;
}
示例2: I810DRIMoveBuffers
/* This routine is a modified form of XAADoBitBlt with the calls to
* ScreenToScreenBitBlt built in. My routine has the prgnSrc as source
* instead of destination. My origin is upside down so the ydir cases
* are reversed.
*
* KW: can you believe that this is called even when a 2d window moves?
*/
static void
I810DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
RegionPtr prgnSrc, CARD32 index)
{
ScreenPtr pScreen = pParent->drawable.pScreen;
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
BoxPtr pboxTmp, pboxNext, pboxBase;
DDXPointPtr pptTmp, pptNew2 = NULL;
int xdir, ydir;
int screenwidth = pScrn->virtualX;
int screenheight = pScrn->virtualY;
BoxPtr pbox = REGION_RECTS(prgnSrc);
int nbox = REGION_NUM_RECTS(prgnSrc);
BoxPtr pboxNew1 = NULL;
BoxPtr pboxNew2 = NULL;
DDXPointPtr pptNew1 = NULL;
DDXPointPtr pptSrc = &ptOldOrg;
int dx = pParent->drawable.x - ptOldOrg.x;
int dy = pParent->drawable.y - ptOldOrg.y;
/* If the copy will overlap in Y, reverse the order */
if (dy > 0) {
ydir = -1;
if (nbox > 1) {
/* Keep ordering in each band, reverse order of bands */
pboxNew1 = (BoxPtr) malloc(sizeof(BoxRec) * nbox);
if (!pboxNew1)
return;
pptNew1 = (DDXPointPtr) malloc(sizeof(DDXPointRec) * nbox);
if (!pptNew1) {
free(pboxNew1);
return;
}
pboxBase = pboxNext = pbox + nbox - 1;
while (pboxBase >= pbox) {
while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1))
pboxNext--;
pboxTmp = pboxNext + 1;
pptTmp = pptSrc + (pboxTmp - pbox);
while (pboxTmp <= pboxBase) {
*pboxNew1++ = *pboxTmp++;
*pptNew1++ = *pptTmp++;
}
pboxBase = pboxNext;
}
pboxNew1 -= nbox;
pbox = pboxNew1;
pptNew1 -= nbox;
pptSrc = pptNew1;
}
} else {
/* No changes required */
ydir = 1;
}
/* If the regions will overlap in X, reverse the order */
if (dx > 0) {
xdir = -1;
if (nbox > 1) {
/*reverse orderof rects in each band */
pboxNew2 = (BoxPtr) malloc(sizeof(BoxRec) * nbox);
pptNew2 = (DDXPointPtr) malloc(sizeof(DDXPointRec) * nbox);
if (!pboxNew2 || !pptNew2) {
if (pptNew2)
free(pptNew2);
if (pboxNew2)
free(pboxNew2);
if (pboxNew1) {
free(pptNew1);
free(pboxNew1);
}
return;
}
pboxBase = pboxNext = pbox;
while (pboxBase < pbox + nbox) {
while ((pboxNext < pbox + nbox) && (pboxNext->y1 == pboxBase->y1))
pboxNext++;
pboxTmp = pboxNext;
pptTmp = pptSrc + (pboxTmp - pbox);
while (pboxTmp != pboxBase) {
*pboxNew2++ = *--pboxTmp;
*pptNew2++ = *--pptTmp;
}
pboxBase = pboxNext;
}
pboxNew2 -= nbox;
pbox = pboxNew2;
//.........这里部分代码省略.........
示例3: AllocateArea
static FBAreaPtr
AllocateArea(
FBManagerPtr offman,
int w, int h,
int granularity,
MoveAreaCallbackProcPtr moveCB,
RemoveAreaCallbackProcPtr removeCB,
pointer privData
){
ScreenPtr pScreen = offman->pScreen;
FBLinkPtr link = NULL;
FBAreaPtr area = NULL;
RegionRec NewReg;
int i, x = 0, num;
BoxPtr boxp;
if(granularity <= 1) granularity = 0;
boxp = REGION_RECTS(offman->FreeBoxes);
num = REGION_NUM_RECTS(offman->FreeBoxes);
/* look through the free boxes */
for(i = 0; i < num; i++, boxp++) {
x = boxp->x1;
if(granularity) {
int tmp = x % granularity;
if(tmp) x += (granularity - tmp);
}
if(((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w))
continue;
link = xalloc(sizeof(FBLink));
if(!link) return NULL;
area = &(link->area);
link->next = offman->UsedAreas;
offman->UsedAreas = link;
offman->NumUsedAreas++;
break;
}
/* try to boot a removeable one out if we are not expendable ourselves */
if(!area && !removeCB) {
link = offman->UsedAreas;
while(link) {
if(!link->area.RemoveAreaCallback) {
link = link->next;
continue;
}
boxp = &(link->area.box);
x = boxp->x1;
if(granularity) {
int tmp = x % granularity;
if(tmp) x += (granularity - tmp);
}
if(((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w)) {
link = link->next;
continue;
}
/* bye, bye */
(*link->area.RemoveAreaCallback)(&link->area);
REGION_INIT(pScreen, &NewReg, &(link->area.box), 1);
REGION_UNION(pScreen, offman->FreeBoxes, offman->FreeBoxes, &NewReg);
REGION_UNINIT(pScreen, &NewReg);
area = &(link->area);
break;
}
}
if(area) {
area->pScreen = pScreen;
area->granularity = granularity;
area->box.x1 = x;
area->box.x2 = x + w;
area->box.y1 = boxp->y1;
area->box.y2 = boxp->y1 + h;
area->MoveAreaCallback = moveCB;
area->RemoveAreaCallback = removeCB;
area->devPrivate.ptr = privData;
REGION_INIT(pScreen, &NewReg, &(area->box), 1);
REGION_SUBTRACT(pScreen, offman->FreeBoxes, offman->FreeBoxes, &NewReg);
REGION_UNINIT(pScreen, &NewReg);
}
return area;
}
示例4: rdpImageText8
//.........这里部分代码省略.........
got_id = 1;
}
}
}
else
{
if (pDrawable->type == DRAWABLE_WINDOW)
{
pDstWnd = (WindowPtr)pDrawable;
if (pDstWnd->viewable)
{
post_process = 1;
if (g_do_dirty_ons)
{
LLOGLN(0, ("rdpImageText8: gettig dirty"));
g_screenPriv.is_dirty = 1;
pDirtyPriv = &g_screenPriv;
dirty_type = RDI_IMGLL;
}
else
{
rdpup_get_screen_image_rect(&id);
got_id = 1;
}
}
}
}
if (!post_process)
{
return;
}
RegionInit(®, NullBox, 0);
if (count == 0)
{
cd = 0;
}
else
{
cd = rdp_get_clip(®, pDrawable, pGC);
}
if (cd == 1)
{
if (dirty_type != 0)
{
RegionInit(®1, &box, 0);
draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, 9);
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();
}
}
else if (cd == 2)
{
RegionInit(®1, &box, 0);
RegionIntersect(®, ®, ®1);
num_clips = REGION_NUM_RECTS(®);
if (num_clips > 0)
{
if (dirty_type != 0)
{
draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type, 9);
}
else if (got_id)
{
rdpup_begin_update();
for (j = num_clips - 1; j >= 0; j--)
{
box = REGION_RECTS(®)[j];
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
box.y2 - box.y1);
}
rdpup_end_update();
}
}
RegionUninit(®1);
}
RegionUninit(®);
if (reset_surface)
{
rdpup_switch_os_surface(-1);
}
return;
}
示例5: XAAPaintWindow
void
XAAPaintWindow(
WindowPtr pWin,
RegionPtr prgn,
int what
)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable));
int nBox = REGION_NUM_RECTS(prgn);
BoxPtr pBox = REGION_RECTS(prgn);
int fg = -1;
PixmapPtr pPix = NULL;
if(!infoRec->pScrn->vtSema) goto BAILOUT;
switch (what) {
case PW_BACKGROUND:
switch(pWin->backgroundState) {
case None: return;
case ParentRelative:
do { pWin = pWin->parent; }
while(pWin->backgroundState == ParentRelative);
(*pWin->drawable.pScreen->PaintWindowBackground)(pWin, prgn, what);
return;
case BackgroundPixel:
fg = pWin->background.pixel;
break;
case BackgroundPixmap:
pPix = pWin->background.pixmap;
break;
}
break;
case PW_BORDER:
if (pWin->borderIsPixel)
fg = pWin->border.pixel;
else /* pixmap */
pPix = pWin->border.pixmap;
break;
default: return;
}
if(!pPix) {
if(infoRec->FillSolidRects &&
(!(infoRec->FillSolidRectsFlags & RGB_EQUAL) ||
(CHECK_RGB_EQUAL(fg))) ) {
(*infoRec->FillSolidRects)(infoRec->pScrn, fg, GXcopy, ~0,
nBox, pBox);
return;
}
} else { /* pixmap */
XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
WindowPtr pBgWin = pWin;
Bool NoCache = FALSE;
int xorg, yorg;
/* Hack so we can use this with the dual framebuffer layers
which only support the pixmap cache in the primary bpp */
if(pPix->drawable.bitsPerPixel != infoRec->pScrn->bitsPerPixel)
NoCache = TRUE;
if (what == PW_BORDER) {
for (pBgWin = pWin;
pBgWin->backgroundState == ParentRelative;
pBgWin = pBgWin->parent);
}
xorg = pBgWin->drawable.x;
yorg = pBgWin->drawable.y;
if(IS_OFFSCREEN_PIXMAP(pPix) && infoRec->FillCacheBltRects) {
XAACacheInfoPtr pCache = &(infoRec->ScratchCacheInfoRec);
pCache->x = pPriv->offscreenArea->box.x1;
pCache->y = pPriv->offscreenArea->box.y1;
pCache->w = pCache->orig_w =
pPriv->offscreenArea->box.x2 - pCache->x;
pCache->h = pCache->orig_h =
pPriv->offscreenArea->box.y2 - pCache->y;
pCache->trans_color = -1;
(*infoRec->FillCacheBltRects)(infoRec->pScrn, GXcopy, ~0,
nBox, pBox, xorg, yorg, pCache);
return;
}
if(pPriv->flags & DIRTY) {
pPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK);
pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
}
if(!(pPriv->flags & REDUCIBILITY_CHECKED) &&
(infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) {
XAACheckTileReducibility(pPix, infoRec->CanDoMono8x8);
}
if(pPriv->flags & REDUCIBLE_TO_8x8) {
if((pPriv->flags & REDUCIBLE_TO_2_COLOR) &&
infoRec->CanDoMono8x8 && infoRec->FillMono8x8PatternRects &&
//.........这里部分代码省略.........
示例6: PclPolyRectangle
void
PclPolyRectangle(
DrawablePtr pDrawable,
GCPtr pGC,
int nRects,
xRectangle *pRects)
{
char t[80];
FILE *outFile;
int nbox, i;
BoxPtr pbox;
xRectangle *drawRects, *r;
RegionPtr drawRegion, region;
short fudge;
int xoffset, yoffset;
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return;
pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
/*
* Allocate the storage required to deal with the clipping
* regions.
*/
region = REGION_CREATE( pGC->pScreen, NULL, 0 );
drawRects = (xRectangle *)xalloc( nRects * sizeof( xRectangle ) );
fudge = 3 * pGC->lineWidth + 1;
/*
* Generate the PCL code to draw the rectangles, by defining them
* as a macro which uses the HP-GL/2 rectangle drawing function.
*/
MACRO_START( outFile, pConPriv );
SAVE_PCL( outFile, pConPriv, "\033%0B" );
xoffset = pDrawable->x;
yoffset = pDrawable->y;
for( i = 0, r = drawRects; i < nRects; i++, r++ )
{
xRectangle rect = pRects[i];
/* Draw the rectangle */
sprintf( t, "PU%d,%d;ER%d,%d;", rect.x + xoffset,
rect.y + yoffset, rect.width, rect.height );
SAVE_PCL( outFile, pConPriv, t );
/* Build the bounding box */
r->x = MIN( rect.x, rect.x + rect.width ) + xoffset -
fudge;
r->y = MIN( rect.y, rect.y + rect.height ) + yoffset -
fudge;
r->width = rect.width + 2 * fudge;
r->height = rect.height + 2 * fudge;
}
SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */
MACRO_END( outFile );
/*
* Convert the collection of rectangles to a proper region, then
* intersect it with the clip region.
*/
drawRegion = RECTS_TO_REGION( pGC->pScreen, nRects,
drawRects, CT_UNSORTED );
REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
/*
* For each rectangle in the clip region, set the HP-GL/2 "input
* window" and render the set of rectangles to it.
*/
pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region );
PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
/*
* Clean up the temporary regions
*/
REGION_DESTROY( pGC->pScreen, drawRegion );
REGION_DESTROY( pGC->pScreen, region );
xfree( drawRects );
}
示例7: rdpPutImage
//.........这里部分代码省略.........
{
rdpup_switch_os_surface(pDstPriv->rdpindex);
reset_surface = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
got_id = 1;
}
}
}
else
{
if (pDst->type == DRAWABLE_WINDOW)
{
pDstWnd = (WindowPtr)pDst;
if (pDstWnd->viewable)
{
post_process = 1;
if (g_do_dirty_ons)
{
LLOGLN(10, ("rdpPutImage: gettig dirty"));
g_screenPriv.is_dirty = 1;
pDirtyPriv = &g_screenPriv;
dirty_type = RDI_IMGLL;
}
else
{
rdpup_get_screen_image_rect(&id);
got_id = 1;
}
}
}
}
if (!post_process)
{
return;
}
RegionInit(&clip_reg, NullBox, 0);
cd = rdp_get_clip(&clip_reg, pDst, pGC);
if (cd == 1)
{
if (dirty_type != 0)
{
box.x1 = pDst->x + x;
box.y1 = pDst->y + y;
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;
RegionInit(®1, &box, 0);
draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, TAG_PUTIMAGE);
RegionUninit(®1);
}
else if (got_id)
{
rdpup_begin_update();
rdpup_send_area(&id, pDst->x + x, pDst->y + y, w, h);
rdpup_end_update();
}
}
else if (cd == 2)
{
if (dirty_type != 0)
{
box.x1 = pDst->x + x;
box.y1 = pDst->y + y;
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;
RegionInit(®1, &box, 0);
RegionInit(®2, NullBox, 0);
RegionCopy(®2, &clip_reg);
RegionIntersect(®1, ®1, ®2);
draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type, TAG_PUTIMAGE);
RegionUninit(®1);
RegionUninit(®2);
}
else if (got_id)
{
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);
if (reset_surface)
{
rdpup_switch_os_surface(-1);
}
}
示例8: EVERGREENDisplayTexturedVideo
void
EVERGREENDisplayTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
{
RADEONInfoPtr info = RADEONPTR(pScrn);
struct radeon_accel_state *accel_state = info->accel_state;
PixmapPtr pPixmap = pPriv->pPixmap;
BoxPtr pBox = REGION_RECTS(&pPriv->clip);
int nBox = REGION_NUM_RECTS(&pPriv->clip);
int dstxoff, dstyoff;
struct r600_accel_object src_obj, dst_obj;
cb_config_t cb_conf;
tex_resource_t tex_res;
tex_sampler_t tex_samp;
shader_config_t vs_conf, ps_conf;
/*
* y' = y - .0625
* u' = u - .5
* v' = v - .5;
*
* r = 1.1643 * y' + 0.0 * u' + 1.5958 * v'
* g = 1.1643 * y' - 0.39173 * u' - 0.81290 * v'
* b = 1.1643 * y' + 2.017 * u' + 0.0 * v'
*
* DP3 might look like the straightforward solution
* but we'd need to move the texture yuv values in
* the same reg for this to work. Therefore use MADs.
* Brightness just adds to the off constant.
* Contrast is multiplication of luminance.
* Saturation and hue change the u and v coeffs.
* Default values (before adjustments - depend on colorspace):
* yco = 1.1643
* uco = 0, -0.39173, 2.017
* vco = 1.5958, -0.8129, 0
* off = -0.0625 * yco + -0.5 * uco[r] + -0.5 * vco[r],
* -0.0625 * yco + -0.5 * uco[g] + -0.5 * vco[g],
* -0.0625 * yco + -0.5 * uco[b] + -0.5 * vco[b],
*
* temp = MAD(yco, yuv.yyyy, off)
* temp = MAD(uco, yuv.uuuu, temp)
* result = MAD(vco, yuv.vvvv, temp)
*/
/* TODO: calc consts in the shader */
const float Loff = -0.0627;
const float Coff = -0.502;
float uvcosf, uvsinf;
float yco;
float uco[3], vco[3], off[3];
float bright, cont, gamma;
int ref = pPriv->transform_index;
Bool needgamma = FALSE;
float *ps_alu_consts;
const_config_t ps_const_conf;
float *vs_alu_consts;
const_config_t vs_const_conf;
cont = RTFContrast(pPriv->contrast);
bright = RTFBrightness(pPriv->brightness);
gamma = (float)pPriv->gamma / 1000.0;
uvcosf = RTFSaturation(pPriv->saturation) * cos(RTFHue(pPriv->hue));
uvsinf = RTFSaturation(pPriv->saturation) * sin(RTFHue(pPriv->hue));
/* overlay video also does pre-gamma contrast/sat adjust, should we? */
yco = trans[ref].RefLuma * cont;
uco[0] = -trans[ref].RefRCr * uvsinf;
uco[1] = trans[ref].RefGCb * uvcosf - trans[ref].RefGCr * uvsinf;
uco[2] = trans[ref].RefBCb * uvcosf;
vco[0] = trans[ref].RefRCr * uvcosf;
vco[1] = trans[ref].RefGCb * uvsinf + trans[ref].RefGCr * uvcosf;
vco[2] = trans[ref].RefBCb * uvsinf;
off[0] = Loff * yco + Coff * (uco[0] + vco[0]) + bright;
off[1] = Loff * yco + Coff * (uco[1] + vco[1]) + bright;
off[2] = Loff * yco + Coff * (uco[2] + vco[2]) + bright;
// XXX
gamma = 1.0;
if (gamma != 1.0) {
needgamma = TRUE;
/* note: gamma correction is out = in ^ gamma;
gpu can only do LG2/EX2 therefore we transform into
in ^ gamma = 2 ^ (log2(in) * gamma).
Lots of scalar ops, unfortunately (better solution?) -
without gamma that's 3 inst, with gamma it's 10...
could use different gamma factors per channel,
if that's of any use. */
}
CLEAR (cb_conf);
CLEAR (tex_res);
CLEAR (tex_samp);
CLEAR (vs_conf);
CLEAR (ps_conf);
CLEAR (vs_const_conf);
CLEAR (ps_const_conf);
dst_obj.offset = 0;
src_obj.offset = 0;
dst_obj.bo = radeon_get_pixmap_bo(pPixmap);
dst_obj.tiling_flags = radeon_get_pixmap_tiling(pPixmap);
dst_obj.surface = radeon_get_pixmap_surface(pPixmap);
//.........这里部分代码省略.........
示例9: rdpPolyGlyphBlt
void
rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr* ppci, pointer pglyphBase)
{
RegionRec reg;
RegionRec reg1;
int num_clips;
int cd;
int j;
int got_id;
BoxRec box;
struct image_data id;
WindowPtr pDstWnd;
PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv;
LLOGLN(10, ("rdpPolyGlyphBlt:"));
if (nglyph != 0)
{
GetTextBoundingBox(pDrawable, pGC->font, x, y, nglyph, &box);
}
/* do original call */
rdpPolyGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
got_id = 0;
if (pDrawable->type == DRAWABLE_PIXMAP)
{
pDstPixmap = (PixmapPtr)pDrawable;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
{
rdpup_switch_os_surface(pDstPriv->rdpindex);
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)
{
return;
}
RegionInit(®, NullBox, 0);
if (nglyph == 0)
{
cd = 0;
}
else
{
cd = rdp_get_clip(®, pDrawable, pGC);
}
if (cd == 1)
{
rdpup_begin_update();
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
rdpup_end_update();
}
else if (cd == 2)
{
RegionInit(®1, &box, 0);
RegionIntersect(®, ®, ®1);
num_clips = REGION_NUM_RECTS(®);
if (num_clips > 0)
{
rdpup_begin_update();
for (j = num_clips - 1; j >= 0; j--)
{
box = REGION_RECTS(®)[j];
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
}
rdpup_end_update();
}
RegionUninit(®1);
}
RegionUninit(®);
rdpup_switch_os_surface(-1);
return;
}
示例10: fbPutXYImage
void
fbPutXYImage (DrawablePtr pDrawable,
RegionPtr pClip,
FbBits fg,
FbBits bg,
FbBits pm,
int alu,
Bool opaque,
int x,
int y,
int width,
int height,
FbStip *src,
FbStride srcStride,
int srcX)
{
FbBits *dst;
FbStride dstStride;
int dstBpp;
int dstXoff, dstYoff;
int nbox;
BoxPtr pbox;
int x1, y1, x2, y2;
FbBits fgand = 0, fgxor = 0, bgand = 0, bgxor = 0;
fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
if (dstBpp == 1)
{
if (opaque)
alu = FbOpaqueStipple1Rop(alu,fg,bg);
else
alu = FbStipple1Rop(alu,fg);
}
else
{
fgand = fbAnd(alu,fg,pm);
fgxor = fbXor(alu,fg,pm);
if (opaque)
{
bgand = fbAnd(alu,bg,pm);
bgxor = fbXor(alu,bg,pm);
}
else
{
bgand = fbAnd(GXnoop,(FbBits)0,FB_ALLONES);
bgxor = fbXor(GXnoop,(FbBits)0,FB_ALLONES);
}
}
for (nbox = REGION_NUM_RECTS (pClip),
pbox = REGION_RECTS(pClip);
nbox--;
pbox++)
{
x1 = x;
y1 = y;
x2 = x + width;
y2 = y + height;
if (x1 < pbox->x1)
x1 = pbox->x1;
if (y1 < pbox->y1)
y1 = pbox->y1;
if (x2 > pbox->x2)
x2 = pbox->x2;
if (y2 > pbox->y2)
y2 = pbox->y2;
if (x1 >= x2 || y1 >= y2)
continue;
if (dstBpp == 1)
{
fbBltStip (src + (y1 - y) * srcStride,
srcStride,
(x1 - x) + srcX,
(FbStip *) (dst + (y1 + dstYoff) * dstStride),
FbBitsStrideToStipStride(dstStride),
(x1 + dstXoff) * dstBpp,
(x2 - x1) * dstBpp,
(y2 - y1),
alu,
pm,
dstBpp);
}
else
{
fbBltOne (src + (y1 - y) * srcStride,
srcStride,
(x1 - x) + srcX,
dst + (y1 + dstYoff) * dstStride,
dstStride,
(x1 + dstXoff) * dstBpp,
dstBpp,
(x2 - x1) * dstBpp,
//.........这里部分代码省略.........
示例11: cfb8_32WidCopyWindow
void
cfb8_32WidCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
cfb8_32WidScreenPtr pScreenPriv =
CFB8_32WID_GET_SCREEN_PRIVATE(pScreen);
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
PixmapPtr pPixChildren;
DDXPointPtr ppt, pptSrc;
RegionRec rgnDst, rgnOther, rgnPixmap;
BoxPtr pbox;
int i, nbox, dx, dy, other_bpp;
REGION_NULL(pScreen, &rgnDst);
dx = ptOldOrg.x - pWin->drawable.x;
dy = ptOldOrg.y - pWin->drawable.y;
REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy);
REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
if ((nbox = REGION_NUM_RECTS(&rgnDst)) == 0) {
/* Nothing to render. */
REGION_UNINIT(pScreen, &rgnDst);
return;
}
/* First, copy the WID plane for the whole area. */
pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec));
if(pptSrc) {
pbox = REGION_RECTS(&rgnDst);
for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
ppt->x = pbox->x1 + dx;
ppt->y = pbox->y1 + dy;
}
pScreenPriv->WIDOps->WidCopyArea((DrawablePtr)pScreenPriv->pixWid,
&rgnDst, pptSrc);
DEALLOCATE_LOCAL(pptSrc);
}
/* Next, we copy children which have a different
* bpp than pWin into a temporary pixmap. We will
* toss this pixmap back onto the framebuffer before
* we return.
*/
if (pWin->drawable.bitsPerPixel == 8)
other_bpp = pScrn->bitsPerPixel;
else
other_bpp = 8;
REGION_NULL(pScreen, &rgnOther);
SegregateChildrenBpp(pWin, &rgnOther, 0,
other_bpp, pWin->drawable.bitsPerPixel);
pPixChildren = NULL;
if (REGION_NOTEMPTY(pScreen, &rgnOther)) {
REGION_INTERSECT(pScreen, &rgnOther, &rgnOther, prgnSrc);
nbox = REGION_NUM_RECTS(&rgnOther);
if (nbox) {
int width = rgnOther.extents.x2 - rgnOther.extents.x1;
int height = rgnOther.extents.y2 - rgnOther.extents.y1;
int depth = (other_bpp == 8) ? 8 : pScrn->depth;
if (other_bpp == 8)
pPixChildren = cfbCreatePixmap(pScreen, width, height, depth);
else
pPixChildren = cfb32CreatePixmap(pScreen, width, height, depth);
}
if (nbox &&
pPixChildren &&
(pptSrc = (DDXPointPtr) ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) {
pbox = REGION_RECTS(&rgnOther);
for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
ppt->x = pbox->x1 + dx;
ppt->y = pbox->y1 + dy;
}
REGION_NULL(pScreen, &rgnPixmap);
REGION_COPY(pScreen, &rgnPixmap, &rgnOther);
REGION_TRANSLATE(pScreen, &rgnPixmap, -(rgnOther.extents.x1), -(rgnOther.extents.y1));
if (other_bpp == 8)
cfbDoBitbltCopy((DrawablePtr)pScreenPriv->pix8,
(DrawablePtr)pPixChildren,
GXcopy, &rgnPixmap, pptSrc, ~0L);
else
cfb32DoBitbltCopy((DrawablePtr)pScreenPriv->pix32,
(DrawablePtr)pPixChildren,
GXcopy, &rgnPixmap, pptSrc, ~0L);
REGION_UNINIT(pScreen, &rgnPixmap);
DEALLOCATE_LOCAL(pptSrc);
}
REGION_SUBTRACT(pScreen, &rgnDst, &rgnDst, &rgnOther);
}
/* Now copy the parent along with all child windows using the same depth. */
nbox = REGION_NUM_RECTS(&rgnDst);
//.........这里部分代码省略.........
示例12: I915DisplayVideoTextured
void
I915DisplayVideoTextured(ScrnInfoPtr scrn,
intel_adaptor_private *adaptor_priv, int id,
RegionPtr dstRegion,
short width, short height, int video_pitch,
int video_pitch2,
short src_w, short src_h, short drw_w, short drw_h,
PixmapPtr pixmap)
{
intel_screen_private *intel = intel_get_screen_private(scrn);
uint32_t format, ms3, s5, tiling;
BoxPtr pbox = REGION_RECTS(dstRegion);
int nbox_total = REGION_NUM_RECTS(dstRegion);
int nbox_this_time;
int dxo, dyo, pix_xoff, pix_yoff;
PixmapPtr target;
#if 0
ErrorF("I915DisplayVideo: %dx%d (pitch %d)\n", width, height,
video_pitch);
#endif
dxo = dstRegion->extents.x1;
dyo = dstRegion->extents.y1;
if (pixmap->drawable.width > 2048 || pixmap->drawable.height > 2048 ||
!intel_uxa_check_pitch_3d(pixmap)) {
ScreenPtr screen = pixmap->drawable.pScreen;
target = screen->CreatePixmap(screen,
dstRegion->extents.x2 - dxo,
dstRegion->extents.y2 - dyo,
pixmap->drawable.depth,
CREATE_PIXMAP_USAGE_SCRATCH);
if (target == NULL)
return;
if (intel_uxa_get_pixmap_bo(target) == NULL) {
screen->DestroyPixmap(target);
return;
}
pix_xoff = -dxo;
pix_yoff = -dyo;
} else {
target = pixmap;
/* Set up the offset for translating from the given region
* (in screen coordinates) to the backing pixmap.
*/
#ifdef COMPOSITE
pix_xoff = -target->screen_x + target->drawable.x;
pix_yoff = -target->screen_y + target->drawable.y;
#else
pix_xoff = 0;
pix_yoff = 0;
#endif
}
#define BYTES_FOR_BOXES(n) ((200 + (n) * 20) * 4)
#define BOXES_IN_BYTES(s) ((((s)/4) - 200) / 20)
#define BATCH_BYTES(p) ((p)->batch_bo->size - 16)
while (nbox_total) {
nbox_this_time = nbox_total;
if (BYTES_FOR_BOXES(nbox_this_time) > BATCH_BYTES(intel))
nbox_this_time = BOXES_IN_BYTES(BATCH_BYTES(intel));
nbox_total -= nbox_this_time;
intel_batch_start_atomic(scrn, 200 + 20 * nbox_this_time);
IntelEmitInvarientState(scrn);
intel->last_3d = LAST_3D_VIDEO;
/* draw rect -- just clipping */
OUT_BATCH(_3DSTATE_DRAW_RECT_CMD);
OUT_BATCH(DRAW_DITHER_OFS_X(pixmap->drawable.x & 3) |
DRAW_DITHER_OFS_Y(pixmap->drawable.y & 3));
OUT_BATCH(0x00000000); /* ymin, xmin */
/* ymax, xmax */
OUT_BATCH((target->drawable.width - 1) |
(target->drawable.height - 1) << 16);
OUT_BATCH(0x00000000); /* yorigin, xorigin */
OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(2) |
I1_LOAD_S(5) | I1_LOAD_S(6) | 2);
OUT_BATCH(S2_TEXCOORD_FMT(0, TEXCOORDFMT_2D) |
S2_TEXCOORD_FMT(1, TEXCOORDFMT_NOT_PRESENT) |
S2_TEXCOORD_FMT(2, TEXCOORDFMT_NOT_PRESENT) |
S2_TEXCOORD_FMT(3, TEXCOORDFMT_NOT_PRESENT) |
S2_TEXCOORD_FMT(4, TEXCOORDFMT_NOT_PRESENT) |
S2_TEXCOORD_FMT(5, TEXCOORDFMT_NOT_PRESENT) |
S2_TEXCOORD_FMT(6, TEXCOORDFMT_NOT_PRESENT) |
S2_TEXCOORD_FMT(7, TEXCOORDFMT_NOT_PRESENT));
s5 = 0x0;
if (intel->cpp == 2)
s5 |= S5_COLOR_DITHER_ENABLE;
OUT_BATCH(s5); /* S5 - enable bits */
OUT_BATCH((2 << S6_DEPTH_TEST_FUNC_SHIFT) |
(2 << S6_CBUF_SRC_BLEND_FACT_SHIFT) |
//.........这里部分代码省略.........
示例13: rdpPolySegment
//.........这里部分代码省略.........
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);
post_process = 0;
if (pDrawable->type == DRAWABLE_PIXMAP)
{
pDstPixmap = (PixmapPtr) pDrawable;
pDstPriv = GETPIXPRIV(pDstPixmap);
}
else
{
if (pDrawable->type == DRAWABLE_WINDOW)
{
pDstWnd = (WindowPtr) pDrawable;
if (pDstWnd->viewable)
{
post_process = 1;
}
}
}
if (!post_process)
{
free(segs);
return;
}
RegionInit(&clip_reg, NullBox, 0);
cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
LLOGLN(10, ("rdpPolySegment: cd %d", cd));
if (cd == 1) /* no clip */
{
if (segs != 0)
{
XRDP_MSG_LINE_TO msg;
rdpup_begin_update();
msg.bRop2 = rdpup_convert_opcode(pGC->alu);
msg.penColor = rdpup_convert_color(pGC->fgPixel);
msg.penWidth = pGC->lineWidth;
msg.penStyle = 0;
for (i = 0; i < nseg; i++)
{
msg.nXStart = segs[i].x1;
msg.nYStart = segs[i].y1;
msg.nXEnd = segs[i].x2;
msg.nYEnd = segs[i].y2;
rdpup_draw_line(&msg);
}
rdpup_end_update();
}
}
else if (cd == 2) /* clip */
{
if (segs != 0)
{
XRDP_MSG_LINE_TO msg;
rdpup_begin_update();
msg.bRop2 = rdpup_convert_opcode(pGC->alu);
msg.penColor = rdpup_convert_color(pGC->fgPixel);
msg.penWidth = pGC->lineWidth;
msg.penStyle = 0;
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++)
{
msg.nXStart = segs[i].x1;
msg.nYStart = segs[i].y1;
msg.nXEnd = segs[i].x2;
msg.nYEnd = segs[i].y2;
rdpup_draw_line(&msg);
}
}
rdpup_reset_clip();
rdpup_end_update();
}
}
free(segs);
RegionUninit(&clip_reg);
}
示例14: region_pack
void region_pack(RegionPtr pregion, int threshold)
{
int i, num_rects;
int height, overhead, area1, area2, area3;
int joins = 0, sum_overhead = 0;
BoxRec prev_rect, this_rect, tmp_rect;
RegionRec tmp_region, add_region;
num_rects = REGION_NUM_RECTS(pregion);
if (num_rects < 2) {
return; /* nothing to optimize */
}
REGION_INIT(&add_region, NullBox, 16);
prev_rect = REGION_RECTS(pregion)[0];
for (i = 1; i < num_rects; i++) {
this_rect = REGION_RECTS(pregion)[i];
if (this_rect.y1 == prev_rect.y1 && this_rect.y2 == prev_rect.y2) {
/* Try to join two rectangles of the same "band" */
if (prev_rect.x2 > this_rect.x1) {
report_bad_rect_order();
REGION_UNINIT(&add_region);
return;
}
height = this_rect.y2 - this_rect.y1;
overhead = (this_rect.x1 - prev_rect.x2) * height;
if (overhead < threshold) {
tmp_rect.y1 = prev_rect.y1;
tmp_rect.y2 = prev_rect.y2;
tmp_rect.x1 = prev_rect.x2;
tmp_rect.x2 = this_rect.x1;
REGION_INIT(&tmp_region, &tmp_rect, 1);
REGION_UNION(&add_region, &add_region, &tmp_region);
REGION_UNINIT(&tmp_region);
joins++;
sum_overhead += overhead;
}
} else {
/* Try to join two rectangles of neighboring "bands" */
area1 = (prev_rect.x2 - prev_rect.x1) * (prev_rect.y2 - prev_rect.y1);
area2 = (this_rect.x2 - this_rect.x1) * (this_rect.y2 - this_rect.y1);
tmp_rect.x1 = min(prev_rect.x1, this_rect.x1);
tmp_rect.x2 = max(prev_rect.x2, this_rect.x2);
tmp_rect.y1 = min(prev_rect.y1, this_rect.y1);
tmp_rect.y2 = max(prev_rect.y2, this_rect.y2);
area3 = (tmp_rect.x2 - tmp_rect.x1) * (tmp_rect.y2 - tmp_rect.y1);
overhead = area3 - area2 - area1;
if (overhead < threshold || overhead < (area1 + area2) / 100) {
REGION_INIT(&tmp_region, &tmp_rect, 1);
REGION_UNION(&add_region, &add_region, &tmp_region);
REGION_UNINIT(&tmp_region);
joins++;
sum_overhead += overhead;
this_rect = tmp_rect; /* copy the joined one to prev_rect */
}
}
prev_rect = this_rect;
}
if (sum_overhead) {
REGION_UNION(pregion, pregion, &add_region);
log_write(LL_DEBUG, "Joined rectangles: %d -> %d, overhead %d",
num_rects, (int)(REGION_NUM_RECTS(pregion)), sum_overhead);
}
REGION_UNINIT(&add_region);
}
示例15: PsPaintWindow
void
PsPaintWindow(
WindowPtr pWin,
RegionPtr pRegion,
int what)
{
int status;
WindowPtr pRoot;
#define FUNCTION 0
#define FOREGROUND 1
#define TILE 2
#define FILLSTYLE 3
#define ABSX 4
#define ABSY 5
#define CLIPMASK 6
#define SUBWINDOW 7
#define COUNT_BITS 8
pointer gcval[7];
pointer newValues [COUNT_BITS];
BITS32 gcmask, index, mask;
RegionRec prgnWin;
DDXPointRec oldCorner;
BoxRec box;
WindowPtr pBgWin;
GCPtr pGC;
register int i;
register BoxPtr pbox;
register ScreenPtr pScreen = pWin->drawable.pScreen;
register xRectangle *prect;
int numRects;
gcmask = 0;
/*
* We don't want to paint a window that has no place to put the
* PS output.
*/
if( PsGetContextFromWindow(pWin)==(XpContextPtr)NULL ) return;
if( what==PW_BACKGROUND )
{
switch(pWin->backgroundState)
{
case None: return;
case ParentRelative:
(*pWin->parent->drawable.pScreen->PaintWindowBackground)
(pWin->parent, pRegion, what);
return;
case BackgroundPixel:
newValues[FOREGROUND] = (pointer)pWin->background.pixel;
newValues[FILLSTYLE] = (pointer)FillSolid;
gcmask |= GCForeground | GCFillStyle;
break;
case BackgroundPixmap:
newValues[TILE] = (pointer)pWin->background.pixmap;
newValues[FILLSTYLE] = (pointer)FillTiled;
gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin;
break;
}
}
else
{
if( pWin->borderIsPixel )
{
newValues[FOREGROUND] = (pointer)pWin->border.pixel;
newValues[FILLSTYLE] = (pointer)FillSolid;
gcmask |= GCForeground | GCFillStyle;
}
else
{
newValues[TILE] = (pointer)pWin->border.pixmap;
newValues[FILLSTYLE] = (pointer)FillTiled;
gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin;
}
}
prect = (xRectangle *)ALLOCATE_LOCAL(REGION_NUM_RECTS(pRegion) *
sizeof(xRectangle));
if( !prect ) return;
newValues[FUNCTION] = (pointer)GXcopy;
gcmask |= GCFunction | GCClipMask;
i = pScreen->myNum;
pRoot = WindowTable[i];
pBgWin = pWin;
if (what == PW_BORDER)
{
while( pBgWin->backgroundState==ParentRelative ) pBgWin = pBgWin->parent;
}
pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
if( !pGC )
{
DEALLOCATE_LOCAL(prect);
return;
//.........这里部分代码省略.........