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

Side by Side Diff: gfx/win_util.cc

Issue 6246027: Move src/gfx/ to src/ui/gfx... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « gfx/win_util.h ('k') | gpu/gpu.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 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 "gfx/win_util.h"
6
7 #include <windows.h>
8
9 #include "base/win/windows_version.h"
10
11 namespace {
12
13 bool DynamicLibraryPresent(const wchar_t* lib_name) {
14 HINSTANCE lib = LoadLibrary(lib_name);
15 if (lib) {
16 FreeLibrary(lib);
17 return true;
18 }
19 return false;
20 }
21
22 } // namespace
23
24 namespace gfx {
25
26 // Returns true if Direct2d is available, false otherwise.
27 bool Direct2dIsAvailable() {
28 static bool checked = false;
29 static bool available = false;
30
31 if (!checked) {
32 base::win::Version version = base::win::GetVersion();
33 if (version < base::win::VERSION_VISTA)
34 available = false;
35 else if (version >= base::win::VERSION_WIN7)
36 available = true;
37 else
38 available = DynamicLibraryPresent(L"d2d1.dll");
39 checked = true;
40 }
41 return available;
42 }
43
44 // Returns true if DirectWrite is available, false otherwise.
45 bool DirectWriteIsAvailable() {
46 static bool checked = false;
47 static bool available = false;
48
49 if (!checked) {
50 base::win::Version version = base::win::GetVersion();
51 if (version < base::win::VERSION_VISTA)
52 available = false;
53 else if (version >= base::win::VERSION_WIN7)
54 available = true;
55 else
56 available = DynamicLibraryPresent(L"dwrite.dll");
57 checked = true;
58 }
59 return available;
60 }
61
62 } // namespace gfx
63
OLDNEW
« no previous file with comments | « gfx/win_util.h ('k') | gpu/gpu.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698