Commit 40f8d29a authored by levin@chromium.org's avatar levin@chromium.org
Browse files

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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105656 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3820c1dc
2012-01-18 David Levin <levin@chromium.org>
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 <nghq36@motorola.com>
 
MicroData: Compilation error while building Webkit with --microdata.
......@@ -34,6 +34,12 @@ namespace WebCore {
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,8 +54,24 @@ public:
~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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment