Browse Source

* perform clipping in assembly in the PutPixel320 asm routine

git-svn-id: trunk@40919 -
nickysn 6 years ago
parent
commit
08a86b6b9f
1 changed files with 14 additions and 9 deletions
  1. 14 9
      packages/graph/src/msdos/graph.pp

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

@@ -2238,16 +2238,7 @@ End;
   end;
   end;
 {$else asmgraph}
 {$else asmgraph}
  Procedure PutPixel320(X,Y : smallint; Pixel: ColorType);
  Procedure PutPixel320(X,Y : smallint; Pixel: ColorType);
- { x,y -> must be in local coordinates. Clipping if required. }
   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
 {$ifdef FPC_MM_HUGE}
 {$ifdef FPC_MM_HUGE}
       mov    ax, SEG SegA000
       mov    ax, SEG SegA000
@@ -2258,6 +2249,19 @@ End;
 {$endif FPC_MM_HUGE}
 {$endif FPC_MM_HUGE}
       mov    ax, [Y]
       mov    ax, [Y]
       mov    di, [X]
       mov    di, [X]
+      cmp    byte ptr [ClipPixels], 0
+      je     @@ClipDone
+
+      test   ax, ax
+      js     @@Done
+      test   di, di
+      js     @@Done
+      cmp    ax, [ViewHeight]
+      jg     @@Done
+      cmp    di, [ViewWidth]
+      jg     @@Done
+
+@@ClipDone:
       add    ax, [StartYViewPort]
       add    ax, [StartYViewPort]
       add    di, [StartXViewPort]
       add    di, [StartXViewPort]
       xchg   ah, al            { The value of Y must be in AH }
       xchg   ah, al            { The value of Y must be in AH }
@@ -2267,6 +2271,7 @@ End;
       add    di, ax
       add    di, ax
       mov    ax, [Pixel]
       mov    ax, [Pixel]
       mov    es:[di], al
       mov    es:[di], al
+@@Done:
     end ['ax','di'];
     end ['ax','di'];
  end;
  end;
 {$endif asmgraph}
 {$endif asmgraph}