mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-15 07:09:43 +03:00
443b043b49
I'm going with a global top-of-the-screen menu instead of per-window menus. The basic idea is that menus will live in the WindowServer and clients can create menus via WindowServer requests.
69 lines
1.7 KiB
C++
69 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include "Color.h"
|
|
#include "Rect.h"
|
|
#include "Size.h"
|
|
#include <AK/Retainable.h>
|
|
#include <AK/RetainPtr.h>
|
|
#include <AK/AKString.h>
|
|
|
|
#ifdef KERNEL
|
|
#include "Process.h"
|
|
#endif
|
|
|
|
class GraphicsBitmap : public Retainable<GraphicsBitmap> {
|
|
public:
|
|
#ifdef KERNEL
|
|
static RetainPtr<GraphicsBitmap> create(Process&, const Size&);
|
|
static RetainPtr<GraphicsBitmap> create_kernel_only(const Size&);
|
|
#endif
|
|
static RetainPtr<GraphicsBitmap> create_wrapper(const Size&, RGBA32*);
|
|
static RetainPtr<GraphicsBitmap> load_from_file(const String& path, const Size&);
|
|
~GraphicsBitmap();
|
|
|
|
RGBA32* scanline(int y);
|
|
const RGBA32* scanline(int y) const;
|
|
|
|
Rect rect() const { return { {}, m_size }; }
|
|
Size size() const { return m_size; }
|
|
int width() const { return m_size.width(); }
|
|
int height() const { return m_size.height(); }
|
|
size_t pitch() const { return m_pitch; }
|
|
|
|
#ifdef KERNEL
|
|
Region* client_region() { return m_client_region; }
|
|
Region* server_region() { return m_server_region; }
|
|
#endif
|
|
|
|
private:
|
|
#ifdef KERNEL
|
|
GraphicsBitmap(Process&, const Size&);
|
|
GraphicsBitmap(const Size&);
|
|
#endif
|
|
GraphicsBitmap(const Size&, RGBA32*);
|
|
|
|
Size m_size;
|
|
RGBA32* m_data { nullptr };
|
|
size_t m_pitch { 0 };
|
|
|
|
#ifdef USERLAND
|
|
bool m_mmaped { false };
|
|
#endif
|
|
|
|
#ifdef KERNEL
|
|
WeakPtr<Process> m_client_process;
|
|
Region* m_client_region { nullptr };
|
|
Region* m_server_region { nullptr };
|
|
#endif
|
|
};
|
|
|
|
inline RGBA32* GraphicsBitmap::scanline(int y)
|
|
{
|
|
return reinterpret_cast<RGBA32*>((((byte*)m_data) + (y * m_pitch)));
|
|
}
|
|
|
|
inline const RGBA32* GraphicsBitmap::scanline(int y) const
|
|
{
|
|
return reinterpret_cast<const RGBA32*>((((const byte*)m_data) + (y * m_pitch)));
|
|
}
|