1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-13 00:25:19 +02:00

Deleted unused parts of blitter

This commit is contained in:
sfan5
2025-07-07 18:18:03 +02:00
parent 158bfa6442
commit e8e5ef0369
6 changed files with 0 additions and 541 deletions

View File

@@ -2,11 +2,6 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
/*
History:
- changed behavior for log2 textures ( replaced multiplies by shift )
*/
#pragma once
#include "irrMath.h"
@@ -120,98 +115,6 @@ REALINLINE u32 PixelBlend32(const u32 c2, const u32 c1, const u32 alpha)
return rb | xg;
}
/*!
Pixel = dest * ( 1 - alpha ) + source * alpha
alpha [0;32]
*/
inline u16 PixelBlend16(const u16 c2, const u16 c1, const u16 alpha)
{
const u16 srcRB = c1 & 0x7C1F;
const u16 srcXG = c1 & 0x03E0;
const u16 dstRB = c2 & 0x7C1F;
const u16 dstXG = c2 & 0x03E0;
u32 rb = srcRB - dstRB;
u32 xg = srcXG - dstXG;
rb *= alpha;
xg *= alpha;
rb >>= 5;
xg >>= 5;
rb += dstRB;
xg += dstXG;
rb &= 0x7C1F;
xg &= 0x03E0;
return (u16)(rb | xg);
}
/*
Pixel = c0 * (c1/31). c0 Alpha retain
*/
inline u16 PixelMul16(const u16 c0, const u16 c1)
{
return (u16)(((((c0 & 0x7C00) * (c1 & 0x7C00)) & 0x3E000000) >> 15) |
((((c0 & 0x03E0) * (c1 & 0x03E0)) & 0x000F8000) >> 10) |
((((c0 & 0x001F) * (c1 & 0x001F)) & 0x000003E0) >> 5) |
(c0 & 0x8000));
}
/*
Pixel = c0 * (c1/31).
*/
inline u16 PixelMul16_2(u16 c0, u16 c1)
{
return (u16)((((c0 & 0x7C00) * (c1 & 0x7C00)) & 0x3E000000) >> 15 |
(((c0 & 0x03E0) * (c1 & 0x03E0)) & 0x000F8000) >> 10 |
(((c0 & 0x001F) * (c1 & 0x001F)) & 0x000003E0) >> 5 |
(c0 & c1 & 0x8000));
}
/*
Pixel = c0 * (c1/255). c0 Alpha Retain
*/
REALINLINE u32 PixelMul32(const u32 c0, const u32 c1)
{
return (c0 & 0xFF000000) |
((((c0 & 0x00FF0000) >> 12) * ((c1 & 0x00FF0000) >> 12)) & 0x00FF0000) |
((((c0 & 0x0000FF00) * (c1 & 0x0000FF00)) >> 16) & 0x0000FF00) |
((((c0 & 0x000000FF) * (c1 & 0x000000FF)) >> 8) & 0x000000FF);
}
/*
Pixel = c0 * (c1/255).
*/
REALINLINE u32 PixelMul32_2(const u32 c0, const u32 c1)
{
return ((((c0 & 0xFF000000) >> 16) * ((c1 & 0xFF000000) >> 16)) & 0xFF000000) |
((((c0 & 0x00FF0000) >> 12) * ((c1 & 0x00FF0000) >> 12)) & 0x00FF0000) |
((((c0 & 0x0000FF00) * (c1 & 0x0000FF00)) >> 16) & 0x0000FF00) |
((((c0 & 0x000000FF) * (c1 & 0x000000FF)) >> 8) & 0x000000FF);
}
/*
Pixel = clamp ( c0 + c1, 0, 255 )
*/
REALINLINE u32 PixelAdd32(const u32 c2, const u32 c1)
{
u32 sum = (c2 & 0x00FFFFFF) + (c1 & 0x00FFFFFF);
u32 low_bits = (c2 ^ c1) & 0x00010101;
s32 carries = (sum - low_bits) & 0x01010100;
u32 modulo = sum - carries;
u32 clamp = carries - (carries >> 8);
return modulo | clamp;
}
// 1 - Bit Alpha Blending
inline u16 PixelBlend16(const u16 c2, const u16 c1)
{
u16 mask = ((c1 & 0x8000) >> 15) + 0x7fff;
return (c2 & mask) | (c1 & ~mask);
}
/*!
Pixel = dest * ( 1 - SourceAlpha ) + source * SourceAlpha (OpenGL blending)
*/