LCL: fixed range check errors

git-svn-id: trunk@15674 -
This commit is contained in:
tombo 2008-07-04 14:02:11 +00:00
parent fa3bdaac2f
commit 29ea8899f8
2 changed files with 10 additions and 10 deletions

View File

@ -589,7 +589,7 @@ begin
ADesc.BitOrder := riboReversedBits;
ADesc.ByteOrder := riboMSBFirst;
BPR := CGImageGetBytesPerRow(ABitmap.CGImage);
BPR := CGImageGetBytesPerRow(ABitmap.CGImage) and $FF;
if BPR and $F = 0 then ADesc.LineEnd := rileDQWordBoundary // 128bit aligned
else if BPR and $7 = 0 then ADesc.LineEnd := rileQWordBoundary // 64bit aligned
else if BPR and $3 = 0 then ADesc.LineEnd := rileWordBoundary // 32bit aligned
@ -604,7 +604,7 @@ begin
ADesc.MaskLineEnd := rileByteBoundary;
// ADesc.MaskShift := 0;
Prec := CGImageGetBitsPerComponent(ABitmap.CGImage);
Prec := CGImageGetBitsPerComponent(ABitmap.CGImage) and $FF;
AlphaInfo := CGImageGetAlphaInfo(ABitmap.CGImage);
if AlphaInfo <> kCGImageAlphaOnly

View File

@ -1346,10 +1346,10 @@ var
if Desc.GreenShift and 7 <> 0 then Exit;
if Desc.BlueShift and 7 <> 0 then Exit;
Positions := ((Desc.AlphaShift shr 3) and 3) shl 6
Positions := (((Desc.AlphaShift shr 3) and 3) shl 6
or ((Desc.RedShift shr 3) and 3) shl 4
or ((Desc.GreenShift shr 3) and 3) shl 2
or ((Desc.BlueShift shr 3) and 3);
or ((Desc.BlueShift shr 3) and 3)) and $FF;
if Desc.ByteOrder = riboMSBFirst
then Positions := not Positions; // reverse positions
@ -1439,9 +1439,9 @@ var
if Desc.GreenShift and 7 <> 0 then Exit;
if Desc.BlueShift and 7 <> 0 then Exit;
Positions := ((Desc.RedShift shr 3) and 3) shl 4
Positions := (((Desc.RedShift shr 3) and 3) shl 4
or ((Desc.GreenShift shr 3) and 3) shl 2
or ((Desc.BlueShift shr 3) and 3);
or ((Desc.BlueShift shr 3) and 3)) and $FF;
if Desc.ByteOrder = riboMSBFirst
then Positions := not Positions and %00111111; // reverse positions
@ -1533,13 +1533,13 @@ var
if Desc.ByteOrder = riboMSBFirst
then
Positions := (2-((Desc.RedShift shr 3) and 3)) shl 4
Positions := ((2-((Desc.RedShift shr 3) and 3)) shl 4
or (2-((Desc.GreenShift shr 3) and 3)) shl 2
or (2-((Desc.BlueShift shr 3) and 3))
or (2-((Desc.BlueShift shr 3) and 3))) and $FF
else
Positions := ((Desc.RedShift shr 3) and 3) shl 4
Positions := (((Desc.RedShift shr 3) and 3) shl 4
or ((Desc.GreenShift shr 3) and 3) shl 2
or ((Desc.BlueShift shr 3) and 3);
or ((Desc.BlueShift shr 3) and 3)) and $FF;
// the locations of R,G,B are now coded in 2 bits each: xxRRBBGG