The Pedigree Project
0.1
|
#include <Graphics.h>
Public Member Functions | |
size_t | getWidth () |
size_t | getHeight () |
PedigreeGraphics::PixelFormat | getFormat () |
size_t | getBytesPerPixel () |
void | setPalette (uint32_t *palette, size_t entries) |
void * | getRawBuffer () |
Framebuffer * | createChild (size_t x, size_t y, size_t w, size_t h) |
bool | convertPixel (uint32_t source, PedigreeGraphics::PixelFormat srcFormat, uint32_t &dest, PedigreeGraphics::PixelFormat destFormat) |
PedigreeGraphics::Buffer * | createBuffer (const void *srcData, PedigreeGraphics::PixelFormat srcFormat, size_t width, size_t height) |
void | destroyBuffer (PedigreeGraphics::Buffer *pBuffer) |
void | redraw (size_t x=~0UL, size_t y=~0UL, size_t w=~0UL, size_t h=~0UL, bool bChild=false) |
void | blit (PedigreeGraphics::Buffer *pBuffer, size_t srcx, size_t srcy, size_t destx, size_t desty, size_t width, size_t height) |
void | draw (void *pBuffer, size_t srcx, size_t srcy, size_t destx, size_t desty, size_t width, size_t height, PedigreeGraphics::PixelFormat format=PedigreeGraphics::Bits32_Argb) |
void | rect (size_t x, size_t y, size_t width, size_t height, uint32_t colour, PedigreeGraphics::PixelFormat format=PedigreeGraphics::Bits32_Argb) |
void | copy (size_t srcx, size_t srcy, size_t destx, size_t desty, size_t w, size_t h) |
void | line (size_t x1, size_t y1, size_t x2, size_t y2, uint32_t colour, PedigreeGraphics::PixelFormat format=PedigreeGraphics::Bits32_Argb) |
void | setPixel (size_t x, size_t y, uint32_t colour, PedigreeGraphics::PixelFormat format=PedigreeGraphics::Bits32_Argb) |
Framebuffer (GraphicsProvider &gfx) | |
GraphicsProvider | getProvider () |
Private Attributes | |
GraphicsProvider | m_Provider |
bool | m_bProviderValid |
bool | m_bIsChild |
This class provides a generic interface for interfacing with a framebuffer. Each display driver specialises this class to define the "base address" of the framebuffer in its own way (eg, allocate memory, or use a DMA region). There are a variety of default software-only operations, which are used by default if the main operational methods are not overridden.
Definition at line 133 of file modules/subsys/native/include/pedigree/native/graphics/Graphics.h.
Framebuffer::Framebuffer | ( | GraphicsProvider & | gfx | ) |
Creates a framebuffer given a GraphicsProvider. Sanity checked and should barely be used (as the information itself only ever comes from the kernel; it cannot be fabricated).
Definition at line 104 of file modules/subsys/native/user/graphics/Graphics.cc.
void Framebuffer::blit | ( | PedigreeGraphics::Buffer * | pBuffer, |
size_t | srcx, | ||
size_t | srcy, | ||
size_t | destx, | ||
size_t | desty, | ||
size_t | width, | ||
size_t | height | ||
) |
Blits a given buffer to the screen. See createBuffer.
Definition at line 277 of file modules/subsys/native/user/graphics/Graphics.cc.
bool PedigreeGraphics::Framebuffer::convertPixel | ( | uint32_t | source, |
PedigreeGraphics::PixelFormat | srcFormat, | ||
uint32_t & | dest, | ||
PedigreeGraphics::PixelFormat | destFormat | ||
) |
Converts a given pixel from one pixel format to another.
void Framebuffer::copy | ( | size_t | srcx, |
size_t | srcy, | ||
size_t | destx, | ||
size_t | desty, | ||
size_t | w, | ||
size_t | h | ||
) |
Copies a rectangle already on the framebuffer to a new location
Definition at line 331 of file modules/subsys/native/user/graphics/Graphics.cc.
Buffer * Framebuffer::createBuffer | ( | const void * | srcData, |
PedigreeGraphics::PixelFormat | srcFormat, | ||
size_t | width, | ||
size_t | height | ||
) |
Creates a new buffer to be used for blits from the given raw pixel data. Performs automatic conversion of the pixel format to the pixel format of the current display mode. Do not modify any of the members of the buffer structure, or attempt to inject your own pixels into the buffer. Once a buffer is created, it is only used for blitting to the screen and cannot be modified. It is expected that the buffer has been packed to its bit depth, and does not have any padding on each scanline at all. Do not delete the returned buffer yourself, pass it to destroyBuffer which performs a proper cleanup of all resources related to the buffer. The buffer should be padded to finish on a DWORD boundary. This is not padding per scanline but rather padding per buffer.
Definition at line 230 of file modules/subsys/native/user/graphics/Graphics.cc.
Framebuffer * Framebuffer::createChild | ( | size_t | x, |
size_t | y, | ||
size_t | w, | ||
size_t | h | ||
) |
Creates a new child of this framebuffer with the given semantics. Do a normal "delete" to destroy memory consumed by this new buffer.
Definition at line 200 of file modules/subsys/native/user/graphics/Graphics.cc.
void Framebuffer::destroyBuffer | ( | PedigreeGraphics::Buffer * | pBuffer | ) |
Destroys a created buffer. Frees its memory in both the system RAM and any references still in VRAM.
Definition at line 254 of file modules/subsys/native/user/graphics/Graphics.cc.
void Framebuffer::draw | ( | void * | pBuffer, |
size_t | srcx, | ||
size_t | srcy, | ||
size_t | destx, | ||
size_t | desty, | ||
size_t | width, | ||
size_t | height, | ||
PedigreeGraphics::PixelFormat | format = PedigreeGraphics::Bits32_Argb |
||
) |
Draws given raw pixel data to the screen. Used for framebuffer chains and applications which need to render constantly changing pixel buffers.
Definition at line 293 of file modules/subsys/native/user/graphics/Graphics.cc.
size_t Framebuffer::getBytesPerPixel | ( | ) |
Gets the number of bytes per pixel for the framebuffer
Definition at line 181 of file modules/subsys/native/user/graphics/Graphics.cc.
PixelFormat Framebuffer::getFormat | ( | ) |
Gets the framebuffer's native format
Definition at line 170 of file modules/subsys/native/user/graphics/Graphics.cc.
size_t Framebuffer::getHeight | ( | ) |
Gets the framebuffer height
Definition at line 159 of file modules/subsys/native/user/graphics/Graphics.cc.
Referenced by Terminal::getSelectFd().
|
inline |
Gets the internal GraphicsProvider for the framebuffer.
Definition at line 245 of file modules/subsys/native/include/pedigree/native/graphics/Graphics.h.
void * Framebuffer::getRawBuffer | ( | ) |
Gets a raw pointer to the framebuffer itself. There is no way to know if this pointer points to an MMIO region or real RAM, so it cannot be guaranteed to be safe. There is no way to determine if an application can safely use this buffer without segfaulting.
Definition at line 192 of file modules/subsys/native/user/graphics/Graphics.cc.
size_t Framebuffer::getWidth | ( | ) |
Gets the framebuffer width
Definition at line 148 of file modules/subsys/native/user/graphics/Graphics.cc.
Referenced by Terminal::getSelectFd().
void Framebuffer::line | ( | size_t | x1, |
size_t | y1, | ||
size_t | x2, | ||
size_t | y2, | ||
uint32_t | colour, | ||
PedigreeGraphics::PixelFormat | format = PedigreeGraphics::Bits32_Argb |
||
) |
Draws a line one pixel wide between two points on the screen
Definition at line 348 of file modules/subsys/native/user/graphics/Graphics.cc.
void Framebuffer::rect | ( | size_t | x, |
size_t | y, | ||
size_t | width, | ||
size_t | height, | ||
uint32_t | colour, | ||
PedigreeGraphics::PixelFormat | format = PedigreeGraphics::Bits32_Argb |
||
) |
Draws a single rectangle to the screen with the given colour.
Definition at line 313 of file modules/subsys/native/user/graphics/Graphics.cc.
void Framebuffer::redraw | ( | size_t | x = ~0UL , |
size_t | y = ~0UL , |
||
size_t | w = ~0UL , |
||
size_t | h = ~0UL , |
||
bool | bChild = false |
||
) |
Performs an update of a region of this framebuffer. This function can be used by drivers to request an area of the framebuffer be redrawn, but is useless for non-hardware-accelerated devices.
x | leftmost x co-ordinate of the redraw area, ~0 for "invalid" |
y | topmost y co-ordinate of the redraw area, ~0 for "invalid" |
w | width of the redraw area, ~0 for "invalid" |
h | height of the redraw area, ~0 for "invalid" |
bChild | non-zero if a child began the redraw, zero otherwise |
Definition at line 262 of file modules/subsys/native/user/graphics/Graphics.cc.
Referenced by Terminal::getSelectFd().
void Framebuffer::setPalette | ( | uint32_t * | palette, |
size_t | entries | ||
) |
Sets a new palette for use with indexed colour formats. The palette should be an array of uint32_t's, all of which will be interpreted as 24-bit RGB.
Definition at line 140 of file modules/subsys/native/user/graphics/Graphics.cc.
void Framebuffer::setPixel | ( | size_t | x, |
size_t | y, | ||
uint32_t | colour, | ||
PedigreeGraphics::PixelFormat | format = PedigreeGraphics::Bits32_Argb |
||
) |
Sets an individual pixel on the framebuffer. Not inheritable.
Definition at line 366 of file modules/subsys/native/user/graphics/Graphics.cc.