summaryrefslogtreecommitdiff
path: root/drv/impedgc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drv/impedgc.c')
-rw-r--r--drv/impedgc.c197
1 files changed, 86 insertions, 111 deletions
diff --git a/drv/impedgc.c b/drv/impedgc.c
index ca9324695..54674d1cb 100644
--- a/drv/impedgc.c
+++ b/drv/impedgc.c
@@ -12,6 +12,7 @@
#include "gcstruct.h"
#include "drv_gcstruct.h"
+#include "drv_pixmapstr.h"
#include "gc.h"
#include "migc.h"
#include "mi.h"
@@ -47,6 +48,41 @@ static void SyncDrvGC(GCPtr pGC, DrvGCPtr pDrvGC, int index)
}
}
+static void setup_shatter_clip(RegionPtr orig_region, DrvGCPtr pDrvGC, DrvPixmapPtr pDrvPixmap)
+{
+ BoxRec pixbox;
+ RegionRec pixclip;
+
+ pixbox.x1 = pDrvPixmap->shattered_x;
+ pixbox.x2 = pDrvPixmap->shattered_x + pDrvPixmap->width;
+ pixbox.y1 = pDrvPixmap->shattered_y;
+ pixbox.y2 = pDrvPixmap->shattered_y + pDrvPixmap->height;
+
+ /* adjust the composite clip */
+ RegionInit(&pixclip, &pixbox, 1);
+
+ RegionNull(orig_region);
+ RegionCopy(orig_region, pDrvGC->pCompositeClip);
+ RegionIntersect(pDrvGC->pCompositeClip, orig_region, &pixclip);
+}
+
+static void finish_shatter_clip(RegionPtr orig_region, DrvGCPtr pDrvGC)
+{
+ RegionCopy(pDrvGC->pCompositeClip, orig_region);
+}
+
+#define FOR_EACH_PIXMAP(op) for (int _i = 0; _i < imped_screen->num_gpu; _i++) { \
+ DrvGCPtr _pDrvGC = imped_gc->gpu[_i]; \
+ DrvPixmapPtr _pDrvPixmap = imped_pixmap->gpu[_i]; \
+ RegionRec orig_region; \
+ while (_pDrvPixmap) { \
+ if (imped_pixmap->shattered) setup_shatter_clip(&orig_region, _pDrvGC, _pDrvPixmap); \
+ op; \
+ if (imped_pixmap->shattered) finish_shatter_clip(&orig_region, _pDrvGC); \
+ _pDrvPixmap = _pDrvPixmap->shatter_next; \
+ } \
+ }
+
void
impedValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
{
@@ -95,7 +131,6 @@ impedFillSpans (DrawablePtr pDrawable,
int i;
int x_off, y_off;
PixmapPtr pPixmap = GetDrawablePixmap(pDrawable);
- DrvGCPtr pDrvGC;
impedGCPrivPtr imped_gc = impedGetGC(pGC);
impedPixmapPrivPtr imped_pixmap = impedGetPixmap(pPixmap);
impedScreenPrivPtr imped_screen = impedGetScreen(pDrawable->pScreen);
@@ -105,15 +140,12 @@ impedFillSpans (DrawablePtr pDrawable,
pptInit[i].y += y_off;
}
- for (i = 0; i < imped_screen->num_gpu; i++) {
- pDrvGC = imped_gc->gpu[i];
- pDrvGC->ops->FillSpans(imped_pixmap->gpu[i],
- pDrvGC,
- nInit,
- pptInit,
- pwidthInit,
- fSorted);
- }
+ FOR_EACH_PIXMAP(_pDrvGC->ops->FillSpans(_pDrvPixmap,
+ _pDrvGC,
+ nInit,
+ pptInit,
+ pwidthInit,
+ fSorted));
}
static void
@@ -128,7 +160,6 @@ impedSetSpans (DrawablePtr pDrawable,
int i;
int x_off, y_off;
PixmapPtr pPixmap = (PixmapPtr)GetDrawablePixmap(pDrawable);
- DrvGCPtr pDrvGC;
impedGCPrivPtr imped_gc = impedGetGC(pGC);
impedPixmapPrivPtr imped_pixmap = impedGetPixmap(pPixmap);
impedScreenPrivPtr imped_screen = impedGetScreen(pDrawable->pScreen);
@@ -139,16 +170,14 @@ impedSetSpans (DrawablePtr pDrawable,
ppt[i].y += y_off;
}
- for (i = 0; i < imped_screen->num_gpu; i++) {
- pDrvGC = imped_gc->gpu[i];
- pDrvGC->ops->SetSpans(imped_pixmap->gpu[i],
- pDrvGC,
- src,
- ppt,
- pwidth,
- nspans,
- fSorted);
- }
+
+ FOR_EACH_PIXMAP(_pDrvGC->ops->SetSpans(_pDrvPixmap,
+ _pDrvGC,
+ src,
+ ppt,
+ pwidth,
+ nspans,
+ fSorted));
}
static void
@@ -165,22 +194,18 @@ impedPutImage (DrawablePtr pDrawable,
{
int x_off, y_off;
PixmapPtr pPixmap = (PixmapPtr)GetDrawablePixmap(pDrawable);
- DrvGCPtr pDrvGC;
impedGCPrivPtr imped_gc = impedGetGC(pGC);
impedPixmapPrivPtr imped_pixmap = impedGetPixmap(pPixmap);
impedScreenPrivPtr imped_screen = impedGetScreen(pDrawable->pScreen);
- int i;
impedGetDrawableDeltas(pDrawable, pPixmap, &x_off, &y_off);
x += x_off;
y += y_off;
- for (i = 0; i < imped_screen->num_gpu; i++) {
- pDrvGC = imped_gc->gpu[i];
- pDrvGC->ops->PutImage(imped_pixmap->gpu[i],
- pDrvGC,
- depth, x, y, w, h,
- leftPad, format, pImage);
- }
+
+ FOR_EACH_PIXMAP(_pDrvGC->ops->PutImage(_pDrvPixmap,
+ _pDrvGC,
+ depth, x, y, w, h,
+ leftPad, format, pImage));
}
@@ -194,7 +219,6 @@ impedPolyPoint (DrawablePtr pDrawable,
int i;
PixmapPtr pPixmap = (PixmapPtr)GetDrawablePixmap(pDrawable);
int x_off, y_off;
- DrvGCPtr pDrvGC;
impedGCPrivPtr imped_gc = impedGetGC(pGC);
impedPixmapPrivPtr imped_pixmap = impedGetPixmap(pPixmap);
impedScreenPrivPtr imped_screen = impedGetScreen(pDrawable->pScreen);
@@ -209,11 +233,8 @@ impedPolyPoint (DrawablePtr pDrawable,
pptInit[i].y += y_off;
}
}
- for (i = 0; i < imped_screen->num_gpu; i++) {
- pDrvGC = imped_gc->gpu[i];
- pDrvGC->ops->PolyPoint(imped_pixmap->gpu[i],
- pDrvGC, mode, npt, pptInit);
- }
+ FOR_EACH_PIXMAP(_pDrvGC->ops->PolyPoint(_pDrvPixmap,
+ _pDrvGC, mode, npt, pptInit));
}
static void
@@ -226,7 +247,6 @@ impedPolyLines (DrawablePtr pDrawable,
int i;
PixmapPtr pPixmap = (PixmapPtr)GetDrawablePixmap(pDrawable);
int x_off, y_off;
- DrvGCPtr pDrvGC;
impedGCPrivPtr imped_gc = impedGetGC(pGC);
impedPixmapPrivPtr imped_pixmap = impedGetPixmap(pPixmap);
impedScreenPrivPtr imped_screen = impedGetScreen(pDrawable->pScreen);
@@ -242,11 +262,9 @@ impedPolyLines (DrawablePtr pDrawable,
ppt[i].y += y_off;
}
}
- for (i = 0; i < imped_screen->num_gpu; i++) {
- pDrvGC = imped_gc->gpu[i];
- pDrvGC->ops->Polylines(imped_pixmap->gpu[i],
- pDrvGC, mode, npt, ppt);
- }
+
+ FOR_EACH_PIXMAP(_pDrvGC->ops->Polylines(_pDrvPixmap,
+ _pDrvGC, mode, npt, ppt));
}
static void
@@ -258,7 +276,6 @@ impedPolySegment (DrawablePtr pDrawable,
int i;
PixmapPtr pPixmap = (PixmapPtr)GetDrawablePixmap(pDrawable);
int x_off, y_off;
- DrvGCPtr pDrvGC;
impedGCPrivPtr imped_gc = impedGetGC(pGC);
impedPixmapPrivPtr imped_pixmap = impedGetPixmap(pPixmap);
impedScreenPrivPtr imped_screen = impedGetScreen(pDrawable->pScreen);
@@ -270,11 +287,8 @@ impedPolySegment (DrawablePtr pDrawable,
pSegs[i].y1 += y_off;
pSegs[i].y2 += y_off;
}
- for (i = 0; i < imped_screen->num_gpu; i++) {
- pDrvGC = imped_gc->gpu[i];
- pDrvGC->ops->PolySegment(imped_pixmap->gpu[i],
- pDrvGC, nseg, pSegs);
- }
+ FOR_EACH_PIXMAP(_pDrvGC->ops->PolySegment(_pDrvPixmap,
+ _pDrvGC, nseg, pSegs));
}
static void
@@ -283,7 +297,6 @@ impedPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, xRectangle *pRe
int i;
PixmapPtr pPixmap = (PixmapPtr)GetDrawablePixmap(pDrawable);
int x_off, y_off;
- DrvGCPtr pDrvGC;
impedGCPrivPtr imped_gc = impedGetGC(pGC);
impedPixmapPrivPtr imped_pixmap = impedGetPixmap(pPixmap);
impedScreenPrivPtr imped_screen = impedGetScreen(pDrawable->pScreen);
@@ -293,10 +306,8 @@ impedPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, xRectangle *pRe
pRects[i].x += x_off;
pRects[i].y += y_off;
}
- for (i = 0; i < imped_screen->num_gpu; i++) {
- pDrvGC = imped_gc->gpu[i];
- pDrvGC->ops->PolyRectangle(imped_pixmap->gpu[i], pDrvGC, nrects, pRects);
- }
+
+ FOR_EACH_PIXMAP(_pDrvGC->ops->PolyRectangle(_pDrvPixmap, _pDrvGC, nrects, pRects));
}
static void impedPolyArc (DrawablePtr pDrawable,
@@ -307,7 +318,6 @@ static void impedPolyArc (DrawablePtr pDrawable,
int i;
PixmapPtr pPixmap = (PixmapPtr)GetDrawablePixmap(pDrawable);
int x_off, y_off;
- DrvGCPtr pDrvGC;
impedGCPrivPtr imped_gc = impedGetGC(pGC);
impedPixmapPrivPtr imped_pixmap = impedGetPixmap(pPixmap);
impedScreenPrivPtr imped_screen = impedGetScreen(pDrawable->pScreen);
@@ -317,10 +327,7 @@ static void impedPolyArc (DrawablePtr pDrawable,
parcs[i].x += x_off;
parcs[i].y += y_off;
}
- for (i = 0; i < imped_screen->num_gpu; i++) {
- pDrvGC = imped_gc->gpu[i];
- pDrvGC->ops->PolyArc(imped_pixmap->gpu[i], pDrvGC, narcs, parcs);
- }
+ FOR_EACH_PIXMAP(_pDrvGC->ops->PolyArc(_pDrvPixmap, _pDrvGC, narcs, parcs));
}
static void impedFillPolygon( DrawablePtr pDrawable, GCPtr pGC,
@@ -330,7 +337,6 @@ static void impedFillPolygon( DrawablePtr pDrawable, GCPtr pGC,
int i;
PixmapPtr pPixmap = (PixmapPtr)GetDrawablePixmap(pDrawable);
int x_off, y_off;
- DrvGCPtr pDrvGC;
impedGCPrivPtr imped_gc = impedGetGC(pGC);
impedPixmapPrivPtr imped_pixmap = impedGetPixmap(pPixmap);
impedScreenPrivPtr imped_screen = impedGetScreen(pDrawable->pScreen);
@@ -340,11 +346,8 @@ static void impedFillPolygon( DrawablePtr pDrawable, GCPtr pGC,
pPts[i].x += x_off;
pPts[i].y += y_off;
}
- for (i = 0; i < imped_screen->num_gpu; i++) {
- pDrvGC = imped_gc->gpu[i];
- pDrvGC->ops->FillPolygon(imped_pixmap->gpu[i], pDrvGC, shape,
- mode, count, pPts);
- }
+ FOR_EACH_PIXMAP(_pDrvGC->ops->FillPolygon(_pDrvPixmap, _pDrvGC, shape,
+ mode, count, pPts));
}
static void impedPolyFillRect(DrawablePtr pDrawable,
@@ -355,7 +358,6 @@ static void impedPolyFillRect(DrawablePtr pDrawable,
int i;
PixmapPtr pPixmap = (PixmapPtr)GetDrawablePixmap(pDrawable);
int x_off, y_off;
- DrvGCPtr pDrvGC;
impedGCPrivPtr imped_gc = impedGetGC(pGC);
impedPixmapPrivPtr imped_pixmap = impedGetPixmap(pPixmap);
impedScreenPrivPtr imped_screen = impedGetScreen(pDrawable->pScreen);
@@ -366,10 +368,7 @@ static void impedPolyFillRect(DrawablePtr pDrawable,
prectInit[i].y += y_off;
}
- for (i = 0; i < imped_screen->num_gpu; i++) {
- pDrvGC = imped_gc->gpu[i];
- pDrvGC->ops->PolyFillRect(imped_pixmap->gpu[i], pDrvGC, nrectFill, prectInit);
- }
+ FOR_EACH_PIXMAP(_pDrvGC->ops->PolyFillRect(_pDrvPixmap, _pDrvGC, nrectFill, prectInit));
}
static void impedPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
@@ -377,7 +376,6 @@ static void impedPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *
int i;
PixmapPtr pPixmap = (PixmapPtr)GetDrawablePixmap(pDrawable);
int x_off, y_off;
- DrvGCPtr pDrvGC;
impedGCPrivPtr imped_gc = impedGetGC(pGC);
impedPixmapPrivPtr imped_pixmap = impedGetPixmap(pPixmap);
impedScreenPrivPtr imped_screen = impedGetScreen(pDrawable->pScreen);
@@ -388,16 +386,14 @@ static void impedPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *
parcs[i].x += x_off;
parcs[i].y += y_off;
}
- for (i = 0; i < imped_screen->num_gpu; i++) {
- pDrvGC = imped_gc->gpu[i];
- pDrvGC->ops->PolyFillArc(imped_pixmap->gpu[i], pDrvGC, narcs, parcs);
- }
+
+ FOR_EACH_PIXMAP(_pDrvGC->ops->PolyFillArc(_pDrvPixmap, _pDrvGC, narcs, parcs));
}
static int
impedPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars)
{
- int i, ret;
+ int i, ret = 0;
PixmapPtr pPixmap = (PixmapPtr)GetDrawablePixmap(pDrawable);
int x_off, y_off;
DrvGCPtr pDrvGC;
@@ -405,6 +401,7 @@ impedPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *
impedPixmapPrivPtr imped_pixmap = impedGetPixmap(pPixmap);
impedScreenPrivPtr imped_screen = impedGetScreen(pDrawable->pScreen);
impedGetDrawableDeltas(pDrawable, pPixmap, &x_off, &y_off);
+
for (i = 0; i < imped_screen->num_gpu; i++) {
pDrvGC = imped_gc->gpu[i];
ret = pDrvGC->ops->PolyText8(imped_pixmap->gpu[i], pDrvGC, x, y, count, chars);
@@ -422,7 +419,7 @@ impedPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsig
impedGCPrivPtr imped_gc = impedGetGC(pGC);
impedPixmapPrivPtr imped_pixmap = impedGetPixmap(pPixmap);
impedScreenPrivPtr imped_screen = impedGetScreen(pDrawable->pScreen);
- int ret;
+ int ret = 0;
impedGetDrawableDeltas(pDrawable, pPixmap, &x_off, &y_off);
@@ -438,38 +435,28 @@ impedPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsig
static void
impedImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars)
{
- int i;
PixmapPtr pPixmap = (PixmapPtr)GetDrawablePixmap(pDrawable);
int x_off, y_off;
- DrvGCPtr pDrvGC;
impedGCPrivPtr imped_gc = impedGetGC(pGC);
impedPixmapPrivPtr imped_pixmap = impedGetPixmap(pPixmap);
impedScreenPrivPtr imped_screen = impedGetScreen(pDrawable->pScreen);
impedGetDrawableDeltas(pDrawable, pPixmap, &x_off, &y_off);
- for (i = 0; i < imped_screen->num_gpu; i++) {
- pDrvGC = imped_gc->gpu[i];
- pDrvGC->ops->ImageText8(imped_pixmap->gpu[i], pDrvGC, x, y, count, chars);
- }
+ FOR_EACH_PIXMAP(_pDrvGC->ops->ImageText8(_pDrvPixmap, _pDrvGC, x, y, count, chars));
}
static void
impedImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars)
{
- int i;
PixmapPtr pPixmap = (PixmapPtr)GetDrawablePixmap(pDrawable);
int x_off, y_off;
- DrvGCPtr pDrvGC;
impedGCPrivPtr imped_gc = impedGetGC(pGC);
impedPixmapPrivPtr imped_pixmap = impedGetPixmap(pPixmap);
impedScreenPrivPtr imped_screen = impedGetScreen(pDrawable->pScreen);
impedGetDrawableDeltas(pDrawable, pPixmap, &x_off, &y_off);
- for (i = 0; i < imped_screen->num_gpu; i++) {
- pDrvGC = imped_gc->gpu[i];
- pDrvGC->ops->ImageText16(imped_pixmap->gpu[i], pDrvGC, x, y, count, chars);
- }
+ FOR_EACH_PIXMAP(_pDrvGC->ops->ImageText16(_pDrvPixmap, _pDrvGC, x, y, count, chars));
}
static void
@@ -483,21 +470,17 @@ impedPolyGlyphBlt (DrawablePtr pDrawable,
{
int x_off, y_off;
PixmapPtr pPixmap = (PixmapPtr)GetDrawablePixmap(pDrawable);
- DrvGCPtr pDrvGC;
impedGCPrivPtr imped_gc = impedGetGC(pGC);
impedPixmapPrivPtr imped_pixmap = impedGetPixmap(pPixmap);
impedScreenPrivPtr imped_screen = impedGetScreen(pDrawable->pScreen);
- int i;
impedGetDrawableDeltas(pDrawable, pPixmap, &x_off, &y_off);
x += x_off;
y += y_off;
- for (i = 0; i < imped_screen->num_gpu; i++) {
- pDrvGC = imped_gc->gpu[i];
- pDrvGC->ops->PolyGlyphBlt(imped_pixmap->gpu[i], pDrvGC,
- x, y, nglyph,
- ppci, pglyphBase);
- }
+
+ FOR_EACH_PIXMAP(_pDrvGC->ops->PolyGlyphBlt(_pDrvPixmap, _pDrvGC,
+ x, y, nglyph,
+ ppci, pglyphBase));
}
static void
@@ -511,20 +494,16 @@ impedImageGlyphBlt (DrawablePtr pDrawable,
{
int x_off, y_off;
PixmapPtr pPixmap = (PixmapPtr)GetDrawablePixmap(pDrawable);
- DrvGCPtr pDrvGC;
impedGCPrivPtr imped_gc = impedGetGC(pGC);
impedPixmapPrivPtr imped_pixmap = impedGetPixmap(pPixmap);
- int i;
impedScreenPrivPtr imped_screen = impedGetScreen(pDrawable->pScreen);
+
impedGetDrawableDeltas(pDrawable, pPixmap, &x_off, &y_off);
x += x_off;
y += y_off;
- for (i = 0; i < imped_screen->num_gpu; i++) {
- pDrvGC = imped_gc->gpu[i];
- pDrvGC->ops->ImageGlyphBlt(imped_pixmap->gpu[i], pDrvGC,
- x, y, nglyph,
- ppciInit, pglyphBase);
- }
+ FOR_EACH_PIXMAP(_pDrvGC->ops->ImageGlyphBlt(_pDrvPixmap, _pDrvGC,
+ x, y, nglyph,
+ ppciInit, pglyphBase));
}
void
@@ -700,22 +679,18 @@ impedPushPixels (GCPtr pGC,
{
int x_off, y_off;
PixmapPtr pPixmap = (PixmapPtr)GetDrawablePixmap(pDrawable);
- DrvGCPtr pDrvGC;
impedGCPrivPtr imped_gc = impedGetGC(pGC);
impedPixmapPrivPtr imped_pixmap = impedGetPixmap(pPixmap);
impedPixmapPrivPtr imped_bitmap = impedGetPixmap(pBitmap);
impedScreenPrivPtr imped_screen = impedGetScreen(pDrawable->pScreen);
- int i;
impedGetDrawableDeltas(pDrawable, pPixmap, &x_off, &y_off);
xOrg += x_off;
yOrg += y_off;
- for (i = 0; i < imped_screen->num_gpu; i++) {
- pDrvGC = imped_gc->gpu[i];
- pDrvGC->ops->PushPixels(pDrvGC, imped_bitmap->gpu[i], imped_pixmap->gpu[i],
- dx, dy, xOrg, yOrg);
- }
+ FOR_EACH_PIXMAP(_pDrvGC->ops->PushPixels(_pDrvGC, imped_bitmap->gpu[_i], _pDrvPixmap,
+ dx, dy, xOrg, yOrg));
+
}
const GCOps impedGCOps = {