bump product version to 7.6.3.2-android
[LibreOffice.git] / canvas / source / vcl / spritedevicehelper.cxx
blob99f8b19145cee668d763f7319d2ca6aef70f3f42
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sal/config.h>
22 #include <osl/diagnose.h>
23 #include <vcl/bitmapex.hxx>
24 #include <vcl/dibtools.hxx>
25 #include <tools/stream.hxx>
27 #include "spritedevicehelper.hxx"
28 #include "impltools.hxx"
30 using namespace ::com::sun::star;
32 namespace vclcanvas
34 SpriteDeviceHelper::SpriteDeviceHelper()
38 void SpriteDeviceHelper::init( const OutDevProviderSharedPtr& pOutDev )
40 DeviceHelper::init(pOutDev);
42 // setup back buffer
43 OutputDevice& rOutDev( pOutDev->getOutDev() );
44 mpBackBuffer = std::make_shared<BackBuffer>( rOutDev );
45 mpBackBuffer->setSize( rOutDev.GetOutputSizePixel() );
47 tools::SetDefaultDeviceAntiAliasing( &mpBackBuffer->getOutDev());
50 bool SpriteDeviceHelper::showBuffer( bool, bool )
52 OSL_FAIL("Not supposed to be called, handled by SpriteCanvas");
53 return false;
56 bool SpriteDeviceHelper::switchBuffer( bool, bool )
58 OSL_FAIL("Not supposed to be called, handled by SpriteCanvas");
59 return false;
62 void SpriteDeviceHelper::disposing()
64 // release all references
65 mpBackBuffer.reset();
67 DeviceHelper::disposing();
70 uno::Any SpriteDeviceHelper::isAccelerated() const
72 return DeviceHelper::isAccelerated();
75 uno::Any SpriteDeviceHelper::getDeviceHandle() const
77 return DeviceHelper::getDeviceHandle();
80 uno::Any SpriteDeviceHelper::getSurfaceHandle() const
82 if( !mpBackBuffer )
83 return uno::Any();
85 return uno::Any(
86 reinterpret_cast< sal_Int64 >(&mpBackBuffer->getOutDev()) );
89 void SpriteDeviceHelper::notifySizeUpdate( const awt::Rectangle& rBounds )
91 if( mpBackBuffer )
92 mpBackBuffer->setSize( ::Size(rBounds.Width,
93 rBounds.Height) );
96 void SpriteDeviceHelper::dumpScreenContent() const
98 DeviceHelper::dumpScreenContent();
100 static sal_Int32 nFilePostfixCount(0);
102 if( mpBackBuffer )
104 OUString aFilename = "dbg_backbuffer" + OUString::number(nFilePostfixCount) + ".bmp";
106 SvFileStream aStream( aFilename, StreamMode::STD_READWRITE );
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);
114 ++nFilePostfixCount;
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */