Changeset 43


Ignore:
Timestamp:
Jan 9, 2017, 10:24:30 PM (7 years ago)
Author:
chronos
Message:
  • Fixed: Range check error in pixel manipulation.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ScreenTools.pas

    r41 r43  
    771771    for i := 0 to w - 1 do
    772772    begin
    773       Red := (Pixel[0] * (Color0 and $0000FF) + Pixel[1] * (Color1 and $0000FF)
    774         + Pixel[2] * (Color2 and $0000FF)) shr 8;
    775       Green := (Pixel[0] * (Color0 shr 8 and $0000FF) + Pixel[1] *
    776         (Color1 shr 8 and $0000FF) + Pixel[2] * (Color2 shr 8 and
    777         $0000FF)) shr 8;
    778       Pixel[0] := (Pixel[0] * (Color0 shr 16 and $0000FF) + Pixel[1] *
    779         (Color1 shr 16 and $0000FF) + Pixel[2] * (Color2 shr 16 and $0000FF))
    780         shr 8; // Blue
     773      Red := ((Pixel[0] * (Color0 and $0000FF) + Pixel[1] * (Color1 and $0000FF)
     774        + Pixel[2] * (Color2 and $0000FF)) shr 8) and $ff;
     775      Green := ((Pixel[0] * (Color0 shr 8 and $0000FF) + Pixel[1] *
     776        ((Color1 shr 8) and $0000FF) + Pixel[2] * ((Color2 shr 8) and
     777        $0000FF)) shr 8) and $ff;
     778      Pixel[0] := ((Pixel[0] * (Color0 shr 16 and $0000FF) + Pixel[1] *
     779        ((Color1 shr 16) and $0000FF) + Pixel[2] * ((Color2 shr 16) and $0000FF))
     780        shr 8) and $ff; // Blue
    781781      Pixel[1] := Green;
    782782      Pixel[2] := Red;
Note: See TracChangeset for help on using the changeset viewer.