Ignore:
Timestamp:
Mar 23, 2021, 2:46:42 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Created single procedure for unshare/free bitmap before BitBlt use.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/CevoComponents/ScreenTools.pas

    r318 r323  
    109109function ScaleToNative(Value: Integer): Integer;
    110110function ScaleFromNative(Value: Integer): Integer;
     111procedure UnshareBitmap(Bitmap: TBitmap);
    111112
    112113const
     
    15141515procedure PaintLogo(Canvas: TCanvas; X, Y, LightColor, ShadeColor: Integer);
    15151516begin
    1516   // TODO: Explicitly clear background to black but in fact BitBlt SRCCOPY should do it
    1517   LogoBuffer.Canvas.FillRect(0, 0, LogoBuffer.Width, LogoBuffer.Height);
     1517  UnshareBitmap(LogoBuffer);
    15181518  BitBltCanvas(LogoBuffer.Canvas, 0, 0, Logo.Width, Logo.Height, Canvas, X, Y);
    15191519  ImageOp_BCC(LogoBuffer, Templates.Data, Point(0, 0), Logo.BoundsRect,
     
    16261626begin
    16271627  Result := Value;
     1628end;
     1629
     1630procedure UnshareBitmap(Bitmap: TBitmap);
     1631begin
     1632  // FillRect cause image data to be freed so subsequent BitBlt can access valid image data
     1633  Bitmap.Canvas.FillRect(0, 0, 0, 0);
    16281634end;
    16291635
Note: See TracChangeset for help on using the changeset viewer.