All pastes #492050 Raw Edit

sbeam

public cpp v1 · immutable
·published 2007-05-16 23:57 UTC
rendered paste body
#define _putpixels_fixratio_scale1(d) static void			\_putpixels_fixratio_##d##bits_scale1 (int x, int y, int w, UINT8 *p) {	\	if (y > 0 && ASPECT_RATIO (y) - 1 != ASPECT_RATIO (y - 1))	\		_putpixels_##d##bits_scale1 (x, ASPECT_RATIO(y) - 1, w, p);\	_putpixels_##d##bits_scale1 (x, ASPECT_RATIO(y), w, p);		\}#define _putpixels_fixratio_scale2(d) static void INLINE		\_putpixels_fixratio_##d##bits_scale2 (int x, int y, int w, Uint8 *p0) {	\	Uint##d *s, *t, *u; Uint8 *p; int extra = 0;			\	if (w == 0) return;						\	x <<= 1; y <<= 1;						\	if (y < ((GFX_WIDTH - 1) << 2) && ASPECT_RATIO (y) + 2 != ASPECT_RATIO (y + 2)) extra = w; \	y = ASPECT_RATIO(y);						\	s = (Uint##d *)screen->pixels + x + y * screen->w;		\	t = s + screen->w;						\	u = t + screen->w;						\	if (SDL_MUSTLOCK (screen)) {					\		if (SDL_LockSurface (screen) < 0)			\			return;						\	}								\	for (p = p0; w--; p++) {					\		int c = mapped_color[*p];				\		*s++ = c; *s++ = c; *t++ = c; *t++ = c;			\	}								\	for (p = p0; extra--; p++) {					\		int c = mapped_color[*p];				\		*u++ = c; *u++ = c;					\	}								\	if (SDL_MUSTLOCK (screen)) SDL_UnlockSurface (screen);		\}_putpixels_fixratio_scale1(8);_putpixels_fixratio_scale1(16);_putpixels_fixratio_scale1(32);_putpixels_fixratio_scale2(8);_putpixels_fixratio_scale2(16);_putpixels_fixratio_scale2(32);