summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2010-07-14 08:29:26 -0700
committerJamey Sharp <jamey@minilop.net>2011-12-14 18:38:44 -0800
commit90746a9e9fd8c931cb226843d661170f8a5463b1 (patch)
treeb2e8718e101bbd924023fc4f2ccbf595b438d52b
parent5a70cf630b8777a665363c7efc8861137109d6fc (diff)
Move GC->miTranslate flag to ScreenRec.miTranslate
No DDX uses the ability to set this flag differently on different GCs. When it's set at all, it was unconditionally set to true in a CreateGC hook. Since CreateGC hooks are per-screen, just put the flag on the screen instead. fb sets miTranslate, so almost everything wants GC ops to be handed screen-relative coordinates, but I can't easily prove that *everything* uses fb. If the xfree86 driver API changed to unconditionally initialize fb then it would be safe to delete the miTranslate flag outright. Signed-off-by: Jamey Sharp <jamey@minilop.net>
-rw-r--r--doc/Xserver-spec.xml11
-rw-r--r--fb/fbgc.c2
-rw-r--r--fb/fbscreen.c3
-rw-r--r--hw/xfree86/shadowfb/shadow.c6
-rw-r--r--hw/xfree86/xaa/xaaFillArc.c4
-rw-r--r--hw/xnest/GC.c2
-rw-r--r--hw/xnest/Screen.c2
-rw-r--r--hw/xwin/wingc.c3
-rw-r--r--hw/xwin/winscrinit.c3
-rw-r--r--include/gcstruct.h3
-rw-r--r--include/scrnintstr.h4
-rw-r--r--mi/miarc.c6
-rw-r--r--mi/mibitblt.c4
-rw-r--r--mi/midispcur.c4
-rw-r--r--mi/mifillarc.c9
-rw-r--r--mi/mifillrct.c3
-rw-r--r--mi/mifpolycon.c3
-rw-r--r--mi/miglblt.c2
-rw-r--r--mi/mipoly.c5
-rw-r--r--mi/mipolypnt.c3
-rw-r--r--mi/miwideline.c11
-rw-r--r--mi/mizerarc.c5
-rw-r--r--mi/mizerline.c6
-rw-r--r--miext/damage/damage.c6
24 files changed, 59 insertions, 51 deletions
diff --git a/doc/Xserver-spec.xml b/doc/Xserver-spec.xml
index 1bd36971c..167394076 100644
--- a/doc/Xserver-spec.xml
+++ b/doc/Xserver-spec.xml
@@ -4359,22 +4359,19 @@ they are aligned to the patOrg point in the GC. This defaults to (0,
<para>
However, the mi routines can translate (relocate) the points from
window-relative to screen-relative if desired. If you set the
-miTranslate field in the GC (set it in the CreateGC or ValidateGC
-routine), then the mi output routines will translate all coordinates.
+miTranslate field in the ScreenRec during screen initialization, then
+the mi output routines will translate all coordinates.
If it is false, then the coordinates will be passed window-relative.
Screens with no hardware translation will probably set miTranslate to
TRUE, so that geometry (e.g. polygons, rectangles) can be translated,
rather than having the resulting list of scanlines translated; this is
-good because the list vertices in a drawing request will generally be
+good because the list of vertices in a drawing request will generally be
much smaller than the list of scanlines it produces. Similarly,
hardware that does translation can set miTranslate to FALSE, and avoid
the extra addition per vertex, which can be (but is not always)
important for getting the highest possible performance. (Contrast the
behavior of GetSpans, which is not expected to be called as often, and
-so has different constraints.) The miTranslate field is settable in
-each GC, if , for example, you are mixing several kinds of
-destinations (offscreen pixmaps, main memory pixmaps, backing store,
-and windows), all of which have different requirements, on one screen.</para>
+so has different constraints.)</para>
<para>
As with other drawing routines, there are fields in the GC to direct
higher code to the correct routine to execute for each function. In
diff --git a/fb/fbgc.c b/fb/fbgc.c
index aa75d7a00..7d7a9519c 100644
--- a/fb/fbgc.c
+++ b/fb/fbgc.c
@@ -64,8 +64,6 @@ fbCreateGC(GCPtr pGC)
pGC->ops = (GCOps *) &fbGCOps;
pGC->funcs = (GCFuncs *) &fbGCFuncs;
- /* fb wants to translate before scan conversion */
- pGC->miTranslate = 1;
pGC->fExpose = 1;
fbGetGCPrivate(pGC)->bpp = BitsPerPixel (pGC->depth);
diff --git a/fb/fbscreen.c b/fb/fbscreen.c
index 9e6ecf50f..4a25a302d 100644
--- a/fb/fbscreen.c
+++ b/fb/fbscreen.c
@@ -133,6 +133,9 @@ fbSetupScreen(ScreenPtr pScreen,
pScreen->GetWindowPixmap = _fbGetWindowPixmap;
pScreen->SetWindowPixmap = _fbSetWindowPixmap;
+ /* fb wants to translate before scan conversion */
+ pScreen->miTranslate = 1;
+
return TRUE;
}
diff --git a/hw/xfree86/shadowfb/shadow.c b/hw/xfree86/shadowfb/shadow.c
index 499bbc384..b0e28700b 100644
--- a/hw/xfree86/shadowfb/shadow.c
+++ b/hw/xfree86/shadowfb/shadow.c
@@ -469,7 +469,7 @@ ShadowFillSpans(
box.y2++;
- if(!pGC->miTranslate) {
+ if(!pGC->pScreen->miTranslate) {
TRANSLATE_BOX(box, pDraw);
}
TRIM_BOX(box, pGC);
@@ -525,7 +525,7 @@ ShadowSetSpans(
box.y2++;
- if(!pGC->miTranslate) {
+ if(!pGC->pScreen->miTranslate) {
TRANSLATE_BOX(box, pDraw);
}
TRIM_BOX(box, pGC);
@@ -1606,7 +1606,7 @@ ShadowPushPixels(
box.x1 = xOrg;
box.y1 = yOrg;
- if(!pGC->miTranslate) {
+ if(!pGC->pScreen->miTranslate) {
box.x1 += pDraw->x;
box.y1 += pDraw->y;
}
diff --git a/hw/xfree86/xaa/xaaFillArc.c b/hw/xfree86/xaa/xaaFillArc.c
index 47d804108..549dd4304 100644
--- a/hw/xfree86/xaa/xaaFillArc.c
+++ b/hw/xfree86/xaa/xaaFillArc.c
@@ -71,7 +71,7 @@ XAAFillEllipseSolid(DrawablePtr pDraw, GCPtr pGC, xArc *arc)
miFillArcSetup(arc, &info);
MIFILLARCSETUP();
- if (pGC->miTranslate)
+ if (pGC->pScreen->miTranslate)
{
xorg += pDraw->x;
yorg += pDraw->y;
@@ -129,7 +129,7 @@ XAAFillArcSliceSolid(DrawablePtr pDraw, GCPtr pGC, xArc *arc)
slw = arc->height;
if (slice.flip_top || slice.flip_bot)
slw += (arc->height >> 1) + 1;
- if (pGC->miTranslate)
+ if (pGC->pScreen->miTranslate)
{
xorg += pDraw->x;
yorg += pDraw->y;
diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c
index 5f9d224ca..e7f0d50ad 100644
--- a/hw/xnest/GC.c
+++ b/hw/xnest/GC.c
@@ -73,8 +73,6 @@ xnestCreateGC(GCPtr pGC)
pGC->funcs = &xnestFuncs;
pGC->ops = &xnestOps;
- pGC->miTranslate = 1;
-
xnestGCPriv(pGC)->gc = XCreateGC(xnestDisplay,
xnestDefaultDrawables[pGC->depth],
0L, NULL);
diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index d0c7fc8b0..9079cd62e 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -256,6 +256,8 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
/* GCPrivateSizes */
/* totalGCSize */
+ pScreen->miTranslate = 1;
+
/* Random screen procedures */
pScreen->QueryBestSize = xnestQueryBestSize;
diff --git a/hw/xwin/wingc.c b/hw/xwin/wingc.c
index 09e996878..9600448f7 100644
--- a/hw/xwin/wingc.c
+++ b/hw/xwin/wingc.c
@@ -123,9 +123,6 @@ winCreateGCNativeGDI (GCPtr pGC)
pGC->ops = (GCOps *) &winGCOps;
pGC->funcs = (GCFuncs *) &winGCFuncs;
- /* We want all coordinates passed to spans functions to be screen relative */
- pGC->miTranslate = TRUE;
-
/* Allocate privates for this GC */
pGCPriv = winGetGCPriv (pGC);
if (pGCPriv == NULL)
diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index 983ff5730..10f76bfc1 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -672,6 +672,9 @@ winFinishScreenInitNativeGDI (int index,
return FALSE;
}
+ /* We want all coordinates passed to spans functions to be screen relative */
+ pScreen->miTranslate = TRUE;
+
pScreen->defColormap = FakeClientID(0);
/*
diff --git a/include/gcstruct.h b/include/gcstruct.h
index ed598fc21..07872a2d7 100644
--- a/include/gcstruct.h
+++ b/include/gcstruct.h
@@ -278,12 +278,11 @@ typedef struct _GC {
unsigned int arcMode : 1;
unsigned int subWindowMode : 1;
unsigned int graphicsExposures : 1;
- unsigned int miTranslate:1; /* should mi things translate? */
unsigned int tileIsPixel:1; /* tile is solid pixel */
unsigned int fExpose:1; /* Call exposure handling */
unsigned int freeCompClip:1; /* Free composite clip */
unsigned int scratch_inuse:1; /* is this GC in a pool for reuse? */
- unsigned int unused:15; /* see comment above */
+ unsigned int unused:16; /* see comment above */
unsigned long planemask;
unsigned long fgPixel;
unsigned long bgPixel;
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index 132a67193..7524b694f 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -419,6 +419,10 @@ typedef struct _Screen {
short minInstalledCmaps, maxInstalledCmaps;
char backingStoreSupport, saveUnderSupport;
unsigned long whitePixel, blackPixel;
+
+ unsigned int miTranslate : 1;
+ unsigned int unusedFlags : 31;
+
GCPtr GCperDepth[MAXFORMATS+1];
/* next field is a stipple to use as default in
a GC. we don't build default tiles of all depths
diff --git a/mi/miarc.c b/mi/miarc.c
index cd870fa39..74d103b3f 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -262,7 +262,7 @@ miArcSegment(
return;
}
- if (pGC->miTranslate) {
+ if (pGC->pScreen->miTranslate) {
tarc.x += pDraw->x;
tarc.y += pDraw->y;
}
@@ -837,7 +837,7 @@ miFillWideEllipse(
xorg = parc->x + (parc->width >> 1);
yorgu = parc->y + (parc->height >> 1);
yorgl = yorgu + (parc->height & 1);
- if (pGC->miTranslate)
+ if (pGC->pScreen->miTranslate)
{
xorg += pDraw->x;
yorgu += pDraw->y;
@@ -1024,7 +1024,7 @@ miPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
parc->x -= xOrg;
parc->y -= yOrg;
}
- if (pGC->miTranslate)
+ if (pGC->pScreen->miTranslate)
{
xOrg += pDraw->x;
yOrg += pDraw->y;
diff --git a/mi/mibitblt.c b/mi/mibitblt.c
index d701e0e9e..5443a369a 100644
--- a/mi/mibitblt.c
+++ b/mi/mibitblt.c
@@ -137,7 +137,7 @@ miCopyArea(DrawablePtr pSrcDrawable,
dstx = xOut;
dsty = yOut;
- if (pGC->miTranslate)
+ if (pGC->pScreen->miTranslate)
{
dstx += pDstDrawable->x;
dsty += pDstDrawable->y;
@@ -800,7 +800,7 @@ miPutImage( DrawablePtr pDraw, GCPtr pGC, int depth,
free(pptFirst);
return;
}
- if (pGC->miTranslate)
+ if (pGC->pScreen->miTranslate)
{
x += pDraw->x;
y += pDraw->y;
diff --git a/mi/midispcur.c b/mi/midispcur.c
index 32c5c9df6..a830d924d 100644
--- a/mi/midispcur.c
+++ b/mi/midispcur.c
@@ -343,7 +343,7 @@ miDCPutBits (
if (sourceGC->serialNumber != pDrawable->serialNumber)
ValidateGC (pDrawable, sourceGC);
- if(sourceGC->miTranslate)
+ if(sourceGC->pScreen->miTranslate)
{
x = pDrawable->x + x_org;
y = pDrawable->y + y_org;
@@ -363,7 +363,7 @@ miDCPutBits (
if (maskGC->serialNumber != pDrawable->serialNumber)
ValidateGC (pDrawable, maskGC);
- if(maskGC->miTranslate)
+ if(maskGC->pScreen->miTranslate)
{
x = pDrawable->x + x_org;
y = pDrawable->y + y_org;
diff --git a/mi/mifillarc.c b/mi/mifillarc.c
index 6e13e681f..98ad1de22 100644
--- a/mi/mifillarc.c
+++ b/mi/mifillarc.c
@@ -40,6 +40,7 @@ Author: Bob Scheifler, MIT X Consortium
#include "mifpoly.h"
#include "mi.h"
#include "mifillarc.h"
+#include "scrnintstr.h"
#define QUADRANT (90 * 64)
#define HALFCIRCLE (180 * 64)
@@ -557,7 +558,7 @@ miFillEllipseI(
}
miFillArcSetup(arc, &info);
MIFILLARCSETUP();
- if (pGC->miTranslate)
+ if (pGC->pScreen->miTranslate)
{
xorg += pDraw->x;
yorg += pDraw->y;
@@ -600,7 +601,7 @@ miFillEllipseD(
}
miFillArcDSetup(arc, &info);
MIFILLARCSETUP();
- if (pGC->miTranslate)
+ if (pGC->pScreen->miTranslate)
{
xorg += pDraw->x;
yorg += pDraw->y;
@@ -670,7 +671,7 @@ miFillArcSliceI(
free(points);
return;
}
- if (pGC->miTranslate)
+ if (pGC->pScreen->miTranslate)
{
xorg += pDraw->x;
yorg += pDraw->y;
@@ -734,7 +735,7 @@ miFillArcSliceD(
free(points);
return;
}
- if (pGC->miTranslate)
+ if (pGC->pScreen->miTranslate)
{
xorg += pDraw->x;
yorg += pDraw->y;
diff --git a/mi/mifillrct.c b/mi/mifillrct.c
index 1c63a35fa..7a01e3725 100644
--- a/mi/mifillrct.c
+++ b/mi/mifillrct.c
@@ -56,6 +56,7 @@ SOFTWARE.
#include "pixmap.h"
#include "mi.h"
#include "misc.h"
+#include "scrnintstr.h"
/* mi rectangles
written by newman, with debts to all and sundry
@@ -86,7 +87,7 @@ miPolyFillRect(
int *pwFirst;
int *pw;
- if (pGC->miTranslate)
+ if (pGC->pScreen->miTranslate)
{
xorg = pDrawable->x;
yorg = pDrawable->y;
diff --git a/mi/mifpolycon.c b/mi/mifpolycon.c
index e48686a58..b547d144d 100644
--- a/mi/mifpolycon.c
+++ b/mi/mifpolycon.c
@@ -54,6 +54,7 @@ SOFTWARE.
#include "windowstr.h"
#include "pixmapstr.h"
#include "mifpoly.h"
+#include "scrnintstr.h"
static int GetFPolyYBounds(SppPointPtr pts, int n, double yFtrans,
int *by, int *ty);
@@ -105,7 +106,7 @@ miFillSppPoly(
DDXPointPtr ptsOut,
FirstPoint; /* output buffer */
- if (pgc->miTranslate)
+ if (pgc->pScreen->miTranslate)
{
xTrans += dst->x;
yTrans += dst->y;
diff --git a/mi/miglblt.c b/mi/miglblt.c
index 9edb500c4..1ba8433c3 100644
--- a/mi/miglblt.c
+++ b/mi/miglblt.c
@@ -109,7 +109,7 @@ miPolyGlyphBlt(
ChangeGCVal gcvals[3];
- if (pGC->miTranslate)
+ if (pGC->pScreen->miTranslate)
{
x += pDrawable->x;
y += pDrawable->y;
diff --git a/mi/mipoly.c b/mi/mipoly.c
index b3e2c2fb1..974cf959c 100644
--- a/mi/mipoly.c
+++ b/mi/mipoly.c
@@ -50,7 +50,7 @@ SOFTWARE.
* Written by Brian Kelleher; June 1986
*
* Draw polygons. This routine translates the point by the
- * origin if pGC->miTranslate is non-zero, and calls
+ * origin if pGC->pScreen->miTranslate is non-zero, and calls
* to the appropriate routine to actually scan convert the
* polygon.
*/
@@ -64,6 +64,7 @@ SOFTWARE.
#include "pixmapstr.h"
#include "mi.h"
#include "regionstr.h"
+#include "scrnintstr.h"
void
@@ -79,7 +80,7 @@ miFillPolygon( DrawablePtr dst, GCPtr pgc,
return;
ppt = pPts;
- if (pgc->miTranslate)
+ if (pgc->pScreen->miTranslate)
{
xorg = dst->x;
yorg = dst->y;
diff --git a/mi/mipolypnt.c b/mi/mipolypnt.c
index 3e43a523e..f77866258 100644
--- a/mi/mipolypnt.c
+++ b/mi/mipolypnt.c
@@ -54,6 +54,7 @@ SOFTWARE.
#include "gcstruct.h"
#include "windowstr.h"
#include "mi.h"
+#include "scrnintstr.h"
void
miPolyPoint(
@@ -90,7 +91,7 @@ miPolyPoint(
}
}
- if(pGC->miTranslate)
+ if(pGC->pScreen->miTranslate)
{
ppt = pptInit;
nptTmp = npt;
diff --git a/mi/miwideline.c b/mi/miwideline.c
index 057339dbe..0ae49a7da 100644
--- a/mi/miwideline.c
+++ b/mi/miwideline.c
@@ -51,6 +51,7 @@ from The Open Group.
#include "regionstr.h"
#include "miwideline.h"
#include "mi.h"
+#include "scrnintstr.h"
static Bool
InitSpans(Spans *spans, size_t nspans)
@@ -161,7 +162,7 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
pwidth = spanRec.widths;
xorg = 0;
- if (pGC->miTranslate)
+ if (pGC->pScreen->miTranslate)
{
y += pDrawable->y;
xorg = pDrawable->x;
@@ -278,7 +279,7 @@ miFillRectPolyHelper (
ppt = spanRec.points;
pwidth = spanRec.widths;
- if (pGC->miTranslate)
+ if (pGC->pScreen->miTranslate)
{
y += pDrawable->y;
x += pDrawable->x;
@@ -494,7 +495,7 @@ miLineOnePoint (
else
{
wid = 1;
- if (pGC->miTranslate)
+ if (pGC->pScreen->miTranslate)
{
x += pDrawable->x;
y += pDrawable->y;
@@ -671,7 +672,7 @@ miLineArcI (
tpts = points;
twids = widths;
- if (pGC->miTranslate)
+ if (pGC->pScreen->miTranslate)
{
xorg += pDraw->x;
yorg += pDraw->y;
@@ -772,7 +773,7 @@ miLineArcD (
x0 = xorg - xbase;
ybase = ICEIL (yorg);
y0 = yorg - ybase;
- if (pGC->miTranslate)
+ if (pGC->pScreen->miTranslate)
{
xbase += pDraw->x;
ybase += pDraw->y;
diff --git a/mi/mizerarc.c b/mi/mizerarc.c
index 5adf3dd09..d01d05007 100644
--- a/mi/mizerarc.c
+++ b/mi/mizerarc.c
@@ -45,6 +45,7 @@ Author: Bob Scheifler, MIT X Consortium
#include "pixmapstr.h"
#include "mi.h"
#include "mizerarc.h"
+#include "scrnintstr.h"
#define FULLCIRCLE (360 * 64)
#define OCTANT (45 * 64)
@@ -788,7 +789,7 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
while (maxw < n)
widths[maxw++] = 1;
}
- if (pGC->miTranslate)
+ if (pGC->pScreen->miTranslate)
{
for (pt = points; pt != pts; pt++)
{
@@ -820,7 +821,7 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
while (maxw < n)
widths[maxw++] = 1;
}
- if (pGC->miTranslate)
+ if (pGC->pScreen->miTranslate)
{
for (pt = oddPts; pt != pts; pt++)
{
diff --git a/mi/mizerline.c b/mi/mizerline.c
index 7077b5198..57385fd79 100644
--- a/mi/mizerline.c
+++ b/mi/mizerline.c
@@ -130,7 +130,7 @@ miZeroLine(
xright = pDraw->x + pDraw->width - 1;
ybottom = pDraw->y + pDraw->height - 1;
- if (!pGC->miTranslate)
+ if (!pGC->pScreen->miTranslate)
{
/* do everything in drawable-relative coordinates */
xleft = 0;
@@ -170,7 +170,7 @@ miZeroLine(
xstart = ppt->x;
ystart = ppt->y;
- if (pGC->miTranslate)
+ if (pGC->pScreen->miTranslate)
{
xstart += pDraw->x;
ystart += pDraw->y;
@@ -201,7 +201,7 @@ miZeroLine(
x2 = ppt->x;
y2 = ppt->y;
- if (pGC->miTranslate && (mode != CoordModePrevious))
+ if (pGC->pScreen->miTranslate && (mode != CoordModePrevious))
{
x2 += pDraw->x;
y2 += pDraw->y;
diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index a24b6cccc..a7fb3ab64 100644
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -707,7 +707,7 @@ damageFillSpans(DrawablePtr pDrawable,
box.y2++;
- if(!pGC->miTranslate) {
+ if(!pGC->pScreen->miTranslate) {
TRANSLATE_BOX(box, pDrawable);
}
TRIM_BOX(box, pGC);
@@ -757,7 +757,7 @@ damageSetSpans(DrawablePtr pDrawable,
box.y2++;
- if(!pGC->miTranslate) {
+ if(!pGC->pScreen->miTranslate) {
TRANSLATE_BOX(box, pDrawable);
}
TRIM_BOX(box, pGC);
@@ -1548,7 +1548,7 @@ damagePushPixels(GCPtr pGC,
box.x1 = xOrg;
box.y1 = yOrg;
- if(!pGC->miTranslate) {
+ if(!pGC->pScreen->miTranslate) {
box.x1 += pDrawable->x;
box.y1 += pDrawable->y;
}