1.1-rc3
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
Screen Class Referenceabstract

Manages one of more buffers that make up a Screen. More...

Inheritance diagram for Screen:
Inheritance graph
[legend]

Public Types

using DamageArray = std::vector< Rect >
 Type used for damage arrays. More...
 

Public Member Functions

 Screen () noexcept
 
 Screen (const Screen &)=default
 
 Screen (Screen &&) noexcept=default
 
virtual ~Screen () noexcept=default
 
void async_flip (bool async)
 Set if asynchronous buffer flips are used. More...
 
EGT_NODISCARD Rect box () const
 Bounding box for the screen. More...
 
virtual EGT_NODISCARD size_t brightness () const
 Get the current brightness of the screen. More...
 
virtual void brightness (size_t brightness)
 Set the brightness of the screen. More...
 
EGT_NODISCARD shared_cairo_t context () const
 Get the context for the screen. More...
 
virtual void flip (const DamageArray &damage)
 Perform a flip of the buffers. More...
 
EGT_NODISCARD PixelFormat format () const
 Get the format of the screen. More...
 
virtual EGT_NODISCARD bool have_planes () const
 Returns true if the screen supports planes. More...
 
virtual void high_fidelity ()
 Configure high fidelity options. More...
 
virtual uint32_t index ()
 If the screen implementation manages multiple buffers, this will return the index of the current buffer. More...
 
virtual void low_fidelity ()
 Configure low fidelity options. More...
 
virtual EGT_NODISCARD size_t max_brightness () const
 Get the max brightness of the screen. More...
 
Screenoperator= (const Screen &)=default
 
Screenoperator= (Screen &&) noexcept=default
 
virtual void schedule_flip ()=0
 Schedule a flip to occur later. More...
 
EGT_NODISCARD Size size () const
 Size of the screen. More...
 

Static Public Member Functions

static void damage_algorithm (Screen::DamageArray &damage, Rect rect)
 This function implements the algorithm for adding damage rectangles to a list. More...
 

Protected Types

using BufferArray = std::vector< ScreenBuffer >
 Type used for an array of ScreenBuffer objects. More...
 

Protected Member Functions

virtual void copy_to_buffer (ScreenBuffer &buffer)
 Copy the framebuffer to the current composition buffer. More...
 
void copy_to_buffer_software (ScreenBuffer &buffer)
 Copy the framebuffer to the current composition buffer. More...
 
void init (const Size &size, PixelFormat format=PixelFormat::argb8888)
 
void init (void **ptr, uint32_t count, const Size &size, PixelFormat format=PixelFormat::argb8888)
 

Protected Attributes

bool m_async {false}
 Perform flips asynchronously if supported. More...
 
BufferArray m_buffers
 Screen buffer array. More...
 
shared_cairo_t m_cr
 Composition surface context. More...
 
PixelFormat m_format {}
 Format of the screen. More...
 
Size m_size
 Size of the screen. More...
 
shared_cairo_surface_t m_surface
 Composition surface. More...
 

Detailed Description

Manages one of more buffers that make up a Screen.

Note
A Screen is not necessarily the same resolution and Orientation of the Display.

Member Typedef Documentation

◆ BufferArray

using BufferArray = std::vector<ScreenBuffer>
protected

Type used for an array of ScreenBuffer objects.

◆ DamageArray

using DamageArray = std::vector<Rect>

Type used for damage arrays.

Constructor & Destructor Documentation

◆ Screen() [1/3]

Screen ( )
noexcept

◆ Screen() [2/3]

Screen ( const Screen )
default

◆ Screen() [3/3]

Screen ( Screen &&  )
defaultnoexcept

◆ ~Screen()

virtual ~Screen ( )
virtualdefaultnoexcept

Member Function Documentation

◆ async_flip()

void async_flip ( bool  async)
inline

Set if asynchronous buffer flips are used.

◆ box()

EGT_NODISCARD Rect box ( ) const
inline

Bounding box for the screen.

◆ brightness() [1/2]

virtual EGT_NODISCARD size_t brightness ( ) const
virtual

Get the current brightness of the screen.

Note
Not all screens support this capability.

Reimplemented in KMSScreen.

◆ brightness() [2/2]

virtual void brightness ( size_t  brightness)
virtual

Set the brightness of the screen.

Parameters
brightnessValue from 0 to max_brightness().
Note
Not all screens support this capability.

Reimplemented in KMSScreen.

◆ context()

EGT_NODISCARD shared_cairo_t context ( ) const
inline

Get the context for the screen.

Get the target surface from this using cairo_get_target().

◆ copy_to_buffer()

virtual void copy_to_buffer ( ScreenBuffer &  buffer)
protectedvirtual

Copy the framebuffer to the current composition buffer.

Reimplemented in X11Screen.

◆ copy_to_buffer_software()

void copy_to_buffer_software ( ScreenBuffer &  buffer)
protected

Copy the framebuffer to the current composition buffer.

◆ damage_algorithm()

static void damage_algorithm ( Screen::DamageArray damage,
Rect  rect 
)
static

This function implements the algorithm for adding damage rectangles to a list.

Parameters
[in,out]damageThe starting and ending damage array.
[in]rectThe new rectangle to add.
Note
This function may be implemented to be recursive.

◆ flip()

virtual void flip ( const DamageArray damage)
virtual

Perform a flip of the buffers.

This iterates the buffers and puts the composition buffer into the screen buffers.

Note
This will call schedule_flip() automatically.

Reimplemented in X11Screen, and SDLScreen.

◆ format()

EGT_NODISCARD PixelFormat format ( ) const
inline

Get the format of the screen.

◆ have_planes()

virtual EGT_NODISCARD bool have_planes ( ) const
inlinevirtual

Returns true if the screen supports planes.

Reimplemented in KMSScreen.

◆ high_fidelity()

virtual void high_fidelity ( )
virtual

Configure high fidelity options.

This configures settings related to font hinting, font aliasing, and shape aliasing.

◆ index()

virtual uint32_t index ( )
inlinevirtual

If the screen implementation manages multiple buffers, this will return the index of the current buffer.

Reimplemented in KMSOverlay, and KMSScreen.

◆ init() [1/2]

void init ( const Size size,
PixelFormat  format = PixelFormat::argb8888 
)
inlineprotected
See also
init()

◆ init() [2/2]

void init ( void **  ptr,
uint32_t  count,
const Size size,
PixelFormat  format = PixelFormat::argb8888 
)
protected
Parameters
ptrArray of framebuffer pointers.
countSize of ptr array. Zero is allowed.
sizeSize of the framebuffers. They must all be the same.
formatFormat of the framebuffers.

◆ low_fidelity()

virtual void low_fidelity ( )
virtual

Configure low fidelity options.

This configures settings related to font hinting, font aliasing, and shape aliasing.

◆ max_brightness()

virtual EGT_NODISCARD size_t max_brightness ( ) const
virtual

Get the max brightness of the screen.

Note
Not all screens support this capability.

Reimplemented in KMSScreen.

◆ operator=() [1/2]

Screen& operator= ( const Screen )
default

◆ operator=() [2/2]

Screen& operator= ( Screen &&  )
defaultnoexcept

◆ schedule_flip()

virtual void schedule_flip ( )
pure virtual

Schedule a flip to occur later.

This is needed if a flip should occur sometime in the future to the hardware.

Implemented in KMSOverlay, KMSScreen, X11Screen, SDLScreen, FrameBuffer, and MemoryScreen.

◆ size()

EGT_NODISCARD Size size ( ) const
inline

Size of the screen.

Member Data Documentation

◆ m_async

bool m_async {false}
protected

Perform flips asynchronously if supported.

◆ m_buffers

BufferArray m_buffers
protected

Screen buffer array.

◆ m_cr

shared_cairo_t m_cr
protected

Composition surface context.

◆ m_format

PixelFormat m_format {}
protected

Format of the screen.

◆ m_size

Size m_size
protected

Size of the screen.

◆ m_surface

shared_cairo_surface_t m_surface
protected

Composition surface.