static void OptimizeVisualSurfaceProperties(CompositionVisualSurface obj) { // Unset properties that are set to their default values. if (obj.SourceOffset == Vector2.Zero) { obj.SourceOffset = null; } if (obj.SourceSize == Vector2.Zero) { obj.SourceSize = null; } }
CompositionVisualSurface GetCompositionVisualSurface(CompositionVisualSurface obj) { if (GetExisting(obj, out CompositionVisualSurface result)) { return(result); } result = CacheAndInitializeCompositionObject(obj, _c.CreateVisualSurface()); if (obj.SourceVisual != null) { result.SourceVisual = GetVisual(obj.SourceVisual); } result.SourceSize = obj.SourceSize; result.SourceOffset = obj.SourceOffset; StartAnimationsAndFreeze(obj, result); return(result); }