本文整理汇总了C++中RegionNumRects函数的典型用法代码示例。如果您正苦于以下问题:C++ RegionNumRects函数的具体用法?C++ RegionNumRects怎么用?C++ RegionNumRects使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RegionNumRects函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: XAAOverWindowExposures
void
XAAOverWindowExposures(WindowPtr pWin, RegionPtr pReg, RegionPtr pOtherReg)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
if ((pWin->drawable.bitsPerPixel != 8) && infoRec->pScrn->vtSema) {
if (RegionNumRects(pReg) && infoRec->FillSolidRects) {
XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen);
SWITCH_DEPTH(8);
(*infoRec->FillSolidRects) (infoRec->pScrn,
infoRec->pScrn->colorKey, GXcopy, ~0,
RegionNumRects(pReg),
RegionRects(pReg));
miWindowExposures(pWin, pReg, pOtherReg);
return;
}
else if (infoRec->NeedToSync) {
(*infoRec->Sync) (infoRec->pScrn);
infoRec->NeedToSync = FALSE;
}
}
XAA_SCREEN_PROLOGUE(pScreen, WindowExposures);
(*pScreen->WindowExposures) (pWin, pReg, pOtherReg);
XAA_SCREEN_EPILOGUE(pScreen, WindowExposures, XAAOverWindowExposures);
}
示例2: fbPushImage
void
fbPushImage(DrawablePtr pDrawable,
GCPtr pGC,
FbStip * src,
FbStride srcStride, int srcX, int x, int y, int width, int height)
{
RegionPtr pClip = fbGetCompositeClip(pGC);
int nbox;
BoxPtr pbox;
int x1, y1, x2, y2;
for (nbox = RegionNumRects(pClip),
pbox = RegionRects(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;
fbPushFill(pDrawable,
pGC,
src + (y1 - y) * srcStride,
srcStride, srcX + (x1 - x), x1, y1, x2 - x1, y2 - y1);
}
}
示例3: ephyrInternalDamageRedisplay
static void
ephyrInternalDamageRedisplay(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
RegionPtr pRegion;
if (!scrpriv || !scrpriv->pDamage)
return;
pRegion = DamageRegion(scrpriv->pDamage);
if (RegionNotEmpty(pRegion)) {
int nbox;
BoxPtr pbox;
if (ephyr_glamor) {
ephyr_glamor_damage_redisplay(scrpriv->glamor, pRegion);
} else {
nbox = RegionNumRects(pRegion);
pbox = RegionRects(pRegion);
while (nbox--) {
hostx_paint_rect(screen,
pbox->x1, pbox->y1,
pbox->x1, pbox->y1,
pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
pbox++;
}
}
DamageEmpty(scrpriv->pDamage);
}
}
示例4: fbPolySegment
void
fbPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg)
{
void (*seg) (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg);
if (pGC->lineWidth == 0) {
seg = fbZeroSegment;
if (pGC->fillStyle == FillSolid &&
pGC->lineStyle == LineSolid &&
RegionNumRects(fbGetCompositeClip(pGC)) == 1) {
switch (pDrawable->bitsPerPixel) {
case 8:
seg = fbPolySegment8;
break;
case 16:
seg = fbPolySegment16;
break;
case 32:
seg = fbPolySegment32;
break;
}
}
}
else {
seg = miPolySegment;
}
(*seg) (pDrawable, pGC, nseg, pseg);
}
示例5: glamor_dash_loop
static void
glamor_dash_loop(DrawablePtr drawable, GCPtr gc, glamor_program *prog,
int n, GLenum mode)
{
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
int box_index;
int off_x, off_y;
glEnable(GL_SCISSOR_TEST);
glamor_pixmap_loop(pixmap_priv, box_index) {
int nbox = RegionNumRects(gc->pCompositeClip);
BoxPtr box = RegionRects(gc->pCompositeClip);
glamor_set_destination_drawable(drawable, box_index, TRUE, TRUE,
prog->matrix_uniform, &off_x, &off_y);
while (nbox--) {
glScissor(box->x1 + off_x,
box->y1 + off_y,
box->x2 - box->x1,
box->y2 - box->y1);
box++;
glDrawArrays(mode, 0, n);
}
}
示例6: ShadowCopyWindow
static void
ShadowCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgn)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
int num = 0;
RegionRec rgnDst;
if (pPriv->vtSema) {
RegionNull(&rgnDst);
RegionCopy(&rgnDst, prgn);
RegionTranslate(&rgnDst,
pWin->drawable.x - ptOldOrg.x,
pWin->drawable.y - ptOldOrg.y);
RegionIntersect(&rgnDst, &pWin->borderClip, &rgnDst);
if ((num = RegionNumRects(&rgnDst))) {
if (pPriv->preRefresh)
(*pPriv->preRefresh) (pPriv->pScrn, num, RegionRects(&rgnDst));
}
else {
RegionUninit(&rgnDst);
}
}
pScreen->CopyWindow = pPriv->CopyWindow;
(*pScreen->CopyWindow) (pWin, ptOldOrg, prgn);
pScreen->CopyWindow = ShadowCopyWindow;
if (num) {
if (pPriv->postRefresh)
(*pPriv->postRefresh) (pPriv->pScrn, num, RegionRects(&rgnDst));
RegionUninit(&rgnDst);
}
}
示例7: miWindowExposures
void
miWindowExposures(WindowPtr pWin, RegionPtr prgn)
{
RegionPtr exposures = prgn;
if (prgn && !RegionNil(prgn)) {
RegionRec expRec;
int clientInterested =
(pWin->eventMask | wOtherEventMasks(pWin)) & ExposureMask;
if (clientInterested && (RegionNumRects(prgn) > RECTLIMIT)) {
/*
* If we have LOTS of rectangles, we decide to take the extents
* and force an exposure on that. This should require much less
* work overall, on both client and server. This is cheating, but
* isn't prohibited by the protocol ("spontaneous combustion" :-).
*/
BoxRec box = *RegionExtents(prgn);
exposures = &expRec;
RegionInit(exposures, &box, 1);
RegionReset(prgn, &box);
/* miPaintWindow doesn't clip, so we have to */
RegionIntersect(prgn, prgn, &pWin->clipList);
}
pWin->drawable.pScreen->PaintWindow(pWin, prgn, PW_BACKGROUND);
if (clientInterested)
miSendExposures(pWin, exposures,
pWin->drawable.x, pWin->drawable.y);
if (exposures == &expRec)
RegionUninit(exposures);
RegionEmpty(prgn);
}
}
示例8: miSendExposures
void
miSendExposures(WindowPtr pWin, RegionPtr pRgn, int dx, int dy)
{
BoxPtr pBox;
int numRects;
xEvent *pEvent, *pe;
int i;
pBox = RegionRects(pRgn);
numRects = RegionNumRects(pRgn);
if (!(pEvent = calloc(1, numRects * sizeof(xEvent))))
return;
for (i = numRects, pe = pEvent; --i >= 0; pe++, pBox++) {
pe->u.u.type = Expose;
pe->u.expose.window = pWin->drawable.id;
pe->u.expose.x = pBox->x1 - dx;
pe->u.expose.y = pBox->y1 - dy;
pe->u.expose.width = pBox->x2 - pBox->x1;
pe->u.expose.height = pBox->y2 - pBox->y1;
pe->u.expose.count = i;
}
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
int scrnum = pWin->drawable.pScreen->myNum;
int x = 0, y = 0;
XID realWin = 0;
if (!pWin->parent) {
x = screenInfo.screens[scrnum]->x;
y = screenInfo.screens[scrnum]->y;
pWin = screenInfo.screens[0]->root;
realWin = pWin->drawable.id;
}
else if (scrnum) {
PanoramiXRes *win;
win = PanoramiXFindIDByScrnum(XRT_WINDOW,
pWin->drawable.id, scrnum);
if (!win) {
free(pEvent);
return;
}
realWin = win->info[0].id;
dixLookupWindow(&pWin, realWin, serverClient, DixSendAccess);
}
if (x || y || scrnum)
for (i = 0; i < numRects; i++) {
pEvent[i].u.expose.window = realWin;
pEvent[i].u.expose.x += x;
pEvent[i].u.expose.y += y;
}
}
#endif
DeliverEvents(pWin, pEvent, numRects, NullWindow);
free(pEvent);
}
示例9: fbPolyLine
void
fbPolyLine(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt)
{
void (*line) (DrawablePtr, GCPtr, int mode, int npt, DDXPointPtr ppt);
if (pGC->lineWidth == 0) {
line = fbZeroLine;
if (pGC->fillStyle == FillSolid &&
pGC->lineStyle == LineSolid &&
RegionNumRects(fbGetCompositeClip(pGC)) == 1) {
switch (pDrawable->bitsPerPixel) {
case 8:
line = fbPolyline8;
break;
case 16:
line = fbPolyline16;
break;
case 32:
line = fbPolyline32;
break;
}
}
}
else {
if (pGC->lineStyle != LineSolid)
line = miWideDash;
else
line = miWideLine;
}
(*line) (pDrawable, pGC, mode, npt, ppt);
}
示例10: shadowUpdateIplan2p4
void
shadowUpdateIplan2p4(ScreenPtr pScreen, shadowBufPtr pBuf)
{
RegionPtr damage = shadowDamage(pBuf);
PixmapPtr pShadow = pBuf->pPixmap;
int nbox = RegionNumRects(damage);
BoxPtr pbox = RegionRects(damage);
FbBits *shaBase;
CARD16 *shaLine, *sha;
FbStride shaStride;
int scrLine;
_X_UNUSED int shaBpp, shaXoff, shaYoff;
int x, y, w, h;
int i, n;
CARD16 *win;
_X_UNUSED CARD32 winSize;
union {
CARD8 bytes[8];
CARD32 words[2];
} d;
fbGetDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff,
shaYoff);
shaStride *= sizeof(FbBits) / sizeof(CARD16);
while (nbox--) {
x = pbox->x1;
y = pbox->y1;
w = pbox->x2 - pbox->x1;
h = pbox->y2 - pbox->y1;
scrLine = (x & -16) / 2;
shaLine = (CARD16 *)shaBase + y * shaStride + scrLine / sizeof(CARD16);
n = ((x & 15) + w + 15) / 16; /* number of c2p units in scanline */
while (h--) {
sha = shaLine;
win = (CARD16 *) (*pBuf->window) (pScreen,
y,
scrLine,
SHADOW_WINDOW_WRITE,
&winSize,
pBuf->closure);
if (!win)
return;
for (i = 0; i < n; i++) {
memcpy(d.bytes, sha, sizeof(d.bytes));
c2p_16x4(d.words);
store_iplan2p4(win, d.words);
sha += sizeof(d.bytes) / sizeof(*sha);
win += sizeof(d.bytes) / sizeof(*win);
}
shaLine += shaStride;
y++;
}
pbox++;
}
}
示例11: fbPutZImage
void
fbPutZImage (DrawablePtr pDrawable,
RegionPtr pClip,
int alu,
FbBits pm,
int x,
int y,
int width,
int height,
FbStip *src,
FbStride srcStride)
{
FbStip *dst;
FbStride dstStride;
int dstBpp;
int dstXoff, dstYoff;
int nbox;
BoxPtr pbox;
int x1, y1, x2, y2;
fbGetStipDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
for (nbox = RegionNumRects (pClip),
pbox = RegionRects(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;
fbBltStip (src + (y1 - y) * srcStride,
srcStride,
(x1 - x) * dstBpp,
dst + (y1 + dstYoff) * dstStride,
dstStride,
(x1 + dstXoff) * dstBpp,
(x2 - x1) * dstBpp,
(y2 - y1),
alu,
pm,
dstBpp);
}
fbFinishAccess (pDrawable);
}
示例12: XAACopyWindow
void
XAACopyWindow(
WindowPtr pWin,
DDXPointRec ptOldOrg,
RegionPtr prgnSrc )
{
DDXPointPtr pptSrc, ppt;
RegionRec rgnDst;
BoxPtr pbox;
int dx, dy, nbox;
WindowPtr pwinRoot;
ScreenPtr pScreen = pWin->drawable.pScreen;
XAAInfoRecPtr infoRec =
GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable));
if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) {
XAA_SCREEN_PROLOGUE (pScreen, CopyWindow);
if(infoRec->pScrn->vtSema && infoRec->NeedToSync) {
(*infoRec->Sync)(infoRec->pScrn);
infoRec->NeedToSync = FALSE;
}
(*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAACopyWindow);
return;
}
pwinRoot = pScreen->root;
RegionNull(&rgnDst);
dx = ptOldOrg.x - pWin->drawable.x;
dy = ptOldOrg.y - pWin->drawable.y;
RegionTranslate(prgnSrc, -dx, -dy);
RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
pbox = RegionRects(&rgnDst);
nbox = RegionNumRects(&rgnDst);
if(!nbox ||
!(pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec)))) {
RegionUninit(&rgnDst);
return;
}
ppt = pptSrc;
while(nbox--) {
ppt->x = pbox->x1 + dx;
ppt->y = pbox->y1 + dy;
ppt++; pbox++;
}
infoRec->ScratchGC.planemask = ~0L;
infoRec->ScratchGC.alu = GXcopy;
XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
&(infoRec->ScratchGC), &rgnDst, pptSrc);
free(pptSrc);
RegionUninit(&rgnDst);
}
示例13: xprCreateFrame
/*
* Create and display a new frame.
*/
static Bool
xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
int newX, int newY, RegionPtr pShape)
{
WindowPtr pWin = pFrame->win;
xp_window_changes wc;
unsigned int mask = 0;
xp_error err;
wc.x = newX;
wc.y = newY;
wc.width = pFrame->width;
wc.height = pFrame->height;
wc.bit_gravity = XP_GRAVITY_NONE;
mask |= XP_BOUNDS;
if (pWin->drawable.depth == 8) {
wc.depth = XP_DEPTH_INDEX8;
wc.colormap = xprColormapCallback;
wc.colormap_data = pScreen;
mask |= XP_COLORMAP;
}
else if (pWin->drawable.depth == 15)
wc.depth = XP_DEPTH_RGB555;
else if (pWin->drawable.depth == 24)
wc.depth = XP_DEPTH_ARGB8888;
else
wc.depth = XP_DEPTH_NIL;
mask |= XP_DEPTH;
if (pShape != NULL) {
wc.shape_nrects = RegionNumRects(pShape);
wc.shape_rects = RegionRects(pShape);
wc.shape_tx = wc.shape_ty = 0;
mask |= XP_SHAPE;
}
pFrame->level =
!IsRoot(pWin) ? AppleWMWindowLevelNormal : AppleWMNumWindowLevels;
if (XQuartzIsRootless)
wc.window_level = normal_window_levels[pFrame->level];
else if (XQuartzShieldingWindowLevel)
wc.window_level = XQuartzShieldingWindowLevel + 1;
else
wc.window_level = rooted_window_levels[pFrame->level];
mask |= XP_WINDOW_LEVEL;
err = xp_create_window(mask, &wc, (xp_window_id *)&pFrame->wid);
if (err != Success) {
return FALSE;
}
#ifdef HAVE_LIBDISPATCH
dispatch_async(window_hash_serial_q, ^ {
x_hash_table_insert(window_hash, pFrame->wid, pFrame);
});
示例14: miShapedWindowIn
/*
* Compute the visibility of a shaped window
*/
int
miShapedWindowIn (RegionPtr universe, RegionPtr bounding,
BoxPtr rect, int x, int y)
{
BoxRec box;
BoxPtr boundBox;
int nbox;
Bool someIn, someOut;
int t, x1, y1, x2, y2;
nbox = RegionNumRects (bounding);
boundBox = RegionRects (bounding);
someIn = someOut = FALSE;
x1 = rect->x1;
y1 = rect->y1;
x2 = rect->x2;
y2 = rect->y2;
while (nbox--)
{
if ((t = boundBox->x1 + x) < x1)
t = x1;
box.x1 = t;
if ((t = boundBox->y1 + y) < y1)
t = y1;
box.y1 = t;
if ((t = boundBox->x2 + x) > x2)
t = x2;
box.x2 = t;
if ((t = boundBox->y2 + y) > y2)
t = y2;
box.y2 = t;
if (box.x1 > box.x2)
box.x2 = box.x1;
if (box.y1 > box.y2)
box.y2 = box.y1;
switch (RegionContainsRect(universe, &box))
{
case rgnIN:
if (someOut)
return rgnPART;
someIn = TRUE;
break;
case rgnOUT:
if (someIn)
return rgnPART;
someOut = TRUE;
break;
default:
return rgnPART;
}
boundBox++;
}
if (someIn)
return rgnIN;
return rgnOUT;
}
示例15: glamor_glyphs_flush
static void
glamor_glyphs_flush(CARD8 op, PicturePtr src, PicturePtr dst,
glamor_program *prog,
struct glamor_glyph_atlas *atlas, int nglyph)
{
DrawablePtr drawable = dst->pDrawable;
glamor_screen_private *glamor_priv = glamor_get_screen_private(drawable->pScreen);
PixmapPtr atlas_pixmap = atlas->atlas;
glamor_pixmap_private *atlas_priv = glamor_get_pixmap_private(atlas_pixmap);
glamor_pixmap_fbo *atlas_fbo = glamor_pixmap_fbo_at(atlas_priv, 0, 0);
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
int box_x, box_y;
int off_x, off_y;
glamor_put_vbo_space(drawable->pScreen);
glEnable(GL_SCISSOR_TEST);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, atlas_fbo->tex);
for (;;) {
if (!glamor_use_program_render(prog, op, src, dst))
break;
glUniform1i(prog->atlas_uniform, 1);
glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
BoxPtr box = RegionRects(dst->pCompositeClip);
int nbox = RegionNumRects(dst->pCompositeClip);
glamor_set_destination_drawable(drawable, box_x, box_y, TRUE, FALSE, prog->matrix_uniform, &off_x, &off_y);
/* Run over the clip list, drawing the glyphs
* in each box
*/
while (nbox--) {
glScissor(box->x1 + off_x,
box->y1 + off_y,
box->x2 - box->x1,
box->y2 - box->y1);
box++;
if (glamor_glyph_use_130(glamor_priv))
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, nglyph);
else
glamor_glDrawArrays_GL_QUADS(glamor_priv, nglyph);
}
}
if (prog->alpha != glamor_program_alpha_ca_first)
break;
prog++;
}