Skip to content

Commit

Permalink
Merge remote-tracking branch 'github/develop' into github-CGD2D
Browse files Browse the repository at this point in the history
Conflicts:
	.gitattributes
	Frameworks/CoreGraphics/CGContext.mm
	Frameworks/CoreGraphics/CGGraphicBufferImage.mm
	Frameworks/QuartzCore/CALayer.mm
	Frameworks/UIKit/StarboardXaml/CompositorInterface.mm
	Frameworks/UIKit/UIImage.mm
	Frameworks/UIKit/UILabel.mm
	Frameworks/UIKit/UIPasteboard.mm
	Frameworks/include/CACompositor.h
	Frameworks/include/CGContextInternal.h
	Frameworks/include/CGGraphicBufferImage.h
	Frameworks/include/CGImageInternal.h
	build/Tests/UnitTests/CoreGraphics/CoreGraphics.UnitTests.vcxproj
  • Loading branch information
DHowett committed Nov 29, 2016
2 parents 633799f + 2a0de15 commit 281b612
Show file tree
Hide file tree
Showing 325 changed files with 15,565 additions and 9,549 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
*.nef filter=lfs diff=lfs merge=lfs -text
*.xcf filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
3 changes: 1 addition & 2 deletions Frameworks/AVFoundation/AVAudioPlayer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ - (instancetype)init {
_mediaElement = [WXCMediaElement make];
_mediaElement.autoPlay = NO;
_mediaElement.volume = 1.0f;
_hiddenView = [[_UIHiddenMediaView alloc] initWithFrame:{ 0, 0, 0, 0 }];
[_hiddenView setXamlElement:_mediaElement];
_hiddenView = [[_UIHiddenMediaView alloc] initWithFrame:{ 0, 0, 0, 0 } xamlElement:_mediaElement];

_lastState = _mediaElement.currentState;

Expand Down
2 changes: 1 addition & 1 deletion Frameworks/AudioToolbox/CAFDecoder.mm
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ uint64_t int64Swap(uint64_t val) {

if (isPcm) {
NSInteger result =
[stream read:(uint8_t*)&outOutputData maxLength:(cafDesc.mBytesPerPacket * (ioOutputDataByteSize / cafDesc.mBytesPerPacket))];
[stream read:(uint8_t*)outOutputData maxLength:(cafDesc.mBytesPerPacket * (ioOutputDataByteSize / cafDesc.mBytesPerPacket))];
ioNumberPackets = (result / cafDesc.mBytesPerPacket);
ioOutputDataByteSize = result;
return;
Expand Down
46 changes: 27 additions & 19 deletions Frameworks/AutoLayout/AutoLayout.mm
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ void RemoveStays() {
NSMutableArray* _associatedConstraints;
};

// Since categories can't have ivars, we bundle up a couple C++ classes in NSObjects and associate them to the UIView/UILayoutGuide/NSLayoutConstraint
// Since categories can't have ivars, we bundle up a couple C++ classes in NSObjects and associate them to the
// UIView/UILayoutGuide/NSLayoutConstraint
@protocol _AutoLayoutProperties
@property (readonly) AutoLayoutProperties* _autoLayoutProperties;
@end
Expand All @@ -116,7 +117,7 @@ @interface _AutoLayoutStorage : NSObject {
@end

@implementation _AutoLayoutStorage
@end
@end

@interface _NSLayoutConstraintStorage : NSObject {
@public
Expand All @@ -125,7 +126,7 @@ @interface _NSLayoutConstraintStorage : NSObject {
@end

@implementation _NSLayoutConstraintStorage
@end
@end

@interface UIView (AutoLayoutProperties) <_AutoLayoutProperties>
@end
Expand All @@ -140,7 +141,9 @@ - (_NSLayoutConstraintStorage*)_constraintStorage {
}

- (void)autoLayoutAlloc {
objc_setAssociatedObject(self, @selector(_constraintStorage), [_NSLayoutConstraintStorage new], OBJC_ASSOCIATION_RETAIN);
_NSLayoutConstraintStorage* storage = [_NSLayoutConstraintStorage new];
objc_setAssociatedObject(self, @selector(_constraintStorage), storage, OBJC_ASSOCIATION_RETAIN);
[storage release];
}

- (void)autoLayoutConstraintAddedToView:(UIView*)view {
Expand Down Expand Up @@ -270,7 +273,6 @@ - (void)autoLayoutConstraintAddedToView:(UIView*)view {
}

c_solver.AddConstraint(constraintStorage->_constraint);

}
}

Expand Down Expand Up @@ -312,7 +314,9 @@ - (void)_removeFromSolver {
@implementation UILayoutGuide (AutoLayout)

- (void)autoLayoutAlloc {
objc_setAssociatedObject(self, @selector(_autoLayoutProperties), [_AutoLayoutStorage new], OBJC_ASSOCIATION_RETAIN);
_AutoLayoutStorage* storage = [_AutoLayoutStorage new];
objc_setAssociatedObject(self, @selector(_autoLayoutProperties), storage, OBJC_ASSOCIATION_RETAIN);
[storage release];
}

- (CGRect)autoLayoutGetRect {
Expand Down Expand Up @@ -355,7 +359,9 @@ - (AutoLayoutProperties*)_autoLayoutProperties {
}

- (void)autoLayoutAlloc {
objc_setAssociatedObject(self, @selector(_autoLayoutProperties), [_AutoLayoutStorage new], OBJC_ASSOCIATION_RETAIN);
_AutoLayoutStorage* storage = [_AutoLayoutStorage new];
objc_setAssociatedObject(self, @selector(_autoLayoutProperties), storage, OBJC_ASSOCIATION_RETAIN);
[storage release];
}

- (void)autoLayoutSetFrameToView:(UIView*)toView fromView:(UIView*)fromView {
Expand Down Expand Up @@ -433,13 +439,15 @@ - (void)autoLayoutInvalidateContentSize {
c_solver.AddConstraint(&layoutProperties->_contentHuggingConstraint[Horizontal]);
c_solver.AddConstraint(&layoutProperties->_contentCompressionResistanceConstraint[Horizontal]);
}
if ([self contentHuggingPriorityForAxis:UILayoutConstraintAxisHorizontal] != layoutProperties->_contentHuggingConstraint[Horizontal].weight()) {
c_solver.ChangeWeight(&layoutProperties->_contentHuggingConstraint[Horizontal], [self contentHuggingPriorityForAxis:UILayoutConstraintAxisHorizontal]);
if ([self contentHuggingPriorityForAxis:UILayoutConstraintAxisHorizontal] !=
layoutProperties->_contentHuggingConstraint[Horizontal].weight()) {
c_solver.ChangeWeight(&layoutProperties->_contentHuggingConstraint[Horizontal],
[self contentHuggingPriorityForAxis:UILayoutConstraintAxisHorizontal]);
}
if ([self contentCompressionResistancePriorityForAxis:UILayoutConstraintAxisHorizontal] !=
layoutProperties->_contentCompressionResistanceConstraint[Horizontal].weight()) {
c_solver.ChangeWeight(&layoutProperties->_contentCompressionResistanceConstraint[Horizontal],
[self contentCompressionResistancePriorityForAxis:UILayoutConstraintAxisHorizontal]);
[self contentCompressionResistancePriorityForAxis:UILayoutConstraintAxisHorizontal]);
}
}
if (!layoutProperties->_contentHuggingConstraint[Horizontal].FIsInSolver()) {
Expand Down Expand Up @@ -477,13 +485,15 @@ - (void)autoLayoutInvalidateContentSize {
c_solver.AddConstraint(&layoutProperties->_contentHuggingConstraint[Vertical]);
c_solver.AddConstraint(&layoutProperties->_contentCompressionResistanceConstraint[Vertical]);
}
if ([self contentHuggingPriorityForAxis:UILayoutConstraintAxisVertical] != layoutProperties->_contentHuggingConstraint[Vertical].weight()) {
c_solver.ChangeWeight(&layoutProperties->_contentHuggingConstraint[Vertical], [self contentHuggingPriorityForAxis:UILayoutConstraintAxisVertical]);
if ([self contentHuggingPriorityForAxis:UILayoutConstraintAxisVertical] !=
layoutProperties->_contentHuggingConstraint[Vertical].weight()) {
c_solver.ChangeWeight(&layoutProperties->_contentHuggingConstraint[Vertical],
[self contentHuggingPriorityForAxis:UILayoutConstraintAxisVertical]);
}
if ([self contentCompressionResistancePriorityForAxis:UILayoutConstraintAxisVertical] !=
layoutProperties->_contentCompressionResistanceConstraint[Vertical].weight()) {
c_solver.ChangeWeight(&layoutProperties->_contentCompressionResistanceConstraint[Vertical],
[self contentCompressionResistancePriorityForAxis:UILayoutConstraintAxisVertical]);
[self contentCompressionResistancePriorityForAxis:UILayoutConstraintAxisVertical]);
}
}
if (!layoutProperties->_contentHuggingConstraint[Vertical].FIsInSolver()) {
Expand All @@ -510,7 +520,7 @@ - (void)autoLayoutInvalidateContentSize {
// Gets the top most view that autolayout is relative to.
- (UIView*)autolayoutRoot {
UIView* ret = self;

while (ret.translatesAutoresizingMaskIntoConstraints == NO || ([ret.superview viewForBaselineLayout] == ret)) {
ret = ret.superview;
if (ret == nil) {
Expand Down Expand Up @@ -538,33 +548,31 @@ - (void)autoLayoutUpdateConstraints {
CGRect convFrame;

layoutProperties->AddStays();

convFrame = [self convertRect:curBounds toView:[self autolayoutRoot]];

if ((layoutProperties->_vars[AutoLayoutProperties::Right].Value() != convFrame.origin.x + convFrame.size.width) ||
(layoutProperties->_vars[AutoLayoutProperties::Left].Value() != convFrame.origin.x)) {

c_solver.AddEditVar(layoutProperties->_vars[AutoLayoutProperties::Right], ClsStrong(), 2.0);
c_solver.AddEditVar(layoutProperties->_vars[AutoLayoutProperties::Left], ClsStrong(), 2.0);

c_solver.BeginEdit();
c_solver.SuggestValue(layoutProperties->_vars[AutoLayoutProperties::Right], convFrame.origin.x + convFrame.size.width);
c_solver.SuggestValue(layoutProperties->_vars[AutoLayoutProperties::Left], convFrame.origin.x);
c_solver.Resolve();
c_solver.EndEdit(); // Removes edit constraints.
c_solver.EndEdit(); // Removes edit constraints.
}

if ((layoutProperties->_vars[AutoLayoutProperties::Bottom].Value() != convFrame.origin.y + convFrame.size.height) ||
(layoutProperties->_vars[AutoLayoutProperties::Top].Value() != convFrame.origin.y)) {

c_solver.AddEditVar(layoutProperties->_vars[AutoLayoutProperties::Bottom], ClsStrong(), 2.0);
c_solver.AddEditVar(layoutProperties->_vars[AutoLayoutProperties::Top], ClsStrong(), 2.0);

c_solver.BeginEdit();
c_solver.SuggestValue(layoutProperties->_vars[AutoLayoutProperties::Bottom], convFrame.origin.y + convFrame.size.height);
c_solver.SuggestValue(layoutProperties->_vars[AutoLayoutProperties::Top], convFrame.origin.y);
c_solver.Resolve();
c_solver.EndEdit(); // Removes edit constraints.
c_solver.EndEdit(); // Removes edit constraints.
}
} else {
[self autoLayoutInvalidateContentSize];
Expand Down
17 changes: 13 additions & 4 deletions Frameworks/CoreGraphics/CGFont.mm
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,19 @@ CGFontRef CGFontRetain(CGFontRef font) {
}

/**
@Status Stub
@Status Interoperable
*/
CGFontRef CGFontCreateWithDataProvider(CGDataProviderRef cgDataProvider) {
UNIMPLEMENTED();
return StubReturn();
RETURN_NULL_IF(!cgDataProvider);

size_t memSize = sizeof(struct __CGFont) - sizeof(CFRuntimeBase);
CGFontRef ret = static_cast<CGFontRef>(_CFRuntimeCreateInstance(kCFAllocatorDefault, CGFontGetTypeID(), memSize, NULL));
CFAutorelease(ret);
struct __CGFont* mutableRet = const_cast<struct __CGFont*>(ret);

RETURN_NULL_IF_FAILED(_DWriteCreateFontFaceWithDataProvider(cgDataProvider, &mutableRet->_dwriteFontFace));

return static_cast<CGFontRef>(CFRetain(ret));
}

/**
Expand Down Expand Up @@ -235,7 +243,8 @@ int CGFontGetAscent(CGFontRef font) {
*/
int CGFontGetDescent(CGFontRef font) {
// Value for CGFont metrics are specified in 'glyph space units', which appear to be the same as DWrite's 'design units'
return font ? __CGFontGetDWriteMetrics(font).descent : 0;
// But CGFont expects descent to be negative for glyphs extending below the baseline, whereas DWrite has them positive
return font ? -__CGFontGetDWriteMetrics(font).descent : 0;
}

/**
Expand Down
Loading

0 comments on commit 281b612

Please sign in to comment.