Skip to content

Commit

Permalink
Fixing a regression in a validation app search box that was introduce…
Browse files Browse the repository at this point in the history
…d with the recent consolidation of the iOS Application and WinRT UI fibers. The validation app attempts to animate some visuals via flip/woosh animations early during app launch. These animations require taking a bitmap snapshot of the visuals, but some of the visuals are 0x0 in size during initial app launch. Attempting to take a bitmap snapshot of a 0x0 visual (via RenderTargetBitmap::RenderAsync) throws an exception, so the initial commit worked around this by short-circuiting the animations. Unfortunately, that fix was a bit too aggressive, and it lead to us dropping some animations that we actually need to run.

This fix is to only drop the animations that we truly can do without (we now just drop the animations on the temporary bitmaps that we can't render due to the 0x0 visual size).
  • Loading branch information
jaredhms committed May 23, 2016
1 parent a26be64 commit 86d7ab0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 26 deletions.
40 changes: 26 additions & 14 deletions Frameworks/UIKit/StarboardXaml/CALayerXaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1709,45 +1709,57 @@ void EventedStoryboard::AddTransition(CALayerXaml^ realLayer, CALayerXaml^ snaps
timeSpan.Duration = (long long)(0.75 * c_hundredNanoSeconds);
m_container->Duration = Duration(timeSpan);
Panel^ parent = (Panel^)VisualTreeHelper::GetParent(realLayer);
unsigned int idx;
parent->Children->IndexOf(realLayer, &idx);
parent->Children->InsertAt(idx + 1, snapshotLayer);
parent->InvalidateArrange();
realLayer->Opacity = 0;

bool flipToLeft = true;
if (subtype != "kCATransitionFromLeft") {
flipToLeft = false;
}

_CreateFlip(snapshotLayer, flipToLeft, false, true);
// We don't need to animate a snapshot if it doesn't exist
if (snapshotLayer) {
unsigned int idx;
parent->Children->IndexOf(realLayer, &idx);
parent->Children->InsertAt(idx + 1, snapshotLayer);
parent->InvalidateArrange();
realLayer->Opacity = 0;
_CreateFlip(snapshotLayer, flipToLeft, false, true);
}

_CreateFlip(realLayer, flipToLeft, true, false);
}
else {
TimeSpan timeSpan = TimeSpan();
timeSpan.Duration = (long long)(0.5 * c_hundredNanoSeconds);
m_container->Duration = Duration(timeSpan);
Panel^ parent = (Panel^)VisualTreeHelper::GetParent(realLayer);
unsigned int idx;
parent->Children->IndexOf(realLayer, &idx);

bool fromRight = true;
if (subtype == "kCATransitionFromLeft") {
fromRight = false;
}

if (fromRight) {
parent->Children->InsertAt(idx, snapshotLayer);
parent->InvalidateArrange();
// We don't need to animate a snapshot if it doesn't exist
if (snapshotLayer) {
unsigned int idx;
parent->Children->IndexOf(realLayer, &idx);
parent->Children->InsertAt(idx, snapshotLayer);
parent->InvalidateArrange();
_CreateWoosh(snapshotLayer, fromRight, true, true);
}

_CreateWoosh(snapshotLayer, fromRight, true, true);
_CreateWoosh(realLayer, fromRight, false, false);
}
else {
parent->Children->InsertAt(idx + 1, snapshotLayer);
parent->InvalidateArrange();
// We don't need to animate a snapshot if it doesn't exist
if (snapshotLayer) {
unsigned int idx;
parent->Children->IndexOf(realLayer, &idx);
parent->Children->InsertAt(idx + 1, snapshotLayer);
parent->InvalidateArrange();
_CreateWoosh(snapshotLayer, fromRight, false, true);
}

_CreateWoosh(snapshotLayer, fromRight, false, true);
_CreateWoosh(realLayer, fromRight, true, false);
}
}
Expand Down
22 changes: 10 additions & 12 deletions Frameworks/UIKit/StarboardXaml/XamlCompositor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,14 @@ concurrency::task<void> DisplayAnimation::AddTransitionAnimation(DisplayNode* no
return xamlAnimation->SnapshotLayer(xamlNode)
.then([this, xamlAnimation, xamlNode, wtype, wsubtype](XamlCompositor::Controls::CALayerXaml^ snapshotLayer) {

if (snapshotLayer != nullptr) {
xamlAnimation->AddTransition(
xamlNode,
snapshotLayer,
ref new Platform::String(wtype.data()),
ref new Platform::String(wsubtype.data()));

Start();
}
}, concurrency::task_continuation_context::use_current());
xamlAnimation->AddTransition(
xamlNode,
snapshotLayer,
ref new Platform::String(wtype.data()),
ref new Platform::String(wsubtype.data()));

Start();
} , concurrency::task_continuation_context::use_current());
}

void DisplayNode::AddToRoot() {
Expand Down Expand Up @@ -669,9 +667,9 @@ void DispatchCompositorTransactions(
// Walk and process the map of queued properties per DisplayNode and the list of node movements as a single distinct task
s_compositorTransactions = s_compositorTransactions
.then([movementTransactions = std::move(movementTransactions),
propertyTransactions = std::move(propertyTransactions)]() noexcept {
propertyTransactions = std::move(propertyTransactions)]() noexcept {
for (auto& nodeMovement : movementTransactions) {
nodeMovement->Process();
nodeMovement->Process();
}

for (auto& nodeProperties : propertyTransactions) {
Expand Down

0 comments on commit 86d7ab0

Please sign in to comment.