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

Unified Diff: ui/gfx/color_profile_win.cc

Issue 10448110: Adds monitor ICC profile support for win and mac (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix android build Created 8 years, 5 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
Index: ui/gfx/color_profile_win.cc
diff --git a/ui/gfx/color_profile_win.cc b/ui/gfx/color_profile_win.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5c81271116cf3baf79b027910a06b69015d36435
--- /dev/null
+++ b/ui/gfx/color_profile_win.cc
@@ -0,0 +1,35 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/gfx/color_profile.h"
+
+#include <windows.h>
+
+#include "base/file_util.h"
+
+namespace gfx {
+
+void ReadColorProfile(std::vector<char>* profile) {
+ // TODO: support multiple monitors.
+ HDC screen_dc = GetDC(NULL);
+ DWORD path_len = MAX_PATH;
+ WCHAR path[MAX_PATH + 1];
+
+ BOOL res = GetICMProfile(screen_dc, &path_len, path);
+ ReleaseDC(NULL, screen_dc);
+ if (!res)
+ return;
+ std::string profileData;
+ if (!file_util::ReadFileToString(FilePath(path), &profileData))
+ return;
+ size_t length = profileData.size();
+ if (length > gfx::kMaxProfileLength)
+ return;
+ if (length < gfx::kMinProfileLength)
+ return;
+ profile->assign(profileData.data(), profileData.data() + length);
+}
+
+} // namespace gfx
+
« ui/gfx/color_profile_mac.cc ('K') | « ui/gfx/color_profile_mac.cc ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698