Coverage Report

Created: 2025-03-04 07:22

/src/serenity/Userland/Libraries/LibGfx/CharacterBitmap.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
3
 * Copyright (c) 2022, the SerenityOS developers.
4
 *
5
 * SPDX-License-Identifier: BSD-2-Clause
6
 */
7
8
#pragma once
9
10
#include "Size.h"
11
#include <AK/RefCounted.h>
12
#include <AK/RefPtr.h>
13
#include <AK/StringView.h>
14
15
namespace Gfx {
16
17
class CharacterBitmap {
18
public:
19
    CharacterBitmap() = delete;
20
    constexpr CharacterBitmap(StringView ascii_data, unsigned width, unsigned height)
21
        : m_bits(ascii_data)
22
        , m_size(width, height)
23
0
    {
24
0
    }
25
26
    constexpr ~CharacterBitmap() = default;
27
28
0
    constexpr bool bit_at(unsigned x, unsigned y) const { return m_bits[y * width() + x] == '#'; }
29
0
    constexpr StringView bits() const { return m_bits; }
30
31
0
    constexpr IntSize size() const { return m_size; }
32
0
    constexpr unsigned width() const { return m_size.width(); }
33
0
    constexpr unsigned height() const { return m_size.height(); }
34
35
private:
36
    StringView m_bits {};
37
    IntSize m_size {};
38
};
39
40
}