From cf71c461e3099bb8db9ccbc09b55797733f4632c Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Fri, 13 Feb 2009 21:27:42 +0000 Subject: Additional safe guard for pixel size in ColorizeImage git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1591 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/UImage.pas | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/base/UImage.pas') diff --git a/src/base/UImage.pas b/src/base/UImage.pas index d9d02a58..db4cde09 100644 --- a/src/base/UImage.pas +++ b/src/base/UImage.pas @@ -947,6 +947,15 @@ var begin Pixel := ImgSurface^.Pixels; + + // check of the size of a pixel in bytes. + // It should be always 4, but this + // additional safeguard will show, + // whether something went wrong up to here. + + if ImgSurface^.format.BytesPerPixel <> 4 then + Log.LogError ('ColorizeImage: The pixel size should be 4, but it is ' + + IntToStr(ImgSurface^.format.BytesPerPixel)); hue := col2hue(NewColor); // hue is shl 10 f := hue and $3ff; -- cgit v1.2.3