123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- #if (R_DRAWSPAN_PIPELINE_BITS == 8)
- #define SCREENTYPE byte
- #define TOPLEFT byte_topleft
- #define PITCH byte_pitch
- #elif (R_DRAWSPAN_PIPELINE_BITS == 15)
- #define SCREENTYPE unsigned short
- #define TOPLEFT short_topleft
- #define PITCH short_pitch
- #elif (R_DRAWSPAN_PIPELINE_BITS == 16)
- #define SCREENTYPE unsigned short
- #define TOPLEFT short_topleft
- #define PITCH short_pitch
- #elif (R_DRAWSPAN_PIPELINE_BITS == 32)
- #define SCREENTYPE unsigned int
- #define TOPLEFT int_topleft
- #define PITCH int_pitch
- #endif
- #if (R_DRAWSPAN_PIPELINE & RDC_DITHERZ)
- #define GETDEPTHMAP(col) dither_colormaps[filter_getDitheredPixelLevel(x1, y, fracz)][(col)]
- #else
- #define GETDEPTHMAP(col) colormap[(col)]
- #endif
- #if (R_DRAWSPAN_PIPELINE_BITS == 8)
- #define GETCOL_POINT(col) GETDEPTHMAP(col)
- #define GETCOL_LINEAR(col) GETDEPTHMAP(col)
- #elif (R_DRAWSPAN_PIPELINE_BITS == 15)
- #define GETCOL_POINT(col) VID_PAL15(GETDEPTHMAP(col), VID_COLORWEIGHTMASK)
- #define GETCOL_LINEAR(col) filter_getFilteredForSpan15(GETDEPTHMAP, xfrac, yfrac)
- #elif (R_DRAWSPAN_PIPELINE_BITS == 16)
- #define GETCOL_POINT(col) VID_PAL16(GETDEPTHMAP(col), VID_COLORWEIGHTMASK)
- #define GETCOL_LINEAR(col) filter_getFilteredForSpan16(GETDEPTHMAP, xfrac, yfrac)
- #elif (R_DRAWSPAN_PIPELINE_BITS == 32)
- #define GETCOL_POINT(col) VID_PAL32(GETDEPTHMAP(col), VID_COLORWEIGHTMASK)
- #define GETCOL_LINEAR(col) filter_getFilteredForSpan32(GETDEPTHMAP, xfrac, yfrac)
- #endif
- #if (R_DRAWSPAN_PIPELINE & RDC_BILINEAR)
- #define GETCOL(col) GETCOL_LINEAR(col)
- #else
- #define GETCOL(col) GETCOL_POINT(col)
- #endif
- static void R_DRAWSPAN_FUNCNAME(draw_span_vars_t *dsvars)
- {
- #if (R_DRAWSPAN_PIPELINE & (RDC_ROUNDED|RDC_BILINEAR))
-
-
- if ((D_abs(dsvars->xstep) > drawvars.mag_threshold)
- || (D_abs(dsvars->ystep) > drawvars.mag_threshold))
- {
- R_GetDrawSpanFunc(RDRAW_FILTER_POINT,
- drawvars.filterz)(dsvars);
- return;
- }
- #endif
- {
- unsigned count = dsvars->x2 - dsvars->x1 + 1;
- fixed_t xfrac = dsvars->xfrac;
- fixed_t yfrac = dsvars->yfrac;
- const fixed_t xstep = dsvars->xstep;
- const fixed_t ystep = dsvars->ystep;
- const byte *source = dsvars->source;
- const byte *colormap = dsvars->colormap;
- (void)colormap;
- SCREENTYPE *dest = drawvars.TOPLEFT + dsvars->y*drawvars.PITCH + dsvars->x1;
- #if (R_DRAWSPAN_PIPELINE & (RDC_DITHERZ|RDC_BILINEAR))
- const int y = dsvars->y;
- int x1 = dsvars->x1;
-
- (void)y;
- (void)x1;
- #endif
- #if (R_DRAWSPAN_PIPELINE & RDC_DITHERZ)
- const int fracz = (dsvars->z >> 12) & 255;
- const byte *dither_colormaps[2] = { dsvars->colormap, dsvars->nextcolormap };
- #endif
- while (count) {
- #if ((R_DRAWSPAN_PIPELINE_BITS != 8) && (R_DRAWSPAN_PIPELINE & RDC_BILINEAR))
-
- *dest++ = GETCOL(0);
- xfrac += xstep;
- yfrac += ystep;
- count--;
- #if (R_DRAWSPAN_PIPELINE & RDC_DITHERZ)
- x1--;
- #endif
- #elif (R_DRAWSPAN_PIPELINE & RDC_ROUNDED)
- *dest++ = GETCOL(filter_getRoundedForSpan(xfrac, yfrac));
- xfrac += xstep;
- yfrac += ystep;
- count--;
- #if (R_DRAWSPAN_PIPELINE & RDC_DITHERZ)
- x1--;
- #endif
- #else
- #if (R_DRAWSPAN_PIPELINE & RDC_BILINEAR)
-
- const fixed_t xtemp = ((xfrac >> 16) + (filter_getDitheredPixelLevel(x1, y, ((xfrac>>8)&0xff)))) & 63;
- const fixed_t ytemp = ((yfrac >> 10) + 64*(filter_getDitheredPixelLevel(x1, y, ((yfrac>>8)&0xff)))) & 4032;
- #else
- const fixed_t xtemp = (xfrac >> 16) & 63;
- const fixed_t ytemp = (yfrac >> 10) & 4032;
- #endif
- const fixed_t spot = xtemp | ytemp;
- xfrac += xstep;
- yfrac += ystep;
- *dest++ = GETCOL(source[spot]);
- count--;
- #if (R_DRAWSPAN_PIPELINE & (RDC_DITHERZ|RDC_BILINEAR))
- x1--;
- #endif
- #endif
- }
- }
- }
- #undef GETDEPTHMAP
- #undef GETCOL_LINEAR
- #undef GETCOL_POINT
- #undef GETCOL
- #undef PITCH
- #undef TOPLEFT
- #undef SCREENTYPE
- #undef R_DRAWSPAN_PIPELINE_BITS
- #undef R_DRAWSPAN_PIPELINE
- #undef R_DRAWSPAN_FUNCNAME
|