2 * Copyright 2000-2001 VA Linux Systems, Inc.
3 * (C) Copyright IBM Corporation 2004
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * on the rights to use, copy, modify, merge, publish, distribute, sub
10 * license, and/or sell copies of the Software, and to permit persons to whom
11 * the Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
20 * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
23 * USE OR OTHER DEALINGS IN THE SOFTWARE.
27 * \file spantmp_common.h
29 * common macros for span read / write functions to be used in the depth,
30 * stencil and pixel span templates.
34 #define HW_WRITE_LOCK() HW_LOCK()
37 #ifndef HW_WRITE_UNLOCK
38 #define HW_WRITE_UNLOCK() HW_UNLOCK()
42 #define HW_READ_LOCK() HW_LOCK()
45 #ifndef HW_READ_UNLOCK
46 #define HW_READ_UNLOCK() HW_UNLOCK()
50 #define HW_CLIPLOOP() \
52 int _nc = dPriv->numClipRects; \
54 int minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \
55 int miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \
56 int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \
57 int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
60 #ifndef HW_ENDCLIPLOOP
61 #define HW_ENDCLIPLOOP() \
67 #define CLIPPIXEL( _x, _y ) \
68 ((_x >= minx) && (_x < maxx) && (_y >= miny) && (_y < maxy))
72 #define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \
73 if ( _y < miny || _y >= maxy /*|| _x + n < minx || _x >=maxx*/ ) { \
78 if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
79 if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \