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

Animated WebP support #605

Merged
merged 15 commits into from
Oct 9, 2017
Merged

Animated WebP support #605

merged 15 commits into from
Oct 9, 2017

Conversation

garrettmoon
Copy link
Member

@garrettmoon garrettmoon commented Oct 7, 2017

#117.

@ghost
Copy link

ghost commented Oct 7, 2017

🚫 CI failed with log

@djblake
Copy link
Contributor

djblake commented Oct 8, 2017

@garrettmoon from my testing:

Fixed:

  • Transition behaviour now working properly again, button images are no longer being unloaded when a button is removed from the layer hierarchy.
  • No longer seeing flashing when removing an image from one parent and directly adding it to another parent.

Possible issues:

  • When moving a gif from one parent and immediately adding it to another I still see a flash (a double flash actually) as the image is presumably being unloaded when removeFromSupernode: triggers the didExitDisplayState which removes the cover image. Not sure if anything can be done about this as obviously still need the memory benefit of doing this when moving ASCellNodes outside of display range. Unfortunately displaysAsynchronously = YES seems to have no effect on the flashing like it did when the regular images had this problem. That would probably be the optimum fix for this if it worked. A hack for this is probably if I place the the gifs in a container ASDisplayNode and call removeFromSupernode: on that node instead, fooling the gifs into thinking they still belong to the same parent and never calling didExitDisplayState.

  • Not sure what can be done about this, but I can still crash (due to memory overload) that test example project I made with the 1000 gifs in a ASCollectionNode if I scroll as fast as I can to the bottom. Only happens when loading the gif through .URL =, presumably because the loading from the memory cache occurs after its already left the display range. It is worth noting however that the current master branch does not exhibit this behaviour, i.e. I can scroll as far as I can to the bottom with that and the memory stays completely level.

Other than those, all looking good!

@garrettmoon
Copy link
Member Author

Thanks for the feedback @djblake! The second issue you brought up is something I want to look at. The first is a little harder to deal with. I could make displaysAsynchronously NO work, but it probably would really mess up the performance of any transitions. I'd recommend a workaround of copying the node's layer contents before removing it and setting them after adding it back in.

@garrettmoon
Copy link
Member Author

@djblake Turns out #2 is actually a separate issue, probably only encountered more often on GIFs! Fix is here: #606

@@ -32,7 +30,9 @@ - (void)viewDidLoad {
// Do any additional setup after loading the view, typically from a nib.

ASNetworkImageNode *imageNode = [[ASNetworkImageNode alloc] init];
imageNode.URL = [NSURL URLWithString:@"https://s-media-cache-ak0.pinimg.com/originals/07/44/38/074438e7c75034df2dcf37ba1057803e.gif"];
// imageNode.URL = [NSURL URLWithString:@"https://s-media-cache-ak0.pinimg.com/originals/07/44/38/074438e7c75034df2dcf37ba1057803e.gif"];
// imageNode.URL = [NSURL URLWithString:@"https://storage.googleapis.com/downloads.webmproject.org/webp/images/dancing_banana2.lossless.webp"];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove these lines.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'll remove one and add a comment to the other one saying "uncomment to see animated webp support"?

@ghost
Copy link

ghost commented Oct 9, 2017

🚫 CI failed with log

@garrettmoon garrettmoon merged commit 4dbb644 into master Oct 9, 2017
appleguy pushed a commit that referenced this pull request Oct 10, 2017
* Updating to support animated WebP

* Fix a deadlock with display link

* Fix playhead issue.

* Fix up timing on iOS 10 and above

* Don't redraw the same frame over and over

* Clear out layer contents if we're an animated GIF on exit range

* Clear out cover image on exit of visible range

* Don't set cover image if we're no longer in display range.

* Don't clear out image if we're not an animated image

* Only set image if we're not already animating

* Get rid of changes to podfile

* Add CHANGELOG entry

* Update license

* Update PINRemoteImage

* Remove commented out lines in example
nguyenhuy pushed a commit that referenced this pull request Oct 24, 2017
…nds changes. (#431)

* [ASCollectionView] Improve performance and behavior of rotation / bounds changes.

See #430 for details.

* Edit CHANGELOG.md

* [ASDataController] Implement -relayoutAllNodesWithInvalidationBlock:, to flush the ASMainSerialQueue before -invalidateLayout is called.

* Don't set download results if no longer in preload range. (#606)

Good catch by @djblake, if you scroll fast enough, you leave images
set on the image node because didExitPreloadRange (which would have
cleared it) was already called.

* Animated WebP support (#605)

* Updating to support animated WebP

* Fix a deadlock with display link

* Fix playhead issue.

* Fix up timing on iOS 10 and above

* Don't redraw the same frame over and over

* Clear out layer contents if we're an animated GIF on exit range

* Clear out cover image on exit of visible range

* Don't set cover image if we're no longer in display range.

* Don't clear out image if we're not an animated image

* Only set image if we're not already animating

* Get rid of changes to podfile

* Add CHANGELOG entry

* Update license

* Update PINRemoteImage

* Remove commented out lines in example

* [ASDataController] Add nullable specifier to invalidationBlock for relayout of nodes.
bernieperez pushed a commit to AtomTickets/Texture that referenced this pull request Apr 25, 2018
* Updating to support animated WebP

* Fix a deadlock with display link

* Fix playhead issue.

* Fix up timing on iOS 10 and above

* Don't redraw the same frame over and over

* Clear out layer contents if we're an animated GIF on exit range

* Clear out cover image on exit of visible range

* Don't set cover image if we're no longer in display range.

* Don't clear out image if we're not an animated image

* Only set image if we're not already animating

* Get rid of changes to podfile

* Add CHANGELOG entry

* Update license

* Update PINRemoteImage

* Remove commented out lines in example
bernieperez pushed a commit to AtomTickets/Texture that referenced this pull request Apr 25, 2018
…nds changes. (TextureGroup#431)

* [ASCollectionView] Improve performance and behavior of rotation / bounds changes.

See TextureGroup#430 for details.

* Edit CHANGELOG.md

* [ASDataController] Implement -relayoutAllNodesWithInvalidationBlock:, to flush the ASMainSerialQueue before -invalidateLayout is called.

* Don't set download results if no longer in preload range. (TextureGroup#606)

Good catch by @djblake, if you scroll fast enough, you leave images
set on the image node because didExitPreloadRange (which would have
cleared it) was already called.

* Animated WebP support (TextureGroup#605)

* Updating to support animated WebP

* Fix a deadlock with display link

* Fix playhead issue.

* Fix up timing on iOS 10 and above

* Don't redraw the same frame over and over

* Clear out layer contents if we're an animated GIF on exit range

* Clear out cover image on exit of visible range

* Don't set cover image if we're no longer in display range.

* Don't clear out image if we're not an animated image

* Only set image if we're not already animating

* Get rid of changes to podfile

* Add CHANGELOG entry

* Update license

* Update PINRemoteImage

* Remove commented out lines in example

* [ASDataController] Add nullable specifier to invalidationBlock for relayout of nodes.
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.

None yet

3 participants