File diff r19211:689ef38b7870 → r19212:c8e0af51e6c1
src/blitter/32bpp_anim.cpp
Show inline comments
 
@@ -28,28 +28,28 @@ inline void Blitter_32bppAnim::Draw(cons
 

	
 
	for (uint i = bp->skip_top; i != 0; i--) {
 
		src_px = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
 
		src_n  = (const uint16 *)((const byte *)src_n  + *(const uint32 *)src_n);
 
	}
 

	
 
	uint32 *dst = (uint32 *)bp->dst + bp->top * bp->pitch + bp->left;
 
	Colour *dst = (Colour *)bp->dst + bp->top * bp->pitch + bp->left;
 
	uint16 *anim = this->anim_buf + ((uint32 *)bp->dst - (uint32 *)_screen.dst_ptr) + bp->top * this->anim_buf_width + bp->left;
 

	
 
	const byte *remap = bp->remap; // store so we don't have to access it via bp everytime
 

	
 
	for (int y = 0; y < bp->height; y++) {
 
		uint32 *dst_ln = dst + bp->pitch;
 
		Colour *dst_ln = dst + bp->pitch;
 
		uint16 *anim_ln = anim + this->anim_buf_width;
 

	
 
		const Colour *src_px_ln = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
 
		src_px++;
 

	
 
		const uint16 *src_n_ln = (const uint16 *)((const byte *)src_n + *(const uint32 *)src_n);
 
		src_n += 2;
 

	
 
		uint32 *dst_end = dst + bp->skip_left;
 
		Colour *dst_end = dst + bp->skip_left;
 

	
 
		uint n;
 

	
 
		while (dst < dst_end) {
 
			n = *src_n++;
 

	
 
@@ -216,13 +216,13 @@ void Blitter_32bppAnim::DrawColourMappin
 
	if (_screen_disable_anim) {
 
		/* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawColourMappingRect() */
 
		Blitter_32bppOptimized::DrawColourMappingRect(dst, width, height, pal);
 
		return;
 
	}
 

	
 
	uint32 *udst = (uint32 *)dst;
 
	Colour *udst = (Colour *)dst;
 
	uint16 *anim;
 

	
 
	anim = this->anim_buf + ((uint32 *)dst - (uint32 *)_screen.dst_ptr);
 

	
 
	if (pal == PALETTE_TO_TRANSPARENT) {
 
		do {
 
@@ -253,13 +253,13 @@ void Blitter_32bppAnim::DrawColourMappin
 

	
 
	DEBUG(misc, 0, "32bpp blitter doesn't know how to draw this colour table ('%d')", pal);
 
}
 

	
 
void Blitter_32bppAnim::SetPixel(void *video, int x, int y, uint8 colour)
 
{
 
	*((uint32 *)video + x + y * _screen.pitch) = LookupColourInPalette(colour);
 
	*((Colour *)video + x + y * _screen.pitch) = LookupColourInPalette(colour);
 

	
 
	/* Set the colour in the anim-buffer too, if we are rendering to the screen */
 
	if (_screen_disable_anim) return;
 
	this->anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->anim_buf_width] = colour | (DEFAULT_BRIGHTNESS << 8);
 
}
 

	
 
@@ -268,19 +268,19 @@ void Blitter_32bppAnim::DrawRect(void *v
 
	if (_screen_disable_anim) {
 
		/* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawRect() */
 
		Blitter_32bppOptimized::DrawRect(video, width, height, colour);
 
		return;
 
	}
 

	
 
	uint32 colour32 = LookupColourInPalette(colour);
 
	Colour colour32 = LookupColourInPalette(colour);
 
	uint16 *anim_line;
 

	
 
	anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
 

	
 
	do {
 
		uint32 *dst = (uint32 *)video;
 
		Colour *dst = (Colour *)video;
 
		uint16 *anim = anim_line;
 

	
 
		for (int i = width; i > 0; i--) {
 
			*dst = colour32;
 
			/* Set the colour in the anim-buffer too */
 
			*anim = colour | (DEFAULT_BRIGHTNESS << 8);
 
@@ -293,19 +293,19 @@ void Blitter_32bppAnim::DrawRect(void *v
 
}
 

	
 
void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width, int height)
 
{
 
	assert(!_screen_disable_anim);
 
	assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
 
	uint32 *dst = (uint32 *)video;
 
	Colour *dst = (Colour *)video;
 
	const uint32 *usrc = (const uint32 *)src;
 
	uint16 *anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
 

	
 
	for (; height > 0; height--) {
 
		/* We need to keep those for palette animation. */
 
		uint32 *dst_pal = dst;
 
		Colour *dst_pal = dst;
 
		uint16 *anim_pal = anim_line;
 

	
 
		memcpy(dst, usrc, width * sizeof(uint32));
 
		usrc += width;
 
		dst += _screen.pitch;
 
		/* Copy back the anim-buffer */
 
@@ -419,13 +419,13 @@ void Blitter_32bppAnim::PaletteAnimate(c
 
	/* If first_dirty is 0, it is for 8bpp indication to send the new
 
	 *  palette. However, only the animation colours might possibly change.
 
	 *  Especially when going between toyland and non-toyland. */
 
	assert(this->palette.first_dirty == PALETTE_ANIM_START || this->palette.first_dirty == 0);
 

	
 
	const uint16 *anim = this->anim_buf;
 
	uint32 *dst = (uint32 *)_screen.dst_ptr;
 
	Colour *dst = (Colour *)_screen.dst_ptr;
 

	
 
	/* Let's walk the anim buffer and try to find the pixels */
 
	for (int y = this->anim_buf_height; y != 0 ; y--) {
 
		for (int x = this->anim_buf_width; x != 0 ; x--) {
 
			uint colour = GB(*anim, 0, 8);
 
			if (colour >= PALETTE_ANIM_START) {