Mercurial > sdl-ios-xcode
comparison src/video/SDL_blit_slow.c @ 5143:e743b9c3f6d6
Making the API simpler, the blend modes are "none, blend, add" and are supported by all renderers.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 31 Jan 2011 23:23:57 -0800 |
parents | 791b3256fb22 |
children | d976b67150c5 |
comparison
equal
deleted
inserted
replaced
5142:57851a238c8f | 5143:e743b9c3f6d6 |
---|---|
115 srcR = (srcR * srcA) / 255; | 115 srcR = (srcR * srcA) / 255; |
116 srcG = (srcG * srcA) / 255; | 116 srcG = (srcG * srcA) / 255; |
117 srcB = (srcB * srcA) / 255; | 117 srcB = (srcB * srcA) / 255; |
118 } | 118 } |
119 } | 119 } |
120 switch (flags & | 120 switch (flags & (SDL_COPY_BLEND | SDL_COPY_ADD)) { |
121 (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | | |
122 SDL_COPY_MOD)) { | |
123 case 0: | 121 case 0: |
124 dstR = srcR; | 122 dstR = srcR; |
125 dstG = srcG; | 123 dstG = srcG; |
126 dstB = srcB; | 124 dstB = srcB; |
127 dstA = srcA; | 125 dstA = srcA; |
128 break; | |
129 case SDL_COPY_MASK: | |
130 if (srcA) { | |
131 dstR = srcR; | |
132 dstG = srcG; | |
133 dstB = srcB; | |
134 } | |
135 break; | 126 break; |
136 case SDL_COPY_BLEND: | 127 case SDL_COPY_BLEND: |
137 dstR = srcR + ((255 - srcA) * dstR) / 255; | 128 dstR = srcR + ((255 - srcA) * dstR) / 255; |
138 dstG = srcG + ((255 - srcA) * dstG) / 255; | 129 dstG = srcG + ((255 - srcA) * dstG) / 255; |
139 dstB = srcB + ((255 - srcA) * dstB) / 255; | 130 dstB = srcB + ((255 - srcA) * dstB) / 255; |
147 dstG = 255; | 138 dstG = 255; |
148 dstB = srcB + dstB; | 139 dstB = srcB + dstB; |
149 if (dstB > 255) | 140 if (dstB > 255) |
150 dstB = 255; | 141 dstB = 255; |
151 break; | 142 break; |
152 case SDL_COPY_MOD: | |
153 dstR = (srcR * dstR) / 255; | |
154 dstG = (srcG * dstG) / 255; | |
155 dstB = (srcB * dstB) / 255; | |
156 break; | |
157 } | 143 } |
158 if (dst_fmt->Amask) { | 144 if (dst_fmt->Amask) { |
159 ASSEMBLE_RGBA(dst, dstbpp, dst_fmt, dstR, dstG, dstB, dstA); | 145 ASSEMBLE_RGBA(dst, dstbpp, dst_fmt, dstR, dstG, dstB, dstA); |
160 } else { | 146 } else { |
161 ASSEMBLE_RGB(dst, dstbpp, dst_fmt, dstR, dstG, dstB); | 147 ASSEMBLE_RGB(dst, dstbpp, dst_fmt, dstR, dstG, dstB); |