26 #include "../../SDL_internal.h" 28 #if SDL_VIDEO_DRIVER_MIR 36 static const Uint32 mir_pixel_format_to_sdl_format[] = {
46 MIR_GetSDLPixelFormat(MirPixelFormat
format)
48 return mir_pixel_format_to_sdl_format[
format];
57 MirSurfaceParameters surfaceparm;
66 MIR_mir_surface_get_parameters(mir_window->
surface, &surfaceparm);
68 *format = MIR_GetSDLPixelFormat(surfaceparm.pixel_format);
78 mir_window->
surface = MIR_mir_connection_create_surface_sync(mir_data->
connection, &surfaceparm);
79 if (!MIR_mir_surface_is_valid(mir_window->
surface)) {
80 const char* error = MIR_mir_surface_get_error_message(mir_window->
surface);
81 return SDL_SetError(
"Failed to created a mir surface: %s", error);
93 MirGraphicsRegion region;
95 int bytes_per_pixel, bytes_per_row, s_stride, d_stride;
99 MIR_mir_surface_get_graphics_region(mir_window->
surface, ®ion);
101 s_dest = region.vaddr;
105 d_stride = region.stride;
108 for (i = 0; i < numrects; i++) {
109 s_dest = region.vaddr;
117 if (w <= 0 || h <= 0 || (x + w) <= 0 || (y +
h) <= 0)
130 if (x + w > window->
w)
132 if (y + h > window->
h)
135 start = y * s_stride +
x;
139 bytes_per_row = bytes_per_pixel *
w;
140 for (j = 0; j <
h; j++) {
141 memcpy(s_dest, pixels, bytes_per_row);
147 MIR_mir_surface_swap_buffers_sync(mir_window->
surface);
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
uint32_t Uint32
An unsigned 32-bit integer type.
int MIR_CreateWindowFramebuffer(_THIS, SDL_Window *sdl_window, Uint32 *format, void **pixels, int *pitch)
GLint GLint GLint GLint GLint x
int MIR_CreateWindow(_THIS, SDL_Window *window)
#define SDL_BYTESPERPIXEL(X)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
static SDL_VideoDevice * _this
MirConnection * connection
GLint GLint GLint GLint GLint GLint y
int MIR_UpdateWindowFramebuffer(_THIS, SDL_Window *sdl_window, const SDL_Rect *rects, int numrects)
void MIR_DestroyWindowFramebuffer(_THIS, SDL_Window *sdl_window)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
#define SDL_OutOfMemory()
The type used to identify a window.
SDL_Rect rects[MAX_RECTS]
GLubyte GLubyte GLubyte GLubyte w
GLfloat GLfloat GLfloat GLfloat h
A rectangle, with the origin at the upper left.
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int in j)