aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-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;