LibreOffice Module canvas (master) 1
spritedevicehelper.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <sal/config.h>
21
22#include <osl/diagnose.h>
23#include <vcl/bitmapex.hxx>
24#include <vcl/dibtools.hxx>
25#include <tools/stream.hxx>
26
28#include "impltools.hxx"
29
30using namespace ::com::sun::star;
31
32namespace vclcanvas
33{
35 {
36 }
37
39 {
40 DeviceHelper::init(pOutDev);
41
42 // setup back buffer
43 OutputDevice& rOutDev( pOutDev->getOutDev() );
44 mpBackBuffer = std::make_shared<BackBuffer>( rOutDev );
45 mpBackBuffer->setSize( rOutDev.GetOutputSizePixel() );
46
48 }
49
51 {
52 OSL_FAIL("Not supposed to be called, handled by SpriteCanvas");
53 return false;
54 }
55
57 {
58 OSL_FAIL("Not supposed to be called, handled by SpriteCanvas");
59 return false;
60 }
61
63 {
64 // release all references
65 mpBackBuffer.reset();
66
68 }
69
71 {
73 }
74
76 {
78 }
79
81 {
82 if( !mpBackBuffer )
83 return uno::Any();
84
85 return uno::Any(
86 reinterpret_cast< sal_Int64 >(&mpBackBuffer->getOutDev()) );
87 }
88
89 void SpriteDeviceHelper::notifySizeUpdate( const awt::Rectangle& rBounds )
90 {
91 if( mpBackBuffer )
92 mpBackBuffer->setSize( ::Size(rBounds.Width,
93 rBounds.Height) );
94 }
95
97 {
99
100 static sal_Int32 nFilePostfixCount(0);
101
102 if( mpBackBuffer )
103 {
104 OUString aFilename = "dbg_backbuffer" + OUString::number(nFilePostfixCount) + ".bmp";
105
106 SvFileStream aStream( aFilename, StreamMode::STD_READWRITE );
107
108 const ::Point aEmptyPoint;
109 mpBackBuffer->getOutDev().EnableMapMode( false );
110 mpBackBuffer->getOutDev().SetAntialiasing( AntialiasingFlags::Enable );
111 WriteDIB(mpBackBuffer->getOutDev().GetBitmapEx(aEmptyPoint, mpBackBuffer->getOutDev().GetOutputSizePixel()), aStream, false);
112 }
113
114 ++nFilePostfixCount;
115 }
116
117}
118
119/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Size GetOutputSizePixel() const
void disposing()
Dispose all internal references.
void dumpScreenContent() const
called when DumpScreenContent property is enabled on XGraphicDevice, and writes out bitmaps of curren...
void init(const OutDevProviderSharedPtr &rOutDev)
css::uno::Any isAccelerated() const
css::uno::Any getDeviceHandle() const
void notifySizeUpdate(const css::awt::Rectangle &rBounds)
css::uno::Any getDeviceHandle() const
css::uno::Any isAccelerated() const
css::uno::Any getSurfaceHandle() const
bool showBuffer(bool bWindowVisible, bool bUpdateAll)
bool switchBuffer(bool bWindowVisible, bool bUpdateAll)
BackBufferSharedPtr mpBackBuffer
This buffer holds the background content for all associated canvases.
void init(const OutDevProviderSharedPtr &rOutDev)
void disposing()
Dispose all internal references.
bool VCL_DLLPUBLIC WriteDIB(const Bitmap &rSource, SvStream &rOStm, bool bCompressed, bool bFileHeader)
void SetDefaultDeviceAntiAliasing(OutputDevice *pDevice)
Definition: impltools.cxx:248
std::shared_ptr< OutDevProvider > OutDevProviderSharedPtr