aboutsummaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
authork-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-02-13 00:06:59 +0000
committerk-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-02-13 00:06:59 +0000
commit23c87e0c4020c47a14d6e7fc3ae29d31f0bef387 (patch)
treeb0f0239a29169eed8a47a485474266c4c8455a81 /src/base
parentb89c524d4d7996f7984d698b68fb75b0ec253267 (diff)
downloadusdx-23c87e0c4020c47a14d6e7fc3ae29d31f0bef387.tar.gz
usdx-23c87e0c4020c47a14d6e7fc3ae29d31f0bef387.tar.xz
usdx-23c87e0c4020c47a14d6e7fc3ae29d31f0bef387.zip
endian related glitch with icons resolved (Bug 2363571). Courtesy to sven for an essential hint.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1590 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/base')
-rw-r--r--src/base/UImage.pas25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/base/UImage.pas b/src/base/UImage.pas
index 01dfe9ea..d9d02a58 100644
--- a/src/base/UImage.pas
+++ b/src/base/UImage.pas
@@ -903,6 +903,7 @@ procedure ColorizeImage(ImgSurface: PSDL_Surface; NewColor: cardinal);
red, green, blue: longword;
min, max, delta: longword;
hue: double;
+ test: longword;
begin
// extract the colors
// division by 255 is omitted, since it is implicitly done
@@ -961,9 +962,15 @@ begin
// get color values
+ {$IFDEF FPC_BIG_ENDIAN}
+ red := PixelColors[3];
+ green := PixelColors[2];
+ blue := PixelColors[1];
+ {$ELSE}
red := PixelColors[0];
green := PixelColors[1];
blue := PixelColors[2];
+ {$ENDIF}
//calculate luminance and saturation from rgb
@@ -973,9 +980,15 @@ begin
if (max = 0) then // the color is black
begin
+ {$IFDEF FPC_BIG_ENDIAN}
+ PixelColors[3] := 0;
+ PixelColors[2] := 0;
+ PixelColors[1] := 0;
+ {$ELSE}
PixelColors[0] := 0;
PixelColors[1] := 0;
PixelColors[2] := 0;
+ {$ENDIF}
end
else
begin
@@ -985,9 +998,15 @@ begin
if (min = 255) then // the color is white
begin
+ {$IFDEF FPC_BIG_ENDIAN}
+ PixelColors[3] := 255;
+ PixelColors[2] := 255;
+ PixelColors[1] := 255;
+ {$ELSE}
PixelColors[0] := 255;
PixelColors[1] := 255;
PixelColors[2] := 255;
+ {$ENDIF}
end
else // all colors except black and white
begin
@@ -1010,9 +1029,15 @@ begin
5: begin red := max; green := p; blue := q; end; // (v,p,q)
end;
+ {$IFDEF FPC_BIG_ENDIAN}
+ PixelColors[3] := red ;
+ PixelColors[2] := green ;
+ PixelColors[1] := blue ;
+ {$ELSE}
PixelColors[0] := red ;
PixelColors[1] := green ;
PixelColors[2] := blue ;
+ {$ENDIF}
end;
end;