Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/inc/image.h
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
#pragma once
21
22
#include <vcl/bitmap.hxx>
23
#include <vcl/gdimtf.hxx>
24
25
class SalGraphics;
26
27
class ImplImage
28
{
29
private:
30
    BitmapChecksum maBitmapChecksum;
31
    /// if non-empty: cached original size of maStockName else Size of maBitmap
32
    Size maSizePixel;
33
    /// If set - defines the bitmap via images.zip*
34
    OUString maStockName;
35
    /// rare case of dynamically created Image contents
36
    std::unique_ptr<GDIMetaFile> mxMetaFile;
37
38
    /// Original bitmap - or cache of a potentially scaled bitmap
39
    Bitmap maBitmap;
40
    Bitmap maDisabledBitmap;
41
42
    bool bOptional = false;
43
44
    bool loadStockAtScale(SalGraphics* pGraphics, Bitmap &rBitmap);
45
46
public:
47
    ImplImage(const Bitmap& rBitmap);
48
    ImplImage(const GDIMetaFile& rMetaFile);
49
    ImplImage(OUString aStockName);
50
51
    bool isStock() const
52
0
    {
53
0
        return maStockName.getLength() > 0;
54
0
    }
55
56
    const OUString & getStock() const
57
0
    {
58
0
        return maStockName;
59
0
    }
60
61
    /// get size in co-ordinates not scaled for HiDPI
62
    Size getSizePixel();
63
    /// Legacy - the original bitmap
64
    Bitmap const & getBitmap(bool bDisabled = false);
65
    /// Taking account of HiDPI scaling
66
    Bitmap const & getBitmapForHiDPI(bool bDisabled, SalGraphics* pGraphics);
67
68
    void SetOptional(bool bValue);
69
70
    bool isEqual(const ImplImage &ref) const;
71
    bool isSizeEmpty() const
72
0
    {
73
0
        return maSizePixel == Size();
74
0
    }
75
};
76
77
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */