Coverage Report

Created: 2026-02-14 09:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/source/pdf/PdfConfig.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
 */
10
11
#include <pdf/PdfConfig.hxx>
12
#include <cstdlib>
13
14
#include <vcl/svapp.hxx>
15
#include <vcl/outdev.hxx>
16
17
namespace vcl::pdf
18
{
19
/// Get the default PDF rendering resolution in DPI.
20
double getDefaultPdfResolutionDpi()
21
1
{
22
    // If an overriding default is set, use it.
23
1
    const char* envar = ::getenv("PDFIMPORT_RESOLUTION_DPI");
24
1
    if (envar)
25
0
    {
26
0
        const double dpi = atof(envar);
27
0
        if (dpi > 0)
28
0
            return dpi;
29
0
    }
30
31
    // Fallback to a sensible default.
32
1
    OutputDevice* pDefault = Application::GetDefaultDevice();
33
1
    return pDefault ? pDefault->GetDPIX() : 96.0;
34
1
}
35
}
36
37
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */