Index: ui/gfx/screen_compatible_dc_win.h |
=================================================================== |
--- ui/gfx/screen_compatible_dc_win.h (revision 0) |
+++ ui/gfx/screen_compatible_dc_win.h (revision 0) |
@@ -0,0 +1,32 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef UI_GFX_SCREEN_COMPATIBLE_DC_WIN_H_ |
+#define UI_GFX_SCREEN_COMPATIBLE_DC_WIN_H_ |
+#pragma once |
+ |
+#include <windows.h> |
+ |
+#include "base/basictypes.h" |
+ |
+namespace gfx { |
+ |
+// Temporary device context that is compatible with the screen. Can be used for |
+// short-lived operations on the UI threads. |
+class ScopedTemporaryScreenCompatibleDC { |
+ public: |
+ ScopedTemporaryScreenCompatibleDC(); |
+ ~ScopedTemporaryScreenCompatibleDC(); |
+ |
+ operator HDC() { return hdc_; } |
sky
2012/02/03 23:14:42
Is there a reason you like this better than a stat
Alexei Svitkine (slow)
2012/02/06 14:37:38
I based this off of base::win::ScopedCreateDC, whi
sky
2012/02/06 16:43:08
The style guide recommends against it, so I say go
|
+ |
+ private: |
+ HDC hdc_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ScopedTemporaryScreenCompatibleDC); |
+}; |
+ |
+} // namespace gfx |
+ |
+#endif // UI_GFX_SCREEN_COMPATIBLE_DC_WIN_H_ |