/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include #include #include #include #include #include #include #include void OutputDevice::SaveBackground(VirtualDevice& rSaveDevice, const Point& rPos, const Size& rSize, const Size& rBackgroundSize) const { rSaveDevice.DrawOutDev(Point(), rBackgroundSize, rPos, rSize, *this); } vcl::Region OutputDevice::GetClipRegion() const { return PixelToLogic( maRegion ); } void OutputDevice::SetClipRegion() { if ( mpMetaFile ) mpMetaFile->AddAction( new MetaClipRegionAction( vcl::Region(), false ) ); SetDeviceClipRegion( nullptr ); if( mpAlphaVDev ) mpAlphaVDev->SetClipRegion(); } void OutputDevice::SetClipRegion( const vcl::Region& rRegion ) { if ( mpMetaFile ) mpMetaFile->AddAction( new MetaClipRegionAction( rRegion, true ) ); if ( rRegion.IsNull() ) { SetDeviceClipRegion( nullptr ); } else { vcl::Region aRegion = LogicToPixel( rRegion ); SetDeviceClipRegion( &aRegion ); } if( mpAlphaVDev ) mpAlphaVDev->SetClipRegion( rRegion ); } bool OutputDevice::SelectClipRegion( const vcl::Region& rRegion, SalGraphics* pGraphics ) { DBG_TESTSOLARMUTEX(); if( !pGraphics ) { if( !mpGraphics && !AcquireGraphics() ) return false; pGraphics = mpGraphics; } bool bClipRegion = pGraphics->SetClipRegion( rRegion, this ); OSL_ENSURE( bClipRegion, "OutputDevice::SelectClipRegion() - can't create region" ); return bClipRegion; } void OutputDevice::MoveClipRegion( long nHorzMove, long nVertMove ) { if ( mbClipRegion ) { if( mpMetaFile ) mpMetaFile->AddAction( new MetaMoveClipRegionAction( nHorzMove, nVertMove ) ); maRegion.Move( ImplLogicWidthToDevicePixel( nHorzMove ), ImplLogicHeightToDevicePixel( nVertMove ) ); mbInitClipRegion = true; } if( mpAlphaVDev ) mpAlphaVDev->MoveClipRegion( nHorzMove, nVertMove ); } void OutputDevice::IntersectClipRegion( const tools::Rectangle& rRect ) { if ( mpMetaFile ) mpMetaFile->AddAction( new MetaISectRectClipRegionAction( rRect ) ); tools::Rectangle aRect = LogicToPixel( rRect ); maRegion.Intersect( aRect ); mbClipRegion = true; mbInitClipRegion = true; if( mpAlphaVDev ) mpAlphaVDev->IntersectClipRegion( rRect ); } void OutputDevice::IntersectClipRegion( const vcl::Region& rRegion ) { if(!rRegion.IsNull()) { if ( mpMetaFile ) mpMetaFile->AddAction( new MetaISectRegionClipRegionAction( rRegion ) ); vcl::Region aRegion = LogicToPixel( rRegion ); maRegion.Intersect( aRegion ); mbClipRegion = true; mbInitClipRegion = true; } if( mpAlphaVDev ) mpAlphaVDev->IntersectClipRegion( rRegion ); } void OutputDevice::InitClipRegion() { DBG_TESTSOLARMUTEX(); if ( mbClipRegion ) { if ( maRegion.IsEmpty() ) mbOutputClipped = true; else { mbOutputClipped = false; // #102532# Respect output offset also for clip region vcl::Region aRegion = ClipToDeviceBounds(ImplPixelToDevicePixel(maRegion)); if ( aRegion.IsEmpty() ) { mbOutputClipped = true; } else { mbOutputClipped = false; SelectClipRegion( aRegion ); } } mbClipRegionSet = true; } else { if ( mbClipRegionSet ) { if (mpGraphics) mpGraphics->ResetClipRegion(); mbClipRegionSet = false; } mbOutputClipped = false; } mbInitClipRegion = false; } vcl::Region OutputDevice::ClipToDeviceBounds(vcl::Region aRegion) const { aRegion.Intersect(tools::Rectangle{mnOutOffX, mnOutOffY, mnOutOffX + GetOutputWidthPixel() - 1, mnOutOffY + GetOutputHeightPixel() - 1 }); return aRegion; } vcl::Region OutputDevice::GetActiveClipRegion() const { return GetClipRegion(); } void OutputDevice::ClipToPaintRegion(tools::Rectangle& /*rDstRect*/) { // this is only used in Window, but we still need it as it's called // on in other clipping functions } void OutputDevice::SetDeviceClipRegion( const vcl::Region* pRegion ) { DBG_TESTSOLARMUTEX(); if ( !pRegion ) { if ( mbClipRegion ) { maRegion = vcl::Region(true); mbClipRegion = false; mbInitClipRegion = true; } } else { maRegion = *pRegion; mbClipRegion = true; mbInitClipRegion = true; } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ption value='distro/escriba/escriba-5.4'>distro/escriba/escriba-5.4 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-04-02New --with-coredumpctl to obtain core dumps of crashed tests from coredumpctlStephan Bergmann
...for (Linux) systems that don't store core.* files in the current working directory. When enabled, this wraps test execution in `systemd-run --scope --user --unit=...` with unit values unique per individual test invocation, so that solenv/bin/gdb-core-bt.sh can query coredumpctl for matching core dumps. (See the mailing list thread starting at <https://lists.freedesktop.org/archives/systemd-devel/2023-March/048884.html> "[systemd-devel] coredumpctl: matching by e.g. env var?" for further details.) The used --unit=... scheme is a best effort to produce system-wide unique values, combining the target location path of the given test with a second-granularity date/time and the current PID. (In case there would be multiple invocations of the same test per second, which then hopefully wouldn't reuse the same PID. The date/time and PID could be replaced with a high-resolution system-wide monotonic clock/counter if one were easily available. The advantage of the current scheme is that it only uses Posix features.) The overall length of the unit value (incl. the appended ".scope" suffix) must not exceed 256 characters, or else systemd-run would fail with "Failed to mangle scope name: Invalid argument". It might look more natural to pass the unit value into gdb-core-bt.sh as a fourth positional argument rather than via a new LIBO_TEST_UNIT env var. But for one, the unit value is most easily computed from within the recipe shell command lines, where an env var is the most natural fit. And for another, this avoids having to tunnel yet another value through the tearDown method in unotest/source/java/org/openoffice/test/OfficeConnection.java to the given postprocesscommand. Change-Id: Idcb20cd1e1141d8ec7f10947e5edc70aa2aa7d32 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149690 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-07-18Mend python support for lldb cppunit tests.Hannah Meeks
Change-Id: I02f4872ac75d82f2d77c1854ce040b72883b484a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137204 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>