mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 21:12:43 +00:00 
			
		
		
		
	 cb9cac4e40
			
		
	
	
		cb9cac4e40
		
	
	
	
	
		
			
			This allows us to use TRY() in decoding helpers, leading to a nice reduction in line count.
		
			
				
	
	
		
			40 lines
		
	
	
	
		
			723 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
	
		
			723 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/RefPtr.h>
 | |
| #include <LibGfx/Bitmap.h>
 | |
| #include <LibGfx/Size.h>
 | |
| 
 | |
| namespace Gfx {
 | |
| 
 | |
| class ShareableBitmap {
 | |
| public:
 | |
|     ShareableBitmap() { }
 | |
| 
 | |
|     enum Tag { ConstructWithKnownGoodBitmap };
 | |
|     ShareableBitmap(NonnullRefPtr<Gfx::Bitmap>, Tag);
 | |
| 
 | |
|     bool is_valid() const { return m_bitmap; }
 | |
| 
 | |
|     const Bitmap* bitmap() const { return m_bitmap; }
 | |
|     Bitmap* bitmap() { return m_bitmap; }
 | |
| 
 | |
| private:
 | |
|     friend class Bitmap;
 | |
| 
 | |
|     RefPtr<Bitmap> m_bitmap;
 | |
| };
 | |
| 
 | |
| }
 | |
| 
 | |
| namespace IPC {
 | |
| 
 | |
| bool encode(Encoder&, const Gfx::ShareableBitmap&);
 | |
| ErrorOr<void> decode(Decoder&, Gfx::ShareableBitmap&);
 | |
| 
 | |
| }
 |