Title: [105656] trunk/Source/WebCore
Revision
105656
Author
[email protected]
Date
2012-01-23 16:35:29 -0800 (Mon, 23 Jan 2012)

Log Message

Allow delayed DC allocation in HWndDC.
https://bugs.webkit.org/show_bug.cgi?id=76737

Reviewed by Adam Roben.

No new functionality exposed so no new tests.

* platform/win/HWndDC.h: Changed this slightly to allow
for allocating a window DC after the initial creation since
this pattern occurrs in several places so this makes it easy to
replace them in an upcoming change.
(WebCore::HWndDC::HWndDC):
(WebCore::HWndDC::~HWndDC):
(WebCore::HWndDC::setHWnd):
(WebCore::HWndDC::clear):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (105655 => 105656)


--- trunk/Source/WebCore/ChangeLog	2012-01-24 00:26:40 UTC (rev 105655)
+++ trunk/Source/WebCore/ChangeLog	2012-01-24 00:35:29 UTC (rev 105656)
@@ -1,3 +1,21 @@
+2012-01-18  David Levin  <[email protected]>
+
+        Allow delayed DC allocation in HWndDC.
+        https://bugs.webkit.org/show_bug.cgi?id=76737
+
+        Reviewed by Adam Roben.
+
+        No new functionality exposed so no new tests.
+
+        * platform/win/HWndDC.h: Changed this slightly to allow
+        for allocating a window DC after the initial creation since
+        this pattern occurrs in several places so this makes it easy to
+        replace them in an upcoming change.
+        (WebCore::HWndDC::HWndDC):
+        (WebCore::HWndDC::~HWndDC):
+        (WebCore::HWndDC::setHWnd):
+        (WebCore::HWndDC::clear):
+
 2012-01-23  Arko Saha  <[email protected]>
 
         MicroData: Compilation error while building Webkit with --microdata.

Modified: trunk/Source/WebCore/platform/win/HWndDC.h (105655 => 105656)


--- trunk/Source/WebCore/platform/win/HWndDC.h	2012-01-24 00:26:40 UTC (rev 105655)
+++ trunk/Source/WebCore/platform/win/HWndDC.h	2012-01-24 00:35:29 UTC (rev 105656)
@@ -34,6 +34,12 @@
 class HWndDC {
     WTF_MAKE_NONCOPYABLE(HWndDC);
 public:
+    HWndDC()
+        : m_hwnd(0)
+        , m_hdc(0)
+    {
+    }
+
     explicit HWndDC(HWND hwnd)
         : m_hwnd(hwnd)
         , m_hdc(::GetDC(hwnd))
@@ -48,10 +54,26 @@
 
     ~HWndDC()
     {
-        if (m_hdc)
-            ::ReleaseDC(m_hwnd, m_hdc);
+        clear();
     }
 
+    HDC setHWnd(HWND hwnd)
+    {
+        clear();
+        m_hwnd = hwnd;
+        m_hdc = ::GetDC(hwnd);
+        return m_hdc;
+    }
+
+    void clear()
+    {
+        if (!m_hdc)
+            return;
+        ::ReleaseDC(m_hwnd, m_hdc);
+        m_hwnd = 0;
+        m_hdc = 0;
+    }
+
     operator HDC()
     {
         return m_hdc;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to