src/video/mir/SDL_mirframebuffer.c
changeset 10089 25fda20d0173
parent 9998 f67cf37e9cd4
child 10094 fdfdae3f6039
     1.1 --- a/src/video/mir/SDL_mirframebuffer.c	Sun Feb 21 17:21:29 2016 -0500
     1.2 +++ b/src/video/mir/SDL_mirframebuffer.c	Sun Feb 21 15:19:35 2016 -0800
     1.3 @@ -39,7 +39,11 @@
     1.4      SDL_PIXELFORMAT_BGR888,   /* mir_pixel_format_xbgr_8888 */
     1.5      SDL_PIXELFORMAT_ARGB8888, /* mir_pixel_format_argb_8888 */
     1.6      SDL_PIXELFORMAT_RGB888,   /* mir_pixel_format_xrgb_8888 */
     1.7 -    SDL_PIXELFORMAT_BGR24     /* mir_pixel_format_bgr_888   */
     1.8 +    SDL_PIXELFORMAT_BGR24,    /* mir_pixel_format_bgr_888   */
     1.9 +    SDL_PIXELFORMAT_RGB24,    /* mir_pixel_format_rgb_888   */
    1.10 +    SDL_PIXELFORMAT_RGB565,   /* mir_pixel_format_rgb_565   */
    1.11 +    SDL_PIXELFORMAT_RGBA5551, /* mir_pixel_format_rgba_5551 */
    1.12 +    SDL_PIXELFORMAT_RGBA4444  /* mir_pixel_format_rgba_4444 */
    1.13  };
    1.14  
    1.15  Uint32
    1.16 @@ -53,19 +57,13 @@
    1.17                              void** pixels, int* pitch)
    1.18  {
    1.19      MIR_Data* mir_data = _this->driverdata;
    1.20 -    MIR_Window* mir_window;
    1.21 -    MirSurfaceParameters surfaceparm;
    1.22  
    1.23      mir_data->software = SDL_TRUE;
    1.24  
    1.25      if (MIR_CreateWindow(_this, window) < 0)
    1.26          return SDL_SetError("Failed to created a mir window.");
    1.27  
    1.28 -    mir_window = window->driverdata;
    1.29 -
    1.30 -    MIR_mir_surface_get_parameters(mir_window->surface, &surfaceparm);
    1.31 -
    1.32 -    *format = MIR_GetSDLPixelFormat(surfaceparm.pixel_format);
    1.33 +    *format = MIR_GetSDLPixelFormat(mir_data->pixel_format);
    1.34      if (*format == SDL_PIXELFORMAT_UNKNOWN)
    1.35          return SDL_SetError("Unknown pixel format");
    1.36  
    1.37 @@ -75,12 +73,6 @@
    1.38      if (*pixels == NULL)
    1.39          return SDL_OutOfMemory();
    1.40  
    1.41 -    mir_window->surface = MIR_mir_connection_create_surface_sync(mir_data->connection, &surfaceparm);
    1.42 -    if (!MIR_mir_surface_is_valid(mir_window->surface)) {
    1.43 -        const char* error = MIR_mir_surface_get_error_message(mir_window->surface);
    1.44 -        return SDL_SetError("Failed to created a mir surface: %s", error);
    1.45 -    }
    1.46 -
    1.47      return 0;
    1.48  }
    1.49  
    1.50 @@ -91,12 +83,14 @@
    1.51      MIR_Window* mir_window = window->driverdata;
    1.52  
    1.53      MirGraphicsRegion region;
    1.54 +    MirBufferStream* bs;
    1.55      int i, j, x, y, w, h, start;
    1.56      int bytes_per_pixel, bytes_per_row, s_stride, d_stride;
    1.57      char* s_dest;
    1.58      char* pixels;
    1.59  
    1.60 -    MIR_mir_surface_get_graphics_region(mir_window->surface, &region);
    1.61 +    bs = MIR_mir_surface_get_buffer_stream(mir_window->surface);
    1.62 +    MIR_mir_buffer_stream_get_graphics_region(bs, &region);
    1.63  
    1.64      s_dest = region.vaddr;
    1.65      pixels = (char*)window->surface->pixels;
    1.66 @@ -144,7 +138,7 @@
    1.67          }
    1.68      }
    1.69  
    1.70 -    MIR_mir_surface_swap_buffers_sync(mir_window->surface);
    1.71 +    MIR_mir_buffer_stream_swap_buffers_sync(bs);
    1.72  
    1.73      return 0;
    1.74  }