73 Commits

Author SHA1 Message Date
Aaron Schubert
b586b9f34b Fix merge conflicts 2016-04-21 09:26:40 +01:00
Aaron Schubert
e2fa2f8192 [tvOS] Address comments on previous PR. 2016-04-21 09:23:47 +01:00
Aaron Schubert
06d4573b14 [tvOS] Branch out tvOS specific code into it's own categories 2016-04-21 08:59:14 +01:00
appleguy
dd4853bf3a Merge pull request #1273 from aaronschubert0/tvOS
[tvOS] Add default focus states to ASControlNode & ASImageNode.
2016-04-20 13:29:31 -07:00
Garrett Moon
0fc39d1ccd Follow up to animated GIF PR 2016-04-19 13:43:41 -07:00
Aaron Schubert
21abe8f899 Fix merge conflicts 2016-04-19 09:02:07 +01:00
appleguy
30a0c471ca Merge pull request #1528 from ejensen/instancetype
[Refactoring] Replace id with instancetype in initializers
2016-04-16 20:53:41 -07:00
Garrett Moon
1b316217ef Downstream ASAnimatedImage 2016-04-13 14:23:02 -07:00
Garrett Moon
beba9031ef Expose public properties properly
Reviewers: rmalik

Reviewed By: rmalik

Differential Revision: https://phabricator.pinadmin.com/D82227
2016-04-13 14:23:02 -07:00
Garrett Moon
3bcbfb149d Add support for animated GIFs
Summary:
Use NSData as key

Add chunking of files

Add support for Animated Images

This adds support for GIF playback in ASDK. It's not currently ready
for merging to public ASDK – for one the GIF decompression may make
more sense in PINRemoteImage.

Removed duration as it wasn't used

Make cover image lazily loaded

Differential Revision: https://phabricator.pinadmin.com/D82033
2016-04-13 14:23:02 -07:00
Eric Jensen
527397ba7e Replace id with instancetype in initializers 2016-04-13 11:20:05 -07:00
Scott Goodson
cd493358cc [ASControlNode] Upgrades to +setEnableHitTestDebug: to intersect hitTestSlop with parents' bounds+slop, to accurately predict and visualize UIKit event delivery edge cases. 2016-03-27 22:02:13 -07:00
Scott Goodson
c5c7abb1d6 [ASDisplayNode] Placeholders should always be recreated if returning to past nodes.
If previously-displayed contents is gone (e.g. clearContents), and is not finished displaying
by the time the node is onscreen, recreate the placeholder immediately.
2016-03-18 21:13:26 -07:00
Eric Jensen
33fda7ab49 - Use modern Objective-C syntax.
-  Simplify comparisons.
-  Remove dead stores.
2016-03-15 22:34:29 -07:00
Scott Goodson
21bebb9d29 [ASRangeController] Improvements to application state change and memory warning handling.
Introduces ASLayoutRangeModeVisibleOnly, allowing the preservation of decoded backing stores without any extra padding to
strictly minimize memory usage while supporting immediate re-display of content.  Set visible range controllers to this mode
upon app suspend / memory warning, while more aggressively clearing others to the ASLayoutRangeModeLowMemory mode.

By default, when the app is running and recieves a memory warning, we set the range mode for non-visible controllers to
ASLayoutRangeModeVisibleOnly.  This is because, unlike in the app suspend case where on app resume we can restore controllers
from LowMemory to VisibleOnly, the memory warning doesn't provide a good opportunity to do this.

A new +Beta API to control this behavior is called +setRangeModeForMemoryWarnings:, as some apps may prefer to use LowMemory
in the memory warning scenario.  For these apps, optimal user experience will require manually setting the range mode back
to some larger value as the user navigates the app, or they will encounter controllers that are temporarily blank and need
a moment to re-display their contents as they start to become visible.
2016-03-09 21:22:45 -08:00
Hannah Troisi
51eccb3d96 [ASImageNode] More refined naming and documentation for [ASImageNode shouldShowImageScalingOverlay] 2016-03-08 23:30:17 -08:00
Hannah Troisi
d64c05a68e [ASImageNode] A ASImageNode debug feature showing pixel scaling amount
- shows a red text label overlay on bottom right hand corner of ASImageNodes with pixel scaling factor
- import AsyncDisplayKit+Debug.h and enable using [ASImageNode setEnableImageDebugOverlay]
2016-03-08 23:13:32 -08:00
Aaron Schubert
f9bf402047 [tvOS] Clean up and document parts of code. 2016-02-25 09:06:11 +00:00
Aaron Schubert
3d6f6766e9 [tvOS] Implement a default behaviour of ASImageNode, trying to match the behaviour of UIImageView. Still need to add shine. 2016-02-24 13:58:11 +00:00
appleguy
3abde9348d Merge pull request #1256 from Adlai-Holler/AHAffinityRevisions
[ASDisplayNode] Post-Review Refinements of Recent No-Affinity UIKit/CA Property Bridging
2016-02-22 20:41:59 -08:00
Adlai Holler
fd5723379f [ASImageNode] Lock & unlock directly instead of using stack objects. 2016-02-22 18:48:31 -08:00
Adlai Holler
57ca0c73bf [ASImageNode] Correctly unlock _imageLock 2016-02-22 09:12:58 -08:00
Adlai Holler
03d2b57991 [ASImageNode] Unlock immediately after updating _image 2016-02-22 09:04:23 -08:00
Adlai Holler
2a94d88b4b [ASImageNode] Remove thread affinity dispatches 2016-02-20 15:43:00 -08:00
Garrett Moon
8f07197573 Don't need this :) 2016-02-16 19:05:17 -08:00
Garrett Moon
1b08114eca Allow prevention of downscaling 2016-02-02 19:10:12 -08:00
Garrett Moon
580b7bdc78 Move the call to willDisplayNodeContentWithRenderingContext to before background fill in image node 2016-01-28 17:40:21 -08:00
Garrett Moon
1ecfd81e3e Address comments 2016-01-28 16:05:49 -08:00
Garrett Moon
7b002c408d Ensure context is non-null 2016-01-28 08:38:40 -08:00
Garrett Moon
48150668c6 Fix up build 2016-01-28 08:33:18 -08:00
Garrett Moon
d7d36c0a6b Addressing Scott's comments 2016-01-27 21:08:04 -08:00
Garrett Moon
01c1680904 Switch to instance methods of draw and display
This patch switches to instance methods of draw and display for
ASTextNode and ASImageNode to attempt to increase their performance.

It also fixes some thread safety issues in ASImageNode which appear
to have been regressions (though probably not hit very often).

And it sets up work for allowing modification of CGContexts before
and after a node's contents are drawn.
2016-01-27 20:08:02 -08:00
Scott Goodson
264887413e Add @synchronized around UIImage draw to prevent concurrently decoding the same instance.
This is a workaround necessary due to an iOS 9 bug.  I'm not gating it to iOS 9 only so as to
not exaggerate iOS version-specific behavior differences in the framework, since a majority are
on iOS 9 anyway.  If we can confirm the bug is fixed in a later iOS version, then it will be gated.

Issue tracked in greater detail here: https://github.com/facebook/AsyncDisplayKit/issues/1068
2016-01-23 13:35:04 -08:00
Adlai Holler
b4b88da8cd Merge branch 'master' into update-objc
Conflicts:
	AsyncDisplayKit/ASCellNode.h
2015-11-02 09:36:46 -08:00
Huy Nguyen
cd31f884dd Move ASDisplayNodePerformBlockOnMainThread to ASInternalHelpers 2015-10-29 16:09:36 +02:00
Adlai Holler
b1e60a95e6 Merge branch 'master' into update-objc 2015-10-13 21:26:20 -07:00
Adlai Holler
87caed27e2 Add more deep compares when setting public properties to the same value 2015-10-05 23:48:48 -07:00
Adlai Holler
9d6b3b6e14 Merge branch 'master' into update-objc
Conflicts:
	AsyncDisplayKit/Details/ASTextNodeTextKitHelpers.h
2015-09-20 21:55:54 -07:00
Adlai Holler
d0f4bacc67 ImageNode: fill background more efficiently 2015-09-19 12:23:51 -07:00
Adlai Holler
c872485459 Fill image context with background color if image node is opaque 2015-09-17 21:59:52 -07:00
Adlai Holler
814f72535c Add nullability annotations for public API 2015-09-16 15:21:35 -07:00
rcancro
2f3562fa09 scott's comments 2015-09-15 09:11:19 -07:00
rcancro
01be5acece added a callback for initWithViewBlock/initWithLayerBlock 2015-09-14 20:36:08 -07:00
ricky cancro
3bc692c938 comments 2015-08-12 15:29:26 -07:00
ricky cancro
b4e6591ad8 call super to return preferredFrameSize. 2015-08-12 13:43:10 -07:00
ricky cancro
b58e8344c0 Add expectedSize to ASNetworkImageNode
ASNetworkImageNode defers to ASImageNode to return its calculatedSize. ASImageNode returns the size of its image. There is a good chance that ASNetworkImageNode hasn't downloaded its image yet when calculatedSize is called, so it returns a size of CGSizeZero.

On top of that, it is possible that the size of the image is not actually the size that we wish to display in our node.

I've added an "expectedImageSize" property that can be used to determine the calculatedSize of an ASNetworkImageNode.
2015-08-09 16:34:44 -07:00
Huy Nguyen
dd29a890df Still support -calculateLayoutThatFits: (and manual layout), for backward compatibility. 2015-06-28 20:31:32 +07:00
Huy Nguyen
f588bceb4d Introduce ASLayoutable and eliminate ASCompositeNode:
- Both ASDisplayNode and ASLayoutNode conforms to this protocol.
- ASDisplayNode can be embeded directly into layout graph.
- Eliminate ASCompositeNode.
- Fix ASStaticSizeDisplayNode not recpect min constrained size.
- Updated tests.
2015-06-26 09:29:16 +07:00
Huy Nguyen
abe98d5b09 Integrate new layout nodes to the framework.
- Introduce ASLayoutNode and its subclasses.
- ASDisplayNode measures its ASLayoutNode and cache the result (ASLayout). Calculated size and position of each subnode can be retrieved from the calculated layout.
- Custom nodes need to override -layoutNodeThatFits:(CGSize) instead of -calculateSizeThatFits:(CGSize).
- Custom nodes do not need to layout its subnodes (in -layout:) anymore. ASDisplayNode can handle the job most of the time, by walking through its layout tree.
- ASCompositeNode is used to embed (display) subnodes to a node's layout. That way, each subnode will also be measured while the parent node is measuring. And the parent node knows where its subnodes are within its layout.
2015-06-25 11:34:35 +07:00
Scott Goodson
c4cd38bb6e Set line width on path instead of context.
I’m not confident why the original implementation doesn’t work, but
this version is stylistically cleaner regardless.  Resolves task #450.
2015-05-17 17:01:59 -10:00