Changeset 323


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
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/CityScreen.pas

    r318 r323  
    259259    AgePrepared := MainTextureAge;
    260260
    261     // TODO: FillRect should not be needed as BitBlt is with SRCCOPY
    262     Back.Canvas.FillRect(0, 0, ClientWidth, ClientHeight);
    263 
     261    UnshareBitmap(Back);
    264262    BitBltCanvas(Back.Canvas, 0, 0, ClientWidth, ClientHeight,
    265263      MainTexture.Image.Canvas, 0, 0);
     
    358356procedure TCityDlg.InitZoomCityMap;
    359357begin
    360   // TODO: FillRect should not be needed as BitBlt is with SRCCOPY
    361   ZoomCityMap.Canvas.FillRect(0, 0, ZoomCityMap.Width, ZoomCityMap.Height);
    362 
     358  UnshareBitmap(ZoomCityMap);
    363359  BitBltCanvas(ZoomCityMap.Canvas, 0, 0, wZoomMap, hZoomMap,
    364360    Back.Canvas, xZoomMap, yZoomMap);
  • trunk/LocalPlayer/Draft.pas

    r318 r323  
    233233begin
    234234  inherited;
    235   // TODO: Explicitly clear background to black but in fact BitBlt SRCCOPY should do it
    236   Back.Canvas.FillRect(0, 0, Back.Width, Back.Height);
     235  UnshareBitmap(Back);
    237236
    238237  ClientHeight := Template.Height - Cut;
  • trunk/LocalPlayer/MessgEx.pas

    r318 r323  
    292292
    293293  // paint
    294   // TODO: Explicitly clear background to black but in fact BitBlt SRCCOPY should do it
    295   LogoBuffer.Canvas.FillRect(0, 0, LogoBuffer.Width, LogoBuffer.Height);
     294  UnshareBitmap(LogoBuffer);
    296295  BitBltCanvas(LogoBuffer.Canvas, 0, 0, BookRect.Width, BookRect.Height, ca, x, y);
    297296
     
    374373      begin
    375374        p1 := MyRO.Wonder[IconIndex].EffectiveOwner;
    376         // TODO: Explicitly clear background to black but in fact BitBlt SRCCOPY should do it
    377         Buffer.Canvas.FillRect(0, 0, 1, 1);
     375        UnshareBitmap(Buffer);
    378376        BitBltCanvas(Buffer.Canvas, 0, 0, xSizeBig + 2 * GlowRange,
    379377          ySizeBig + 2 * GlowRange, Canvas,
  • 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
  • trunk/Start.pas

    r320 r323  
    503503    $000000, xAction, y + 21, Phrases2.Lookup(TextItem));
    504504
    505   // TODO: Explicitly clear background to black but in fact BitBlt SRCCOPY should do it
    506   LogoBuffer.Canvas.FillRect(0, 0, LogoBuffer.Width, LogoBuffer.Height);
     505  UnshareBitmap(LogoBuffer);
    507506  BitBltCanvas(LogoBuffer.Canvas, 0, 0, 50, 50, Canvas,
    508507    xActionIcon - 2, y - 2);
     
    603602
    604603  // Paint menu logo
    605   // TODO: Explicitly clear background to black but in fact BitBlt SRCCOPY should do it
    606   LogoBuffer.Canvas.FillRect(0, 0, LogoBuffer.Width, LogoBuffer.Height);
     604  UnshareBitmap(LogoBuffer);
    607605  BitBltCanvas(LogoBuffer.Canvas, 0, 0, MenuLogo.Width, MenuLogo.Height, Canvas, 6,
    608606    3 + 2 * integer(Tab <> tbMain));
     
    627625          h := ClientHeight - ActionBottomBorder -
    628626            (yAction + Integer(SelectedAction) * ActionPitch - 8);
    629         // TODO: Explicitly clear background to black but in fact BitBlt SRCCOPY should do it
    630         LogoBuffer.Canvas.FillRect(0, 0, LogoBuffer.Width, LogoBuffer.Height);
     627
     628        UnshareBitmap(LogoBuffer);
    631629        BitBltCanvas(LogoBuffer.Canvas, 0, 0, w, h, Canvas,
    632630          ActionSideBorder + i * wBuffer, yAction + Integer(SelectedAction) * ActionPitch
     
    653651                Format(Phrases2.Lookup('ACTIONHEADER_WEB'), [CevoHomepageShort]));
    654652              Canvas.Font.Assign(UniFont[ftNormal]);
    655               // TODO: Explicitly clear background to black but in fact BitBlt SRCCOPY should do it
    656               LogoBuffer.Canvas.FillRect(0, 0, LogoBuffer.Width, LogoBuffer.Height);
     653
     654              UnshareBitmap(LogoBuffer);
    657655              BitBltCanvas(LogoBuffer.Canvas, 0, 0, LinkArrows.Width, LinkArrows.Height, Canvas,
    658656                xActionIcon, y + 2);
Note: See TracChangeset for help on using the changeset viewer.