Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/canvas/source/tools/cachedprimitivebase.cxx
Line
Count
Source
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 <basegfx/matrix/b2dhommatrix.hxx>
23
#include <basegfx/utils/canvastools.hxx>
24
#include <com/sun/star/rendering/RepaintResult.hpp>
25
#include <cppuhelper/supportsservice.hxx>
26
27
#include <base/cachedprimitivebase.hxx>
28
#include <utility>
29
30
31
using namespace ::com::sun::star;
32
33
namespace canvas
34
{
35
    CachedPrimitiveBase::CachedPrimitiveBase( rendering::ViewState                    aUsedViewState,
36
                                              uno::Reference< rendering::XCanvas >    xTarget ) :
37
0
        maUsedViewState(std::move( aUsedViewState )),
38
0
        mxTarget(std::move( xTarget ))
39
0
    {
40
0
    }
41
42
    CachedPrimitiveBase::~CachedPrimitiveBase()
43
0
    {
44
0
    }
45
46
    void CachedPrimitiveBase::disposing(std::unique_lock<std::mutex>& /*rGuard*/)
47
0
    {
48
0
        maUsedViewState.Clip.clear();
49
0
        mxTarget.clear();
50
0
    }
51
52
    sal_Int8 SAL_CALL CachedPrimitiveBase::redraw( const rendering::ViewState& aState )
53
0
    {
54
0
        ::basegfx::B2DHomMatrix aUsedTransformation;
55
0
        ::basegfx::B2DHomMatrix aNewTransformation;
56
57
0
        ::basegfx::unotools::homMatrixFromAffineMatrix( aUsedTransformation,
58
0
                                                        maUsedViewState.AffineTransform );
59
0
        ::basegfx::unotools::homMatrixFromAffineMatrix( aNewTransformation,
60
0
                                                        aState.AffineTransform );
61
62
0
        const bool bSameViewTransforms( aUsedTransformation == aNewTransformation );
63
64
0
        if( !bSameViewTransforms )
65
0
        {
66
            // differing transformations, don't try to draft the
67
            // output, just plain fail here.
68
0
            return rendering::RepaintResult::FAILED;
69
0
        }
70
71
0
        return doRedraw( aState,
72
0
                         maUsedViewState,
73
0
                         mxTarget,
74
0
                         bSameViewTransforms );
75
0
    }
76
77
    OUString SAL_CALL CachedPrimitiveBase::getImplementationName(  )
78
0
    {
79
0
        return u"canvas::CachedPrimitiveBase"_ustr;
80
0
    }
81
82
    sal_Bool SAL_CALL CachedPrimitiveBase::supportsService( const OUString& ServiceName )
83
0
    {
84
0
        return cppu::supportsService(this, ServiceName);
85
0
    }
86
87
    uno::Sequence< OUString > SAL_CALL CachedPrimitiveBase::getSupportedServiceNames(  )
88
0
    {
89
0
        return { u"com.sun.star.rendering.CachedBitmap"_ustr };
90
0
    }
91
}
92
93
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */