Commit Graph
30 Commits
Author SHA1 Message Date
Antoine Mercadal f9275a70af FIXED: New warnings reveleaded by ivar type checking
This patch fixes all new warnings
2014-11-06 10:17:05 -08:00
Alexandre Wilhelm fc4413d56b Changed clockWise to isClockWise 2013-05-24 14:15:54 -07:00
Alexandre Wilhelm 25f54c83ed Added method CGPathContainsPoint 2013-05-24 11:53:33 -07:00
Alexandre Wilhelm b5df5f730b Fixed: CGPath is wrong when creating an arc
Previously when creating a CGPath with an arc, the path was wrong. It added a line when it wasn't necessary and when it was necessary it added a line to a wrong point.
Now CGPath works like in cocoa (If the specified path already contains a subpath, Quartz implicitly adds a line connecting the subpath’s current point to the beginning of the arc. If the path is empty, Quartz creates a new subpath with a starting point set to the starting point of the arc.)

Test app in Tests/Manual/CGPath/AppController.j
2013-05-23 14:07:04 -07:00
Aparajita Fishman afd5925499 Fixed: _CG and _CP macros were confusing and could degrade performance
Previously, Cappuccino was using preprocessor macros internally for the CGPoint/Size/Rect/Inset/Affine functions, as well as for CPRange. These macros had the same name as the corresponding function, but began with _. The functions were actually defined using the macros.

The motivation behind using macros was to increase performance by reducing function calls. However, there were a number of problems with this approach:

- There was an artificial dichotomy between _CG macros and the corresponding CG functions. We never completely replaced CG function calls with _CG macros. In fact, they were often mixed up in the same file. There was an extra burden on the programmer to remember to use the macro instead of the function.
- If a method call was passed as an argument to a macro, performance could actually be significantly *worse* than a function call. For example, _CGGetRectMakeCopy([view frame]) would expand to `{ origin:{ x:[view frame].origin.x, y:[view frame].origin.y }, size:{ width:[view frame].size.width, height:[view frame].size.height } }`. So instead of a single objj_msgSend and a single simple function call, we ended up with 4 objj_msgSend calls, which are way more expensive than simple function calls.
- Because of this expansion problem, to use macros efficiently required us to remember to use variables for all macro parameters. This didn't happen, and shouldn't have to happen.
- Finally, with modern Javascript engines, function call overhead is so small that it really isn't worth using the macros.

This commit eliminates the _CGGeometry, CGAffineTransformation and CPRange macros and replaces them with function calls.

BREAKING CHANGE:
The macros are no longer available. They could only be used with compiled code, but if there is any user code that used them, they will have to be replaced with the corresponding functions.
2013-03-13 12:22:10 -04:00
Alexander Ljungberg a0b9efe1fd Fixed: CGPathMoveToPoint problem after a0115962.
Without this fix, CGPathMoveToPoint would not actually move to the point if there had been at least one previous CGPath command (a current path existed) but it was not a move to point command.

This fix ensures move to point is effective in all cases.

Fixes #1801.
2013-02-26 16:27:54 +00:00
Aparajita Fishman 2cb3450cf8 Fixed: CGPathEqualToPath did not compare all subpath types
The implementation of CGPathEqualToPath did not compare all of the subpath types now supported by CGPath. In addition, it referred to subpath properties that no longer exist.

The implementation now compares all properties of all supported subpath types.

Closes #1246
2013-02-26 08:41:27 -05:00
Martin Carlberg 93c9a70aa0 Fixed typo 2013-02-26 12:44:37 +01:00
Aparajita Fishman a011596231 CGContext fixes/enhancements
- NEW: Retrieve the underlying Image element from a CPImage with -image.
- NEW: You can now render any arbitrary drawing to a pattern context and use that as a fill or stroke pattern. See CGContextCreatePatternContext, CGContextSetFillPattern and CGContextSetStrokePattern. Works in all canvas-enabled browsers, including IE 9+.
- NEW: An example of using a custom rendered pattern is in Tests/Manual/PatternFillTest.
- NEW: Test if a CPImage is a single image (vs. three/nine part) with -isSingleImage.
- FIXED: With canvas, we have to track ourselves whether the context has a path or not.
- FIXED: All shapes except rects may not be added to a path with no context. If you attempt to do so, an error is logged.
- FIXED: CGPath was not setting the start and current point correctly in some cases.
- FIXED: CGContextAddPath was not moving to the path's start point at the beginning.
- FIXED: Removed superfluous CGContextClosePath commands, fixed some drawing sequences.
- FIXED: Misc. formatting.

Sorry, these changes are canvas only (including IE 9+)! I am not going to spend the time to port these fixes to VML (IE 8).
2013-02-23 13:53:20 -05:00
Aparajita Fishman f590d38746 Revert "Fixed a bunch of bugs in CGContextCanvas and CGPath."
This reverts commit 7ab84ca607 until I can figure out why it is breaking other things.
2013-02-22 16:56:19 -05:00
Aparajita Fishman 7ab84ca607 Fixed a bunch of bugs in CGContextCanvas and CGPath.
- With canvas, we have to track ourselves whether the context has a path or not.
- All shapes except rects may not be added to a path with no context.
- CGPath was not setting the start and current point correctly in some cases.
- CGContextAddPath was not moving to the path's start point at the beginning.

Sorry, I am not going to spend the time to port these fixes to VML!
2013-02-21 21:44:16 -05:00
Adam Radabaugh a774e52988 Fixes formatting and style for missing CGCanvasContext functions. Adds CGCanvasContext test. 2013-02-19 14:10:39 -07:00
Alexander Ljungberg a63f185ba9 Refs #1778. Store clockwise parameter with right name.
The name has to match what we ultimately use in CGContextCanvas and CGContextVML.
2013-02-19 11:50:47 +00:00
Andrew Hankinson b9a97931c8 Formatting CGPath.j 2013-02-18 23:26:15 -05:00
Andrew Hankinson 4ec3b5e387 This fix adds a missing isClockwise property
Without this fix, the isClockwise property is not stored for use in CGPathAddPath.

C.F. https://github.com/cappuccino/cappuccino/blob/master/AppKit/CoreGraphics/CGPath.j#L195

This is a partial fix for #578.
2013-02-18 23:02:28 -05:00
Aparajita Fishman 866e1f00f7 Objj2 compiler fixes
- Each file compiles individually with no errors or warnings.
- Added missing imports.
- Fixed imports to remove circularity.
- Removed unnecessary imports.
- Added missing headers.
- Added missing action_button.png.
- Replace CPMakeRect with CGRectMake.
2013-01-23 15:48:56 +07:00
Alexander Ljungberg eba3e95b81 CPBezierPath controlPointBounds and CGPathGetBoundingBox. 2012-10-15 11:10:23 +01:00
Alexander Ljungberg ca4e034a3b CPBezierPath appendBezierPathWithArcFromPoint:toPoint:radius: and CGPathAddArcToPoint. 2012-10-15 02:47:37 +01:00
Randall Luecke 561d22168a Stop references function arguments with arguments["name"] in CG. 2011-04-20 12:19:29 -04:00
Alexander Ljungberg 651d6a7ed8 Linting AppKit. 2011-02-28 23:48:34 -03:00
Francisco Ryan Tolmasky I d69f46f7ee More capp_linting.
Reviewed by me.
2010-12-09 13:45:29 -08:00
Francisco Ryan Tolmasky I 52f7844aee Made it so .h files are automatically included in AppKit (avoiding needing to manually include Platform.h, etc.).
Also changed a bunch of <AppKit/*> imports to "*" imports.

Reviewed by me.
2010-11-01 11:10:01 -07:00
Emmanuel MaillardandRoss Boucher b7b2dd2915 - CGPathAddQuadCurveToPoint fix for an unknown variable when using a transformation matrix 2010-03-26 10:36:08 -07:00
Ross Boucher a710dc974f Fix for VML paths 2009-05-31 19:17:36 -07:00
Ross Boucher 35947697f2 Fix for KAPPA missing in CGPath. Looks like it was auto-merged out. 2009-05-31 12:12:51 -07:00
Ross Boucher 850125b8ab Add documentation groups 2009-05-18 15:43:36 -07:00
Ross Boucher e05816419e Some documentation enhancements. 2009-05-14 22:48:42 -07:00
Ross Boucher 9c7f07979b Add CPBezierPath, clean up some of CGPath and CGContext 2009-05-14 19:06:58 -07:00
Francisco Ryan Tolmasky I 5144a5a579 Added @accessor support, @import, and fixed spacing bug with @selector.
Reviewed by ross.
2008-10-26 00:48:49 -07:00
Francisco Ryan Tolmasky I a97bb72800 Initial commit.
Reviewed by francisco, ross and tom.
2008-09-04 03:52:20 -07:00