Changeset 41


Ignore:
Timestamp:
Jan 9, 2017, 9:41:20 PM (7 years ago)
Author:
chronos
Message:

Fixed: Problem with reading Form canvas during OnPaint event using BitBlt. Chnaged to read using StreatchDraw as workaround.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/MessgEx.pas

    r38 r41  
    298298
    299299  // paint
    300   BitBlt(LogoBuffer.Canvas.Handle, 0, 0, wb, hb, ca.Handle, x, y, SRCCOPY);
     300  BitBltCanvas(LogoBuffer.Canvas, 0, 0, wb, hb, ca, x, y, SRCCOPY);
    301301
    302302  if IconIndex >= 0 then
     
    436436    mikEnemyShipComplete:
    437437      begin
    438         BitBlt(Buffer.Canvas.Handle, 0, 0, 140, 120, Canvas.Handle,
     438        BitBltCanvas(Buffer.Canvas, 0, 0, 140, 120, Canvas,
    439439          (ClientWidth - 140) div 2, 24, SRCCOPY);
    440440        ImageOp_BCC(Buffer, Templates, 0, 0, 1, 279, 140, 120, 0, $FFFFFF);
  • trunk/LocalPlayer/Select.pas

    r40 r41  
    821821        LoweredTextOut(Canvas, -1, MainTexture, xScreen + 10,
    822822          ClientHeight - 29, s);
    823         BitBlt(ScienceNationDot.Canvas.Handle, 0, 0, 17, 17, Canvas.Handle,
     823        BitBltCanvas(ScienceNationDot.Canvas, 0, 0, 17, 17, Canvas,
    824824          xScreen - 10, ClientHeight - 27, SRCCOPY);
    825825        ImageOp_BCC(ScienceNationDot, Templates, 0, 0, 114, 211, 17, 17,
  • trunk/ScreenTools.pas

    r40 r41  
    4848procedure ImageOp_CCC(bmp: TBitmap; x, y, w, h, Color0, Color1,
    4949  Color2: integer);
     50function BitBltCanvas(DestCanvas: TCanvas; X, Y, Width, Height: Integer; SrcCanvas: TCanvas;
     51  XSrc, YSrc: Integer; Rop: DWORD): Boolean;
    5052procedure SLine(ca: TCanvas; x0, x1, y: integer; cl: TColor);
    5153procedure DLine(ca: TCanvas; x0, x1, y: integer; cl0, cl1: TColor);
     
    192194
    193195uses
    194   Directories, Sound, ButtonBase, ButtonA, ButtonB,
    195 
    196   Registry;
     196  Directories, Sound, Registry;
    197197
    198198var
     
    713713    exit;
    714714
     715  Src.BeginUpdate;
    715716  dst.BeginUpdate;
    716717  for iy := 0 to h - 1 do
     
    725726      if trans <> $FF then
    726727      begin
    727         Value := (DstLine[xDst + ix][0] * trans + (Color2 shr 16 and $FF) * amp2
    728           + (Color1 shr 16 and $FF) * amp1) div $FF;
     728        Value := (DstLine[xDst + ix][0] * trans + ((Color2 shr 16) and $FF) * amp2
     729          + ((Color1 shr 16) and $FF) * amp1) div $FF;
    729730        if Value < 256 then
    730731          DstLine[xDst + ix][0] := Value
    731732        else
    732733          DstLine[xDst + ix][0] := 255;
    733         Value := (DstLine[xDst + ix][1] * trans + (Color2 shr 8 and $FF) * amp2
    734           + (Color1 shr 8 and $FF) * amp1) div $FF;
     734        Value := (DstLine[xDst + ix][1] * trans + ((Color2 shr 8) and $FF) * amp2
     735          + ((Color1 shr 8) and $FF) * amp1) div $FF;
    735736        if Value < 256 then
    736737          DstLine[xDst + ix][1] := Value
     
    746747    end
    747748  end;
     749  Src.EndUpdate;
    748750  dst.EndUpdate;
    749751end;
     
    802804  BitBlt(dst.Canvas.Handle, xDst, yDst, Width, Height,
    803805    GrExt[HGr].Data.Canvas.Handle, xGr, yGr, SRCPAINT);
     806end;
     807
     808function BitBltCanvas(DestCanvas: TCanvas; X, Y, Width, Height: Integer; SrcCanvas: TCanvas; XSrc,
     809  YSrc: Integer; Rop: DWORD): Boolean;
     810begin
     811  Assert(Rop = SRCCOPY);
     812  DestCanvas.CopyRect(Rect(X, X, Width, Height), SrcCanvas,
     813    Rect(XSrc, YSrc, XSrc + Width, YSrc + Height));
    804814end;
    805815
     
    14411451    procedure PaintLogo(ca: TCanvas; x, y, clLight, clShade: integer);
    14421452    begin
    1443       BitBlt(LogoBuffer.Canvas.Handle, 0, 0, wLogo, hLogo, ca.Handle, x,
     1453      BitBltCanvas(LogoBuffer.Canvas, 0, 0, wLogo, hLogo, ca, x,
    14441454        y, SRCCOPY);
    14451455      ImageOp_BCC(LogoBuffer, Templates, 0, 0, 1, 1, wLogo, hLogo,
  • trunk/Start.pas

    r40 r41  
    542542      TabOffset + (Tab + 1) * TabSize + 2, TabHeight, MainTexture.clBevelShade,
    543543      MainTexture.clBevelShade); // Tab shadow
    544   BitBlt(LogoBuffer.Canvas.Handle, 0, 0, 36, 36, Canvas.Handle, 6,
     544  BitBltCanvas(LogoBuffer.Canvas, 0, 0, 36, 36, Canvas, 6,
    545545    3 + 2 * integer(Tab <> 0), SRCCOPY);
     546
     547
    546548  ImageOp_BCC(LogoBuffer, Templates, 0, 0, 145, 38, 36, 27, $BFBF20, $4040DF);
    547549  // logo part 1
     
    592594                Phrases2.Lookup('ACTIONHEADER_WEB'));
    593595              Canvas.Font.Assign(UniFont[ftNormal]);
    594               BitBlt(LogoBuffer.Canvas.Handle, 0, 0, 91, 25, Canvas.Handle,
     596              BitBltCanvas(LogoBuffer.Canvas, 0, 0, 91, 25, Canvas,
    595597                xActionIcon, y + 2, SRCCOPY);
    596598              ImageOp_BCC(LogoBuffer, Templates, 0, 0, 1, 400, 91, 25, 0,
Note: See TracChangeset for help on using the changeset viewer.