Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/svgio/source/svgreader/svgfegaussianblurnode.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 <svgfegaussianblurnode.hxx>
21
#include <drawinglayer/primitive2d/softedgeprimitive2d.hxx>
22
#include <o3tl/string_view.hxx>
23
24
namespace svgio::svgreader
25
{
26
SvgFeGaussianBlurNode::SvgFeGaussianBlurNode(SvgDocument& rDocument, SvgNode* pParent)
27
0
    : SvgFilterNode(SVGToken::FeGaussianBlur, rDocument, pParent)
28
0
    , maStdDeviation(SvgNumber(0.0))
29
0
{
30
0
}
31
32
0
SvgFeGaussianBlurNode::~SvgFeGaussianBlurNode() {}
33
34
void SvgFeGaussianBlurNode::parseAttribute(SVGToken aSVGToken, const OUString& aContent)
35
0
{
36
    // parse own
37
0
    switch (aSVGToken)
38
0
    {
39
0
        case SVGToken::StdDeviation:
40
0
        {
41
0
            SvgNumber aNum;
42
43
0
            if (readSingleNumber(aContent, aNum))
44
0
            {
45
0
                if (aNum.isPositive())
46
0
                {
47
0
                    maStdDeviation = aNum;
48
0
                }
49
0
            }
50
0
            break;
51
0
        }
52
0
        case SVGToken::In:
53
0
        {
54
0
            maIn = aContent.trim();
55
0
            break;
56
0
        }
57
0
        case SVGToken::Result:
58
0
        {
59
0
            maResult = aContent.trim();
60
0
            break;
61
0
        }
62
0
        default:
63
0
        {
64
0
            break;
65
0
        }
66
0
    }
67
0
}
68
69
void SvgFeGaussianBlurNode::apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget,
70
                                  const SvgFilterNode* pParent) const
71
0
{
72
0
    if (const drawinglayer::primitive2d::Primitive2DContainer* rSource
73
0
        = pParent->findGraphicSource(maIn))
74
0
    {
75
0
        rTarget = *rSource;
76
0
    }
77
78
0
    const drawinglayer::primitive2d::Primitive2DReference xRef(
79
0
        new drawinglayer::primitive2d::SoftEdgePrimitive2D(maStdDeviation.getNumber(),
80
0
                                                           std::move(rTarget)));
81
82
0
    rTarget = drawinglayer::primitive2d::Primitive2DContainer{ xRef };
83
84
0
    pParent->addGraphicSourceToMapper(maResult, rTarget);
85
0
}
86
87
} // end of namespace svgio::svgreader
88
89
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */