ladybird/Userland/Services/WindowServer/HardwareScreenBackend.h
Linus Groh 6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00

50 lines
1.4 KiB
C++

/*
* Copyright (c) 2022, kleines Filmröllchen <filmroellchen@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "ScreenBackend.h"
#include "ScreenLayout.h"
#include <AK/DeprecatedString.h>
#include <AK/Error.h>
#include <AK/Span.h>
#include <sys/ioctl_numbers.h>
namespace WindowServer {
class HardwareScreenBackend : public ScreenBackend {
public:
virtual ~HardwareScreenBackend();
explicit HardwareScreenBackend(DeprecatedString device);
virtual ErrorOr<void> open() override;
virtual void set_head_buffer(int index) override;
virtual ErrorOr<void> flush_framebuffer_rects(int buffer_index, Span<FBRect const> rects) override;
virtual ErrorOr<void> flush_framebuffer() override;
virtual ErrorOr<void> unmap_framebuffer() override;
virtual ErrorOr<void> map_framebuffer() override;
virtual ErrorOr<void> set_safe_head_mode_setting() override;
virtual ErrorOr<void> set_head_mode_setting(GraphicsHeadModeSetting) override;
virtual ErrorOr<GraphicsHeadModeSetting> get_head_mode_setting() override;
DeprecatedString m_device {};
int m_display_connector_fd { -1 };
Gfx::ARGB32* scanline(int buffer_index, int y) const
{
size_t buffer_offset = buffer_index == 1 ? m_back_buffer_offset : 0;
return reinterpret_cast<Gfx::ARGB32*>(((u8*)m_framebuffer) + buffer_offset + (y * m_pitch));
}
};
}