mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-26 16:33:45 +01:00 
			
		
		
		
	* ClearViewPort was wrong ,and is now 75% faster
* Some clipping added by replacing DirectPutPixel -> PutPixel
This commit is contained in:
		
							parent
							
								
									28f657b4db
								
							
						
					
					
						commit
						a6a9da360d
					
				| @ -619,7 +619,6 @@ const | |||||||
|      ($80,$40,$20,$10,$08,$04,$02,$01); |      ($80,$40,$20,$10,$08,$04,$02,$01); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|   MaxModes = 13; |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     { pre expanded line patterns } |     { pre expanded line patterns } | ||||||
| @ -1403,19 +1402,30 @@ var | |||||||
| 
 | 
 | ||||||
| Procedure ClearViewPortDefault; | Procedure ClearViewPortDefault; | ||||||
| var | var | ||||||
|  i,j: integer; |  j: integer; | ||||||
|  MaxWidth, MaxHeight: Integer; |  OldWriteMode, OldCurColor: word; | ||||||
|  |  LineSets : LineSettingsType; | ||||||
| Begin | Begin | ||||||
|   { CP is always RELATIVE coordinates } |   { CP is always RELATIVE coordinates } | ||||||
|   CurrentX := 0; |   CurrentX := 0; | ||||||
|   CurrentY := 0; |   CurrentY := 0; | ||||||
|   MaxWidth  := StartXViewPort + ViewWidth; | 
 | ||||||
|   MaxHeight := StartYViewPort + ViewHeight; |   { Save all old settings } | ||||||
|   for J:=StartYViewPort to MaxHeight do |   OldCurColor := CurrentColor; | ||||||
|    Begin |   CurrentColor:=CurrentBkColor; | ||||||
|      for i:=StartXViewPort to MaxWidth do |   OldWriteMode:=CurrentWriteMode; | ||||||
|        PutPixel(I,J,CurrentBkColor); |   GetLineSettings(LineSets); | ||||||
|    end; |   { reset to normal line style...} | ||||||
|  |   SetLineStyle(SolidLn, 0, NormWidth); | ||||||
|  | 
 | ||||||
|  |   { routines are relative here...} | ||||||
|  |   for J:=0 to ViewHeight do | ||||||
|  |        HLine(0, ViewWidth, J); | ||||||
|  | 
 | ||||||
|  |   { restore old settings...} | ||||||
|  |   SetLineStyle(LineSets.LineStyle, LineSets.Pattern, LineSets.Thickness); | ||||||
|  |   CurrentColor := OldCurColor; | ||||||
|  |   CurrentWriteMode := OldWriteMode; | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -1696,10 +1706,10 @@ end; | |||||||
| 
 | 
 | ||||||
|      if (Radius = 1) then |      if (Radius = 1) then | ||||||
|        begin |        begin | ||||||
| 	  OldWriteMode:=CurrentWriteMode; |          { must use clipping ... } | ||||||
| 	  CurrentWriteMode := NormalPut; |          { don't need to explicitly set NormalPut mode } | ||||||
| 	  DirectPutPixel(X, Y); |          { because PutPixel only supports normal put   } | ||||||
| 	  CurrentWriteMode := OldWriteMode; | 	     PutPixel(X, Y,CurrentColor); | ||||||
| 	     Exit; | 	     Exit; | ||||||
|        end; |        end; | ||||||
| 
 | 
 | ||||||
| @ -1767,10 +1777,8 @@ end; | |||||||
| 
 | 
 | ||||||
|      if (Radius = 1) then |      if (Radius = 1) then | ||||||
|      begin |      begin | ||||||
| 	  OldWriteMode := CurrentWriteMode; |       { only normal put mode is supported by a call to PutPixel } | ||||||
| 	  CurrentWriteMode := NormalPut; | 	  PutPixel(X, Y, CurrentColor); | ||||||
| 	  DirectPutPixel(X, Y); |  | ||||||
| 	  CurrentWriteMode := OldWriteMode; |  | ||||||
| 	  Exit; | 	  Exit; | ||||||
|      end; |      end; | ||||||
| 
 | 
 | ||||||
| @ -1803,9 +1811,11 @@ end; | |||||||
|      Currentwritemode:=normalput; |      Currentwritemode:=normalput; | ||||||
|      Line(ArcCall.XStart, ArcCall.YStart, x,y); |      Line(ArcCall.XStart, ArcCall.YStart, x,y); | ||||||
|      Line(x,y,ArcCall.Xend,ArcCall.YEnd); |      Line(x,y,ArcCall.Xend,ArcCall.YEnd); | ||||||
|      DirectPutPixel(ArcCall.xstart,ArcCall.ystart); |      { we must take care of clipping so we call PutPixel instead } | ||||||
|      DirectPutPixel(x,y); |      { of DirectPutPixel...                                      } | ||||||
|      DirectPutPixel(ArcCall.xend,ArcCall.yend); |      PutPixel(ArcCall.xstart,ArcCall.ystart,CurrentColor); | ||||||
|  |      PutPixel(x,y,CurrentColor); | ||||||
|  |      PutPixel(ArcCall.xend,ArcCall.yend,CurrentColor); | ||||||
|      stangle:=Stangle mod 360; EndAngle:=Endangle mod 360; |      stangle:=Stangle mod 360; EndAngle:=Endangle mod 360; | ||||||
|      if stAngle<=Endangle then |      if stAngle<=Endangle then | ||||||
|        Angle:=(stAngle+EndAngle)/2 |        Angle:=(stAngle+EndAngle)/2 | ||||||
| @ -1888,12 +1898,14 @@ end; | |||||||
|      Lineinfo.thickness:=normwidth; |      Lineinfo.thickness:=normwidth; | ||||||
| 
 | 
 | ||||||
|      case Fillsettings.pattern of |      case Fillsettings.pattern of | ||||||
|      EmptyFill : begin |      EmptyFill : | ||||||
|  |            begin | ||||||
| 		     Currentcolor:=CurrentBkColor; | 		     Currentcolor:=CurrentBkColor; | ||||||
| 		     for y:=y1 to y2 do | 		     for y:=y1 to y2 do | ||||||
| 		       Hline(x1,x2,y); | 		       Hline(x1,x2,y); | ||||||
| 		   end; | 		   end; | ||||||
|      SolidFill :  begin |      SolidFill : | ||||||
|  |            begin | ||||||
| 		     CurrentColor:=FillSettings.color; | 		     CurrentColor:=FillSettings.color; | ||||||
| 		     for y:=y1 to y2 do | 		     for y:=y1 to y2 do | ||||||
| 		       Hline(x1,x2,y); | 		       Hline(x1,x2,y); | ||||||
| @ -2203,9 +2215,11 @@ end; | |||||||
|      Arc(x,y,StAngle,EndAngle,Radius); |      Arc(x,y,StAngle,EndAngle,Radius); | ||||||
|      Line(ArcCall.XStart, ArcCall.YStart, x,y); |      Line(ArcCall.XStart, ArcCall.YStart, x,y); | ||||||
|      Line(x,y, ArcCall.XEnd, ArcCall.YEnd); |      Line(x,y, ArcCall.XEnd, ArcCall.YEnd); | ||||||
|      DirectPutPixel(ArcCall.xstart,ArcCall.ystart); |      { must use PutPixel() instead of DirectPutPixel because we need } | ||||||
|      DirectPutPixel(x,y); |      { clipping...                                                   } | ||||||
|      DirectPutPixel(ArcCall.xend,ArcCall.yend); |      PutPixel(ArcCall.xstart,ArcCall.ystart,CurrentColor); | ||||||
|  |      PutPixel(x,y,CurrentColor); | ||||||
|  |      PutPixel(ArcCall.xend,ArcCall.yend,CurrentColor); | ||||||
|      Stangle:=stAngle mod 360; EndAngle:=Endangle mod 360; |      Stangle:=stAngle mod 360; EndAngle:=Endangle mod 360; | ||||||
|      if Stangle<=Endangle then |      if Stangle<=Endangle then | ||||||
|        angle:=(StAngle+EndAngle)/2 |        angle:=(StAngle+EndAngle)/2 | ||||||
| @ -2322,14 +2336,6 @@ SetRGBPalette | |||||||
| SetVisualPage | SetVisualPage | ||||||
| DetectGraph | DetectGraph | ||||||
| 
 | 
 | ||||||
| { These routine must be hooked for every new platform:  } |  | ||||||
| {                                                       } |  | ||||||
| {   InitGraph()                                         } |  | ||||||
| {   PutPixel()                                          } |  | ||||||
| {   DirectPutPixel()                                    } |  | ||||||
| {   GetPixel()                                          } |  | ||||||
| {   CloseGraph()                                        } |  | ||||||
| 
 |  | ||||||
| {   DetectGraph()                                       } | {   DetectGraph()                                       } | ||||||
| {   GetPalette()                                        } | {   GetPalette()                                        } | ||||||
| {   SetAllPalette()                                     } | {   SetAllPalette()                                     } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 carl
						carl