Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(752)

Unified Diff: ui/gfx/color_profile_mac.mm

Issue 849523003: ui/gfx/color_profile: Add GetDisplayColorProfile for an NSWindow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/color_profile.cc ('k') | ui/gfx/color_profile_mac_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/color_profile_mac.mm
diff --git a/ui/gfx/color_profile_mac.mm b/ui/gfx/color_profile_mac.mm
index a7eda3731b9d4d6fae48e1b2b5662b2a3119a129..1d4b00ef6c09b710e1bfc61a3d4da2d697e18c50 100644
--- a/ui/gfx/color_profile_mac.mm
+++ b/ui/gfx/color_profile_mac.mm
@@ -54,6 +54,24 @@ bool GetDisplayColorProfile(const gfx::Rect& bounds,
return true;
}
+GFX_EXPORT bool GetDisplayColorProfile(gfx::NativeWindow window,
+ std::vector<char>* profile) {
+ DCHECK(profile->empty());
+
+ NSColorSpace* color_space = [window colorSpace];
+ if (!color_space || NSIsEmptyRect([window frame]))
+ return false;
+
+ if ([color_space isEqual:[NSColorSpace sRGBColorSpace]])
+ return true;
+ NSData* profile_data = [color_space ICCProfileData];
+ const char* data = static_cast<const char*>([profile_data bytes]);
+ size_t length = [profile_data length];
+ if (data && !gfx::InvalidColorProfileLength(length))
+ profile->assign(data, data + length);
+ return true;
+}
+
void ReadColorProfile(std::vector<char>* profile) {
CGColorSpaceRef monitor_color_space(base::mac::GetSystemColorSpace());
base::ScopedCFTypeRef<CFDataRef> icc_profile(
« no previous file with comments | « ui/gfx/color_profile.cc ('k') | ui/gfx/color_profile_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698