diff --git a/apinotes/CoreGraphics.apinotes b/apinotes/CoreGraphics.apinotes index 0b923e61c592c..fb3022897cab7 100644 --- a/apinotes/CoreGraphics.apinotes +++ b/apinotes/CoreGraphics.apinotes @@ -535,11 +535,6 @@ Enumerators: SwiftName: CGColorRenderingIntent.saturation - Name: kCGMomentumScrollPhaseContinue SwiftName: CGMomentumScrollPhase.continuous -- Name: kCGColorSpaceModelRGB - SwiftName: CGColorSpaceModel.rgb -- Name: kCGColorSpaceModelCMYK - SwiftName: CGColorSpaceModel.cmyk - # CGContext - Name: kCGBlendModeXOR SwiftName: CGBlendMode.xor diff --git a/stdlib/public/SDK/CoreGraphics/CoreGraphics.swift b/stdlib/public/SDK/CoreGraphics/CoreGraphics.swift index 73faa070bda55..867250926d69f 100644 --- a/stdlib/public/SDK/CoreGraphics/CoreGraphics.swift +++ b/stdlib/public/SDK/CoreGraphics/CoreGraphics.swift @@ -18,6 +18,7 @@ import Darwin //===----------------------------------------------------------------------===// extension CGColor { + @available(OSX 10.3, iOS 2.0, *) public var components: [CGFloat]? { guard let pointer = self.__unsafeComponents else { return nil } let buffer = UnsafeBufferPointer(start: pointer, count: self.numberOfComponents) @@ -25,14 +26,11 @@ extension CGColor { } #if os(macOS) - public class var white: CGColor - { return CGColor.__constantColor(for: CGColor.__whiteColorName)! } + public class var white: CGColor { return CGColor.__constantColor(for: CGColor.__whiteColorName)! } - public class var black: CGColor - { return CGColor.__constantColor(for: CGColor.__blackColorName)! } + public class var black: CGColor { return CGColor.__constantColor(for: CGColor.__blackColorName)! } - public class var clear: CGColor - { return CGColor.__constantColor(for: CGColor.__clearColorName)! } + public class var clear: CGColor { return CGColor.__constantColor(for: CGColor.__clearColorName)! } #endif } @@ -219,4 +217,5 @@ extension CGAffineTransform { @_transparent // @fragile get { return CGAffineTransform(a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0) } } -} \ No newline at end of file +} + diff --git a/test/ClangModules/CoreGraphics_test.swift b/test/ClangModules/CoreGraphics_test.swift index 64559bf429e2b..6a30350af579f 100644 --- a/test/ClangModules/CoreGraphics_test.swift +++ b/test/ClangModules/CoreGraphics_test.swift @@ -5,27 +5,6 @@ import CoreGraphics // REQUIRES: OS=macosx -// CHECK: [[SWITCHTABLE:@.*]] = private unnamed_addr constant [8 x i64] [i64 0, i64 12, i64 23, i64 34, i64 45, i64 55, i64 67, i64 71] - -// CHECK-LABEL: define i64 {{.*}}testEnums{{.*}} { -public func testEnums(_ model: CGColorSpaceModel) -> Int { - switch model { - case .unknown : return 0 - case .monochrome : return 12 - case .rgb : return 23 - case .cmyk : return 34 - case .lab : return 45 - case .deviceN : return 55 - case .indexed : return 67 - case .pattern : return 71 - - default: return 0 - } -// CHECK: [[GEP:%.+]] = getelementptr inbounds [8 x i64], [8 x i64]* [[SWITCHTABLE]], i64 0, i64 %{{.*}} -// CHECK: [[LOAD:%.+]] = load i64, i64* [[GEP]], align 8 -// CHECK: ret i64 [[LOAD]] -} - // CHECK-LABEL: define void {{.*}}rotationAround{{.*}} { // Get a transform that will rotate around a given offset public func rotationAround(offset: CGPoint, angle: CGFloat, @@ -113,8 +92,10 @@ public func testRenames(transform: CGAffineTransform, context: CGContext, // CHECK: call void @CGContextTranslateCTM(%struct.CGContext* [[CONTEXT]], double {{1\.0+.*}}, double {{1\.0+.*}}) context.clip(to: rect) + context.clip(to: &rect, count: 2) context.clip(to: rect, mask: image) // CHECK: call void @CGContextClipToRect(%struct.CGContext* [[CONTEXT]], %struct.CGRect* byval nonnull align 8 %{{.*}}) +// CHECK: call void @CGContextClipToRects(%struct.CGContext* [[CONTEXT]], %struct.CGRect* nonnull %{{.*}}, i64 2) // CHECK: call void @CGContextClipToMask(%struct.CGContext* [[CONTEXT]], %struct.CGRect* byval nonnull align 8 %{{.*}}, %struct.CGImage* %{{.*}}) var slice = CGRect.zero @@ -123,7 +104,7 @@ public func testRenames(transform: CGAffineTransform, context: CGContext, from: edge) assert((slice, remainder) == rect.divided(atDistance: CGFloat(2.0), from: edge)) -// CHECK: call void @CGRectDivide(%struct.CGRect* byval nonnull align 8 %{{.*}}, %struct.CGRect* nonnull %{{.*}}, %struct.CGRect* nonnull %{{.*}}, double {{2\.0+.*}}, i32 %{{.*}}) +// CHECK: call void @CGRectDivide(%struct.CGRect* byval nonnull align 8 %{{.*}}, %struct.CGRect* nonnull %slice, %struct.CGRect* nonnull %remainder, double {{2\.0+.*}}, i32 %{{.*}}) // // CHECK: ret void } diff --git a/tools/swift-reflection-test/swift-reflection-test.c b/tools/swift-reflection-test/swift-reflection-test.c index ced8cb55761bd..e53d919468ca9 100644 --- a/tools/swift-reflection-test/swift-reflection-test.c +++ b/tools/swift-reflection-test/swift-reflection-test.c @@ -421,10 +421,8 @@ int doDumpHeapInstance(const char *BinaryFilename) { return EXIT_SUCCESS; break; case Existential: { - static const char Name[] = "_TtP_"; swift_typeref_t AnyTR - = swift_reflection_typeRefForMangledTypeName(RC, - Name, sizeof(Name)-1); + = swift_reflection_typeRefForMangledTypeName(RC, "_TtP_", 5); printf("Reflecting an existential.\n"); if (!reflectExistential(RC, Pipe, AnyTR)) @@ -432,10 +430,9 @@ int doDumpHeapInstance(const char *BinaryFilename) { break; } case ErrorExistential: { - static const char ErrorName[] = "_TtPs5Error_"; swift_typeref_t ErrorTR = swift_reflection_typeRefForMangledTypeName(RC, - ErrorName, sizeof(ErrorName)-1); + "_TtPs5Error_", 21); printf("Reflecting an error existential.\n"); if (!reflectExistential(RC, Pipe, ErrorTR)) return EXIT_SUCCESS;