src/video/mir/SDL_mirframebuffer.c
author Philipp Wiesemann <philipp.wiesemann@arcor.de>
Wed, 24 Feb 2016 21:07:19 +0100
changeset 10094 fdfdae3f6039
parent 10089 25fda20d0173
permissions -rw-r--r--
Mir: Replaced memcpy() with SDL_memcpy().
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     1
/*
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     2
  Simple DirectMedia Layer
9998
f67cf37e9cd4 Updated copyright to 2016
Sam Lantinga <slouken@libsdl.org>
parents: 9619
diff changeset
     3
  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     4
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     5
  This software is provided 'as-is', without any express or implied
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     7
  arising from the use of this software.
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     8
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    11
  freely, subject to the following restrictions:
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    12
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    14
     claim that you wrote the original software. If you use this software
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    16
     appreciated but is not required.
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    18
     misrepresented as being the original software.
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    20
*/
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    21
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    22
/*
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    23
  Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    24
*/
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    25
8154
ea6b25de67b6 Cleaned up headers and footers on Mir code.
Ryan C. Gordon <icculus@icculus.org>
parents: 8153
diff changeset
    26
#include "../../SDL_internal.h"
ea6b25de67b6 Cleaned up headers and footers on Mir code.
Ryan C. Gordon <icculus@icculus.org>
parents: 8153
diff changeset
    27
ea6b25de67b6 Cleaned up headers and footers on Mir code.
Ryan C. Gordon <icculus@icculus.org>
parents: 8153
diff changeset
    28
#if SDL_VIDEO_DRIVER_MIR
ea6b25de67b6 Cleaned up headers and footers on Mir code.
Ryan C. Gordon <icculus@icculus.org>
parents: 8153
diff changeset
    29
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    30
#include "SDL_mirevents.h"
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    31
#include "SDL_mirframebuffer.h"
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    32
#include "SDL_mirwindow.h"
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    33
8159
427e8fdf6f69 Hooked up dynamic loading for Mir.
Ryan C. Gordon <icculus@icculus.org>
parents: 8157
diff changeset
    34
#include "SDL_mirdyn.h"
427e8fdf6f69 Hooked up dynamic loading for Mir.
Ryan C. Gordon <icculus@icculus.org>
parents: 8157
diff changeset
    35
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    36
static const Uint32 mir_pixel_format_to_sdl_format[] = {
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    37
    SDL_PIXELFORMAT_UNKNOWN,  /* mir_pixel_format_invalid   */
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    38
    SDL_PIXELFORMAT_ABGR8888, /* mir_pixel_format_abgr_8888 */
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    39
    SDL_PIXELFORMAT_BGR888,   /* mir_pixel_format_xbgr_8888 */
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    40
    SDL_PIXELFORMAT_ARGB8888, /* mir_pixel_format_argb_8888 */
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    41
    SDL_PIXELFORMAT_RGB888,   /* mir_pixel_format_xrgb_8888 */
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    42
    SDL_PIXELFORMAT_BGR24,    /* mir_pixel_format_bgr_888   */
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    43
    SDL_PIXELFORMAT_RGB24,    /* mir_pixel_format_rgb_888   */
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    44
    SDL_PIXELFORMAT_RGB565,   /* mir_pixel_format_rgb_565   */
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    45
    SDL_PIXELFORMAT_RGBA5551, /* mir_pixel_format_rgba_5551 */
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    46
    SDL_PIXELFORMAT_RGBA4444  /* mir_pixel_format_rgba_4444 */
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    47
};
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    48
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    49
Uint32
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    50
MIR_GetSDLPixelFormat(MirPixelFormat format)
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    51
{
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    52
    return mir_pixel_format_to_sdl_format[format];
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    53
}
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    54
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    55
int
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    56
MIR_CreateWindowFramebuffer(_THIS, SDL_Window* window, Uint32* format,
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    57
                            void** pixels, int* pitch)
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    58
{
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    59
    MIR_Data* mir_data = _this->driverdata;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    60
8749
f34996d809b7 Fix software rendering in the mir backend. The window assumed hardware buffer, which caused testdrawchessboard to fail to mmap a buffer.
Brandon Schaefer <brandon.schaefer@canonical.com>
parents: 8300
diff changeset
    61
    mir_data->software = SDL_TRUE;
f34996d809b7 Fix software rendering in the mir backend. The window assumed hardware buffer, which caused testdrawchessboard to fail to mmap a buffer.
Brandon Schaefer <brandon.schaefer@canonical.com>
parents: 8300
diff changeset
    62
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    63
    if (MIR_CreateWindow(_this, window) < 0)
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    64
        return SDL_SetError("Failed to created a mir window.");
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    65
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    66
    *format = MIR_GetSDLPixelFormat(mir_data->pixel_format);
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    67
    if (*format == SDL_PIXELFORMAT_UNKNOWN)
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    68
        return SDL_SetError("Unknown pixel format");
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    69
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    70
    *pitch = (((window->w * SDL_BYTESPERPIXEL(*format)) + 3) & ~3);
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    71
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    72
    *pixels = SDL_malloc(window->h*(*pitch));
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    73
    if (*pixels == NULL)
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    74
        return SDL_OutOfMemory();
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    75
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    76
    return 0;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    77
}
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    78
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    79
int
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    80
MIR_UpdateWindowFramebuffer(_THIS, SDL_Window* window,
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    81
                            const SDL_Rect* rects, int numrects)
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    82
{
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    83
    MIR_Window* mir_window = window->driverdata;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    84
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    85
    MirGraphicsRegion region;
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    86
    MirBufferStream* bs;
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    87
    int i, j, x, y, w, h, start;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    88
    int bytes_per_pixel, bytes_per_row, s_stride, d_stride;
8300
8393682d9d96 Patched to compile on C89 compilers.
Ryan C. Gordon <icculus@icculus.org>
parents: 8159
diff changeset
    89
    char* s_dest;
8393682d9d96 Patched to compile on C89 compilers.
Ryan C. Gordon <icculus@icculus.org>
parents: 8159
diff changeset
    90
    char* pixels;
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    91
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    92
    bs = MIR_mir_surface_get_buffer_stream(mir_window->surface);
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
    93
    MIR_mir_buffer_stream_get_graphics_region(bs, &region);
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    94
8300
8393682d9d96 Patched to compile on C89 compilers.
Ryan C. Gordon <icculus@icculus.org>
parents: 8159
diff changeset
    95
    s_dest = region.vaddr;
8393682d9d96 Patched to compile on C89 compilers.
Ryan C. Gordon <icculus@icculus.org>
parents: 8159
diff changeset
    96
    pixels = (char*)window->surface->pixels;
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    97
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    98
    s_stride = window->surface->pitch;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    99
    d_stride = region.stride;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   100
    bytes_per_pixel = window->surface->format->BytesPerPixel;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   101
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   102
    for (i = 0; i < numrects; i++) {
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   103
        s_dest = region.vaddr;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   104
        pixels = (char*)window->surface->pixels;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   105
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   106
        x = rects[i].x;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   107
        y = rects[i].y;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   108
        w = rects[i].w;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   109
        h = rects[i].h;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   110
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   111
        if (w <= 0 || h <= 0 || (x + w) <= 0 || (y + h) <= 0)
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   112
            continue;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   113
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   114
        if (x < 0) {
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   115
            x += w;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   116
            w += rects[i].x;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   117
        }
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   118
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   119
        if (y < 0) {
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   120
            y += h;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   121
            h += rects[i].y;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   122
        }
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   123
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   124
        if (x + w > window->w)
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   125
            w = window->w - x;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   126
        if (y + h > window->h)
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   127
            h = window->h - y;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   128
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   129
        start = y * s_stride + x;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   130
        pixels += start;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   131
        s_dest += start;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   132
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   133
        bytes_per_row =  bytes_per_pixel * w;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   134
        for (j = 0; j < h; j++) {
10094
fdfdae3f6039 Mir: Replaced memcpy() with SDL_memcpy().
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 10089
diff changeset
   135
            SDL_memcpy(s_dest, pixels, bytes_per_row);
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   136
            pixels += s_stride;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   137
            s_dest += d_stride;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   138
        }
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   139
    }
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   140
10089
25fda20d0173 Fix API/ABI breakage in Mir 0.13/0.14.
bschaefer
parents: 9998
diff changeset
   141
    MIR_mir_buffer_stream_swap_buffers_sync(bs);
8153
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   142
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   143
    return 0;
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   144
}
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   145
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   146
void
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   147
MIR_DestroyWindowFramebuffer(_THIS, SDL_Window* window)
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   148
{
3e43c73ac79b Added Mir video target (thanks, Brandon!).
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   149
}
8154
ea6b25de67b6 Cleaned up headers and footers on Mir code.
Ryan C. Gordon <icculus@icculus.org>
parents: 8153
diff changeset
   150
ea6b25de67b6 Cleaned up headers and footers on Mir code.
Ryan C. Gordon <icculus@icculus.org>
parents: 8153
diff changeset
   151
#endif /* SDL_VIDEO_DRIVER_MIR */
ea6b25de67b6 Cleaned up headers and footers on Mir code.
Ryan C. Gordon <icculus@icculus.org>
parents: 8153
diff changeset
   152
ea6b25de67b6 Cleaned up headers and footers on Mir code.
Ryan C. Gordon <icculus@icculus.org>
parents: 8153
diff changeset
   153
/* vi: set ts=4 sw=4 expandtab: */