Changeset 41 for trunk/ScreenTools.pas


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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,
Note: See TracChangeset for help on using the changeset viewer.