浏览代码

change filter.smooth implementation, added filter-smooth to domkit

Nicolas Cannasse 1 年之前
父节点
当前提交
09115bd240
共有 5 个文件被更改,包括 8 次插入5 次删除
  1. 1 0
      h2d/Object.hx
  2. 5 0
      h2d/domkit/BaseComponents.hx
  3. 0 1
      h2d/filter/Blur.hx
  4. 2 3
      h2d/filter/Filter.hx
  5. 0 1
      h2d/filter/Outline.hx

+ 1 - 0
h2d/Object.hx

@@ -691,6 +691,7 @@ class Object #if (domkit && !domkit_heaps) implements domkit.Model<h2d.Object> #
 	function emitTile( ctx : RenderContext, tile : h2d.Tile ) {
 		if( nullDrawable == null )
 			nullDrawable = @:privateAccess new h2d.Drawable(null);
+		nullDrawable.smooth = filter != null && filter.smooth ? true : null;
 		if( !ctx.hasBuffering() ) {
 			nullDrawable.absX = absX;
 			nullDrawable.absY = absY;

+ 5 - 0
h2d/domkit/BaseComponents.hx

@@ -401,6 +401,7 @@ class ObjectComp implements h2d.domkit.Object implements domkit.Component.Compon
 	@:p var scaleY : Float;
 	@:p var blend : h2d.BlendMode = Alpha;
 	@:p(filter) var filter : h2d.filter.Filter;
+	@:p var filterSmooth : Bool;
 
 	// flow properties
 	@:p(box) var margin : { left : Int, top : Int, right : Int, bottom : Int };
@@ -445,6 +446,10 @@ class ObjectComp implements h2d.domkit.Object implements domkit.Component.Compon
 		o.filter = f;
 	}
 
+	static function set_filterSmooth(o:h2d.Object, b:Bool) {
+		if( o.filter != null ) o.filter.smooth = b;
+	}
+
 	static function set_blend(o:h2d.Object, b:h2d.BlendMode) {
 		o.blendMode = b;
 	}

+ 0 - 1
h2d/filter/Blur.hx

@@ -36,7 +36,6 @@ class Blur extends Filter {
 	**/
 	public function new( radius = 1., gain = 1., quality = 1., linear = 0. ) {
 		super();
-		smooth = true;
 		pass = new h3d.pass.Blur(radius, gain, linear, quality);
 	}
 

+ 2 - 3
h2d/filter/Filter.hx

@@ -29,9 +29,8 @@ class Filter {
 	**/
 	public var boundsExtend : Float = 0.;
 	/**
-		When enabled, some filters will use bilinear filtering on temporary textures.
-		Does not affect the majority of filters.
-		@see `AbstractMask`
+		When enabled, filters on not Object which are not Drawable will use bilinear filtering when displayed
+		and some filter will also use bilinear filtering on intermediate textures.
 	**/
 	public var smooth = false;
 	/**

+ 0 - 1
h2d/filter/Outline.hx

@@ -41,7 +41,6 @@ class Outline extends Filter {
 	**/
 	public function new(size = 4.0, color = 0x000000, quality = 0.3, multiplyAlpha = true) {
 		super();
-		smooth = true;
 		pass = new h3d.pass.Outline(size, color, quality, multiplyAlpha);
 	}