040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync/***********************************************************
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncCopyright 1989, 1998 The Open Group
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncPermission to use, copy, modify, distribute, and sell this software and its
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncdocumentation for any purpose is hereby granted without fee, provided that
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncthe above copyright notice appear in all copies and that both that
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsynccopyright notice and this permission notice appear in supporting
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncdocumentation.
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncThe above copyright notice and this permission notice shall be included in
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncall copies or substantial portions of the Software.
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncExcept as contained in this notice, the name of The Open Group shall not be
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncused in advertising or otherwise to promote the sale, use or other dealings
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncin this Software without prior written authorization from The Open Group.
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncCopyright 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync All Rights Reserved
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncPermission to use, copy, modify, and distribute this software and its
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncdocumentation for any purpose and without fee is hereby granted,
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncprovided that the above copyright notice appear in all copies and that
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncboth that copyright notice and this permission notice appear in
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncsupporting documentation, and that the name of Digital not be
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncused in advertising or publicity pertaining to distribution of the
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncsoftware without specific, written prior permission.
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncSOFTWARE.
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync******************************************************************/
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsynctypedef struct {
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync int count; /* number of spans */
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync DDXPointPtr points; /* pointer to list of start points */
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync int *widths; /* pointer to list of widths */
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync} Spans;
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsynctypedef struct {
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync int size; /* Total number of *Spans allocated */
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync int count; /* Number of *Spans actually in group */
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync Spans *group; /* List of Spans */
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync int ymin, ymax; /* Min, max y values encountered */
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync} SpanGroup;
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync/* Initialize SpanGroup. MUST BE DONE before use. */
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncextern void miInitSpanGroup(
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync SpanGroup * /*spanGroup*/
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync);
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync/* Add a Spans to a SpanGroup. The spans MUST BE in y-sorted order */
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncextern void miAppendSpans(
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync SpanGroup * /*spanGroup*/,
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync SpanGroup * /*otherGroup*/,
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync Spans * /*spans*/
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync);
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync/* Paint a span group, insuring that each pixel is painted at most once */
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncextern void miFillUniqueSpanGroup(
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync DrawablePtr /*pDraw*/,
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync GCPtr /*pGC*/,
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync SpanGroup * /*spanGroup*/
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync);
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync/* Free up data in a span group. MUST BE DONE or you'll suffer memory leaks */
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncextern void miFreeSpanGroup(
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync SpanGroup * /*spanGroup*/
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync);
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncextern int miClipSpans(
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync RegionPtr /*prgnDst*/,
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync DDXPointPtr /*ppt*/,
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync int * /*pwidth*/,
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync int /*nspans*/,
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync DDXPointPtr /*pptNew*/,
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync int * /*pwidthNew*/,
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync int /*fSorted*/
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync);
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync/* Rops which must use span groups */
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync#define miSpansCarefulRop(rop) (((rop) & 0xc) == 0x8 || ((rop) & 0x3) == 0x2)
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync#define miSpansEasyRop(rop) (!miSpansCarefulRop(rop))
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync