28 #ifndef Inc_Helper_ScreenBuffer_h_
29 #define Inc_Helper_ScreenBuffer_h_ 1
33 #if YCL_MULTITHREAD == 1
58 ScreenBuffer(
const Drawing::Size&);
60 ScreenBuffer(ScreenBuffer&&)
ynothrow;
66 DefGetter(const ynothrow, ::HBITMAP, NativeHandle, hBitmap)
67 DefGetter(const ynothrow, const Drawing::Size&, Size, size)
74 UpdateFrom(Drawing::BitmapPtr) ynothrow;
80 class ScreenRegionBuffer : private ScreenBuffer
86 ScreenRegionBuffer(
const Drawing::Size& s)
87 : ScreenBuffer(s), mtx()
90 using ScreenBuffer::GetBufferPtr;
91 using ScreenBuffer::GetNativeHandle;
92 using ScreenBuffer::GetSize;
93 DefGetter(ynothrow, ScreenBuffer&, ScreenBufferRef, *
this)
96 UpdateFrom(Drawing::BitmapPtr) ynothrow;
99 UpdateTo(::HWND, const Drawing::
Point& = {}) ynothrow;
109 class WindowMemorySurface
112 ::HDC h_owner_dc, h_mem_dc;
115 WindowMemorySurface(::HDC h_dc)
116 : h_owner_dc(h_dc), h_mem_dc(::CreateCompatibleDC(h_dc))
118 ~WindowMemorySurface()
120 ::DeleteDC(h_mem_dc);
133 Update(rbuf.GetScreenBufferRef(), pt);
138 class WindowDeviceContextBase
144 WindowDeviceContextBase(::HWND h_wnd, ::HDC h_dc)
145 : hWindow(h_wnd), hDC(h_dc)
151 DefGetter(const ynothrow, ::HWND, WindowHandle, hWindow)
159 class WindowDeviceContext : public WindowDeviceContextBase
162 WindowDeviceContext(::HWND h_wnd)
163 : WindowDeviceContextBase(h_wnd, ::GetDC(h_wnd))
165 ~WindowDeviceContext()
167 ::ReleaseDC(hWindow, hDC);
176 class WindowRegionDeviceContext :
public WindowDeviceContextBase
182 WindowRegionDeviceContext(::HWND h_wnd)
183 : WindowDeviceContextBase(h_wnd, ::BeginPaint(h_wnd, &ps))
185 ~WindowRegionDeviceContext()
187 ::EndPaint(hWindow, &ps);
193 template<
typename _type = WindowDeviceContext>
194 class GSurface :
public _type,
public WindowMemorySurface
197 GSurface(::HWND h_wnd)
198 : _type(h_wnd), WindowMemorySurface(::GetDC(h_wnd))