OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 SInt32 minor = 0; | 75 SInt32 minor = 0; |
76 // These selectors don't exist pre 10.4 but as we check the error | 76 // These selectors don't exist pre 10.4 but as we check the error |
77 // the function will correctly return NO which is the right answer. | 77 // the function will correctly return NO which is the right answer. |
78 result = ((::Gestalt(gestaltSystemVersionMajor, &major) == noErr) && | 78 result = ((::Gestalt(gestaltSystemVersionMajor, &major) == noErr) && |
79 (::Gestalt(gestaltSystemVersionMinor, &minor) == noErr) && | 79 (::Gestalt(gestaltSystemVersionMinor, &minor) == noErr) && |
80 ((major > 10) || (major == 10 && minor >= 5))); | 80 ((major > 10) || (major == 10 && minor >= 5))); |
81 isCached = true; | 81 isCached = true; |
82 } | 82 } |
83 return result; | 83 return result; |
84 } | 84 } |
| 85 |
| 86 // Returns whether OS is 10.6 (Snow Leopard) or higher. |
| 87 bool IsMacOSTenSixOrHigher() { |
| 88 static bool isCached = false, result = false; |
| 89 |
| 90 if (!isCached) { |
| 91 SInt32 major = 0; |
| 92 SInt32 minor = 0; |
| 93 // These selectors don't exist pre 10.4 but as we check the error |
| 94 // the function will correctly return NO which is the right answer. |
| 95 result = ((::Gestalt(gestaltSystemVersionMajor, &major) == noErr) && |
| 96 (::Gestalt(gestaltSystemVersionMinor, &minor) == noErr) && |
| 97 ((major > 10) || (major == 10 && minor >= 6))); |
| 98 isCached = true; |
| 99 } |
| 100 return result; |
| 101 } |
85 | 102 |
86 | |
87 Rect CGRect2Rect(const CGRect &inRect) { | 103 Rect CGRect2Rect(const CGRect &inRect) { |
88 Rect outRect; | 104 Rect outRect; |
89 outRect.left = inRect.origin.x; | 105 outRect.left = inRect.origin.x; |
90 outRect.top = inRect.origin.y; | 106 outRect.top = inRect.origin.y; |
91 outRect.right = inRect.origin.x + inRect.size.width; | 107 outRect.right = inRect.origin.x + inRect.size.width; |
92 outRect.bottom = inRect.origin.y + inRect.size.height; | 108 outRect.bottom = inRect.origin.y + inRect.size.height; |
93 return outRect; | 109 return outRect; |
94 } | 110 } |
95 | 111 |
96 | 112 |
(...skipping 28 matching lines...) Expand all Loading... |
125 CGContextAddArcToPoint(context, lx, ty, lx, cy, radius); | 141 CGContextAddArcToPoint(context, lx, ty, lx, cy, radius); |
126 CGContextClosePath(context); | 142 CGContextClosePath(context); |
127 | 143 |
128 if (fill) | 144 if (fill) |
129 CGContextFillPath(context); | 145 CGContextFillPath(context); |
130 else | 146 else |
131 CGContextStrokePath(context); | 147 CGContextStrokePath(context); |
132 } | 148 } |
133 | 149 |
134 } // namespace o3d | 150 } // namespace o3d |
OLD | NEW |