mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-16 01:40:37 +01:00
Cocoa: Fix painting refresh bug
git-svn-id: trunk@43957 -
This commit is contained in:
parent
7653aab9b6
commit
7d53b0d01b
@ -987,27 +987,32 @@ procedure TLCLCommonCallback.Draw(ControlContext: NSGraphicsContext;
|
||||
const bounds, dirty: NSRect);
|
||||
var
|
||||
PS: PPaintStruct;
|
||||
r: TRect;
|
||||
nsr:NSRect;
|
||||
begin
|
||||
// todo: think more about draw call while previous draw still active
|
||||
if Assigned(FContext) then
|
||||
Exit;
|
||||
FContext := TCocoaContext.Create(ControlContext);
|
||||
try
|
||||
// debugln('Draw '+Target.name+' bounds='+Dbgs(NSRectToRect(bounds))+' dirty='+Dbgs(NSRectToRect(dirty)));
|
||||
if FContext.InitDraw(Round(bounds.size.width), Round(bounds.size.height)) then
|
||||
begin
|
||||
nsr:=dirty;
|
||||
nsr.origin.y:=bounds.size.height-dirty.origin.y-dirty.size.height;
|
||||
|
||||
if FIsOpaque and (Target.Color<>clDefault) then
|
||||
begin
|
||||
FContext.BkMode:=OPAQUE;
|
||||
FContext.BkColor:=Target.Color;
|
||||
FContext.BackgroundFill(dirty);
|
||||
FContext.BackgroundFill(nsr);
|
||||
//debugln('Background '+Target.name+Dbgs(NSRectToRect(dirty)));
|
||||
end;
|
||||
|
||||
New(PS);
|
||||
try
|
||||
FillChar(PS^, SizeOf(TPaintStruct), 0);
|
||||
PS^.hdc := HDC(FContext);
|
||||
PS^.rcPaint := NSRectToRect(dirty);
|
||||
PS^.rcPaint := NSRectToRect(nsr);
|
||||
LCLSendPaintMsg(Target, HDC(FContext), PS);
|
||||
if FHasCaret then
|
||||
DrawCaret;
|
||||
|
||||
@ -373,13 +373,11 @@ var
|
||||
|
||||
|
||||
R := CreateParamsToNSRect(AParams);
|
||||
R.origin.x := 0;
|
||||
R.origin.y := 0;
|
||||
cnt := TCocoaWindowContent.alloc.initWithFrame(R);
|
||||
|
||||
if (AParams.Style and WS_CHILD) = 0 then
|
||||
begin
|
||||
R := CreateParamsToNSRect(AParams);
|
||||
|
||||
win := TCocoaWindow(TCocoaWindow.alloc);
|
||||
|
||||
if not Assigned(win) then
|
||||
|
||||
Loading…
Reference in New Issue
Block a user