Factor out and simplify COM-safe wait
[LibreOffice.git] / vcl / source / window / bufferdevice.cxx
blob188fbb1acc1c1d5b27e8436bd54140ec8d858e22
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include "bufferdevice.hxx"
12 namespace vcl
14 BufferDevice::BufferDevice(const VclPtr<vcl::Window>& pWindow, vcl::RenderContext& rRenderContext)
15 : m_pBuffer(VclPtr<VirtualDevice>::Create(rRenderContext))
16 , m_pWindow(pWindow)
17 , m_rRenderContext(rRenderContext)
19 m_pBuffer->SetOutputSizePixel(pWindow->GetOutputSizePixel(), false);
20 m_pBuffer->SetTextColor(rRenderContext.GetTextColor());
21 m_pBuffer->DrawOutDev(Point(0, 0), pWindow->GetOutputSizePixel(), Point(0, 0),
22 pWindow->GetOutputSizePixel(), rRenderContext);
23 m_pBuffer->EnableRTL(rRenderContext.IsRTLEnabled());
26 void BufferDevice::Dispose()
28 if (m_bDisposed)
30 return;
33 m_rRenderContext.DrawOutDev(Point(0, 0), m_pWindow->GetOutputSizePixel(), Point(0, 0),
34 m_pWindow->GetOutputSizePixel(), *m_pBuffer);
35 m_bDisposed = true;
38 BufferDevice::~BufferDevice() { Dispose(); }
40 vcl::RenderContext* BufferDevice::operator->() { return m_pBuffer.get(); }
42 vcl::RenderContext& BufferDevice::operator*() { return *m_pBuffer; }
45 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */