Cocoa: Fix painting refresh bug

git-svn-id: trunk@43957 -
This commit is contained in:
freq 2014-02-08 17:52:34 +00:00
parent 7653aab9b6
commit 7d53b0d01b
2 changed files with 9 additions and 6 deletions

View File

@ -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;

View File

@ -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