public static LayoutRoundingStatus GetLayoutRoundingStatus(SceneElement element) { if (!LayoutRoundingHelper.ShouldConsiderLayoutRoundingAdjustment(element)) { return(LayoutRoundingStatus.Off); } IProperty property = LayoutRoundingHelper.ResolveUseLayoutRoundingProperty((SceneNode)element); if (property == null || !LayoutRoundingHelper.GetUseLayoutRounding(element)) { return(LayoutRoundingStatus.Off); } LayoutRoundingStatus layoutRoundingStatus = LayoutRoundingStatus.On; bool flag = element.IsSet((IPropertyId)property) == PropertyState.Set; if (!flag && PlatformTypes.Path.IsAssignableFrom((ITypeId)element.Type)) { layoutRoundingStatus |= LayoutRoundingStatus.ShouldTurnOff; } else if (LayoutRoundingHelper.IsAxisAligned(element)) { layoutRoundingStatus |= LayoutRoundingStatus.ShouldSnapToPixel; } else if (!flag || LayoutRoundingHelper.GetAutoLayoutRounding(element)) { layoutRoundingStatus |= LayoutRoundingStatus.ShouldTurnOff; } return(layoutRoundingStatus); }
public static bool UpdateLayoutRounding(SceneElement element) { if (!LayoutRoundingHelper.ShouldConsiderLayoutRoundingAdjustment(element)) { return(false); } IPropertyId propertyKey = (IPropertyId)LayoutRoundingHelper.ResolveUseLayoutRoundingProperty((SceneNode)element); if (propertyKey == null) { return(false); } bool flag1 = element.IsSet(propertyKey) == PropertyState.Set; if (PlatformTypes.Path.IsAssignableFrom((ITypeId)element.Type)) { if (!flag1 && (bool)element.GetComputedValue(propertyKey)) { element.SetLocalValue(Base2DElement.UseLayoutRoundingProperty, (object)false); LayoutRoundingHelper.SetAutoLayoutRounding(element, false); return(true); } } else if (!flag1 || LayoutRoundingHelper.GetAutoLayoutRounding(element)) { bool flag2 = (bool)element.GetComputedValue(propertyKey); if (LayoutRoundingHelper.IsAxisAligned(element)) { if (!flag2) { element.ClearValue(propertyKey); LayoutRoundingHelper.SetAutoLayoutRounding(element, false); return(true); } } else if (flag2) { element.SetValue(propertyKey, (object)false); LayoutRoundingHelper.SetAutoLayoutRounding(element, true); return(true); } } return(false); }