Browse Source

* implement the clipping in assembly instead of pascal in PutPixel16

git-svn-id: trunk@41003 -
nickysn 6 years ago
parent
commit
1533f1e218
1 changed files with 14 additions and 8 deletions
  1. 14 8
      packages/graph/src/msdos/graph.pp

+ 14 - 8
packages/graph/src/msdos/graph.pp

@@ -1589,17 +1589,22 @@ end;
 {$else asmgraph}
 {$else asmgraph}
  Procedure PutPixel16(X,Y : smallint; Pixel: ColorType);
  Procedure PutPixel16(X,Y : smallint; Pixel: ColorType);
   Begin
   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
       asm
         mov  si, [X]
         mov  si, [X]
         mov  bx, [Y]
         mov  bx, [Y]
+        cmp  byte ptr [ClipPixels], 0
+        je   @@ClipDone
+
+        test si, si
+        js   @@Done
+        test bx, bx
+        js   @@Done
+        cmp  si, [ViewWidth]
+        jg   @@Done
+        cmp  bx, [ViewHeight]
+        jg   @@Done
+
+@@ClipDone:
         add  si, [StartXViewPort]
         add  si, [StartXViewPort]
         add  bx, [StartYViewPort]
         add  bx, [StartYViewPort]
 {$ifdef FPC_MM_HUGE}
 {$ifdef FPC_MM_HUGE}
@@ -1648,6 +1653,7 @@ end;
         { restore enable set/reset register }
         { restore enable set/reset register }
         mov  ax,0001h
         mov  ax,0001h
         out  dx,ax
         out  dx,ax
+@@Done:
       end ['AX','BX','CX','DX','SI','DI'];
       end ['AX','BX','CX','DX','SI','DI'];
    end;
    end;
 {$endif asmgraph}
 {$endif asmgraph}