view dmline.c @ 261:eb77496ab7b3

More work on the rendering test.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 10 Oct 2012 01:03:15 +0300
parents a2abd0b991b6
children 9d015d32841a
line wrap: on
line source

/*
 * DMLib
 * -- Arbitrary line drawing functions
 * Programmed and designed by Matti 'ccr' Hamalainen
 * (C) Copyright 2011 Tecnic Software productions (TNSP)
 */
#include "dmlib.h"

/* Clip line coordinates. Return value:
 * = 0  : No clipping needed.
 * > 0  : Clipped. Line partially inside the clipping area.
 * < 0  : Line completely outside the clipping area.
 */
#define dmClipBits(Q, x, y)	\
    do {			\
        Q = 0;			\
        if (x < clipX0) Q |= 1;	\
        else			\
        if (x > clipX1) Q |= 2;	\
        if (y < clipY0) Q |= 4;	\
        else			\
        if (y > clipY1) Q |= 8;	\
    } while (0)

#define xA (*x0)
#define xB (*x1)
#define yA (*y0)
#define yB (*y1)

#define DM_CLIP_FUNC dmClipLineCoordsInt
#define DM_COORD_TYPE int
#include "dmlineclip.h"

#define DM_CLIP_FUNC dmClipLineCoordsFloat
#define DM_COORD_TYPE DMFloat
#include "dmlineclip.h"


#include "dmlinefunc.h"