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

Side by Side Diff: ui/gfx/win/scoped_set_map_mode.h

Issue 23769011: Move a bunch of windows stuff from ui/base/win to ui/gfx/win (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moar bustage. Created 7 years, 3 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 | « ui/gfx/win/hwnd_util.cc ('k') | ui/gfx/win/singleton_hwnd.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_BASE_WIN_SCOPED_SET_MAP_MODE_H_ 5 #ifndef UI_GFX_WIN_SCOPED_SET_MAP_MODE_H_
6 #define UI_BASE_WIN_SCOPED_SET_MAP_MODE_H_ 6 #define UI_GFX_WIN_SCOPED_SET_MAP_MODE_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 12
13 namespace ui { 13 namespace gfx {
14 14
15 // Helper class for setting and restore the map mode on a DC. 15 // Helper class for setting and restore the map mode on a DC.
16 class ScopedSetMapMode { 16 class ScopedSetMapMode {
17 public: 17 public:
18 ScopedSetMapMode(HDC hdc, int map_mode) 18 ScopedSetMapMode(HDC hdc, int map_mode)
19 : hdc_(hdc), 19 : hdc_(hdc),
20 old_map_mode_(SetMapMode(hdc, map_mode)) { 20 old_map_mode_(SetMapMode(hdc, map_mode)) {
21 DCHECK(hdc_); 21 DCHECK(hdc_);
22 DCHECK_NE(map_mode, 0); 22 DCHECK_NE(map_mode, 0);
23 DCHECK_NE(old_map_mode_, 0); 23 DCHECK_NE(old_map_mode_, 0);
24 } 24 }
25 25
26 ~ScopedSetMapMode() { 26 ~ScopedSetMapMode() {
27 const int mode = SetMapMode(hdc_, old_map_mode_); 27 const int mode = SetMapMode(hdc_, old_map_mode_);
28 DCHECK_NE(mode, 0); 28 DCHECK_NE(mode, 0);
29 } 29 }
30 30
31 private: 31 private:
32 HDC hdc_; 32 HDC hdc_;
33 int old_map_mode_; 33 int old_map_mode_;
34 34
35 DISALLOW_COPY_AND_ASSIGN(ScopedSetMapMode); 35 DISALLOW_COPY_AND_ASSIGN(ScopedSetMapMode);
36 }; 36 };
37 37
38 } // namespace ui 38 } // namespace gfx
39 39
40 #endif // UI_BASE_WIN_SCOPED_SET_MAP_MODE_H_ 40 #endif // UI_GFX_WIN_SCOPED_SET_MAP_MODE_H_
OLDNEW
« no previous file with comments | « ui/gfx/win/hwnd_util.cc ('k') | ui/gfx/win/singleton_hwnd.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698