105b261ecSmrg/* 205b261ecSmrg * Copyright © 1998 Keith Packard 305b261ecSmrg * 405b261ecSmrg * Permission to use, copy, modify, distribute, and sell this software and its 505b261ecSmrg * documentation for any purpose is hereby granted without fee, provided that 605b261ecSmrg * the above copyright notice appear in all copies and that both that 705b261ecSmrg * copyright notice and this permission notice appear in supporting 805b261ecSmrg * documentation, and that the name of Keith Packard not be used in 905b261ecSmrg * advertising or publicity pertaining to distribution of the software without 1005b261ecSmrg * specific, written prior permission. Keith Packard makes no 1105b261ecSmrg * representations about the suitability of this software for any purpose. It 1205b261ecSmrg * is provided "as is" without express or implied warranty. 1305b261ecSmrg * 1405b261ecSmrg * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 1505b261ecSmrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 1605b261ecSmrg * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR 1705b261ecSmrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 1805b261ecSmrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 1905b261ecSmrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 2005b261ecSmrg * PERFORMANCE OF THIS SOFTWARE. 2105b261ecSmrg */ 2205b261ecSmrg 2305b261ecSmrg#ifdef HAVE_DIX_CONFIG_H 2405b261ecSmrg#include <dix-config.h> 2505b261ecSmrg#endif 2605b261ecSmrg 2705b261ecSmrg#include "fb.h" 2805b261ecSmrg 2905b261ecSmrgvoid 3035c4bbdfSmrgfbSetSpans(DrawablePtr pDrawable, 3135c4bbdfSmrg GCPtr pGC, 3235c4bbdfSmrg char *src, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted) 3305b261ecSmrg{ 3435c4bbdfSmrg FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); 3535c4bbdfSmrg RegionPtr pClip = fbGetCompositeClip(pGC); 3635c4bbdfSmrg FbBits *dst, *d, *s; 3735c4bbdfSmrg FbStride dstStride; 3835c4bbdfSmrg int dstBpp; 3935c4bbdfSmrg int dstXoff, dstYoff; 4035c4bbdfSmrg BoxPtr pbox; 4135c4bbdfSmrg int n; 4235c4bbdfSmrg int xoff; 4335c4bbdfSmrg int x1, x2; 4405b261ecSmrg 4535c4bbdfSmrg fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); 4635c4bbdfSmrg while (nspans--) { 4735c4bbdfSmrg d = dst + (ppt->y + dstYoff) * dstStride; 4835c4bbdfSmrg xoff = (int) (((long) src) & (FB_MASK >> 3)); 4935c4bbdfSmrg s = (FbBits *) (src - xoff); 5035c4bbdfSmrg xoff <<= 3; 5135c4bbdfSmrg n = RegionNumRects(pClip); 5235c4bbdfSmrg pbox = RegionRects(pClip); 5335c4bbdfSmrg while (n--) { 5435c4bbdfSmrg if (pbox->y1 > ppt->y) 5535c4bbdfSmrg break; 5635c4bbdfSmrg if (pbox->y2 > ppt->y) { 5735c4bbdfSmrg x1 = ppt->x; 5835c4bbdfSmrg x2 = x1 + *pwidth; 5935c4bbdfSmrg if (pbox->x1 > x1) 6035c4bbdfSmrg x1 = pbox->x1; 6135c4bbdfSmrg if (pbox->x2 < x2) 6235c4bbdfSmrg x2 = pbox->x2; 6335c4bbdfSmrg if (x1 < x2) 6435c4bbdfSmrg fbBlt((FbBits *) s, 6535c4bbdfSmrg 0, 6635c4bbdfSmrg (x1 - ppt->x) * dstBpp + xoff, 6735c4bbdfSmrg d, 6835c4bbdfSmrg dstStride, 6935c4bbdfSmrg (x1 + dstXoff) * dstBpp, 7035c4bbdfSmrg (x2 - x1) * dstBpp, 7135c4bbdfSmrg 1, pGC->alu, pPriv->pm, dstBpp, FALSE, FALSE); 7235c4bbdfSmrg } 7335c4bbdfSmrg } 7435c4bbdfSmrg src += PixmapBytePad(*pwidth, pDrawable->depth); 7535c4bbdfSmrg ppt++; 7635c4bbdfSmrg pwidth++; 7705b261ecSmrg } 7835c4bbdfSmrg fbValidateDrawable(pDrawable); 7935c4bbdfSmrg fbFinishAccess(pDrawable); 8005b261ecSmrg} 81