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..149e4f1bb5d4d2cfa03547133df8e0b8f974bce6 |
--- /dev/null |
+++ b/ui/gfx/color_profile_win.cc |
@@ -0,0 +1,36 @@ |
+// 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" |
+ |
+ |
sky
2012/07/18 14:36:18
remove newline.
tpayne
2012/07/18 17:41:52
Done.
|
+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]; |
sky
2012/07/18 14:36:18
MAX_PATH -> path_len
tpayne
2012/07/18 17:41:52
Done.
tpayne
2012/07/18 21:18:19
Undone. Doesn't compile.
|
+ |
+ 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 |
+ |