/* * Copyright (c) 2024, Aliaksandr Kalenik * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include namespace Core { class IOSurfaceHandle { AK_MAKE_NONCOPYABLE(IOSurfaceHandle); public: IOSurfaceHandle(IOSurfaceHandle&& other); IOSurfaceHandle& operator=(IOSurfaceHandle&& other); static IOSurfaceHandle create(int width, int height); static IOSurfaceHandle from_mach_port(MachPort const& port); MachPort create_mach_port() const; size_t width() const; size_t height() const; size_t bytes_per_element() const; size_t bytes_per_row() const; void* data() const; void* core_foundation_pointer() const; ~IOSurfaceHandle(); private: struct IOSurfaceRefWrapper; IOSurfaceHandle(OwnPtr&&); OwnPtr m_ref_wrapper; }; }