Skip to content

Conversation

@Thristhart
Copy link
Contributor

@Thristhart Thristhart commented Jun 20, 2019

Changes in this PR

  • Remove m_brush->Source(surface); from ReactImage::Source
  • Capture surface in a lambda passed to LoadCompleted in order to keep it from being destructed until being assigned to the ReactImageBrush

Why

As it stands, switching the source of an Image between large images causes noticeable flashes while the image loads (gif at 2x slowdown to make it more obvious):

RNW_image_switching_flashes

This is occurring because of the time it takes to load and decode these images. If the CompositionSurfaceBrush's surface is set to a LoadedImageSurface while it's still decoding, the surface is cleared. This change makes it so that the surface isn't set until the image is already decoded, so switching is smooth:

RNW_image_switching_noflashes

I'm inexperienced with both UWP and modern C++, so I'm very open to suggestions on a better way to do this.

Microsoft Reviewers: Open in CodeFlow

@Thristhart Thristhart requested a review from a team as a code owner June 20, 2019 20:35
@ghost ghost added the vnext label Jun 20, 2019
@stecrain stecrain requested a review from marlenecota June 20, 2019 20:36
@stecrain
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@marlenecota
Copy link
Contributor

}

Delete


Refers to: vnext/ReactUWP/Views/Image/ReactImage.cpp:127 in e22af0f. [](commit_id = e22af0f, deletion_comment = False)

@stecrain
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@stecrain stecrain requested a review from a team June 21, 2019 00:13
@stecrain stecrain merged commit 08aaf18 into microsoft:master Jun 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants