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

Unified Diff: ui/gfx/screen_win.cc

Issue 9323011: Cache a screen compatible DC to avoid re-creating it excessively. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: . Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ui/gfx/screen_win.cc
===================================================================
--- ui/gfx/screen_win.cc (revision 120215)
+++ ui/gfx/screen_win.cc (working copy)
@@ -20,6 +20,9 @@
namespace gfx {
// static
+HDC Screen::compatible_dc_ = NULL;
+
+// static
gfx::Point Screen::GetCursorScreenPoint() {
POINT pt;
GetCursorPos(&pt);
@@ -102,4 +105,19 @@
return GetSystemMetrics(SM_CMONITORS);
}
+// static
+HDC Screen::GetCompatibleDC() {
+ if (!compatible_dc_)
+ compatible_dc_ = CreateCompatibleDC(NULL);
+ return compatible_dc_;
+}
+
+// static
+void Screen::ReleaseCompatibleDC() {
+ if (compatible_dc_) {
+ DeleteDC(compatible_dc_);
+ compatible_dc_ = NULL;
+ }
+}
+
} // namespace gfx

Powered by Google App Engine
This is Rietveld 408576698