Add a stub __cxa_demangle to disable LLVM's demangler.
[chromium-blink-merge.git] / ui / gfx / color_profile_win.cc
blob9b7a32c677c37e5e3821bfe5aec011edc3068668
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.
5 #include "ui/gfx/color_profile.h"
7 #include <windows.h>
8 #include <map>
10 #include "base/files/file_util.h"
11 #include "base/lazy_instance.h"
12 #include "base/synchronization/lock.h"
14 namespace gfx {
16 void ReadColorProfile(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 + 1];
22 BOOL result = GetICMProfile(screen_dc, &path_len, path);
23 ReleaseDC(NULL, screen_dc);
24 if (!result)
25 return;
26 std::string profileData;
27 if (!base::ReadFileToString(base::FilePath(path), &profileData))
28 return;
29 size_t length = profileData.size();
30 if (gfx::InvalidColorProfileLength(length))
31 return;
32 profile->assign(profileData.data(), profileData.data() + length);
35 } // namespace gfx