Anonymous avatar Anonymous committed 87d293d

Documentation updates.
Simplified blit/blend algorithm macros.
Added OpenMP support to alpha blit routines.
Minor fixes in sdl.wm.set_icon() and openal.CaptureDevice.get_samples()

Comments (0)

Files changed (29)

 * Add palette color support to sdlext.transform (trunk rev. 2242).
 * Speed up blits using fast lookup tables for 8bpp to 8bpp.
 * add pgcompat.h to *mod.h internal headers.
+* SDL_mixer: channel groups.
+* SDL_mixer: Mix_SetMusicCMD.
+* SDL_mixer: finishing hooks.
 
 Things to WRAP:
 ===============
 built. First of all, the source packages are required as the binary packages
 will be built using them. ::
 
-    make release
+  make release
 
 .. note::
 

doc/capi/base.rst

 In addition to the types, a set of helpful macros was established, which are
 used heavily and should be relied on wherever possible.
 
-.. cfunction:: PRAGMA(q)
+.. cmacro:: PRAGMA(q)
 
   #pragma handler for usage within C macros. ::
 
   which in turn will be expanded to the default #pragma directive for
   the compiler.
 
-.. cfunction:: MIN(q,v)
+.. cmacro:: MIN(q,v)
 
   Gets the smaller of two values. The own implementation will only be used,
   if no system-specific one was found.
 
-.. cfunction:: MAX(q,v)
+.. cmacro:: MAX(q,v)
 
   Gets the larger of two values. The own implementation will only be used,
   if no system-specific one was found.
 
-.. cfunction:: ABS(q)
+.. cmacro:: ABS(q)
 
   Gets the absolute value. The own implementation will be only used,
   if no system-specific one was found.
 
-.. cfunction:: trunc(q)
+.. cmacro:: trunc(q)
 
   Truncates a floating point value. The own implementation will only be used,
   if no system-specific one was found.
 
-.. cfunction:: round(q)
+.. cmacro:: round(q)
 
   Rounds a floating point value to the nearest integer. The own implementation
   will only be used, if no system-specific one was found.
 
-.. cfunction:: CLAMP(q,low,high)
+.. cmacro:: CLAMP(q,low,high)
   
   Checks, whether *q* is within the boundaries of *low* and *high* and returns
   it. If *q* is not within the boundaries, either *low* or *high* will be
   The pi constant with 31 digits. The own definition will only be used, if no
   system-specific one was found.
 
-.. cfunction:: DEG2RAD(a)
+.. cmacro:: DEG2RAD(q)
 
   Converts degrees to radians. The own implementation will only be used, if no
   system-specific one was found.
 
-.. cfunction:: RAD2DEG(a)
+.. cmacro:: RAD2DEG(q)
 
   Converts radians to degrees. The own implementation will only be used, if no
   system-specific one was found.
 
-.. cfunction:: ARGB_2_RGBA(a)
+.. cmacro:: ARGB_2_RGBA(q)
 
   Converts a 32-bit unsigned integer value from an 0xAARRGGBB layout to
   a 32-bit unsigned integer value using an 0xRRGGBBAA layout.
 
-.. cfunction:: RGBA_2_ARGB(a)
+.. cmacro:: RGBA_2_ARGB(q)
 
   Converts a 32-bit unsigned integer value from an 0xRRGGBBAA layout to
   a 32-bit unsigned integer value using an 0xAARRGGBB layout.
 
-.. cfunction:: ADD_LIMIT(q,v,lower,upper)
+.. cmacro:: ADD_LIMIT(q,v,lower,upper)
                SUB_LIMIT(q,v,lower,upper)
 
    Adds and subtracts two values, but guarantees that the result will not be 
    smaller or larger than the *lower* and *upper* limits.
 
-.. cfunction:: INT_ADD_LIMIT(q,v)
+.. cmacro:: INT_ADD_LIMIT(q,v)
                INT_SUB_LIMIT(q,v)
                INT16_ADD_LIMIT(q,v)
                INT16_SUB_LIMIT(q,v)
    Adds and subtracts two integer values, but guarantees that the result will
    not be smaller or larger than the *INT_MIN* and *INT_MAX* limits.
 
-.. cfunction:: UINT_ADD_LIMIT(q,v)
+.. cmacro:: UINT_ADD_LIMIT(q,v)
                UINT_SUB_LIMIT(q,v)
                UINT16_ADD_LIMIT(q,v)
                UINT16_SUB_LIMIT(q,v)
    Adds and subtracts two unsigned integer values, but guarantees that the
    result will not be smaller or larger than zero and *UINT_MAX*.
 
-.. cfunction:: LONG_ADD_LIMIT(q,v)
+.. cmacro:: LONG_ADD_LIMIT(q,v)
                LONG_SUB_LIMIT(q,v)
                INT32_ADD_LIMIT(q,v)
                INT32_SUB_LIMIT(q,v)
    Adds and subtracts two long integer values, but guarantees that the result
    will not be smaller or larger than the *LONG_MIN* and *LONG_MAX* limits.
 
-.. cfunction:: ULONG_ADD_LIMIT(q,v)
+.. cmacro:: ULONG_ADD_LIMIT(q,v)
                ULONG_SUB_LIMIT(q,v)
                UINT32_ADD_LIMIT(q,v)
                UINT32_SUB_LIMIT(q,v)
    Adds and subtracts two unsigned long integer values, but guarantees that the
    result will not be smaller or larger than zero and *ULONG_MAX*.
 
-.. cfunction:: DBL_ADD_LIMIT(q,v)
+.. cmacro:: DBL_ADD_LIMIT(q,v)
                DBL_SUB_LIMIT(q,v)
 
    Adds and subtracts two floating point values, but guarantees that the result
    will not be smaller or larger than the *DBL_MIN* and *DBL_MAX* limits.
 
-.. cfunction:: INT_ADD_UINT_LIMIT(q,v,t)
+.. cmacro:: INT_ADD_UINT_LIMIT(q,v,t)
                INT_SUB_UINT_LIMIT(q,v,t)
                INT16_ADD_UINT16_LIMIT(q,v,t)
                INT16_SUB_UINT16_LIMIT(q,v,t)

doc/capi/openal.rst

 Macros
 ------
 
-.. cfunction:: CONTEXT_IS_CURRENT (ctxt)
+.. cmacro:: CONTEXT_IS_CURRENT (ctxt)
 
   Gets, whether the passed context is the current one. This returns 0,
   if the context is not the current one
 
-.. cfunction:: ASSERT_CONTEXT_IS_CURRENT (ctxt, ret)
+.. cmacro:: ASSERT_CONTEXT_IS_CURRENT (ctxt, ret)
 
   Checks, whether the passed context is the current one. If not, this
   will set a :exc:`PyExc_PyGameError` and return *retval*.

doc/capi/sdlbase.rst

 and related modules. They are used to check whether certain parts of the
 SDL subsystems are properly set and initialised.
 
-.. cfunction:: ASSERT_TIME_INIT (retval)
+.. cmacro:: ASSERT_TIME_INIT (retval)
 
   Checks, whether the time subsystem was properly initialised. If not,
   this will set a :exc:`PyExc_PyGameError` and return *retval*.

doc/capi/sdlcdrom.rst

 
 Macros
 ------
-.. cfunction:: ASSERT_CDROM_INIT (retval)
+.. cmacro:: ASSERT_CDROM_INIT (retval)
 
   Checks, whether the cdrom subsystem was properly initialised. If not,
   this will set a :exc:`PyExc_PyGameError` and return *retval*.
 
-.. cfunction:: ASSERT_CDROM_OPEN (obj, retval)
+.. cmacro:: ASSERT_CDROM_OPEN (obj, retval)
 
   Checks, whether the passed :ctype:`PyCD` is open for access. If not,
   this will set a :exc:`PyExc_PyGameError` and return *retval*.

doc/capi/sdlevent.rst

 The :mod:`pygame2.sdl.event` C API contains objects and functions for
 accessing and manipulating the SDL event system queue.
 
-.. todo::
-   
-   Describe user event encapsulation!
-
 Import
 ------
 Include headers::
   Constant for SDL user event types. This is usually placed into the
   :cmember:`SDL_Event.code` field for :cmacro:`SDL_USEREVENT` events.
 
+.. note::
+
+   If you handle events programmatically from C code or interoperate with other
+   SDL-based applications or libraries, which exchange events, you might have to
+   treat Python-based SDL events in a special way.
+
+   To check, whether the event comes from Pygame, you can check the
+   :cmember:`SDL_Event.data1` and :cmember:`SDL_Event.code` for the
+   :cdata:`PYGAME_USEREVENT` and :cdata:`PYGAME_USEREVENT_CODE` values.
+   If both are set, this indicates that the event comes from Pygame and carries
+   a Python dictionary in the :cmember:`SDL_Event.data2` field. ::
+   
+     if (event->user.code == PYGAME_USEREVENT_CODE &&
+         event->user.data1 == (void*)PYGAME_USEREVENT)
+     {
+         /* It comes from pygame*/
+         PyObject *dict = (PyObject*) event->user.data2;
+         ...
+     }
+
+  
 PyEvent
 -------
 .. ctype:: PyEvent

doc/capi/sdljoystick.rst

 
 Macros
 ------
-.. cfunction:: ASSERT_JOYSTICK_INIT (retval)
+.. cmacro:: ASSERT_JOYSTICK_INIT (retval)
 
   Checks, whether the joystick subsystem was properly initialised. If
   not, this will set a :exc:`PyExc_PyGameError` and return *retval*.
 
-.. cfunction:: ASSERT_JOYSTICK_OPEN (obj, retval)
+.. cmacro:: ASSERT_JOYSTICK_OPEN (obj, retval)
 
   Checks, whether the passed :ctype:`PyJoystick` is open for access. If
   not, this will set a :exc:`PyExc_PyGameError` and return *retval*.

doc/capi/sdlttf.rst

 
 Macros
 ------
-.. cfunction:: ASSERT_TTF_INIT (retval)
+.. cmacro:: ASSERT_TTF_INIT (retval)
 
   Checks, whether the ttf subsystem was properly initialised. If
   not, this will set a :exc:`PyExc_PyGameError` and return *retval*.

doc/capi/sdlvideo.rst

 
 Macros
 ------
-.. cfunction:: ASSERT_VIDEO_INIT (retval)
+.. cmacro:: ASSERT_VIDEO_INIT (retval)
 
   Checks, whether the video subsystem was properly initialised. If not,
   this will set a :exc:`PyExc_PyGameError` and return *retval*.
 
-.. cfunction:: ASSERT_VIDEO_SURFACE_SET (retval)
+.. cmacro:: ASSERT_VIDEO_SURFACE_SET (retval)
 
   Checks, whether a display surface was created already using
   :func:`pygame2.sdl.video.set_mode`. If not, this will set a
 # built documents.
 #
 # The short X.Y version.
-version = '2.0.0-alpha4'
+version = '2.0.0-alpha5'
 # The full version, including alpha/beta/rc tags.
-release = '2.0.0-alpha4'
+release = '2.0.0-alpha5'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
   </class>
 
   <func name="from_surface">
-    <call>from_surface (surface, threshold) -> :class:`Mask`</call>
+    <call>from_surface (surface, threshold) -> Mask</call>
     <desc>
       Returns a :class:`Mask` from the given :class:`pygame2.sdl.video.Surface`.
 
     </desc>
   </func>
   <func name="from_threshold">
-    <call>from_threshold (surface, color[, threshold, thressurface]) -> :class:`Mask`</call>
+    <call>from_threshold (surface, color[, threshold, thressurface]) -> Mask</call>
     <desc>
       Creates a :class:`Mask` by thresholding surfaces.
 

doc/src/sdl_constants.rst

 
    Indicates that the SDL application has the mouse input focus.
 
+Input State Flags
+-----------------
+
+The following constants are used by the :func:`pygame2.sdl.wm.grab_input`
+function.
+
+.. data:: GRAB_OFF
+
+   Release the input devices to allow them to switch to other applications.
+
+.. data:: GRAB_ON
+
+   Grab all supported input devices and deny switching to other applications,
+   if possible (this is not necessarily supported on any platform and window
+   manager).
+
+.. data:: GRAB_QUERY
+
+   Query the grab state without actually changing it.
+   
+Input System Contants
+---------------------
+
+The constants below represent flags or button and key abbreviations, which are
+usually retrieved by input events or used on operating with the various input
+modules, functions and classes.
+
+For keyboard constants, see :ref:`kbdconstants`.
+
+.. data:: BUTTON_LEFT
+
+   Represents the left mouse button.
+
+.. data:: BUTTON_MIDDLE
+
+   Represents the middle mouse button.
+
+.. data:: BUTTON_RIGHT
+
+   Represents the right mouse button.
+
+.. data:: BUTTON_WHEELDOWN
+
+   Represents the mouse wheel down signal.
+
+.. data:: BUTTON_WHEELUP
+
+   Represents the mouse wheel up signal.
+
+.. data:: BUTTON_X1
+
+   Represents an extended mouse button.
+   
+.. data:: BUTTON_X2
+
+   Represents an extended mouse button.
+   
+.. data:: HAT_CENTERED
+
+   Indicates that the joystick hat is centered.
+
+.. data:: HAT_DOWN
+
+   Indicates that the joystick hat is pushed downwards.
+
+.. data:: HAT_LEFT
+
+   Indicates that the joystick hat is pushed to the left.
+
+.. data:: HAT_LEFTDOWN
+
+   Indicates that the joystick hat is pushed to the lower left.
+
+.. data:: HAT_LEFTUP
+
+   Indicates that the joystick hat is pushed to the upper left.
+
+.. data:: HAT_RIGHT
+
+   Indicates that the joystick hat is pushed to the right.
+
+.. data:: HAT_RIGHTDOWN
+
+   Indicates that the joystick hat is pushed to the lower right.
+
+.. data:: HAT_RIGHTUP
+
+   Indicates that the joystick hat is pushed to the upper right.
+
+.. data:: HAT_UP
+
+   Indicates that the joystick hat is pushed upwards.
+
+.. data:: PRESSED
+
+   Indicates that a button or key is pressed down.
+
+.. data:: RELEASED
+
+   Indicates that a button or key is released (not pressed down).
+   
+.. _kbdconstants:
+
 Keyboard Constants
 ------------------
 
    This is only available for the :mod:`pygame2.sdl.video` functions and the
    display surface set by :meth:`pygame2.sdl.video.set_mode`.
 
+OpenGL Constants
+----------------
+
+The following pre-defined constants are used by the :mod:`pygame2.sdl.gl`
+attribute functions.
+
+.. data:: GL_ACCELERATED_VISUAL
+
+   
+
+.. data:: GL_ACCUM_ALPHA_SIZE
+
+   
+
+.. data:: GL_ACCUM_BLUE_SIZE
+
+   
+
+.. data:: GL_ACCUM_GREEN_SIZE
+
+   
+
+.. data:: GL_ACCUM_RED_SIZE
+
+   
+
+.. data:: GL_DEPTH_SIZE
+
+   
+
+.. data:: GL_ALPHA_SIZE
+
+   
+
+.. data:: GL_BLUE_SIZE
+
+   
+
+.. data:: GL_BUFFER_SIZE
+
+   
+
+.. data:: GL_GREEN_SIZE
+
+   
+
+.. data:: GL_RED_SIZE
+
+   
+
+.. data:: GL_DOUBLEBUFFER
+
+   
+
+.. data:: GL_MULTISAMPLEBUFFERS
+
+   
+
+.. data:: GL_MULTISAMPLESAMPLES
+
+   
+
+.. data:: GL_STENCIL_SIZE
+
+   
+
+.. data:: GL_STEREO
+
+   
+
+.. data:: GL_SWAP_CONTROL
+
+   xxx
+
+State and Context Constants
+---------------------------
+
+The following constants are used by various methods and functions to indicate,
+that a particular state, context or action is allowed or supported or
+disallowed or unsupported.
+
+Their concrete meaning and behaviour is explained in the documentation of the
+using function or method.
+
+.. data:: ENABLE
+
+   Indicates that the context (action) is allowed.
+
+.. data:: DISABLE
+
+   Indicates that the context (action) is disallowed.
+
+.. data:: IGNORE
+
+   Indicates that the context (action) is ignored.
+
+.. data:: QUERY
+
+   Queries the context (action) state without actually changing it.
+
+
 Various Constants
 -----------------
 
 .. data:: BIG_ENDIAN
     
    Indicates a big endian byte order.
+
+.. data:: ALPHA_OPAQUE
+
+   The alpha channel value representing a fully opaque (255) Color .
+
+.. data:: ALPHA_TRANSPARENT
+
+   The alpha channel value representing a fully transparent (0) Color .
+
+.. data:: TIMER_RESOLUTION
+
+   The default timer (tick) resolution used within :mod:`pygame2.sdl.time`.
+
+TO SORT:
+--------
+
+.. todo:
+
+  Sort those!
+ 
+  .. data:: PHYSPAL
+  .. data:: RLEACCELOK
+

doc/src/sdlmixer_constants.rst

 
    Initialises the ogg/vorbis library bindings.
 
-Format constants
+Format Constants
 ----------------
 
 Those constants are used by the :func:`pygame2.sdlmixer.open_audio` and
    
    Signed 16-bit data in system byte order.
 
-.. todo::
+Fading Status Constants
+-----------------------
 
-   Complete the constants
+Those constants indicate the fading status for :class:`pygame2.sdlmixer.Channel`
+and :class:`pygame2.sdlmixer.Music` objects.
 
+.. data:: NO_FADING
+
+   Indicates that the Channel or Music is currently not faded.
+
+.. data:: FADING_IN
+
+   Indicates that the Channel or Music is currently fading in.
+
+.. data:: FADING_OUT
+
+   Indicates that the Channel or Music is currently fading out.
+
+Music Type Constants
+--------------------
+
+Those constants are used by the :attr:`pygame2.sdlmixer.Music.type` attribute.
+
+.. data:: MUS_NONE
+
+   Indicates no music being played at all.
+
+.. data:: MUS_CMD
+
+   Indicates an external command to be used for music playback.
+
+.. data:: MUS_WAV
+
+   The music format is WAV data.
+
+.. data:: MUS_MOD
+
+   The music format is MOD data.
+   
+.. data:: MUS_MID
+
+   The music format is MIDI data.
+
+.. data:: MUS_OGG
+
+   The music format is Ogg/Vorbis encoded data.
+
+.. data:: MUS_MP3
+
+   The music format is MP3 encoded data (using smpeg as decoder).
+
+.. data:: MUS_MP3_MAD
+
+   The music format is MP3 encoded data (using libmad as decoder).
+
+Other Constants
+---------------
+
+.. data:: CHANNELS
+
+   The default amount of ready-to-use allocated
+   :class:`pygame2.sdlmixer.Channel` objects after the initial call to
+   :func:`pygame2.sdlmixer.open_audio`.
+
+.. data:: DEFAULT_FREQUENCY
+
+   A good default sample rate in Hz for most sound cards (22050).
+
+.. data:: DEFAULT_FORMAT
+
+   The suggested default audio format (:const:`AUDIO_S16SYS`).
+   
+.. data:: DEFAULT_CHANNELS
+
+   The suggested default channel setting for :func:`pygame2.sdlmixer.open_audio`.
+   This is 2 for stereo sound.
+
+.. data:: MAX_VOLUME
+
+   The maximum value for any volume setting.

doc/src/sdlmixerbase.xml

   </desc>
 
   <class name="Channel">
-    <constructor>TODO</constructor>
-    <desc></desc>
+    <constructor>Channel ([index]) -> Channel</constructor>
+    <desc>Creates a new Channel for playing audio data
+    
+      Channel represents a playback destination for audio data.
+      SDL_mixer can handle multiple channels to play audio simultanously.
+
+      If *index* is omitted or smaller than 1, a new Channel will be created.
+      Otherwise Channel will refer to an existing channel and reuse it.
+      
+      .. note::
+         
+         The state of an existing channel will not be reset.
+    </desc>
     <attr name="chunk">
-      <desc></desc>
+      <desc>The current :class:`Chunk` of audio data to be played.</desc>
     </attr>
     <method name="expire">
-      <call></call>
-      <desc></desc>
+      <call>expire (ms) -> None</call>
+      <desc>Halts the playback of the Channel after *ms* milliseconds.</desc>
     </method>
     <method name="fade_in">
-      <call></call>
-      <desc></desc>
+      <call>fade_in (sound, ms[, loops, ticks]) -> None</call>
+      <desc>Fades in the passed sound.
+      
+        This starts playing the passed *sound* at volume 0, which fades up to
+        the maximum value over *ms* milliseconds. The *sound* will be played
+        for *loops* + 1 number of times.
+        
+        *ticks* is the optional maximum time in milliseconds to stop playing
+        after.
+      </desc>
     </method>
     <method name="fade_out">
-      <call></call>
-      <desc></desc>
+      <call>fade_out (ms) -> None</call>
+      <desc>Fades out the current audio playback.
+      
+      This gradually reduces the volume to 0 over *ms* milliseconds. The channel
+      will be halted after the fadeout is complete.
+      </desc>
     </method>
     <attr name="fading">
-      <desc></desc>
+      <desc>The fading status of the Channel.</desc>
     </attr>
     <method name="halt">
-      <call></call>
-      <desc></desc>
+      <call>halt () -> None</call>
+      <desc>Stops the audio playback immediately and resets the playback state
+      </desc>
     </method>
     <method name="pause">
-      <call></call>
-      <desc></desc>
+      <call>pause () -> None</call>
+      <desc>Pauses the current audio playback.</desc>
     </method>
     <attr name="paused">
-      <desc></desc>
+      <desc>Gets, whether the Channel playback is currently paused.</desc>
     </attr>
     <method name="play">
-      <call></call>
-      <desc></desc>
+      <call>play (sound[, loops, ticks]) -> None</call>
+      <desc>Starts the playback of an audio :class:`Chunk`.
+      
+        The audio chunk will be played for *loops* + 1 times (or one time only, 
+        if *loops* is omitted).
+        
+        *ticks* is the optional maximum time in milliseconds to stop playing
+        after.
+      </desc>
     </method>
     <attr name="playing">
-      <desc></desc>
+      <desc>Gets, whether the Channel is currently playing audio.</desc>
     </attr>
     <method name="resume">
-      <call></call>
-      <desc></desc>
+      <call>resume () -> None</call>
+      <desc>Resumes the playback of a paused sound chunk.</desc>
     </method>
     <attr name="volume">
-      <desc></desc>
+      <desc>Gets or sets the channel volume.</desc>
     </attr>
   </class>
 
   <class name="Chunk">
-    <constructor>TODO</constructor>
-    <desc>
-
+    <constructor>Chunk (file) -> Chunk</constructor>
+    <desc>Creates a new sound chunk for audio playback.
+    
       .. note::
 
         The file object *must* support binary read and write
         access. This is especially important for Python 3.x users.
     </desc>
     <attr name="buf">
-      <desc></desc>
+      <desc>Gets the raw audio buffer of the Chunk.</desc>
     </attr>
     <attr name="len">
-      <desc></desc>
+      <desc>Gets the length of the audio data.</desc>
     </attr>
     <attr name="volume">
-      <desc></desc>
+      <desc>Gets or sets the default volume for the audio data.</desc>
     </attr>
   </class>
 
   <class name="Music">
-    <constructor>TODO</constructor>
-    <desc>
+    <constructor>Music (file) -> Music</constructor>
+    <desc>Creates a new sound chunk for music playback.
 
       .. note::
 
         access. This is especially important for Python 3.x users.
     </desc>
     <method name="fade_in">
-      <call></call>
-      <desc></desc>
+      <call>fade_in (ms[, loops, pos]) -> None</call>
+      <desc>Fades in the Music.
+      
+        This starts playing the Music at volume 0, which fades up to
+        the maximum value over *ms* milliseconds. The Music will be played
+        for *loops* + 1 number of times.
+        
+        *pos* is the position to start the playback from.
+      </desc>
     </method>
     <method name="play">
-      <call></call>
-      <desc></desc>
+      <call>play ([loops]) -> None</call>
+      <desc>Starts the playback of the Music.
+      
+        Starts the playback of the Music. The music will be played once, if
+        *loops* is omitted, otherwise it will be played *loops* + 1 times.
+      </desc>
     </method>
     <attr name="type">
-      <desc></desc>
+      <desc>Gets the music format.</desc>
     </attr>
   </class>
 

doc/src/sdlmixerchannel.xml

 
 <module name="pygame2.sdlmixer.channel">
   <short>SDL_mixer sound channel handling</short>
-  <desc></desc>
+  <desc>
+    This module takes care of general sound channel management and operations,
+    which can apply to one or multiple channels at once without having a 
+    concrete :class:`Channel` object around.
+  </desc>
 
   <func name="allocate">
-    <call></call>
-    <desc></desc>
+    <call>allocate (amount) -> (Channel, Channel, ...)</call>
+    <desc>(Pre-)Allocates a set of Channel objects.
+    </desc>
   </func>
   <func name="expire">
-    <call></call>
-    <desc></desc>
+    <call>expire (ms) -> None</call>
+    <desc>Halts the playback of all channels after *ms* milliseconds.</desc>
   </func>
   <func name="fade_out">
-    <call></call>
-    <desc></desc>
+    <call>fade_out (ms) -> int</call>
+    <desc>Fades out the current audio playback for all channels.
+    
+      This gradually reduces the volume for all channels to 0 over *ms*
+      milliseconds. The channels will be halted after the fadeout is complete.
+      
+      The number of channels set to fade out will be returned.
+    </desc>
   </func>
   <func name="get_volume">
-    <call></call>
-    <desc></desc>
+    <call>get_volume () -> int</call>
+    <desc>Gets the currently set overall volume for all Channel objects.</desc>
   </func>
   <func name="halt">
-    <call></call>
-    <desc></desc>
+    <call>halt () -> None</call>
+    <desc>Stops the sound playback for all Channel objects.</desc>
   </func>
   <func name="opened">
-    <call></call>
-    <desc></desc>
+    <call>opened () -> int</call>
+    <desc>Gets the number of currently open (allocated) channels.</desc>
   </func>
   <func name="pause">
-    <call></call>
-    <desc></desc>
+    <call>pause () -> None</call>
+    <desc>Pauses the sound playback for all Channel objects.</desc>
   </func>
   <func name="paused">
-    <call></call>
-    <desc></desc>
+    <call>paused () -> int</call>
+    <desc>Gets the number of channels being currently paused.</desc>
   </func>
   <func name="playing">
-    <call></call>
-    <desc></desc>
+    <call>playing () -> int</call>
+    <desc>Gets the number of channels currently playing.</desc>
   </func>
   <func name="resume">
-    <call></call>
-    <desc></desc>
+    <call>resume () -> None</call>
+    <desc>Resumes the playback for all paused Channel objects.</desc>
   </func>
   <func name="set_volume">
-    <call></call>
-    <desc></desc>
+    <call>set_volume (volume) -> int</call>
+    <desc>Sets the overall volume for all available Channel objects.
+
+      Sets the volume for all available Channel objects and returns the previous
+      set volume.
+    </desc>
   </func>
 </module>
 

doc/src/sdlmixermusic.xml

 
 <module name="pygame2.sdlmixer.music">
   <short>SDL_mixer music playback</short>
-  <desc></desc>
+  <desc>
+    This module takes care of general music management and operations,
+    which can apply to the currently set :class:`Music` object.
+  </desc>
 
   <func name="fade_out">
-    <call></call>
-    <desc></desc>
+    <call>fade_out (ms) -> None</call>
+    <desc>Fades out the current music playback.
+    
+      This gradually reduces the volume for the current music to 0 over *ms*
+      milliseconds. The music will be halted after the fadeout is complete.
+    </desc>
   </func>
   <func name="fading">
-    <call></call>
-    <desc></desc>
+    <call>fading () -> int</call>
+    <desc>Gets the fading status of the music.</desc>
   </func>
   <func name="get_volume">
-    <call></call>
-    <desc></desc>
+    <call>get_volume () -> int</call>
+    <desc>Gets the volume of the music.</desc>
   </func>
   <func name="halt">
-    <call></call>
-    <desc></desc>
+    <call>halt () -> None</call>
+    <desc>Halts the music playback and resets its state.</desc>
   </func>
   <func name="pause">
-    <call></call>
-    <desc></desc>
+    <call>pause () -> None</call>
+    <desc>Pauses the music playback.</desc>
   </func>
   <func name="paused">
-    <call></call>
-    <desc></desc>
+    <call>paused () -> bool</call>
+    <desc>Gets, whether the music playback is currently paused.</desc>
   </func>
   <func name="playing">
-    <call></call>
-    <desc></desc>
+    <call>playing () -> bool</call>
+    <desc>Gets, whether the music is currently playing.</desc>
   </func>
   <func name="resume">
-    <call></call>
-    <desc></desc>
+    <call>resume () -> None</call>
+    <desc>Resumes the previously paused music playback</desc>
   </func>
   <func name="rewind">
-    <call></call>
-    <desc></desc>
+    <call>rewind () -> None</call>
+    <desc>Rewinds the music to the start.</desc>
   </func>
   <func name="set_position">
-    <call></call>
-    <desc></desc>
+    <call>set_position (pos) -> None</call>
+    <desc>Sets the current playback position.</desc>
   </func>
   <func name="set_volume">
-    <call></call>
-    <desc></desc>
+    <call>set_volume (volume) -> int</call>
+    <desc>Sets the volume for the music.
+    
+      Sets the volume for the music and returns the previous set volume.
+    </desc>
   </func>
 </module>
 
 
 DLLPATH = os.path.join (path, "dll")
 
-__version__ = "2.0.0-alpha4"
-version_info = (2, 0, 0, "alpha4")
+__version__ = "2.0.0-alpha5"
+version_info = (2, 0, 0, "alpha5")
 
 from pygame2.base import *
             "src/sdl/surface_blit.c",
             "src/sdl/surface_blit_rgb.c",
             "src/sdl/surface_blit_rgba.c",
+            "src/sdl/surface_blit_alpha.c",
             "src/sdl/surface_fill.c",
             "src/sdl/surface_save.c",
             "src/sdl/surface.c",
 import modules, cfg
 from config import helpers, msys, config_modules
 
-VERSION = "2.0.0-alpha4"
+VERSION = "2.0.0-alpha5"
 DEBUG = True
 
 # Minimum requirements.

src/openal/capturedevice.c

             PyMem_Free (buf);
             return NULL;
         }
-        if (!CPyStreamWrapper_Write (buffer, buf, count, bytesize * channels,
+        if (!CPyStreamWrapper_Write (wrapper, buf, count, bytesize * channels,
                 &written))
         {
             PyMem_Free (buf);
-            CPyStreamWrapper_Free (buffer);
+            CPyStreamWrapper_Free (wrapper);
             return NULL;
         }
-        CPyStreamWrapper_Free (buffer);
+        CPyStreamWrapper_Free (wrapper);
         return PyLong_FromUnsignedLong ((unsigned long) written);
     }
 

src/sdl/surface_blit.c

 
 #include "surface_blit.h"
 
-static void alphablit_alpha (SDL_BlitInfo* info);
-static void alphablit_colorkey (SDL_BlitInfo* info);
-static void alphablit_solid (SDL_BlitInfo* info);
-
-static void 
-alphablit_alpha (SDL_BlitInfo * info)
-{
-    int             n;
-    int             width = info->d_width;
-    int             height = info->d_height;
-    Uint8          *src = info->s_pixels;
-    int             srcskip = info->s_skip;
-    Uint8          *dst = info->d_pixels;
-    int             dstskip = info->d_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
-    int             srcbpp = srcfmt->BytesPerPixel;
-    int             dstbpp = dstfmt->BytesPerPixel;
-    int             dR, dG, dB, dA, sR, sG, sB, sA;
-    Uint32          pixel;
-
-/*    
-    printf ("Alpha blit with %d and %d\n", srcbpp, dstbpp);
-*/
-
-    if (srcbpp == 1)
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    ALPHA_BLEND (sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    ALPHA_BLEND (sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-    else /* srcbpp > 1 */
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    ALPHA_BLEND (sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    ALPHA_BLEND (sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-}
-
-static void 
-alphablit_colorkey (SDL_BlitInfo * info)
-{
-    int             n;
-    int             width = info->d_width;
-    int             height = info->d_height;
-    Uint8          *src = info->s_pixels;
-    int             srcskip = info->s_skip;
-    Uint8          *dst = info->d_pixels;
-    int             dstskip = info->d_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
-    int             srcbpp = srcfmt->BytesPerPixel;
-    int             dstbpp = dstfmt->BytesPerPixel;
-    int             dR, dG, dB, dA, sR, sG, sB, sA;
-    int             alpha = srcfmt->alpha;
-    Uint32          colorkey = srcfmt->colorkey;
-    Uint32          pixel;
-
-/*    
-    printf ("Colorkey blit with %d and %d\n", srcbpp, dstbpp);
-*/  
-
-    if (srcbpp == 1)
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    sA = (*src == colorkey) ? 0 : alpha;
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    ALPHA_BLEND (sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    sA = (*src == colorkey) ? 0 : alpha;
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    ALPHA_BLEND (sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-    else /* srcbpp > 1 */
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    sA = (pixel == colorkey) ? 0 : alpha;
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    ALPHA_BLEND (sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    sA = (pixel == colorkey) ? 0 : alpha;
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    ALPHA_BLEND (sR, sG, sB, sA, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-}
-
-static void 
-alphablit_solid (SDL_BlitInfo * info)
-{
-    int             n;
-    int             width = info->d_width;
-    int             height = info->d_height;
-    Uint8          *src = info->s_pixels;
-    int             srcskip = info->s_skip;
-    Uint8          *dst = info->d_pixels;
-    int             dstskip = info->d_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
-    int             srcbpp = srcfmt->BytesPerPixel;
-    int             dstbpp = dstfmt->BytesPerPixel;
-    int             dR, dG, dB, dA, sR, sG, sB, sA;
-    int             alpha = srcfmt->alpha;
-    int             pixel;
-
-/*    
-    printf ("Solid blit with %d and %d\n", srcbpp, dstbpp);
-*/    
-
-    if (srcbpp == 1)
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    ALPHA_BLEND (sR, sG, sB, alpha, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    ALPHA_BLEND (sR, sG, sB, alpha, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-    else /* srcbpp > 1 */
-    {
-        if (dstbpp == 1)
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);
-                    ALPHA_BLEND (sR, sG, sB, alpha, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n, width);
-                src += srcskip;
-                dst += dstskip;
-            }
-
-        }
-        else /* dstbpp > 1 */
-        {
-            while (height--)
-            {
-                LOOP_UNROLLED4(
-                {
-                    GET_PIXEL(pixel, srcbpp, src);
-                    GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);
-                    GET_PIXEL (pixel, dstbpp, dst);
-                    GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);
-                    ALPHA_BLEND (sR, sG, sB, alpha, dR, dG, dB, dA);
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);
-                    src += srcbpp;
-                    dst += dstbpp;
-                }, n ,width);
-                src += srcskip;
-                dst += dstskip;
-            }
-        }
-    }
-}
-
 int
 pyg_sdlsoftware_blit (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst,
     SDL_Rect *dstrect, BlendMode blitargs)
         case 0:
         {
             if (src->flags & SDL_SRCALPHA && src->format->Amask)
-                alphablit_alpha (&info);
+                blit_alpha_alpha (&info);
             else if (src->flags & SDL_SRCCOLORKEY)
-                alphablit_colorkey (&info);
+                blit_alpha_colorkey (&info);
             else
-                alphablit_solid (&info);
+                blit_alpha_solid (&info);
             break;
         }
         case BLEND_RGB_ADD:

src/sdl/surface_blit.h

 #define _PYGAME_SURFACEBLIT_H_
 
 #include "surface.h"
+#ifdef HAVE_OPENMP
+#include <omp.h>
+#endif
 
 /* The structure passed to the low level blit functions */
 typedef struct
     SDL_PixelFormat *dst;
 } SDL_BlitInfo;
 
+/* Blitter definition
+ *
+ * _sop1 == special alpha blit operation for 1bpp src
+ * _sop2 == special alpha blit operation for >1bpp src
+ * _sop3 == special alpha blit operation for 4bpp<->4bpp
+ *
+ */
+#ifdef HAVE_OPENMP
+#define CREATE_BLITTER(_name,_blitop,_sop1,_sop2,_sop3)                 \
+    void blit_##_name(SDL_BlitInfo *info)                               \
+    {                                                                   \
+        int             width = info->d_width;                          \
+        int             height = info->d_height;                        \
+        Uint8          *src = info->s_pixels;                           \
+        Uint8          *dst = info->d_pixels;                           \
+        SDL_PixelFormat *srcfmt = info->src;                            \
+        SDL_PixelFormat *dstfmt = info->dst;                            \
+        int             srcbpp = srcfmt->BytesPerPixel;                 \
+        int             dstbpp = dstfmt->BytesPerPixel;                 \
+        Uint8           dR, dG, dB, dA, sR, sG, sB, sA;                 \
+        Uint32          pixel;                                          \
+        int             alpha = srcfmt->alpha;                          \
+        Uint32          colorkey = srcfmt->colorkey;                    \
+        Uint32          tmp;                                            \
+        Sint32          tmp2;                                           \
+        Uint8          *sppx, *dppx;                                    \
+        int             x, y;                                           \
+                                                                        \
+        if (srcbpp == 4 && dstbpp == 4)                                 \
+        {                                                               \
+            PRAGMA(omp parallel)                                        \
+            {                                                           \
+                PRAGMA(omp for private(sppx,dppx,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
+                for (y = 0; y < height; y++)                            \
+                {                                                       \
+                    for (x = 0; x < width; x++)                         \
+                    {                                                   \
+                        sppx = src + y * info->s_pitch + x * srcbpp;    \
+                        dppx = dst + y * info->d_pitch + x * dstbpp;    \
+                        _sop3;                                          \
+                        GET_RGB_VALS ((*(Uint32*)sppx), srcfmt, sR, sG, sB, sA); \
+                        GET_RGB_VALS ((*(Uint32*)dppx), dstfmt, dR, dG, dB, dA); \
+                        _blitop;                                        \
+                        CREATE_PIXEL(dppx, dR, dG, dB, dA, dstbpp, dstfmt); \
+                    }                                                   \
+                }                                                       \
+            }                                                           \
+            return;                                                     \
+        }                                                               \
+                                                                        \
+        if (srcbpp == 1)                                                \
+        {                                                               \
+            if (dstbpp == 1)                                            \
+            {                                                           \
+                PRAGMA(omp parallel)                                    \
+                {                                                       \
+                    PRAGMA(omp for private(sppx,dppx,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
+                    for (y = 0; y < height; y++)                        \
+                    {                                                   \
+                        for (x = 0; x < width; x++)                     \
+                        {                                               \
+                            sppx = src + y * info->s_pitch + x * srcbpp; \
+                            dppx = dst + y * info->d_pitch + x * dstbpp; \
+                            GET_PALETTE_VALS(sppx, srcfmt, sR, sG, sB, sA); \
+                            _sop1;                                      \
+                            GET_PALETTE_VALS(dppx, dstfmt, dR, dG, dB, dA); \
+                            _blitop;                                    \
+                            CREATE_PIXEL(dppx, dR, dG, dB, dA, dstbpp, dstfmt); \
+                        }                                               \
+                    }                                                   \
+                }                                                       \
+            }                                                           \
+            else /* dstbpp > 1 */                                       \
+            {                                                           \
+                PRAGMA(omp parallel)                                    \
+                {                                                       \
+                    PRAGMA(omp for private(sppx,dppx,pixel,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
+                    for (y = 0; y < height; y++)                        \
+                    {                                                   \
+                        for (x = 0; x < width; x++)                     \
+                        {                                               \
+                            sppx = src + y * info->s_pitch + x * srcbpp; \
+                            dppx = dst + y * info->d_pitch + x * dstbpp; \
+                            GET_PALETTE_VALS(sppx, srcfmt, sR, sG, sB, sA); \
+                            _sop1;                                      \
+                            GET_PIXEL (pixel, dstbpp, dppx);            \
+                            GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA); \
+                            _blitop;                                    \
+                            CREATE_PIXEL(dppx, dR, dG, dB, dA, dstbpp, dstfmt); \
+                        }                                               \
+                    }                                                   \
+                }                                                       \
+            }                                                           \
+        }                                                               \
+        else /* srcbpp > 1 */                                           \
+        {                                                               \
+            if (dstbpp == 1)                                            \
+            {                                                           \
+                PRAGMA(omp parallel)                                    \
+                {                                                       \
+                    PRAGMA(omp for private(sppx,dppx,pixel,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
+                    for (y = 0; y < height; y++)                        \
+                    {                                                   \
+                        for (x = 0; x < width; x++)                     \
+                        {                                               \
+                            sppx = src + y * info->s_pitch + x * srcbpp; \
+                            dppx = dst + y * info->d_pitch + x * dstbpp; \
+                            GET_PIXEL(pixel, srcbpp, sppx);             \
+                            _sop2;                                      \
+                            GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA); \
+                            GET_PALETTE_VALS(dppx, dstfmt, dR, dG, dB, dA); \
+                            _blitop;                                    \
+                            CREATE_PIXEL(dppx, dR, dG, dB, dA, dstbpp, dstfmt); \
+                        }                                               \
+                    }                                                   \
+                }                                                       \
+            }                                                           \
+            else /* dstbpp > 1 */                                       \
+            {                                                           \
+                PRAGMA(omp parallel)                                    \
+                {                                                       \
+                    PRAGMA(omp for private(sppx,dppx,pixel,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
+                    for (y = 0; y < height; y++)                        \
+                    {                                                   \
+                        for (x = 0; x < width; x++)                     \
+                        {                                               \
+                            sppx = src + y * info->s_pitch + x * srcbpp; \
+                            dppx = dst + y * info->d_pitch + x * dstbpp; \
+                            GET_PIXEL(pixel, srcbpp, sppx);             \
+                            _sop2;                                      \
+                            GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA); \
+                            GET_PIXEL (pixel, dstbpp, dppx);            \
+                            GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA); \
+                            _blitop;                                    \
+                            CREATE_PIXEL(dppx, dR, dG, dB, dA, dstbpp, dstfmt); \
+                        }                                               \
+                    }                                                   \
+                }                                                       \
+            }                                                           \
+        }                                                               \
+    }
+#else /* HAVE_OPENMP */
+#define CREATE_BLITTER(_name,_blitop,_sop1,_sop2,_sop3)                 \
+    void blit_##_name(SDL_BlitInfo *info)                               \
+    {                                                                   \
+        int             n;                                              \
+        int             width = info->d_width;                          \
+        int             height = info->d_height;                        \
+        Uint8          *src = info->s_pixels;                           \
+        int             srcskip = info->s_skip;                         \
+        Uint8          *dst = info->d_pixels;                           \
+        int             dstskip = info->d_skip;                         \
+        SDL_PixelFormat *srcfmt = info->src;                            \
+        SDL_PixelFormat *dstfmt = info->dst;                            \
+        int             srcbpp = srcfmt->BytesPerPixel;                 \
+        int             dstbpp = dstfmt->BytesPerPixel;                 \
+        Uint8           dR, dG, dB, dA, sR, sG, sB, sA;                 \
+        Uint32          pixel;                                          \
+        int             alpha = srcfmt->alpha;                          \
+        Uint32          colorkey = srcfmt->colorkey;                    \
+        Uint32          tmp;                                            \
+        Sint32          tmp2;                                           \
+                                                                        \
+        if (srcbpp == 4 && dstbpp == 4)                                 \
+        {                                                               \
+            while (height--)                                            \
+            {                                                           \
+                LOOP_UNROLLED4(                                         \
+                {                                                       \
+                    GET_RGB_VALS ((*(Uint32*)src), srcfmt, sR, sG, sB, sA); \
+                    GET_RGB_VALS ((*(Uint32*)dst), dstfmt, dR, dG, dB, dA); \
+                    _sop3;                                              \
+                    _blitop;                                            \
+                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);  \
+                    src += srcbpp;                                      \
+                    dst += dstbpp;                                      \
+                }, n, width);                                           \
+                src += srcskip;                                         \
+                dst += dstskip;                                         \
+            }                                                           \
+            return;                                                     \
+        }                                                               \
+                                                                        \
+        if (srcbpp == 1)                                                \
+        {                                                               \
+            if (dstbpp == 1)                                            \
+            {                                                           \
+                while (height--)                                        \
+                {                                                       \
+                    LOOP_UNROLLED4(                                     \
+                    {                                                   \
+                        GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);  \
+                        _sop1;                                          \
+                        GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);  \
+                        _blitop;                                        \
+                        CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt); \
+                        src += srcbpp;                                  \
+                        dst += dstbpp;                                  \
+                    }, n, width);                                       \
+                    src += srcskip;                                     \
+                    dst += dstskip;                                     \
+                }                                                       \
+            }                                                           \
+            else /* dstbpp > 1 */                                       \
+            {                                                           \
+                while (height--)                                        \
+                {                                                       \
+                    LOOP_UNROLLED4(                                     \
+                    {                                                   \
+                        GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);  \
+                        _sop1;                                          \
+                        GET_PIXEL (pixel, dstbpp, dst);                 \
+                        GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);   \
+                        _blitop;                                        \
+                        CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt); \
+                        src += srcbpp;                                  \
+                        dst += dstbpp;                                  \
+                    }, n, width);                                       \
+                    src += srcskip;                                     \
+                    dst += dstskip;                                     \
+                }                                                       \
+            }                                                           \
+        }                                                               \
+        else /* srcbpp > 1 */                                           \
+        {                                                               \
+            if (dstbpp == 1)                                            \
+            {                                                           \
+                while (height--)                                        \
+                {                                                       \
+                    LOOP_UNROLLED4(                                     \
+                    {                                                   \
+                        GET_PIXEL(pixel, srcbpp, src);                  \
+                        _sop2;                                          \
+                        GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);   \
+                        GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);  \
+                        _blitop;                                        \
+                        CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt); \
+                        src += srcbpp;                                  \
+                        dst += dstbpp;                                  \
+                    }, n, width);                                       \
+                    src += srcskip;                                     \
+                    dst += dstskip;                                     \
+                }                                                       \
+                                                                        \
+            }                                                           \
+            else /* dstbpp > 1 */                                       \
+            {                                                           \
+                while (height--)                                        \
+                {                                                       \
+                    LOOP_UNROLLED4(                                     \
+                    {                                                   \
+                        GET_PIXEL(pixel, srcbpp, src);                  \
+                        _sop2;                                          \
+                        GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);   \
+                        GET_PIXEL (pixel, dstbpp, dst);                 \
+                        GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);   \
+                        _blitop;                                        \
+                        CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt); \
+                        src += srcbpp;                                  \
+                        dst += dstbpp;                                  \
+                    }, n, width);                                       \
+                    src += srcskip;                                     \
+                    dst += dstskip;                                     \
+                }                                                       \
+            }                                                           \
+        }                                                               \
+    }
+#endif /* HAVE_OPENMP */
+
 void blit_blend_rgb_add (SDL_BlitInfo* info);
 void blit_blend_rgb_sub (SDL_BlitInfo* info);
 void blit_blend_rgb_mul (SDL_BlitInfo* info);
 void blit_blend_rgba_screen (SDL_BlitInfo* info);
 void blit_blend_rgba_avg (SDL_BlitInfo* info);
 
+void blit_alpha_alpha (SDL_BlitInfo* info);
+void blit_alpha_colorkey (SDL_BlitInfo* info);
+void blit_alpha_solid (SDL_BlitInfo* info);
+
 #endif /* _PYGAME_SURFACEBLIT_H_ */

src/sdl/surface_blit_alpha.c

+/*
+  pygame - Python Game Library
+  Copyright (C) 2000-2001  Pete Shinners, 2006 Rene Dudfield,
+                2007-2010 Marcus von Appen
+
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Library General Public
+  License as published by the Free Software Foundation; either
+  version 2 of the License, or (at your option) any later version.
+
+  This library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  Library General Public License for more details.
+
+  You should have received a copy of the GNU Library General Public
+  License along with this library; if not, write to the Free
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#include "surface_blit.h"
+
+CREATE_BLITTER(alpha_alpha, ALPHA_BLEND(sR,sG,sB,sA,dR,dG,dB,dA),,,)
+CREATE_BLITTER(alpha_solid, ALPHA_BLEND(sR,sG,sB,alpha,dR,dG,dB,dA),,,)
+#ifdef HAVE_OPENMP
+/* src values are reachable via sppx in OpenMP macro */
+CREATE_BLITTER(alpha_colorkey, ALPHA_BLEND(sR,sG,sB,sA,dR,dG,dB,dA),
+    (sA = (*sppx == colorkey) ? 0 : alpha),
+    (sA = (pixel == colorkey) ? 0 : alpha),
+    (sA = ((*(Uint32*)sppx) == colorkey) ? 0 : alpha))
+#else
+CREATE_BLITTER(alpha_colorkey, ALPHA_BLEND(sR,sG,sB,sA,dR,dG,dB,dA),
+    (sA = (*src == colorkey) ? 0 : alpha),
+    (sA = (pixel == colorkey) ? 0 : alpha),
+    (sA = ((*(Uint32*)src) == colorkey) ? 0 : alpha))
+#endif

src/sdl/surface_blit_rgb.c

 */
 
 #include "surface_blit.h"
-#ifdef HAVE_OPENMP
-#include <omp.h>
-#endif
 
-#ifdef HAVE_OPENMP
-#define CREATE_BLITTER(_name,_blitop)                                   \
-    void blit_##_name(SDL_BlitInfo *info)                               \
-    {                                                                   \
-        int             width = info->d_width;                          \
-        int             height = info->d_height;                        \
-        Uint8          *src = info->s_pixels;                           \
-        Uint8          *dst = info->d_pixels;                           \
-        SDL_PixelFormat *srcfmt = info->src;                            \
-        SDL_PixelFormat *dstfmt = info->dst;                            \
-        int             srcbpp = srcfmt->BytesPerPixel;                 \
-        int             dstbpp = dstfmt->BytesPerPixel;                 \
-        Uint8           dR, dG, dB, dA, sR, sG, sB, sA;                 \
-        Uint32          pixel;                                          \
-        Uint32          tmp;                                            \
-        Sint32          tmp2;                                           \
-        Uint8          *sppx, *dppx;                                    \
-        int             x, y;                                           \
-                                                                        \
-        if (srcbpp == 4 && dstbpp == 4)                                 \
-        {                                                               \
-            PRAGMA(omp parallel)                                        \
-            {                                                           \
-                PRAGMA(omp for private(sppx,dppx,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
-                for (y = 0; y < height; y++)                            \
-                {                                                       \
-                    for (x = 0; x < width; x++)                         \
-                    {                                                   \
-                        sppx = src + y * info->s_pitch + x * srcbpp;    \
-                        dppx = dst + y * info->d_pitch + x * dstbpp;    \
-                        GET_RGB_VALS ((*(Uint32*)sppx), srcfmt, sR, sG, sB, sA); \
-                        GET_RGB_VALS ((*(Uint32*)dppx), dstfmt, dR, dG, dB, dA); \
-                        _blitop;                                        \
-                        CREATE_PIXEL(dppx, dR, dG, dB, dA, dstbpp, dstfmt); \
-                    }                                                   \
-                }                                                       \
-            }                                                           \
-            return;                                                     \
-        }                                                               \
-                                                                        \
-        if (srcbpp == 1)                                                \
-        {                                                               \
-            if (dstbpp == 1)                                            \
-            {                                                           \
-                PRAGMA(omp parallel)                                    \
-                {                                                       \
-                    PRAGMA(omp for private(sppx,dppx,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
-                    for (y = 0; y < height; y++)                        \
-                    {                                                   \
-                        for (x = 0; x < width; x++)                     \
-                        {                                               \
-                            sppx = src + y * info->s_pitch + x * srcbpp; \
-                            dppx = dst + y * info->d_pitch + x * dstbpp; \
-                            GET_PALETTE_VALS(sppx, srcfmt, sR, sG, sB, sA); \
-                            GET_PALETTE_VALS(dppx, dstfmt, dR, dG, dB, dA); \
-                            _blitop;                                    \
-                            CREATE_PIXEL(dppx, dR, dG, dB, dA, dstbpp, dstfmt); \
-                        }                                               \
-                    }                                                   \
-                }                                                       \
-            }                                                           \
-            else /* dstbpp > 1 */                                       \
-            {                                                           \
-                PRAGMA(omp parallel)                                    \
-                {                                                       \
-                    PRAGMA(omp for private(sppx,dppx,pixel,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
-                    for (y = 0; y < height; y++)                        \
-                    {                                                   \
-                        for (x = 0; x < width; x++)                     \
-                        {                                               \
-                            sppx = src + y * info->s_pitch + x * srcbpp; \
-                            dppx = dst + y * info->d_pitch + x * dstbpp; \
-                            GET_PALETTE_VALS(sppx, srcfmt, sR, sG, sB, sA); \
-                            GET_PIXEL (pixel, dstbpp, dppx);             \
-                            GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA); \
-                            _blitop;                                    \
-                            CREATE_PIXEL(dppx, dR, dG, dB, dA, dstbpp, dstfmt); \
-                        }                                               \
-                    }                                                   \
-                }                                                       \
-            }                                                           \
-        }                                                               \
-        else /* srcbpp > 1 */                                           \
-        {                                                               \
-            if (dstbpp == 1)                                            \
-            {                                                           \
-                PRAGMA(omp parallel)                                    \
-                {                                                       \
-                    PRAGMA(omp for private(sppx,dppx,pixel,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
-                    for (y = 0; y < height; y++)                        \
-                    {                                                   \
-                        for (x = 0; x < width; x++)                     \
-                        {                                               \
-                            sppx = src + y * info->s_pitch + x * srcbpp; \
-                            dppx = dst + y * info->d_pitch + x * dstbpp; \
-                            GET_PIXEL(pixel, srcbpp, sppx);             \
-                            GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA); \
-                            GET_PALETTE_VALS(dppx, dstfmt, dR, dG, dB, dA); \
-                            _blitop;                                    \
-                            CREATE_PIXEL(dppx, dR, dG, dB, dA, dstbpp, dstfmt); \
-                        }                                               \
-                    }                                                   \
-                }                                                       \
-            }                                                           \
-            else /* dstbpp > 1 */                                       \
-            {                                                           \
-                PRAGMA(omp parallel)                                    \
-                {                                                       \
-                    PRAGMA(omp for private(sppx,dppx,pixel,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
-                    for (y = 0; y < height; y++)                        \
-                    {                                                   \
-                        for (x = 0; x < width; x++)                     \
-                        {                                               \
-                            sppx = src + y * info->s_pitch + x * srcbpp; \
-                            dppx = dst + y * info->d_pitch + x * dstbpp; \
-                            GET_PIXEL(pixel, srcbpp, sppx);             \
-                            GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA); \
-                            GET_PIXEL (pixel, dstbpp, dppx);            \
-                            GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA); \
-                            _blitop;                                    \
-                            CREATE_PIXEL(dppx, dR, dG, dB, dA, dstbpp, dstfmt); \
-                        }                                               \
-                    }                                                   \
-                }                                                       \
-            }                                                           \
-        }                                                               \
-    }
-#else /* HAVE_OPENMP */
-#define CREATE_BLITTER(_name,_blitop)                                   \
-    void blit_##_name(SDL_BlitInfo *info)                               \
-    {                                                                   \
-        int             n;                                              \
-        int             width = info->d_width;                          \
-        int             height = info->d_height;                        \
-        Uint8          *src = info->s_pixels;                           \
-        int             srcskip = info->s_skip;                         \
-        Uint8          *dst = info->d_pixels;                           \
-        int             dstskip = info->d_skip;                         \
-        SDL_PixelFormat *srcfmt = info->src;                            \
-        SDL_PixelFormat *dstfmt = info->dst;                            \
-        int             srcbpp = srcfmt->BytesPerPixel;                 \
-        int             dstbpp = dstfmt->BytesPerPixel;                 \
-        Uint8           dR, dG, dB, dA, sR, sG, sB, sA;                 \
-        Uint32          pixel;                                          \
-        Uint32          tmp;                                            \
-        Sint32          tmp2;                                           \
-                                                                        \
-        if (srcbpp == 4 && dstbpp == 4)                                 \
-        {                                                               \
-            while (height--)                                            \
-            {                                                           \
-                LOOP_UNROLLED4(                                         \
-                    {                                                   \
-                    GET_RGB_VALS ((*(Uint32*)src), srcfmt, sR, sG, sB, sA); \
-                    GET_RGB_VALS ((*(Uint32*)dst), dstfmt, dR, dG, dB, dA); \
-                    _blitop;                                            \
-                    CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt);  \
-                    src += srcbpp;                                      \
-                    dst += dstbpp;                                      \
-                    }, n, width);                                       \
-                src += srcskip;                                         \
-                dst += dstskip;                                         \
-            }                                                           \
-            return;                                                     \
-        }                                                               \
-                                                                        \
-        if (srcbpp == 1)                                                \
-        {                                                               \
-            if (dstbpp == 1)                                            \
-            {                                                           \
-                while (height--)                                        \
-                {                                                       \
-                    LOOP_UNROLLED4(                                     \
-                    {                                                   \
-                        GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);  \
-                        GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);  \
-                        _blitop;                                        \
-                        CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt); \
-                        src += srcbpp;                                  \
-                        dst += dstbpp;                                  \
-                    }, n, width);                                       \
-                    src += srcskip;                                     \
-                    dst += dstskip;                                     \
-                }                                                       \
-            }                                                           \
-            else /* dstbpp > 1 */                                       \
-            {                                                           \
-                while (height--)                                        \
-                {                                                       \
-                    LOOP_UNROLLED4(                                     \
-                    {                                                   \
-                        GET_PALETTE_VALS(src, srcfmt, sR, sG, sB, sA);  \
-                        GET_PIXEL (pixel, dstbpp, dst);                 \
-                        GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);   \
-                        _blitop;                                        \
-                        CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt); \
-                        src += srcbpp;                                  \
-                        dst += dstbpp;                                  \
-                    }, n, width);                                       \
-                    src += srcskip;                                     \
-                    dst += dstskip;                                     \
-                }                                                       \
-            }                                                           \
-        }                                                               \
-        else /* srcbpp > 1 */                                           \
-        {                                                               \
-            if (dstbpp == 1)                                            \
-            {                                                           \
-                while (height--)                                        \
-                {                                                       \
-                    LOOP_UNROLLED4(                                     \
-                    {                                                   \
-                        GET_PIXEL(pixel, srcbpp, src);                  \
-                        GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);   \
-                        GET_PALETTE_VALS(dst, dstfmt, dR, dG, dB, dA);  \
-                        _blitop;                                        \
-                        CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt); \
-                        src += srcbpp;                                  \
-                        dst += dstbpp;                                  \
-                    }, n, width);                                       \
-                    src += srcskip;                                     \
-                    dst += dstskip;                                     \
-                }                                                       \
-                                                                        \
-            }                                                           \
-            else /* dstbpp > 1 */                                       \
-            {                                                           \
-                while (height--)                                        \
-                {                                                       \
-                    LOOP_UNROLLED4(                                     \
-                    {                                                   \
-                        GET_PIXEL(pixel, srcbpp, src);                  \
-                        GET_RGB_VALS (pixel, srcfmt, sR, sG, sB, sA);   \
-                        GET_PIXEL (pixel, dstbpp, dst);                 \
-                        GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA);   \
-                        _blitop;                                        \
-                        CREATE_PIXEL(dst, dR, dG, dB, dA, dstbpp, dstfmt); \
-                        src += srcbpp;                                  \
-                        dst += dstbpp;                                  \
-                    }, n, width);                                       \
-                    src += srcskip;                                     \
-                    dst += dstskip;                                     \
-                }                                                       \
-            }                                                           \
-        }                                                               \
-    }
-#endif /* HAVE_OPENMP */
-CREATE_BLITTER(blend_rgb_add, D_BLEND_RGB_ADD(tmp,sR,sG,sB,dR,dG,dB))
-CREATE_BLITTER(blend_rgb_sub, D_BLEND_RGB_SUB(tmp2,sR,sG,sB,dR,dG,dB))
-CREATE_BLITTER(blend_rgb_mul, D_BLEND_RGB_MULT(sR,sG,sB,dR,dG,dB))
-CREATE_BLITTER(blend_rgb_min, D_BLEND_RGB_MIN(sR,sG,sB,dR,dG,dB))
-CREATE_BLITTER(blend_rgb_max, D_BLEND_RGB_MAX(sR,sG,sB,dR,dG,dB))
-CREATE_BLITTER(blend_rgb_xor, D_BLEND_RGB_XOR(sR,sG,sB,dR,dG,dB))
-CREATE_BLITTER(blend_rgb_and, D_BLEND_RGB_AND(sR,sG,sB,dR,dG,dB))
-CREATE_BLITTER(blend_rgb_or, D_BLEND_RGB_OR(sR,sG,sB,dR,dG,dB))
-CREATE_BLITTER(blend_rgb_diff, D_BLEND_RGB_DIFF(sR,sG,sB,dR,dG,dB))
-CREATE_BLITTER(blend_rgb_screen, D_BLEND_RGB_SCREEN(sR,sG,sB,dR,dG,dB))
-CREATE_BLITTER(blend_rgb_avg, D_BLEND_RGB_AVG(sR,sG,sB,dR,dG,dB))
+CREATE_BLITTER(blend_rgb_add, D_BLEND_RGB_ADD(tmp,sR,sG,sB,dR,dG,dB),,,)
+CREATE_BLITTER(blend_rgb_sub, D_BLEND_RGB_SUB(tmp2,sR,sG,sB,dR,dG,dB),,,)
+CREATE_BLITTER(blend_rgb_mul, D_BLEND_RGB_MULT(sR,sG,sB,dR,dG,dB),,,)
+CREATE_BLITTER(blend_rgb_min, D_BLEND_RGB_MIN(sR,sG,sB,dR,dG,dB),,,)
+CREATE_BLITTER(blend_rgb_max, D_BLEND_RGB_MAX(sR,sG,sB,dR,dG,dB),,,)
+CREATE_BLITTER(blend_rgb_xor, D_BLEND_RGB_XOR(sR,sG,sB,dR,dG,dB),,,)
+CREATE_BLITTER(blend_rgb_and, D_BLEND_RGB_AND(sR,sG,sB,dR,dG,dB),,,)
+CREATE_BLITTER(blend_rgb_or, D_BLEND_RGB_OR(sR,sG,sB,dR,dG,dB),,,)
+CREATE_BLITTER(blend_rgb_diff, D_BLEND_RGB_DIFF(sR,sG,sB,dR,dG,dB),,,)
+CREATE_BLITTER(blend_rgb_screen, D_BLEND_RGB_SCREEN(sR,sG,sB,dR,dG,dB),,,)
+CREATE_BLITTER(blend_rgb_avg, D_BLEND_RGB_AVG(sR,sG,sB,dR,dG,dB),,,)

src/sdl/surface_blit_rgba.c

 */
 
 #include "surface_blit.h"
-#ifdef HAVE_OPENMP
-#include <omp.h>
-#endif
 
-#ifdef HAVE_OPENMP
-#define CREATE_BLITTER(_name,_blitop)                                   \
-    void blit_##_name(SDL_BlitInfo *info)                               \
-    {                                                                   \
-        int             width = info->d_width;                          \
-        int             height = info->d_height;                        \
-        Uint8          *src = info->s_pixels;                           \
-        Uint8          *dst = info->d_pixels;                           \
-        SDL_PixelFormat *srcfmt = info->src;                            \
-        SDL_PixelFormat *dstfmt = info->dst;                            \
-        int             srcbpp = srcfmt->BytesPerPixel;                 \
-        int             dstbpp = dstfmt->BytesPerPixel;                 \
-        Uint8           dR, dG, dB, dA, sR, sG, sB, sA;                 \
-        Uint32          pixel;                                          \
-        Uint32          tmp;                                            \
-        Sint32          tmp2;                                           \
-        Uint8          *sppx, *dppx;                                    \
-        int             x, y;                                           \
-                                                                        \
-        if (srcbpp == 4 && dstbpp == 4)                                 \
-        {                                                               \
-            PRAGMA(omp parallel)                                        \
-            {                                                           \
-                PRAGMA(omp for private(sppx,dppx,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
-                for (y = 0; y < height; y++)                            \
-                {                                                       \
-                    for (x = 0; x < width; x++)                         \
-                    {                                                   \
-                        sppx = src + y * info->s_pitch + x * srcbpp;    \
-                        dppx = dst + y * info->d_pitch + x * dstbpp;    \
-                        GET_RGB_VALS ((*(Uint32*)sppx), srcfmt, sR, sG, sB, sA); \
-                        GET_RGB_VALS ((*(Uint32*)dppx), dstfmt, dR, dG, dB, dA); \
-                        _blitop;                                        \
-                        CREATE_PIXEL(dppx, dR, dG, dB, dA, dstbpp, dstfmt); \
-                    }                                                   \
-                }                                                       \
-            }                                                           \
-            return;                                                     \
-        }                                                               \
-                                                                        \
-        if (srcbpp == 1)                                                \
-        {                                                               \
-            if (dstbpp == 1)                                            \
-            {                                                           \
-                PRAGMA(omp parallel)                                    \
-                {                                                       \
-                    PRAGMA(omp for private(sppx,dppx,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
-                    for (y = 0; y < height; y++)                        \
-                    {                                                   \
-                        for (x = 0; x < width; x++)                     \
-                        {                                               \
-                            sppx = src + y * info->s_pitch + x * srcbpp; \
-                            dppx = dst + y * info->d_pitch + x * dstbpp; \
-                            GET_PALETTE_VALS(sppx, srcfmt, sR, sG, sB, sA); \
-                            GET_PALETTE_VALS(dppx, dstfmt, dR, dG, dB, dA); \
-                            _blitop;                                    \
-                            CREATE_PIXEL(dppx, dR, dG, dB, dA, dstbpp, dstfmt); \
-                        }                                               \
-                    }                                                   \
-                }                                                       \
-            }                                                           \
-            else /* dstbpp > 1 */                                       \
-            {                                                           \
-                PRAGMA(omp parallel)                                    \
-                {                                                       \
-                    PRAGMA(omp for private(sppx,dppx,pixel,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
-                    for (y = 0; y < height; y++)                        \
-                    {                                                   \
-                        for (x = 0; x < width; x++)                     \
-                        {                                               \
-                            sppx = src + y * info->s_pitch + x * srcbpp; \
-                            dppx = dst + y * info->d_pitch + x * dstbpp; \
-                            GET_PALETTE_VALS(sppx, srcfmt, sR, sG, sB, sA); \
-                            GET_PIXEL (pixel, dstbpp, dppx);             \
-                            GET_RGB_VALS (pixel, dstfmt, dR, dG, dB, dA); \
-                            _blitop;                                    \
-                            CREATE_PIXEL(dppx, dR, dG, dB, dA, dstbpp, dstfmt); \
-                        }                                               \
-                    }                                                   \
-                }                                                       \
-            }                                                           \
-        }                                                               \
-        else /* srcbpp > 1 */                                           \
-        {                                                               \
-            if (dstbpp == 1)                                            \
-            {                                                           \
-                PRAGMA(omp parallel)                                    \
-                {                                                       \
-                    PRAGMA(omp for private(sppx,dppx,pixel,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \