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