Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions AddShapeEffect/AddShapeEffectProcessor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Immutable;
using System.Collections.Immutable;
using System.Numerics;
using AddShapeEffect.ForVideoEffectChain;
using Vortice.Direct2D1;
Expand Down Expand Up @@ -73,7 +73,6 @@ public DrawDescription Update(EffectDescription effectDescription)
DrawDescription descAfterChain = effectDescription.DrawDescription;

if (currentInput == null) return effectDescription.DrawDescription;

{
var shapeParameter = item.ShapeParameter;
if (isFirst || this.shapeParameter != shapeParameter)
Expand Down Expand Up @@ -129,8 +128,8 @@ public DrawDescription Update(EffectDescription effectDescription)
float baseL = x - baseHalfWidth;
float baseR = x + baseHalfWidth;

float targetL = item.PinLeft ? (-inputWidth / 2f + leftMargin) : baseL;
float targetR = item.PinRight ? (inputWidth / 2f - rightMargin) : baseR;
float targetL = item.PinLeft ? ((-inputWidth / 2f) + leftMargin) : baseL;
float targetR = item.PinRight ? ((inputWidth / 2f) - rightMargin) : baseR;

float finalWidth = targetR - targetL;
float finalScaleX = (shapeWidth > 0) ? (finalWidth / shapeWidth) : 0;
Expand All @@ -140,8 +139,8 @@ public DrawDescription Update(EffectDescription effectDescription)
float baseT = y - baseHalfHeight;
float baseB = y + baseHalfHeight;

float targetT = item.PinTop ? (-inputHeight / 2f + topMargin) : baseT;
float targetB = item.PinBottom ? (inputHeight / 2f - bottomMargin) : baseB;
float targetT = item.PinTop ? ((-inputHeight / 2f) + topMargin) : baseT;
float targetB = item.PinBottom ? ((inputHeight / 2f) - bottomMargin) : baseB;

float finalHeight = targetB - targetT;
float finalScaleY = (shapeHeight > 0) ? (finalHeight / shapeHeight) : 0;
Expand Down