Ignore:
Timestamp:
May 6, 2020, 11:21:12 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Simplified code by replacing BitBlt which uses always handles by BitBltCanvas which uses directly TCanvas objects. Used default ROP SRCCOPY.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Term.pas

    r182 r188  
    27482748          begin
    27492749            if AILogo[pLogo] <> nil then
    2750               BitBlt(Canvas.Handle, (xRightPanel + 10) - (16 + 64),
    2751                 ClientHeight - PanelHeight, 64, 64, AILogo[pLogo].Canvas.Handle,
    2752                 0, 0, SRCCOPY);
     2750              BitBltCanvas(Canvas, (xRightPanel + 10) - (16 + 64),
     2751                ClientHeight - PanelHeight, 64, 64, AILogo[pLogo].Canvas,
     2752                0, 0);
    27532753          end
    27542754        end
     
    40384038    exit;
    40394039
    4040   NoMap.BitBlt(Panel, -xMap - MapOffset, -yMap + MapHeight - overlap, xMidPanel,
     4040  NoMap.BitBltBitmap(Panel, -xMap - MapOffset, -yMap + MapHeight - overlap, xMidPanel,
    40414041    overlap, 0, 0, SRCCOPY);
    4042   NoMap.BitBlt(Panel, -xMap - MapOffset + xRightPanel,
     4042  NoMap.BitBltBitmap(Panel, -xMap - MapOffset + xRightPanel,
    40434043    -yMap + MapHeight - overlap, Panel.width - xRightPanel, overlap,
    40444044    xRightPanel, 0, SRCCOPY);
     
    40464046  begin
    40474047    if xMap < 0 then
    4048       BitBlt(Canvas.Handle, MapOffset, TopBarHeight, width + xMap,
    4049         height + yMap, Buffer.Canvas.Handle, -xMap, -yMap, SRCCOPY)
     4048      BitBltCanvas(Canvas, MapOffset, TopBarHeight, width + xMap,
     4049        height + yMap, Buffer.Canvas, -xMap, -yMap)
    40504050    else
    4051       BitBlt(Canvas.Handle, xMap + MapOffset, TopBarHeight, width,
    4052         height + yMap, Buffer.Canvas.Handle, 0, -yMap, SRCCOPY)
     4051      BitBltCanvas(Canvas, xMap + MapOffset, TopBarHeight, width,
     4052        height + yMap, Buffer.Canvas, 0, -yMap)
    40534053  end
    40544054  else
    40554055  begin
    40564056    if xMap < 0 then
    4057       BitBlt(Canvas.Handle, MapOffset, TopBarHeight + yMap, width + xMap,
    4058         height, Buffer.Canvas.Handle, -xMap, 0, SRCCOPY)
     4057      BitBltCanvas(Canvas, MapOffset, TopBarHeight + yMap, width + xMap,
     4058        height, Buffer.Canvas, -xMap, 0)
    40594059    else
    4060       BitBlt(Canvas.Handle, xMap + MapOffset, TopBarHeight + yMap, width,
    4061         height, Buffer.Canvas.Handle, 0, 0, SRCCOPY);
     4060      BitBltCanvas(Canvas, xMap + MapOffset, TopBarHeight + yMap, width,
     4061        height, Buffer.Canvas, 0, 0);
    40624062  end
    40634063end;
     
    41844184begin
    41854185  BitBltCanvas(Canvas, lprcScroll.Left + dx, lprcScroll.Top + dy, lprcScroll.Right - lprcScroll.Left, lprcScroll.Bottom - lprcScroll.Top,
    4186     Canvas, lprcScroll.Left, lprcScroll.Top, SRCCOPY);
     4186    Canvas, lprcScroll.Left, lprcScroll.Top);
    41874187end;
    41884188{$ENDIF}
     
    43294329procedure TMainScreen.CopyMiniToPanel;
    43304330begin
    4331   BitBlt(Panel.Canvas.Handle, xMini + 2, yMini + 2, G.lx * 2, G.ly,
    4332     Mini.Canvas.Handle, 0, 0, SRCCOPY);
     4331  BitBltCanvas(Panel.Canvas, xMini + 2, yMini + 2, G.lx * 2, G.ly,
     4332    Mini.Canvas, 0, 0);
    43334333  if MarkCityLoc >= 0 then
    43344334    Sprite(Panel, HGrSystem, xMini - 2 + (4 * G.lx + 2 * (MarkCityLoc mod G.lx)
     
    44184418          ClientWidth - xPalace + xSizeBig + 1, yPalace + ySizeBig + 1,
    44194419          $FFFFFF, $B0B0B0);
    4420         BitBlt(Panel.Canvas.Handle, ClientWidth - xPalace, yPalace, xSizeBig,
    4421           ySizeBig, GrExt[HGrSystem2].Data.Canvas.Handle, 70, 123, SRCCOPY);
     4420        BitBltCanvas(Panel.Canvas, ClientWidth - xPalace, yPalace, xSizeBig,
     4421          ySizeBig, GrExt[HGrSystem2].Data.Canvas, 70, 123);
    44224422      end
    44234423      else if MyRO.NatBuilt[imPalace] > 0 then
     
    52765276      PaintLoc(MouseLoc, 2);
    52775277      MiniPaint;
    5278       BitBlt(Panel.Canvas.Handle, xMini + 2, yMini + 2, G.lx * 2, G.ly,
    5279         Mini.Canvas.Handle, 0, 0, SRCCOPY);
     5278      BitBltCanvas(Panel.Canvas, xMini + 2, yMini + 2, G.lx * 2, G.ly,
     5279        Mini.Canvas, 0, 0);
    52805280      if ywmax <= 0 then
    52815281        Frame(Panel.Canvas, xMini + 2 + G.lx - MapWidth div (2 * xxt),
     
    61006100    for Step := 0 to abs(Step1 - Step0) do
    61016101    begin
    6102       BitBlt(Buffer.Canvas.Handle, 0, 0, xRange, yRange,
    6103         offscreen.Canvas.Handle, xMin, yMin, SRCCOPY);
     6102      BitBltCanvas(Buffer.Canvas, 0, 0, xRange, yRange,
     6103        offscreen.Canvas, xMin, yMin);
    61046104      if Step1 <> Step0 then
    61056105      begin
     
    61426142  if Restore then
    61436143  begin
    6144     BitBlt(Buffer.Canvas.Handle, 0, 0, xRange, yRange, offscreen.Canvas.Handle,
    6145       xMin, yMin, SRCCOPY);
     6144    BitBltCanvas(Buffer.Canvas, 0, 0, xRange, yRange, offscreen.Canvas, xMin, yMin);
    61466145    PaintBufferToScreen(xMin, yMin, xRange, yRange);
    61476146  end;
     
    75587557          yw := ywmax;
    75597558      end;
    7560       BitBlt(Buffer.Canvas.Handle, 0, 0, G.lx * 2, G.ly, Mini.Canvas.Handle, 0,
    7561         0, SRCCOPY);
     7559      BitBltCanvas(Buffer.Canvas, 0, 0, G.lx * 2, G.ly, Mini.Canvas, 0, 0);
    75627560      if ywmax <= 0 then
    75637561        Frame(Buffer.Canvas, x - xMini - 2 - MapWidth div (xxt * 2), 0,
     
    75687566          x - xMini - 2 + MapWidth div (xxt * 2) - 1, yw + MapHeight div yyt -
    75697567          2, MainTexture.clMark, MainTexture.clMark);
    7570       BitBlt(Panel.Canvas.Handle, xMini + 2, yMini + 2, G.lx * 2, G.ly,
    7571         Buffer.Canvas.Handle, 0, 0, SRCCOPY);
     7568      BitBltCanvas(Panel.Canvas, xMini + 2, yMini + 2, G.lx * 2, G.ly,
     7569        Buffer.Canvas, 0, 0);
    75727570      MainOffscreenPaint;
    75737571      RectInvalidate(xMini + 2, TopBarHeight + MapHeight - overlap + yMini + 2,
     
    75787576  end
    75797577  else
    7580     Tracking := false
     7578    Tracking := false;
    75817579end;
    75827580
     
    77207718      Brush.Style := bsClear;
    77217719    end;
    7722   BitBlt(Canvas.Handle, MapOffset, TopBarHeight, MapWidth, MapHeight - overlap,
    7723     offscreen.Canvas.Handle, 0, 0, SRCCOPY);
    7724   BitBlt(Canvas.Handle, 0, 0, ClientWidth, TopBarHeight, TopBar.Canvas.Handle,
    7725     0, 0, SRCCOPY);
     7720  BitBltCanvas(Canvas, MapOffset, TopBarHeight, MapWidth, MapHeight - overlap,
     7721    offscreen.Canvas, 0, 0);
     7722  BitBltCanvas(Canvas, 0, 0, ClientWidth, TopBarHeight, TopBar.Canvas,
     7723    0, 0);
    77267724  if xMidPanel > MapOffset then
    7727     BitBlt(Canvas.Handle, xMidPanel, TopBarHeight + MapHeight - overlap,
    7728       ClientWidth div 2 - xMidPanel, overlap, offscreen.Canvas.Handle,
    7729       xMidPanel - MapOffset, MapHeight - overlap, SRCCOPY)
     7725    BitBltCanvas(Canvas, xMidPanel, TopBarHeight + MapHeight - overlap,
     7726      ClientWidth div 2 - xMidPanel, overlap, offscreen.Canvas,
     7727      xMidPanel - MapOffset, MapHeight - overlap)
    77307728  else
    7731     BitBlt(Canvas.Handle, MapOffset, TopBarHeight + MapHeight - overlap,
    7732       ClientWidth div 2 - MapOffset, overlap, offscreen.Canvas.Handle, 0,
    7733       MapHeight - overlap, SRCCOPY);
     7729    BitBltCanvas(Canvas, MapOffset, TopBarHeight + MapHeight - overlap,
     7730      ClientWidth div 2 - MapOffset, overlap, offscreen.Canvas, 0,
     7731      MapHeight - overlap);
    77347732  if xRightPanel < MapOffset + MapWidth then
    7735     BitBlt(Canvas.Handle, ClientWidth div 2, TopBarHeight + MapHeight - overlap,
    7736       xRightPanel - ClientWidth div 2, overlap, offscreen.Canvas.Handle,
    7737       ClientWidth div 2 - MapOffset, MapHeight - overlap, SRCCOPY)
     7733    BitBltCanvas(Canvas, ClientWidth div 2, TopBarHeight + MapHeight - overlap,
     7734      xRightPanel - ClientWidth div 2, overlap, offscreen.Canvas,
     7735      ClientWidth div 2 - MapOffset, MapHeight - overlap)
    77387736  else
    7739     BitBlt(Canvas.Handle, ClientWidth div 2, TopBarHeight + MapHeight - overlap,
     7737    BitBltCanvas(Canvas, ClientWidth div 2, TopBarHeight + MapHeight - overlap,
    77407738      MapOffset + MapWidth - ClientWidth div 2, overlap,
    7741       offscreen.Canvas.Handle, ClientWidth div 2 - MapOffset,
    7742       MapHeight - overlap, SRCCOPY);
    7743   BitBlt(Canvas.Handle, 0, TopBarHeight + MapHeight - overlap, xMidPanel,
    7744     overlap, Panel.Canvas.Handle, 0, 0, SRCCOPY);
    7745   BitBlt(Canvas.Handle, xRightPanel, TopBarHeight + MapHeight - overlap,
    7746     Panel.width - xRightPanel, overlap, Panel.Canvas.Handle, xRightPanel,
    7747     0, SRCCOPY);
    7748   BitBlt(Canvas.Handle, 0, TopBarHeight + MapHeight, Panel.width,
    7749     PanelHeight - overlap, Panel.Canvas.Handle, 0, overlap, SRCCOPY);
     7739      offscreen.Canvas, ClientWidth div 2 - MapOffset,
     7740      MapHeight - overlap);
     7741  BitBltCanvas(Canvas, 0, TopBarHeight + MapHeight - overlap, xMidPanel,
     7742    overlap, Panel.Canvas, 0, 0);
     7743  BitBltCanvas(Canvas, xRightPanel, TopBarHeight + MapHeight - overlap,
     7744    Panel.width - xRightPanel, overlap, Panel.Canvas, xRightPanel, 0);
     7745  BitBltCanvas(Canvas, 0, TopBarHeight + MapHeight, Panel.width,
     7746    PanelHeight - overlap, Panel.Canvas, 0, overlap);
    77507747  if (pLogo >= 0) and (G.RO[pLogo] = nil) and (AILogo[pLogo] <> nil) then
    7751     BitBlt(Canvas.Handle, xRightPanel + 10 - (16 + 64),
    7752       ClientHeight - PanelHeight, 64, 64, AILogo[pLogo].Canvas.Handle, 0,
    7753       0, SRCCOPY);
     7748    BitBltCanvas(Canvas, xRightPanel + 10 - (16 + 64),
     7749      ClientHeight - PanelHeight, 64, 64, AILogo[pLogo].Canvas, 0, 0);
    77547750end;
    77557751
Note: See TracChangeset for help on using the changeset viewer.