Browse Source

Minor bitmap optimizations

Former-commit-id: c3a980b4d7208cde0f3bef9dd5c2cc28ef79e68b
Former-commit-id: 645e1ebe51f96d97ff81e9962ffd0cb809b5d8a4
Former-commit-id: 16448059bf75d00199580eab8d53f985adec178d
pull/17/head
James Jackson-South 10 years ago
parent
commit
e020ae5472
  1. 7
      src/ImageProcessor/Formats/Bmp/BmpDecoderCore.cs

7
src/ImageProcessor/Formats/Bmp/BmpDecoderCore.cs

@ -87,7 +87,8 @@ namespace ImageProcessor.Formats
if (colorMapSize > 0)
{
if (colorMapSize > 255 * 4)
// 255 * 4
if (colorMapSize > 1020)
{
throw new ImageFormatException($"Invalid bmp colormap size '{colorMapSize}'");
}
@ -242,8 +243,8 @@ namespace ImageProcessor.Formats
private void ReadRgb16(float[] imageData, int width, int height)
{
// We divide here as we will store the colors in our floating point format.
const int ScaleR = (256 / 32) / 32;
const int ScaleG = (256 / 64) / 64;
const float ScaleR = 0.25F; // (256 / 32) / 32
const float ScaleG = 0.0625F; // (256 / 64) / 64
int alignment;
byte[] data = this.GetImageArray(width, height, 2, out alignment);

Loading…
Cancel
Save