| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /* | 5 /* |
| 6 * Copyright (C) 2010 Google Inc. All rights reserved. | 6 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 7 * Copyright (C) 2012 Apple Inc. | 7 * Copyright (C) 2012 Apple Inc. |
| 8 * | 8 * |
| 9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
| 10 * modification, are permitted provided that the following conditions are | 10 * modification, are permitted provided that the following conditions are |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 CFDictionaryRef device_info = ColorSyncDeviceCopyDeviceInfo( | 63 CFDictionaryRef device_info = ColorSyncDeviceCopyDeviceInfo( |
| 64 kColorSyncDisplayDeviceClass, main_display_id); | 64 kColorSyncDisplayDeviceClass, main_display_id); |
| 65 | 65 |
| 66 if (!device_info) { | 66 if (!device_info) { |
| 67 NSLog(@"No display attached to system; not setting main display's color " | 67 NSLog(@"No display attached to system; not setting main display's color " |
| 68 "profile."); | 68 "profile."); |
| 69 CFRelease(main_display_id); | 69 CFRelease(main_display_id); |
| 70 return; | 70 return; |
| 71 } | 71 } |
| 72 | 72 |
| 73 CFDictionaryRef factory_info = |
| 74 (CFDictionaryRef)CFDictionaryGetValue(device_info, |
| 75 kColorSyncFactoryProfiles); |
| 76 |
| 77 if (!factory_info) { |
| 78 NSLog(@"No no factory info; not setting main display's color " |
| 79 "profile."); |
| 80 CFRelease(device_info); |
| 81 CFRelease(main_display_id); |
| 82 return; |
| 83 } |
| 84 |
| 85 CFStringRef default_profile_id = |
| 86 (CFStringRef)CFDictionaryGetValue(factory_info, |
| 87 kColorSyncDeviceDefaultProfileID); |
| 88 |
| 89 if (!default_profile_id) { |
| 90 NSLog(@"No no default profile id; not setting main display's color " |
| 91 "profile."); |
| 92 CFRelease(factory_info); |
| 93 CFRelease(device_info); |
| 94 CFRelease(main_display_id); |
| 95 return; |
| 96 } |
| 97 |
| 73 CFDictionaryRef profile_info = (CFDictionaryRef)CFDictionaryGetValue( | 98 CFDictionaryRef profile_info = (CFDictionaryRef)CFDictionaryGetValue( |
| 74 device_info, kColorSyncCustomProfiles); | 99 device_info, kColorSyncCustomProfiles); |
| 75 if (profile_info) { | 100 if (profile_info) { |
| 76 user_color_profile_url = | 101 user_color_profile_url = |
| 77 (CFURLRef)CFDictionaryGetValue(profile_info, CFSTR("1")); | 102 (CFURLRef)CFDictionaryGetValue(profile_info, default_profile_id); |
| 78 CFRetain(user_color_profile_url); | 103 CFRetain(user_color_profile_url); |
| 79 } else { | 104 } else { |
| 80 profile_info = (CFDictionaryRef)CFDictionaryGetValue( | 105 profile_info = (CFDictionaryRef)CFDictionaryGetValue( |
| 81 device_info, kColorSyncFactoryProfiles); | 106 device_info, kColorSyncFactoryProfiles); |
| 82 CFDictionaryRef factory_profile = | 107 CFDictionaryRef factory_profile = |
| 83 (CFDictionaryRef)CFDictionaryGetValue(profile_info, CFSTR("1")); | 108 (CFDictionaryRef)CFDictionaryGetValue(profile_info, |
| 109 default_profile_id); |
| 84 user_color_profile_url = (CFURLRef)CFDictionaryGetValue( | 110 user_color_profile_url = (CFURLRef)CFDictionaryGetValue( |
| 85 factory_profile, kColorSyncDeviceProfileURL); | 111 factory_profile, kColorSyncDeviceProfileURL); |
| 86 CFRetain(user_color_profile_url); | 112 CFRetain(user_color_profile_url); |
| 87 } | 113 } |
| 88 | 114 |
| 115 CFRelease(default_profile_id); |
| 116 CFRelease(factory_info); |
| 117 CFRelease(device_info); |
| 89 CFRelease(device_info); | 118 CFRelease(device_info); |
| 90 } | 119 } |
| 91 | 120 |
| 92 ColorSyncProfileRef generic_rgb_profile = | 121 ColorSyncProfileRef generic_rgb_profile = |
| 93 ColorSyncProfileCreateWithName(kColorSyncGenericRGBProfile); | 122 ColorSyncProfileCreateWithName(kColorSyncGenericRGBProfile); |
| 94 CFErrorRef error; | 123 CFErrorRef error; |
| 95 CFURLRef profile_url = ColorSyncProfileGetURL(generic_rgb_profile, &error); | 124 CFURLRef profile_url = ColorSyncProfileGetURL(generic_rgb_profile, &error); |
| 96 if (!profile_url) { | 125 if (!profile_url) { |
| 97 NSLog(@"Failed to get URL of Generic RGB color profile! Many pixel tests " | 126 NSLog(@"Failed to get URL of Generic RGB color profile! Many pixel tests " |
| 98 "may fail as a result. Error: %@", | 127 "may fail as a result. Error: %@", |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 | 284 |
| 256 // Wait for any key (or signal). | 285 // Wait for any key (or signal). |
| 257 getchar(); | 286 getchar(); |
| 258 | 287 |
| 259 // Restore the profile. | 288 // Restore the profile. |
| 260 RestoreUserColorProfile(); | 289 RestoreUserColorProfile(); |
| 261 | 290 |
| 262 [pool release]; | 291 [pool release]; |
| 263 return 0; | 292 return 0; |
| 264 } | 293 } |
| OLD | NEW |