aboutsummaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
authork-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-02-13 21:27:42 +0000
committerk-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-02-13 21:27:42 +0000
commitcf71c461e3099bb8db9ccbc09b55797733f4632c (patch)
treeeea54aca3afd533fdc734949cd6ace1a64d380d7 /src/base
parent23c87e0c4020c47a14d6e7fc3ae29d31f0bef387 (diff)
downloadusdx-cf71c461e3099bb8db9ccbc09b55797733f4632c.tar.gz
usdx-cf71c461e3099bb8db9ccbc09b55797733f4632c.tar.xz
usdx-cf71c461e3099bb8db9ccbc09b55797733f4632c.zip
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
Diffstat (limited to 'src/base')
-rw-r--r--src/base/UImage.pas9
1 files changed, 9 insertions, 0 deletions
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;