File diff r21363:d44cc377eeb3 → r21364:fc9d03d2e2b8
src/blitter/32bpp_sse_func.hpp
Show inline comments
 
@@ -235,19 +235,19 @@ inline void Blitter_32bppSSE4::Draw(cons
 
#endif
 
	const __m128i tr_nom_base = TRANSPARENT_NOM_BASE;
 

	
 
	for (int y = bp->height; y != 0; y--) {
 
		Colour *dst = dst_line;
 
		const Colour *src = src_rgba_line + META_LENGTH;
 
		if (mode == BM_COLOUR_REMAP) src_mv = src_mv_line;
 
		if (mode == BM_COLOUR_REMAP || mode == BM_CRASH_REMAP) src_mv = src_mv_line;
 

	
 
		if (read_mode == RM_WITH_MARGIN) {
 
			assert(bt_last == BT_NONE); // or you must ensure block type is preserved
 
			src += src_rgba_line[0].data;
 
			dst += src_rgba_line[0].data;
 
			if (mode == BM_COLOUR_REMAP) src_mv += src_rgba_line[0].data;
 
			if (mode == BM_COLOUR_REMAP || mode == BM_CRASH_REMAP) src_mv += src_rgba_line[0].data;
 
			const int width_diff = si->sprite_width - bp->width;
 
			effective_width = bp->width - (int) src_rgba_line[0].data;
 
			const int delta_diff = (int) src_rgba_line[1].data - width_diff;
 
			const int new_width = effective_width - delta_diff;
 
			effective_width = delta_diff > 0 ? new_width : effective_width;
 
			if (effective_width <= 0) goto next_line;
 
@@ -374,16 +374,33 @@ bmcr_alpha_blend_single:
 
				if ((bt_last == BT_NONE && bp->width & 1) || bt_last == BT_ODD) {
 
					__m128i srcABCD = _mm_cvtsi32_si128(src->data);
 
					__m128i dstABCD = _mm_cvtsi32_si128(dst->data);
 
					dst->data = _mm_cvtsi128_si32(DarkenTwoPixels(srcABCD, dstABCD, DARKEN_PARAM_1, DARKEN_PARAM_2));
 
				}
 
				break;
 

	
 
			case BM_CRASH_REMAP:
 
				for (uint x = (uint) bp->width; x > 0; x--) {
 
					if (src_mv->m == 0) {
 
						if (src->a != 0) {
 
							uint8 g = MakeDark(src->r, src->g, src->b);
 
							*dst = ComposeColourRGBA(g, g, g, src->a, *dst);
 
						}
 
					} else {
 
						uint r = remap[src_mv->m];
 
						if (r != 0) *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(r), src_mv->v), src->a, *dst);
 
					}
 
					src_mv++;
 
					dst++;
 
					src++;
 
				}
 
				break;
 
		}
 

	
 
next_line:
 
		if (mode == BM_COLOUR_REMAP) src_mv_line += si->sprite_width;
 
		if (mode == BM_COLOUR_REMAP || mode == BM_CRASH_REMAP) src_mv_line += si->sprite_width;
 
		src_rgba_line = (const Colour*) ((const byte*) src_rgba_line + si->sprite_line_size);
 
		dst_line += bp->pitch;
 
	}
 
}
 
IGNORE_UNINITIALIZED_WARNING_STOP
 

	
 
@@ -426,12 +443,13 @@ bm_normal:
 
			if (bp->skip_left != 0 || bp->width <= MARGIN_REMAP_THRESHOLD) {
 
				Draw<BM_COLOUR_REMAP, RM_WITH_SKIP, BT_NONE, true>(bp, zoom); return;
 
			} else {
 
				Draw<BM_COLOUR_REMAP, RM_WITH_MARGIN, BT_NONE, true>(bp, zoom); return;
 
			}
 
		case BM_TRANSPARENT:  Draw<BM_TRANSPARENT, RM_NONE, BT_NONE, true>(bp, zoom); return;
 
		case BM_CRASH_REMAP:  Draw<BM_CRASH_REMAP, RM_NONE, BT_NONE, true>(bp, zoom); return;
 
	}
 
}
 
#endif /* FULL_ANIMATION */
 

	
 
#endif /* WITH_SSE */
 
#endif /* BLITTER_32BPP_SSE_FUNC_HPP */