From abf98cf2cd2aaa1361a654f48773c2c727a56222 Mon Sep 17 00:00:00 2001 From: nickysn Date: Thu, 24 Jan 2019 15:30:15 +0000 Subject: [PATCH] * perform the clipping in asm in PutPixelX git-svn-id: trunk@41038 - --- packages/graph/src/msdos/graph.pp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/packages/graph/src/msdos/graph.pp b/packages/graph/src/msdos/graph.pp index 47489b6f1d..d55e6d6b6e 100644 --- a/packages/graph/src/msdos/graph.pp +++ b/packages/graph/src/msdos/graph.pp @@ -2612,14 +2612,6 @@ const CrtAddress: word = 0; {$else asmgraph} Procedure PutPixelX(X,Y: smallint; color:ColorType); begin - { verify clipping and then convert to absolute coordinates...} - if ClipPixels then - begin - if (X < 0) or (X > ViewWidth) then - exit; - if (Y < 0) or (Y > ViewHeight) then - exit; - end; asm push ax push bx @@ -2629,6 +2621,20 @@ const CrtAddress: word = 0; push di mov ax, [X] mov di, [Y] ; (* DI = Y coordinate *) + + cmp byte ptr [ClipPixels], 0 + je @@ClipDone + + test ax, ax + js @@Done + test di, di + js @@Done + cmp ax, [ViewWidth] + jg @@Done + cmp di, [ViewHeight] + jg @@Done + +@@ClipDone: add di, [StartYViewPort] (* Multiply by 80 start *) mov cl, 4 @@ -2655,6 +2661,7 @@ const CrtAddress: word = 0; mov es,[SegA000] mov ax,[Color] ; { only lower byte is used. } mov es:[di], al +@@Done: pop di pop es pop dx