Mercurial > sdl-ios-xcode
annotate src/video/SDL_blit_slow.c @ 3097:0d12e8f1de3c
Date: Thu, 05 Feb 2009 18:07:35 +0100
From: Stefan Klug
Subject: [SDL] SDL 1.3 WinCE backend
as promised, I've started to work on the WinCE backend of SDL 1.3
I've modified the win32 video backend and the gdi renderer, to work
properly in WinCE.
The results till now are great, but there is still some work to do.
Attached are two patches with my changes.
I would be happy if someone could review and propably commit them.
The first one (configure.in.patch) should be straight forward without
any side effects.
The second one does the necessary changes to the win32 backend. I was
really unhappy to start slicing this shiny new backend with
#ifdef/#endif but I saw no other option.
The most problematic issues are:
- WinCe has no GetDIBits, so its practically impossible to fill a
BITMAPINFO with correct values. I therefore removed the bmi member from
the GDI_RenderData in SDL_gdirender.c to prevent usage of a not or not
properly initialized bmi.
- In SDL_win32window.c I exchanged some ASCII function by their general
counterparts, (In CE only the Unicode versions are available). I don't
know if this has a negative effect when running in win32
Cheers
Stefan
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 23 Mar 2009 05:35:21 +0000 |
parents | 99210400e8b9 |
children | c5fe76962106 |
rev | line source |
---|---|
2256
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
2859 | 3 Copyright (C) 1997-2009 Sam Lantinga |
2256
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 #include "SDL_config.h" |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 #include "SDL_video.h" |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 #include "SDL_blit.h" |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 /* The ONE TRUE BLITTER |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 * This puppy has to handle all the unoptimized cases - yes, it's slow. |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 */ |
2824
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
30 void |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
31 SDL_Blit_Slow(SDL_BlitInfo * info) |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
32 { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
33 const int flags = info->flags; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
34 const Uint32 modulateR = info->r; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
35 const Uint32 modulateG = info->g; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
36 const Uint32 modulateB = info->b; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
37 const Uint32 modulateA = info->a; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
38 Uint32 srcpixel; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
39 Uint32 srcR, srcG, srcB, srcA; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
40 Uint32 dstpixel; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
41 Uint32 dstR, dstG, dstB, dstA; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
42 int srcy, srcx; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
43 int posy, posx; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
44 int incy, incx; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
45 SDL_PixelFormat *src_fmt = info->src_fmt; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
46 SDL_PixelFormat *dst_fmt = info->dst_fmt; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
47 int srcbpp = src_fmt->BytesPerPixel; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
48 int dstbpp = dst_fmt->BytesPerPixel; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
49 |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
50 srcy = 0; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
51 posy = 0; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
52 incy = (info->src_h << 16) / info->dst_h; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
53 incx = (info->src_w << 16) / info->dst_w; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
54 |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
55 while (info->dst_h--) { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
56 Uint8 *src; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
57 Uint8 *dst = (Uint8 *) info->dst; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
58 int n = info->dst_w; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
59 srcx = -1; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
60 posx = 0x10000L; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
61 while (posy >= 0x10000L) { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
62 ++srcy; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
63 posy -= 0x10000L; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
64 } |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
65 while (n--) { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
66 if (posx >= 0x10000L) { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
67 while (posx >= 0x10000L) { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
68 ++srcx; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
69 posx -= 0x10000L; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
70 } |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
71 src = |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
72 (info->src + (srcy * info->src_pitch) + (srcx * srcbpp)); |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
73 } |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
74 if (src_fmt->Amask) { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
75 DISEMBLE_RGBA(src, srcbpp, src_fmt, srcpixel, srcR, srcG, |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
76 srcB, srcA); |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
77 } else { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
78 DISEMBLE_RGB(src, srcbpp, src_fmt, srcpixel, srcR, srcG, |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
79 srcB); |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
80 srcA = 0xFF; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
81 } |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
82 if (flags & SDL_COPY_COLORKEY) { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
83 /* srcpixel isn't set for 24 bpp */ |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
84 if (srcbpp == 24) { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
85 srcpixel = (srcR << src_fmt->Rshift) | |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
86 (srcG << src_fmt->Gshift) | (srcB << src_fmt->Bshift); |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
87 } |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
88 if (srcpixel == info->colorkey) { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
89 posx += incx; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
90 dst += dstbpp; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
91 continue; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
92 } |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
93 } |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
94 if (dst_fmt->Amask) { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
95 DISEMBLE_RGBA(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
96 dstB, dstA); |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
97 } else { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
98 DISEMBLE_RGB(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
99 dstB); |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
100 dstA = 0xFF; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
101 } |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
102 |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
103 if (flags & SDL_COPY_MODULATE_COLOR) { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
104 srcR = (srcR * modulateR) / 255; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
105 srcG = (srcG * modulateG) / 255; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
106 srcB = (srcB * modulateB) / 255; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
107 } |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
108 if (flags & SDL_COPY_MODULATE_ALPHA) { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
109 srcA = (srcA * modulateA) / 255; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
110 } |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
111 if (flags & (SDL_COPY_BLEND | SDL_COPY_ADD)) { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
112 /* This goes away if we ever use premultiplied alpha */ |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
113 if (srcA < 255) { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
114 srcR = (srcR * srcA) / 255; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
115 srcG = (srcG * srcA) / 255; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
116 srcB = (srcB * srcA) / 255; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
117 } |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
118 } |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
119 switch (flags & |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
120 (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
121 SDL_COPY_MOD)) { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
122 case 0: |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
123 dstR = srcR; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
124 dstG = srcG; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
125 dstB = srcB; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
126 dstA = srcA; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
127 break; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
128 case SDL_COPY_MASK: |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
129 if (srcA) { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
130 dstR = srcR; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
131 dstG = srcG; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
132 dstB = srcB; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
133 } |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
134 break; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
135 case SDL_COPY_BLEND: |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
136 dstR = srcR + ((255 - srcA) * dstR) / 255; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
137 dstG = srcG + ((255 - srcA) * dstG) / 255; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
138 dstB = srcB + ((255 - srcA) * dstB) / 255; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
139 break; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
140 case SDL_COPY_ADD: |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
141 dstR = srcR + dstR; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
142 if (dstR > 255) |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
143 dstR = 255; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
144 dstG = srcG + dstG; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
145 if (dstG > 255) |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
146 dstG = 255; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
147 dstB = srcB + dstB; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
148 if (dstB > 255) |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
149 dstB = 255; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
150 break; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
151 case SDL_COPY_MOD: |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
152 dstR = (srcR * dstR) / 255; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
153 dstG = (srcG * dstG) / 255; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
154 dstB = (srcB * dstB) / 255; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
155 break; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
156 } |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
157 if (dst_fmt->Amask) { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
158 ASSEMBLE_RGBA(dst, dstbpp, dst_fmt, dstR, dstG, dstB, dstA); |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
159 } else { |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
160 ASSEMBLE_RGB(dst, dstbpp, dst_fmt, dstR, dstG, dstB); |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
161 } |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
162 posx += incx; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
163 dst += dstbpp; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
164 } |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
165 posy += incy; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
166 info->dst += info->dst_pitch; |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
167 } |
4dba7aa7ea77
Added slow but complete blit fallback
Sam Lantinga <slouken@libsdl.org>
parents:
2256
diff
changeset
|
168 } |
2256
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 |
e893d24ad8db
Getting ready to add slow blitters. Everyone will love me. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 /* vi: set ts=4 sw=4 expandtab: */ |