Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve ctor performance of Drawables #1269

Merged
merged 2 commits into from
Dec 17, 2017
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions osu.Framework/Graphics/Containers/CompositeDrawable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ protected internal bool RemoveInternal(Drawable drawable)
/// </param>
protected internal void ClearInternal(bool disposeChildren = true)
{
if (internalChildren.Count == 0) return;

foreach (Drawable t in internalChildren)
{
if (t.IsAlive)
Expand Down
4 changes: 2 additions & 2 deletions osu.Framework/Graphics/Drawable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ private bool loadComplete()
MainThread = Thread.CurrentThread;
scheduler?.SetCurrentThread(MainThread);

Invalidate();
loadState = LoadState.Loaded;
Invalidate();
LoadComplete();
OnLoadComplete?.Invoke(this);
return true;
Expand Down Expand Up @@ -1454,7 +1454,7 @@ private Vector2 computeRequiredParentSizeToFit()
/// <returns>If the invalidate was actually necessary.</returns>
public virtual bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true)
{
if (invalidation == Invalidation.None)
if (invalidation == Invalidation.None || !IsLoaded)
return false;

if (shallPropagate && Parent != null && source != Parent)
Expand Down