Skip to content

Commit f0e8cc4

Browse files
committed
Adjust dispatch
1 parent 0f0b9ef commit f0e8cc4

File tree

1 file changed

+33
-31
lines changed

1 file changed

+33
-31
lines changed

src_c/alphablit.c

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -219,46 +219,48 @@ SoftBlitPyGame(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst,
219219
src->format->Rmask == dst->format->Rmask &&
220220
src->format->Gmask == dst->format->Gmask &&
221221
src->format->Bmask == dst->format->Bmask) {
222-
/* If our source and destination are the same ARGB 32bit
223-
format we can use SSE2/NEON/AVX2 to speed up the blend */
222+
/* If our source and destination are the same ARGB
223+
32bit format we can use SSE2/NEON/AVX2 to speed
224+
up the blend */
225+
if (pg_has_avx2() && (src != dst)) {
226+
if (info.src_blanket_alpha != 255) {
227+
alphablit_alpha_avx2_argb_surf_alpha(
228+
&info);
229+
}
230+
else if (SDL_ISPIXELFORMAT_ALPHA(
231+
dst->format->format) &&
232+
info.dst_blend !=
233+
SDL_BLENDMODE_NONE) {
234+
alphablit_alpha_avx2_argb_no_surf_alpha(
235+
&info);
236+
}
237+
else {
238+
alphablit_alpha_avx2_argb_no_surf_alpha_opaque_dst(
239+
&info);
240+
}
241+
break;
242+
}
224243
#if PG_ENABLE_SSE_NEON
225244
if ((pg_HasSSE_NEON()) && (src != dst)) {
226245
if (info.src_blanket_alpha != 255) {
227-
if (pg_has_avx2()) {
228-
alphablit_alpha_avx2_argb_surf_alpha(
229-
&info);
230-
}
231-
else {
232-
alphablit_alpha_sse2_argb_surf_alpha(
233-
&info);
234-
}
246+
alphablit_alpha_sse2_argb_surf_alpha(
247+
&info);
248+
}
249+
else if (SDL_ISPIXELFORMAT_ALPHA(
250+
dst->format->format) &&
251+
info.dst_blend !=
252+
SDL_BLENDMODE_NONE) {
253+
alphablit_alpha_sse2_argb_no_surf_alpha(
254+
&info);
235255
}
236256
else {
237-
if (SDL_ISPIXELFORMAT_ALPHA(
238-
dst->format->format) &&
239-
info.dst_blend != SDL_BLENDMODE_NONE) {
240-
if (pg_has_avx2()) {
241-
alphablit_alpha_avx2_argb_no_surf_alpha(
242-
&info);
243-
}
244-
else {
245-
alphablit_alpha_sse2_argb_no_surf_alpha(
246-
&info);
247-
}
248-
}
249-
else if (pg_has_avx2()) {
250-
alphablit_alpha_avx2_argb_no_surf_alpha_opaque_dst(
251-
&info);
252-
}
253-
else {
254-
alphablit_alpha_sse2_argb_no_surf_alpha_opaque_dst(
255-
&info);
256-
}
257+
alphablit_alpha_sse2_argb_no_surf_alpha_opaque_dst(
258+
&info);
257259
}
258260
break;
259261
}
260-
#endif /* PG_ENABLE_SSE_NEON */
261262
}
263+
#endif /* PG_ENABLE_SSE_NEON */
262264
#endif /* SDL_BYTEORDER == SDL_LIL_ENDIAN */
263265
#endif /* __EMSCRIPTEN__ */
264266
alphablit_alpha(&info);

0 commit comments

Comments
 (0)