Skip to content

Commit 7810987

Browse files
committed
Various fixes, mostly for GCC, as reported by Fred Kiefer.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/quartzcore/trunk@35429 72102866-910b-0410-8b05-ffd578937521
1 parent 1df39b0 commit 7810987

10 files changed

+109
-62
lines changed

.hgignore

+2
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ syntax: glob
77
*/*.xcworkspace/*
88
Tests/CATransform3D/catransform3d*
99
Tests/CAMediaTimingFunction/camediatimingfunction*
10+
Tests/*.app/*
1011
_notes/*
12+

ChangeLog

+28
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
2012-08-20 Ivan Vučica <[email protected]>
2+
3+
* Headers/QuartzCore/CALayer.h:
4+
GCC doesn't like that we declare a property as NSMutableArray
5+
in public header and then override that with a NSArray in
6+
class extension.
7+
8+
Added missing method declaration.
9+
10+
* Source/CAImplicitAnimationObserver.m:
11+
Making a call to -isEqual: instead of -isEqualTo:.
12+
Fixed a possible problem if actionForKey: returns nil or NSNull.
13+
14+
* Source/CALayer+DynamicProperties.h:
15+
* Source/CARenderer.m:
16+
Added missing method declarations.
17+
18+
* Source/CALayer+DynamicProperties.m:
19+
Style fixes.
20+
21+
* Source/CALayer.m:
22+
* Source/GLHelpers/CAGLTexture.m:
23+
Resolved warnings.
24+
25+
* Source/Shaders/simple.fsh:
26+
Commented out textureSize() function which broke compiling on
27+
some GPUs.
28+
129
2012-08-20 Ivan Vučica <[email protected]>
230

331
* INSTALL:

Headers/QuartzCore/CALayer.h

+6
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,12 @@ NSString *const kCATransition;
159159
@property (copy) NSDictionary *actions;
160160
/* TODO: Style property is unimplemented */
161161
@property (copy) NSDictionary *style;
162+
#if __clang__
162163
@property (retain, readonly) NSArray *animationKeys;
164+
#else
165+
#warning GCC workaround: CALayer.animationKeys publicly defined as NSMutableArray although it should not be.
166+
@property (retain, readonly) NSMutableArray *animationKeys;
167+
#endif
163168

164169
- (id) init;
165170
- (id) initWithLayer: (CALayer *)layer;
@@ -188,6 +193,7 @@ NSString *const kCATransition;
188193
- (BOOL) needsDisplay;
189194
- (void) setNeedsDisplay;
190195
- (void) setNeedsDisplayInRect: (CGRect)r;
196+
- (void) drawInContext: (CGContextRef)context;
191197
- (BOOL) needsLayout;
192198
- (void) setNeedsLayout;
193199
- (void) layoutIfNeeded;

Source/CAImplicitAnimationObserver.m

+3-1
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,12 @@ - (void) observeValueForKeyPath: (NSString *)keyPath
7676
/* Implicit animation must not be launched if model tree value
7777
is equal to the new value, even if the presentation tree value
7878
is not equal. */
79-
if ([to isEqualTo: from])
79+
if ([to isEqual: from])
8080
return;
8181

8282
NSObject<CAAction>* action = (id)[object actionForKey: keyPath];
83+
if (!action || [action isKindOfClass: [NSNull class]])
84+
return;
8385
[[CATransaction topTransaction] registerAction: action
8486
onObject: object
8587
keyPath: keyPath];

Source/CALayer+DynamicProperties.h

+4
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,8 @@
2929

3030
@interface CALayer (DynamicProperties)
3131
+ (void)_dynamicallyCreateProperty:(objc_property_t)property;
32+
33+
+ (NSDictionary *) _dynamicPropertyProcessAttributes: (objc_property_t)property;
34+
+ (IMP) _getterForKey: (NSString *)key type: (NSString *)type;
35+
+ (IMP) _setterForKey: (NSString *)key type: (NSString *)type;
3236
@end

Source/CALayer+DynamicProperties.m

+56-58
Original file line numberDiff line numberDiff line change
@@ -36,72 +36,70 @@ @implementation CALayer (DynamicProperties)
3636
+ (void) _dynamicallyCreateProperty: (objc_property_t)property
3737
{
3838

39-
NSString* name = [NSString stringWithCString:property_getName(property)
40-
encoding:NSASCIIStringEncoding];
41-
42-
NSDictionary* attributes = [self _dynamicPropertyProcessAttributes: property];
43-
44-
// create the method names
45-
NSString* getterName = [attributes valueForKey:@"getter"];
46-
47-
if (getterName == nil)
48-
{
49-
getterName = name;
50-
}
51-
52-
NSString* setterName = [attributes valueForKey:@"setter"];
53-
54-
if (setterName == nil)
55-
{
56-
setterName = [NSString stringWithFormat:@"set%@%@:",
57-
[[name substringToIndex: 1] uppercaseString],
58-
[name substringFromIndex: 1]];
59-
}
60-
61-
62-
// Set the types
63-
NSString* type = [attributes valueForKey:@"type"];
64-
NSString* getterTypes = [NSString stringWithFormat:@"%@@:", type];
65-
NSString* setterTypes = [NSString stringWithFormat:@"v@:%@", type];
66-
67-
NSString* key = [NSString stringWithFormat:@"dynamicproperty_%@_%@",
68-
NSStringFromClass([self class]),
69-
name];
70-
71-
IMP getter = [self _getterForKey: key type: type];
72-
IMP setter = [self _setterForKey: key type: type];
73-
74-
// Add getter
75-
BOOL success;
76-
success = class_addMethod([self class],
77-
NSSelectorFromString(getterName),
78-
getter,
79-
[getterTypes cStringUsingEncoding:NSASCIIStringEncoding]);
39+
NSString* name = [NSString stringWithCString: property_getName(property)
40+
encoding: NSASCIIStringEncoding];
41+
42+
NSDictionary* attributes = [self _dynamicPropertyProcessAttributes: property];
43+
44+
// create the method names
45+
NSString* getterName = [attributes valueForKey: @"getter"];
46+
if (getterName == nil)
47+
{
48+
getterName = name;
49+
}
50+
51+
NSString* setterName = [attributes valueForKey: @"setter"];
52+
53+
if (setterName == nil)
54+
{
55+
setterName = [NSString stringWithFormat: @"set%@%@:",
56+
[[name substringToIndex: 1] uppercaseString],
57+
[name substringFromIndex: 1]];
58+
}
8059

81-
if (!success)
82-
{
83-
[NSException raise:NSGenericException
84-
format:@"Could not add method %@", getterName];
85-
86-
}
8760

88-
// Add setter
89-
success = class_addMethod([self class],
90-
NSSelectorFromString(setterName),
91-
setter,
92-
[setterTypes cStringUsingEncoding:NSASCIIStringEncoding]);
61+
// Set the types
62+
NSString* type = [attributes valueForKey: @"type"];
63+
NSString* getterTypes = [NSString stringWithFormat: @"%@@:", type];
64+
NSString* setterTypes = [NSString stringWithFormat: @"v@:%@", type];
9365

94-
if (!success)
95-
{
96-
[NSException raise:NSGenericException
97-
format:@"Could not add method %@", setterName];
66+
NSString* key = [NSString stringWithFormat: @"dynamicproperty_%@_%@",
67+
NSStringFromClass([self class]),
68+
name];
9869

99-
}
70+
IMP getter = [self _getterForKey: key type: type];
71+
IMP setter = [self _setterForKey: key type: type];
72+
73+
// Add getter
74+
BOOL success;
75+
success = class_addMethod([self class],
76+
NSSelectorFromString(getterName),
77+
getter,
78+
[getterTypes cStringUsingEncoding: NSASCIIStringEncoding]);
79+
80+
if (!success)
81+
{
82+
[NSException raise: NSGenericException
83+
format: @"Could not add method %@", getterName];
84+
}
85+
86+
// Add setter
87+
success = class_addMethod([self class],
88+
NSSelectorFromString(setterName),
89+
setter,
90+
[setterTypes cStringUsingEncoding: NSASCIIStringEncoding]);
10091

92+
if (!success)
93+
{
94+
[NSException raise: NSGenericException
95+
format: @"Could not add method %@", setterName];
96+
}
97+
10198
}
10299

103100

104-
+ (NSDictionary *) _dynamicPropertyProcessAttributes: (objc_property_t)property {
101+
+ (NSDictionary *) _dynamicPropertyProcessAttributes: (objc_property_t)property
102+
{
105103

106104
NSString * attributes = [NSString stringWithCString: property_getAttributes(property)
107105
encoding: NSASCIIStringEncoding];

Source/CALayer.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ - (NSString *)description
396396

397397
/* *** properties *** */
398398
#if GNUSTEP
399-
#warning KVO under GNUstep doesn't work without custom setters for any struct type!
399+
#warning KVO under GNUstep does not work without custom setters for any struct type!
400400
/* For more info, refer to NSKeyValueObserving.m. */
401401
/* Once we implement @dynamic generation, this won't be important, but
402402
it's still a GNUstep bug. */

Source/CARenderer.m

+6
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ - (void) _determineAndScheduleRasterizationForLayer: (CALayer *) layer;
5959
- (void) _scheduleRasterization: (CALayer *) layer;
6060
- (void) _rasterize: (NSDictionary *) rasterizationSpec;
6161
- (void) _rasterizeAll;
62+
- (void) _updateLayer: (CALayer *)layer
63+
atTime: (CFTimeInterval)theTime;
64+
- (void) _renderLayer: (CALayer *)layer
65+
withTransform: (CATransform3D)transform;
66+
- (id) initWithNSOpenGLContext: (NSOpenGLContext*)ctx
67+
options: options;
6268
@end
6369

6470
@implementation CARenderer

Source/GLHelpers/CAGLTexture.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ - (void)loadImage: (CGImageRef) image
166166
#if !GNUSTEP
167167
CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB(); //CGImageGetColorSpace(image); // if we get indexed-colorspace image, creation of bitmap context will fail. also, we load image into OpenGL as RGB. so, force RGB
168168
#else
169-
#warning Opal doesn't like CGColorSpaceCreateDeviceRGB() passed as colorpsace for bitmap context
169+
#warning Opal does not like CGColorSpaceCreateDeviceRGB() passed as colorpsace for bitmap context
170170
CGColorSpaceRef space = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);// 2
171171
#endif
172172

Source/Shaders/simple.fsh

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ varying mediump vec2 fragmentTextureCoordinates;
3030
varying vec2 fragmentTextureCoordinates;
3131
#endif
3232

33-
33+
/*
3434
vec2 textureSize(sampler2DRect sampler, int lod)
3535
{
3636
// function unavailable before GLSL 1.30!
@@ -41,6 +41,7 @@ vec2 textureSize(sampler2DRect sampler, int lod)
4141
4242
return vec2(512.0, 512.0);
4343
}
44+
*/
4445

4546
void main()
4647
{

0 commit comments

Comments
 (0)