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.
Location:
trunk/Packages/CevoComponents
Files:
2 edited

Legend:

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

    r208 r323  
    7474begin
    7575  with Canvas do
    76     if FGraphic <> nil then
    77     begin
    78       // TODO: For some reason BitBlt is not working with gray background here
    79       //BitBltCanvas(Buffer.Canvas, 0, 0, 48, 48, Back.Canvas, 0, 0);
    80       Buffer.Canvas.Draw(0, 0, Back);
     76    if FGraphic <> nil then begin
     77      UnshareBitmap(Buffer);
     78      BitBltCanvas(Buffer.Canvas, 0, 0, 48, 48, Back.Canvas, 0, 0);
    8179      ImageOp_CBC(Buffer, Template, 0, 0, 133, 149 + 48 * Byte(FDown), 48, 48,
    8280        $000000, $FFFFFF);
     
    8583          $000000, $FFFFFF);
    8684      BitBltCanvas(Canvas, 0, 0, 48, 48, Buffer.Canvas, 0, 0);
    87     end
    88     else
    89     begin
     85    end else begin
    9086      Brush.Color := $0000FF;
    9187      FrameRect(Rect(0, 0, 48, 48))
  • 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.