src/video/SDL_blit_auto.c
changeset 2262 bee005ace1bf
child 2263 900c35d8e8fd
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/video/SDL_blit_auto.c	Fri Aug 17 06:21:58 2007 +0000
     1.3 @@ -0,0 +1,5357 @@
     1.4 +/* DO NOT EDIT!  This file is generated by sdlgenblit.pl */
     1.5 +/*
     1.6 +    SDL - Simple DirectMedia Layer
     1.7 +    Copyright (C) 1997-2006 Sam Lantinga
     1.8 +
     1.9 +    This library is free software; you can redistribute it and/or
    1.10 +    modify it under the terms of the GNU Lesser General Public
    1.11 +    License as published by the Free Software Foundation; either
    1.12 +    version 2.1 of the License, or (at your option) any later version.
    1.13 +
    1.14 +    This library is distributed in the hope that it will be useful,
    1.15 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.16 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.17 +    Lesser General Public License for more details.
    1.18 +
    1.19 +    You should have received a copy of the GNU Lesser General Public
    1.20 +    License along with this library; if not, write to the Free Software
    1.21 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    1.22 +
    1.23 +    Sam Lantinga
    1.24 +    slouken@libsdl.org
    1.25 +*/
    1.26 +#include "SDL_config.h"
    1.27 +
    1.28 +/* *INDENT-OFF* */
    1.29 +
    1.30 +#include "SDL_video.h"
    1.31 +#include "SDL_blit.h"
    1.32 +#include "SDL_blit_auto.h"
    1.33 +
    1.34 +static SDL_BlitFuncEntry _SDL_GeneratedBlitFuncTable[] = {
    1.35 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Scale },
    1.36 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend },
    1.37 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend_Scale },
    1.38 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate },
    1.39 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Scale },
    1.40 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Blend },
    1.41 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale },
    1.42 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Scale },
    1.43 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Blend },
    1.44 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Blend_Scale },
    1.45 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate },
    1.46 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Scale },
    1.47 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend },
    1.48 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale },
    1.49 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Scale },
    1.50 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend },
    1.51 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend_Scale },
    1.52 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate },
    1.53 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Scale },
    1.54 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Blend },
    1.55 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale },
    1.56 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Scale },
    1.57 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Blend },
    1.58 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Blend_Scale },
    1.59 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate },
    1.60 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Scale },
    1.61 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend },
    1.62 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale },
    1.63 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Scale },
    1.64 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend },
    1.65 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend_Scale },
    1.66 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate },
    1.67 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Scale },
    1.68 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Blend },
    1.69 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale },
    1.70 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Scale },
    1.71 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Blend },
    1.72 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Blend_Scale },
    1.73 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate },
    1.74 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Scale },
    1.75 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend },
    1.76 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale },
    1.77 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Scale },
    1.78 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend },
    1.79 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend_Scale },
    1.80 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate },
    1.81 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Scale },
    1.82 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Blend },
    1.83 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale },
    1.84 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Scale },
    1.85 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Blend },
    1.86 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Blend_Scale },
    1.87 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate },
    1.88 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Scale },
    1.89 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend },
    1.90 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale },
    1.91 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Scale },
    1.92 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend },
    1.93 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend_Scale },
    1.94 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate },
    1.95 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Scale },
    1.96 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Blend },
    1.97 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale },
    1.98 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Scale },
    1.99 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Blend },
   1.100 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Blend_Scale },
   1.101 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate },
   1.102 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Scale },
   1.103 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend },
   1.104 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale },
   1.105 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Scale },
   1.106 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend },
   1.107 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend_Scale },
   1.108 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate },
   1.109 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Scale },
   1.110 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Blend },
   1.111 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale },
   1.112 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Scale },
   1.113 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Blend },
   1.114 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Blend_Scale },
   1.115 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate },
   1.116 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Scale },
   1.117 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend },
   1.118 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale },
   1.119 +    { 0, 0, 0, 0, NULL }
   1.120 +};
   1.121 +
   1.122 +SDL_BlitFuncEntry *SDL_GeneratedBlitFuncTable = _SDL_GeneratedBlitFuncTable;
   1.123 +
   1.124 +void SDL_Blit_RGB888_RGB888_Scale(SDL_BlitInfo *info)
   1.125 +{
   1.126 +    const int flags = info->flags;
   1.127 +    int srcy, srcx;
   1.128 +    int posy, posx;
   1.129 +    int incy, incx;
   1.130 +
   1.131 +    srcy = 0;
   1.132 +    posy = 0;
   1.133 +    incy = (info->src_h << 16) / info->dst_h;
   1.134 +    incx = (info->src_w << 16) / info->dst_w;
   1.135 +
   1.136 +    while (info->dst_h--) {
   1.137 +        Uint32 *src;
   1.138 +        Uint32 *dst = (Uint32 *)info->dst;
   1.139 +        int n = info->dst_w;
   1.140 +        srcx = -1;
   1.141 +        posx = 0x10000L;
   1.142 +        while (posy >= 0x10000L) {
   1.143 +            ++srcy;
   1.144 +            posy -= 0x10000L;
   1.145 +        }
   1.146 +        while (n--) {
   1.147 +            if (posx >= 0x10000L) {
   1.148 +                while (posx >= 0x10000L) {
   1.149 +                    ++srcx;
   1.150 +                    posx -= 0x10000L;
   1.151 +                }
   1.152 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
   1.153 +            }
   1.154 +            *dst = *src;
   1.155 +            posx += incx;
   1.156 +            ++dst;
   1.157 +        }
   1.158 +        posy += incy;
   1.159 +        info->dst += info->dst_pitch;
   1.160 +    }
   1.161 +}
   1.162 +
   1.163 +void SDL_Blit_RGB888_RGB888_Blend(SDL_BlitInfo *info)
   1.164 +{
   1.165 +    const int flags = info->flags;
   1.166 +    Uint32 srcpixel;
   1.167 +    Uint32 srcR, srcG, srcB, srcA;
   1.168 +    Uint32 dstpixel;
   1.169 +    Uint32 dstR, dstG, dstB, dstA;
   1.170 +
   1.171 +    while (info->dst_h--) {
   1.172 +        Uint32 *src = (Uint32 *)info->src;
   1.173 +        Uint32 *dst = (Uint32 *)info->dst;
   1.174 +        int n = info->dst_w;
   1.175 +        while (n--) {
   1.176 +            srcpixel = *src;
   1.177 +            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
   1.178 +            dstpixel = *dst;
   1.179 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
   1.180 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
   1.181 +                /* This goes away if we ever use premultiplied alpha */
   1.182 +                if (srcA < 255) {
   1.183 +                    srcR = (srcR * srcA) / 255;
   1.184 +                    srcG = (srcG * srcA) / 255;
   1.185 +                    srcB = (srcB * srcA) / 255;
   1.186 +                }
   1.187 +            }
   1.188 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
   1.189 +            case SDL_COPY_MASK:
   1.190 +                if (srcA) {
   1.191 +                    dstR = srcR;
   1.192 +                    dstG = srcG;
   1.193 +                    dstB = srcB;
   1.194 +                }
   1.195 +                break;
   1.196 +            case SDL_COPY_BLEND:
   1.197 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
   1.198 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
   1.199 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
   1.200 +                break;
   1.201 +            case SDL_COPY_ADD:
   1.202 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
   1.203 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
   1.204 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
   1.205 +                break;
   1.206 +            case SDL_COPY_MOD:
   1.207 +                dstR = (srcR * dstR) / 255;
   1.208 +                dstG = (srcG * dstG) / 255;
   1.209 +                dstB = (srcB * dstB) / 255;
   1.210 +                break;
   1.211 +            }
   1.212 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
   1.213 +            *dst = dstpixel;
   1.214 +            ++src;
   1.215 +            ++dst;
   1.216 +        }
   1.217 +        info->src += info->src_pitch;
   1.218 +        info->dst += info->dst_pitch;
   1.219 +    }
   1.220 +}
   1.221 +
   1.222 +void SDL_Blit_RGB888_RGB888_Blend_Scale(SDL_BlitInfo *info)
   1.223 +{
   1.224 +    const int flags = info->flags;
   1.225 +    Uint32 srcpixel;
   1.226 +    Uint32 srcR, srcG, srcB, srcA;
   1.227 +    Uint32 dstpixel;
   1.228 +    Uint32 dstR, dstG, dstB, dstA;
   1.229 +    int srcy, srcx;
   1.230 +    int posy, posx;
   1.231 +    int incy, incx;
   1.232 +
   1.233 +    srcy = 0;
   1.234 +    posy = 0;
   1.235 +    incy = (info->src_h << 16) / info->dst_h;
   1.236 +    incx = (info->src_w << 16) / info->dst_w;
   1.237 +
   1.238 +    while (info->dst_h--) {
   1.239 +        Uint32 *src;
   1.240 +        Uint32 *dst = (Uint32 *)info->dst;
   1.241 +        int n = info->dst_w;
   1.242 +        srcx = -1;
   1.243 +        posx = 0x10000L;
   1.244 +        while (posy >= 0x10000L) {
   1.245 +            ++srcy;
   1.246 +            posy -= 0x10000L;
   1.247 +        }
   1.248 +        while (n--) {
   1.249 +            if (posx >= 0x10000L) {
   1.250 +                while (posx >= 0x10000L) {
   1.251 +                    ++srcx;
   1.252 +                    posx -= 0x10000L;
   1.253 +                }
   1.254 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
   1.255 +            }
   1.256 +            srcpixel = *src;
   1.257 +            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
   1.258 +            dstpixel = *dst;
   1.259 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
   1.260 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
   1.261 +                /* This goes away if we ever use premultiplied alpha */
   1.262 +                if (srcA < 255) {
   1.263 +                    srcR = (srcR * srcA) / 255;
   1.264 +                    srcG = (srcG * srcA) / 255;
   1.265 +                    srcB = (srcB * srcA) / 255;
   1.266 +                }
   1.267 +            }
   1.268 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
   1.269 +            case SDL_COPY_MASK:
   1.270 +                if (srcA) {
   1.271 +                    dstR = srcR;
   1.272 +                    dstG = srcG;
   1.273 +                    dstB = srcB;
   1.274 +                }
   1.275 +                break;
   1.276 +            case SDL_COPY_BLEND:
   1.277 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
   1.278 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
   1.279 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
   1.280 +                break;
   1.281 +            case SDL_COPY_ADD:
   1.282 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
   1.283 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
   1.284 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
   1.285 +                break;
   1.286 +            case SDL_COPY_MOD:
   1.287 +                dstR = (srcR * dstR) / 255;
   1.288 +                dstG = (srcG * dstG) / 255;
   1.289 +                dstB = (srcB * dstB) / 255;
   1.290 +                break;
   1.291 +            }
   1.292 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
   1.293 +            *dst = dstpixel;
   1.294 +            posx += incx;
   1.295 +            ++dst;
   1.296 +        }
   1.297 +        posy += incy;
   1.298 +        info->dst += info->dst_pitch;
   1.299 +    }
   1.300 +}
   1.301 +
   1.302 +void SDL_Blit_RGB888_RGB888_Modulate(SDL_BlitInfo *info)
   1.303 +{
   1.304 +    const int flags = info->flags;
   1.305 +    const Uint32 modulateR = info->r;
   1.306 +    const Uint32 modulateG = info->g;
   1.307 +    const Uint32 modulateB = info->b;
   1.308 +    const Uint32 modulateA = info->a;
   1.309 +    Uint32 pixel;
   1.310 +    Uint32 R, G, B, A;
   1.311 +
   1.312 +    while (info->dst_h--) {
   1.313 +        Uint32 *src = (Uint32 *)info->src;
   1.314 +        Uint32 *dst = (Uint32 *)info->dst;
   1.315 +        int n = info->dst_w;
   1.316 +        while (n--) {
   1.317 +            pixel = *src;
   1.318 +            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
   1.319 +            if (flags & SDL_COPY_MODULATE_COLOR) {
   1.320 +                R = (R * modulateR) / 255;
   1.321 +                G = (G * modulateG) / 255;
   1.322 +                B = (B * modulateB) / 255;
   1.323 +            }
   1.324 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
   1.325 +                A = (A * modulateA) / 255;
   1.326 +            }
   1.327 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
   1.328 +            *dst = pixel;
   1.329 +            ++src;
   1.330 +            ++dst;
   1.331 +        }
   1.332 +        info->src += info->src_pitch;
   1.333 +        info->dst += info->dst_pitch;
   1.334 +    }
   1.335 +}
   1.336 +
   1.337 +void SDL_Blit_RGB888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
   1.338 +{
   1.339 +    const int flags = info->flags;
   1.340 +    const Uint32 modulateR = info->r;
   1.341 +    const Uint32 modulateG = info->g;
   1.342 +    const Uint32 modulateB = info->b;
   1.343 +    const Uint32 modulateA = info->a;
   1.344 +    Uint32 pixel;
   1.345 +    Uint32 R, G, B, A;
   1.346 +    int srcy, srcx;
   1.347 +    int posy, posx;
   1.348 +    int incy, incx;
   1.349 +
   1.350 +    srcy = 0;
   1.351 +    posy = 0;
   1.352 +    incy = (info->src_h << 16) / info->dst_h;
   1.353 +    incx = (info->src_w << 16) / info->dst_w;
   1.354 +
   1.355 +    while (info->dst_h--) {
   1.356 +        Uint32 *src;
   1.357 +        Uint32 *dst = (Uint32 *)info->dst;
   1.358 +        int n = info->dst_w;
   1.359 +        srcx = -1;
   1.360 +        posx = 0x10000L;
   1.361 +        while (posy >= 0x10000L) {
   1.362 +            ++srcy;
   1.363 +            posy -= 0x10000L;
   1.364 +        }
   1.365 +        while (n--) {
   1.366 +            if (posx >= 0x10000L) {
   1.367 +                while (posx >= 0x10000L) {
   1.368 +                    ++srcx;
   1.369 +                    posx -= 0x10000L;
   1.370 +                }
   1.371 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
   1.372 +            }
   1.373 +            pixel = *src;
   1.374 +            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
   1.375 +            if (flags & SDL_COPY_MODULATE_COLOR) {
   1.376 +                R = (R * modulateR) / 255;
   1.377 +                G = (G * modulateG) / 255;
   1.378 +                B = (B * modulateB) / 255;
   1.379 +            }
   1.380 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
   1.381 +                A = (A * modulateA) / 255;
   1.382 +            }
   1.383 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
   1.384 +            *dst = pixel;
   1.385 +            posx += incx;
   1.386 +            ++dst;
   1.387 +        }
   1.388 +        posy += incy;
   1.389 +        info->dst += info->dst_pitch;
   1.390 +    }
   1.391 +}
   1.392 +
   1.393 +void SDL_Blit_RGB888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
   1.394 +{
   1.395 +    const int flags = info->flags;
   1.396 +    const Uint32 modulateR = info->r;
   1.397 +    const Uint32 modulateG = info->g;
   1.398 +    const Uint32 modulateB = info->b;
   1.399 +    const Uint32 modulateA = info->a;
   1.400 +    Uint32 srcpixel;
   1.401 +    Uint32 srcR, srcG, srcB, srcA;
   1.402 +    Uint32 dstpixel;
   1.403 +    Uint32 dstR, dstG, dstB, dstA;
   1.404 +
   1.405 +    while (info->dst_h--) {
   1.406 +        Uint32 *src = (Uint32 *)info->src;
   1.407 +        Uint32 *dst = (Uint32 *)info->dst;
   1.408 +        int n = info->dst_w;
   1.409 +        while (n--) {
   1.410 +            srcpixel = *src;
   1.411 +            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
   1.412 +            dstpixel = *dst;
   1.413 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
   1.414 +            if (flags & SDL_COPY_MODULATE_COLOR) {
   1.415 +                srcR = (srcR * modulateR) / 255;
   1.416 +                srcG = (srcG * modulateG) / 255;
   1.417 +                srcB = (srcB * modulateB) / 255;
   1.418 +            }
   1.419 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
   1.420 +                srcA = (srcA * modulateA) / 255;
   1.421 +            }
   1.422 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
   1.423 +                /* This goes away if we ever use premultiplied alpha */
   1.424 +                if (srcA < 255) {
   1.425 +                    srcR = (srcR * srcA) / 255;
   1.426 +                    srcG = (srcG * srcA) / 255;
   1.427 +                    srcB = (srcB * srcA) / 255;
   1.428 +                }
   1.429 +            }
   1.430 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
   1.431 +            case SDL_COPY_MASK:
   1.432 +                if (srcA) {
   1.433 +                    dstR = srcR;
   1.434 +                    dstG = srcG;
   1.435 +                    dstB = srcB;
   1.436 +                }
   1.437 +                break;
   1.438 +            case SDL_COPY_BLEND:
   1.439 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
   1.440 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
   1.441 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
   1.442 +                break;
   1.443 +            case SDL_COPY_ADD:
   1.444 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
   1.445 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
   1.446 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
   1.447 +                break;
   1.448 +            case SDL_COPY_MOD:
   1.449 +                dstR = (srcR * dstR) / 255;
   1.450 +                dstG = (srcG * dstG) / 255;
   1.451 +                dstB = (srcB * dstB) / 255;
   1.452 +                break;
   1.453 +            }
   1.454 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
   1.455 +            *dst = dstpixel;
   1.456 +            ++src;
   1.457 +            ++dst;
   1.458 +        }
   1.459 +        info->src += info->src_pitch;
   1.460 +        info->dst += info->dst_pitch;
   1.461 +    }
   1.462 +}
   1.463 +
   1.464 +void SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
   1.465 +{
   1.466 +    const int flags = info->flags;
   1.467 +    const Uint32 modulateR = info->r;
   1.468 +    const Uint32 modulateG = info->g;
   1.469 +    const Uint32 modulateB = info->b;
   1.470 +    const Uint32 modulateA = info->a;
   1.471 +    Uint32 srcpixel;
   1.472 +    Uint32 srcR, srcG, srcB, srcA;
   1.473 +    Uint32 dstpixel;
   1.474 +    Uint32 dstR, dstG, dstB, dstA;
   1.475 +    int srcy, srcx;
   1.476 +    int posy, posx;
   1.477 +    int incy, incx;
   1.478 +
   1.479 +    srcy = 0;
   1.480 +    posy = 0;
   1.481 +    incy = (info->src_h << 16) / info->dst_h;
   1.482 +    incx = (info->src_w << 16) / info->dst_w;
   1.483 +
   1.484 +    while (info->dst_h--) {
   1.485 +        Uint32 *src;
   1.486 +        Uint32 *dst = (Uint32 *)info->dst;
   1.487 +        int n = info->dst_w;
   1.488 +        srcx = -1;
   1.489 +        posx = 0x10000L;
   1.490 +        while (posy >= 0x10000L) {
   1.491 +            ++srcy;
   1.492 +            posy -= 0x10000L;
   1.493 +        }
   1.494 +        while (n--) {
   1.495 +            if (posx >= 0x10000L) {
   1.496 +                while (posx >= 0x10000L) {
   1.497 +                    ++srcx;
   1.498 +                    posx -= 0x10000L;
   1.499 +                }
   1.500 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
   1.501 +            }
   1.502 +            srcpixel = *src;
   1.503 +            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
   1.504 +            dstpixel = *dst;
   1.505 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
   1.506 +            if (flags & SDL_COPY_MODULATE_COLOR) {
   1.507 +                srcR = (srcR * modulateR) / 255;
   1.508 +                srcG = (srcG * modulateG) / 255;
   1.509 +                srcB = (srcB * modulateB) / 255;
   1.510 +            }
   1.511 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
   1.512 +                srcA = (srcA * modulateA) / 255;
   1.513 +            }
   1.514 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
   1.515 +                /* This goes away if we ever use premultiplied alpha */
   1.516 +                if (srcA < 255) {
   1.517 +                    srcR = (srcR * srcA) / 255;
   1.518 +                    srcG = (srcG * srcA) / 255;
   1.519 +                    srcB = (srcB * srcA) / 255;
   1.520 +                }
   1.521 +            }
   1.522 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
   1.523 +            case SDL_COPY_MASK:
   1.524 +                if (srcA) {
   1.525 +                    dstR = srcR;
   1.526 +                    dstG = srcG;
   1.527 +                    dstB = srcB;
   1.528 +                }
   1.529 +                break;
   1.530 +            case SDL_COPY_BLEND:
   1.531 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
   1.532 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
   1.533 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
   1.534 +                break;
   1.535 +            case SDL_COPY_ADD:
   1.536 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
   1.537 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
   1.538 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
   1.539 +                break;
   1.540 +            case SDL_COPY_MOD:
   1.541 +                dstR = (srcR * dstR) / 255;
   1.542 +                dstG = (srcG * dstG) / 255;
   1.543 +                dstB = (srcB * dstB) / 255;
   1.544 +                break;
   1.545 +            }
   1.546 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
   1.547 +            *dst = dstpixel;
   1.548 +            posx += incx;
   1.549 +            ++dst;
   1.550 +        }
   1.551 +        posy += incy;
   1.552 +        info->dst += info->dst_pitch;
   1.553 +    }
   1.554 +}
   1.555 +
   1.556 +void SDL_Blit_RGB888_BGR888_Scale(SDL_BlitInfo *info)
   1.557 +{
   1.558 +    const int flags = info->flags;
   1.559 +    Uint32 pixel;
   1.560 +    Uint32 R, G, B, A;
   1.561 +    int srcy, srcx;
   1.562 +    int posy, posx;
   1.563 +    int incy, incx;
   1.564 +
   1.565 +    srcy = 0;
   1.566 +    posy = 0;
   1.567 +    incy = (info->src_h << 16) / info->dst_h;
   1.568 +    incx = (info->src_w << 16) / info->dst_w;
   1.569 +
   1.570 +    while (info->dst_h--) {
   1.571 +        Uint32 *src;
   1.572 +        Uint32 *dst = (Uint32 *)info->dst;
   1.573 +        int n = info->dst_w;
   1.574 +        srcx = -1;
   1.575 +        posx = 0x10000L;
   1.576 +        while (posy >= 0x10000L) {
   1.577 +            ++srcy;
   1.578 +            posy -= 0x10000L;
   1.579 +        }
   1.580 +        while (n--) {
   1.581 +            if (posx >= 0x10000L) {
   1.582 +                while (posx >= 0x10000L) {
   1.583 +                    ++srcx;
   1.584 +                    posx -= 0x10000L;
   1.585 +                }
   1.586 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
   1.587 +            }
   1.588 +            pixel = *src;
   1.589 +            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
   1.590 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
   1.591 +            *dst = pixel;
   1.592 +            posx += incx;
   1.593 +            ++dst;
   1.594 +        }
   1.595 +        posy += incy;
   1.596 +        info->dst += info->dst_pitch;
   1.597 +    }
   1.598 +}
   1.599 +
   1.600 +void SDL_Blit_RGB888_BGR888_Blend(SDL_BlitInfo *info)
   1.601 +{
   1.602 +    const int flags = info->flags;
   1.603 +    Uint32 srcpixel;
   1.604 +    Uint32 srcR, srcG, srcB, srcA;
   1.605 +    Uint32 dstpixel;
   1.606 +    Uint32 dstR, dstG, dstB, dstA;
   1.607 +
   1.608 +    while (info->dst_h--) {
   1.609 +        Uint32 *src = (Uint32 *)info->src;
   1.610 +        Uint32 *dst = (Uint32 *)info->dst;
   1.611 +        int n = info->dst_w;
   1.612 +        while (n--) {
   1.613 +            srcpixel = *src;
   1.614 +            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
   1.615 +            dstpixel = *dst;
   1.616 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
   1.617 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
   1.618 +                /* This goes away if we ever use premultiplied alpha */
   1.619 +                if (srcA < 255) {
   1.620 +                    srcR = (srcR * srcA) / 255;
   1.621 +                    srcG = (srcG * srcA) / 255;
   1.622 +                    srcB = (srcB * srcA) / 255;
   1.623 +                }
   1.624 +            }
   1.625 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
   1.626 +            case SDL_COPY_MASK:
   1.627 +                if (srcA) {
   1.628 +                    dstR = srcR;
   1.629 +                    dstG = srcG;
   1.630 +                    dstB = srcB;
   1.631 +                }
   1.632 +                break;
   1.633 +            case SDL_COPY_BLEND:
   1.634 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
   1.635 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
   1.636 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
   1.637 +                break;
   1.638 +            case SDL_COPY_ADD:
   1.639 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
   1.640 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
   1.641 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
   1.642 +                break;
   1.643 +            case SDL_COPY_MOD:
   1.644 +                dstR = (srcR * dstR) / 255;
   1.645 +                dstG = (srcG * dstG) / 255;
   1.646 +                dstB = (srcB * dstB) / 255;
   1.647 +                break;
   1.648 +            }
   1.649 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
   1.650 +            *dst = dstpixel;
   1.651 +            ++src;
   1.652 +            ++dst;
   1.653 +        }
   1.654 +        info->src += info->src_pitch;
   1.655 +        info->dst += info->dst_pitch;
   1.656 +    }
   1.657 +}
   1.658 +
   1.659 +void SDL_Blit_RGB888_BGR888_Blend_Scale(SDL_BlitInfo *info)
   1.660 +{
   1.661 +    const int flags = info->flags;
   1.662 +    Uint32 srcpixel;
   1.663 +    Uint32 srcR, srcG, srcB, srcA;
   1.664 +    Uint32 dstpixel;
   1.665 +    Uint32 dstR, dstG, dstB, dstA;
   1.666 +    int srcy, srcx;
   1.667 +    int posy, posx;
   1.668 +    int incy, incx;
   1.669 +
   1.670 +    srcy = 0;
   1.671 +    posy = 0;
   1.672 +    incy = (info->src_h << 16) / info->dst_h;
   1.673 +    incx = (info->src_w << 16) / info->dst_w;
   1.674 +
   1.675 +    while (info->dst_h--) {
   1.676 +        Uint32 *src;
   1.677 +        Uint32 *dst = (Uint32 *)info->dst;
   1.678 +        int n = info->dst_w;
   1.679 +        srcx = -1;
   1.680 +        posx = 0x10000L;
   1.681 +        while (posy >= 0x10000L) {
   1.682 +            ++srcy;
   1.683 +            posy -= 0x10000L;
   1.684 +        }
   1.685 +        while (n--) {
   1.686 +            if (posx >= 0x10000L) {
   1.687 +                while (posx >= 0x10000L) {
   1.688 +                    ++srcx;
   1.689 +                    posx -= 0x10000L;
   1.690 +                }
   1.691 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
   1.692 +            }
   1.693 +            srcpixel = *src;
   1.694 +            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
   1.695 +            dstpixel = *dst;
   1.696 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
   1.697 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
   1.698 +                /* This goes away if we ever use premultiplied alpha */
   1.699 +                if (srcA < 255) {
   1.700 +                    srcR = (srcR * srcA) / 255;
   1.701 +                    srcG = (srcG * srcA) / 255;
   1.702 +                    srcB = (srcB * srcA) / 255;
   1.703 +                }
   1.704 +            }
   1.705 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
   1.706 +            case SDL_COPY_MASK:
   1.707 +                if (srcA) {
   1.708 +                    dstR = srcR;
   1.709 +                    dstG = srcG;
   1.710 +                    dstB = srcB;
   1.711 +                }
   1.712 +                break;
   1.713 +            case SDL_COPY_BLEND:
   1.714 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
   1.715 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
   1.716 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
   1.717 +                break;
   1.718 +            case SDL_COPY_ADD:
   1.719 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
   1.720 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
   1.721 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
   1.722 +                break;
   1.723 +            case SDL_COPY_MOD:
   1.724 +                dstR = (srcR * dstR) / 255;
   1.725 +                dstG = (srcG * dstG) / 255;
   1.726 +                dstB = (srcB * dstB) / 255;
   1.727 +                break;
   1.728 +            }
   1.729 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
   1.730 +            *dst = dstpixel;
   1.731 +            posx += incx;
   1.732 +            ++dst;
   1.733 +        }
   1.734 +        posy += incy;
   1.735 +        info->dst += info->dst_pitch;
   1.736 +    }
   1.737 +}
   1.738 +
   1.739 +void SDL_Blit_RGB888_BGR888_Modulate(SDL_BlitInfo *info)
   1.740 +{
   1.741 +    const int flags = info->flags;
   1.742 +    const Uint32 modulateR = info->r;
   1.743 +    const Uint32 modulateG = info->g;
   1.744 +    const Uint32 modulateB = info->b;
   1.745 +    const Uint32 modulateA = info->a;
   1.746 +    Uint32 pixel;
   1.747 +    Uint32 R, G, B, A;
   1.748 +
   1.749 +    while (info->dst_h--) {
   1.750 +        Uint32 *src = (Uint32 *)info->src;
   1.751 +        Uint32 *dst = (Uint32 *)info->dst;
   1.752 +        int n = info->dst_w;
   1.753 +        while (n--) {
   1.754 +            pixel = *src;
   1.755 +            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
   1.756 +            if (flags & SDL_COPY_MODULATE_COLOR) {
   1.757 +                R = (R * modulateR) / 255;
   1.758 +                G = (G * modulateG) / 255;
   1.759 +                B = (B * modulateB) / 255;
   1.760 +            }
   1.761 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
   1.762 +                A = (A * modulateA) / 255;
   1.763 +            }
   1.764 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
   1.765 +            *dst = pixel;
   1.766 +            ++src;
   1.767 +            ++dst;
   1.768 +        }
   1.769 +        info->src += info->src_pitch;
   1.770 +        info->dst += info->dst_pitch;
   1.771 +    }
   1.772 +}
   1.773 +
   1.774 +void SDL_Blit_RGB888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
   1.775 +{
   1.776 +    const int flags = info->flags;
   1.777 +    const Uint32 modulateR = info->r;
   1.778 +    const Uint32 modulateG = info->g;
   1.779 +    const Uint32 modulateB = info->b;
   1.780 +    const Uint32 modulateA = info->a;
   1.781 +    Uint32 pixel;
   1.782 +    Uint32 R, G, B, A;
   1.783 +    int srcy, srcx;
   1.784 +    int posy, posx;
   1.785 +    int incy, incx;
   1.786 +
   1.787 +    srcy = 0;
   1.788 +    posy = 0;
   1.789 +    incy = (info->src_h << 16) / info->dst_h;
   1.790 +    incx = (info->src_w << 16) / info->dst_w;
   1.791 +
   1.792 +    while (info->dst_h--) {
   1.793 +        Uint32 *src;
   1.794 +        Uint32 *dst = (Uint32 *)info->dst;
   1.795 +        int n = info->dst_w;
   1.796 +        srcx = -1;
   1.797 +        posx = 0x10000L;
   1.798 +        while (posy >= 0x10000L) {
   1.799 +            ++srcy;
   1.800 +            posy -= 0x10000L;
   1.801 +        }
   1.802 +        while (n--) {
   1.803 +            if (posx >= 0x10000L) {
   1.804 +                while (posx >= 0x10000L) {
   1.805 +                    ++srcx;
   1.806 +                    posx -= 0x10000L;
   1.807 +                }
   1.808 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
   1.809 +            }
   1.810 +            pixel = *src;
   1.811 +            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
   1.812 +            if (flags & SDL_COPY_MODULATE_COLOR) {
   1.813 +                R = (R * modulateR) / 255;
   1.814 +                G = (G * modulateG) / 255;
   1.815 +                B = (B * modulateB) / 255;
   1.816 +            }
   1.817 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
   1.818 +                A = (A * modulateA) / 255;
   1.819 +            }
   1.820 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
   1.821 +            *dst = pixel;
   1.822 +            posx += incx;
   1.823 +            ++dst;
   1.824 +        }
   1.825 +        posy += incy;
   1.826 +        info->dst += info->dst_pitch;
   1.827 +    }
   1.828 +}
   1.829 +
   1.830 +void SDL_Blit_RGB888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
   1.831 +{
   1.832 +    const int flags = info->flags;
   1.833 +    const Uint32 modulateR = info->r;
   1.834 +    const Uint32 modulateG = info->g;
   1.835 +    const Uint32 modulateB = info->b;
   1.836 +    const Uint32 modulateA = info->a;
   1.837 +    Uint32 srcpixel;
   1.838 +    Uint32 srcR, srcG, srcB, srcA;
   1.839 +    Uint32 dstpixel;
   1.840 +    Uint32 dstR, dstG, dstB, dstA;
   1.841 +
   1.842 +    while (info->dst_h--) {
   1.843 +        Uint32 *src = (Uint32 *)info->src;
   1.844 +        Uint32 *dst = (Uint32 *)info->dst;
   1.845 +        int n = info->dst_w;
   1.846 +        while (n--) {
   1.847 +            srcpixel = *src;
   1.848 +            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
   1.849 +            dstpixel = *dst;
   1.850 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
   1.851 +            if (flags & SDL_COPY_MODULATE_COLOR) {
   1.852 +                srcR = (srcR * modulateR) / 255;
   1.853 +                srcG = (srcG * modulateG) / 255;
   1.854 +                srcB = (srcB * modulateB) / 255;
   1.855 +            }
   1.856 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
   1.857 +                srcA = (srcA * modulateA) / 255;
   1.858 +            }
   1.859 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
   1.860 +                /* This goes away if we ever use premultiplied alpha */
   1.861 +                if (srcA < 255) {
   1.862 +                    srcR = (srcR * srcA) / 255;
   1.863 +                    srcG = (srcG * srcA) / 255;
   1.864 +                    srcB = (srcB * srcA) / 255;
   1.865 +                }
   1.866 +            }
   1.867 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
   1.868 +            case SDL_COPY_MASK:
   1.869 +                if (srcA) {
   1.870 +                    dstR = srcR;
   1.871 +                    dstG = srcG;
   1.872 +                    dstB = srcB;
   1.873 +                }
   1.874 +                break;
   1.875 +            case SDL_COPY_BLEND:
   1.876 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
   1.877 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
   1.878 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
   1.879 +                break;
   1.880 +            case SDL_COPY_ADD:
   1.881 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
   1.882 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
   1.883 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
   1.884 +                break;
   1.885 +            case SDL_COPY_MOD:
   1.886 +                dstR = (srcR * dstR) / 255;
   1.887 +                dstG = (srcG * dstG) / 255;
   1.888 +                dstB = (srcB * dstB) / 255;
   1.889 +                break;
   1.890 +            }
   1.891 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
   1.892 +            *dst = dstpixel;
   1.893 +            ++src;
   1.894 +            ++dst;
   1.895 +        }
   1.896 +        info->src += info->src_pitch;
   1.897 +        info->dst += info->dst_pitch;
   1.898 +    }
   1.899 +}
   1.900 +
   1.901 +void SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
   1.902 +{
   1.903 +    const int flags = info->flags;
   1.904 +    const Uint32 modulateR = info->r;
   1.905 +    const Uint32 modulateG = info->g;
   1.906 +    const Uint32 modulateB = info->b;
   1.907 +    const Uint32 modulateA = info->a;
   1.908 +    Uint32 srcpixel;
   1.909 +    Uint32 srcR, srcG, srcB, srcA;
   1.910 +    Uint32 dstpixel;
   1.911 +    Uint32 dstR, dstG, dstB, dstA;
   1.912 +    int srcy, srcx;
   1.913 +    int posy, posx;
   1.914 +    int incy, incx;
   1.915 +
   1.916 +    srcy = 0;
   1.917 +    posy = 0;
   1.918 +    incy = (info->src_h << 16) / info->dst_h;
   1.919 +    incx = (info->src_w << 16) / info->dst_w;
   1.920 +
   1.921 +    while (info->dst_h--) {
   1.922 +        Uint32 *src;
   1.923 +        Uint32 *dst = (Uint32 *)info->dst;
   1.924 +        int n = info->dst_w;
   1.925 +        srcx = -1;
   1.926 +        posx = 0x10000L;
   1.927 +        while (posy >= 0x10000L) {
   1.928 +            ++srcy;
   1.929 +            posy -= 0x10000L;
   1.930 +        }
   1.931 +        while (n--) {
   1.932 +            if (posx >= 0x10000L) {
   1.933 +                while (posx >= 0x10000L) {
   1.934 +                    ++srcx;
   1.935 +                    posx -= 0x10000L;
   1.936 +                }
   1.937 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
   1.938 +            }
   1.939 +            srcpixel = *src;
   1.940 +            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
   1.941 +            dstpixel = *dst;
   1.942 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
   1.943 +            if (flags & SDL_COPY_MODULATE_COLOR) {
   1.944 +                srcR = (srcR * modulateR) / 255;
   1.945 +                srcG = (srcG * modulateG) / 255;
   1.946 +                srcB = (srcB * modulateB) / 255;
   1.947 +            }
   1.948 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
   1.949 +                srcA = (srcA * modulateA) / 255;
   1.950 +            }
   1.951 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
   1.952 +                /* This goes away if we ever use premultiplied alpha */
   1.953 +                if (srcA < 255) {
   1.954 +                    srcR = (srcR * srcA) / 255;
   1.955 +                    srcG = (srcG * srcA) / 255;
   1.956 +                    srcB = (srcB * srcA) / 255;
   1.957 +                }
   1.958 +            }
   1.959 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
   1.960 +            case SDL_COPY_MASK:
   1.961 +                if (srcA) {
   1.962 +                    dstR = srcR;
   1.963 +                    dstG = srcG;
   1.964 +                    dstB = srcB;
   1.965 +                }
   1.966 +                break;
   1.967 +            case SDL_COPY_BLEND:
   1.968 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
   1.969 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
   1.970 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
   1.971 +                break;
   1.972 +            case SDL_COPY_ADD:
   1.973 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
   1.974 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
   1.975 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
   1.976 +                break;
   1.977 +            case SDL_COPY_MOD:
   1.978 +                dstR = (srcR * dstR) / 255;
   1.979 +                dstG = (srcG * dstG) / 255;
   1.980 +                dstB = (srcB * dstB) / 255;
   1.981 +                break;
   1.982 +            }
   1.983 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
   1.984 +            *dst = dstpixel;
   1.985 +            posx += incx;
   1.986 +            ++dst;
   1.987 +        }
   1.988 +        posy += incy;
   1.989 +        info->dst += info->dst_pitch;
   1.990 +    }
   1.991 +}
   1.992 +
   1.993 +void SDL_Blit_BGR888_RGB888_Scale(SDL_BlitInfo *info)
   1.994 +{
   1.995 +    const int flags = info->flags;
   1.996 +    Uint32 pixel;
   1.997 +    Uint32 R, G, B, A;
   1.998 +    int srcy, srcx;
   1.999 +    int posy, posx;
  1.1000 +    int incy, incx;
  1.1001 +
  1.1002 +    srcy = 0;
  1.1003 +    posy = 0;
  1.1004 +    incy = (info->src_h << 16) / info->dst_h;
  1.1005 +    incx = (info->src_w << 16) / info->dst_w;
  1.1006 +
  1.1007 +    while (info->dst_h--) {
  1.1008 +        Uint32 *src;
  1.1009 +        Uint32 *dst = (Uint32 *)info->dst;
  1.1010 +        int n = info->dst_w;
  1.1011 +        srcx = -1;
  1.1012 +        posx = 0x10000L;
  1.1013 +        while (posy >= 0x10000L) {
  1.1014 +            ++srcy;
  1.1015 +            posy -= 0x10000L;
  1.1016 +        }
  1.1017 +        while (n--) {
  1.1018 +            if (posx >= 0x10000L) {
  1.1019 +                while (posx >= 0x10000L) {
  1.1020 +                    ++srcx;
  1.1021 +                    posx -= 0x10000L;
  1.1022 +                }
  1.1023 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.1024 +            }
  1.1025 +            pixel = *src;
  1.1026 +            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
  1.1027 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  1.1028 +            *dst = pixel;
  1.1029 +            posx += incx;
  1.1030 +            ++dst;
  1.1031 +        }
  1.1032 +        posy += incy;
  1.1033 +        info->dst += info->dst_pitch;
  1.1034 +    }
  1.1035 +}
  1.1036 +
  1.1037 +void SDL_Blit_BGR888_RGB888_Blend(SDL_BlitInfo *info)
  1.1038 +{
  1.1039 +    const int flags = info->flags;
  1.1040 +    Uint32 srcpixel;
  1.1041 +    Uint32 srcR, srcG, srcB, srcA;
  1.1042 +    Uint32 dstpixel;
  1.1043 +    Uint32 dstR, dstG, dstB, dstA;
  1.1044 +
  1.1045 +    while (info->dst_h--) {
  1.1046 +        Uint32 *src = (Uint32 *)info->src;
  1.1047 +        Uint32 *dst = (Uint32 *)info->dst;
  1.1048 +        int n = info->dst_w;
  1.1049 +        while (n--) {
  1.1050 +            srcpixel = *src;
  1.1051 +            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
  1.1052 +            dstpixel = *dst;
  1.1053 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  1.1054 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.1055 +                /* This goes away if we ever use premultiplied alpha */
  1.1056 +                if (srcA < 255) {
  1.1057 +                    srcR = (srcR * srcA) / 255;
  1.1058 +                    srcG = (srcG * srcA) / 255;
  1.1059 +                    srcB = (srcB * srcA) / 255;
  1.1060 +                }
  1.1061 +            }
  1.1062 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.1063 +            case SDL_COPY_MASK:
  1.1064 +                if (srcA) {
  1.1065 +                    dstR = srcR;
  1.1066 +                    dstG = srcG;
  1.1067 +                    dstB = srcB;
  1.1068 +                }
  1.1069 +                break;
  1.1070 +            case SDL_COPY_BLEND:
  1.1071 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.1072 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.1073 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.1074 +                break;
  1.1075 +            case SDL_COPY_ADD:
  1.1076 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.1077 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.1078 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.1079 +                break;
  1.1080 +            case SDL_COPY_MOD:
  1.1081 +                dstR = (srcR * dstR) / 255;
  1.1082 +                dstG = (srcG * dstG) / 255;
  1.1083 +                dstB = (srcB * dstB) / 255;
  1.1084 +                break;
  1.1085 +            }
  1.1086 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  1.1087 +            *dst = dstpixel;
  1.1088 +            ++src;
  1.1089 +            ++dst;
  1.1090 +        }
  1.1091 +        info->src += info->src_pitch;
  1.1092 +        info->dst += info->dst_pitch;
  1.1093 +    }
  1.1094 +}
  1.1095 +
  1.1096 +void SDL_Blit_BGR888_RGB888_Blend_Scale(SDL_BlitInfo *info)
  1.1097 +{
  1.1098 +    const int flags = info->flags;
  1.1099 +    Uint32 srcpixel;
  1.1100 +    Uint32 srcR, srcG, srcB, srcA;
  1.1101 +    Uint32 dstpixel;
  1.1102 +    Uint32 dstR, dstG, dstB, dstA;
  1.1103 +    int srcy, srcx;
  1.1104 +    int posy, posx;
  1.1105 +    int incy, incx;
  1.1106 +
  1.1107 +    srcy = 0;
  1.1108 +    posy = 0;
  1.1109 +    incy = (info->src_h << 16) / info->dst_h;
  1.1110 +    incx = (info->src_w << 16) / info->dst_w;
  1.1111 +
  1.1112 +    while (info->dst_h--) {
  1.1113 +        Uint32 *src;
  1.1114 +        Uint32 *dst = (Uint32 *)info->dst;
  1.1115 +        int n = info->dst_w;
  1.1116 +        srcx = -1;
  1.1117 +        posx = 0x10000L;
  1.1118 +        while (posy >= 0x10000L) {
  1.1119 +            ++srcy;
  1.1120 +            posy -= 0x10000L;
  1.1121 +        }
  1.1122 +        while (n--) {
  1.1123 +            if (posx >= 0x10000L) {
  1.1124 +                while (posx >= 0x10000L) {
  1.1125 +                    ++srcx;
  1.1126 +                    posx -= 0x10000L;
  1.1127 +                }
  1.1128 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.1129 +            }
  1.1130 +            srcpixel = *src;
  1.1131 +            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
  1.1132 +            dstpixel = *dst;
  1.1133 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  1.1134 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.1135 +                /* This goes away if we ever use premultiplied alpha */
  1.1136 +                if (srcA < 255) {
  1.1137 +                    srcR = (srcR * srcA) / 255;
  1.1138 +                    srcG = (srcG * srcA) / 255;
  1.1139 +                    srcB = (srcB * srcA) / 255;
  1.1140 +                }
  1.1141 +            }
  1.1142 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.1143 +            case SDL_COPY_MASK:
  1.1144 +                if (srcA) {
  1.1145 +                    dstR = srcR;
  1.1146 +                    dstG = srcG;
  1.1147 +                    dstB = srcB;
  1.1148 +                }
  1.1149 +                break;
  1.1150 +            case SDL_COPY_BLEND:
  1.1151 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.1152 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.1153 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.1154 +                break;
  1.1155 +            case SDL_COPY_ADD:
  1.1156 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.1157 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.1158 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.1159 +                break;
  1.1160 +            case SDL_COPY_MOD:
  1.1161 +                dstR = (srcR * dstR) / 255;
  1.1162 +                dstG = (srcG * dstG) / 255;
  1.1163 +                dstB = (srcB * dstB) / 255;
  1.1164 +                break;
  1.1165 +            }
  1.1166 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  1.1167 +            *dst = dstpixel;
  1.1168 +            posx += incx;
  1.1169 +            ++dst;
  1.1170 +        }
  1.1171 +        posy += incy;
  1.1172 +        info->dst += info->dst_pitch;
  1.1173 +    }
  1.1174 +}
  1.1175 +
  1.1176 +void SDL_Blit_BGR888_RGB888_Modulate(SDL_BlitInfo *info)
  1.1177 +{
  1.1178 +    const int flags = info->flags;
  1.1179 +    const Uint32 modulateR = info->r;
  1.1180 +    const Uint32 modulateG = info->g;
  1.1181 +    const Uint32 modulateB = info->b;
  1.1182 +    const Uint32 modulateA = info->a;
  1.1183 +    Uint32 pixel;
  1.1184 +    Uint32 R, G, B, A;
  1.1185 +
  1.1186 +    while (info->dst_h--) {
  1.1187 +        Uint32 *src = (Uint32 *)info->src;
  1.1188 +        Uint32 *dst = (Uint32 *)info->dst;
  1.1189 +        int n = info->dst_w;
  1.1190 +        while (n--) {
  1.1191 +            pixel = *src;
  1.1192 +            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
  1.1193 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.1194 +                R = (R * modulateR) / 255;
  1.1195 +                G = (G * modulateG) / 255;
  1.1196 +                B = (B * modulateB) / 255;
  1.1197 +            }
  1.1198 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.1199 +                A = (A * modulateA) / 255;
  1.1200 +            }
  1.1201 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  1.1202 +            *dst = pixel;
  1.1203 +            ++src;
  1.1204 +            ++dst;
  1.1205 +        }
  1.1206 +        info->src += info->src_pitch;
  1.1207 +        info->dst += info->dst_pitch;
  1.1208 +    }
  1.1209 +}
  1.1210 +
  1.1211 +void SDL_Blit_BGR888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
  1.1212 +{
  1.1213 +    const int flags = info->flags;
  1.1214 +    const Uint32 modulateR = info->r;
  1.1215 +    const Uint32 modulateG = info->g;
  1.1216 +    const Uint32 modulateB = info->b;
  1.1217 +    const Uint32 modulateA = info->a;
  1.1218 +    Uint32 pixel;
  1.1219 +    Uint32 R, G, B, A;
  1.1220 +    int srcy, srcx;
  1.1221 +    int posy, posx;
  1.1222 +    int incy, incx;
  1.1223 +
  1.1224 +    srcy = 0;
  1.1225 +    posy = 0;
  1.1226 +    incy = (info->src_h << 16) / info->dst_h;
  1.1227 +    incx = (info->src_w << 16) / info->dst_w;
  1.1228 +
  1.1229 +    while (info->dst_h--) {
  1.1230 +        Uint32 *src;
  1.1231 +        Uint32 *dst = (Uint32 *)info->dst;
  1.1232 +        int n = info->dst_w;
  1.1233 +        srcx = -1;
  1.1234 +        posx = 0x10000L;
  1.1235 +        while (posy >= 0x10000L) {
  1.1236 +            ++srcy;
  1.1237 +            posy -= 0x10000L;
  1.1238 +        }
  1.1239 +        while (n--) {
  1.1240 +            if (posx >= 0x10000L) {
  1.1241 +                while (posx >= 0x10000L) {
  1.1242 +                    ++srcx;
  1.1243 +                    posx -= 0x10000L;
  1.1244 +                }
  1.1245 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.1246 +            }
  1.1247 +            pixel = *src;
  1.1248 +            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
  1.1249 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.1250 +                R = (R * modulateR) / 255;
  1.1251 +                G = (G * modulateG) / 255;
  1.1252 +                B = (B * modulateB) / 255;
  1.1253 +            }
  1.1254 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.1255 +                A = (A * modulateA) / 255;
  1.1256 +            }
  1.1257 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  1.1258 +            *dst = pixel;
  1.1259 +            posx += incx;
  1.1260 +            ++dst;
  1.1261 +        }
  1.1262 +        posy += incy;
  1.1263 +        info->dst += info->dst_pitch;
  1.1264 +    }
  1.1265 +}
  1.1266 +
  1.1267 +void SDL_Blit_BGR888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
  1.1268 +{
  1.1269 +    const int flags = info->flags;
  1.1270 +    const Uint32 modulateR = info->r;
  1.1271 +    const Uint32 modulateG = info->g;
  1.1272 +    const Uint32 modulateB = info->b;
  1.1273 +    const Uint32 modulateA = info->a;
  1.1274 +    Uint32 srcpixel;
  1.1275 +    Uint32 srcR, srcG, srcB, srcA;
  1.1276 +    Uint32 dstpixel;
  1.1277 +    Uint32 dstR, dstG, dstB, dstA;
  1.1278 +
  1.1279 +    while (info->dst_h--) {
  1.1280 +        Uint32 *src = (Uint32 *)info->src;
  1.1281 +        Uint32 *dst = (Uint32 *)info->dst;
  1.1282 +        int n = info->dst_w;
  1.1283 +        while (n--) {
  1.1284 +            srcpixel = *src;
  1.1285 +            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
  1.1286 +            dstpixel = *dst;
  1.1287 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  1.1288 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.1289 +                srcR = (srcR * modulateR) / 255;
  1.1290 +                srcG = (srcG * modulateG) / 255;
  1.1291 +                srcB = (srcB * modulateB) / 255;
  1.1292 +            }
  1.1293 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.1294 +                srcA = (srcA * modulateA) / 255;
  1.1295 +            }
  1.1296 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.1297 +                /* This goes away if we ever use premultiplied alpha */
  1.1298 +                if (srcA < 255) {
  1.1299 +                    srcR = (srcR * srcA) / 255;
  1.1300 +                    srcG = (srcG * srcA) / 255;
  1.1301 +                    srcB = (srcB * srcA) / 255;
  1.1302 +                }
  1.1303 +            }
  1.1304 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.1305 +            case SDL_COPY_MASK:
  1.1306 +                if (srcA) {
  1.1307 +                    dstR = srcR;
  1.1308 +                    dstG = srcG;
  1.1309 +                    dstB = srcB;
  1.1310 +                }
  1.1311 +                break;
  1.1312 +            case SDL_COPY_BLEND:
  1.1313 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.1314 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.1315 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.1316 +                break;
  1.1317 +            case SDL_COPY_ADD:
  1.1318 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.1319 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.1320 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.1321 +                break;
  1.1322 +            case SDL_COPY_MOD:
  1.1323 +                dstR = (srcR * dstR) / 255;
  1.1324 +                dstG = (srcG * dstG) / 255;
  1.1325 +                dstB = (srcB * dstB) / 255;
  1.1326 +                break;
  1.1327 +            }
  1.1328 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  1.1329 +            *dst = dstpixel;
  1.1330 +            ++src;
  1.1331 +            ++dst;
  1.1332 +        }
  1.1333 +        info->src += info->src_pitch;
  1.1334 +        info->dst += info->dst_pitch;
  1.1335 +    }
  1.1336 +}
  1.1337 +
  1.1338 +void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
  1.1339 +{
  1.1340 +    const int flags = info->flags;
  1.1341 +    const Uint32 modulateR = info->r;
  1.1342 +    const Uint32 modulateG = info->g;
  1.1343 +    const Uint32 modulateB = info->b;
  1.1344 +    const Uint32 modulateA = info->a;
  1.1345 +    Uint32 srcpixel;
  1.1346 +    Uint32 srcR, srcG, srcB, srcA;
  1.1347 +    Uint32 dstpixel;
  1.1348 +    Uint32 dstR, dstG, dstB, dstA;
  1.1349 +    int srcy, srcx;
  1.1350 +    int posy, posx;
  1.1351 +    int incy, incx;
  1.1352 +
  1.1353 +    srcy = 0;
  1.1354 +    posy = 0;
  1.1355 +    incy = (info->src_h << 16) / info->dst_h;
  1.1356 +    incx = (info->src_w << 16) / info->dst_w;
  1.1357 +
  1.1358 +    while (info->dst_h--) {
  1.1359 +        Uint32 *src;
  1.1360 +        Uint32 *dst = (Uint32 *)info->dst;
  1.1361 +        int n = info->dst_w;
  1.1362 +        srcx = -1;
  1.1363 +        posx = 0x10000L;
  1.1364 +        while (posy >= 0x10000L) {
  1.1365 +            ++srcy;
  1.1366 +            posy -= 0x10000L;
  1.1367 +        }
  1.1368 +        while (n--) {
  1.1369 +            if (posx >= 0x10000L) {
  1.1370 +                while (posx >= 0x10000L) {
  1.1371 +                    ++srcx;
  1.1372 +                    posx -= 0x10000L;
  1.1373 +                }
  1.1374 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.1375 +            }
  1.1376 +            srcpixel = *src;
  1.1377 +            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
  1.1378 +            dstpixel = *dst;
  1.1379 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  1.1380 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.1381 +                srcR = (srcR * modulateR) / 255;
  1.1382 +                srcG = (srcG * modulateG) / 255;
  1.1383 +                srcB = (srcB * modulateB) / 255;
  1.1384 +            }
  1.1385 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.1386 +                srcA = (srcA * modulateA) / 255;
  1.1387 +            }
  1.1388 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.1389 +                /* This goes away if we ever use premultiplied alpha */
  1.1390 +                if (srcA < 255) {
  1.1391 +                    srcR = (srcR * srcA) / 255;
  1.1392 +                    srcG = (srcG * srcA) / 255;
  1.1393 +                    srcB = (srcB * srcA) / 255;
  1.1394 +                }
  1.1395 +            }
  1.1396 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.1397 +            case SDL_COPY_MASK:
  1.1398 +                if (srcA) {
  1.1399 +                    dstR = srcR;
  1.1400 +                    dstG = srcG;
  1.1401 +                    dstB = srcB;
  1.1402 +                }
  1.1403 +                break;
  1.1404 +            case SDL_COPY_BLEND:
  1.1405 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.1406 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.1407 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.1408 +                break;
  1.1409 +            case SDL_COPY_ADD:
  1.1410 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.1411 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.1412 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.1413 +                break;
  1.1414 +            case SDL_COPY_MOD:
  1.1415 +                dstR = (srcR * dstR) / 255;
  1.1416 +                dstG = (srcG * dstG) / 255;
  1.1417 +                dstB = (srcB * dstB) / 255;
  1.1418 +                break;
  1.1419 +            }
  1.1420 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  1.1421 +            *dst = dstpixel;
  1.1422 +            posx += incx;
  1.1423 +            ++dst;
  1.1424 +        }
  1.1425 +        posy += incy;
  1.1426 +        info->dst += info->dst_pitch;
  1.1427 +    }
  1.1428 +}
  1.1429 +
  1.1430 +void SDL_Blit_BGR888_BGR888_Scale(SDL_BlitInfo *info)
  1.1431 +{
  1.1432 +    const int flags = info->flags;
  1.1433 +    int srcy, srcx;
  1.1434 +    int posy, posx;
  1.1435 +    int incy, incx;
  1.1436 +
  1.1437 +    srcy = 0;
  1.1438 +    posy = 0;
  1.1439 +    incy = (info->src_h << 16) / info->dst_h;
  1.1440 +    incx = (info->src_w << 16) / info->dst_w;
  1.1441 +
  1.1442 +    while (info->dst_h--) {
  1.1443 +        Uint32 *src;
  1.1444 +        Uint32 *dst = (Uint32 *)info->dst;
  1.1445 +        int n = info->dst_w;
  1.1446 +        srcx = -1;
  1.1447 +        posx = 0x10000L;
  1.1448 +        while (posy >= 0x10000L) {
  1.1449 +            ++srcy;
  1.1450 +            posy -= 0x10000L;
  1.1451 +        }
  1.1452 +        while (n--) {
  1.1453 +            if (posx >= 0x10000L) {
  1.1454 +                while (posx >= 0x10000L) {
  1.1455 +                    ++srcx;
  1.1456 +                    posx -= 0x10000L;
  1.1457 +                }
  1.1458 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.1459 +            }
  1.1460 +            *dst = *src;
  1.1461 +            posx += incx;
  1.1462 +            ++dst;
  1.1463 +        }
  1.1464 +        posy += incy;
  1.1465 +        info->dst += info->dst_pitch;
  1.1466 +    }
  1.1467 +}
  1.1468 +
  1.1469 +void SDL_Blit_BGR888_BGR888_Blend(SDL_BlitInfo *info)
  1.1470 +{
  1.1471 +    const int flags = info->flags;
  1.1472 +    Uint32 srcpixel;
  1.1473 +    Uint32 srcR, srcG, srcB, srcA;
  1.1474 +    Uint32 dstpixel;
  1.1475 +    Uint32 dstR, dstG, dstB, dstA;
  1.1476 +
  1.1477 +    while (info->dst_h--) {
  1.1478 +        Uint32 *src = (Uint32 *)info->src;
  1.1479 +        Uint32 *dst = (Uint32 *)info->dst;
  1.1480 +        int n = info->dst_w;
  1.1481 +        while (n--) {
  1.1482 +            srcpixel = *src;
  1.1483 +            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
  1.1484 +            dstpixel = *dst;
  1.1485 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  1.1486 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.1487 +                /* This goes away if we ever use premultiplied alpha */
  1.1488 +                if (srcA < 255) {
  1.1489 +                    srcR = (srcR * srcA) / 255;
  1.1490 +                    srcG = (srcG * srcA) / 255;
  1.1491 +                    srcB = (srcB * srcA) / 255;
  1.1492 +                }
  1.1493 +            }
  1.1494 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.1495 +            case SDL_COPY_MASK:
  1.1496 +                if (srcA) {
  1.1497 +                    dstR = srcR;
  1.1498 +                    dstG = srcG;
  1.1499 +                    dstB = srcB;
  1.1500 +                }
  1.1501 +                break;
  1.1502 +            case SDL_COPY_BLEND:
  1.1503 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.1504 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.1505 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.1506 +                break;
  1.1507 +            case SDL_COPY_ADD:
  1.1508 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.1509 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.1510 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.1511 +                break;
  1.1512 +            case SDL_COPY_MOD:
  1.1513 +                dstR = (srcR * dstR) / 255;
  1.1514 +                dstG = (srcG * dstG) / 255;
  1.1515 +                dstB = (srcB * dstB) / 255;
  1.1516 +                break;
  1.1517 +            }
  1.1518 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  1.1519 +            *dst = dstpixel;
  1.1520 +            ++src;
  1.1521 +            ++dst;
  1.1522 +        }
  1.1523 +        info->src += info->src_pitch;
  1.1524 +        info->dst += info->dst_pitch;
  1.1525 +    }
  1.1526 +}
  1.1527 +
  1.1528 +void SDL_Blit_BGR888_BGR888_Blend_Scale(SDL_BlitInfo *info)
  1.1529 +{
  1.1530 +    const int flags = info->flags;
  1.1531 +    Uint32 srcpixel;
  1.1532 +    Uint32 srcR, srcG, srcB, srcA;
  1.1533 +    Uint32 dstpixel;
  1.1534 +    Uint32 dstR, dstG, dstB, dstA;
  1.1535 +    int srcy, srcx;
  1.1536 +    int posy, posx;
  1.1537 +    int incy, incx;
  1.1538 +
  1.1539 +    srcy = 0;
  1.1540 +    posy = 0;
  1.1541 +    incy = (info->src_h << 16) / info->dst_h;
  1.1542 +    incx = (info->src_w << 16) / info->dst_w;
  1.1543 +
  1.1544 +    while (info->dst_h--) {
  1.1545 +        Uint32 *src;
  1.1546 +        Uint32 *dst = (Uint32 *)info->dst;
  1.1547 +        int n = info->dst_w;
  1.1548 +        srcx = -1;
  1.1549 +        posx = 0x10000L;
  1.1550 +        while (posy >= 0x10000L) {
  1.1551 +            ++srcy;
  1.1552 +            posy -= 0x10000L;
  1.1553 +        }
  1.1554 +        while (n--) {
  1.1555 +            if (posx >= 0x10000L) {
  1.1556 +                while (posx >= 0x10000L) {
  1.1557 +                    ++srcx;
  1.1558 +                    posx -= 0x10000L;
  1.1559 +                }
  1.1560 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.1561 +            }
  1.1562 +            srcpixel = *src;
  1.1563 +            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
  1.1564 +            dstpixel = *dst;
  1.1565 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  1.1566 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.1567 +                /* This goes away if we ever use premultiplied alpha */
  1.1568 +                if (srcA < 255) {
  1.1569 +                    srcR = (srcR * srcA) / 255;
  1.1570 +                    srcG = (srcG * srcA) / 255;
  1.1571 +                    srcB = (srcB * srcA) / 255;
  1.1572 +                }
  1.1573 +            }
  1.1574 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.1575 +            case SDL_COPY_MASK:
  1.1576 +                if (srcA) {
  1.1577 +                    dstR = srcR;
  1.1578 +                    dstG = srcG;
  1.1579 +                    dstB = srcB;
  1.1580 +                }
  1.1581 +                break;
  1.1582 +            case SDL_COPY_BLEND:
  1.1583 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.1584 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.1585 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.1586 +                break;
  1.1587 +            case SDL_COPY_ADD:
  1.1588 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.1589 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.1590 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.1591 +                break;
  1.1592 +            case SDL_COPY_MOD:
  1.1593 +                dstR = (srcR * dstR) / 255;
  1.1594 +                dstG = (srcG * dstG) / 255;
  1.1595 +                dstB = (srcB * dstB) / 255;
  1.1596 +                break;
  1.1597 +            }
  1.1598 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  1.1599 +            *dst = dstpixel;
  1.1600 +            posx += incx;
  1.1601 +            ++dst;
  1.1602 +        }
  1.1603 +        posy += incy;
  1.1604 +        info->dst += info->dst_pitch;
  1.1605 +    }
  1.1606 +}
  1.1607 +
  1.1608 +void SDL_Blit_BGR888_BGR888_Modulate(SDL_BlitInfo *info)
  1.1609 +{
  1.1610 +    const int flags = info->flags;
  1.1611 +    const Uint32 modulateR = info->r;
  1.1612 +    const Uint32 modulateG = info->g;
  1.1613 +    const Uint32 modulateB = info->b;
  1.1614 +    const Uint32 modulateA = info->a;
  1.1615 +    Uint32 pixel;
  1.1616 +    Uint32 R, G, B, A;
  1.1617 +
  1.1618 +    while (info->dst_h--) {
  1.1619 +        Uint32 *src = (Uint32 *)info->src;
  1.1620 +        Uint32 *dst = (Uint32 *)info->dst;
  1.1621 +        int n = info->dst_w;
  1.1622 +        while (n--) {
  1.1623 +            pixel = *src;
  1.1624 +            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
  1.1625 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.1626 +                R = (R * modulateR) / 255;
  1.1627 +                G = (G * modulateG) / 255;
  1.1628 +                B = (B * modulateB) / 255;
  1.1629 +            }
  1.1630 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.1631 +                A = (A * modulateA) / 255;
  1.1632 +            }
  1.1633 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  1.1634 +            *dst = pixel;
  1.1635 +            ++src;
  1.1636 +            ++dst;
  1.1637 +        }
  1.1638 +        info->src += info->src_pitch;
  1.1639 +        info->dst += info->dst_pitch;
  1.1640 +    }
  1.1641 +}
  1.1642 +
  1.1643 +void SDL_Blit_BGR888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
  1.1644 +{
  1.1645 +    const int flags = info->flags;
  1.1646 +    const Uint32 modulateR = info->r;
  1.1647 +    const Uint32 modulateG = info->g;
  1.1648 +    const Uint32 modulateB = info->b;
  1.1649 +    const Uint32 modulateA = info->a;
  1.1650 +    Uint32 pixel;
  1.1651 +    Uint32 R, G, B, A;
  1.1652 +    int srcy, srcx;
  1.1653 +    int posy, posx;
  1.1654 +    int incy, incx;
  1.1655 +
  1.1656 +    srcy = 0;
  1.1657 +    posy = 0;
  1.1658 +    incy = (info->src_h << 16) / info->dst_h;
  1.1659 +    incx = (info->src_w << 16) / info->dst_w;
  1.1660 +
  1.1661 +    while (info->dst_h--) {
  1.1662 +        Uint32 *src;
  1.1663 +        Uint32 *dst = (Uint32 *)info->dst;
  1.1664 +        int n = info->dst_w;
  1.1665 +        srcx = -1;
  1.1666 +        posx = 0x10000L;
  1.1667 +        while (posy >= 0x10000L) {
  1.1668 +            ++srcy;
  1.1669 +            posy -= 0x10000L;
  1.1670 +        }
  1.1671 +        while (n--) {
  1.1672 +            if (posx >= 0x10000L) {
  1.1673 +                while (posx >= 0x10000L) {
  1.1674 +                    ++srcx;
  1.1675 +                    posx -= 0x10000L;
  1.1676 +                }
  1.1677 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.1678 +            }
  1.1679 +            pixel = *src;
  1.1680 +            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
  1.1681 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.1682 +                R = (R * modulateR) / 255;
  1.1683 +                G = (G * modulateG) / 255;
  1.1684 +                B = (B * modulateB) / 255;
  1.1685 +            }
  1.1686 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.1687 +                A = (A * modulateA) / 255;
  1.1688 +            }
  1.1689 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  1.1690 +            *dst = pixel;
  1.1691 +            posx += incx;
  1.1692 +            ++dst;
  1.1693 +        }
  1.1694 +        posy += incy;
  1.1695 +        info->dst += info->dst_pitch;
  1.1696 +    }
  1.1697 +}
  1.1698 +
  1.1699 +void SDL_Blit_BGR888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
  1.1700 +{
  1.1701 +    const int flags = info->flags;
  1.1702 +    const Uint32 modulateR = info->r;
  1.1703 +    const Uint32 modulateG = info->g;
  1.1704 +    const Uint32 modulateB = info->b;
  1.1705 +    const Uint32 modulateA = info->a;
  1.1706 +    Uint32 srcpixel;
  1.1707 +    Uint32 srcR, srcG, srcB, srcA;
  1.1708 +    Uint32 dstpixel;
  1.1709 +    Uint32 dstR, dstG, dstB, dstA;
  1.1710 +
  1.1711 +    while (info->dst_h--) {
  1.1712 +        Uint32 *src = (Uint32 *)info->src;
  1.1713 +        Uint32 *dst = (Uint32 *)info->dst;
  1.1714 +        int n = info->dst_w;
  1.1715 +        while (n--) {
  1.1716 +            srcpixel = *src;
  1.1717 +            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
  1.1718 +            dstpixel = *dst;
  1.1719 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  1.1720 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.1721 +                srcR = (srcR * modulateR) / 255;
  1.1722 +                srcG = (srcG * modulateG) / 255;
  1.1723 +                srcB = (srcB * modulateB) / 255;
  1.1724 +            }
  1.1725 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.1726 +                srcA = (srcA * modulateA) / 255;
  1.1727 +            }
  1.1728 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.1729 +                /* This goes away if we ever use premultiplied alpha */
  1.1730 +                if (srcA < 255) {
  1.1731 +                    srcR = (srcR * srcA) / 255;
  1.1732 +                    srcG = (srcG * srcA) / 255;
  1.1733 +                    srcB = (srcB * srcA) / 255;
  1.1734 +                }
  1.1735 +            }
  1.1736 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.1737 +            case SDL_COPY_MASK:
  1.1738 +                if (srcA) {
  1.1739 +                    dstR = srcR;
  1.1740 +                    dstG = srcG;
  1.1741 +                    dstB = srcB;
  1.1742 +                }
  1.1743 +                break;
  1.1744 +            case SDL_COPY_BLEND:
  1.1745 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.1746 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.1747 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.1748 +                break;
  1.1749 +            case SDL_COPY_ADD:
  1.1750 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.1751 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.1752 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.1753 +                break;
  1.1754 +            case SDL_COPY_MOD:
  1.1755 +                dstR = (srcR * dstR) / 255;
  1.1756 +                dstG = (srcG * dstG) / 255;
  1.1757 +                dstB = (srcB * dstB) / 255;
  1.1758 +                break;
  1.1759 +            }
  1.1760 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  1.1761 +            *dst = dstpixel;
  1.1762 +            ++src;
  1.1763 +            ++dst;
  1.1764 +        }
  1.1765 +        info->src += info->src_pitch;
  1.1766 +        info->dst += info->dst_pitch;
  1.1767 +    }
  1.1768 +}
  1.1769 +
  1.1770 +void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
  1.1771 +{
  1.1772 +    const int flags = info->flags;
  1.1773 +    const Uint32 modulateR = info->r;
  1.1774 +    const Uint32 modulateG = info->g;
  1.1775 +    const Uint32 modulateB = info->b;
  1.1776 +    const Uint32 modulateA = info->a;
  1.1777 +    Uint32 srcpixel;
  1.1778 +    Uint32 srcR, srcG, srcB, srcA;
  1.1779 +    Uint32 dstpixel;
  1.1780 +    Uint32 dstR, dstG, dstB, dstA;
  1.1781 +    int srcy, srcx;
  1.1782 +    int posy, posx;
  1.1783 +    int incy, incx;
  1.1784 +
  1.1785 +    srcy = 0;
  1.1786 +    posy = 0;
  1.1787 +    incy = (info->src_h << 16) / info->dst_h;
  1.1788 +    incx = (info->src_w << 16) / info->dst_w;
  1.1789 +
  1.1790 +    while (info->dst_h--) {
  1.1791 +        Uint32 *src;
  1.1792 +        Uint32 *dst = (Uint32 *)info->dst;
  1.1793 +        int n = info->dst_w;
  1.1794 +        srcx = -1;
  1.1795 +        posx = 0x10000L;
  1.1796 +        while (posy >= 0x10000L) {
  1.1797 +            ++srcy;
  1.1798 +            posy -= 0x10000L;
  1.1799 +        }
  1.1800 +        while (n--) {
  1.1801 +            if (posx >= 0x10000L) {
  1.1802 +                while (posx >= 0x10000L) {
  1.1803 +                    ++srcx;
  1.1804 +                    posx -= 0x10000L;
  1.1805 +                }
  1.1806 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.1807 +            }
  1.1808 +            srcpixel = *src;
  1.1809 +            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
  1.1810 +            dstpixel = *dst;
  1.1811 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  1.1812 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.1813 +                srcR = (srcR * modulateR) / 255;
  1.1814 +                srcG = (srcG * modulateG) / 255;
  1.1815 +                srcB = (srcB * modulateB) / 255;
  1.1816 +            }
  1.1817 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.1818 +                srcA = (srcA * modulateA) / 255;
  1.1819 +            }
  1.1820 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.1821 +                /* This goes away if we ever use premultiplied alpha */
  1.1822 +                if (srcA < 255) {
  1.1823 +                    srcR = (srcR * srcA) / 255;
  1.1824 +                    srcG = (srcG * srcA) / 255;
  1.1825 +                    srcB = (srcB * srcA) / 255;
  1.1826 +                }
  1.1827 +            }
  1.1828 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.1829 +            case SDL_COPY_MASK:
  1.1830 +                if (srcA) {
  1.1831 +                    dstR = srcR;
  1.1832 +                    dstG = srcG;
  1.1833 +                    dstB = srcB;
  1.1834 +                }
  1.1835 +                break;
  1.1836 +            case SDL_COPY_BLEND:
  1.1837 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.1838 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.1839 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.1840 +                break;
  1.1841 +            case SDL_COPY_ADD:
  1.1842 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.1843 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.1844 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.1845 +                break;
  1.1846 +            case SDL_COPY_MOD:
  1.1847 +                dstR = (srcR * dstR) / 255;
  1.1848 +                dstG = (srcG * dstG) / 255;
  1.1849 +                dstB = (srcB * dstB) / 255;
  1.1850 +                break;
  1.1851 +            }
  1.1852 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  1.1853 +            *dst = dstpixel;
  1.1854 +            posx += incx;
  1.1855 +            ++dst;
  1.1856 +        }
  1.1857 +        posy += incy;
  1.1858 +        info->dst += info->dst_pitch;
  1.1859 +    }
  1.1860 +}
  1.1861 +
  1.1862 +void SDL_Blit_ARGB8888_RGB888_Scale(SDL_BlitInfo *info)
  1.1863 +{
  1.1864 +    const int flags = info->flags;
  1.1865 +    Uint32 pixel;
  1.1866 +    Uint32 R, G, B, A;
  1.1867 +    int srcy, srcx;
  1.1868 +    int posy, posx;
  1.1869 +    int incy, incx;
  1.1870 +
  1.1871 +    srcy = 0;
  1.1872 +    posy = 0;
  1.1873 +    incy = (info->src_h << 16) / info->dst_h;
  1.1874 +    incx = (info->src_w << 16) / info->dst_w;
  1.1875 +
  1.1876 +    while (info->dst_h--) {
  1.1877 +        Uint32 *src;
  1.1878 +        Uint32 *dst = (Uint32 *)info->dst;
  1.1879 +        int n = info->dst_w;
  1.1880 +        srcx = -1;
  1.1881 +        posx = 0x10000L;
  1.1882 +        while (posy >= 0x10000L) {
  1.1883 +            ++srcy;
  1.1884 +            posy -= 0x10000L;
  1.1885 +        }
  1.1886 +        while (n--) {
  1.1887 +            if (posx >= 0x10000L) {
  1.1888 +                while (posx >= 0x10000L) {
  1.1889 +                    ++srcx;
  1.1890 +                    posx -= 0x10000L;
  1.1891 +                }
  1.1892 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.1893 +            }
  1.1894 +            pixel = *src;
  1.1895 +            A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
  1.1896 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  1.1897 +            *dst = pixel;
  1.1898 +            posx += incx;
  1.1899 +            ++dst;
  1.1900 +        }
  1.1901 +        posy += incy;
  1.1902 +        info->dst += info->dst_pitch;
  1.1903 +    }
  1.1904 +}
  1.1905 +
  1.1906 +void SDL_Blit_ARGB8888_RGB888_Blend(SDL_BlitInfo *info)
  1.1907 +{
  1.1908 +    const int flags = info->flags;
  1.1909 +    Uint32 srcpixel;
  1.1910 +    Uint32 srcR, srcG, srcB, srcA;
  1.1911 +    Uint32 dstpixel;
  1.1912 +    Uint32 dstR, dstG, dstB, dstA;
  1.1913 +
  1.1914 +    while (info->dst_h--) {
  1.1915 +        Uint32 *src = (Uint32 *)info->src;
  1.1916 +        Uint32 *dst = (Uint32 *)info->dst;
  1.1917 +        int n = info->dst_w;
  1.1918 +        while (n--) {
  1.1919 +            srcpixel = *src;
  1.1920 +            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
  1.1921 +            dstpixel = *dst;
  1.1922 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  1.1923 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.1924 +                /* This goes away if we ever use premultiplied alpha */
  1.1925 +                if (srcA < 255) {
  1.1926 +                    srcR = (srcR * srcA) / 255;
  1.1927 +                    srcG = (srcG * srcA) / 255;
  1.1928 +                    srcB = (srcB * srcA) / 255;
  1.1929 +                }
  1.1930 +            }
  1.1931 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.1932 +            case SDL_COPY_MASK:
  1.1933 +                if (srcA) {
  1.1934 +                    dstR = srcR;
  1.1935 +                    dstG = srcG;
  1.1936 +                    dstB = srcB;
  1.1937 +                }
  1.1938 +                break;
  1.1939 +            case SDL_COPY_BLEND:
  1.1940 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.1941 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.1942 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.1943 +                break;
  1.1944 +            case SDL_COPY_ADD:
  1.1945 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.1946 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.1947 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.1948 +                break;
  1.1949 +            case SDL_COPY_MOD:
  1.1950 +                dstR = (srcR * dstR) / 255;
  1.1951 +                dstG = (srcG * dstG) / 255;
  1.1952 +                dstB = (srcB * dstB) / 255;
  1.1953 +                break;
  1.1954 +            }
  1.1955 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  1.1956 +            *dst = dstpixel;
  1.1957 +            ++src;
  1.1958 +            ++dst;
  1.1959 +        }
  1.1960 +        info->src += info->src_pitch;
  1.1961 +        info->dst += info->dst_pitch;
  1.1962 +    }
  1.1963 +}
  1.1964 +
  1.1965 +void SDL_Blit_ARGB8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
  1.1966 +{
  1.1967 +    const int flags = info->flags;
  1.1968 +    Uint32 srcpixel;
  1.1969 +    Uint32 srcR, srcG, srcB, srcA;
  1.1970 +    Uint32 dstpixel;
  1.1971 +    Uint32 dstR, dstG, dstB, dstA;
  1.1972 +    int srcy, srcx;
  1.1973 +    int posy, posx;
  1.1974 +    int incy, incx;
  1.1975 +
  1.1976 +    srcy = 0;
  1.1977 +    posy = 0;
  1.1978 +    incy = (info->src_h << 16) / info->dst_h;
  1.1979 +    incx = (info->src_w << 16) / info->dst_w;
  1.1980 +
  1.1981 +    while (info->dst_h--) {
  1.1982 +        Uint32 *src;
  1.1983 +        Uint32 *dst = (Uint32 *)info->dst;
  1.1984 +        int n = info->dst_w;
  1.1985 +        srcx = -1;
  1.1986 +        posx = 0x10000L;
  1.1987 +        while (posy >= 0x10000L) {
  1.1988 +            ++srcy;
  1.1989 +            posy -= 0x10000L;
  1.1990 +        }
  1.1991 +        while (n--) {
  1.1992 +            if (posx >= 0x10000L) {
  1.1993 +                while (posx >= 0x10000L) {
  1.1994 +                    ++srcx;
  1.1995 +                    posx -= 0x10000L;
  1.1996 +                }
  1.1997 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.1998 +            }
  1.1999 +            srcpixel = *src;
  1.2000 +            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
  1.2001 +            dstpixel = *dst;
  1.2002 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  1.2003 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.2004 +                /* This goes away if we ever use premultiplied alpha */
  1.2005 +                if (srcA < 255) {
  1.2006 +                    srcR = (srcR * srcA) / 255;
  1.2007 +                    srcG = (srcG * srcA) / 255;
  1.2008 +                    srcB = (srcB * srcA) / 255;
  1.2009 +                }
  1.2010 +            }
  1.2011 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.2012 +            case SDL_COPY_MASK:
  1.2013 +                if (srcA) {
  1.2014 +                    dstR = srcR;
  1.2015 +                    dstG = srcG;
  1.2016 +                    dstB = srcB;
  1.2017 +                }
  1.2018 +                break;
  1.2019 +            case SDL_COPY_BLEND:
  1.2020 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.2021 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.2022 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.2023 +                break;
  1.2024 +            case SDL_COPY_ADD:
  1.2025 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.2026 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.2027 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.2028 +                break;
  1.2029 +            case SDL_COPY_MOD:
  1.2030 +                dstR = (srcR * dstR) / 255;
  1.2031 +                dstG = (srcG * dstG) / 255;
  1.2032 +                dstB = (srcB * dstB) / 255;
  1.2033 +                break;
  1.2034 +            }
  1.2035 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  1.2036 +            *dst = dstpixel;
  1.2037 +            posx += incx;
  1.2038 +            ++dst;
  1.2039 +        }
  1.2040 +        posy += incy;
  1.2041 +        info->dst += info->dst_pitch;
  1.2042 +    }
  1.2043 +}
  1.2044 +
  1.2045 +void SDL_Blit_ARGB8888_RGB888_Modulate(SDL_BlitInfo *info)
  1.2046 +{
  1.2047 +    const int flags = info->flags;
  1.2048 +    const Uint32 modulateR = info->r;
  1.2049 +    const Uint32 modulateG = info->g;
  1.2050 +    const Uint32 modulateB = info->b;
  1.2051 +    const Uint32 modulateA = info->a;
  1.2052 +    Uint32 pixel;
  1.2053 +    Uint32 R, G, B, A;
  1.2054 +
  1.2055 +    while (info->dst_h--) {
  1.2056 +        Uint32 *src = (Uint32 *)info->src;
  1.2057 +        Uint32 *dst = (Uint32 *)info->dst;
  1.2058 +        int n = info->dst_w;
  1.2059 +        while (n--) {
  1.2060 +            pixel = *src;
  1.2061 +            A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
  1.2062 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.2063 +                R = (R * modulateR) / 255;
  1.2064 +                G = (G * modulateG) / 255;
  1.2065 +                B = (B * modulateB) / 255;
  1.2066 +            }
  1.2067 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.2068 +                A = (A * modulateA) / 255;
  1.2069 +            }
  1.2070 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  1.2071 +            *dst = pixel;
  1.2072 +            ++src;
  1.2073 +            ++dst;
  1.2074 +        }
  1.2075 +        info->src += info->src_pitch;
  1.2076 +        info->dst += info->dst_pitch;
  1.2077 +    }
  1.2078 +}
  1.2079 +
  1.2080 +void SDL_Blit_ARGB8888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
  1.2081 +{
  1.2082 +    const int flags = info->flags;
  1.2083 +    const Uint32 modulateR = info->r;
  1.2084 +    const Uint32 modulateG = info->g;
  1.2085 +    const Uint32 modulateB = info->b;
  1.2086 +    const Uint32 modulateA = info->a;
  1.2087 +    Uint32 pixel;
  1.2088 +    Uint32 R, G, B, A;
  1.2089 +    int srcy, srcx;
  1.2090 +    int posy, posx;
  1.2091 +    int incy, incx;
  1.2092 +
  1.2093 +    srcy = 0;
  1.2094 +    posy = 0;
  1.2095 +    incy = (info->src_h << 16) / info->dst_h;
  1.2096 +    incx = (info->src_w << 16) / info->dst_w;
  1.2097 +
  1.2098 +    while (info->dst_h--) {
  1.2099 +        Uint32 *src;
  1.2100 +        Uint32 *dst = (Uint32 *)info->dst;
  1.2101 +        int n = info->dst_w;
  1.2102 +        srcx = -1;
  1.2103 +        posx = 0x10000L;
  1.2104 +        while (posy >= 0x10000L) {
  1.2105 +            ++srcy;
  1.2106 +            posy -= 0x10000L;
  1.2107 +        }
  1.2108 +        while (n--) {
  1.2109 +            if (posx >= 0x10000L) {
  1.2110 +                while (posx >= 0x10000L) {
  1.2111 +                    ++srcx;
  1.2112 +                    posx -= 0x10000L;
  1.2113 +                }
  1.2114 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.2115 +            }
  1.2116 +            pixel = *src;
  1.2117 +            A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
  1.2118 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.2119 +                R = (R * modulateR) / 255;
  1.2120 +                G = (G * modulateG) / 255;
  1.2121 +                B = (B * modulateB) / 255;
  1.2122 +            }
  1.2123 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.2124 +                A = (A * modulateA) / 255;
  1.2125 +            }
  1.2126 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  1.2127 +            *dst = pixel;
  1.2128 +            posx += incx;
  1.2129 +            ++dst;
  1.2130 +        }
  1.2131 +        posy += incy;
  1.2132 +        info->dst += info->dst_pitch;
  1.2133 +    }
  1.2134 +}
  1.2135 +
  1.2136 +void SDL_Blit_ARGB8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
  1.2137 +{
  1.2138 +    const int flags = info->flags;
  1.2139 +    const Uint32 modulateR = info->r;
  1.2140 +    const Uint32 modulateG = info->g;
  1.2141 +    const Uint32 modulateB = info->b;
  1.2142 +    const Uint32 modulateA = info->a;
  1.2143 +    Uint32 srcpixel;
  1.2144 +    Uint32 srcR, srcG, srcB, srcA;
  1.2145 +    Uint32 dstpixel;
  1.2146 +    Uint32 dstR, dstG, dstB, dstA;
  1.2147 +
  1.2148 +    while (info->dst_h--) {
  1.2149 +        Uint32 *src = (Uint32 *)info->src;
  1.2150 +        Uint32 *dst = (Uint32 *)info->dst;
  1.2151 +        int n = info->dst_w;
  1.2152 +        while (n--) {
  1.2153 +            srcpixel = *src;
  1.2154 +            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
  1.2155 +            dstpixel = *dst;
  1.2156 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  1.2157 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.2158 +                srcR = (srcR * modulateR) / 255;
  1.2159 +                srcG = (srcG * modulateG) / 255;
  1.2160 +                srcB = (srcB * modulateB) / 255;
  1.2161 +            }
  1.2162 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.2163 +                srcA = (srcA * modulateA) / 255;
  1.2164 +            }
  1.2165 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.2166 +                /* This goes away if we ever use premultiplied alpha */
  1.2167 +                if (srcA < 255) {
  1.2168 +                    srcR = (srcR * srcA) / 255;
  1.2169 +                    srcG = (srcG * srcA) / 255;
  1.2170 +                    srcB = (srcB * srcA) / 255;
  1.2171 +                }
  1.2172 +            }
  1.2173 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.2174 +            case SDL_COPY_MASK:
  1.2175 +                if (srcA) {
  1.2176 +                    dstR = srcR;
  1.2177 +                    dstG = srcG;
  1.2178 +                    dstB = srcB;
  1.2179 +                }
  1.2180 +                break;
  1.2181 +            case SDL_COPY_BLEND:
  1.2182 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.2183 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.2184 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.2185 +                break;
  1.2186 +            case SDL_COPY_ADD:
  1.2187 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.2188 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.2189 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.2190 +                break;
  1.2191 +            case SDL_COPY_MOD:
  1.2192 +                dstR = (srcR * dstR) / 255;
  1.2193 +                dstG = (srcG * dstG) / 255;
  1.2194 +                dstB = (srcB * dstB) / 255;
  1.2195 +                break;
  1.2196 +            }
  1.2197 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  1.2198 +            *dst = dstpixel;
  1.2199 +            ++src;
  1.2200 +            ++dst;
  1.2201 +        }
  1.2202 +        info->src += info->src_pitch;
  1.2203 +        info->dst += info->dst_pitch;
  1.2204 +    }
  1.2205 +}
  1.2206 +
  1.2207 +void SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
  1.2208 +{
  1.2209 +    const int flags = info->flags;
  1.2210 +    const Uint32 modulateR = info->r;
  1.2211 +    const Uint32 modulateG = info->g;
  1.2212 +    const Uint32 modulateB = info->b;
  1.2213 +    const Uint32 modulateA = info->a;
  1.2214 +    Uint32 srcpixel;
  1.2215 +    Uint32 srcR, srcG, srcB, srcA;
  1.2216 +    Uint32 dstpixel;
  1.2217 +    Uint32 dstR, dstG, dstB, dstA;
  1.2218 +    int srcy, srcx;
  1.2219 +    int posy, posx;
  1.2220 +    int incy, incx;
  1.2221 +
  1.2222 +    srcy = 0;
  1.2223 +    posy = 0;
  1.2224 +    incy = (info->src_h << 16) / info->dst_h;
  1.2225 +    incx = (info->src_w << 16) / info->dst_w;
  1.2226 +
  1.2227 +    while (info->dst_h--) {
  1.2228 +        Uint32 *src;
  1.2229 +        Uint32 *dst = (Uint32 *)info->dst;
  1.2230 +        int n = info->dst_w;
  1.2231 +        srcx = -1;
  1.2232 +        posx = 0x10000L;
  1.2233 +        while (posy >= 0x10000L) {
  1.2234 +            ++srcy;
  1.2235 +            posy -= 0x10000L;
  1.2236 +        }
  1.2237 +        while (n--) {
  1.2238 +            if (posx >= 0x10000L) {
  1.2239 +                while (posx >= 0x10000L) {
  1.2240 +                    ++srcx;
  1.2241 +                    posx -= 0x10000L;
  1.2242 +                }
  1.2243 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.2244 +            }
  1.2245 +            srcpixel = *src;
  1.2246 +            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
  1.2247 +            dstpixel = *dst;
  1.2248 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  1.2249 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.2250 +                srcR = (srcR * modulateR) / 255;
  1.2251 +                srcG = (srcG * modulateG) / 255;
  1.2252 +                srcB = (srcB * modulateB) / 255;
  1.2253 +            }
  1.2254 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.2255 +                srcA = (srcA * modulateA) / 255;
  1.2256 +            }
  1.2257 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.2258 +                /* This goes away if we ever use premultiplied alpha */
  1.2259 +                if (srcA < 255) {
  1.2260 +                    srcR = (srcR * srcA) / 255;
  1.2261 +                    srcG = (srcG * srcA) / 255;
  1.2262 +                    srcB = (srcB * srcA) / 255;
  1.2263 +                }
  1.2264 +            }
  1.2265 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.2266 +            case SDL_COPY_MASK:
  1.2267 +                if (srcA) {
  1.2268 +                    dstR = srcR;
  1.2269 +                    dstG = srcG;
  1.2270 +                    dstB = srcB;
  1.2271 +                }
  1.2272 +                break;
  1.2273 +            case SDL_COPY_BLEND:
  1.2274 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.2275 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.2276 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.2277 +                break;
  1.2278 +            case SDL_COPY_ADD:
  1.2279 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.2280 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.2281 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.2282 +                break;
  1.2283 +            case SDL_COPY_MOD:
  1.2284 +                dstR = (srcR * dstR) / 255;
  1.2285 +                dstG = (srcG * dstG) / 255;
  1.2286 +                dstB = (srcB * dstB) / 255;
  1.2287 +                break;
  1.2288 +            }
  1.2289 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  1.2290 +            *dst = dstpixel;
  1.2291 +            posx += incx;
  1.2292 +            ++dst;
  1.2293 +        }
  1.2294 +        posy += incy;
  1.2295 +        info->dst += info->dst_pitch;
  1.2296 +    }
  1.2297 +}
  1.2298 +
  1.2299 +void SDL_Blit_ARGB8888_BGR888_Scale(SDL_BlitInfo *info)
  1.2300 +{
  1.2301 +    const int flags = info->flags;
  1.2302 +    Uint32 pixel;
  1.2303 +    Uint32 R, G, B, A;
  1.2304 +    int srcy, srcx;
  1.2305 +    int posy, posx;
  1.2306 +    int incy, incx;
  1.2307 +
  1.2308 +    srcy = 0;
  1.2309 +    posy = 0;
  1.2310 +    incy = (info->src_h << 16) / info->dst_h;
  1.2311 +    incx = (info->src_w << 16) / info->dst_w;
  1.2312 +
  1.2313 +    while (info->dst_h--) {
  1.2314 +        Uint32 *src;
  1.2315 +        Uint32 *dst = (Uint32 *)info->dst;
  1.2316 +        int n = info->dst_w;
  1.2317 +        srcx = -1;
  1.2318 +        posx = 0x10000L;
  1.2319 +        while (posy >= 0x10000L) {
  1.2320 +            ++srcy;
  1.2321 +            posy -= 0x10000L;
  1.2322 +        }
  1.2323 +        while (n--) {
  1.2324 +            if (posx >= 0x10000L) {
  1.2325 +                while (posx >= 0x10000L) {
  1.2326 +                    ++srcx;
  1.2327 +                    posx -= 0x10000L;
  1.2328 +                }
  1.2329 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.2330 +            }
  1.2331 +            pixel = *src;
  1.2332 +            A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
  1.2333 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  1.2334 +            *dst = pixel;
  1.2335 +            posx += incx;
  1.2336 +            ++dst;
  1.2337 +        }
  1.2338 +        posy += incy;
  1.2339 +        info->dst += info->dst_pitch;
  1.2340 +    }
  1.2341 +}
  1.2342 +
  1.2343 +void SDL_Blit_ARGB8888_BGR888_Blend(SDL_BlitInfo *info)
  1.2344 +{
  1.2345 +    const int flags = info->flags;
  1.2346 +    Uint32 srcpixel;
  1.2347 +    Uint32 srcR, srcG, srcB, srcA;
  1.2348 +    Uint32 dstpixel;
  1.2349 +    Uint32 dstR, dstG, dstB, dstA;
  1.2350 +
  1.2351 +    while (info->dst_h--) {
  1.2352 +        Uint32 *src = (Uint32 *)info->src;
  1.2353 +        Uint32 *dst = (Uint32 *)info->dst;
  1.2354 +        int n = info->dst_w;
  1.2355 +        while (n--) {
  1.2356 +            srcpixel = *src;
  1.2357 +            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
  1.2358 +            dstpixel = *dst;
  1.2359 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  1.2360 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.2361 +                /* This goes away if we ever use premultiplied alpha */
  1.2362 +                if (srcA < 255) {
  1.2363 +                    srcR = (srcR * srcA) / 255;
  1.2364 +                    srcG = (srcG * srcA) / 255;
  1.2365 +                    srcB = (srcB * srcA) / 255;
  1.2366 +                }
  1.2367 +            }
  1.2368 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.2369 +            case SDL_COPY_MASK:
  1.2370 +                if (srcA) {
  1.2371 +                    dstR = srcR;
  1.2372 +                    dstG = srcG;
  1.2373 +                    dstB = srcB;
  1.2374 +                }
  1.2375 +                break;
  1.2376 +            case SDL_COPY_BLEND:
  1.2377 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.2378 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.2379 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.2380 +                break;
  1.2381 +            case SDL_COPY_ADD:
  1.2382 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.2383 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.2384 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.2385 +                break;
  1.2386 +            case SDL_COPY_MOD:
  1.2387 +                dstR = (srcR * dstR) / 255;
  1.2388 +                dstG = (srcG * dstG) / 255;
  1.2389 +                dstB = (srcB * dstB) / 255;
  1.2390 +                break;
  1.2391 +            }
  1.2392 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  1.2393 +            *dst = dstpixel;
  1.2394 +            ++src;
  1.2395 +            ++dst;
  1.2396 +        }
  1.2397 +        info->src += info->src_pitch;
  1.2398 +        info->dst += info->dst_pitch;
  1.2399 +    }
  1.2400 +}
  1.2401 +
  1.2402 +void SDL_Blit_ARGB8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
  1.2403 +{
  1.2404 +    const int flags = info->flags;
  1.2405 +    Uint32 srcpixel;
  1.2406 +    Uint32 srcR, srcG, srcB, srcA;
  1.2407 +    Uint32 dstpixel;
  1.2408 +    Uint32 dstR, dstG, dstB, dstA;
  1.2409 +    int srcy, srcx;
  1.2410 +    int posy, posx;
  1.2411 +    int incy, incx;
  1.2412 +
  1.2413 +    srcy = 0;
  1.2414 +    posy = 0;
  1.2415 +    incy = (info->src_h << 16) / info->dst_h;
  1.2416 +    incx = (info->src_w << 16) / info->dst_w;
  1.2417 +
  1.2418 +    while (info->dst_h--) {
  1.2419 +        Uint32 *src;
  1.2420 +        Uint32 *dst = (Uint32 *)info->dst;
  1.2421 +        int n = info->dst_w;
  1.2422 +        srcx = -1;
  1.2423 +        posx = 0x10000L;
  1.2424 +        while (posy >= 0x10000L) {
  1.2425 +            ++srcy;
  1.2426 +            posy -= 0x10000L;
  1.2427 +        }
  1.2428 +        while (n--) {
  1.2429 +            if (posx >= 0x10000L) {
  1.2430 +                while (posx >= 0x10000L) {
  1.2431 +                    ++srcx;
  1.2432 +                    posx -= 0x10000L;
  1.2433 +                }
  1.2434 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.2435 +            }
  1.2436 +            srcpixel = *src;
  1.2437 +            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
  1.2438 +            dstpixel = *dst;
  1.2439 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  1.2440 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.2441 +                /* This goes away if we ever use premultiplied alpha */
  1.2442 +                if (srcA < 255) {
  1.2443 +                    srcR = (srcR * srcA) / 255;
  1.2444 +                    srcG = (srcG * srcA) / 255;
  1.2445 +                    srcB = (srcB * srcA) / 255;
  1.2446 +                }
  1.2447 +            }
  1.2448 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.2449 +            case SDL_COPY_MASK:
  1.2450 +                if (srcA) {
  1.2451 +                    dstR = srcR;
  1.2452 +                    dstG = srcG;
  1.2453 +                    dstB = srcB;
  1.2454 +                }
  1.2455 +                break;
  1.2456 +            case SDL_COPY_BLEND:
  1.2457 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.2458 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.2459 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.2460 +                break;
  1.2461 +            case SDL_COPY_ADD:
  1.2462 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.2463 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.2464 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.2465 +                break;
  1.2466 +            case SDL_COPY_MOD:
  1.2467 +                dstR = (srcR * dstR) / 255;
  1.2468 +                dstG = (srcG * dstG) / 255;
  1.2469 +                dstB = (srcB * dstB) / 255;
  1.2470 +                break;
  1.2471 +            }
  1.2472 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  1.2473 +            *dst = dstpixel;
  1.2474 +            posx += incx;
  1.2475 +            ++dst;
  1.2476 +        }
  1.2477 +        posy += incy;
  1.2478 +        info->dst += info->dst_pitch;
  1.2479 +    }
  1.2480 +}
  1.2481 +
  1.2482 +void SDL_Blit_ARGB8888_BGR888_Modulate(SDL_BlitInfo *info)
  1.2483 +{
  1.2484 +    const int flags = info->flags;
  1.2485 +    const Uint32 modulateR = info->r;
  1.2486 +    const Uint32 modulateG = info->g;
  1.2487 +    const Uint32 modulateB = info->b;
  1.2488 +    const Uint32 modulateA = info->a;
  1.2489 +    Uint32 pixel;
  1.2490 +    Uint32 R, G, B, A;
  1.2491 +
  1.2492 +    while (info->dst_h--) {
  1.2493 +        Uint32 *src = (Uint32 *)info->src;
  1.2494 +        Uint32 *dst = (Uint32 *)info->dst;
  1.2495 +        int n = info->dst_w;
  1.2496 +        while (n--) {
  1.2497 +            pixel = *src;
  1.2498 +            A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
  1.2499 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.2500 +                R = (R * modulateR) / 255;
  1.2501 +                G = (G * modulateG) / 255;
  1.2502 +                B = (B * modulateB) / 255;
  1.2503 +            }
  1.2504 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.2505 +                A = (A * modulateA) / 255;
  1.2506 +            }
  1.2507 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  1.2508 +            *dst = pixel;
  1.2509 +            ++src;
  1.2510 +            ++dst;
  1.2511 +        }
  1.2512 +        info->src += info->src_pitch;
  1.2513 +        info->dst += info->dst_pitch;
  1.2514 +    }
  1.2515 +}
  1.2516 +
  1.2517 +void SDL_Blit_ARGB8888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
  1.2518 +{
  1.2519 +    const int flags = info->flags;
  1.2520 +    const Uint32 modulateR = info->r;
  1.2521 +    const Uint32 modulateG = info->g;
  1.2522 +    const Uint32 modulateB = info->b;
  1.2523 +    const Uint32 modulateA = info->a;
  1.2524 +    Uint32 pixel;
  1.2525 +    Uint32 R, G, B, A;
  1.2526 +    int srcy, srcx;
  1.2527 +    int posy, posx;
  1.2528 +    int incy, incx;
  1.2529 +
  1.2530 +    srcy = 0;
  1.2531 +    posy = 0;
  1.2532 +    incy = (info->src_h << 16) / info->dst_h;
  1.2533 +    incx = (info->src_w << 16) / info->dst_w;
  1.2534 +
  1.2535 +    while (info->dst_h--) {
  1.2536 +        Uint32 *src;
  1.2537 +        Uint32 *dst = (Uint32 *)info->dst;
  1.2538 +        int n = info->dst_w;
  1.2539 +        srcx = -1;
  1.2540 +        posx = 0x10000L;
  1.2541 +        while (posy >= 0x10000L) {
  1.2542 +            ++srcy;
  1.2543 +            posy -= 0x10000L;
  1.2544 +        }
  1.2545 +        while (n--) {
  1.2546 +            if (posx >= 0x10000L) {
  1.2547 +                while (posx >= 0x10000L) {
  1.2548 +                    ++srcx;
  1.2549 +                    posx -= 0x10000L;
  1.2550 +                }
  1.2551 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.2552 +            }
  1.2553 +            pixel = *src;
  1.2554 +            A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
  1.2555 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.2556 +                R = (R * modulateR) / 255;
  1.2557 +                G = (G * modulateG) / 255;
  1.2558 +                B = (B * modulateB) / 255;
  1.2559 +            }
  1.2560 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.2561 +                A = (A * modulateA) / 255;
  1.2562 +            }
  1.2563 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  1.2564 +            *dst = pixel;
  1.2565 +            posx += incx;
  1.2566 +            ++dst;
  1.2567 +        }
  1.2568 +        posy += incy;
  1.2569 +        info->dst += info->dst_pitch;
  1.2570 +    }
  1.2571 +}
  1.2572 +
  1.2573 +void SDL_Blit_ARGB8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
  1.2574 +{
  1.2575 +    const int flags = info->flags;
  1.2576 +    const Uint32 modulateR = info->r;
  1.2577 +    const Uint32 modulateG = info->g;
  1.2578 +    const Uint32 modulateB = info->b;
  1.2579 +    const Uint32 modulateA = info->a;
  1.2580 +    Uint32 srcpixel;
  1.2581 +    Uint32 srcR, srcG, srcB, srcA;
  1.2582 +    Uint32 dstpixel;
  1.2583 +    Uint32 dstR, dstG, dstB, dstA;
  1.2584 +
  1.2585 +    while (info->dst_h--) {
  1.2586 +        Uint32 *src = (Uint32 *)info->src;
  1.2587 +        Uint32 *dst = (Uint32 *)info->dst;
  1.2588 +        int n = info->dst_w;
  1.2589 +        while (n--) {
  1.2590 +            srcpixel = *src;
  1.2591 +            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
  1.2592 +            dstpixel = *dst;
  1.2593 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  1.2594 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.2595 +                srcR = (srcR * modulateR) / 255;
  1.2596 +                srcG = (srcG * modulateG) / 255;
  1.2597 +                srcB = (srcB * modulateB) / 255;
  1.2598 +            }
  1.2599 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.2600 +                srcA = (srcA * modulateA) / 255;
  1.2601 +            }
  1.2602 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.2603 +                /* This goes away if we ever use premultiplied alpha */
  1.2604 +                if (srcA < 255) {
  1.2605 +                    srcR = (srcR * srcA) / 255;
  1.2606 +                    srcG = (srcG * srcA) / 255;
  1.2607 +                    srcB = (srcB * srcA) / 255;
  1.2608 +                }
  1.2609 +            }
  1.2610 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.2611 +            case SDL_COPY_MASK:
  1.2612 +                if (srcA) {
  1.2613 +                    dstR = srcR;
  1.2614 +                    dstG = srcG;
  1.2615 +                    dstB = srcB;
  1.2616 +                }
  1.2617 +                break;
  1.2618 +            case SDL_COPY_BLEND:
  1.2619 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.2620 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.2621 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.2622 +                break;
  1.2623 +            case SDL_COPY_ADD:
  1.2624 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.2625 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.2626 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.2627 +                break;
  1.2628 +            case SDL_COPY_MOD:
  1.2629 +                dstR = (srcR * dstR) / 255;
  1.2630 +                dstG = (srcG * dstG) / 255;
  1.2631 +                dstB = (srcB * dstB) / 255;
  1.2632 +                break;
  1.2633 +            }
  1.2634 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  1.2635 +            *dst = dstpixel;
  1.2636 +            ++src;
  1.2637 +            ++dst;
  1.2638 +        }
  1.2639 +        info->src += info->src_pitch;
  1.2640 +        info->dst += info->dst_pitch;
  1.2641 +    }
  1.2642 +}
  1.2643 +
  1.2644 +void SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
  1.2645 +{
  1.2646 +    const int flags = info->flags;
  1.2647 +    const Uint32 modulateR = info->r;
  1.2648 +    const Uint32 modulateG = info->g;
  1.2649 +    const Uint32 modulateB = info->b;
  1.2650 +    const Uint32 modulateA = info->a;
  1.2651 +    Uint32 srcpixel;
  1.2652 +    Uint32 srcR, srcG, srcB, srcA;
  1.2653 +    Uint32 dstpixel;
  1.2654 +    Uint32 dstR, dstG, dstB, dstA;
  1.2655 +    int srcy, srcx;
  1.2656 +    int posy, posx;
  1.2657 +    int incy, incx;
  1.2658 +
  1.2659 +    srcy = 0;
  1.2660 +    posy = 0;
  1.2661 +    incy = (info->src_h << 16) / info->dst_h;
  1.2662 +    incx = (info->src_w << 16) / info->dst_w;
  1.2663 +
  1.2664 +    while (info->dst_h--) {
  1.2665 +        Uint32 *src;
  1.2666 +        Uint32 *dst = (Uint32 *)info->dst;
  1.2667 +        int n = info->dst_w;
  1.2668 +        srcx = -1;
  1.2669 +        posx = 0x10000L;
  1.2670 +        while (posy >= 0x10000L) {
  1.2671 +            ++srcy;
  1.2672 +            posy -= 0x10000L;
  1.2673 +        }
  1.2674 +        while (n--) {
  1.2675 +            if (posx >= 0x10000L) {
  1.2676 +                while (posx >= 0x10000L) {
  1.2677 +                    ++srcx;
  1.2678 +                    posx -= 0x10000L;
  1.2679 +                }
  1.2680 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.2681 +            }
  1.2682 +            srcpixel = *src;
  1.2683 +            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
  1.2684 +            dstpixel = *dst;
  1.2685 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  1.2686 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.2687 +                srcR = (srcR * modulateR) / 255;
  1.2688 +                srcG = (srcG * modulateG) / 255;
  1.2689 +                srcB = (srcB * modulateB) / 255;
  1.2690 +            }
  1.2691 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.2692 +                srcA = (srcA * modulateA) / 255;
  1.2693 +            }
  1.2694 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.2695 +                /* This goes away if we ever use premultiplied alpha */
  1.2696 +                if (srcA < 255) {
  1.2697 +                    srcR = (srcR * srcA) / 255;
  1.2698 +                    srcG = (srcG * srcA) / 255;
  1.2699 +                    srcB = (srcB * srcA) / 255;
  1.2700 +                }
  1.2701 +            }
  1.2702 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.2703 +            case SDL_COPY_MASK:
  1.2704 +                if (srcA) {
  1.2705 +                    dstR = srcR;
  1.2706 +                    dstG = srcG;
  1.2707 +                    dstB = srcB;
  1.2708 +                }
  1.2709 +                break;
  1.2710 +            case SDL_COPY_BLEND:
  1.2711 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.2712 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.2713 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.2714 +                break;
  1.2715 +            case SDL_COPY_ADD:
  1.2716 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.2717 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.2718 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.2719 +                break;
  1.2720 +            case SDL_COPY_MOD:
  1.2721 +                dstR = (srcR * dstR) / 255;
  1.2722 +                dstG = (srcG * dstG) / 255;
  1.2723 +                dstB = (srcB * dstB) / 255;
  1.2724 +                break;
  1.2725 +            }
  1.2726 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  1.2727 +            *dst = dstpixel;
  1.2728 +            posx += incx;
  1.2729 +            ++dst;
  1.2730 +        }
  1.2731 +        posy += incy;
  1.2732 +        info->dst += info->dst_pitch;
  1.2733 +    }
  1.2734 +}
  1.2735 +
  1.2736 +void SDL_Blit_RGBA8888_RGB888_Scale(SDL_BlitInfo *info)
  1.2737 +{
  1.2738 +    const int flags = info->flags;
  1.2739 +    Uint32 pixel;
  1.2740 +    Uint32 R, G, B, A;
  1.2741 +    int srcy, srcx;
  1.2742 +    int posy, posx;
  1.2743 +    int incy, incx;
  1.2744 +
  1.2745 +    srcy = 0;
  1.2746 +    posy = 0;
  1.2747 +    incy = (info->src_h << 16) / info->dst_h;
  1.2748 +    incx = (info->src_w << 16) / info->dst_w;
  1.2749 +
  1.2750 +    while (info->dst_h--) {
  1.2751 +        Uint32 *src;
  1.2752 +        Uint32 *dst = (Uint32 *)info->dst;
  1.2753 +        int n = info->dst_w;
  1.2754 +        srcx = -1;
  1.2755 +        posx = 0x10000L;
  1.2756 +        while (posy >= 0x10000L) {
  1.2757 +            ++srcy;
  1.2758 +            posy -= 0x10000L;
  1.2759 +        }
  1.2760 +        while (n--) {
  1.2761 +            if (posx >= 0x10000L) {
  1.2762 +                while (posx >= 0x10000L) {
  1.2763 +                    ++srcx;
  1.2764 +                    posx -= 0x10000L;
  1.2765 +                }
  1.2766 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.2767 +            }
  1.2768 +            pixel = *src;
  1.2769 +            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  1.2770 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  1.2771 +            *dst = pixel;
  1.2772 +            posx += incx;
  1.2773 +            ++dst;
  1.2774 +        }
  1.2775 +        posy += incy;
  1.2776 +        info->dst += info->dst_pitch;
  1.2777 +    }
  1.2778 +}
  1.2779 +
  1.2780 +void SDL_Blit_RGBA8888_RGB888_Blend(SDL_BlitInfo *info)
  1.2781 +{
  1.2782 +    const int flags = info->flags;
  1.2783 +    Uint32 srcpixel;
  1.2784 +    Uint32 srcR, srcG, srcB, srcA;
  1.2785 +    Uint32 dstpixel;
  1.2786 +    Uint32 dstR, dstG, dstB, dstA;
  1.2787 +
  1.2788 +    while (info->dst_h--) {
  1.2789 +        Uint32 *src = (Uint32 *)info->src;
  1.2790 +        Uint32 *dst = (Uint32 *)info->dst;
  1.2791 +        int n = info->dst_w;
  1.2792 +        while (n--) {
  1.2793 +            srcpixel = *src;
  1.2794 +            srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  1.2795 +            dstpixel = *dst;
  1.2796 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  1.2797 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.2798 +                /* This goes away if we ever use premultiplied alpha */
  1.2799 +                if (srcA < 255) {
  1.2800 +                    srcR = (srcR * srcA) / 255;
  1.2801 +                    srcG = (srcG * srcA) / 255;
  1.2802 +                    srcB = (srcB * srcA) / 255;
  1.2803 +                }
  1.2804 +            }
  1.2805 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.2806 +            case SDL_COPY_MASK:
  1.2807 +                if (srcA) {
  1.2808 +                    dstR = srcR;
  1.2809 +                    dstG = srcG;
  1.2810 +                    dstB = srcB;
  1.2811 +                }
  1.2812 +                break;
  1.2813 +            case SDL_COPY_BLEND:
  1.2814 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.2815 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.2816 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.2817 +                break;
  1.2818 +            case SDL_COPY_ADD:
  1.2819 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.2820 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.2821 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.2822 +                break;
  1.2823 +            case SDL_COPY_MOD:
  1.2824 +                dstR = (srcR * dstR) / 255;
  1.2825 +                dstG = (srcG * dstG) / 255;
  1.2826 +                dstB = (srcB * dstB) / 255;
  1.2827 +                break;
  1.2828 +            }
  1.2829 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  1.2830 +            *dst = dstpixel;
  1.2831 +            ++src;
  1.2832 +            ++dst;
  1.2833 +        }
  1.2834 +        info->src += info->src_pitch;
  1.2835 +        info->dst += info->dst_pitch;
  1.2836 +    }
  1.2837 +}
  1.2838 +
  1.2839 +void SDL_Blit_RGBA8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
  1.2840 +{
  1.2841 +    const int flags = info->flags;
  1.2842 +    Uint32 srcpixel;
  1.2843 +    Uint32 srcR, srcG, srcB, srcA;
  1.2844 +    Uint32 dstpixel;
  1.2845 +    Uint32 dstR, dstG, dstB, dstA;
  1.2846 +    int srcy, srcx;
  1.2847 +    int posy, posx;
  1.2848 +    int incy, incx;
  1.2849 +
  1.2850 +    srcy = 0;
  1.2851 +    posy = 0;
  1.2852 +    incy = (info->src_h << 16) / info->dst_h;
  1.2853 +    incx = (info->src_w << 16) / info->dst_w;
  1.2854 +
  1.2855 +    while (info->dst_h--) {
  1.2856 +        Uint32 *src;
  1.2857 +        Uint32 *dst = (Uint32 *)info->dst;
  1.2858 +        int n = info->dst_w;
  1.2859 +        srcx = -1;
  1.2860 +        posx = 0x10000L;
  1.2861 +        while (posy >= 0x10000L) {
  1.2862 +            ++srcy;
  1.2863 +            posy -= 0x10000L;
  1.2864 +        }
  1.2865 +        while (n--) {
  1.2866 +            if (posx >= 0x10000L) {
  1.2867 +                while (posx >= 0x10000L) {
  1.2868 +                    ++srcx;
  1.2869 +                    posx -= 0x10000L;
  1.2870 +                }
  1.2871 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.2872 +            }
  1.2873 +            srcpixel = *src;
  1.2874 +            srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  1.2875 +            dstpixel = *dst;
  1.2876 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  1.2877 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.2878 +                /* This goes away if we ever use premultiplied alpha */
  1.2879 +                if (srcA < 255) {
  1.2880 +                    srcR = (srcR * srcA) / 255;
  1.2881 +                    srcG = (srcG * srcA) / 255;
  1.2882 +                    srcB = (srcB * srcA) / 255;
  1.2883 +                }
  1.2884 +            }
  1.2885 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.2886 +            case SDL_COPY_MASK:
  1.2887 +                if (srcA) {
  1.2888 +                    dstR = srcR;
  1.2889 +                    dstG = srcG;
  1.2890 +                    dstB = srcB;
  1.2891 +                }
  1.2892 +                break;
  1.2893 +            case SDL_COPY_BLEND:
  1.2894 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.2895 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.2896 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.2897 +                break;
  1.2898 +            case SDL_COPY_ADD:
  1.2899 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.2900 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.2901 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.2902 +                break;
  1.2903 +            case SDL_COPY_MOD:
  1.2904 +                dstR = (srcR * dstR) / 255;
  1.2905 +                dstG = (srcG * dstG) / 255;
  1.2906 +                dstB = (srcB * dstB) / 255;
  1.2907 +                break;
  1.2908 +            }
  1.2909 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  1.2910 +            *dst = dstpixel;
  1.2911 +            posx += incx;
  1.2912 +            ++dst;
  1.2913 +        }
  1.2914 +        posy += incy;
  1.2915 +        info->dst += info->dst_pitch;
  1.2916 +    }
  1.2917 +}
  1.2918 +
  1.2919 +void SDL_Blit_RGBA8888_RGB888_Modulate(SDL_BlitInfo *info)
  1.2920 +{
  1.2921 +    const int flags = info->flags;
  1.2922 +    const Uint32 modulateR = info->r;
  1.2923 +    const Uint32 modulateG = info->g;
  1.2924 +    const Uint32 modulateB = info->b;
  1.2925 +    const Uint32 modulateA = info->a;
  1.2926 +    Uint32 pixel;
  1.2927 +    Uint32 R, G, B, A;
  1.2928 +
  1.2929 +    while (info->dst_h--) {
  1.2930 +        Uint32 *src = (Uint32 *)info->src;
  1.2931 +        Uint32 *dst = (Uint32 *)info->dst;
  1.2932 +        int n = info->dst_w;
  1.2933 +        while (n--) {
  1.2934 +            pixel = *src;
  1.2935 +            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  1.2936 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.2937 +                R = (R * modulateR) / 255;
  1.2938 +                G = (G * modulateG) / 255;
  1.2939 +                B = (B * modulateB) / 255;
  1.2940 +            }
  1.2941 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.2942 +                A = (A * modulateA) / 255;
  1.2943 +            }
  1.2944 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  1.2945 +            *dst = pixel;
  1.2946 +            ++src;
  1.2947 +            ++dst;
  1.2948 +        }
  1.2949 +        info->src += info->src_pitch;
  1.2950 +        info->dst += info->dst_pitch;
  1.2951 +    }
  1.2952 +}
  1.2953 +
  1.2954 +void SDL_Blit_RGBA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
  1.2955 +{
  1.2956 +    const int flags = info->flags;
  1.2957 +    const Uint32 modulateR = info->r;
  1.2958 +    const Uint32 modulateG = info->g;
  1.2959 +    const Uint32 modulateB = info->b;
  1.2960 +    const Uint32 modulateA = info->a;
  1.2961 +    Uint32 pixel;
  1.2962 +    Uint32 R, G, B, A;
  1.2963 +    int srcy, srcx;
  1.2964 +    int posy, posx;
  1.2965 +    int incy, incx;
  1.2966 +
  1.2967 +    srcy = 0;
  1.2968 +    posy = 0;
  1.2969 +    incy = (info->src_h << 16) / info->dst_h;
  1.2970 +    incx = (info->src_w << 16) / info->dst_w;
  1.2971 +
  1.2972 +    while (info->dst_h--) {
  1.2973 +        Uint32 *src;
  1.2974 +        Uint32 *dst = (Uint32 *)info->dst;
  1.2975 +        int n = info->dst_w;
  1.2976 +        srcx = -1;
  1.2977 +        posx = 0x10000L;
  1.2978 +        while (posy >= 0x10000L) {
  1.2979 +            ++srcy;
  1.2980 +            posy -= 0x10000L;
  1.2981 +        }
  1.2982 +        while (n--) {
  1.2983 +            if (posx >= 0x10000L) {
  1.2984 +                while (posx >= 0x10000L) {
  1.2985 +                    ++srcx;
  1.2986 +                    posx -= 0x10000L;
  1.2987 +                }
  1.2988 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.2989 +            }
  1.2990 +            pixel = *src;
  1.2991 +            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  1.2992 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.2993 +                R = (R * modulateR) / 255;
  1.2994 +                G = (G * modulateG) / 255;
  1.2995 +                B = (B * modulateB) / 255;
  1.2996 +            }
  1.2997 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.2998 +                A = (A * modulateA) / 255;
  1.2999 +            }
  1.3000 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  1.3001 +            *dst = pixel;
  1.3002 +            posx += incx;
  1.3003 +            ++dst;
  1.3004 +        }
  1.3005 +        posy += incy;
  1.3006 +        info->dst += info->dst_pitch;
  1.3007 +    }
  1.3008 +}
  1.3009 +
  1.3010 +void SDL_Blit_RGBA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
  1.3011 +{
  1.3012 +    const int flags = info->flags;
  1.3013 +    const Uint32 modulateR = info->r;
  1.3014 +    const Uint32 modulateG = info->g;
  1.3015 +    const Uint32 modulateB = info->b;
  1.3016 +    const Uint32 modulateA = info->a;
  1.3017 +    Uint32 srcpixel;
  1.3018 +    Uint32 srcR, srcG, srcB, srcA;
  1.3019 +    Uint32 dstpixel;
  1.3020 +    Uint32 dstR, dstG, dstB, dstA;
  1.3021 +
  1.3022 +    while (info->dst_h--) {
  1.3023 +        Uint32 *src = (Uint32 *)info->src;
  1.3024 +        Uint32 *dst = (Uint32 *)info->dst;
  1.3025 +        int n = info->dst_w;
  1.3026 +        while (n--) {
  1.3027 +            srcpixel = *src;
  1.3028 +            srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  1.3029 +            dstpixel = *dst;
  1.3030 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  1.3031 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.3032 +                srcR = (srcR * modulateR) / 255;
  1.3033 +                srcG = (srcG * modulateG) / 255;
  1.3034 +                srcB = (srcB * modulateB) / 255;
  1.3035 +            }
  1.3036 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.3037 +                srcA = (srcA * modulateA) / 255;
  1.3038 +            }
  1.3039 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.3040 +                /* This goes away if we ever use premultiplied alpha */
  1.3041 +                if (srcA < 255) {
  1.3042 +                    srcR = (srcR * srcA) / 255;
  1.3043 +                    srcG = (srcG * srcA) / 255;
  1.3044 +                    srcB = (srcB * srcA) / 255;
  1.3045 +                }
  1.3046 +            }
  1.3047 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.3048 +            case SDL_COPY_MASK:
  1.3049 +                if (srcA) {
  1.3050 +                    dstR = srcR;
  1.3051 +                    dstG = srcG;
  1.3052 +                    dstB = srcB;
  1.3053 +                }
  1.3054 +                break;
  1.3055 +            case SDL_COPY_BLEND:
  1.3056 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.3057 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.3058 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.3059 +                break;
  1.3060 +            case SDL_COPY_ADD:
  1.3061 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.3062 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.3063 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.3064 +                break;
  1.3065 +            case SDL_COPY_MOD:
  1.3066 +                dstR = (srcR * dstR) / 255;
  1.3067 +                dstG = (srcG * dstG) / 255;
  1.3068 +                dstB = (srcB * dstB) / 255;
  1.3069 +                break;
  1.3070 +            }
  1.3071 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  1.3072 +            *dst = dstpixel;
  1.3073 +            ++src;
  1.3074 +            ++dst;
  1.3075 +        }
  1.3076 +        info->src += info->src_pitch;
  1.3077 +        info->dst += info->dst_pitch;
  1.3078 +    }
  1.3079 +}
  1.3080 +
  1.3081 +void SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
  1.3082 +{
  1.3083 +    const int flags = info->flags;
  1.3084 +    const Uint32 modulateR = info->r;
  1.3085 +    const Uint32 modulateG = info->g;
  1.3086 +    const Uint32 modulateB = info->b;
  1.3087 +    const Uint32 modulateA = info->a;
  1.3088 +    Uint32 srcpixel;
  1.3089 +    Uint32 srcR, srcG, srcB, srcA;
  1.3090 +    Uint32 dstpixel;
  1.3091 +    Uint32 dstR, dstG, dstB, dstA;
  1.3092 +    int srcy, srcx;
  1.3093 +    int posy, posx;
  1.3094 +    int incy, incx;
  1.3095 +
  1.3096 +    srcy = 0;
  1.3097 +    posy = 0;
  1.3098 +    incy = (info->src_h << 16) / info->dst_h;
  1.3099 +    incx = (info->src_w << 16) / info->dst_w;
  1.3100 +
  1.3101 +    while (info->dst_h--) {
  1.3102 +        Uint32 *src;
  1.3103 +        Uint32 *dst = (Uint32 *)info->dst;
  1.3104 +        int n = info->dst_w;
  1.3105 +        srcx = -1;
  1.3106 +        posx = 0x10000L;
  1.3107 +        while (posy >= 0x10000L) {
  1.3108 +            ++srcy;
  1.3109 +            posy -= 0x10000L;
  1.3110 +        }
  1.3111 +        while (n--) {
  1.3112 +            if (posx >= 0x10000L) {
  1.3113 +                while (posx >= 0x10000L) {
  1.3114 +                    ++srcx;
  1.3115 +                    posx -= 0x10000L;
  1.3116 +                }
  1.3117 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.3118 +            }
  1.3119 +            srcpixel = *src;
  1.3120 +            srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  1.3121 +            dstpixel = *dst;
  1.3122 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  1.3123 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.3124 +                srcR = (srcR * modulateR) / 255;
  1.3125 +                srcG = (srcG * modulateG) / 255;
  1.3126 +                srcB = (srcB * modulateB) / 255;
  1.3127 +            }
  1.3128 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.3129 +                srcA = (srcA * modulateA) / 255;
  1.3130 +            }
  1.3131 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.3132 +                /* This goes away if we ever use premultiplied alpha */
  1.3133 +                if (srcA < 255) {
  1.3134 +                    srcR = (srcR * srcA) / 255;
  1.3135 +                    srcG = (srcG * srcA) / 255;
  1.3136 +                    srcB = (srcB * srcA) / 255;
  1.3137 +                }
  1.3138 +            }
  1.3139 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.3140 +            case SDL_COPY_MASK:
  1.3141 +                if (srcA) {
  1.3142 +                    dstR = srcR;
  1.3143 +                    dstG = srcG;
  1.3144 +                    dstB = srcB;
  1.3145 +                }
  1.3146 +                break;
  1.3147 +            case SDL_COPY_BLEND:
  1.3148 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.3149 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.3150 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.3151 +                break;
  1.3152 +            case SDL_COPY_ADD:
  1.3153 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.3154 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.3155 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.3156 +                break;
  1.3157 +            case SDL_COPY_MOD:
  1.3158 +                dstR = (srcR * dstR) / 255;
  1.3159 +                dstG = (srcG * dstG) / 255;
  1.3160 +                dstB = (srcB * dstB) / 255;
  1.3161 +                break;
  1.3162 +            }
  1.3163 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  1.3164 +            *dst = dstpixel;
  1.3165 +            posx += incx;
  1.3166 +            ++dst;
  1.3167 +        }
  1.3168 +        posy += incy;
  1.3169 +        info->dst += info->dst_pitch;
  1.3170 +    }
  1.3171 +}
  1.3172 +
  1.3173 +void SDL_Blit_RGBA8888_BGR888_Scale(SDL_BlitInfo *info)
  1.3174 +{
  1.3175 +    const int flags = info->flags;
  1.3176 +    Uint32 pixel;
  1.3177 +    Uint32 R, G, B, A;
  1.3178 +    int srcy, srcx;
  1.3179 +    int posy, posx;
  1.3180 +    int incy, incx;
  1.3181 +
  1.3182 +    srcy = 0;
  1.3183 +    posy = 0;
  1.3184 +    incy = (info->src_h << 16) / info->dst_h;
  1.3185 +    incx = (info->src_w << 16) / info->dst_w;
  1.3186 +
  1.3187 +    while (info->dst_h--) {
  1.3188 +        Uint32 *src;
  1.3189 +        Uint32 *dst = (Uint32 *)info->dst;
  1.3190 +        int n = info->dst_w;
  1.3191 +        srcx = -1;
  1.3192 +        posx = 0x10000L;
  1.3193 +        while (posy >= 0x10000L) {
  1.3194 +            ++srcy;
  1.3195 +            posy -= 0x10000L;
  1.3196 +        }
  1.3197 +        while (n--) {
  1.3198 +            if (posx >= 0x10000L) {
  1.3199 +                while (posx >= 0x10000L) {
  1.3200 +                    ++srcx;
  1.3201 +                    posx -= 0x10000L;
  1.3202 +                }
  1.3203 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.3204 +            }
  1.3205 +            pixel = *src;
  1.3206 +            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  1.3207 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  1.3208 +            *dst = pixel;
  1.3209 +            posx += incx;
  1.3210 +            ++dst;
  1.3211 +        }
  1.3212 +        posy += incy;
  1.3213 +        info->dst += info->dst_pitch;
  1.3214 +    }
  1.3215 +}
  1.3216 +
  1.3217 +void SDL_Blit_RGBA8888_BGR888_Blend(SDL_BlitInfo *info)
  1.3218 +{
  1.3219 +    const int flags = info->flags;
  1.3220 +    Uint32 srcpixel;
  1.3221 +    Uint32 srcR, srcG, srcB, srcA;
  1.3222 +    Uint32 dstpixel;
  1.3223 +    Uint32 dstR, dstG, dstB, dstA;
  1.3224 +
  1.3225 +    while (info->dst_h--) {
  1.3226 +        Uint32 *src = (Uint32 *)info->src;
  1.3227 +        Uint32 *dst = (Uint32 *)info->dst;
  1.3228 +        int n = info->dst_w;
  1.3229 +        while (n--) {
  1.3230 +            srcpixel = *src;
  1.3231 +            srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  1.3232 +            dstpixel = *dst;
  1.3233 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  1.3234 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.3235 +                /* This goes away if we ever use premultiplied alpha */
  1.3236 +                if (srcA < 255) {
  1.3237 +                    srcR = (srcR * srcA) / 255;
  1.3238 +                    srcG = (srcG * srcA) / 255;
  1.3239 +                    srcB = (srcB * srcA) / 255;
  1.3240 +                }
  1.3241 +            }
  1.3242 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.3243 +            case SDL_COPY_MASK:
  1.3244 +                if (srcA) {
  1.3245 +                    dstR = srcR;
  1.3246 +                    dstG = srcG;
  1.3247 +                    dstB = srcB;
  1.3248 +                }
  1.3249 +                break;
  1.3250 +            case SDL_COPY_BLEND:
  1.3251 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.3252 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.3253 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.3254 +                break;
  1.3255 +            case SDL_COPY_ADD:
  1.3256 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.3257 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.3258 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.3259 +                break;
  1.3260 +            case SDL_COPY_MOD:
  1.3261 +                dstR = (srcR * dstR) / 255;
  1.3262 +                dstG = (srcG * dstG) / 255;
  1.3263 +                dstB = (srcB * dstB) / 255;
  1.3264 +                break;
  1.3265 +            }
  1.3266 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  1.3267 +            *dst = dstpixel;
  1.3268 +            ++src;
  1.3269 +            ++dst;
  1.3270 +        }
  1.3271 +        info->src += info->src_pitch;
  1.3272 +        info->dst += info->dst_pitch;
  1.3273 +    }
  1.3274 +}
  1.3275 +
  1.3276 +void SDL_Blit_RGBA8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
  1.3277 +{
  1.3278 +    const int flags = info->flags;
  1.3279 +    Uint32 srcpixel;
  1.3280 +    Uint32 srcR, srcG, srcB, srcA;
  1.3281 +    Uint32 dstpixel;
  1.3282 +    Uint32 dstR, dstG, dstB, dstA;
  1.3283 +    int srcy, srcx;
  1.3284 +    int posy, posx;
  1.3285 +    int incy, incx;
  1.3286 +
  1.3287 +    srcy = 0;
  1.3288 +    posy = 0;
  1.3289 +    incy = (info->src_h << 16) / info->dst_h;
  1.3290 +    incx = (info->src_w << 16) / info->dst_w;
  1.3291 +
  1.3292 +    while (info->dst_h--) {
  1.3293 +        Uint32 *src;
  1.3294 +        Uint32 *dst = (Uint32 *)info->dst;
  1.3295 +        int n = info->dst_w;
  1.3296 +        srcx = -1;
  1.3297 +        posx = 0x10000L;
  1.3298 +        while (posy >= 0x10000L) {
  1.3299 +            ++srcy;
  1.3300 +            posy -= 0x10000L;
  1.3301 +        }
  1.3302 +        while (n--) {
  1.3303 +            if (posx >= 0x10000L) {
  1.3304 +                while (posx >= 0x10000L) {
  1.3305 +                    ++srcx;
  1.3306 +                    posx -= 0x10000L;
  1.3307 +                }
  1.3308 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.3309 +            }
  1.3310 +            srcpixel = *src;
  1.3311 +            srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  1.3312 +            dstpixel = *dst;
  1.3313 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  1.3314 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.3315 +                /* This goes away if we ever use premultiplied alpha */
  1.3316 +                if (srcA < 255) {
  1.3317 +                    srcR = (srcR * srcA) / 255;
  1.3318 +                    srcG = (srcG * srcA) / 255;
  1.3319 +                    srcB = (srcB * srcA) / 255;
  1.3320 +                }
  1.3321 +            }
  1.3322 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.3323 +            case SDL_COPY_MASK:
  1.3324 +                if (srcA) {
  1.3325 +                    dstR = srcR;
  1.3326 +                    dstG = srcG;
  1.3327 +                    dstB = srcB;
  1.3328 +                }
  1.3329 +                break;
  1.3330 +            case SDL_COPY_BLEND:
  1.3331 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.3332 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.3333 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.3334 +                break;
  1.3335 +            case SDL_COPY_ADD:
  1.3336 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.3337 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.3338 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.3339 +                break;
  1.3340 +            case SDL_COPY_MOD:
  1.3341 +                dstR = (srcR * dstR) / 255;
  1.3342 +                dstG = (srcG * dstG) / 255;
  1.3343 +                dstB = (srcB * dstB) / 255;
  1.3344 +                break;
  1.3345 +            }
  1.3346 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  1.3347 +            *dst = dstpixel;
  1.3348 +            posx += incx;
  1.3349 +            ++dst;
  1.3350 +        }
  1.3351 +        posy += incy;
  1.3352 +        info->dst += info->dst_pitch;
  1.3353 +    }
  1.3354 +}
  1.3355 +
  1.3356 +void SDL_Blit_RGBA8888_BGR888_Modulate(SDL_BlitInfo *info)
  1.3357 +{
  1.3358 +    const int flags = info->flags;
  1.3359 +    const Uint32 modulateR = info->r;
  1.3360 +    const Uint32 modulateG = info->g;
  1.3361 +    const Uint32 modulateB = info->b;
  1.3362 +    const Uint32 modulateA = info->a;
  1.3363 +    Uint32 pixel;
  1.3364 +    Uint32 R, G, B, A;
  1.3365 +
  1.3366 +    while (info->dst_h--) {
  1.3367 +        Uint32 *src = (Uint32 *)info->src;
  1.3368 +        Uint32 *dst = (Uint32 *)info->dst;
  1.3369 +        int n = info->dst_w;
  1.3370 +        while (n--) {
  1.3371 +            pixel = *src;
  1.3372 +            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  1.3373 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.3374 +                R = (R * modulateR) / 255;
  1.3375 +                G = (G * modulateG) / 255;
  1.3376 +                B = (B * modulateB) / 255;
  1.3377 +            }
  1.3378 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.3379 +                A = (A * modulateA) / 255;
  1.3380 +            }
  1.3381 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  1.3382 +            *dst = pixel;
  1.3383 +            ++src;
  1.3384 +            ++dst;
  1.3385 +        }
  1.3386 +        info->src += info->src_pitch;
  1.3387 +        info->dst += info->dst_pitch;
  1.3388 +    }
  1.3389 +}
  1.3390 +
  1.3391 +void SDL_Blit_RGBA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
  1.3392 +{
  1.3393 +    const int flags = info->flags;
  1.3394 +    const Uint32 modulateR = info->r;
  1.3395 +    const Uint32 modulateG = info->g;
  1.3396 +    const Uint32 modulateB = info->b;
  1.3397 +    const Uint32 modulateA = info->a;
  1.3398 +    Uint32 pixel;
  1.3399 +    Uint32 R, G, B, A;
  1.3400 +    int srcy, srcx;
  1.3401 +    int posy, posx;
  1.3402 +    int incy, incx;
  1.3403 +
  1.3404 +    srcy = 0;
  1.3405 +    posy = 0;
  1.3406 +    incy = (info->src_h << 16) / info->dst_h;
  1.3407 +    incx = (info->src_w << 16) / info->dst_w;
  1.3408 +
  1.3409 +    while (info->dst_h--) {
  1.3410 +        Uint32 *src;
  1.3411 +        Uint32 *dst = (Uint32 *)info->dst;
  1.3412 +        int n = info->dst_w;
  1.3413 +        srcx = -1;
  1.3414 +        posx = 0x10000L;
  1.3415 +        while (posy >= 0x10000L) {
  1.3416 +            ++srcy;
  1.3417 +            posy -= 0x10000L;
  1.3418 +        }
  1.3419 +        while (n--) {
  1.3420 +            if (posx >= 0x10000L) {
  1.3421 +                while (posx >= 0x10000L) {
  1.3422 +                    ++srcx;
  1.3423 +                    posx -= 0x10000L;
  1.3424 +                }
  1.3425 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.3426 +            }
  1.3427 +            pixel = *src;
  1.3428 +            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  1.3429 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.3430 +                R = (R * modulateR) / 255;
  1.3431 +                G = (G * modulateG) / 255;
  1.3432 +                B = (B * modulateB) / 255;
  1.3433 +            }
  1.3434 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.3435 +                A = (A * modulateA) / 255;
  1.3436 +            }
  1.3437 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  1.3438 +            *dst = pixel;
  1.3439 +            posx += incx;
  1.3440 +            ++dst;
  1.3441 +        }
  1.3442 +        posy += incy;
  1.3443 +        info->dst += info->dst_pitch;
  1.3444 +    }
  1.3445 +}
  1.3446 +
  1.3447 +void SDL_Blit_RGBA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
  1.3448 +{
  1.3449 +    const int flags = info->flags;
  1.3450 +    const Uint32 modulateR = info->r;
  1.3451 +    const Uint32 modulateG = info->g;
  1.3452 +    const Uint32 modulateB = info->b;
  1.3453 +    const Uint32 modulateA = info->a;
  1.3454 +    Uint32 srcpixel;
  1.3455 +    Uint32 srcR, srcG, srcB, srcA;
  1.3456 +    Uint32 dstpixel;
  1.3457 +    Uint32 dstR, dstG, dstB, dstA;
  1.3458 +
  1.3459 +    while (info->dst_h--) {
  1.3460 +        Uint32 *src = (Uint32 *)info->src;
  1.3461 +        Uint32 *dst = (Uint32 *)info->dst;
  1.3462 +        int n = info->dst_w;
  1.3463 +        while (n--) {
  1.3464 +            srcpixel = *src;
  1.3465 +            srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  1.3466 +            dstpixel = *dst;
  1.3467 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  1.3468 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.3469 +                srcR = (srcR * modulateR) / 255;
  1.3470 +                srcG = (srcG * modulateG) / 255;
  1.3471 +                srcB = (srcB * modulateB) / 255;
  1.3472 +            }
  1.3473 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.3474 +                srcA = (srcA * modulateA) / 255;
  1.3475 +            }
  1.3476 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.3477 +                /* This goes away if we ever use premultiplied alpha */
  1.3478 +                if (srcA < 255) {
  1.3479 +                    srcR = (srcR * srcA) / 255;
  1.3480 +                    srcG = (srcG * srcA) / 255;
  1.3481 +                    srcB = (srcB * srcA) / 255;
  1.3482 +                }
  1.3483 +            }
  1.3484 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.3485 +            case SDL_COPY_MASK:
  1.3486 +                if (srcA) {
  1.3487 +                    dstR = srcR;
  1.3488 +                    dstG = srcG;
  1.3489 +                    dstB = srcB;
  1.3490 +                }
  1.3491 +                break;
  1.3492 +            case SDL_COPY_BLEND:
  1.3493 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.3494 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.3495 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.3496 +                break;
  1.3497 +            case SDL_COPY_ADD:
  1.3498 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.3499 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.3500 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.3501 +                break;
  1.3502 +            case SDL_COPY_MOD:
  1.3503 +                dstR = (srcR * dstR) / 255;
  1.3504 +                dstG = (srcG * dstG) / 255;
  1.3505 +                dstB = (srcB * dstB) / 255;
  1.3506 +                break;
  1.3507 +            }
  1.3508 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  1.3509 +            *dst = dstpixel;
  1.3510 +            ++src;
  1.3511 +            ++dst;
  1.3512 +        }
  1.3513 +        info->src += info->src_pitch;
  1.3514 +        info->dst += info->dst_pitch;
  1.3515 +    }
  1.3516 +}
  1.3517 +
  1.3518 +void SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
  1.3519 +{
  1.3520 +    const int flags = info->flags;
  1.3521 +    const Uint32 modulateR = info->r;
  1.3522 +    const Uint32 modulateG = info->g;
  1.3523 +    const Uint32 modulateB = info->b;
  1.3524 +    const Uint32 modulateA = info->a;
  1.3525 +    Uint32 srcpixel;
  1.3526 +    Uint32 srcR, srcG, srcB, srcA;
  1.3527 +    Uint32 dstpixel;
  1.3528 +    Uint32 dstR, dstG, dstB, dstA;
  1.3529 +    int srcy, srcx;
  1.3530 +    int posy, posx;
  1.3531 +    int incy, incx;
  1.3532 +
  1.3533 +    srcy = 0;
  1.3534 +    posy = 0;
  1.3535 +    incy = (info->src_h << 16) / info->dst_h;
  1.3536 +    incx = (info->src_w << 16) / info->dst_w;
  1.3537 +
  1.3538 +    while (info->dst_h--) {
  1.3539 +        Uint32 *src;
  1.3540 +        Uint32 *dst = (Uint32 *)info->dst;
  1.3541 +        int n = info->dst_w;
  1.3542 +        srcx = -1;
  1.3543 +        posx = 0x10000L;
  1.3544 +        while (posy >= 0x10000L) {
  1.3545 +            ++srcy;
  1.3546 +            posy -= 0x10000L;
  1.3547 +        }
  1.3548 +        while (n--) {
  1.3549 +            if (posx >= 0x10000L) {
  1.3550 +                while (posx >= 0x10000L) {
  1.3551 +                    ++srcx;
  1.3552 +                    posx -= 0x10000L;
  1.3553 +                }
  1.3554 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.3555 +            }
  1.3556 +            srcpixel = *src;
  1.3557 +            srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  1.3558 +            dstpixel = *dst;
  1.3559 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  1.3560 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.3561 +                srcR = (srcR * modulateR) / 255;
  1.3562 +                srcG = (srcG * modulateG) / 255;
  1.3563 +                srcB = (srcB * modulateB) / 255;
  1.3564 +            }
  1.3565 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.3566 +                srcA = (srcA * modulateA) / 255;
  1.3567 +            }
  1.3568 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.3569 +                /* This goes away if we ever use premultiplied alpha */
  1.3570 +                if (srcA < 255) {
  1.3571 +                    srcR = (srcR * srcA) / 255;
  1.3572 +                    srcG = (srcG * srcA) / 255;
  1.3573 +                    srcB = (srcB * srcA) / 255;
  1.3574 +                }
  1.3575 +            }
  1.3576 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.3577 +            case SDL_COPY_MASK:
  1.3578 +                if (srcA) {
  1.3579 +                    dstR = srcR;
  1.3580 +                    dstG = srcG;
  1.3581 +                    dstB = srcB;
  1.3582 +                }
  1.3583 +                break;
  1.3584 +            case SDL_COPY_BLEND:
  1.3585 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.3586 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.3587 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.3588 +                break;
  1.3589 +            case SDL_COPY_ADD:
  1.3590 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.3591 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.3592 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.3593 +                break;
  1.3594 +            case SDL_COPY_MOD:
  1.3595 +                dstR = (srcR * dstR) / 255;
  1.3596 +                dstG = (srcG * dstG) / 255;
  1.3597 +                dstB = (srcB * dstB) / 255;
  1.3598 +                break;
  1.3599 +            }
  1.3600 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  1.3601 +            *dst = dstpixel;
  1.3602 +            posx += incx;
  1.3603 +            ++dst;
  1.3604 +        }
  1.3605 +        posy += incy;
  1.3606 +        info->dst += info->dst_pitch;
  1.3607 +    }
  1.3608 +}
  1.3609 +
  1.3610 +void SDL_Blit_ABGR8888_RGB888_Scale(SDL_BlitInfo *info)
  1.3611 +{
  1.3612 +    const int flags = info->flags;
  1.3613 +    Uint32 pixel;
  1.3614 +    Uint32 R, G, B, A;
  1.3615 +    int srcy, srcx;
  1.3616 +    int posy, posx;
  1.3617 +    int incy, incx;
  1.3618 +
  1.3619 +    srcy = 0;
  1.3620 +    posy = 0;
  1.3621 +    incy = (info->src_h << 16) / info->dst_h;
  1.3622 +    incx = (info->src_w << 16) / info->dst_w;
  1.3623 +
  1.3624 +    while (info->dst_h--) {
  1.3625 +        Uint32 *src;
  1.3626 +        Uint32 *dst = (Uint32 *)info->dst;
  1.3627 +        int n = info->dst_w;
  1.3628 +        srcx = -1;
  1.3629 +        posx = 0x10000L;
  1.3630 +        while (posy >= 0x10000L) {
  1.3631 +            ++srcy;
  1.3632 +            posy -= 0x10000L;
  1.3633 +        }
  1.3634 +        while (n--) {
  1.3635 +            if (posx >= 0x10000L) {
  1.3636 +                while (posx >= 0x10000L) {
  1.3637 +                    ++srcx;
  1.3638 +                    posx -= 0x10000L;
  1.3639 +                }
  1.3640 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.3641 +            }
  1.3642 +            pixel = *src;
  1.3643 +            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
  1.3644 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  1.3645 +            *dst = pixel;
  1.3646 +            posx += incx;
  1.3647 +            ++dst;
  1.3648 +        }
  1.3649 +        posy += incy;
  1.3650 +        info->dst += info->dst_pitch;
  1.3651 +    }
  1.3652 +}
  1.3653 +
  1.3654 +void SDL_Blit_ABGR8888_RGB888_Blend(SDL_BlitInfo *info)
  1.3655 +{
  1.3656 +    const int flags = info->flags;
  1.3657 +    Uint32 srcpixel;
  1.3658 +    Uint32 srcR, srcG, srcB, srcA;
  1.3659 +    Uint32 dstpixel;
  1.3660 +    Uint32 dstR, dstG, dstB, dstA;
  1.3661 +
  1.3662 +    while (info->dst_h--) {
  1.3663 +        Uint32 *src = (Uint32 *)info->src;
  1.3664 +        Uint32 *dst = (Uint32 *)info->dst;
  1.3665 +        int n = info->dst_w;
  1.3666 +        while (n--) {
  1.3667 +            srcpixel = *src;
  1.3668 +            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
  1.3669 +            dstpixel = *dst;
  1.3670 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  1.3671 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.3672 +                /* This goes away if we ever use premultiplied alpha */
  1.3673 +                if (srcA < 255) {
  1.3674 +                    srcR = (srcR * srcA) / 255;
  1.3675 +                    srcG = (srcG * srcA) / 255;
  1.3676 +                    srcB = (srcB * srcA) / 255;
  1.3677 +                }
  1.3678 +            }
  1.3679 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.3680 +            case SDL_COPY_MASK:
  1.3681 +                if (srcA) {
  1.3682 +                    dstR = srcR;
  1.3683 +                    dstG = srcG;
  1.3684 +                    dstB = srcB;
  1.3685 +                }
  1.3686 +                break;
  1.3687 +            case SDL_COPY_BLEND:
  1.3688 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.3689 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.3690 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.3691 +                break;
  1.3692 +            case SDL_COPY_ADD:
  1.3693 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.3694 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.3695 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.3696 +                break;
  1.3697 +            case SDL_COPY_MOD:
  1.3698 +                dstR = (srcR * dstR) / 255;
  1.3699 +                dstG = (srcG * dstG) / 255;
  1.3700 +                dstB = (srcB * dstB) / 255;
  1.3701 +                break;
  1.3702 +            }
  1.3703 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  1.3704 +            *dst = dstpixel;
  1.3705 +            ++src;
  1.3706 +            ++dst;
  1.3707 +        }
  1.3708 +        info->src += info->src_pitch;
  1.3709 +        info->dst += info->dst_pitch;
  1.3710 +    }
  1.3711 +}
  1.3712 +
  1.3713 +void SDL_Blit_ABGR8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
  1.3714 +{
  1.3715 +    const int flags = info->flags;
  1.3716 +    Uint32 srcpixel;
  1.3717 +    Uint32 srcR, srcG, srcB, srcA;
  1.3718 +    Uint32 dstpixel;
  1.3719 +    Uint32 dstR, dstG, dstB, dstA;
  1.3720 +    int srcy, srcx;
  1.3721 +    int posy, posx;
  1.3722 +    int incy, incx;
  1.3723 +
  1.3724 +    srcy = 0;
  1.3725 +    posy = 0;
  1.3726 +    incy = (info->src_h << 16) / info->dst_h;
  1.3727 +    incx = (info->src_w << 16) / info->dst_w;
  1.3728 +
  1.3729 +    while (info->dst_h--) {
  1.3730 +        Uint32 *src;
  1.3731 +        Uint32 *dst = (Uint32 *)info->dst;
  1.3732 +        int n = info->dst_w;
  1.3733 +        srcx = -1;
  1.3734 +        posx = 0x10000L;
  1.3735 +        while (posy >= 0x10000L) {
  1.3736 +            ++srcy;
  1.3737 +            posy -= 0x10000L;
  1.3738 +        }
  1.3739 +        while (n--) {
  1.3740 +            if (posx >= 0x10000L) {
  1.3741 +                while (posx >= 0x10000L) {
  1.3742 +                    ++srcx;
  1.3743 +                    posx -= 0x10000L;
  1.3744 +                }
  1.3745 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.3746 +            }
  1.3747 +            srcpixel = *src;
  1.3748 +            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
  1.3749 +            dstpixel = *dst;
  1.3750 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  1.3751 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.3752 +                /* This goes away if we ever use premultiplied alpha */
  1.3753 +                if (srcA < 255) {
  1.3754 +                    srcR = (srcR * srcA) / 255;
  1.3755 +                    srcG = (srcG * srcA) / 255;
  1.3756 +                    srcB = (srcB * srcA) / 255;
  1.3757 +                }
  1.3758 +            }
  1.3759 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.3760 +            case SDL_COPY_MASK:
  1.3761 +                if (srcA) {
  1.3762 +                    dstR = srcR;
  1.3763 +                    dstG = srcG;
  1.3764 +                    dstB = srcB;
  1.3765 +                }
  1.3766 +                break;
  1.3767 +            case SDL_COPY_BLEND:
  1.3768 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.3769 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.3770 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.3771 +                break;
  1.3772 +            case SDL_COPY_ADD:
  1.3773 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.3774 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.3775 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.3776 +                break;
  1.3777 +            case SDL_COPY_MOD:
  1.3778 +                dstR = (srcR * dstR) / 255;
  1.3779 +                dstG = (srcG * dstG) / 255;
  1.3780 +                dstB = (srcB * dstB) / 255;
  1.3781 +                break;
  1.3782 +            }
  1.3783 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  1.3784 +            *dst = dstpixel;
  1.3785 +            posx += incx;
  1.3786 +            ++dst;
  1.3787 +        }
  1.3788 +        posy += incy;
  1.3789 +        info->dst += info->dst_pitch;
  1.3790 +    }
  1.3791 +}
  1.3792 +
  1.3793 +void SDL_Blit_ABGR8888_RGB888_Modulate(SDL_BlitInfo *info)
  1.3794 +{
  1.3795 +    const int flags = info->flags;
  1.3796 +    const Uint32 modulateR = info->r;
  1.3797 +    const Uint32 modulateG = info->g;
  1.3798 +    const Uint32 modulateB = info->b;
  1.3799 +    const Uint32 modulateA = info->a;
  1.3800 +    Uint32 pixel;
  1.3801 +    Uint32 R, G, B, A;
  1.3802 +
  1.3803 +    while (info->dst_h--) {
  1.3804 +        Uint32 *src = (Uint32 *)info->src;
  1.3805 +        Uint32 *dst = (Uint32 *)info->dst;
  1.3806 +        int n = info->dst_w;
  1.3807 +        while (n--) {
  1.3808 +            pixel = *src;
  1.3809 +            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
  1.3810 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.3811 +                R = (R * modulateR) / 255;
  1.3812 +                G = (G * modulateG) / 255;
  1.3813 +                B = (B * modulateB) / 255;
  1.3814 +            }
  1.3815 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.3816 +                A = (A * modulateA) / 255;
  1.3817 +            }
  1.3818 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  1.3819 +            *dst = pixel;
  1.3820 +            ++src;
  1.3821 +            ++dst;
  1.3822 +        }
  1.3823 +        info->src += info->src_pitch;
  1.3824 +        info->dst += info->dst_pitch;
  1.3825 +    }
  1.3826 +}
  1.3827 +
  1.3828 +void SDL_Blit_ABGR8888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
  1.3829 +{
  1.3830 +    const int flags = info->flags;
  1.3831 +    const Uint32 modulateR = info->r;
  1.3832 +    const Uint32 modulateG = info->g;
  1.3833 +    const Uint32 modulateB = info->b;
  1.3834 +    const Uint32 modulateA = info->a;
  1.3835 +    Uint32 pixel;
  1.3836 +    Uint32 R, G, B, A;
  1.3837 +    int srcy, srcx;
  1.3838 +    int posy, posx;
  1.3839 +    int incy, incx;
  1.3840 +
  1.3841 +    srcy = 0;
  1.3842 +    posy = 0;
  1.3843 +    incy = (info->src_h << 16) / info->dst_h;
  1.3844 +    incx = (info->src_w << 16) / info->dst_w;
  1.3845 +
  1.3846 +    while (info->dst_h--) {
  1.3847 +        Uint32 *src;
  1.3848 +        Uint32 *dst = (Uint32 *)info->dst;
  1.3849 +        int n = info->dst_w;
  1.3850 +        srcx = -1;
  1.3851 +        posx = 0x10000L;
  1.3852 +        while (posy >= 0x10000L) {
  1.3853 +            ++srcy;
  1.3854 +            posy -= 0x10000L;
  1.3855 +        }
  1.3856 +        while (n--) {
  1.3857 +            if (posx >= 0x10000L) {
  1.3858 +                while (posx >= 0x10000L) {
  1.3859 +                    ++srcx;
  1.3860 +                    posx -= 0x10000L;
  1.3861 +                }
  1.3862 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.3863 +            }
  1.3864 +            pixel = *src;
  1.3865 +            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
  1.3866 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.3867 +                R = (R * modulateR) / 255;
  1.3868 +                G = (G * modulateG) / 255;
  1.3869 +                B = (B * modulateB) / 255;
  1.3870 +            }
  1.3871 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.3872 +                A = (A * modulateA) / 255;
  1.3873 +            }
  1.3874 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  1.3875 +            *dst = pixel;
  1.3876 +            posx += incx;
  1.3877 +            ++dst;
  1.3878 +        }
  1.3879 +        posy += incy;
  1.3880 +        info->dst += info->dst_pitch;
  1.3881 +    }
  1.3882 +}
  1.3883 +
  1.3884 +void SDL_Blit_ABGR8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
  1.3885 +{
  1.3886 +    const int flags = info->flags;
  1.3887 +    const Uint32 modulateR = info->r;
  1.3888 +    const Uint32 modulateG = info->g;
  1.3889 +    const Uint32 modulateB = info->b;
  1.3890 +    const Uint32 modulateA = info->a;
  1.3891 +    Uint32 srcpixel;
  1.3892 +    Uint32 srcR, srcG, srcB, srcA;
  1.3893 +    Uint32 dstpixel;
  1.3894 +    Uint32 dstR, dstG, dstB, dstA;
  1.3895 +
  1.3896 +    while (info->dst_h--) {
  1.3897 +        Uint32 *src = (Uint32 *)info->src;
  1.3898 +        Uint32 *dst = (Uint32 *)info->dst;
  1.3899 +        int n = info->dst_w;
  1.3900 +        while (n--) {
  1.3901 +            srcpixel = *src;
  1.3902 +            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
  1.3903 +            dstpixel = *dst;
  1.3904 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  1.3905 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.3906 +                srcR = (srcR * modulateR) / 255;
  1.3907 +                srcG = (srcG * modulateG) / 255;
  1.3908 +                srcB = (srcB * modulateB) / 255;
  1.3909 +            }
  1.3910 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.3911 +                srcA = (srcA * modulateA) / 255;
  1.3912 +            }
  1.3913 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.3914 +                /* This goes away if we ever use premultiplied alpha */
  1.3915 +                if (srcA < 255) {
  1.3916 +                    srcR = (srcR * srcA) / 255;
  1.3917 +                    srcG = (srcG * srcA) / 255;
  1.3918 +                    srcB = (srcB * srcA) / 255;
  1.3919 +                }
  1.3920 +            }
  1.3921 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.3922 +            case SDL_COPY_MASK:
  1.3923 +                if (srcA) {
  1.3924 +                    dstR = srcR;
  1.3925 +                    dstG = srcG;
  1.3926 +                    dstB = srcB;
  1.3927 +                }
  1.3928 +                break;
  1.3929 +            case SDL_COPY_BLEND:
  1.3930 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.3931 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.3932 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.3933 +                break;
  1.3934 +            case SDL_COPY_ADD:
  1.3935 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.3936 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.3937 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.3938 +                break;
  1.3939 +            case SDL_COPY_MOD:
  1.3940 +                dstR = (srcR * dstR) / 255;
  1.3941 +                dstG = (srcG * dstG) / 255;
  1.3942 +                dstB = (srcB * dstB) / 255;
  1.3943 +                break;
  1.3944 +            }
  1.3945 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  1.3946 +            *dst = dstpixel;
  1.3947 +            ++src;
  1.3948 +            ++dst;
  1.3949 +        }
  1.3950 +        info->src += info->src_pitch;
  1.3951 +        info->dst += info->dst_pitch;
  1.3952 +    }
  1.3953 +}
  1.3954 +
  1.3955 +void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
  1.3956 +{
  1.3957 +    const int flags = info->flags;
  1.3958 +    const Uint32 modulateR = info->r;
  1.3959 +    const Uint32 modulateG = info->g;
  1.3960 +    const Uint32 modulateB = info->b;
  1.3961 +    const Uint32 modulateA = info->a;
  1.3962 +    Uint32 srcpixel;
  1.3963 +    Uint32 srcR, srcG, srcB, srcA;
  1.3964 +    Uint32 dstpixel;
  1.3965 +    Uint32 dstR, dstG, dstB, dstA;
  1.3966 +    int srcy, srcx;
  1.3967 +    int posy, posx;
  1.3968 +    int incy, incx;
  1.3969 +
  1.3970 +    srcy = 0;
  1.3971 +    posy = 0;
  1.3972 +    incy = (info->src_h << 16) / info->dst_h;
  1.3973 +    incx = (info->src_w << 16) / info->dst_w;
  1.3974 +
  1.3975 +    while (info->dst_h--) {
  1.3976 +        Uint32 *src;
  1.3977 +        Uint32 *dst = (Uint32 *)info->dst;
  1.3978 +        int n = info->dst_w;
  1.3979 +        srcx = -1;
  1.3980 +        posx = 0x10000L;
  1.3981 +        while (posy >= 0x10000L) {
  1.3982 +            ++srcy;
  1.3983 +            posy -= 0x10000L;
  1.3984 +        }
  1.3985 +        while (n--) {
  1.3986 +            if (posx >= 0x10000L) {
  1.3987 +                while (posx >= 0x10000L) {
  1.3988 +                    ++srcx;
  1.3989 +                    posx -= 0x10000L;
  1.3990 +                }
  1.3991 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.3992 +            }
  1.3993 +            srcpixel = *src;
  1.3994 +            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
  1.3995 +            dstpixel = *dst;
  1.3996 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  1.3997 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.3998 +                srcR = (srcR * modulateR) / 255;
  1.3999 +                srcG = (srcG * modulateG) / 255;
  1.4000 +                srcB = (srcB * modulateB) / 255;
  1.4001 +            }
  1.4002 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.4003 +                srcA = (srcA * modulateA) / 255;
  1.4004 +            }
  1.4005 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.4006 +                /* This goes away if we ever use premultiplied alpha */
  1.4007 +                if (srcA < 255) {
  1.4008 +                    srcR = (srcR * srcA) / 255;
  1.4009 +                    srcG = (srcG * srcA) / 255;
  1.4010 +                    srcB = (srcB * srcA) / 255;
  1.4011 +                }
  1.4012 +            }
  1.4013 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.4014 +            case SDL_COPY_MASK:
  1.4015 +                if (srcA) {
  1.4016 +                    dstR = srcR;
  1.4017 +                    dstG = srcG;
  1.4018 +                    dstB = srcB;
  1.4019 +                }
  1.4020 +                break;
  1.4021 +            case SDL_COPY_BLEND:
  1.4022 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.4023 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.4024 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.4025 +                break;
  1.4026 +            case SDL_COPY_ADD:
  1.4027 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.4028 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.4029 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.4030 +                break;
  1.4031 +            case SDL_COPY_MOD:
  1.4032 +                dstR = (srcR * dstR) / 255;
  1.4033 +                dstG = (srcG * dstG) / 255;
  1.4034 +                dstB = (srcB * dstB) / 255;
  1.4035 +                break;
  1.4036 +            }
  1.4037 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  1.4038 +            *dst = dstpixel;
  1.4039 +            posx += incx;
  1.4040 +            ++dst;
  1.4041 +        }
  1.4042 +        posy += incy;
  1.4043 +        info->dst += info->dst_pitch;
  1.4044 +    }
  1.4045 +}
  1.4046 +
  1.4047 +void SDL_Blit_ABGR8888_BGR888_Scale(SDL_BlitInfo *info)
  1.4048 +{
  1.4049 +    const int flags = info->flags;
  1.4050 +    Uint32 pixel;
  1.4051 +    Uint32 R, G, B, A;
  1.4052 +    int srcy, srcx;
  1.4053 +    int posy, posx;
  1.4054 +    int incy, incx;
  1.4055 +
  1.4056 +    srcy = 0;
  1.4057 +    posy = 0;
  1.4058 +    incy = (info->src_h << 16) / info->dst_h;
  1.4059 +    incx = (info->src_w << 16) / info->dst_w;
  1.4060 +
  1.4061 +    while (info->dst_h--) {
  1.4062 +        Uint32 *src;
  1.4063 +        Uint32 *dst = (Uint32 *)info->dst;
  1.4064 +        int n = info->dst_w;
  1.4065 +        srcx = -1;
  1.4066 +        posx = 0x10000L;
  1.4067 +        while (posy >= 0x10000L) {
  1.4068 +            ++srcy;
  1.4069 +            posy -= 0x10000L;
  1.4070 +        }
  1.4071 +        while (n--) {
  1.4072 +            if (posx >= 0x10000L) {
  1.4073 +                while (posx >= 0x10000L) {
  1.4074 +                    ++srcx;
  1.4075 +                    posx -= 0x10000L;
  1.4076 +                }
  1.4077 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.4078 +            }
  1.4079 +            pixel = *src;
  1.4080 +            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
  1.4081 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  1.4082 +            *dst = pixel;
  1.4083 +            posx += incx;
  1.4084 +            ++dst;
  1.4085 +        }
  1.4086 +        posy += incy;
  1.4087 +        info->dst += info->dst_pitch;
  1.4088 +    }
  1.4089 +}
  1.4090 +
  1.4091 +void SDL_Blit_ABGR8888_BGR888_Blend(SDL_BlitInfo *info)
  1.4092 +{
  1.4093 +    const int flags = info->flags;
  1.4094 +    Uint32 srcpixel;
  1.4095 +    Uint32 srcR, srcG, srcB, srcA;
  1.4096 +    Uint32 dstpixel;
  1.4097 +    Uint32 dstR, dstG, dstB, dstA;
  1.4098 +
  1.4099 +    while (info->dst_h--) {
  1.4100 +        Uint32 *src = (Uint32 *)info->src;
  1.4101 +        Uint32 *dst = (Uint32 *)info->dst;
  1.4102 +        int n = info->dst_w;
  1.4103 +        while (n--) {
  1.4104 +            srcpixel = *src;
  1.4105 +            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
  1.4106 +            dstpixel = *dst;
  1.4107 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  1.4108 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.4109 +                /* This goes away if we ever use premultiplied alpha */
  1.4110 +                if (srcA < 255) {
  1.4111 +                    srcR = (srcR * srcA) / 255;
  1.4112 +                    srcG = (srcG * srcA) / 255;
  1.4113 +                    srcB = (srcB * srcA) / 255;
  1.4114 +                }
  1.4115 +            }
  1.4116 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.4117 +            case SDL_COPY_MASK:
  1.4118 +                if (srcA) {
  1.4119 +                    dstR = srcR;
  1.4120 +                    dstG = srcG;
  1.4121 +                    dstB = srcB;
  1.4122 +                }
  1.4123 +                break;
  1.4124 +            case SDL_COPY_BLEND:
  1.4125 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.4126 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.4127 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.4128 +                break;
  1.4129 +            case SDL_COPY_ADD:
  1.4130 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.4131 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.4132 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.4133 +                break;
  1.4134 +            case SDL_COPY_MOD:
  1.4135 +                dstR = (srcR * dstR) / 255;
  1.4136 +                dstG = (srcG * dstG) / 255;
  1.4137 +                dstB = (srcB * dstB) / 255;
  1.4138 +                break;
  1.4139 +            }
  1.4140 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  1.4141 +            *dst = dstpixel;
  1.4142 +            ++src;
  1.4143 +            ++dst;
  1.4144 +        }
  1.4145 +        info->src += info->src_pitch;
  1.4146 +        info->dst += info->dst_pitch;
  1.4147 +    }
  1.4148 +}
  1.4149 +
  1.4150 +void SDL_Blit_ABGR8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
  1.4151 +{
  1.4152 +    const int flags = info->flags;
  1.4153 +    Uint32 srcpixel;
  1.4154 +    Uint32 srcR, srcG, srcB, srcA;
  1.4155 +    Uint32 dstpixel;
  1.4156 +    Uint32 dstR, dstG, dstB, dstA;
  1.4157 +    int srcy, srcx;
  1.4158 +    int posy, posx;
  1.4159 +    int incy, incx;
  1.4160 +
  1.4161 +    srcy = 0;
  1.4162 +    posy = 0;
  1.4163 +    incy = (info->src_h << 16) / info->dst_h;
  1.4164 +    incx = (info->src_w << 16) / info->dst_w;
  1.4165 +
  1.4166 +    while (info->dst_h--) {
  1.4167 +        Uint32 *src;
  1.4168 +        Uint32 *dst = (Uint32 *)info->dst;
  1.4169 +        int n = info->dst_w;
  1.4170 +        srcx = -1;
  1.4171 +        posx = 0x10000L;
  1.4172 +        while (posy >= 0x10000L) {
  1.4173 +            ++srcy;
  1.4174 +            posy -= 0x10000L;
  1.4175 +        }
  1.4176 +        while (n--) {
  1.4177 +            if (posx >= 0x10000L) {
  1.4178 +                while (posx >= 0x10000L) {
  1.4179 +                    ++srcx;
  1.4180 +                    posx -= 0x10000L;
  1.4181 +                }
  1.4182 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.4183 +            }
  1.4184 +            srcpixel = *src;
  1.4185 +            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
  1.4186 +            dstpixel = *dst;
  1.4187 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  1.4188 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.4189 +                /* This goes away if we ever use premultiplied alpha */
  1.4190 +                if (srcA < 255) {
  1.4191 +                    srcR = (srcR * srcA) / 255;
  1.4192 +                    srcG = (srcG * srcA) / 255;
  1.4193 +                    srcB = (srcB * srcA) / 255;
  1.4194 +                }
  1.4195 +            }
  1.4196 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.4197 +            case SDL_COPY_MASK:
  1.4198 +                if (srcA) {
  1.4199 +                    dstR = srcR;
  1.4200 +                    dstG = srcG;
  1.4201 +                    dstB = srcB;
  1.4202 +                }
  1.4203 +                break;
  1.4204 +            case SDL_COPY_BLEND:
  1.4205 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.4206 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.4207 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.4208 +                break;
  1.4209 +            case SDL_COPY_ADD:
  1.4210 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.4211 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.4212 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.4213 +                break;
  1.4214 +            case SDL_COPY_MOD:
  1.4215 +                dstR = (srcR * dstR) / 255;
  1.4216 +                dstG = (srcG * dstG) / 255;
  1.4217 +                dstB = (srcB * dstB) / 255;
  1.4218 +                break;
  1.4219 +            }
  1.4220 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  1.4221 +            *dst = dstpixel;
  1.4222 +            posx += incx;
  1.4223 +            ++dst;
  1.4224 +        }
  1.4225 +        posy += incy;
  1.4226 +        info->dst += info->dst_pitch;
  1.4227 +    }
  1.4228 +}
  1.4229 +
  1.4230 +void SDL_Blit_ABGR8888_BGR888_Modulate(SDL_BlitInfo *info)
  1.4231 +{
  1.4232 +    const int flags = info->flags;
  1.4233 +    const Uint32 modulateR = info->r;
  1.4234 +    const Uint32 modulateG = info->g;
  1.4235 +    const Uint32 modulateB = info->b;
  1.4236 +    const Uint32 modulateA = info->a;
  1.4237 +    Uint32 pixel;
  1.4238 +    Uint32 R, G, B, A;
  1.4239 +
  1.4240 +    while (info->dst_h--) {
  1.4241 +        Uint32 *src = (Uint32 *)info->src;
  1.4242 +        Uint32 *dst = (Uint32 *)info->dst;
  1.4243 +        int n = info->dst_w;
  1.4244 +        while (n--) {
  1.4245 +            pixel = *src;
  1.4246 +            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
  1.4247 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.4248 +                R = (R * modulateR) / 255;
  1.4249 +                G = (G * modulateG) / 255;
  1.4250 +                B = (B * modulateB) / 255;
  1.4251 +            }
  1.4252 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.4253 +                A = (A * modulateA) / 255;
  1.4254 +            }
  1.4255 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  1.4256 +            *dst = pixel;
  1.4257 +            ++src;
  1.4258 +            ++dst;
  1.4259 +        }
  1.4260 +        info->src += info->src_pitch;
  1.4261 +        info->dst += info->dst_pitch;
  1.4262 +    }
  1.4263 +}
  1.4264 +
  1.4265 +void SDL_Blit_ABGR8888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
  1.4266 +{
  1.4267 +    const int flags = info->flags;
  1.4268 +    const Uint32 modulateR = info->r;
  1.4269 +    const Uint32 modulateG = info->g;
  1.4270 +    const Uint32 modulateB = info->b;
  1.4271 +    const Uint32 modulateA = info->a;
  1.4272 +    Uint32 pixel;
  1.4273 +    Uint32 R, G, B, A;
  1.4274 +    int srcy, srcx;
  1.4275 +    int posy, posx;
  1.4276 +    int incy, incx;
  1.4277 +
  1.4278 +    srcy = 0;
  1.4279 +    posy = 0;
  1.4280 +    incy = (info->src_h << 16) / info->dst_h;
  1.4281 +    incx = (info->src_w << 16) / info->dst_w;
  1.4282 +
  1.4283 +    while (info->dst_h--) {
  1.4284 +        Uint32 *src;
  1.4285 +        Uint32 *dst = (Uint32 *)info->dst;
  1.4286 +        int n = info->dst_w;
  1.4287 +        srcx = -1;
  1.4288 +        posx = 0x10000L;
  1.4289 +        while (posy >= 0x10000L) {
  1.4290 +            ++srcy;
  1.4291 +            posy -= 0x10000L;
  1.4292 +        }
  1.4293 +        while (n--) {
  1.4294 +            if (posx >= 0x10000L) {
  1.4295 +                while (posx >= 0x10000L) {
  1.4296 +                    ++srcx;
  1.4297 +                    posx -= 0x10000L;
  1.4298 +                }
  1.4299 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.4300 +            }
  1.4301 +            pixel = *src;
  1.4302 +            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
  1.4303 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.4304 +                R = (R * modulateR) / 255;
  1.4305 +                G = (G * modulateG) / 255;
  1.4306 +                B = (B * modulateB) / 255;
  1.4307 +            }
  1.4308 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.4309 +                A = (A * modulateA) / 255;
  1.4310 +            }
  1.4311 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  1.4312 +            *dst = pixel;
  1.4313 +            posx += incx;
  1.4314 +            ++dst;
  1.4315 +        }
  1.4316 +        posy += incy;
  1.4317 +        info->dst += info->dst_pitch;
  1.4318 +    }
  1.4319 +}
  1.4320 +
  1.4321 +void SDL_Blit_ABGR8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
  1.4322 +{
  1.4323 +    const int flags = info->flags;
  1.4324 +    const Uint32 modulateR = info->r;
  1.4325 +    const Uint32 modulateG = info->g;
  1.4326 +    const Uint32 modulateB = info->b;
  1.4327 +    const Uint32 modulateA = info->a;
  1.4328 +    Uint32 srcpixel;
  1.4329 +    Uint32 srcR, srcG, srcB, srcA;
  1.4330 +    Uint32 dstpixel;
  1.4331 +    Uint32 dstR, dstG, dstB, dstA;
  1.4332 +
  1.4333 +    while (info->dst_h--) {
  1.4334 +        Uint32 *src = (Uint32 *)info->src;
  1.4335 +        Uint32 *dst = (Uint32 *)info->dst;
  1.4336 +        int n = info->dst_w;
  1.4337 +        while (n--) {
  1.4338 +            srcpixel = *src;
  1.4339 +            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
  1.4340 +            dstpixel = *dst;
  1.4341 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  1.4342 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.4343 +                srcR = (srcR * modulateR) / 255;
  1.4344 +                srcG = (srcG * modulateG) / 255;
  1.4345 +                srcB = (srcB * modulateB) / 255;
  1.4346 +            }
  1.4347 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.4348 +                srcA = (srcA * modulateA) / 255;
  1.4349 +            }
  1.4350 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.4351 +                /* This goes away if we ever use premultiplied alpha */
  1.4352 +                if (srcA < 255) {
  1.4353 +                    srcR = (srcR * srcA) / 255;
  1.4354 +                    srcG = (srcG * srcA) / 255;
  1.4355 +                    srcB = (srcB * srcA) / 255;
  1.4356 +                }
  1.4357 +            }
  1.4358 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.4359 +            case SDL_COPY_MASK:
  1.4360 +                if (srcA) {
  1.4361 +                    dstR = srcR;
  1.4362 +                    dstG = srcG;
  1.4363 +                    dstB = srcB;
  1.4364 +                }
  1.4365 +                break;
  1.4366 +            case SDL_COPY_BLEND:
  1.4367 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.4368 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.4369 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.4370 +                break;
  1.4371 +            case SDL_COPY_ADD:
  1.4372 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.4373 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.4374 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.4375 +                break;
  1.4376 +            case SDL_COPY_MOD:
  1.4377 +                dstR = (srcR * dstR) / 255;
  1.4378 +                dstG = (srcG * dstG) / 255;
  1.4379 +                dstB = (srcB * dstB) / 255;
  1.4380 +                break;
  1.4381 +            }
  1.4382 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  1.4383 +            *dst = dstpixel;
  1.4384 +            ++src;
  1.4385 +            ++dst;
  1.4386 +        }
  1.4387 +        info->src += info->src_pitch;
  1.4388 +        info->dst += info->dst_pitch;
  1.4389 +    }
  1.4390 +}
  1.4391 +
  1.4392 +void SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
  1.4393 +{
  1.4394 +    const int flags = info->flags;
  1.4395 +    const Uint32 modulateR = info->r;
  1.4396 +    const Uint32 modulateG = info->g;
  1.4397 +    const Uint32 modulateB = info->b;
  1.4398 +    const Uint32 modulateA = info->a;
  1.4399 +    Uint32 srcpixel;
  1.4400 +    Uint32 srcR, srcG, srcB, srcA;
  1.4401 +    Uint32 dstpixel;
  1.4402 +    Uint32 dstR, dstG, dstB, dstA;
  1.4403 +    int srcy, srcx;
  1.4404 +    int posy, posx;
  1.4405 +    int incy, incx;
  1.4406 +
  1.4407 +    srcy = 0;
  1.4408 +    posy = 0;
  1.4409 +    incy = (info->src_h << 16) / info->dst_h;
  1.4410 +    incx = (info->src_w << 16) / info->dst_w;
  1.4411 +
  1.4412 +    while (info->dst_h--) {
  1.4413 +        Uint32 *src;
  1.4414 +        Uint32 *dst = (Uint32 *)info->dst;
  1.4415 +        int n = info->dst_w;
  1.4416 +        srcx = -1;
  1.4417 +        posx = 0x10000L;
  1.4418 +        while (posy >= 0x10000L) {
  1.4419 +            ++srcy;
  1.4420 +            posy -= 0x10000L;
  1.4421 +        }
  1.4422 +        while (n--) {
  1.4423 +            if (posx >= 0x10000L) {
  1.4424 +                while (posx >= 0x10000L) {
  1.4425 +                    ++srcx;
  1.4426 +                    posx -= 0x10000L;
  1.4427 +                }
  1.4428 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.4429 +            }
  1.4430 +            srcpixel = *src;
  1.4431 +            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
  1.4432 +            dstpixel = *dst;
  1.4433 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  1.4434 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.4435 +                srcR = (srcR * modulateR) / 255;
  1.4436 +                srcG = (srcG * modulateG) / 255;
  1.4437 +                srcB = (srcB * modulateB) / 255;
  1.4438 +            }
  1.4439 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.4440 +                srcA = (srcA * modulateA) / 255;
  1.4441 +            }
  1.4442 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.4443 +                /* This goes away if we ever use premultiplied alpha */
  1.4444 +                if (srcA < 255) {
  1.4445 +                    srcR = (srcR * srcA) / 255;
  1.4446 +                    srcG = (srcG * srcA) / 255;
  1.4447 +                    srcB = (srcB * srcA) / 255;
  1.4448 +                }
  1.4449 +            }
  1.4450 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.4451 +            case SDL_COPY_MASK:
  1.4452 +                if (srcA) {
  1.4453 +                    dstR = srcR;
  1.4454 +                    dstG = srcG;
  1.4455 +                    dstB = srcB;
  1.4456 +                }
  1.4457 +                break;
  1.4458 +            case SDL_COPY_BLEND:
  1.4459 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.4460 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.4461 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.4462 +                break;
  1.4463 +            case SDL_COPY_ADD:
  1.4464 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.4465 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.4466 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.4467 +                break;
  1.4468 +            case SDL_COPY_MOD:
  1.4469 +                dstR = (srcR * dstR) / 255;
  1.4470 +                dstG = (srcG * dstG) / 255;
  1.4471 +                dstB = (srcB * dstB) / 255;
  1.4472 +                break;
  1.4473 +            }
  1.4474 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  1.4475 +            *dst = dstpixel;
  1.4476 +            posx += incx;
  1.4477 +            ++dst;
  1.4478 +        }
  1.4479 +        posy += incy;
  1.4480 +        info->dst += info->dst_pitch;
  1.4481 +    }
  1.4482 +}
  1.4483 +
  1.4484 +void SDL_Blit_BGRA8888_RGB888_Scale(SDL_BlitInfo *info)
  1.4485 +{
  1.4486 +    const int flags = info->flags;
  1.4487 +    Uint32 pixel;
  1.4488 +    Uint32 R, G, B, A;
  1.4489 +    int srcy, srcx;
  1.4490 +    int posy, posx;
  1.4491 +    int incy, incx;
  1.4492 +
  1.4493 +    srcy = 0;
  1.4494 +    posy = 0;
  1.4495 +    incy = (info->src_h << 16) / info->dst_h;
  1.4496 +    incx = (info->src_w << 16) / info->dst_w;
  1.4497 +
  1.4498 +    while (info->dst_h--) {
  1.4499 +        Uint32 *src;
  1.4500 +        Uint32 *dst = (Uint32 *)info->dst;
  1.4501 +        int n = info->dst_w;
  1.4502 +        srcx = -1;
  1.4503 +        posx = 0x10000L;
  1.4504 +        while (posy >= 0x10000L) {
  1.4505 +            ++srcy;
  1.4506 +            posy -= 0x10000L;
  1.4507 +        }
  1.4508 +        while (n--) {
  1.4509 +            if (posx >= 0x10000L) {
  1.4510 +                while (posx >= 0x10000L) {
  1.4511 +                    ++srcx;
  1.4512 +                    posx -= 0x10000L;
  1.4513 +                }
  1.4514 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.4515 +            }
  1.4516 +            pixel = *src;
  1.4517 +            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  1.4518 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  1.4519 +            *dst = pixel;
  1.4520 +            posx += incx;
  1.4521 +            ++dst;
  1.4522 +        }
  1.4523 +        posy += incy;
  1.4524 +        info->dst += info->dst_pitch;
  1.4525 +    }
  1.4526 +}
  1.4527 +
  1.4528 +void SDL_Blit_BGRA8888_RGB888_Blend(SDL_BlitInfo *info)
  1.4529 +{
  1.4530 +    const int flags = info->flags;
  1.4531 +    Uint32 srcpixel;
  1.4532 +    Uint32 srcR, srcG, srcB, srcA;
  1.4533 +    Uint32 dstpixel;
  1.4534 +    Uint32 dstR, dstG, dstB, dstA;
  1.4535 +
  1.4536 +    while (info->dst_h--) {
  1.4537 +        Uint32 *src = (Uint32 *)info->src;
  1.4538 +        Uint32 *dst = (Uint32 *)info->dst;
  1.4539 +        int n = info->dst_w;
  1.4540 +        while (n--) {
  1.4541 +            srcpixel = *src;
  1.4542 +            srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  1.4543 +            dstpixel = *dst;
  1.4544 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  1.4545 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.4546 +                /* This goes away if we ever use premultiplied alpha */
  1.4547 +                if (srcA < 255) {
  1.4548 +                    srcR = (srcR * srcA) / 255;
  1.4549 +                    srcG = (srcG * srcA) / 255;
  1.4550 +                    srcB = (srcB * srcA) / 255;
  1.4551 +                }
  1.4552 +            }
  1.4553 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.4554 +            case SDL_COPY_MASK:
  1.4555 +                if (srcA) {
  1.4556 +                    dstR = srcR;
  1.4557 +                    dstG = srcG;
  1.4558 +                    dstB = srcB;
  1.4559 +                }
  1.4560 +                break;
  1.4561 +            case SDL_COPY_BLEND:
  1.4562 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.4563 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.4564 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.4565 +                break;
  1.4566 +            case SDL_COPY_ADD:
  1.4567 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.4568 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.4569 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.4570 +                break;
  1.4571 +            case SDL_COPY_MOD:
  1.4572 +                dstR = (srcR * dstR) / 255;
  1.4573 +                dstG = (srcG * dstG) / 255;
  1.4574 +                dstB = (srcB * dstB) / 255;
  1.4575 +                break;
  1.4576 +            }
  1.4577 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  1.4578 +            *dst = dstpixel;
  1.4579 +            ++src;
  1.4580 +            ++dst;
  1.4581 +        }
  1.4582 +        info->src += info->src_pitch;
  1.4583 +        info->dst += info->dst_pitch;
  1.4584 +    }
  1.4585 +}
  1.4586 +
  1.4587 +void SDL_Blit_BGRA8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
  1.4588 +{
  1.4589 +    const int flags = info->flags;
  1.4590 +    Uint32 srcpixel;
  1.4591 +    Uint32 srcR, srcG, srcB, srcA;
  1.4592 +    Uint32 dstpixel;
  1.4593 +    Uint32 dstR, dstG, dstB, dstA;
  1.4594 +    int srcy, srcx;
  1.4595 +    int posy, posx;
  1.4596 +    int incy, incx;
  1.4597 +
  1.4598 +    srcy = 0;
  1.4599 +    posy = 0;
  1.4600 +    incy = (info->src_h << 16) / info->dst_h;
  1.4601 +    incx = (info->src_w << 16) / info->dst_w;
  1.4602 +
  1.4603 +    while (info->dst_h--) {
  1.4604 +        Uint32 *src;
  1.4605 +        Uint32 *dst = (Uint32 *)info->dst;
  1.4606 +        int n = info->dst_w;
  1.4607 +        srcx = -1;
  1.4608 +        posx = 0x10000L;
  1.4609 +        while (posy >= 0x10000L) {
  1.4610 +            ++srcy;
  1.4611 +            posy -= 0x10000L;
  1.4612 +        }
  1.4613 +        while (n--) {
  1.4614 +            if (posx >= 0x10000L) {
  1.4615 +                while (posx >= 0x10000L) {
  1.4616 +                    ++srcx;
  1.4617 +                    posx -= 0x10000L;
  1.4618 +                }
  1.4619 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.4620 +            }
  1.4621 +            srcpixel = *src;
  1.4622 +            srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  1.4623 +            dstpixel = *dst;
  1.4624 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  1.4625 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.4626 +                /* This goes away if we ever use premultiplied alpha */
  1.4627 +                if (srcA < 255) {
  1.4628 +                    srcR = (srcR * srcA) / 255;
  1.4629 +                    srcG = (srcG * srcA) / 255;
  1.4630 +                    srcB = (srcB * srcA) / 255;
  1.4631 +                }
  1.4632 +            }
  1.4633 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.4634 +            case SDL_COPY_MASK:
  1.4635 +                if (srcA) {
  1.4636 +                    dstR = srcR;
  1.4637 +                    dstG = srcG;
  1.4638 +                    dstB = srcB;
  1.4639 +                }
  1.4640 +                break;
  1.4641 +            case SDL_COPY_BLEND:
  1.4642 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.4643 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.4644 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.4645 +                break;
  1.4646 +            case SDL_COPY_ADD:
  1.4647 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.4648 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.4649 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.4650 +                break;
  1.4651 +            case SDL_COPY_MOD:
  1.4652 +                dstR = (srcR * dstR) / 255;
  1.4653 +                dstG = (srcG * dstG) / 255;
  1.4654 +                dstB = (srcB * dstB) / 255;
  1.4655 +                break;
  1.4656 +            }
  1.4657 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  1.4658 +            *dst = dstpixel;
  1.4659 +            posx += incx;
  1.4660 +            ++dst;
  1.4661 +        }
  1.4662 +        posy += incy;
  1.4663 +        info->dst += info->dst_pitch;
  1.4664 +    }
  1.4665 +}
  1.4666 +
  1.4667 +void SDL_Blit_BGRA8888_RGB888_Modulate(SDL_BlitInfo *info)
  1.4668 +{
  1.4669 +    const int flags = info->flags;
  1.4670 +    const Uint32 modulateR = info->r;
  1.4671 +    const Uint32 modulateG = info->g;
  1.4672 +    const Uint32 modulateB = info->b;
  1.4673 +    const Uint32 modulateA = info->a;
  1.4674 +    Uint32 pixel;
  1.4675 +    Uint32 R, G, B, A;
  1.4676 +
  1.4677 +    while (info->dst_h--) {
  1.4678 +        Uint32 *src = (Uint32 *)info->src;
  1.4679 +        Uint32 *dst = (Uint32 *)info->dst;
  1.4680 +        int n = info->dst_w;
  1.4681 +        while (n--) {
  1.4682 +            pixel = *src;
  1.4683 +            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  1.4684 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.4685 +                R = (R * modulateR) / 255;
  1.4686 +                G = (G * modulateG) / 255;
  1.4687 +                B = (B * modulateB) / 255;
  1.4688 +            }
  1.4689 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.4690 +                A = (A * modulateA) / 255;
  1.4691 +            }
  1.4692 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  1.4693 +            *dst = pixel;
  1.4694 +            ++src;
  1.4695 +            ++dst;
  1.4696 +        }
  1.4697 +        info->src += info->src_pitch;
  1.4698 +        info->dst += info->dst_pitch;
  1.4699 +    }
  1.4700 +}
  1.4701 +
  1.4702 +void SDL_Blit_BGRA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
  1.4703 +{
  1.4704 +    const int flags = info->flags;
  1.4705 +    const Uint32 modulateR = info->r;
  1.4706 +    const Uint32 modulateG = info->g;
  1.4707 +    const Uint32 modulateB = info->b;
  1.4708 +    const Uint32 modulateA = info->a;
  1.4709 +    Uint32 pixel;
  1.4710 +    Uint32 R, G, B, A;
  1.4711 +    int srcy, srcx;
  1.4712 +    int posy, posx;
  1.4713 +    int incy, incx;
  1.4714 +
  1.4715 +    srcy = 0;
  1.4716 +    posy = 0;
  1.4717 +    incy = (info->src_h << 16) / info->dst_h;
  1.4718 +    incx = (info->src_w << 16) / info->dst_w;
  1.4719 +
  1.4720 +    while (info->dst_h--) {
  1.4721 +        Uint32 *src;
  1.4722 +        Uint32 *dst = (Uint32 *)info->dst;
  1.4723 +        int n = info->dst_w;
  1.4724 +        srcx = -1;
  1.4725 +        posx = 0x10000L;
  1.4726 +        while (posy >= 0x10000L) {
  1.4727 +            ++srcy;
  1.4728 +            posy -= 0x10000L;
  1.4729 +        }
  1.4730 +        while (n--) {
  1.4731 +            if (posx >= 0x10000L) {
  1.4732 +                while (posx >= 0x10000L) {
  1.4733 +                    ++srcx;
  1.4734 +                    posx -= 0x10000L;
  1.4735 +                }
  1.4736 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.4737 +            }
  1.4738 +            pixel = *src;
  1.4739 +            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  1.4740 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.4741 +                R = (R * modulateR) / 255;
  1.4742 +                G = (G * modulateG) / 255;
  1.4743 +                B = (B * modulateB) / 255;
  1.4744 +            }
  1.4745 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.4746 +                A = (A * modulateA) / 255;
  1.4747 +            }
  1.4748 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  1.4749 +            *dst = pixel;
  1.4750 +            posx += incx;
  1.4751 +            ++dst;
  1.4752 +        }
  1.4753 +        posy += incy;
  1.4754 +        info->dst += info->dst_pitch;
  1.4755 +    }
  1.4756 +}
  1.4757 +
  1.4758 +void SDL_Blit_BGRA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
  1.4759 +{
  1.4760 +    const int flags = info->flags;
  1.4761 +    const Uint32 modulateR = info->r;
  1.4762 +    const Uint32 modulateG = info->g;
  1.4763 +    const Uint32 modulateB = info->b;
  1.4764 +    const Uint32 modulateA = info->a;
  1.4765 +    Uint32 srcpixel;
  1.4766 +    Uint32 srcR, srcG, srcB, srcA;
  1.4767 +    Uint32 dstpixel;
  1.4768 +    Uint32 dstR, dstG, dstB, dstA;
  1.4769 +
  1.4770 +    while (info->dst_h--) {
  1.4771 +        Uint32 *src = (Uint32 *)info->src;
  1.4772 +        Uint32 *dst = (Uint32 *)info->dst;
  1.4773 +        int n = info->dst_w;
  1.4774 +        while (n--) {
  1.4775 +            srcpixel = *src;
  1.4776 +            srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  1.4777 +            dstpixel = *dst;
  1.4778 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  1.4779 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.4780 +                srcR = (srcR * modulateR) / 255;
  1.4781 +                srcG = (srcG * modulateG) / 255;
  1.4782 +                srcB = (srcB * modulateB) / 255;
  1.4783 +            }
  1.4784 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.4785 +                srcA = (srcA * modulateA) / 255;
  1.4786 +            }
  1.4787 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.4788 +                /* This goes away if we ever use premultiplied alpha */
  1.4789 +                if (srcA < 255) {
  1.4790 +                    srcR = (srcR * srcA) / 255;
  1.4791 +                    srcG = (srcG * srcA) / 255;
  1.4792 +                    srcB = (srcB * srcA) / 255;
  1.4793 +                }
  1.4794 +            }
  1.4795 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.4796 +            case SDL_COPY_MASK:
  1.4797 +                if (srcA) {
  1.4798 +                    dstR = srcR;
  1.4799 +                    dstG = srcG;
  1.4800 +                    dstB = srcB;
  1.4801 +                }
  1.4802 +                break;
  1.4803 +            case SDL_COPY_BLEND:
  1.4804 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.4805 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.4806 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.4807 +                break;
  1.4808 +            case SDL_COPY_ADD:
  1.4809 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.4810 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.4811 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.4812 +                break;
  1.4813 +            case SDL_COPY_MOD:
  1.4814 +                dstR = (srcR * dstR) / 255;
  1.4815 +                dstG = (srcG * dstG) / 255;
  1.4816 +                dstB = (srcB * dstB) / 255;
  1.4817 +                break;
  1.4818 +            }
  1.4819 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  1.4820 +            *dst = dstpixel;
  1.4821 +            ++src;
  1.4822 +            ++dst;
  1.4823 +        }
  1.4824 +        info->src += info->src_pitch;
  1.4825 +        info->dst += info->dst_pitch;
  1.4826 +    }
  1.4827 +}
  1.4828 +
  1.4829 +void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
  1.4830 +{
  1.4831 +    const int flags = info->flags;
  1.4832 +    const Uint32 modulateR = info->r;
  1.4833 +    const Uint32 modulateG = info->g;
  1.4834 +    const Uint32 modulateB = info->b;
  1.4835 +    const Uint32 modulateA = info->a;
  1.4836 +    Uint32 srcpixel;
  1.4837 +    Uint32 srcR, srcG, srcB, srcA;
  1.4838 +    Uint32 dstpixel;
  1.4839 +    Uint32 dstR, dstG, dstB, dstA;
  1.4840 +    int srcy, srcx;
  1.4841 +    int posy, posx;
  1.4842 +    int incy, incx;
  1.4843 +
  1.4844 +    srcy = 0;
  1.4845 +    posy = 0;
  1.4846 +    incy = (info->src_h << 16) / info->dst_h;
  1.4847 +    incx = (info->src_w << 16) / info->dst_w;
  1.4848 +
  1.4849 +    while (info->dst_h--) {
  1.4850 +        Uint32 *src;
  1.4851 +        Uint32 *dst = (Uint32 *)info->dst;
  1.4852 +        int n = info->dst_w;
  1.4853 +        srcx = -1;
  1.4854 +        posx = 0x10000L;
  1.4855 +        while (posy >= 0x10000L) {
  1.4856 +            ++srcy;
  1.4857 +            posy -= 0x10000L;
  1.4858 +        }
  1.4859 +        while (n--) {
  1.4860 +            if (posx >= 0x10000L) {
  1.4861 +                while (posx >= 0x10000L) {
  1.4862 +                    ++srcx;
  1.4863 +                    posx -= 0x10000L;
  1.4864 +                }
  1.4865 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.4866 +            }
  1.4867 +            srcpixel = *src;
  1.4868 +            srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  1.4869 +            dstpixel = *dst;
  1.4870 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  1.4871 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.4872 +                srcR = (srcR * modulateR) / 255;
  1.4873 +                srcG = (srcG * modulateG) / 255;
  1.4874 +                srcB = (srcB * modulateB) / 255;
  1.4875 +            }
  1.4876 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.4877 +                srcA = (srcA * modulateA) / 255;
  1.4878 +            }
  1.4879 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.4880 +                /* This goes away if we ever use premultiplied alpha */
  1.4881 +                if (srcA < 255) {
  1.4882 +                    srcR = (srcR * srcA) / 255;
  1.4883 +                    srcG = (srcG * srcA) / 255;
  1.4884 +                    srcB = (srcB * srcA) / 255;
  1.4885 +                }
  1.4886 +            }
  1.4887 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.4888 +            case SDL_COPY_MASK:
  1.4889 +                if (srcA) {
  1.4890 +                    dstR = srcR;
  1.4891 +                    dstG = srcG;
  1.4892 +                    dstB = srcB;
  1.4893 +                }
  1.4894 +                break;
  1.4895 +            case SDL_COPY_BLEND:
  1.4896 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.4897 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.4898 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.4899 +                break;
  1.4900 +            case SDL_COPY_ADD:
  1.4901 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.4902 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.4903 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.4904 +                break;
  1.4905 +            case SDL_COPY_MOD:
  1.4906 +                dstR = (srcR * dstR) / 255;
  1.4907 +                dstG = (srcG * dstG) / 255;
  1.4908 +                dstB = (srcB * dstB) / 255;
  1.4909 +                break;
  1.4910 +            }
  1.4911 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  1.4912 +            *dst = dstpixel;
  1.4913 +            posx += incx;
  1.4914 +            ++dst;
  1.4915 +        }
  1.4916 +        posy += incy;
  1.4917 +        info->dst += info->dst_pitch;
  1.4918 +    }
  1.4919 +}
  1.4920 +
  1.4921 +void SDL_Blit_BGRA8888_BGR888_Scale(SDL_BlitInfo *info)
  1.4922 +{
  1.4923 +    const int flags = info->flags;
  1.4924 +    Uint32 pixel;
  1.4925 +    Uint32 R, G, B, A;
  1.4926 +    int srcy, srcx;
  1.4927 +    int posy, posx;
  1.4928 +    int incy, incx;
  1.4929 +
  1.4930 +    srcy = 0;
  1.4931 +    posy = 0;
  1.4932 +    incy = (info->src_h << 16) / info->dst_h;
  1.4933 +    incx = (info->src_w << 16) / info->dst_w;
  1.4934 +
  1.4935 +    while (info->dst_h--) {
  1.4936 +        Uint32 *src;
  1.4937 +        Uint32 *dst = (Uint32 *)info->dst;
  1.4938 +        int n = info->dst_w;
  1.4939 +        srcx = -1;
  1.4940 +        posx = 0x10000L;
  1.4941 +        while (posy >= 0x10000L) {
  1.4942 +            ++srcy;
  1.4943 +            posy -= 0x10000L;
  1.4944 +        }
  1.4945 +        while (n--) {
  1.4946 +            if (posx >= 0x10000L) {
  1.4947 +                while (posx >= 0x10000L) {
  1.4948 +                    ++srcx;
  1.4949 +                    posx -= 0x10000L;
  1.4950 +                }
  1.4951 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.4952 +            }
  1.4953 +            pixel = *src;
  1.4954 +            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  1.4955 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  1.4956 +            *dst = pixel;
  1.4957 +            posx += incx;
  1.4958 +            ++dst;
  1.4959 +        }
  1.4960 +        posy += incy;
  1.4961 +        info->dst += info->dst_pitch;
  1.4962 +    }
  1.4963 +}
  1.4964 +
  1.4965 +void SDL_Blit_BGRA8888_BGR888_Blend(SDL_BlitInfo *info)
  1.4966 +{
  1.4967 +    const int flags = info->flags;
  1.4968 +    Uint32 srcpixel;
  1.4969 +    Uint32 srcR, srcG, srcB, srcA;
  1.4970 +    Uint32 dstpixel;
  1.4971 +    Uint32 dstR, dstG, dstB, dstA;
  1.4972 +
  1.4973 +    while (info->dst_h--) {
  1.4974 +        Uint32 *src = (Uint32 *)info->src;
  1.4975 +        Uint32 *dst = (Uint32 *)info->dst;
  1.4976 +        int n = info->dst_w;
  1.4977 +        while (n--) {
  1.4978 +            srcpixel = *src;
  1.4979 +            srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  1.4980 +            dstpixel = *dst;
  1.4981 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  1.4982 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.4983 +                /* This goes away if we ever use premultiplied alpha */
  1.4984 +                if (srcA < 255) {
  1.4985 +                    srcR = (srcR * srcA) / 255;
  1.4986 +                    srcG = (srcG * srcA) / 255;
  1.4987 +                    srcB = (srcB * srcA) / 255;
  1.4988 +                }
  1.4989 +            }
  1.4990 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.4991 +            case SDL_COPY_MASK:
  1.4992 +                if (srcA) {
  1.4993 +                    dstR = srcR;
  1.4994 +                    dstG = srcG;
  1.4995 +                    dstB = srcB;
  1.4996 +                }
  1.4997 +                break;
  1.4998 +            case SDL_COPY_BLEND:
  1.4999 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.5000 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.5001 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.5002 +                break;
  1.5003 +            case SDL_COPY_ADD:
  1.5004 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.5005 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.5006 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.5007 +                break;
  1.5008 +            case SDL_COPY_MOD:
  1.5009 +                dstR = (srcR * dstR) / 255;
  1.5010 +                dstG = (srcG * dstG) / 255;
  1.5011 +                dstB = (srcB * dstB) / 255;
  1.5012 +                break;
  1.5013 +            }
  1.5014 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  1.5015 +            *dst = dstpixel;
  1.5016 +            ++src;
  1.5017 +            ++dst;
  1.5018 +        }
  1.5019 +        info->src += info->src_pitch;
  1.5020 +        info->dst += info->dst_pitch;
  1.5021 +    }
  1.5022 +}
  1.5023 +
  1.5024 +void SDL_Blit_BGRA8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
  1.5025 +{
  1.5026 +    const int flags = info->flags;
  1.5027 +    Uint32 srcpixel;
  1.5028 +    Uint32 srcR, srcG, srcB, srcA;
  1.5029 +    Uint32 dstpixel;
  1.5030 +    Uint32 dstR, dstG, dstB, dstA;
  1.5031 +    int srcy, srcx;
  1.5032 +    int posy, posx;
  1.5033 +    int incy, incx;
  1.5034 +
  1.5035 +    srcy = 0;
  1.5036 +    posy = 0;
  1.5037 +    incy = (info->src_h << 16) / info->dst_h;
  1.5038 +    incx = (info->src_w << 16) / info->dst_w;
  1.5039 +
  1.5040 +    while (info->dst_h--) {
  1.5041 +        Uint32 *src;
  1.5042 +        Uint32 *dst = (Uint32 *)info->dst;
  1.5043 +        int n = info->dst_w;
  1.5044 +        srcx = -1;
  1.5045 +        posx = 0x10000L;
  1.5046 +        while (posy >= 0x10000L) {
  1.5047 +            ++srcy;
  1.5048 +            posy -= 0x10000L;
  1.5049 +        }
  1.5050 +        while (n--) {
  1.5051 +            if (posx >= 0x10000L) {
  1.5052 +                while (posx >= 0x10000L) {
  1.5053 +                    ++srcx;
  1.5054 +                    posx -= 0x10000L;
  1.5055 +                }
  1.5056 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.5057 +            }
  1.5058 +            srcpixel = *src;
  1.5059 +            srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  1.5060 +            dstpixel = *dst;
  1.5061 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  1.5062 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.5063 +                /* This goes away if we ever use premultiplied alpha */
  1.5064 +                if (srcA < 255) {
  1.5065 +                    srcR = (srcR * srcA) / 255;
  1.5066 +                    srcG = (srcG * srcA) / 255;
  1.5067 +                    srcB = (srcB * srcA) / 255;
  1.5068 +                }
  1.5069 +            }
  1.5070 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.5071 +            case SDL_COPY_MASK:
  1.5072 +                if (srcA) {
  1.5073 +                    dstR = srcR;
  1.5074 +                    dstG = srcG;
  1.5075 +                    dstB = srcB;
  1.5076 +                }
  1.5077 +                break;
  1.5078 +            case SDL_COPY_BLEND:
  1.5079 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.5080 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.5081 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.5082 +                break;
  1.5083 +            case SDL_COPY_ADD:
  1.5084 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.5085 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.5086 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.5087 +                break;
  1.5088 +            case SDL_COPY_MOD:
  1.5089 +                dstR = (srcR * dstR) / 255;
  1.5090 +                dstG = (srcG * dstG) / 255;
  1.5091 +                dstB = (srcB * dstB) / 255;
  1.5092 +                break;
  1.5093 +            }
  1.5094 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  1.5095 +            *dst = dstpixel;
  1.5096 +            posx += incx;
  1.5097 +            ++dst;
  1.5098 +        }
  1.5099 +        posy += incy;
  1.5100 +        info->dst += info->dst_pitch;
  1.5101 +    }
  1.5102 +}
  1.5103 +
  1.5104 +void SDL_Blit_BGRA8888_BGR888_Modulate(SDL_BlitInfo *info)
  1.5105 +{
  1.5106 +    const int flags = info->flags;
  1.5107 +    const Uint32 modulateR = info->r;
  1.5108 +    const Uint32 modulateG = info->g;
  1.5109 +    const Uint32 modulateB = info->b;
  1.5110 +    const Uint32 modulateA = info->a;
  1.5111 +    Uint32 pixel;
  1.5112 +    Uint32 R, G, B, A;
  1.5113 +
  1.5114 +    while (info->dst_h--) {
  1.5115 +        Uint32 *src = (Uint32 *)info->src;
  1.5116 +        Uint32 *dst = (Uint32 *)info->dst;
  1.5117 +        int n = info->dst_w;
  1.5118 +        while (n--) {
  1.5119 +            pixel = *src;
  1.5120 +            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  1.5121 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.5122 +                R = (R * modulateR) / 255;
  1.5123 +                G = (G * modulateG) / 255;
  1.5124 +                B = (B * modulateB) / 255;
  1.5125 +            }
  1.5126 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.5127 +                A = (A * modulateA) / 255;
  1.5128 +            }
  1.5129 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  1.5130 +            *dst = pixel;
  1.5131 +            ++src;
  1.5132 +            ++dst;
  1.5133 +        }
  1.5134 +        info->src += info->src_pitch;
  1.5135 +        info->dst += info->dst_pitch;
  1.5136 +    }
  1.5137 +}
  1.5138 +
  1.5139 +void SDL_Blit_BGRA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
  1.5140 +{
  1.5141 +    const int flags = info->flags;
  1.5142 +    const Uint32 modulateR = info->r;
  1.5143 +    const Uint32 modulateG = info->g;
  1.5144 +    const Uint32 modulateB = info->b;
  1.5145 +    const Uint32 modulateA = info->a;
  1.5146 +    Uint32 pixel;
  1.5147 +    Uint32 R, G, B, A;
  1.5148 +    int srcy, srcx;
  1.5149 +    int posy, posx;
  1.5150 +    int incy, incx;
  1.5151 +
  1.5152 +    srcy = 0;
  1.5153 +    posy = 0;
  1.5154 +    incy = (info->src_h << 16) / info->dst_h;
  1.5155 +    incx = (info->src_w << 16) / info->dst_w;
  1.5156 +
  1.5157 +    while (info->dst_h--) {
  1.5158 +        Uint32 *src;
  1.5159 +        Uint32 *dst = (Uint32 *)info->dst;
  1.5160 +        int n = info->dst_w;
  1.5161 +        srcx = -1;
  1.5162 +        posx = 0x10000L;
  1.5163 +        while (posy >= 0x10000L) {
  1.5164 +            ++srcy;
  1.5165 +            posy -= 0x10000L;
  1.5166 +        }
  1.5167 +        while (n--) {
  1.5168 +            if (posx >= 0x10000L) {
  1.5169 +                while (posx >= 0x10000L) {
  1.5170 +                    ++srcx;
  1.5171 +                    posx -= 0x10000L;
  1.5172 +                }
  1.5173 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.5174 +            }
  1.5175 +            pixel = *src;
  1.5176 +            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  1.5177 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.5178 +                R = (R * modulateR) / 255;
  1.5179 +                G = (G * modulateG) / 255;
  1.5180 +                B = (B * modulateB) / 255;
  1.5181 +            }
  1.5182 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.5183 +                A = (A * modulateA) / 255;
  1.5184 +            }
  1.5185 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  1.5186 +            *dst = pixel;
  1.5187 +            posx += incx;
  1.5188 +            ++dst;
  1.5189 +        }
  1.5190 +        posy += incy;
  1.5191 +        info->dst += info->dst_pitch;
  1.5192 +    }
  1.5193 +}
  1.5194 +
  1.5195 +void SDL_Blit_BGRA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
  1.5196 +{
  1.5197 +    const int flags = info->flags;
  1.5198 +    const Uint32 modulateR = info->r;
  1.5199 +    const Uint32 modulateG = info->g;
  1.5200 +    const Uint32 modulateB = info->b;
  1.5201 +    const Uint32 modulateA = info->a;
  1.5202 +    Uint32 srcpixel;
  1.5203 +    Uint32 srcR, srcG, srcB, srcA;
  1.5204 +    Uint32 dstpixel;
  1.5205 +    Uint32 dstR, dstG, dstB, dstA;
  1.5206 +
  1.5207 +    while (info->dst_h--) {
  1.5208 +        Uint32 *src = (Uint32 *)info->src;
  1.5209 +        Uint32 *dst = (Uint32 *)info->dst;
  1.5210 +        int n = info->dst_w;
  1.5211 +        while (n--) {
  1.5212 +            srcpixel = *src;
  1.5213 +            srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  1.5214 +            dstpixel = *dst;
  1.5215 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  1.5216 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.5217 +                srcR = (srcR * modulateR) / 255;
  1.5218 +                srcG = (srcG * modulateG) / 255;
  1.5219 +                srcB = (srcB * modulateB) / 255;
  1.5220 +            }
  1.5221 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.5222 +                srcA = (srcA * modulateA) / 255;
  1.5223 +            }
  1.5224 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.5225 +                /* This goes away if we ever use premultiplied alpha */
  1.5226 +                if (srcA < 255) {
  1.5227 +                    srcR = (srcR * srcA) / 255;
  1.5228 +                    srcG = (srcG * srcA) / 255;
  1.5229 +                    srcB = (srcB * srcA) / 255;
  1.5230 +                }
  1.5231 +            }
  1.5232 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.5233 +            case SDL_COPY_MASK:
  1.5234 +                if (srcA) {
  1.5235 +                    dstR = srcR;
  1.5236 +                    dstG = srcG;
  1.5237 +                    dstB = srcB;
  1.5238 +                }
  1.5239 +                break;
  1.5240 +            case SDL_COPY_BLEND:
  1.5241 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.5242 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.5243 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.5244 +                break;
  1.5245 +            case SDL_COPY_ADD:
  1.5246 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.5247 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.5248 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.5249 +                break;
  1.5250 +            case SDL_COPY_MOD:
  1.5251 +                dstR = (srcR * dstR) / 255;
  1.5252 +                dstG = (srcG * dstG) / 255;
  1.5253 +                dstB = (srcB * dstB) / 255;
  1.5254 +                break;
  1.5255 +            }
  1.5256 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  1.5257 +            *dst = dstpixel;
  1.5258 +            ++src;
  1.5259 +            ++dst;
  1.5260 +        }
  1.5261 +        info->src += info->src_pitch;
  1.5262 +        info->dst += info->dst_pitch;
  1.5263 +    }
  1.5264 +}
  1.5265 +
  1.5266 +void SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
  1.5267 +{
  1.5268 +    const int flags = info->flags;
  1.5269 +    const Uint32 modulateR = info->r;
  1.5270 +    const Uint32 modulateG = info->g;
  1.5271 +    const Uint32 modulateB = info->b;
  1.5272 +    const Uint32 modulateA = info->a;
  1.5273 +    Uint32 srcpixel;
  1.5274 +    Uint32 srcR, srcG, srcB, srcA;
  1.5275 +    Uint32 dstpixel;
  1.5276 +    Uint32 dstR, dstG, dstB, dstA;
  1.5277 +    int srcy, srcx;
  1.5278 +    int posy, posx;
  1.5279 +    int incy, incx;
  1.5280 +
  1.5281 +    srcy = 0;
  1.5282 +    posy = 0;
  1.5283 +    incy = (info->src_h << 16) / info->dst_h;
  1.5284 +    incx = (info->src_w << 16) / info->dst_w;
  1.5285 +
  1.5286 +    while (info->dst_h--) {
  1.5287 +        Uint32 *src;
  1.5288 +        Uint32 *dst = (Uint32 *)info->dst;
  1.5289 +        int n = info->dst_w;
  1.5290 +        srcx = -1;
  1.5291 +        posx = 0x10000L;
  1.5292 +        while (posy >= 0x10000L) {
  1.5293 +            ++srcy;
  1.5294 +            posy -= 0x10000L;
  1.5295 +        }
  1.5296 +        while (n--) {
  1.5297 +            if (posx >= 0x10000L) {
  1.5298 +                while (posx >= 0x10000L) {
  1.5299 +                    ++srcx;
  1.5300 +                    posx -= 0x10000L;
  1.5301 +                }
  1.5302 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  1.5303 +            }
  1.5304 +            srcpixel = *src;
  1.5305 +            srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  1.5306 +            dstpixel = *dst;
  1.5307 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  1.5308 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  1.5309 +                srcR = (srcR * modulateR) / 255;
  1.5310 +                srcG = (srcG * modulateG) / 255;
  1.5311 +                srcB = (srcB * modulateB) / 255;
  1.5312 +            }
  1.5313 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  1.5314 +                srcA = (srcA * modulateA) / 255;
  1.5315 +            }
  1.5316 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  1.5317 +                /* This goes away if we ever use premultiplied alpha */
  1.5318 +                if (srcA < 255) {
  1.5319 +                    srcR = (srcR * srcA) / 255;
  1.5320 +                    srcG = (srcG * srcA) / 255;
  1.5321 +                    srcB = (srcB * srcA) / 255;
  1.5322 +                }
  1.5323 +            }
  1.5324 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  1.5325 +            case SDL_COPY_MASK:
  1.5326 +                if (srcA) {
  1.5327 +                    dstR = srcR;
  1.5328 +                    dstG = srcG;
  1.5329 +                    dstB = srcB;
  1.5330 +                }
  1.5331 +                break;
  1.5332 +            case SDL_COPY_BLEND:
  1.5333 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  1.5334 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  1.5335 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  1.5336 +                break;
  1.5337 +            case SDL_COPY_ADD:
  1.5338 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  1.5339 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  1.5340 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  1.5341 +                break;
  1.5342 +            case SDL_COPY_MOD:
  1.5343 +                dstR = (srcR * dstR) / 255;
  1.5344 +                dstG = (srcG * dstG) / 255;
  1.5345 +                dstB = (srcB * dstB) / 255;
  1.5346 +                break;
  1.5347 +            }
  1.5348 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  1.5349 +            *dst = dstpixel;
  1.5350 +            posx += incx;
  1.5351 +            ++dst;
  1.5352 +        }
  1.5353 +        posy += incy;
  1.5354 +        info->dst += info->dst_pitch;
  1.5355 +    }
  1.5356 +}
  1.5357 +
  1.5358 +/* *INDENT-ON* */
  1.5359 +
  1.5360 +/* vi: set ts=4 sw=4 expandtab: */