33 using namespace Drawing;
38 ScreenBuffer::ScreenBuffer(
const Size& s)
39 : size(s), hBitmap([this]{
40 ::BITMAPINFO bmi{{
sizeof(::BITMAPINFOHEADER), size.Width,
41 -size.Height - 1, 1, 32, BI_RGB,
42 sizeof(
PixelType) * size.Width * size.Height, 0, 0, 0, 0}, {}};
44 return ::CreateDIBSection(
nullptr, &bmi, DIB_RGB_COLORS,
45 &reinterpret_cast<void*&>(pBuffer),
nullptr, 0);
48 ScreenBuffer::ScreenBuffer(ScreenBuffer&& sbuf)
ynothrow
49 : size(sbuf.size), hBitmap(sbuf.hBitmap)
51 sbuf.hBitmap =
nullptr;
53 ScreenBuffer::~ScreenBuffer()
55 ::DeleteObject(hBitmap);
61 std::copy_n(buf, size.Width * size.Height, GetBufferPtr());
69 std::lock_guard<std::mutex> lck(mtx);
71 ScreenBuffer::UpdateFrom(buf);
75 ScreenRegionBuffer::UpdateTo(::HWND h_wnd, const
Point& pt)
ynothrow
78 std::lock_guard<std::mutex> lck(mtx);
87 WindowMemorySurface::Update(ScreenBuffer& sbuf, const
Point& pt) ynothrow
89 const auto h_old(::SelectObject(h_mem_dc, sbuf.GetNativeHandle()));
90 const auto& s(sbuf.GetSize());
93 ::BitBlt(h_owner_dc, pt.X, pt.Y, s.Width, s.Height, h_mem_dc, 0, 0,
95 ::SelectObject(h_mem_dc, h_old);