Back to index

lightning-sunbird  0.9+nobinonly
icstipple.c
Go to the documentation of this file.
00001 /*
00002  * Id: $
00003  *
00004  * Copyright © 1998 Keith Packard
00005  *
00006  * Permission to use, copy, modify, distribute, and sell this software and its
00007  * documentation for any purpose is hereby granted without fee, provided that
00008  * the above copyright notice appear in all copies and that both that
00009  * copyright notice and this permission notice appear in supporting
00010  * documentation, and that the name of Keith Packard not be used in
00011  * advertising or publicity pertaining to distribution of the software without
00012  * specific, written prior permission.  Keith Packard makes no
00013  * representations about the suitability of this software for any purpose.  It
00014  * is provided "as is" without express or implied warranty.
00015  *
00016  * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
00017  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
00018  * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
00019  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
00020  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
00021  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00022  * PERFORMANCE OF THIS SOFTWARE.
00023  */
00024 
00025 #include "pixman-xserver-compat.h"
00026 
00027 #ifndef ICNOPIXADDR
00028 /*
00029  * This is a slight abuse of the preprocessor to generate repetitive
00030  * code, the idea is to generate code for each case of a copy-mode
00031  * transparent stipple
00032  */
00033 #define LaneCases1(c,a)         case c: \
00034                             while (n--) { (void)FbLaneCase(c,a); a++; } \
00035                             break
00036 #define LaneCases2(c,a)         LaneCases1(c,a); LaneCases1(c+1,a)
00037 #define LaneCases4(c,a)         LaneCases2(c,a); LaneCases2(c+2,a)
00038 #define LaneCases8(c,a)         LaneCases4(c,a); LaneCases4(c+4,a)
00039 #define LaneCases16(c,a)    LaneCases8(c,a); LaneCases8(c+8,a)
00040 #define LaneCases32(c,a)    LaneCases16(c,a); LaneCases16(c+16,a)
00041 #define LaneCases64(c,a)    LaneCases32(c,a); LaneCases32(c+32,a)
00042 #define LaneCases128(c,a)   LaneCases64(c,a); LaneCases64(c+64,a)
00043 #define LaneCases256(c,a)   LaneCases128(c,a); LaneCases128(c+128,a)
00044     
00045 #if FB_SHIFT == 6
00046 #define LaneCases(a)     LaneCases256(0,a)
00047 #endif
00048     
00049 #if FB_SHIFT == 5
00050 #define LaneCases(a)     LaneCases16(0,a)
00051 #endif
00052                                                     
00053 /*
00054  * Repeat a transparent stipple across a scanline n times
00055  */
00056 
00057 void
00058 fbTransparentSpan (FbBits   *dst,
00059                  FbBits   stip,
00060                  FbBits   fgxor,
00061                  int     n)
00062 {
00063     FbStip  s;
00064 
00065     s  = ((FbStip) (stip      ) & 0x01);
00066     s |= ((FbStip) (stip >>  8) & 0x02);
00067     s |= ((FbStip) (stip >> 16) & 0x04);
00068     s |= ((FbStip) (stip >> 24) & 0x08);
00069 #if FB_SHIFT > 5
00070     s |= ((FbStip) (stip >> 32) & 0x10);
00071     s |= ((FbStip) (stip >> 40) & 0x20);
00072     s |= ((FbStip) (stip >> 48) & 0x40);
00073     s |= ((FbStip) (stip >> 56) & 0x80);
00074 #endif
00075     switch (s) {
00076        LaneCases(dst);
00077     }
00078 }
00079 #endif