ソースを参照

allow limiting the interpolation degree upon Window Draw

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@6580 8c9fc860-2736-0410-a75d-ab315db34111
eth.hunzikerp 9 年 前
コミット
35ba54edae
1 ファイル変更8 行追加6 行削除
  1. 8 6
      source/WMWindowManager.Mod

+ 8 - 6
source/WMWindowManager.Mod

@@ -493,7 +493,8 @@ TYPE
 		img* : Graphics.Image;
 		canvas* : Graphics.BufferCanvas;
 		canvasGen-: Graphics.CanvasGenerator;
-		pointerThreshold* : LONGINT;
+		pointerThreshold*, 
+		maxInterpolation* : LONGINT; (* allows limiting the interpolation degree on Draw *)
 
 		PROCEDURE &Init*(w, h : LONGINT; alpha : BOOLEAN);
 		BEGIN
@@ -501,7 +502,8 @@ TYPE
 			NEW(img);
 			IF alpha THEN Raster.Create(img, w, h, Raster.BGRA8888) ELSE Raster.Create(img, w, h, format) END;
 			SetCanvasGenerator(Graphics.GenCanvas);
-			pointerThreshold := 1; (* invisible pixels are treated as invisble *)
+			pointerThreshold := 1; (* invisible pixels are treated as invisible *)
+			maxInterpolation := Graphics.ScaleBilinear;
 		END Init;
 
 		PROCEDURE SetCanvasGenerator*(canvasGen:Graphics.CanvasGenerator);
@@ -532,10 +534,10 @@ TYPE
 				ELSE
 					IF useAlpha THEN
 						canvas.ScaleImage(img, Rectangles.MakeRect(0, 0, img.width, img.height),
-							Rectangles.MakeRect(0, 0, w, h), Graphics.ModeSrcOverDst, q)
+							Rectangles.MakeRect(0, 0, w, h), Graphics.ModeSrcOverDst, MIN( q,maxInterpolation))
 					ELSE
 						canvas.ScaleImage(img, Rectangles.MakeRect(0, 0, img.width, img.height),
-							Rectangles.MakeRect(0, 0, w, h), Graphics.ModeCopy, q)
+							Rectangles.MakeRect(0, 0, w, h), Graphics.ModeCopy, MIN(q,maxInterpolation))
 					END
 				END
 			END;
@@ -615,10 +617,10 @@ TYPE
 				ELSE
 					IF useAlpha THEN
 						canvas.ScaleImage(img, Rectangles.MakeRect(0, 0, img.width, img.height),
-							Rectangles.MakeRect(0, 0, w, h), Graphics.ModeSrcOverDst, q)
+							Rectangles.MakeRect(0, 0, w, h), Graphics.ModeSrcOverDst, MIN(q,maxInterpolation))
 					ELSE
 						canvas.ScaleImage(img, Rectangles.MakeRect(0, 0, img.width, img.height),
-							Rectangles.MakeRect(0, 0, w, h), Graphics.ModeCopy, q)
+							Rectangles.MakeRect(0, 0, w, h), Graphics.ModeCopy, MIN(q,maxInterpolation))
 					END
 				END
 			END;