Coverage Report

Created: 2025-12-31 07:23

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/poppler/splash/SplashScreen.h
Line
Count
Source
1
//========================================================================
2
//
3
// SplashScreen.h
4
//
5
//========================================================================
6
7
//========================================================================
8
//
9
// Modified under the Poppler project - http://poppler.freedesktop.org
10
//
11
// All changes made under the Poppler project to this file are licensed
12
// under GPL version 2 or later
13
//
14
// Copyright (C) 2009, 2018, 2020, 2021, 2025 Albert Astals Cid <aacid@kde.org>
15
//
16
// To see a description of the changes please see the Changelog file that
17
// came with your tarball or type make ChangeLog if you are building from git
18
//
19
//========================================================================
20
21
#ifndef SPLASHSCREEN_H
22
#define SPLASHSCREEN_H
23
24
#include "SplashTypes.h"
25
26
//------------------------------------------------------------------------
27
// SplashScreen
28
//------------------------------------------------------------------------
29
30
class SplashScreen
31
{
32
public:
33
    explicit SplashScreen(const SplashScreenParams *params);
34
    explicit SplashScreen(const SplashScreen *screen);
35
    ~SplashScreen();
36
37
    SplashScreen(const SplashScreen &) = delete;
38
    SplashScreen &operator=(const SplashScreen &) = delete;
39
40
4.83M
    SplashScreen *copy() const { return new SplashScreen(this); }
41
42
    // Return the computed pixel value (0=black, 1=white) for the gray
43
    // level <value> at (<x>, <y>).
44
    int test(int x, int y, unsigned char value)
45
9.32M
    {
46
9.32M
        int xx, yy;
47
9.32M
        if (mat == nullptr) {
48
202
            createMatrix();
49
202
        }
50
9.32M
        xx = x & sizeM1;
51
9.32M
        yy = y & sizeM1;
52
9.32M
        return value < mat[(yy << log2Size) + xx] ? 0 : 1;
53
9.32M
    }
54
55
private:
56
    void createMatrix();
57
58
    void buildDispersedMatrix(int i, int j, int val, int delta, int offset);
59
    void buildClusteredMatrix();
60
    int distance(int x0, int y0, int x1, int y1);
61
    void buildSCDMatrix(int r);
62
63
    const SplashScreenParams *screenParams; // params to create the other members
64
    unsigned char *mat; // threshold matrix
65
    int size; // size of the threshold matrix
66
    int sizeM1; // size - 1
67
    int log2Size; // log2(size)
68
};
69
70
#endif