| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. All rights reserve
d. | 2 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. All rights reserve
d. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #import "config.h" | 26 #import "config.h" |
| 27 #import "platform/mac/ColorMac.h" | 27 #import "platform/mac/ColorMac.h" |
| 28 | 28 |
| 29 #import <wtf/RetainPtr.h> | 29 #import <wtf/RetainPtr.h> |
| 30 #import <wtf/StdLibExtras.h> | 30 #import <wtf/StdLibExtras.h> |
| 31 | 31 |
| 32 namespace WebCore { | 32 namespace blink { |
| 33 | 33 |
| 34 // NSColor calls don't throw, so no need to block Cocoa exceptions in this file | 34 // NSColor calls don't throw, so no need to block Cocoa exceptions in this file |
| 35 | 35 |
| 36 NSColor *nsColor(const Color& color) | 36 NSColor *nsColor(const Color& color) |
| 37 { | 37 { |
| 38 RGBA32 c = color.rgb(); | 38 RGBA32 c = color.rgb(); |
| 39 switch (c) { | 39 switch (c) { |
| 40 case 0: { | 40 case 0: { |
| 41 // Need this to avoid returning nil because cachedRGBAValues will de
fault to 0. | 41 // Need this to avoid returning nil because cachedRGBAValues will de
fault to 0. |
| 42 DEFINE_STATIC_LOCAL(RetainPtr<NSColor>, clearColor, ([NSColor colorW
ithDeviceRed:0 green:0 blue:0 alpha:0])); | 42 DEFINE_STATIC_LOCAL(RetainPtr<NSColor>, clearColor, ([NSColor colorW
ithDeviceRed:0 green:0 blue:0 alpha:0])); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 69 cachedRGBAValues[cursor] = c; | 69 cachedRGBAValues[cursor] = c; |
| 70 cachedColors[cursor] = result; | 70 cachedColors[cursor] = result; |
| 71 if (++cursor == cacheSize) | 71 if (++cursor == cacheSize) |
| 72 cursor = 0; | 72 cursor = 0; |
| 73 return result; | 73 return result; |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 | 78 |
| 79 } // namespace WebCore | 79 } // namespace blink |
| OLD | NEW |