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> | |
Noel Gordon
2012/07/16 12:14:27
I'd maybe remove these includes (lines 7 and 8).
tpayne
2012/07/16 23:44:16
I think I'm no longer using <stdio.h>, but why rem
| |
8 #include <windows.h> | |
9 | |
10 #include "base/file_util.h" | |
11 | |
12 namespace gfx { | |
13 | |
14 void ReadColorProfile(std::vector<char>* profile) { | |
15 // TODO: support multiple monitors. | |
16 HDC screen_dc = GetDC(NULL); | |
17 DWORD path_len = MAX_PATH; | |
18 WCHAR path[MAX_PATH + 1]; | |
19 | |
20 BOOL res = GetICMProfile(screen_dc, &path_len, path); | |
21 ReleaseDC(NULL, screen_dc); | |
22 if (!res) | |
23 return; | |
24 std::string profileData; | |
25 if (!file_util::ReadFileToString(FilePath(path), &profileData)) | |
26 return; | |
27 size_t length = profileData.size(); | |
28 if (length > gfx::kMaxProfileLength) | |
29 return; | |
30 if (length < gfx::kMinProfileLength) | |
31 return; | |
32 profile->assign(profileData.data(), profileData.data() + length); | |
33 } | |
34 | |
35 } // namespace gfx | |
36 | |
OLD | NEW |