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..59d4572577caa241696dd3f544e685a854066a00 |
--- /dev/null |
+++ b/ui/gfx/color_profile_win.cc |
@@ -0,0 +1,39 @@ |
+// 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 <stdio.h> |
+#include <windows.h> |
+ |
+#include "base/file_util.h" |
+#include "base/sys_byteorder.h" |
Noel Gordon
2012/07/03 14:40:30
This include is not used anymore.
tpayne
2012/07/13 22:24:40
Done.
|
+ |
+namespace gfx { |
+ |
+void ReadColorProfile(gfx::NativeViewId parent_window, |
+ std::vector<char>* profile) { |
+ // TODO: support multiple monitors. |
+ HDC screen_dc = GetDC(NULL); |
+ DWORD path_len = MAX_PATH; |
+ WCHAR path[MAX_PATH]; |
Noel Gordon
2012/07/03 14:40:30
MAX_PATH + 1
tpayne
2012/07/13 22:24:40
Done.
|
+ |
+ BOOL res = GetICMProfile(screen_dc, |
+ &path_len, |
+ reinterpret_cast<LPWSTR>(&path)); |
Noel Gordon
2012/07/03 14:40:30
This current code appears to spray the stack with
tpayne
2012/07/13 22:24:40
Done.
|
+ ReleaseDC(NULL, screen_dc); |
+ if (!res) |
+ return; |
+ std::string profileData; |
+ if (!file_util::ReadFileToString(FilePath(path), &profileData)) |
+ return; |
+ if (profileData.size() > MAX_PROFILE_LENGTH) |
+ return; |
+ if (profileData.size() < MIN_PROFILE_LENGTH) |
+ return; |
+ profile->assign(profileData.data(), profileData.data() + profileData.size()); |
+} |
+ |
+} // namespace gfx |
+ |