Fix code style

This commit is contained in:
Crsky
2025-01-22 16:58:13 +08:00
parent aaa09def6f
commit ee8866c181

View File

@@ -126,8 +126,11 @@ namespace GameRes
public static ImageData Create (ImageMetaData info, PixelFormat format, BitmapPalette palette,
Array pixel_data)
{
return Create (info, format, palette, pixel_data,
format.BitsPerPixel == 4 ? (int)info.Width*format.BitsPerPixel/8 : (int)info.Width*((format.BitsPerPixel+7)/8));
if (format.BitsPerPixel == 4)
return Create(info, format, palette, pixel_data,
(int)info.Width*format.BitsPerPixel/8);
return Create(info, format, palette, pixel_data,
(int)info.Width*((format.BitsPerPixel+7)/8));
}
public static ImageData CreateFlipped (ImageMetaData info, PixelFormat format, BitmapPalette palette,
@@ -218,10 +221,10 @@ namespace GameRes
Func<int, Color> get_color;
if (PaletteFormat.Bgr == format || PaletteFormat.BgrX == format)
get_color = x => Color.FromRgb (palette_data[x+2], palette_data[x+1], palette_data[x]);
else if (PaletteFormat.BgrA7 == format)
get_color = x => Color.FromArgb(palette_data[x+3] >= byte.MaxValue / 2 ? byte.MaxValue : (byte)(palette_data[x+3] << 1), palette_data[x+2], palette_data[x+1], palette_data[x]);
else if (PaletteFormat.BgrA == format)
get_color = x => Color.FromArgb (palette_data[x+3], palette_data[x+2], palette_data[x+1], palette_data[x]);
else if (PaletteFormat.BgrA7 == format)
get_color = x => Color.FromArgb (palette_data[x+3] >= byte.MaxValue / 2 ? byte.MaxValue : (byte)(palette_data[x+3] << 1), palette_data[x+2], palette_data[x+1], palette_data[x]);
else if (PaletteFormat.RgbA == format)
get_color = x => Color.FromArgb (palette_data[x+3], palette_data[x], palette_data[x+1], palette_data[x+2]);
else if (PaletteFormat.RgbA7 == format)