trying to restore transparency handling fix.

probably missed some bitflag in a header that's responsible for this
behavior.
This commit is contained in:
morkt 2016-10-14 01:51:46 +04:00
parent 44deae320c
commit 8c6b44bb3f
2 changed files with 36 additions and 39 deletions

View File

@ -152,7 +152,7 @@ namespace GameRes.Formats.Circus
Palette = new BitmapPalette (palette); Palette = new BitmapPalette (palette);
} }
public void Unpack () public void Unpack (bool is_diff = false)
{ {
if (m_compression >= 3) if (m_compression >= 3)
{ {
@ -184,8 +184,7 @@ namespace GameRes.Formats.Circus
int g = m_output[pixel+2]; int g = m_output[pixel+2];
int r = m_output[pixel+3]; int r = m_output[pixel+3];
/* if (!is_diff && alpha != alpha_flip)
if (alpha != alpha_flip)
{ {
b += (w & 1) + shift; b += (w & 1) + shift;
if (b < 0) if (b < 0)
@ -205,7 +204,7 @@ namespace GameRes.Formats.Circus
else if (r > 0xff) else if (r > 0xff)
r = 0xff; r = 0xff;
} }
*/
m_output[pixel] = (byte)b; m_output[pixel] = (byte)b;
m_output[pixel+1] = (byte)g; m_output[pixel+1] = (byte)g;
m_output[pixel+2] = (byte)r; m_output[pixel+2] = (byte)r;

View File

@ -136,12 +136,11 @@ namespace GameRes.Formats.Circus
if (null == base_info || base_info.BPP != info.BPP) if (null == base_info || base_info.BPP != info.BPP)
throw new InvalidFormatException ("Invalid base image"); throw new InvalidFormatException ("Invalid base image");
using (var reader = new Reader (base_file, base_info)) using (var reader = new Reader (base_file, base_info))
{
reader.Unpack();
using (var crx = OpenDiffStream (stream, meta)) using (var crx = OpenDiffStream (stream, meta))
using (var diff_reader = new Reader (crx, meta.DiffInfo)) using (var diff_reader = new Reader (crx, meta.DiffInfo))
{ {
diff_reader.Unpack(); reader.Unpack (true);
diff_reader.Unpack (true);
var diff_rect = new Rectangle (meta.OffsetX, meta.OffsetY, (int)meta.Width, (int)meta.Height); var diff_rect = new Rectangle (meta.OffsetX, meta.OffsetY, (int)meta.Width, (int)meta.Height);
var base_rect = new Rectangle (base_info.OffsetX, base_info.OffsetY, var base_rect = new Rectangle (base_info.OffsetX, base_info.OffsetY,
(int)base_info.Width, (int)base_info.Height); (int)base_info.Width, (int)base_info.Height);
@ -178,7 +177,6 @@ namespace GameRes.Formats.Circus
} }
} }
} }
}
public override void Write (Stream file, ImageData image) public override void Write (Stream file, ImageData image)
{ {