Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: ui/gfx/color_profile_win.cc

Issue 10448110: Adds monitor ICC profile support for win and mac (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Addressed feedback Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW
« ui/gfx/color_profile.h ('K') | « ui/gfx/color_profile_mac.cc ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698