2020-04-06 09:09:01 +00:00
|
|
|
/*
|
2024-10-04 11:19:50 +00:00
|
|
|
* Copyright (c) 2020, Andreas Kling <andreas@ladybird.org>
|
2020-04-06 09:09:01 +00:00
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-04-06 09:09:01 +00:00
|
|
|
*/
|
|
|
|
|
2020-03-29 17:04:05 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/RefPtr.h>
|
|
|
|
#include <LibGfx/Bitmap.h>
|
2022-12-23 01:40:33 +00:00
|
|
|
#include <LibIPC/Forward.h>
|
2020-03-29 17:04:05 +00:00
|
|
|
|
|
|
|
namespace Gfx {
|
|
|
|
|
|
|
|
class ShareableBitmap {
|
|
|
|
public:
|
2022-03-14 19:26:37 +00:00
|
|
|
ShareableBitmap() = default;
|
2020-03-29 17:04:05 +00:00
|
|
|
|
2021-01-16 10:23:22 +00:00
|
|
|
enum Tag { ConstructWithKnownGoodBitmap };
|
|
|
|
ShareableBitmap(NonnullRefPtr<Gfx::Bitmap>, Tag);
|
|
|
|
|
2020-03-29 17:04:05 +00:00
|
|
|
bool is_valid() const { return m_bitmap; }
|
|
|
|
|
2022-04-01 17:58:27 +00:00
|
|
|
Bitmap const* bitmap() const { return m_bitmap; }
|
2020-03-29 17:04:05 +00:00
|
|
|
Bitmap* bitmap() { return m_bitmap; }
|
|
|
|
|
|
|
|
private:
|
2021-11-06 12:15:43 +00:00
|
|
|
friend class Bitmap;
|
|
|
|
|
2020-03-29 17:04:05 +00:00
|
|
|
RefPtr<Bitmap> m_bitmap;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace IPC {
|
2020-07-26 04:31:47 +00:00
|
|
|
|
2022-11-15 16:24:59 +00:00
|
|
|
template<>
|
2023-01-02 04:37:35 +00:00
|
|
|
ErrorOr<void> encode(Encoder&, Gfx::ShareableBitmap const&);
|
2022-11-15 16:24:59 +00:00
|
|
|
|
|
|
|
template<>
|
2022-12-23 01:40:33 +00:00
|
|
|
ErrorOr<Gfx::ShareableBitmap> decode(Decoder&);
|
2020-07-26 04:31:47 +00:00
|
|
|
|
2020-03-29 17:04:05 +00:00
|
|
|
}
|