OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ui/gfx/color_profile.h" | |
6 | |
7 #include <stdio.h> | |
8 #include <windows.h> | |
9 | |
10 #include "base/file_util.h" | |
11 #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.
| |
12 | |
13 namespace gfx { | |
14 | |
15 void ReadColorProfile(gfx::NativeViewId parent_window, | |
16 std::vector<char>* profile) { | |
17 // TODO: support multiple monitors. | |
18 HDC screen_dc = GetDC(NULL); | |
19 DWORD path_len = MAX_PATH; | |
20 WCHAR path[MAX_PATH]; | |
Noel Gordon
2012/07/03 14:40:30
MAX_PATH + 1
tpayne
2012/07/13 22:24:40
Done.
| |
21 | |
22 BOOL res = GetICMProfile(screen_dc, | |
23 &path_len, | |
24 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.
| |
25 ReleaseDC(NULL, screen_dc); | |
26 if (!res) | |
27 return; | |
28 std::string profileData; | |
29 if (!file_util::ReadFileToString(FilePath(path), &profileData)) | |
30 return; | |
31 if (profileData.size() > MAX_PROFILE_LENGTH) | |
32 return; | |
33 if (profileData.size() < MIN_PROFILE_LENGTH) | |
34 return; | |
35 profile->assign(profileData.data(), profileData.data() + profileData.size()); | |
36 } | |
37 | |
38 } // namespace gfx | |
39 | |
OLD | NEW |