mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 15:49:16 +02:00
* avoid extra locking/unlocking for updatescreen (must now always be
called while the graphdrawing lock is held) git-svn-id: trunk@7715 -
This commit is contained in:
parent
c1640b078b
commit
d1c597aa71
@ -368,27 +368,18 @@ procedure UpdateScreen;
|
|||||||
var
|
var
|
||||||
event : EventRef;
|
event : EventRef;
|
||||||
begin
|
begin
|
||||||
EnterCriticalSection(graphdrawing);
|
|
||||||
if (updatepending) then
|
if (updatepending) then
|
||||||
begin
|
|
||||||
LeaveCriticalSection(graphdrawing);
|
|
||||||
exit;
|
exit;
|
||||||
end;
|
|
||||||
|
|
||||||
if (CreateEvent(nil, kEventClassFPCGraph, kEventFlush, GetCurrentEventTime(), 0, event) <> noErr) then
|
if (CreateEvent(nil, kEventClassFPCGraph, kEventFlush, GetCurrentEventTime(), 0, event) <> noErr) then
|
||||||
begin
|
|
||||||
LeaveCriticalSection(graphdrawing);
|
|
||||||
exit;
|
exit;
|
||||||
end;
|
|
||||||
|
|
||||||
if (PostEventToQueue(MainEventQueue,event,kEventPriorityLow) <> noErr) then
|
if (PostEventToQueue(MainEventQueue,event,kEventPriorityLow) <> noErr) then
|
||||||
begin
|
begin
|
||||||
LeaveCriticalSection(graphdrawing);
|
|
||||||
ReleaseEvent(event);
|
ReleaseEvent(event);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
updatepending:=true;
|
updatepending:=true;
|
||||||
LeaveCriticalSection(graphdrawing);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -507,8 +498,8 @@ begin
|
|||||||
// writeln('direct: (',x,',',y,') := ',color);
|
// writeln('direct: (',x,',',y,') := ',color);
|
||||||
EnterCriticalSection(graphdrawing);
|
EnterCriticalSection(graphdrawing);
|
||||||
CGContextStrokeRect(offscreen,CGRectMake(x-0.5,y-0.5,0.5,0.5));
|
CGContextStrokeRect(offscreen,CGRectMake(x-0.5,y-0.5,0.5,0.5));
|
||||||
LeaveCriticalSection(graphdrawing);
|
|
||||||
UpdateScreen;
|
UpdateScreen;
|
||||||
|
LeaveCriticalSection(graphdrawing);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure q_putpixelproc(X,Y: smallint; Color: Word);
|
procedure q_putpixelproc(X,Y: smallint; Color: Word);
|
||||||
@ -519,8 +510,8 @@ begin
|
|||||||
// writeln('regular: (',x,',',y,') := ',color);
|
// writeln('regular: (',x,',',y,') := ',color);
|
||||||
EnterCriticalSection(graphdrawing);
|
EnterCriticalSection(graphdrawing);
|
||||||
CGContextStrokeRect(offscreen,CGRectMake(x-0.5,y-0.5,0.5,0.5));
|
CGContextStrokeRect(offscreen,CGRectMake(x-0.5,y-0.5,0.5,0.5));
|
||||||
LeaveCriticalSection(graphdrawing);
|
|
||||||
UpdateScreen;
|
UpdateScreen;
|
||||||
|
LeaveCriticalSection(graphdrawing);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function q_getpixelproc (X,Y: smallint): word;
|
function q_getpixelproc (X,Y: smallint): word;
|
||||||
@ -569,8 +560,8 @@ begin
|
|||||||
q_SetColor(CurrentBkColor);
|
q_SetColor(CurrentBkColor);
|
||||||
EnterCriticalSection(graphdrawing);
|
EnterCriticalSection(graphdrawing);
|
||||||
CGContextFillRect(offscreen,CGRectMake(StartXViewPort,StartYViewPort,ViewWidth,ViewHeight));
|
CGContextFillRect(offscreen,CGRectMake(StartXViewPort,StartYViewPort,ViewWidth,ViewHeight));
|
||||||
LeaveCriticalSection(graphdrawing);
|
|
||||||
UpdateScreen;
|
UpdateScreen;
|
||||||
|
LeaveCriticalSection(graphdrawing);
|
||||||
{ reset coordinates }
|
{ reset coordinates }
|
||||||
CurrentX := 0;
|
CurrentX := 0;
|
||||||
CurrentY := 0;
|
CurrentY := 0;
|
||||||
@ -632,8 +623,8 @@ begin
|
|||||||
CGContextAddLineToPoint(offscreen,x2,y2);
|
CGContextAddLineToPoint(offscreen,x2,y2);
|
||||||
CGContextClosePath(offscreen);
|
CGContextClosePath(offscreen);
|
||||||
CGContextStrokePath(offscreen);
|
CGContextStrokePath(offscreen);
|
||||||
LeaveCriticalSection(graphdrawing);
|
|
||||||
UpdateScreen;
|
UpdateScreen;
|
||||||
|
LeaveCriticalSection(graphdrawing);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -668,8 +659,8 @@ begin
|
|||||||
CGContextAddLineToPoint(offscreen,x2,y2);
|
CGContextAddLineToPoint(offscreen,x2,y2);
|
||||||
CGContextClosePath(offscreen);
|
CGContextClosePath(offscreen);
|
||||||
CGContextStrokePath(offscreen);
|
CGContextStrokePath(offscreen);
|
||||||
LeaveCriticalSection(graphdrawing);
|
|
||||||
UpdateScreen;
|
UpdateScreen;
|
||||||
|
LeaveCriticalSection(graphdrawing);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user