ladybird/Libraries/LibGfx/ShareableBitmap.h
InvalidUsernameException 28ba610f32 Everywhere: Avoid large rebuilds when editing (Immutable)Bitmap headers
This reduces the number of recompiled files as follow:
- Bitmap.h: 1309 -> 101
- ImmutableBitmap.h: 1218 -> 75
2025-11-28 18:32:48 +01:00

51 lines
908 B
C++

/*
* Copyright (c) 2020, Andreas Kling <andreas@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/RefPtr.h>
#include <LibGfx/Forward.h>
#include <LibIPC/Forward.h>
namespace Gfx {
class ShareableBitmap {
public:
ShareableBitmap();
enum Tag { ConstructWithKnownGoodBitmap };
ShareableBitmap(NonnullRefPtr<Gfx::Bitmap>, Tag);
~ShareableBitmap();
ShareableBitmap(ShareableBitmap const&);
ShareableBitmap(ShareableBitmap&&);
ShareableBitmap& operator=(ShareableBitmap const&);
ShareableBitmap& operator=(ShareableBitmap&&);
bool is_valid() const;
Bitmap const* bitmap() const;
Bitmap* bitmap();
private:
friend class Bitmap;
RefPtr<Bitmap> m_bitmap;
};
}
namespace IPC {
template<>
ErrorOr<void> encode(Encoder&, Gfx::ShareableBitmap const&);
template<>
ErrorOr<Gfx::ShareableBitmap> decode(Decoder&);
}