Move setting of LD_LIBRARY_PATH closer to invocation of cppunittester
[LibreOffice.git] / canvas / source / tools / cachedprimitivebase.cxx
blob73b09758dce26b83d20601fb66bceb9e6806b561
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 <basegfx/matrix/b2dhommatrix.hxx>
23 #include <basegfx/utils/canvastools.hxx>
24 #include <com/sun/star/rendering/RepaintResult.hpp>
25 #include <cppuhelper/supportsservice.hxx>
27 #include <base/cachedprimitivebase.hxx>
28 #include <utility>
31 using namespace ::com::sun::star;
33 namespace canvas
35 CachedPrimitiveBase::CachedPrimitiveBase( rendering::ViewState aUsedViewState,
36 uno::Reference< rendering::XCanvas > xTarget ) :
37 maUsedViewState(std::move( aUsedViewState )),
38 mxTarget(std::move( xTarget ))
42 CachedPrimitiveBase::~CachedPrimitiveBase()
46 void CachedPrimitiveBase::disposing(std::unique_lock<std::mutex>& /*rGuard*/)
48 maUsedViewState.Clip.clear();
49 mxTarget.clear();
52 sal_Int8 SAL_CALL CachedPrimitiveBase::redraw( const rendering::ViewState& aState )
54 ::basegfx::B2DHomMatrix aUsedTransformation;
55 ::basegfx::B2DHomMatrix aNewTransformation;
57 ::basegfx::unotools::homMatrixFromAffineMatrix( aUsedTransformation,
58 maUsedViewState.AffineTransform );
59 ::basegfx::unotools::homMatrixFromAffineMatrix( aNewTransformation,
60 aState.AffineTransform );
62 const bool bSameViewTransforms( aUsedTransformation == aNewTransformation );
64 if( !bSameViewTransforms )
66 // differing transformations, don't try to draft the
67 // output, just plain fail here.
68 return rendering::RepaintResult::FAILED;
71 return doRedraw( aState,
72 maUsedViewState,
73 mxTarget,
74 bSameViewTransforms );
77 OUString SAL_CALL CachedPrimitiveBase::getImplementationName( )
79 return u"canvas::CachedPrimitiveBase"_ustr;
82 sal_Bool SAL_CALL CachedPrimitiveBase::supportsService( const OUString& ServiceName )
84 return cppu::supportsService(this, ServiceName);
87 uno::Sequence< OUString > SAL_CALL CachedPrimitiveBase::getSupportedServiceNames( )
89 return { u"com.sun.star.rendering.CachedBitmap"_ustr };
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */