2020-04-06 09:09:01 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
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>
|
|
|
|
#include <LibGfx/Size.h>
|
|
|
|
|
|
|
|
namespace Gfx {
|
|
|
|
|
|
|
|
class ShareableBitmap {
|
|
|
|
public:
|
2020-09-18 07:49:51 +00:00
|
|
|
ShareableBitmap() { }
|
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; }
|
|
|
|
|
|
|
|
const Bitmap* bitmap() const { return m_bitmap; }
|
|
|
|
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
|
|
|
|
2020-05-12 16:52:51 +00:00
|
|
|
bool encode(Encoder&, const Gfx::ShareableBitmap&);
|
2021-11-28 10:56:31 +00:00
|
|
|
ErrorOr<void> decode(Decoder&, Gfx::ShareableBitmap&);
|
2020-07-26 04:31:47 +00:00
|
|
|
|
2020-03-29 17:04:05 +00:00
|
|
|
}
|