ladybird/Libraries/LibGfx/ShareableBitmap.h

52 lines
908 B
C
Raw Normal View History

2020-04-06 11:09:01 +02:00
/*
* Copyright (c) 2020, Andreas Kling <andreas@ladybird.org>
2020-04-06 11:09:01 +02:00
*
* SPDX-License-Identifier: BSD-2-Clause
2020-04-06 11:09:01 +02:00
*/
#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&);
}