Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into github
Browse files Browse the repository at this point in the history
  • Loading branch information
Raj Seshasankaran committed Dec 19, 2015
2 parents 44d4edc + ceeb459 commit a31d746
Show file tree
Hide file tree
Showing 213 changed files with 10,483 additions and 7,923 deletions.
14 changes: 10 additions & 4 deletions Frameworks/AVFoundation/AVAudioConstants.mm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@

#import <AVFoundation/AVFoundation.h>

extern "C" NSString* const AVAudioSessionCategoryAmbient = (NSString * const) @"AVAudioSessionCategoryAmbient";
extern "C" NSString* const AVAudioSessionCategoryPlayback = (NSString * const) @"AVAudioSessionCategoryPlayback";
extern "C" NSString* const AVAudioSessionCategoryPlayAndRecord = (NSString * const) @"AVAudioSessionCategoryPlayAndRecord";
extern "C" NSString* const AVAudioSessionCategorySoloAmbient = (NSString * const) @"AVAudioSessionCategorySoloAmbient";
extern "C" NSString* const AVAudioSessionCategoryAmbient = @"AVAudioSessionCategoryAmbient";
extern "C" NSString* const AVAudioSessionCategoryPlayback = @"AVAudioSessionCategoryPlayback";
extern "C" NSString* const AVAudioSessionCategoryPlayAndRecord = @"AVAudioSessionCategoryPlayAndRecord";
extern "C" NSString* const AVAudioSessionCategorySoloAmbient = @"AVAudioSessionCategorySoloAmbient";

extern "C" NSString* const AVAudioSessionInterruptionTypeKey = @"AVAudioSessionInterruptionTypeKey";
extern "C" NSString* const AVAudioSessionInterruptionOptionKey = @"AVAudioSessionInterruptionOptionKey";
extern "C" NSString* const AVAudioSessionRouteChangeReasonKey = @"AVAudioSessionRouteChangeReasonKey";
extern "C" NSString* const AVAudioSessionRouteChangePreviousRouteKey = @"AVAudioSessionRouteChangePreviousRouteKey";
extern "C" NSString* const AVAudioSessionSilenceSecondaryAudioHintTypeKey = @"AVAudioSessionSilenceSecondaryAudioHintTypeKey";
2 changes: 2 additions & 0 deletions Frameworks/CoreFoundation/CFConstants.mm
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@
const CFStringRef kCFBundleNameKey = (const CFStringRef) @"CFBundleName";

CFAllocatorRef const kCFAllocatorDefault = 0;

double kCFCoreFoundationVersionNumber = kCFCoreFoundationVersionNumber_iOS_6_0;
1 change: 0 additions & 1 deletion Frameworks/CoreFoundation/CFNumber.mm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
*/
CFNumberType CFNumberGetType(CFNumberRef self) {
UNIMPLEMENTED();
assert(0);
return kCFNumberIntType;
}

Expand Down
9 changes: 9 additions & 0 deletions Frameworks/CoreFoundation/CFString.mm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
//
//******************************************************************************

#include "Starboard.h"
#import <Foundation/Foundation.h>

/**
Expand Down Expand Up @@ -99,3 +100,11 @@ CFComparisonResult CFStringCompare(CFStringRef self, CFStringRef other, CFOption
CFIndex CFStringGetLength(CFStringRef self) {
return [(NSString*)self length];
}

/**
@Status Stub
*/
CFStringEncoding CFStringGetFastestEncoding(CFStringRef self) {
UNIMPLEMENTED();
return 0;
}
16 changes: 16 additions & 0 deletions Frameworks/CoreFoundation/CFType.mm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ void CFRelease(CFTypeRef obj) {
objc_release_ref((id)obj);
}

/**
@Status Interoperable
*/
void CFAutorelease(CFTypeRef obj) {
[obj autorelease];
}

/**
@Status Interoperable
*/
Expand Down Expand Up @@ -113,6 +120,7 @@ DWORD _NSSetLogCStringFunction(DWORD func) {
CFBooleanType,
CGLayerType,
CFBundleType,
CFBinaryHeap,
} CFTypeIDs;

DWORD CFGetTypeID(id cfobj)
Expand All @@ -124,6 +132,9 @@ DWORD CFGetTypeID(id cfobj)
if ( [objType isKindOfClass:[NSDictionary class]] ) {
return CFDictionaryType;
}
if ( [objType isKindOfClass:[CFBinaryHeap class]] ) {
return CFBinaryHeap;
}
if ( [objType isKindOfClass:[NSArray class]] ) {
return CFArrayType;
}
Expand All @@ -145,6 +156,11 @@ DWORD CFGetTypeID(id cfobj)
return 0;
}

DWORD CFBinaryHeapGetTypeID()
{
return CFBinaryHeap;
}

DWORD CFDictionaryGetTypeID()
{
return CFDictionaryType;
Expand Down
27 changes: 27 additions & 0 deletions Frameworks/CoreFoundation/CFURL.mm
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,30 @@ CFStringRef CFURLCreateStringByAddingPercentEscapes(CFAllocatorRef allocator,
CFStringRef CFURLCopyPathExtension(CFURLRef self) {
return (CFStringRef)[[[(NSURL*)self path] pathExtension] retain];
}

/**
@Status Stub
*/
CFStringRef CFURLCreateStringByReplacingPercentEscapes(CFAllocatorRef allocator, CFStringRef string, CFStringRef charactersToLeaveEscaped) {
UNIMPLEMENTED();
return nil;
}

/**
@Status Stub
*/
CFStringRef CFURLCreateStringByReplacingPercentEscapesUsingEncoding(CFAllocatorRef allocator,
CFStringRef string,
CFStringRef charactersToLeaveEscaped,
CFStringEncoding encoding) {
UNIMPLEMENTED();
return nil;
}

/**
@Status Stub
*/
CFStringRef CFURLCopyPath(CFURLRef self) {
UNIMPLEMENTED();
return nil;
}
92 changes: 86 additions & 6 deletions Frameworks/CoreGraphics/CGFont.mm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "CGContextInternal.h"
#include "CGFontInternal.h"
#include "CoreText/CoreText.h"

#include "Etc.h"

Expand All @@ -35,6 +36,27 @@
#include <ftsizes.h>
}

const CFStringRef kCTCharacterShapeAttributeName = static_cast<CFStringRef>(@"kCTCharacterShapeAttributeName");
const CFStringRef kCTFontAttributeName = static_cast<CFStringRef>(@"NSFontAttributeName");
const CFStringRef kCTKernAttributeName = static_cast<CFStringRef>(@"kCTKernAttributeName");
const CFStringRef kCTLigatureAttributeName = static_cast<CFStringRef>(@"kCTLigatureAttributeName");
const CFStringRef kCTForegroundColorAttributeName = static_cast<CFStringRef>(@"NSForegroundColorAttributeName");
const CFStringRef kCTForegroundColorFromContextAttributeName = static_cast<CFStringRef>(@"kCTForegroundColorFromContextAttributeName");
const CFStringRef kCTParagraphStyleAttributeName = static_cast<CFStringRef>(@"kCTParagraphStyleAttributeName");
const CFStringRef kCTStrokeWidthAttributeName = static_cast<CFStringRef>(@"kCTStrokeWidthAttributeName");
const CFStringRef kCTStrokeColorAttributeName = static_cast<CFStringRef>(@"kCTStrokeColorAttributeName");
const CFStringRef kCTSuperscriptAttributeName = static_cast<CFStringRef>(@"kCTSuperscriptAttributeName");
const CFStringRef kCTUnderlineColorAttributeName = static_cast<CFStringRef>(@"kCTUnderlineColorAttributeName");
const CFStringRef kCTUnderlineStyleAttributeName = static_cast<CFStringRef>(@"kCTUnderlineStyleAttributeName");
const CFStringRef kCTVerticalFormsAttributeName = static_cast<CFStringRef>(@"kCTVerticalFormsAttributeName");
const CFStringRef kCTGlyphInfoAttributeName = static_cast<CFStringRef>(@"kCTGlyphInfoAttributeName");
const CFStringRef kCTRunDelegateAttributeName = static_cast<CFStringRef>(@"kCTRunDelegateAttributeName");
const CFStringRef kCTBackgroundStrokeColorAttributeName = static_cast<CFStringRef>(@"kCTBackgroundStrokeColorAttributeName");
const CFStringRef kCTBackgroundFillColorAttributeName = static_cast<CFStringRef>(@"kCTBackgroundFillColorAttributeName");
const CFStringRef kCTBackgroundCornerRadiusAttributeName = static_cast<CFStringRef>(@"kCTBackgroundCornerRadiusAttributeName");
const CFStringRef kCTBackgroundLineWidthAttributeName = static_cast<CFStringRef>(@"kCTBackgroundLineWidthAttributeName");
const CFStringRef kCTFontPostScriptNameKey = static_cast<CFStringRef>(@"kCTFontPostScriptNameKey");

static float spacing = 1.0f;

static DWORD textureBuffer[1024];
Expand Down Expand Up @@ -1024,12 +1046,6 @@ CFArrayRef CTLineGetGlyphRuns(CTLineRef line) {
return (CFArrayRef)[((_CTLine*)line)->_runs retain];
}

const CFStringRef kCTBackgroundStrokeColorAttributeName = (const CFStringRef) @"kCTBackgroundStrokeColorAttributeName";
const CFStringRef kCTBackgroundFillColorAttributeName = (const CFStringRef) @"kCTBackgroundFillColorAttributeName";
const CFStringRef kCTBackgroundCornerRadiusAttributeName = (const CFStringRef) @"kCTBackgroundCornerRadiusAttributeName";
const CFStringRef kCTBackgroundLineWidthAttributeName = (const CFStringRef) @"kCTBackgroundLineWidthAttributeName";
const CFStringRef kCTSuperscriptAttributeName = (const CFStringRef) @"kCTSuperscriptAttributeName";

/**
@Status Stub
*/
Expand Down Expand Up @@ -1238,3 +1254,67 @@ - (void)dealloc {
[super dealloc];
}
@end

/**
@Status Stub
*/
CTFontRef CTFontCreateCopyWithSymbolicTraits(
CTFontRef font, CGFloat size, const CGAffineTransform* matrix, CTFontSymbolicTraits symTraitValue, CTFontSymbolicTraits symTraitMask) {
UNIMPLEMENTED();
return nil;
}

/**
@Status Stub
*/
void CTFrameDraw(CTFrameRef frame, CGContextRef context) {
UNIMPLEMENTED();
}

/**
@Status Stub
*/
CFIndex CTLineGetStringIndexForPosition(CTLineRef line, CGPoint position) {
UNIMPLEMENTED();
return 0;
}

/**
@Status Stub
*/
CFStringRef CTFontCopyName(CTFontRef font, CFStringRef nameKey) {
UNIMPLEMENTED();
return nil;
}

/**
@Status Stub
*/
CGFloat CTFontGetUnderlineThickness(CTFontRef self) {
UNIMPLEMENTED();
return 0;
}

/**
@Status Stub
*/
CGFloat CTLineGetOffsetForStringIndex(CTLineRef line, CFIndex charIndex, CGFloat* secondaryOffset) {
UNIMPLEMENTED();
return 0;
}

/**
@Status Stub
*/
double CTRunGetTypographicBounds(CTRunRef run, CFRange range, CGFloat* ascent, CGFloat* descent, CGFloat* leading) {
UNIMPLEMENTED();
return 0;
}

/**
@Status Stub
*/
CFRange CTRunGetStringRange(CTRunRef run) {
UNIMPLEMENTED();
return { 0, 0 };
}
24 changes: 16 additions & 8 deletions Frameworks/CoreGraphics/CGGradient.mm
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,22 @@ - (void)release {
}
@end

__CGGradient::__CGGradient() {
__CGGradient::__CGGradient() :
_components(NULL),
_locations(NULL) {
isa = NULL;
object_setClass((id) this, [CGNSGradient class]);
}

__CGGradient::~__CGGradient() {
free(_components);
free(_locations);
if (_components) {
delete [] _components;
_components = NULL;
}
if (_locations) {
delete [] _locations;
_locations = NULL;
}
}

void __CGGradient::initWithColorComponents(const float* components, const float* locations, size_t count, CGColorSpaceRef colorspace) {
Expand All @@ -72,10 +80,10 @@ - (void)release {
break;
}

_components = (float*)malloc(sizeof(float) * count * componentCount);
_components = new float[count * componentCount];
memcpy(_components, components, sizeof(float) * count * componentCount);

_locations = (float*)malloc(sizeof(float) * count);
_locations = new float[count];

if (locations) {
memcpy(_locations, locations, sizeof(float) * count);
Expand Down Expand Up @@ -115,17 +123,17 @@ - (void)release {

int count = [components count];

_components = (float*)malloc(sizeof(float) * count * componentCount);
_components = new float[count * componentCount];

for (int i = 0; i < count; i++) {
id curColor = [components objectAtIndex:i];

float color[4];
[curColor getColors:color];
memcpy(&_components[i * componentCount], color, sizeof(float) * count * componentCount);
memcpy(&_components[i * componentCount], color, sizeof(float) * componentCount);
}

_locations = (float*)malloc(sizeof(float) * count);
_locations = new float[count];

if (locations) {
memcpy(_locations, locations, sizeof(float) * count);
Expand Down
Loading

0 comments on commit a31d746

Please sign in to comment.