/* * Copyright (c) 2020, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include namespace Gfx { class ShareableBitmap { public: ShareableBitmap(); enum Tag { ConstructWithKnownGoodBitmap }; ShareableBitmap(NonnullRefPtr, 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 m_bitmap; }; } namespace IPC { template<> ErrorOr encode(Encoder&, Gfx::ShareableBitmap const&); template<> ErrorOr decode(Decoder&); }