summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2004-08-27 21:09:23 +0000
committerEric Anholt <anholt@freebsd.org>2004-08-27 21:09:23 +0000
commit971755765d6ef9cadf11127478af59189034d356 (patch)
tree225c3b5c2db86309885ae51e052722d8f1e92e45
parent1840a50bb763d5c94195eaffa3954c1afd77a31a (diff)
Bug #1101: Fix PaintWindow in the pixmap case when the window's origin is
not at the backing pixmap's origin. Resulted in incorrect rendering in at least aisleriot, fluxbox, and KDE apps, and probably many more. While here, move the ParentRelative loop above the drawable grab -- may improve correctness with ParentRelative background origins as well. Note that the border code doesn't handle ParentRelative yet.
-rw-r--r--miext/cw/cw.c48
1 files changed, 23 insertions, 25 deletions
diff --git a/miext/cw/cw.c b/miext/cw/cw.c
index 5b45075d8..f834148a7 100644
--- a/miext/cw/cw.c
+++ b/miext/cw/cw.c
@@ -408,20 +408,23 @@ cwFillRegionSolid(DrawablePtr pDrawable, RegionPtr pRegion, unsigned long pixel)
}
static void
-cwFillRegionTiled(DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile)
+cwFillRegionTiled(DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
+ int x_off, int y_off)
{
ScreenPtr pScreen = pDrawable->pScreen;
GCPtr pGC;
BoxPtr pBox;
int nbox, i;
- ChangeGCVal v[3];
+ ChangeGCVal v[5];
pGC = GetScratchGC(pDrawable->depth, pScreen);
v[0].val = GXcopy;
v[1].val = FillTiled;
v[2].ptr = (pointer) pTile;
- dixChangeGC(NullClient, pGC, (GCFunction | GCFillStyle | GCTile),
- NULL, v);
+ v[3].val = x_off;
+ v[4].val = y_off;
+ dixChangeGC(NullClient, pGC, (GCFunction | GCFillStyle | GCTile |
+ GCTileStipXOrigin | GCTileStipYOrigin), NULL, v);
ValidateGC(pDrawable, pGC);
@@ -444,7 +447,6 @@ static void
cwPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
- int x_off, y_off;
SCREEN_PROLOGUE(pScreen, PaintWindowBackground);
@@ -452,33 +454,31 @@ cwPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what)
(*pScreen->PaintWindowBackground)(pWin, pRegion, what);
} else {
DrawablePtr pBackingDrawable;
+ int x_off, y_off, x_screen, y_screen;
+
+ while (pWin && pWin->backgroundState == ParentRelative)
+ pWin = pWin->parent;
pBackingDrawable = cwGetBackingDrawable((DrawablePtr)pWin, &x_off,
&y_off);
- /* The region is in screen coordinates, so translate to window
- * coordinates for the x_off/y_off window->pixmap translation.
- */
- x_off -= pWin->drawable.x;
- y_off -= pWin->drawable.y;
-
- while (pWin && pWin->backgroundState == ParentRelative)
- pWin = pWin->parent;
+ x_screen = x_off - pWin->drawable.x;
+ y_screen = y_off - pWin->drawable.y;
if (pWin && (pWin->backgroundState == BackgroundPixel ||
pWin->backgroundState == BackgroundPixmap))
{
- REGION_TRANSLATE(pScreen, pRegion, x_off, y_off);
+ REGION_TRANSLATE(pScreen, pRegion, x_screen, y_screen);
if (pWin->backgroundState == BackgroundPixel) {
cwFillRegionSolid(pBackingDrawable, pRegion,
pWin->background.pixel);
} else {
cwFillRegionTiled(pBackingDrawable, pRegion,
- pWin->background.pixmap);
+ pWin->background.pixmap, x_off, y_off);
}
- REGION_TRANSLATE(pScreen, pRegion, -x_off, -y_off);
+ REGION_TRANSLATE(pScreen, pRegion, -x_screen, -y_screen);
}
}
@@ -489,7 +489,6 @@ static void
cwPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
- int x_off, y_off;
SCREEN_PROLOGUE(pScreen, PaintWindowBorder);
@@ -497,25 +496,24 @@ cwPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what)
(*pScreen->PaintWindowBorder)(pWin, pRegion, what);
} else {
DrawablePtr pBackingDrawable;
+ int x_off, y_off, x_screen, y_screen;
pBackingDrawable = cwGetBackingDrawable((DrawablePtr)pWin, &x_off,
&y_off);
- /* The region is in screen coordinates, so translate to window
- * coordinates for the x_off/y_off window->pixmap translation.
- */
- x_off -= pWin->drawable.x;
- y_off -= pWin->drawable.y;
+ x_screen = x_off - pWin->drawable.x;
+ y_screen = y_off - pWin->drawable.y;
- REGION_TRANSLATE(pScreen, pRegion, x_off, y_off);
+ REGION_TRANSLATE(pScreen, pRegion, x_screen, y_screen);
if (pWin->borderIsPixel) {
cwFillRegionSolid(pBackingDrawable, pRegion, pWin->border.pixel);
} else {
- cwFillRegionTiled(pBackingDrawable, pRegion, pWin->border.pixmap);
+ cwFillRegionTiled(pBackingDrawable, pRegion, pWin->border.pixmap,
+ x_off, y_off);
}
- REGION_TRANSLATE(pScreen, pRegion, -x_off, -y_off);
+ REGION_TRANSLATE(pScreen, pRegion, -x_screen, -y_screen);
}
SCREEN_EPILOGUE(pScreen, PaintWindowBorder, cwPaintWindowBorder);