Ignore:
Timestamp:
Dec 23, 2016, 10:07:39 AM (8 years ago)
Author:
chronos
Message:
  • Modified: Drawing and loading using bitmap rawimage improvement.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/FastGraphics/UGGraphics.pas

    r29 r30  
    199199  PixelPtr: PInteger;
    200200  PixelPtrMax: PInteger;
     201  PixelPtrMin: PInteger;
    201202  PixelRowPtr: PInteger;
    202203  P: TPixelFormat;
     
    209210    PixelRowPtr := PInteger(RawImage.Data);
    210211    BytePerPixel := RawImage.Description.BitsPerPixel div 8;
     212    PixelPtrMin := PixelRowPtr;
    211213    PixelPtrMax := PixelRowPtr + RawImage.Description.Width * RawImage.Description.Height * BytePerPixel;
    212214    for Y := Rect.Top to Rect.Bottom - 1 do begin
    213215      PixelPtr := PixelRowPtr;
    214216      for X := Rect.Left to Rect.Right - 1 do begin
    215         if (X >= 0) and (X < FSize.X) and (Y >= 0) and (Y < FSize.Y) and (PixelPtr < PixelPtrMax) then
     217        if (X >= 0) and (X < FSize.X) and (Y >= 0) and (Y < FSize.Y) and
     218        (PixelPtr < PixelPtrMax) and (PixelPtr > PixelPtrMin) then
    216219          PixelPtr^ := ColorConvertFunc(Pixels[X, Y]);
    217220        Inc(PByte(PixelPtr), BytePerPixel);
Note: See TracChangeset for help on using the changeset viewer.