Commit a8518b35 authored by Keith Packard's avatar Keith Packard
Browse files

kdrive/savage: Long lines cant be drawn with accelerator

parent 28fd5f75
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* *
* Author: Keith Packard, SuSE, Inc. * Author: Keith Packard, SuSE, Inc.
*/ */
/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3draw.c,v 1.5 2000/08/09 17:52:41 keithp Exp $ */ /* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3draw.c,v 1.6 2001/05/29 04:54:11 keithp Exp $ */
#include "s3.h" #include "s3.h"
#include "s3draw.h" #include "s3draw.h"
...@@ -1682,14 +1682,15 @@ s3PolyTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, ...@@ -1682,14 +1682,15 @@ s3PolyTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
s3ImageTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, (pointer) 1); s3ImageTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, (pointer) 1);
} }
void Bool
_s3Segment (DrawablePtr pDrawable, _s3Segment (DrawablePtr pDrawable,
GCPtr pGC, GCPtr pGC,
int x1, int x1,
int y1, int y1,
int x2, int x2,
int y2, int y2,
Bool drawLast) Bool drawLast,
Bool s3Set)
{ {
SetupS3(pDrawable->pScreen); SetupS3(pDrawable->pScreen);
FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
...@@ -1709,19 +1710,11 @@ _s3Segment (DrawablePtr pDrawable, ...@@ -1709,19 +1710,11 @@ _s3Segment (DrawablePtr pDrawable,
unsigned int oc1; /* outcode of point 1 */ unsigned int oc1; /* outcode of point 1 */
unsigned int oc2; /* outcode of point 2 */ unsigned int oc2; /* outcode of point 2 */
s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC));
nBox = REGION_NUM_RECTS (pClip);
pBox = REGION_RECTS (pClip);
CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy,
1, 1, octant); 1, 1, octant);
cmd = LASTPIX; cmd = LASTPIX;
if (signdx > 0)
cmd |= INC_X;
if (signdy > 0)
cmd |= INC_Y;
if (adx > ady) if (adx > ady)
{ {
axis = X_AXIS; axis = X_AXIS;
...@@ -1741,8 +1734,26 @@ _s3Segment (DrawablePtr pDrawable, ...@@ -1741,8 +1734,26 @@ _s3Segment (DrawablePtr pDrawable,
len = ady; len = ady;
} }
/* S3 line drawing hardware has limited resolution for error terms */
if (len >= 4096)
{
int dashOff = 0;
KdCheckSync (pDrawable->pScreen);
fbSegment (pDrawable, pGC, x1, y1, x2, y2, drawLast, &dashOff);
return FALSE;
}
FIXUP_ERROR (e, octant, bias); FIXUP_ERROR (e, octant, bias);
nBox = REGION_NUM_RECTS (pClip);
pBox = REGION_RECTS (pClip);
if (signdx > 0)
cmd |= INC_X;
if (signdy > 0)
cmd |= INC_Y;
/* we have bresenham parameters and two points. /* we have bresenham parameters and two points.
all we have to do now is clip and draw. all we have to do now is clip and draw.
*/ */
...@@ -1757,6 +1768,12 @@ _s3Segment (DrawablePtr pDrawable, ...@@ -1757,6 +1768,12 @@ _s3Segment (DrawablePtr pDrawable,
OUTCODES(oc2, x2, y2, pBox); OUTCODES(oc2, x2, y2, pBox);
if ((oc1 | oc2) == 0) if ((oc1 | oc2) == 0)
{ {
if (!s3Set)
{
s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC));
_s3SetSolidFill (s3, pGC->fgPixel, pGC->alu, pGC->planemask);
s3Set = TRUE;
}
_s3SetCur (s3, x1, y1); _s3SetCur (s3, x1, y1);
_s3ClipLine (s3, cmd, e1, e2, e, len); _s3ClipLine (s3, cmd, e1, e2, e, len);
break; break;
...@@ -1801,12 +1818,19 @@ _s3Segment (DrawablePtr pDrawable, ...@@ -1801,12 +1818,19 @@ _s3Segment (DrawablePtr pDrawable,
else else
err += (e2 - e1) * clipdx + e1 * clipdy; err += (e2 - e1) * clipdx + e1 * clipdy;
} }
if (!s3Set)
{
s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC));
_s3SetSolidFill (s3, pGC->fgPixel, pGC->alu, pGC->planemask);
s3Set = TRUE;
}
_s3SetCur (s3, new_x1, new_y1); _s3SetCur (s3, new_x1, new_y1);
_s3ClipLine (s3, cmd, e1, e2, err, len); _s3ClipLine (s3, cmd, e1, e2, err, len);
} }
pBox++; pBox++;
} }
} /* while (nBox--) */ } /* while (nBox--) */
return s3Set;
} }
void void
...@@ -1816,11 +1840,11 @@ s3Polylines (DrawablePtr pDrawable, GCPtr pGC, ...@@ -1816,11 +1840,11 @@ s3Polylines (DrawablePtr pDrawable, GCPtr pGC,
SetupS3(pDrawable->pScreen); SetupS3(pDrawable->pScreen);
int x, y, nx, ny; int x, y, nx, ny;
int ox = pDrawable->x, oy = pDrawable->y; int ox = pDrawable->x, oy = pDrawable->y;
Bool s3Set = FALSE;
if (!npt) if (!npt)
return; return;
_s3SetSolidFill (s3, pGC->fgPixel, pGC->alu, pGC->planemask);
x = ppt->x + ox; x = ppt->x + ox;
y = ppt->y + oy; y = ppt->y + oy;
while (--npt) while (--npt)
...@@ -1836,12 +1860,14 @@ s3Polylines (DrawablePtr pDrawable, GCPtr pGC, ...@@ -1836,12 +1860,14 @@ s3Polylines (DrawablePtr pDrawable, GCPtr pGC,
nx = ppt->x + ox; nx = ppt->x + ox;
ny = ppt->y + oy; ny = ppt->y + oy;
} }
_s3Segment (pDrawable, pGC, x, y, nx, ny, s3Set = _s3Segment (pDrawable, pGC, x, y, nx, ny,
npt == 1 && pGC->capStyle != CapNotLast); npt == 1 && pGC->capStyle != CapNotLast,
s3Set);
x = nx; x = nx;
y = ny; y = ny;
} }
MarkSyncS3 (pDrawable->pScreen); if (s3Set)
MarkSyncS3 (pDrawable->pScreen);
} }
void void
...@@ -1862,17 +1888,18 @@ s3PolySegment (DrawablePtr pDrawable, GCPtr pGC, ...@@ -1862,17 +1888,18 @@ s3PolySegment (DrawablePtr pDrawable, GCPtr pGC,
CARD32 cmd; CARD32 cmd;
CARD32 init_cmd; CARD32 init_cmd;
Bool drawLast; Bool drawLast;
Bool s3Set = FALSE;
drawLast = pGC->capStyle != CapNotLast; drawLast = pGC->capStyle != CapNotLast;
_s3SetSolidFill (s3, pGC->fgPixel, pGC->alu, pGC->planemask);
for (nseg = nsegInit, pSeg = pSegInit; nseg--; pSeg++) for (nseg = nsegInit, pSeg = pSegInit; nseg--; pSeg++)
{ {
_s3Segment (pDrawable, pGC, pSeg->x1 + ox, pSeg->y1 + oy, s3Set = _s3Segment (pDrawable, pGC, pSeg->x1 + ox, pSeg->y1 + oy,
pSeg->x2 + ox, pSeg->y2 + oy, drawLast); pSeg->x2 + ox, pSeg->y2 + oy, drawLast, s3Set);
} }
MarkSyncS3 (pDrawable->pScreen); if (s3Set)
MarkSyncS3 (pDrawable->pScreen);
} }
/* /*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment