code
stringlengths
1
1.05M
repo_name
stringlengths
6
83
path
stringlengths
3
242
language
stringclasses
222 values
license
stringclasses
20 values
size
int64
1
1.05M
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" // This is C++/CX code that the WinRT port uses to talk to WASAPI-related // system APIs. The C implementation of these functions, for non-WinRT apps, // is in SDL_wasapi_win32.c. The code in SDL_wasapi.c is used by both standard // Windows and WinRT builds to deal with audio and calls into these functions. #if SDL_AUDIO_DRIVER_WASAPI && defined(__WINRT__) #include <Windows.h> #include <windows.ui.core.h> #include <windows.devices.enumeration.h> #include <windows.media.devices.h> #include <wrl/implements.h> extern "C" { #include "../../core/windows/SDL_windows.h" #include "SDL_audio.h" #include "SDL_timer.h" #include "../SDL_audio_c.h" #include "../SDL_sysaudio.h" #include "SDL_assert.h" } #define COBJMACROS #include <mmdeviceapi.h> #include <audioclient.h> #include "SDL_wasapi.h" using namespace Windows::Devices::Enumeration; using namespace Windows::Media::Devices; using namespace Windows::Foundation; using namespace Microsoft::WRL; class SDL_WasapiDeviceEventHandler { public: SDL_WasapiDeviceEventHandler(const SDL_bool _iscapture); ~SDL_WasapiDeviceEventHandler(); void OnDeviceAdded(DeviceWatcher^ sender, DeviceInformation^ args); void OnDeviceRemoved(DeviceWatcher^ sender, DeviceInformationUpdate^ args); void OnDeviceUpdated(DeviceWatcher^ sender, DeviceInformationUpdate^ args); void OnEnumerationCompleted(DeviceWatcher^ sender, Platform::Object^ args); void OnDefaultRenderDeviceChanged(Platform::Object^ sender, DefaultAudioRenderDeviceChangedEventArgs^ args); void OnDefaultCaptureDeviceChanged(Platform::Object^ sender, DefaultAudioCaptureDeviceChangedEventArgs^ args); SDL_semaphore* completed; private: const SDL_bool iscapture; DeviceWatcher^ watcher; Windows::Foundation::EventRegistrationToken added_handler; Windows::Foundation::EventRegistrationToken removed_handler; Windows::Foundation::EventRegistrationToken updated_handler; Windows::Foundation::EventRegistrationToken completed_handler; Windows::Foundation::EventRegistrationToken default_changed_handler; }; SDL_WasapiDeviceEventHandler::SDL_WasapiDeviceEventHandler(const SDL_bool _iscapture) : iscapture(_iscapture) , completed(SDL_CreateSemaphore(0)) , watcher(DeviceInformation::CreateWatcher(_iscapture ? DeviceClass::AudioCapture : DeviceClass::AudioRender)) { if (!watcher || !completed) return; // uhoh. // !!! FIXME: this doesn't need a lambda here, I think, if I make SDL_WasapiDeviceEventHandler a proper C++/CX class. --ryan. added_handler = watcher->Added += ref new TypedEventHandler<DeviceWatcher^, DeviceInformation^>([this](DeviceWatcher^ sender, DeviceInformation^ args) { OnDeviceAdded(sender, args); } ); removed_handler = watcher->Removed += ref new TypedEventHandler<DeviceWatcher^, DeviceInformationUpdate^>([this](DeviceWatcher^ sender, DeviceInformationUpdate^ args) { OnDeviceRemoved(sender, args); } ); updated_handler = watcher->Updated += ref new TypedEventHandler<DeviceWatcher^, DeviceInformationUpdate^>([this](DeviceWatcher^ sender, DeviceInformationUpdate^ args) { OnDeviceUpdated(sender, args); } ); completed_handler = watcher->EnumerationCompleted += ref new TypedEventHandler<DeviceWatcher^, Platform::Object^>([this](DeviceWatcher^ sender, Platform::Object^ args) { OnEnumerationCompleted(sender, args); } ); if (iscapture) { default_changed_handler = MediaDevice::DefaultAudioCaptureDeviceChanged += ref new TypedEventHandler<Platform::Object^, DefaultAudioCaptureDeviceChangedEventArgs^>([this](Platform::Object^ sender, DefaultAudioCaptureDeviceChangedEventArgs^ args) { OnDefaultCaptureDeviceChanged(sender, args); } ); } else { default_changed_handler = MediaDevice::DefaultAudioRenderDeviceChanged += ref new TypedEventHandler<Platform::Object^, DefaultAudioRenderDeviceChangedEventArgs^>([this](Platform::Object^ sender, DefaultAudioRenderDeviceChangedEventArgs^ args) { OnDefaultRenderDeviceChanged(sender, args); } ); } watcher->Start(); } SDL_WasapiDeviceEventHandler::~SDL_WasapiDeviceEventHandler() { if (watcher) { watcher->Added -= added_handler; watcher->Removed -= removed_handler; watcher->Updated -= updated_handler; watcher->EnumerationCompleted -= completed_handler; watcher->Stop(); watcher = nullptr; } if (completed) { SDL_DestroySemaphore(completed); completed = nullptr; } if (iscapture) { MediaDevice::DefaultAudioCaptureDeviceChanged -= default_changed_handler; } else { MediaDevice::DefaultAudioRenderDeviceChanged -= default_changed_handler; } } void SDL_WasapiDeviceEventHandler::OnDeviceAdded(DeviceWatcher^ sender, DeviceInformation^ info) { SDL_assert(sender == this->watcher); char *utf8dev = WIN_StringToUTF8(info->Name->Data()); if (utf8dev) { WASAPI_AddDevice(this->iscapture, utf8dev, info->Id->Data()); SDL_free(utf8dev); } } void SDL_WasapiDeviceEventHandler::OnDeviceRemoved(DeviceWatcher^ sender, DeviceInformationUpdate^ info) { SDL_assert(sender == this->watcher); WASAPI_RemoveDevice(this->iscapture, info->Id->Data()); } void SDL_WasapiDeviceEventHandler::OnDeviceUpdated(DeviceWatcher^ sender, DeviceInformationUpdate^ args) { SDL_assert(sender == this->watcher); } void SDL_WasapiDeviceEventHandler::OnEnumerationCompleted(DeviceWatcher^ sender, Platform::Object^ args) { SDL_assert(sender == this->watcher); SDL_SemPost(this->completed); } void SDL_WasapiDeviceEventHandler::OnDefaultRenderDeviceChanged(Platform::Object^ sender, DefaultAudioRenderDeviceChangedEventArgs^ args) { SDL_assert(this->iscapture); SDL_AtomicAdd(&WASAPI_DefaultPlaybackGeneration, 1); } void SDL_WasapiDeviceEventHandler::OnDefaultCaptureDeviceChanged(Platform::Object^ sender, DefaultAudioCaptureDeviceChangedEventArgs^ args) { SDL_assert(!this->iscapture); SDL_AtomicAdd(&WASAPI_DefaultCaptureGeneration, 1); } static SDL_WasapiDeviceEventHandler *playback_device_event_handler; static SDL_WasapiDeviceEventHandler *capture_device_event_handler; int WASAPI_PlatformInit(void) { return 0; } void WASAPI_PlatformDeinit(void) { delete playback_device_event_handler; playback_device_event_handler = nullptr; delete capture_device_event_handler; capture_device_event_handler = nullptr; } void WASAPI_EnumerateEndpoints(void) { // DeviceWatchers will fire an Added event for each existing device at // startup, so we don't need to enumerate them separately before // listening for updates. playback_device_event_handler = new SDL_WasapiDeviceEventHandler(SDL_FALSE); capture_device_event_handler = new SDL_WasapiDeviceEventHandler(SDL_TRUE); SDL_SemWait(playback_device_event_handler->completed); SDL_SemWait(capture_device_event_handler->completed); } struct SDL_WasapiActivationHandler : public RuntimeClass< RuntimeClassFlags< ClassicCom >, FtmBase, IActivateAudioInterfaceCompletionHandler > { SDL_WasapiActivationHandler() : device(nullptr) {} STDMETHOD(ActivateCompleted)(IActivateAudioInterfaceAsyncOperation *operation); SDL_AudioDevice *device; }; HRESULT SDL_WasapiActivationHandler::ActivateCompleted(IActivateAudioInterfaceAsyncOperation *async) { // Just set a flag, since we're probably in a different thread. We'll pick it up and init everything on our own thread to prevent races. SDL_AtomicSet(&device->hidden->just_activated, 1); WASAPI_UnrefDevice(device); return S_OK; } void WASAPI_PlatformDeleteActivationHandler(void *handler) { ((SDL_WasapiActivationHandler *) handler)->Release(); } int WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery) { LPCWSTR devid = _this->hidden->devid; Platform::String^ defdevid; if (devid == nullptr) { defdevid = _this->iscapture ? MediaDevice::GetDefaultAudioCaptureId(AudioDeviceRole::Default) : MediaDevice::GetDefaultAudioRenderId(AudioDeviceRole::Default); if (defdevid) { devid = defdevid->Data(); } } SDL_AtomicSet(&_this->hidden->just_activated, 0); ComPtr<SDL_WasapiActivationHandler> handler = Make<SDL_WasapiActivationHandler>(); if (handler == nullptr) { return SDL_SetError("Failed to allocate WASAPI activation handler"); } handler.Get()->AddRef(); // we hold a reference after ComPtr destructs on return, causing a Release, and Release ourselves in WASAPI_PlatformDeleteActivationHandler(), etc. handler.Get()->device = _this; _this->hidden->activation_handler = handler.Get(); WASAPI_RefDevice(_this); /* completion handler will unref it. */ IActivateAudioInterfaceAsyncOperation *async = nullptr; const HRESULT ret = ActivateAudioInterfaceAsync(devid, __uuidof(IAudioClient), nullptr, handler.Get(), &async); if (FAILED(ret) || async == nullptr) { if (async != nullptr) { async->Release(); } handler.Get()->Release(); WASAPI_UnrefDevice(_this); return WIN_SetErrorFromHRESULT("WASAPI can't activate requested audio endpoint", ret); } /* Spin until the async operation is complete. * If we don't PrepDevice before leaving this function, the bug list gets LONG: * - device.spec is not filled with the correct information * - The 'obtained' spec will be wrong for ALLOW_CHANGE properties * - SDL_AudioStreams will/will not be allocated at the right time * - SDL_assert(device->callbackspec.size == device->spec.size) will fail * - When the assert is ignored, skipping or a buffer overflow will occur */ while (!SDL_AtomicCAS(&_this->hidden->just_activated, 1, 0)) { SDL_Delay(1); } HRESULT activateRes = S_OK; IUnknown *iunknown = nullptr; const HRESULT getActivateRes = async->GetActivateResult(&activateRes, &iunknown); async->Release(); if (FAILED(getActivateRes)) { return WIN_SetErrorFromHRESULT("Failed to get WASAPI activate result", getActivateRes); } else if (FAILED(activateRes)) { return WIN_SetErrorFromHRESULT("Failed to activate WASAPI device", activateRes); } iunknown->QueryInterface(IID_PPV_ARGS(&_this->hidden->client)); if (!_this->hidden->client) { return SDL_SetError("Failed to query WASAPI client interface"); } if (WASAPI_PrepDevice(_this, isrecovery) == -1) { return -1; } return 0; } void WASAPI_PlatformThreadInit(_THIS) { // !!! FIXME: set this thread to "Pro Audio" priority. } void WASAPI_PlatformThreadDeinit(_THIS) { // !!! FIXME: set this thread to "Pro Audio" priority. } #endif // SDL_AUDIO_DRIVER_WASAPI && defined(__WINRT__) /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/audio/wasapi/SDL_wasapi_winrt.cpp
C++
apache-2.0
11,750
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #if SDL_AUDIO_DRIVER_WINMM /* Allow access to a raw mixing buffer */ #include "../../core/windows/SDL_windows.h" #include <mmsystem.h> #include "SDL_assert.h" #include "SDL_timer.h" #include "SDL_audio.h" #include "../SDL_audio_c.h" #include "SDL_winmm.h" /* MinGW32 mmsystem.h doesn't include these structures */ #if defined(__MINGW32__) && defined(_MMSYSTEM_H) typedef struct tagWAVEINCAPS2W { WORD wMid; WORD wPid; MMVERSION vDriverVersion; WCHAR szPname[MAXPNAMELEN]; DWORD dwFormats; WORD wChannels; WORD wReserved1; GUID ManufacturerGuid; GUID ProductGuid; GUID NameGuid; } WAVEINCAPS2W,*PWAVEINCAPS2W,*NPWAVEINCAPS2W,*LPWAVEINCAPS2W; typedef struct tagWAVEOUTCAPS2W { WORD wMid; WORD wPid; MMVERSION vDriverVersion; WCHAR szPname[MAXPNAMELEN]; DWORD dwFormats; WORD wChannels; WORD wReserved1; DWORD dwSupport; GUID ManufacturerGuid; GUID ProductGuid; GUID NameGuid; } WAVEOUTCAPS2W,*PWAVEOUTCAPS2W,*NPWAVEOUTCAPS2W,*LPWAVEOUTCAPS2W; #endif /* defined(__MINGW32__) && defined(_MMSYSTEM_H) */ #ifndef WAVE_FORMAT_IEEE_FLOAT #define WAVE_FORMAT_IEEE_FLOAT 0x0003 #endif #define DETECT_DEV_IMPL(iscap, typ, capstyp) \ static void DetectWave##typ##Devs(void) { \ const UINT iscapture = iscap ? 1 : 0; \ const UINT devcount = wave##typ##GetNumDevs(); \ capstyp##2W caps; \ UINT i; \ for (i = 0; i < devcount; i++) { \ if (wave##typ##GetDevCaps(i,(LP##capstyp##W)&caps,sizeof(caps))==MMSYSERR_NOERROR) { \ char *name = WIN_LookupAudioDeviceName(caps.szPname,&caps.NameGuid); \ if (name != NULL) { \ SDL_AddAudioDevice((int) iscapture, name, (void *) ((size_t) i+1)); \ SDL_free(name); \ } \ } \ } \ } DETECT_DEV_IMPL(SDL_FALSE, Out, WAVEOUTCAPS) DETECT_DEV_IMPL(SDL_TRUE, In, WAVEINCAPS) static void WINMM_DetectDevices(void) { DetectWaveInDevs(); DetectWaveOutDevs(); } static void CALLBACK CaptureSound(HWAVEIN hwi, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2) { SDL_AudioDevice *this = (SDL_AudioDevice *) dwInstance; /* Only service "buffer is filled" messages */ if (uMsg != WIM_DATA) return; /* Signal that we have a new buffer of data */ ReleaseSemaphore(this->hidden->audio_sem, 1, NULL); } /* The Win32 callback for filling the WAVE device */ static void CALLBACK FillSound(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2) { SDL_AudioDevice *this = (SDL_AudioDevice *) dwInstance; /* Only service "buffer done playing" messages */ if (uMsg != WOM_DONE) return; /* Signal that we are done playing a buffer */ ReleaseSemaphore(this->hidden->audio_sem, 1, NULL); } static int SetMMerror(char *function, MMRESULT code) { int len; char errbuf[MAXERRORLENGTH]; wchar_t werrbuf[MAXERRORLENGTH]; SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: ", function); len = SDL_static_cast(int, SDL_strlen(errbuf)); waveOutGetErrorText(code, werrbuf, MAXERRORLENGTH - len); WideCharToMultiByte(CP_ACP, 0, werrbuf, -1, errbuf + len, MAXERRORLENGTH - len, NULL, NULL); return SDL_SetError("%s", errbuf); } static void WINMM_WaitDevice(_THIS) { /* Wait for an audio chunk to finish */ WaitForSingleObject(this->hidden->audio_sem, INFINITE); } static Uint8 * WINMM_GetDeviceBuf(_THIS) { return (Uint8 *) (this->hidden-> wavebuf[this->hidden->next_buffer].lpData); } static void WINMM_PlayDevice(_THIS) { /* Queue it up */ waveOutWrite(this->hidden->hout, &this->hidden->wavebuf[this->hidden->next_buffer], sizeof(this->hidden->wavebuf[0])); this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS; } static int WINMM_CaptureFromDevice(_THIS, void *buffer, int buflen) { const int nextbuf = this->hidden->next_buffer; MMRESULT result; SDL_assert(buflen == this->spec.size); /* Wait for an audio chunk to finish */ WaitForSingleObject(this->hidden->audio_sem, INFINITE); /* Copy it to caller's buffer... */ SDL_memcpy(buffer, this->hidden->wavebuf[nextbuf].lpData, this->spec.size); /* requeue the buffer that just finished. */ result = waveInAddBuffer(this->hidden->hin, &this->hidden->wavebuf[nextbuf], sizeof (this->hidden->wavebuf[nextbuf])); if (result != MMSYSERR_NOERROR) { return -1; /* uhoh! Disable the device. */ } /* queue the next buffer in sequence, next time. */ this->hidden->next_buffer = (nextbuf + 1) % NUM_BUFFERS; return this->spec.size; } static void WINMM_FlushCapture(_THIS) { /* Wait for an audio chunk to finish */ if (WaitForSingleObject(this->hidden->audio_sem, 0) == WAIT_OBJECT_0) { const int nextbuf = this->hidden->next_buffer; /* requeue the buffer that just finished without reading from it. */ waveInAddBuffer(this->hidden->hin, &this->hidden->wavebuf[nextbuf], sizeof (this->hidden->wavebuf[nextbuf])); this->hidden->next_buffer = (nextbuf + 1) % NUM_BUFFERS; } } static void WINMM_CloseDevice(_THIS) { int i; if (this->hidden->hout) { waveOutReset(this->hidden->hout); /* Clean up mixing buffers */ for (i = 0; i < NUM_BUFFERS; ++i) { if (this->hidden->wavebuf[i].dwUser != 0xFFFF) { waveOutUnprepareHeader(this->hidden->hout, &this->hidden->wavebuf[i], sizeof (this->hidden->wavebuf[i])); } } waveOutClose(this->hidden->hout); } if (this->hidden->hin) { waveInReset(this->hidden->hin); /* Clean up mixing buffers */ for (i = 0; i < NUM_BUFFERS; ++i) { if (this->hidden->wavebuf[i].dwUser != 0xFFFF) { waveInUnprepareHeader(this->hidden->hin, &this->hidden->wavebuf[i], sizeof (this->hidden->wavebuf[i])); } } waveInClose(this->hidden->hin); } if (this->hidden->audio_sem) { CloseHandle(this->hidden->audio_sem); } SDL_free(this->hidden->mixbuf); SDL_free(this->hidden); } static SDL_bool PrepWaveFormat(_THIS, UINT devId, WAVEFORMATEX *pfmt, const int iscapture) { SDL_zerop(pfmt); if (SDL_AUDIO_ISFLOAT(this->spec.format)) { pfmt->wFormatTag = WAVE_FORMAT_IEEE_FLOAT; } else { pfmt->wFormatTag = WAVE_FORMAT_PCM; } pfmt->wBitsPerSample = SDL_AUDIO_BITSIZE(this->spec.format); pfmt->nChannels = this->spec.channels; pfmt->nSamplesPerSec = this->spec.freq; pfmt->nBlockAlign = pfmt->nChannels * (pfmt->wBitsPerSample / 8); pfmt->nAvgBytesPerSec = pfmt->nSamplesPerSec * pfmt->nBlockAlign; if (iscapture) { return (waveInOpen(0, devId, pfmt, 0, 0, WAVE_FORMAT_QUERY) == 0); } else { return (waveOutOpen(0, devId, pfmt, 0, 0, WAVE_FORMAT_QUERY) == 0); } } static int WINMM_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); int valid_datatype = 0; MMRESULT result; WAVEFORMATEX waveformat; UINT devId = WAVE_MAPPER; /* WAVE_MAPPER == choose system's default */ UINT i; if (handle != NULL) { /* specific device requested? */ /* -1 because we increment the original value to avoid NULL. */ const size_t val = ((size_t) handle) - 1; devId = (UINT) val; } /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden)); if (this->hidden == NULL) { return SDL_OutOfMemory(); } SDL_zerop(this->hidden); /* Initialize the wavebuf structures for closing */ for (i = 0; i < NUM_BUFFERS; ++i) this->hidden->wavebuf[i].dwUser = 0xFFFF; if (this->spec.channels > 2) this->spec.channels = 2; /* !!! FIXME: is this right? */ while ((!valid_datatype) && (test_format)) { switch (test_format) { case AUDIO_U8: case AUDIO_S16: case AUDIO_S32: case AUDIO_F32: this->spec.format = test_format; if (PrepWaveFormat(this, devId, &waveformat, iscapture)) { valid_datatype = 1; } else { test_format = SDL_NextAudioFormat(); } break; default: test_format = SDL_NextAudioFormat(); break; } } if (!valid_datatype) { return SDL_SetError("Unsupported audio format"); } /* Update the fragment size as size in bytes */ SDL_CalculateAudioSpec(&this->spec); /* Open the audio device */ if (iscapture) { result = waveInOpen(&this->hidden->hin, devId, &waveformat, (DWORD_PTR) CaptureSound, (DWORD_PTR) this, CALLBACK_FUNCTION); if (result != MMSYSERR_NOERROR) { return SetMMerror("waveInOpen()", result); } } else { result = waveOutOpen(&this->hidden->hout, devId, &waveformat, (DWORD_PTR) FillSound, (DWORD_PTR) this, CALLBACK_FUNCTION); if (result != MMSYSERR_NOERROR) { return SetMMerror("waveOutOpen()", result); } } #ifdef SOUND_DEBUG /* Check the sound device we retrieved */ { if (iscapture) { WAVEINCAPS caps; result = waveInGetDevCaps((UINT) this->hidden->hout, &caps, sizeof (caps)); if (result != MMSYSERR_NOERROR) { return SetMMerror("waveInGetDevCaps()", result); } printf("Audio device: %s\n", caps.szPname); } else { WAVEOUTCAPS caps; result = waveOutGetDevCaps((UINT) this->hidden->hout, &caps, sizeof(caps)); if (result != MMSYSERR_NOERROR) { return SetMMerror("waveOutGetDevCaps()", result); } printf("Audio device: %s\n", caps.szPname); } } #endif /* Create the audio buffer semaphore */ this->hidden->audio_sem = CreateSemaphore(NULL, iscapture ? 0 : NUM_BUFFERS - 1, NUM_BUFFERS, NULL); if (this->hidden->audio_sem == NULL) { return SDL_SetError("Couldn't create semaphore"); } /* Create the sound buffers */ this->hidden->mixbuf = (Uint8 *) SDL_malloc(NUM_BUFFERS * this->spec.size); if (this->hidden->mixbuf == NULL) { return SDL_OutOfMemory(); } SDL_zeroa(this->hidden->wavebuf); for (i = 0; i < NUM_BUFFERS; ++i) { this->hidden->wavebuf[i].dwBufferLength = this->spec.size; this->hidden->wavebuf[i].dwFlags = WHDR_DONE; this->hidden->wavebuf[i].lpData = (LPSTR) & this->hidden->mixbuf[i * this->spec.size]; if (iscapture) { result = waveInPrepareHeader(this->hidden->hin, &this->hidden->wavebuf[i], sizeof(this->hidden->wavebuf[i])); if (result != MMSYSERR_NOERROR) { return SetMMerror("waveInPrepareHeader()", result); } result = waveInAddBuffer(this->hidden->hin, &this->hidden->wavebuf[i], sizeof(this->hidden->wavebuf[i])); if (result != MMSYSERR_NOERROR) { return SetMMerror("waveInAddBuffer()", result); } } else { result = waveOutPrepareHeader(this->hidden->hout, &this->hidden->wavebuf[i], sizeof(this->hidden->wavebuf[i])); if (result != MMSYSERR_NOERROR) { return SetMMerror("waveOutPrepareHeader()", result); } } } if (iscapture) { result = waveInStart(this->hidden->hin); if (result != MMSYSERR_NOERROR) { return SetMMerror("waveInStart()", result); } } return 0; /* Ready to go! */ } static int WINMM_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ impl->DetectDevices = WINMM_DetectDevices; impl->OpenDevice = WINMM_OpenDevice; impl->PlayDevice = WINMM_PlayDevice; impl->WaitDevice = WINMM_WaitDevice; impl->GetDeviceBuf = WINMM_GetDeviceBuf; impl->CaptureFromDevice = WINMM_CaptureFromDevice; impl->FlushCapture = WINMM_FlushCapture; impl->CloseDevice = WINMM_CloseDevice; impl->HasCaptureSupport = SDL_TRUE; return 1; /* this audio target is available. */ } AudioBootStrap WINMM_bootstrap = { "winmm", "Windows Waveform Audio", WINMM_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_WINMM */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/audio/winmm/SDL_winmm.c
C
apache-2.0
14,267
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifndef SDL_winmm_h_ #define SDL_winmm_h_ #include "../SDL_sysaudio.h" /* Hidden "this" pointer for the audio functions */ #define _THIS SDL_AudioDevice *this #define NUM_BUFFERS 2 /* -- Don't lower this! */ struct SDL_PrivateAudioData { HWAVEOUT hout; HWAVEIN hin; HANDLE audio_sem; Uint8 *mixbuf; /* The raw allocated mixing buffer */ WAVEHDR wavebuf[NUM_BUFFERS]; /* Wave audio fragments */ int next_buffer; }; #endif /* SDL_winmm_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/audio/winmm/SDL_winmm.h
C
apache-2.0
1,508
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifdef SDL_INPUT_LINUXEV #include "uinput.h" #include "input/input.h" /* This is based on the linux joystick driver */ /* References: https://www.kernel.org/doc/Documentation/input/input.txt * https://www.kernel.org/doc/Documentation/input/event-codes.txt * /usr/include/linux/input.h * The evtest application is also useful to debug the protocol */ #include "SDL_evdev.h" #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> #include "SDL.h" #include "SDL_assert.h" #include "SDL_endian.h" #include "SDL_scancode.h" #include "../../events/SDL_events_c.h" #include "../../events/scancodes_linux.h" /* adds linux_scancode_table */ #include "../../core/linux/SDL_udev.h" /* These are not defined in older Linux kernel headers */ #ifndef SYN_DROPPED #define SYN_DROPPED 3 #endif #ifndef ABS_MT_SLOT #define ABS_MT_SLOT 0x2f #define ABS_MT_POSITION_X 0x35 #define ABS_MT_POSITION_Y 0x36 #define ABS_MT_TRACKING_ID 0x39 #define ABS_MT_PRESSURE 0x3a #endif //#define DEBUG_UINPUT typedef struct SDL_EVDEV_PrivateData { int ref_count; int event_count; int num_devices; SDL_mutex *mutex; SDL_cond *cond; } SDL_EVDEV_PrivateData; #undef _THIS #define _THIS SDL_EVDEV_PrivateData *_this static _THIS = NULL; //#define USE_TOUCH static int SDL_EVDEV_device_removed(const char *dev_path); #if SDL_USE_LIBUDEV static int SDL_EVDEV_device_added(const char *dev_path, int udev_class); static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *dev_path); #endif /* SDL_USE_LIBUDEV */ static Uint8 EVDEV_MouseButtons[] = { SDL_BUTTON_LEFT, /* BTN_LEFT 0x110 */ SDL_BUTTON_RIGHT, /* BTN_RIGHT 0x111 */ SDL_BUTTON_MIDDLE, /* BTN_MIDDLE 0x112 */ SDL_BUTTON_X1, /* BTN_SIDE 0x113 */ SDL_BUTTON_X2, /* BTN_EXTRA 0x114 */ SDL_BUTTON_X2 + 1, /* BTN_FORWARD 0x115 */ SDL_BUTTON_X2 + 2, /* BTN_BACK 0x116 */ SDL_BUTTON_X2 + 3 /* BTN_TASK 0x117 */ }; static int SDL_EVDEV_SetRelativeMouseMode(SDL_bool enabled) { /* Mice already send relative events through this interface */ return 0; } static void uinput_callback(uinput_event_type_t event, void* pdata, uint32_t len) { int mouse_button; SDL_Mouse *mouse; uinput_event_t* events; float fx, fy; float norm_pressure; if (!_this) { return; } if (!pdata) return; events = (uinput_event_t*)pdata; mouse = SDL_GetMouse(); mouse_button = 1; //use SDL_BUTTON_LEFT #ifdef USE_TOUCH fx = (float)events->abs.x / (float)800.0f; fy = (float)events->abs.y / (float)480.0f; norm_pressure = 1.0f; #endif switch (events->type) { case UINPUT_EVENT_TOUCH_DOWN: { #ifdef USE_TOUCH SDL_SendTouch(1, 1, NULL, SDL_TRUE, fx, fy, norm_pressure); #else SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_PRESSED, EVDEV_MouseButtons[mouse_button]); #endif break; } case UINPUT_EVENT_TOUCH_UP: { #ifdef USE_TOUCH SDL_SendTouch(1, 1, NULL, SDL_FALSE, fx, fy, norm_pressure); #else SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_RELEASED, EVDEV_MouseButtons[mouse_button]); #endif break; } case UINPUT_EVENT_TOUCH_MOTION: { #ifdef USE_TOUCH printf("fx: %.1f, fy: %.1f\n", fx, fy); SDL_SendTouchMotion(1, 1, NULL, fx, fy, norm_pressure); #else SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, events->abs.x, events->abs.y); #endif break; } } #if defined(DEBUG_UINPUT) printf("uintput callback type=%d", events->type); if (events->type >= UINPUT_EVENT_TOUCH_DOWN) { printf("uintput callback touch point(%d,%d)", events->abs.x, events->abs.y); } else { printf("uintput callback key code=%d", events->key_code); } #endif /*send event to uplayer*/ SDL_LockMutex(_this->mutex); SDL_CondSignal(_this->cond); SDL_UnlockMutex(_this->mutex); } int SDL_EVDEV_Init(void) { if (_this == NULL) { _this = (SDL_EVDEV_PrivateData*)SDL_calloc(1, sizeof(*_this)); if (_this == NULL) { return SDL_OutOfMemory(); } } _this->mutex = SDL_CreateMutex(); _this->cond = SDL_CreateCond(); SDL_GetMouse()->SetRelativeMouseMode = SDL_EVDEV_SetRelativeMouseMode; _this->ref_count += 1; _this->event_count = 0; uinput_service_init(uinput_callback); return 0; } void SDL_EVDEV_Quit(void) { if (_this == NULL) { return; } _this->ref_count -= 1; if (_this->mutex != NULL) SDL_DestroyMutex(_this->mutex); if (_this->cond != NULL) SDL_DestroyCond(_this->cond); if (_this->ref_count < 1) { #if SDL_USE_LIBUDEV SDL_UDEV_DelCallback(SDL_EVDEV_udev_callback); SDL_UDEV_Quit(); #endif /* SDL_USE_LIBUDEV */ SDL_assert(_this->num_devices == 0); SDL_free(_this); _this = NULL; } } #if SDL_USE_LIBUDEV static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class, const char* dev_path) { if (dev_path == NULL) { return; } switch(udev_event) { case SDL_UDEV_DEVICEADDED: if (!(udev_class & (SDL_UDEV_DEVICE_MOUSE | SDL_UDEV_DEVICE_KEYBOARD | SDL_UDEV_DEVICE_TOUCHSCREEN))) return; SDL_EVDEV_device_added(dev_path, udev_class); break; case SDL_UDEV_DEVICEREMOVED: SDL_EVDEV_device_removed(dev_path); break; default: break; } } #endif /* SDL_USE_LIBUDEV */ void SDL_EVDEV_Poll(void) { SDL_LockMutex(_this->mutex); if (!SDL_HasEvents(SDL_FIRSTEVENT, SDL_LASTEVENT)) SDL_CondWait(_this->cond, _this->mutex); SDL_UnlockMutex(_this->mutex); } #ifdef SDL_USE_LIBUDEV static int SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item) { int ret, i; unsigned long xreq, yreq; char name[64]; struct input_absinfo abs_info; if (!item->is_touchscreen) return 0; item->touchscreen_data = SDL_calloc(1, sizeof(*item->touchscreen_data)); if (item->touchscreen_data == NULL) return SDL_OutOfMemory(); ret = ioctl(item->fd, EVIOCGNAME(sizeof(name)), name); if (ret < 0) { SDL_free(item->touchscreen_data); return SDL_SetError("Failed to get evdev touchscreen name"); } item->touchscreen_data->name = SDL_strdup(name); if (item->touchscreen_data->name == NULL) { SDL_free(item->touchscreen_data); return SDL_OutOfMemory(); } ret = ioctl(item->fd, EVIOCGABS(ABS_MT_SLOT), &abs_info); if (ret < 0) { SDL_free(item->touchscreen_data->name); SDL_free(item->touchscreen_data); return SDL_SetError("Failed to get evdev touchscreen limits"); } if (abs_info.maximum == 0) { item->touchscreen_data->max_slots = 1; xreq = EVIOCGABS(ABS_X); yreq = EVIOCGABS(ABS_Y); } else { item->touchscreen_data->max_slots = abs_info.maximum + 1; xreq = EVIOCGABS(ABS_MT_POSITION_X); yreq = EVIOCGABS(ABS_MT_POSITION_Y); } ret = ioctl(item->fd, xreq, &abs_info); if (ret < 0) { SDL_free(item->touchscreen_data->name); SDL_free(item->touchscreen_data); return SDL_SetError("Failed to get evdev touchscreen limits"); } item->touchscreen_data->min_x = abs_info.minimum; item->touchscreen_data->max_x = abs_info.maximum; item->touchscreen_data->range_x = abs_info.maximum - abs_info.minimum; ret = ioctl(item->fd, yreq, &abs_info); if (ret < 0) { SDL_free(item->touchscreen_data->name); SDL_free(item->touchscreen_data); return SDL_SetError("Failed to get evdev touchscreen limits"); } item->touchscreen_data->min_y = abs_info.minimum; item->touchscreen_data->max_y = abs_info.maximum; item->touchscreen_data->range_y = abs_info.maximum - abs_info.minimum; ret = ioctl(item->fd, EVIOCGABS(ABS_MT_PRESSURE), &abs_info); if (ret < 0) { SDL_free(item->touchscreen_data->name); SDL_free(item->touchscreen_data); return SDL_SetError("Failed to get evdev touchscreen limits"); } item->touchscreen_data->min_pressure = abs_info.minimum; item->touchscreen_data->max_pressure = abs_info.maximum; item->touchscreen_data->range_pressure = abs_info.maximum - abs_info.minimum; item->touchscreen_data->slots = SDL_calloc( item->touchscreen_data->max_slots, sizeof(*item->touchscreen_data->slots)); if (item->touchscreen_data->slots == NULL) { SDL_free(item->touchscreen_data->name); SDL_free(item->touchscreen_data); return SDL_OutOfMemory(); } for(i = 0; i < item->touchscreen_data->max_slots; i++) { item->touchscreen_data->slots[i].tracking_id = -1; } ret = SDL_AddTouch(item->fd, /* I guess our fd is unique enough */ SDL_TOUCH_DEVICE_DIRECT, item->touchscreen_data->name); if (ret < 0) { SDL_free(item->touchscreen_data->slots); SDL_free(item->touchscreen_data->name); SDL_free(item->touchscreen_data); return ret; } return 0; } #endif /* SDL_USE_LIBUDEV */ #if SDL_USE_LIBUDEV static int SDL_EVDEV_device_added(const char *dev_path, int udev_class) { int ret; SDL_evdevlist_item *item; /* Check to make sure it's not already in list. */ for (item = _this->first; item != NULL; item = item->next) { if (SDL_strcmp(dev_path, item->path) == 0) { return -1; /* already have this one */ } } item = (SDL_evdevlist_item *) SDL_calloc(1, sizeof (SDL_evdevlist_item)); if (item == NULL) { return SDL_OutOfMemory(); } item->fd = open(dev_path, O_RDONLY | O_NONBLOCK); if (item->fd < 0) { SDL_free(item); return SDL_SetError("Unable to open %s", dev_path); } item->path = SDL_strdup(dev_path); if (item->path == NULL) { close(item->fd); SDL_free(item); return SDL_OutOfMemory(); } if (udev_class & SDL_UDEV_DEVICE_TOUCHSCREEN) { item->is_touchscreen = 1; if ((ret = SDL_EVDEV_init_touchscreen(item)) < 0) { close(item->fd); SDL_free(item); return ret; } } if (_this->last == NULL) { _this->first = _this->last = item; } else { _this->last->next = item; _this->last = item; } SDL_EVDEV_sync_device(item); return _this->num_devices++; } #endif /* SDL_USE_LIBUDEV */ #endif /* SDL_INPUT_LINUXEV */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/alios/SDL_evdev.c
C
apache-2.0
11,802
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifndef SDL_evdev_h_ #define SDL_evdev_h_ #ifdef SDL_INPUT_LINUXEV #include "SDL_events.h" extern int SDL_EVDEV_Init(void); extern void SDL_EVDEV_Quit(void); extern void SDL_EVDEV_Poll(void); #endif /* SDL_INPUT_LINUXEV */ #endif /* SDL_evdev_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/alios/SDL_evdev.h
C
apache-2.0
1,263
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #include "SDL_stdinc.h" #include "SDL_assert.h" #include "SDL_atomic.h" #include "SDL_hints.h" #include "SDL_main.h" #include "SDL_timer.h" #ifdef __ANDROID__ #include "SDL_system.h" #include "SDL_android.h" #include "keyinfotable.h" #include "../../events/SDL_events_c.h" #include "../../video/android/SDL_androidkeyboard.h" #include "../../video/android/SDL_androidmouse.h" #include "../../video/android/SDL_androidtouch.h" #include "../../video/android/SDL_androidvideo.h" #include "../../video/android/SDL_androidwindow.h" #include "../../joystick/android/SDL_sysjoystick_c.h" #include "../../haptic/android/SDL_syshaptic_c.h" #include <android/log.h> #include <android/configuration.h> #include <android/asset_manager_jni.h> #include <sys/system_properties.h> #include <pthread.h> #include <sys/types.h> #include <unistd.h> #include <dlfcn.h> #define SDL_JAVA_PREFIX org_libsdl_app #define CONCAT1(prefix, class, function) CONCAT2(prefix, class, function) #define CONCAT2(prefix, class, function) Java_ ## prefix ## _ ## class ## _ ## function #define SDL_JAVA_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, SDLActivity, function) #define SDL_JAVA_AUDIO_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, SDLAudioManager, function) #define SDL_JAVA_CONTROLLER_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, SDLControllerManager, function) #define SDL_JAVA_INTERFACE_INPUT_CONNECTION(function) CONCAT1(SDL_JAVA_PREFIX, SDLInputConnection, function) /* Audio encoding definitions */ #define ENCODING_PCM_8BIT 3 #define ENCODING_PCM_16BIT 2 #define ENCODING_PCM_FLOAT 4 /* Java class SDLActivity */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)( JNIEnv *env, jclass cls); JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)( JNIEnv *env, jclass cls, jstring library, jstring function, jobject array); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)( JNIEnv *env, jclass jcls, jstring filename); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetScreenResolution)( JNIEnv *env, jclass jcls, jint surfaceWidth, jint surfaceHeight, jint deviceWidth, jint deviceHeight, jint format, jfloat rate); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)( JNIEnv *env, jclass cls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceCreated)( JNIEnv *env, jclass jcls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)( JNIEnv *env, jclass jcls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed)( JNIEnv *env, jclass jcls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyDown)( JNIEnv *env, jclass jcls, jint keycode); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyUp)( JNIEnv *env, jclass jcls, jint keycode); JNIEXPORT jboolean JNICALL SDL_JAVA_INTERFACE(onNativeSoftReturnKey)( JNIEnv *env, jclass jcls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyboardFocusLost)( JNIEnv *env, jclass jcls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeTouch)( JNIEnv *env, jclass jcls, jint touch_device_id_in, jint pointer_finger_id_in, jint action, jfloat x, jfloat y, jfloat p); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeMouse)( JNIEnv *env, jclass jcls, jint button, jint action, jfloat x, jfloat y, jboolean relative); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeAccel)( JNIEnv *env, jclass jcls, jfloat x, jfloat y, jfloat z); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeClipboardChanged)( JNIEnv *env, jclass jcls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)( JNIEnv *env, jclass cls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeLocaleChanged)( JNIEnv *env, jclass cls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSendQuit)( JNIEnv *env, jclass cls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeQuit)( JNIEnv *env, jclass cls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePause)( JNIEnv *env, jclass cls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeResume)( JNIEnv *env, jclass cls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeFocusChanged)( JNIEnv *env, jclass cls, jboolean hasFocus); JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetHint)( JNIEnv *env, jclass cls, jstring name); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)( JNIEnv *env, jclass cls, jstring name, jstring value); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeOrientationChanged)( JNIEnv *env, jclass cls, jint orientation); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeAddTouch)( JNIEnv* env, jclass cls, jint touchId, jstring name); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePermissionResult)( JNIEnv* env, jclass cls, jint requestCode, jboolean result); static JNINativeMethod SDLActivity_tab[] = { { "nativeSetupJNI", "()I", SDL_JAVA_INTERFACE(nativeSetupJNI) }, { "nativeRunMain", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)I", SDL_JAVA_INTERFACE(nativeRunMain) }, { "onNativeDropFile", "(Ljava/lang/String;)V", SDL_JAVA_INTERFACE(onNativeDropFile) }, { "nativeSetScreenResolution", "(IIIIIF)V", SDL_JAVA_INTERFACE(nativeSetScreenResolution) }, { "onNativeResize", "()V", SDL_JAVA_INTERFACE(onNativeResize) }, { "onNativeSurfaceCreated", "()V", SDL_JAVA_INTERFACE(onNativeSurfaceCreated) }, { "onNativeSurfaceChanged", "()V", SDL_JAVA_INTERFACE(onNativeSurfaceChanged) }, { "onNativeSurfaceDestroyed", "()V", SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed) }, { "onNativeKeyDown", "(I)V", SDL_JAVA_INTERFACE(onNativeKeyDown) }, { "onNativeKeyUp", "(I)V", SDL_JAVA_INTERFACE(onNativeKeyUp) }, { "onNativeSoftReturnKey", "()Z", SDL_JAVA_INTERFACE(onNativeSoftReturnKey) }, { "onNativeKeyboardFocusLost", "()V", SDL_JAVA_INTERFACE(onNativeKeyboardFocusLost) }, { "onNativeTouch", "(IIIFFF)V", SDL_JAVA_INTERFACE(onNativeTouch) }, { "onNativeMouse", "(IIFFZ)V", SDL_JAVA_INTERFACE(onNativeMouse) }, { "onNativeAccel", "(FFF)V", SDL_JAVA_INTERFACE(onNativeAccel) }, { "onNativeClipboardChanged", "()V", SDL_JAVA_INTERFACE(onNativeClipboardChanged) }, { "nativeLowMemory", "()V", SDL_JAVA_INTERFACE(nativeLowMemory) }, { "onNativeLocaleChanged", "()V", SDL_JAVA_INTERFACE(onNativeLocaleChanged) }, { "nativeSendQuit", "()V", SDL_JAVA_INTERFACE(nativeSendQuit) }, { "nativeQuit", "()V", SDL_JAVA_INTERFACE(nativeQuit) }, { "nativePause", "()V", SDL_JAVA_INTERFACE(nativePause) }, { "nativeResume", "()V", SDL_JAVA_INTERFACE(nativeResume) }, { "nativeFocusChanged", "(Z)V", SDL_JAVA_INTERFACE(nativeFocusChanged) }, { "nativeGetHint", "(Ljava/lang/String;)Ljava/lang/String;", SDL_JAVA_INTERFACE(nativeGetHint) }, { "nativeSetenv", "(Ljava/lang/String;Ljava/lang/String;)V", SDL_JAVA_INTERFACE(nativeSetenv) }, { "onNativeOrientationChanged", "(I)V", SDL_JAVA_INTERFACE(onNativeOrientationChanged) }, { "nativeAddTouch", "(ILjava/lang/String;)V", SDL_JAVA_INTERFACE(nativeAddTouch) }, { "nativePermissionResult", "(IZ)V", SDL_JAVA_INTERFACE(nativePermissionResult) } }; /* Java class SDLInputConnection */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText)( JNIEnv *env, jclass cls, jstring text, jint newCursorPosition); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancodeForUnichar)( JNIEnv *env, jclass cls, jchar chUnicode); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText)( JNIEnv *env, jclass cls, jstring text, jint newCursorPosition); static JNINativeMethod SDLInputConnection_tab[] = { { "nativeCommitText", "(Ljava/lang/String;I)V", SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText) }, { "nativeGenerateScancodeForUnichar", "(C)V", SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancodeForUnichar) }, { "nativeSetComposingText", "(Ljava/lang/String;I)V", SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText) } }; /* Java class SDLAudioManager */ JNIEXPORT void JNICALL SDL_JAVA_AUDIO_INTERFACE(nativeSetupJNI)( JNIEnv *env, jclass jcls); static JNINativeMethod SDLAudioManager_tab[] = { { "nativeSetupJNI", "()I", SDL_JAVA_AUDIO_INTERFACE(nativeSetupJNI) } }; /* Java class SDLControllerManager */ JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeSetupJNI)( JNIEnv *env, jclass jcls); JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadDown)( JNIEnv *env, jclass jcls, jint device_id, jint keycode); JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadUp)( JNIEnv *env, jclass jcls, jint device_id, jint keycode); JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeJoy)( JNIEnv *env, jclass jcls, jint device_id, jint axis, jfloat value); JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeHat)( JNIEnv *env, jclass jcls, jint device_id, jint hat_id, jint x, jint y); JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddJoystick)( JNIEnv *env, jclass jcls, jint device_id, jstring device_name, jstring device_desc, jint vendor_id, jint product_id, jboolean is_accelerometer, jint button_mask, jint naxes, jint nhats, jint nballs); JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveJoystick)( JNIEnv *env, jclass jcls, jint device_id); JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddHaptic)( JNIEnv *env, jclass jcls, jint device_id, jstring device_name); JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveHaptic)( JNIEnv *env, jclass jcls, jint device_id); static JNINativeMethod SDLControllerManager_tab[] = { { "nativeSetupJNI", "()I", SDL_JAVA_CONTROLLER_INTERFACE(nativeSetupJNI) }, { "onNativePadDown", "(II)I", SDL_JAVA_CONTROLLER_INTERFACE(onNativePadDown) }, { "onNativePadUp", "(II)I", SDL_JAVA_CONTROLLER_INTERFACE(onNativePadUp) }, { "onNativeJoy", "(IIF)V", SDL_JAVA_CONTROLLER_INTERFACE(onNativeJoy) }, { "onNativeHat", "(IIII)V", SDL_JAVA_CONTROLLER_INTERFACE(onNativeHat) }, { "nativeAddJoystick", "(ILjava/lang/String;Ljava/lang/String;IIZIIII)I", SDL_JAVA_CONTROLLER_INTERFACE(nativeAddJoystick) }, { "nativeRemoveJoystick", "(I)I", SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveJoystick) }, { "nativeAddHaptic", "(ILjava/lang/String;)I", SDL_JAVA_CONTROLLER_INTERFACE(nativeAddHaptic) }, { "nativeRemoveHaptic", "(I)I", SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveHaptic) } }; /* Uncomment this to log messages entering and exiting methods in this file */ /* #define DEBUG_JNI */ static void checkJNIReady(void); /******************************************************************************* This file links the Java side of Android with libsdl *******************************************************************************/ #include <jni.h> /******************************************************************************* Globals *******************************************************************************/ static pthread_key_t mThreadKey; static pthread_once_t key_once = PTHREAD_ONCE_INIT; static JavaVM *mJavaVM = NULL; /* Main activity */ static jclass mActivityClass; /* method signatures */ static jmethodID midClipboardGetText; static jmethodID midClipboardHasText; static jmethodID midClipboardSetText; static jmethodID midCreateCustomCursor; static jmethodID midGetContext; static jmethodID midGetDisplayDPI; static jmethodID midGetManifestEnvironmentVariables; static jmethodID midGetNativeSurface; static jmethodID midInitTouch; static jmethodID midIsAndroidTV; static jmethodID midIsChromebook; static jmethodID midIsDeXMode; static jmethodID midIsScreenKeyboardShown; static jmethodID midIsTablet; static jmethodID midManualBackButton; static jmethodID midMinimizeWindow; static jmethodID midOpenAPKExpansionInputStream; static jmethodID midRequestPermission; static jmethodID midSendMessage; static jmethodID midSetActivityTitle; static jmethodID midSetCustomCursor; static jmethodID midSetOrientation; static jmethodID midSetRelativeMouseEnabled; static jmethodID midSetSurfaceViewFormat; static jmethodID midSetSystemCursor; static jmethodID midSetWindowStyle; static jmethodID midShouldMinimizeOnFocusLoss; static jmethodID midShowTextInput; static jmethodID midSupportsRelativeMouse; /* audio manager */ static jclass mAudioManagerClass; /* method signatures */ static jmethodID midAudioOpen; static jmethodID midAudioWriteByteBuffer; static jmethodID midAudioWriteShortBuffer; static jmethodID midAudioWriteFloatBuffer; static jmethodID midAudioClose; static jmethodID midCaptureOpen; static jmethodID midCaptureReadByteBuffer; static jmethodID midCaptureReadShortBuffer; static jmethodID midCaptureReadFloatBuffer; static jmethodID midCaptureClose; static jmethodID midAudioSetThreadPriority; /* controller manager */ static jclass mControllerManagerClass; /* method signatures */ static jmethodID midPollInputDevices; static jmethodID midPollHapticDevices; static jmethodID midHapticRun; static jmethodID midHapticStop; /* Accelerometer data storage */ static SDL_DisplayOrientation displayOrientation; static float fLastAccelerometer[3]; static SDL_bool bHasNewData; static SDL_bool bHasEnvironmentVariables; static SDL_atomic_t bPermissionRequestPending; static SDL_bool bPermissionRequestResult; /* Android AssetManager */ static void Internal_Android_Create_AssetManager(void); static void Internal_Android_Destroy_AssetManager(void); static AAssetManager *asset_manager = NULL; static jobject javaAssetManagerRef = 0; /******************************************************************************* Functions called by JNI *******************************************************************************/ /* From http://developer.android.com/guide/practices/jni.html * All threads are Linux threads, scheduled by the kernel. * They're usually started from managed code (using Thread.start), but they can also be created elsewhere and then * attached to the JavaVM. For example, a thread started with pthread_create can be attached with the * JNI AttachCurrentThread or AttachCurrentThreadAsDaemon functions. Until a thread is attached, it has no JNIEnv, * and cannot make JNI calls. * Attaching a natively-created thread causes a java.lang.Thread object to be constructed and added to the "main" * ThreadGroup, making it visible to the debugger. Calling AttachCurrentThread on an already-attached thread * is a no-op. * Note: You can call this function any number of times for the same thread, there's no harm in it */ /* From http://developer.android.com/guide/practices/jni.html * Threads attached through JNI must call DetachCurrentThread before they exit. If coding this directly is awkward, * in Android 2.0 (Eclair) and higher you can use pthread_key_create to define a destructor function that will be * called before the thread exits, and call DetachCurrentThread from there. (Use that key with pthread_setspecific * to store the JNIEnv in thread-local-storage; that way it'll be passed into your destructor as the argument.) * Note: The destructor is not called unless the stored value is != NULL * Note: You can call this function any number of times for the same thread, there's no harm in it * (except for some lost CPU cycles) */ /* Set local storage value */ static int Android_JNI_SetEnv(JNIEnv *env) { int status = pthread_setspecific(mThreadKey, env); if (status < 0) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed pthread_setspecific() in Android_JNI_SetEnv() (err=%d)", status); } return status; } /* Get local storage value */ JNIEnv* Android_JNI_GetEnv(void) { /* Get JNIEnv from the Thread local storage */ JNIEnv *env = pthread_getspecific(mThreadKey); if (env == NULL) { /* If it fails, try to attach ! (e.g the thread isn't created with SDL_CreateThread() */ int status; /* There should be a JVM */ if (mJavaVM == NULL) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed, there is no JavaVM"); return NULL; } /* Attach the current thread to the JVM and get a JNIEnv. * It will be detached by pthread_create destructor 'Android_JNI_ThreadDestroyed' */ status = (*mJavaVM)->AttachCurrentThread(mJavaVM, &env, NULL); if (status < 0) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed to attach current thread (err=%d)", status); return NULL; } /* Save JNIEnv into the Thread local storage */ if (Android_JNI_SetEnv(env) < 0) { return NULL; } } return env; } /* Set up an external thread for using JNI with Android_JNI_GetEnv() */ int Android_JNI_SetupThread(void) { JNIEnv *env; int status; /* There should be a JVM */ if (mJavaVM == NULL) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed, there is no JavaVM"); return 0; } /* Attach the current thread to the JVM and get a JNIEnv. * It will be detached by pthread_create destructor 'Android_JNI_ThreadDestroyed' */ status = (*mJavaVM)->AttachCurrentThread(mJavaVM, &env, NULL); if (status < 0) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed to attach current thread (err=%d)", status); return 0; } /* Save JNIEnv into the Thread local storage */ if (Android_JNI_SetEnv(env) < 0) { return 0; } return 1; } /* Destructor called for each thread where mThreadKey is not NULL */ static void Android_JNI_ThreadDestroyed(void *value) { /* The thread is being destroyed, detach it from the Java VM and set the mThreadKey value to NULL as required */ JNIEnv *env = (JNIEnv *) value; if (env != NULL) { (*mJavaVM)->DetachCurrentThread(mJavaVM); Android_JNI_SetEnv(NULL); } } /* Creation of local storage mThreadKey */ static void Android_JNI_CreateKey(void) { int status = pthread_key_create(&mThreadKey, Android_JNI_ThreadDestroyed); if (status < 0) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "Error initializing mThreadKey with pthread_key_create() (err=%d)", status); } } static void Android_JNI_CreateKey_once(void) { int status = pthread_once(&key_once, Android_JNI_CreateKey); if (status < 0) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "Error initializing mThreadKey with pthread_once() (err=%d)", status); } } static void register_methods(JNIEnv *env, const char *classname, JNINativeMethod *methods, int nb) { jclass clazz = (*env)->FindClass(env, classname); if (clazz == NULL || (*env)->RegisterNatives(env, clazz, methods, nb) < 0) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed to register methods of %s", classname); return; } } /* Library init */ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { mJavaVM = vm; JNIEnv *env = NULL; if ((*mJavaVM)->GetEnv(mJavaVM, (void **)&env, JNI_VERSION_1_4) != JNI_OK) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed to get JNI Env"); return JNI_VERSION_1_4; } register_methods(env, "org/libsdl/app/SDLActivity", SDLActivity_tab, SDL_arraysize(SDLActivity_tab)); register_methods(env, "org/libsdl/app/SDLInputConnection", SDLInputConnection_tab, SDL_arraysize(SDLInputConnection_tab)); register_methods(env, "org/libsdl/app/SDLAudioManager", SDLAudioManager_tab, SDL_arraysize(SDLAudioManager_tab)); register_methods(env, "org/libsdl/app/SDLControllerManager", SDLControllerManager_tab, SDL_arraysize(SDLControllerManager_tab)); return JNI_VERSION_1_4; } void checkJNIReady(void) { if (!mActivityClass || !mAudioManagerClass || !mControllerManagerClass) { /* We aren't fully initialized, let's just return. */ return; } SDL_SetMainReady(); } /* Activity initialization -- called before SDL_main() to initialize JNI bindings */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cls) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeSetupJNI()"); /* * Create mThreadKey so we can keep track of the JNIEnv assigned to each thread * Refer to http://developer.android.com/guide/practices/design/jni.html for the rationale behind this */ Android_JNI_CreateKey_once(); /* Save JNIEnv of SDLActivity */ Android_JNI_SetEnv(env); if (mJavaVM == NULL) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "failed to found a JavaVM"); } /* Use a mutex to prevent concurrency issues between Java Activity and Native thread code, when using 'Android_Window'. * (Eg. Java sending Touch events, while native code is destroying the main SDL_Window. ) */ if (Android_ActivityMutex == NULL) { Android_ActivityMutex = SDL_CreateMutex(); /* Could this be created twice if onCreate() is called a second time ? */ } if (Android_ActivityMutex == NULL) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "failed to create Android_ActivityMutex mutex"); } Android_PauseSem = SDL_CreateSemaphore(0); if (Android_PauseSem == NULL) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "failed to create Android_PauseSem semaphore"); } Android_ResumeSem = SDL_CreateSemaphore(0); if (Android_ResumeSem == NULL) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "failed to create Android_ResumeSem semaphore"); } mActivityClass = (jclass)((*env)->NewGlobalRef(env, cls)); midClipboardGetText = (*env)->GetStaticMethodID(env, mActivityClass, "clipboardGetText", "()Ljava/lang/String;"); midClipboardHasText = (*env)->GetStaticMethodID(env, mActivityClass, "clipboardHasText", "()Z"); midClipboardSetText = (*env)->GetStaticMethodID(env, mActivityClass, "clipboardSetText", "(Ljava/lang/String;)V"); midCreateCustomCursor = (*env)->GetStaticMethodID(env, mActivityClass, "createCustomCursor", "([IIIII)I"); midGetContext = (*env)->GetStaticMethodID(env, mActivityClass, "getContext","()Landroid/content/Context;"); midGetDisplayDPI = (*env)->GetStaticMethodID(env, mActivityClass, "getDisplayDPI", "()Landroid/util/DisplayMetrics;"); midGetManifestEnvironmentVariables = (*env)->GetStaticMethodID(env, mActivityClass, "getManifestEnvironmentVariables", "()Z"); midGetNativeSurface = (*env)->GetStaticMethodID(env, mActivityClass, "getNativeSurface","()Landroid/view/Surface;"); midInitTouch = (*env)->GetStaticMethodID(env, mActivityClass, "initTouch", "()V"); midIsAndroidTV = (*env)->GetStaticMethodID(env, mActivityClass, "isAndroidTV","()Z"); midIsChromebook = (*env)->GetStaticMethodID(env, mActivityClass, "isChromebook", "()Z"); midIsDeXMode = (*env)->GetStaticMethodID(env, mActivityClass, "isDeXMode", "()Z"); midIsScreenKeyboardShown = (*env)->GetStaticMethodID(env, mActivityClass, "isScreenKeyboardShown","()Z"); midIsTablet = (*env)->GetStaticMethodID(env, mActivityClass, "isTablet", "()Z"); midManualBackButton = (*env)->GetStaticMethodID(env, mActivityClass, "manualBackButton", "()V"); midMinimizeWindow = (*env)->GetStaticMethodID(env, mActivityClass, "minimizeWindow","()V"); midOpenAPKExpansionInputStream = (*env)->GetStaticMethodID(env, mActivityClass, "openAPKExpansionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;"); midRequestPermission = (*env)->GetStaticMethodID(env, mActivityClass, "requestPermission", "(Ljava/lang/String;I)V"); midSendMessage = (*env)->GetStaticMethodID(env, mActivityClass, "sendMessage", "(II)Z"); midSetActivityTitle = (*env)->GetStaticMethodID(env, mActivityClass, "setActivityTitle","(Ljava/lang/String;)Z"); midSetCustomCursor = (*env)->GetStaticMethodID(env, mActivityClass, "setCustomCursor", "(I)Z"); midSetOrientation = (*env)->GetStaticMethodID(env, mActivityClass, "setOrientation","(IIZLjava/lang/String;)V"); midSetRelativeMouseEnabled = (*env)->GetStaticMethodID(env, mActivityClass, "setRelativeMouseEnabled", "(Z)Z"); midSetSurfaceViewFormat = (*env)->GetStaticMethodID(env, mActivityClass, "setSurfaceViewFormat","(I)V"); midSetSystemCursor = (*env)->GetStaticMethodID(env, mActivityClass, "setSystemCursor", "(I)Z"); midSetWindowStyle = (*env)->GetStaticMethodID(env, mActivityClass, "setWindowStyle","(Z)V"); midShouldMinimizeOnFocusLoss = (*env)->GetStaticMethodID(env, mActivityClass, "shouldMinimizeOnFocusLoss","()Z"); midShowTextInput = (*env)->GetStaticMethodID(env, mActivityClass, "showTextInput", "(IIII)Z"); midSupportsRelativeMouse = (*env)->GetStaticMethodID(env, mActivityClass, "supportsRelativeMouse", "()Z"); if (!midClipboardGetText || !midClipboardHasText || !midClipboardSetText || !midCreateCustomCursor || !midGetContext || !midGetDisplayDPI || !midGetManifestEnvironmentVariables || !midGetNativeSurface || !midInitTouch || !midIsAndroidTV || !midIsChromebook || !midIsDeXMode || !midIsScreenKeyboardShown || !midIsTablet || !midManualBackButton || !midMinimizeWindow || !midOpenAPKExpansionInputStream || !midRequestPermission || !midSendMessage || !midSetActivityTitle || !midSetCustomCursor || !midSetOrientation || !midSetRelativeMouseEnabled || !midSetSurfaceViewFormat || !midSetSystemCursor || !midSetWindowStyle || !midShouldMinimizeOnFocusLoss || !midShowTextInput || !midSupportsRelativeMouse) { __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLActivity.java?"); } checkJNIReady(); } /* Audio initialization -- called before SDL_main() to initialize JNI bindings */ JNIEXPORT void JNICALL SDL_JAVA_AUDIO_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cls) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "AUDIO nativeSetupJNI()"); mAudioManagerClass = (jclass)((*env)->NewGlobalRef(env, cls)); midAudioOpen = (*env)->GetStaticMethodID(env, mAudioManagerClass, "audioOpen", "(IIII)[I"); midAudioWriteByteBuffer = (*env)->GetStaticMethodID(env, mAudioManagerClass, "audioWriteByteBuffer", "([B)V"); midAudioWriteShortBuffer = (*env)->GetStaticMethodID(env, mAudioManagerClass, "audioWriteShortBuffer", "([S)V"); midAudioWriteFloatBuffer = (*env)->GetStaticMethodID(env, mAudioManagerClass, "audioWriteFloatBuffer", "([F)V"); midAudioClose = (*env)->GetStaticMethodID(env, mAudioManagerClass, "audioClose", "()V"); midCaptureOpen = (*env)->GetStaticMethodID(env, mAudioManagerClass, "captureOpen", "(IIII)[I"); midCaptureReadByteBuffer = (*env)->GetStaticMethodID(env, mAudioManagerClass, "captureReadByteBuffer", "([BZ)I"); midCaptureReadShortBuffer = (*env)->GetStaticMethodID(env, mAudioManagerClass, "captureReadShortBuffer", "([SZ)I"); midCaptureReadFloatBuffer = (*env)->GetStaticMethodID(env, mAudioManagerClass, "captureReadFloatBuffer", "([FZ)I"); midCaptureClose = (*env)->GetStaticMethodID(env, mAudioManagerClass, "captureClose", "()V"); midAudioSetThreadPriority = (*env)->GetStaticMethodID(env, mAudioManagerClass, "audioSetThreadPriority", "(ZI)V"); if (!midAudioOpen || !midAudioWriteByteBuffer || !midAudioWriteShortBuffer || !midAudioWriteFloatBuffer || !midAudioClose || !midCaptureOpen || !midCaptureReadByteBuffer || !midCaptureReadShortBuffer || !midCaptureReadFloatBuffer || !midCaptureClose || !midAudioSetThreadPriority) { __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLAudioManager.java?"); } checkJNIReady(); } /* Controller initialization -- called before SDL_main() to initialize JNI bindings */ JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cls) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "CONTROLLER nativeSetupJNI()"); mControllerManagerClass = (jclass)((*env)->NewGlobalRef(env, cls)); midPollInputDevices = (*env)->GetStaticMethodID(env, mControllerManagerClass, "pollInputDevices", "()V"); midPollHapticDevices = (*env)->GetStaticMethodID(env, mControllerManagerClass, "pollHapticDevices", "()V"); midHapticRun = (*env)->GetStaticMethodID(env, mControllerManagerClass, "hapticRun", "(IFI)V"); midHapticStop = (*env)->GetStaticMethodID(env, mControllerManagerClass, "hapticStop", "(I)V"); if (!midPollInputDevices || !midPollHapticDevices || !midHapticRun || !midHapticStop) { __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLControllerManager.java?"); } checkJNIReady(); } /* SDL main function prototype */ typedef int (*SDL_main_func)(int argc, char *argv[]); /* Start up the SDL app */ JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)(JNIEnv *env, jclass cls, jstring library, jstring function, jobject array) { int status = -1; const char *library_file; void *library_handle; __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeRunMain()"); /* Save JNIEnv of SDLThread */ Android_JNI_SetEnv(env); library_file = (*env)->GetStringUTFChars(env, library, NULL); library_handle = dlopen(library_file, RTLD_GLOBAL); if (!library_handle) { /* When deploying android app bundle format uncompressed native libs may not extract from apk to filesystem. In this case we should use lib name without path. https://bugzilla.libsdl.org/show_bug.cgi?id=4739 */ const char *library_name = SDL_strrchr(library_file, '/'); if (library_name && *library_name) { library_name += 1; library_handle = dlopen(library_name, RTLD_GLOBAL); } } if (library_handle) { const char *function_name; SDL_main_func SDL_main; function_name = (*env)->GetStringUTFChars(env, function, NULL); SDL_main = (SDL_main_func)dlsym(library_handle, function_name); if (SDL_main) { int i; int argc; int len; char **argv; SDL_bool isstack; /* Prepare the arguments. */ len = (*env)->GetArrayLength(env, array); argv = SDL_small_alloc(char *, 1 + len + 1, &isstack); /* !!! FIXME: check for NULL */ argc = 0; /* Use the name "app_process" so PHYSFS_platformCalcBaseDir() works. https://bitbucket.org/MartinFelis/love-android-sdl2/issue/23/release-build-crash-on-start */ argv[argc++] = SDL_strdup("app_process"); for (i = 0; i < len; ++i) { const char *utf; char *arg = NULL; jstring string = (*env)->GetObjectArrayElement(env, array, i); if (string) { utf = (*env)->GetStringUTFChars(env, string, 0); if (utf) { arg = SDL_strdup(utf); (*env)->ReleaseStringUTFChars(env, string, utf); } (*env)->DeleteLocalRef(env, string); } if (!arg) { arg = SDL_strdup(""); } argv[argc++] = arg; } argv[argc] = NULL; /* Run the application. */ status = SDL_main(argc, argv); /* Release the arguments. */ for (i = 0; i < argc; ++i) { SDL_free(argv[i]); } SDL_small_free(argv, isstack); } else { __android_log_print(ANDROID_LOG_ERROR, "SDL", "nativeRunMain(): Couldn't find function %s in library %s", function_name, library_file); } (*env)->ReleaseStringUTFChars(env, function, function_name); dlclose(library_handle); } else { __android_log_print(ANDROID_LOG_ERROR, "SDL", "nativeRunMain(): Couldn't load library %s", library_file); } (*env)->ReleaseStringUTFChars(env, library, library_file); /* This is a Java thread, it doesn't need to be Detached from the JVM. * Set to mThreadKey value to NULL not to call pthread_create destructor 'Android_JNI_ThreadDestroyed' */ Android_JNI_SetEnv(NULL); /* Do not issue an exit or the whole application will terminate instead of just the SDL thread */ /* exit(status); */ return status; } /* Drop file */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)( JNIEnv *env, jclass jcls, jstring filename) { const char *path = (*env)->GetStringUTFChars(env, filename, NULL); SDL_SendDropFile(NULL, path); (*env)->ReleaseStringUTFChars(env, filename, path); SDL_SendDropComplete(NULL); } /* Lock / Unlock Mutex */ void Android_ActivityMutex_Lock() { SDL_LockMutex(Android_ActivityMutex); } void Android_ActivityMutex_Unlock() { SDL_UnlockMutex(Android_ActivityMutex); } /* Lock the Mutex when the Activity is in its 'Running' state */ void Android_ActivityMutex_Lock_Running() { int pauseSignaled = 0; int resumeSignaled = 0; retry: SDL_LockMutex(Android_ActivityMutex); pauseSignaled = SDL_SemValue(Android_PauseSem); resumeSignaled = SDL_SemValue(Android_ResumeSem); if (pauseSignaled > resumeSignaled) { SDL_UnlockMutex(Android_ActivityMutex); SDL_Delay(50); goto retry; } } /* Set screen resolution */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetScreenResolution)( JNIEnv *env, jclass jcls, jint surfaceWidth, jint surfaceHeight, jint deviceWidth, jint deviceHeight, jint format, jfloat rate) { SDL_LockMutex(Android_ActivityMutex); Android_SetScreenResolution(surfaceWidth, surfaceHeight, deviceWidth, deviceHeight, format, rate); SDL_UnlockMutex(Android_ActivityMutex); } /* Resize */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)( JNIEnv *env, jclass jcls) { SDL_LockMutex(Android_ActivityMutex); if (Android_Window) { Android_SendResize(Android_Window); } SDL_UnlockMutex(Android_ActivityMutex); } JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeOrientationChanged)( JNIEnv *env, jclass jcls, jint orientation) { SDL_LockMutex(Android_ActivityMutex); displayOrientation = (SDL_DisplayOrientation)orientation; if (Android_Window) { SDL_VideoDisplay *display = SDL_GetDisplay(0); SDL_SendDisplayEvent(display, SDL_DISPLAYEVENT_ORIENTATION, orientation); } SDL_UnlockMutex(Android_ActivityMutex); } JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeAddTouch)( JNIEnv* env, jclass cls, jint touchId, jstring name) { const char *utfname = (*env)->GetStringUTFChars(env, name, NULL); SDL_AddTouch((SDL_TouchID) touchId, SDL_TOUCH_DEVICE_DIRECT, utfname); (*env)->ReleaseStringUTFChars(env, name, utfname); } JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePermissionResult)( JNIEnv* env, jclass cls, jint requestCode, jboolean result) { bPermissionRequestResult = result; SDL_AtomicSet(&bPermissionRequestPending, SDL_FALSE); } /* Paddown */ JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadDown)( JNIEnv *env, jclass jcls, jint device_id, jint keycode) { return Android_OnPadDown(device_id, keycode); } /* Padup */ JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadUp)( JNIEnv *env, jclass jcls, jint device_id, jint keycode) { return Android_OnPadUp(device_id, keycode); } /* Joy */ JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeJoy)( JNIEnv *env, jclass jcls, jint device_id, jint axis, jfloat value) { Android_OnJoy(device_id, axis, value); } /* POV Hat */ JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeHat)( JNIEnv *env, jclass jcls, jint device_id, jint hat_id, jint x, jint y) { Android_OnHat(device_id, hat_id, x, y); } JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddJoystick)( JNIEnv *env, jclass jcls, jint device_id, jstring device_name, jstring device_desc, jint vendor_id, jint product_id, jboolean is_accelerometer, jint button_mask, jint naxes, jint nhats, jint nballs) { int retval; const char *name = (*env)->GetStringUTFChars(env, device_name, NULL); const char *desc = (*env)->GetStringUTFChars(env, device_desc, NULL); retval = Android_AddJoystick(device_id, name, desc, vendor_id, product_id, is_accelerometer ? SDL_TRUE : SDL_FALSE, button_mask, naxes, nhats, nballs); (*env)->ReleaseStringUTFChars(env, device_name, name); (*env)->ReleaseStringUTFChars(env, device_desc, desc); return retval; } JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveJoystick)( JNIEnv *env, jclass jcls, jint device_id) { return Android_RemoveJoystick(device_id); } JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddHaptic)( JNIEnv *env, jclass jcls, jint device_id, jstring device_name) { int retval; const char *name = (*env)->GetStringUTFChars(env, device_name, NULL); retval = Android_AddHaptic(device_id, name); (*env)->ReleaseStringUTFChars(env, device_name, name); return retval; } JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveHaptic)( JNIEnv *env, jclass jcls, jint device_id) { return Android_RemoveHaptic(device_id); } /* Called from surfaceCreated() */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceCreated)(JNIEnv *env, jclass jcls) { SDL_LockMutex(Android_ActivityMutex); if (Android_Window) { SDL_WindowData *data = (SDL_WindowData *) Android_Window->driverdata; data->native_window = Android_JNI_GetNativeWindow(); if (data->native_window == NULL) { SDL_SetError("Could not fetch native window from UI thread"); } } SDL_UnlockMutex(Android_ActivityMutex); } /* Called from surfaceChanged() */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv *env, jclass jcls) { SDL_LockMutex(Android_ActivityMutex); if (Android_Window) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); SDL_WindowData *data = (SDL_WindowData *) Android_Window->driverdata; /* If the surface has been previously destroyed by onNativeSurfaceDestroyed, recreate it here */ if (data->egl_surface == EGL_NO_SURFACE) { data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->native_window); } /* GL Context handling is done in the event loop because this function is run from the Java thread */ } SDL_UnlockMutex(Android_ActivityMutex); } /* Called from surfaceDestroyed() */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed)(JNIEnv *env, jclass jcls) { int nb_attempt = 50; retry: SDL_LockMutex(Android_ActivityMutex); if (Android_Window) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); SDL_WindowData *data = (SDL_WindowData *) Android_Window->driverdata; /* Wait for Main thread being paused and context un-activated to release 'egl_surface' */ if (! data->backup_done) { nb_attempt -= 1; if (nb_attempt == 0) { SDL_SetError("Try to release egl_surface with context probably still active"); } else { SDL_UnlockMutex(Android_ActivityMutex); SDL_Delay(10); goto retry; } } if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); data->egl_surface = EGL_NO_SURFACE; } if (data->native_window) { ANativeWindow_release(data->native_window); data->native_window = NULL; } /* GL Context handling is done in the event loop because this function is run from the Java thread */ } SDL_UnlockMutex(Android_ActivityMutex); } /* Keydown */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyDown)( JNIEnv *env, jclass jcls, jint keycode) { Android_OnKeyDown(keycode); } /* Keyup */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyUp)( JNIEnv *env, jclass jcls, jint keycode) { Android_OnKeyUp(keycode); } /* Virtual keyboard return key might stop text input */ JNIEXPORT jboolean JNICALL SDL_JAVA_INTERFACE(onNativeSoftReturnKey)( JNIEnv *env, jclass jcls) { if (SDL_GetHintBoolean(SDL_HINT_RETURN_KEY_HIDES_IME, SDL_FALSE)) { SDL_StopTextInput(); return JNI_TRUE; } return JNI_FALSE; } /* Keyboard Focus Lost */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyboardFocusLost)( JNIEnv *env, jclass jcls) { /* Calling SDL_StopTextInput will take care of hiding the keyboard and cleaning up the DummyText widget */ SDL_StopTextInput(); } /* Touch */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeTouch)( JNIEnv *env, jclass jcls, jint touch_device_id_in, jint pointer_finger_id_in, jint action, jfloat x, jfloat y, jfloat p) { SDL_LockMutex(Android_ActivityMutex); Android_OnTouch(Android_Window, touch_device_id_in, pointer_finger_id_in, action, x, y, p); SDL_UnlockMutex(Android_ActivityMutex); } /* Mouse */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeMouse)( JNIEnv *env, jclass jcls, jint button, jint action, jfloat x, jfloat y, jboolean relative) { SDL_LockMutex(Android_ActivityMutex); Android_OnMouse(Android_Window, button, action, x, y, relative); SDL_UnlockMutex(Android_ActivityMutex); } /* Accelerometer */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeAccel)( JNIEnv *env, jclass jcls, jfloat x, jfloat y, jfloat z) { fLastAccelerometer[0] = x; fLastAccelerometer[1] = y; fLastAccelerometer[2] = z; bHasNewData = SDL_TRUE; } /* Clipboard */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeClipboardChanged)( JNIEnv *env, jclass jcls) { SDL_SendClipboardUpdate(); } /* Low memory */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)( JNIEnv *env, jclass cls) { SDL_SendAppEvent(SDL_APP_LOWMEMORY); } /* Locale * requires android:configChanges="layoutDirection|locale" in AndroidManifest.xml */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeLocaleChanged)( JNIEnv *env, jclass cls) { SDL_SendAppEvent(SDL_LOCALECHANGED); } /* Send Quit event to "SDLThread" thread */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSendQuit)( JNIEnv *env, jclass cls) { /* Discard previous events. The user should have handled state storage * in SDL_APP_WILLENTERBACKGROUND. After nativeSendQuit() is called, no * events other than SDL_QUIT and SDL_APP_TERMINATING should fire */ SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT); /* Inject a SDL_QUIT event */ SDL_SendQuit(); SDL_SendAppEvent(SDL_APP_TERMINATING); /* Robustness: clear any pending Pause */ while (SDL_SemTryWait(Android_PauseSem) == 0) { /* empty */ } /* Resume the event loop so that the app can catch SDL_QUIT which * should now be the top event in the event queue. */ SDL_SemPost(Android_ResumeSem); } /* Activity ends */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeQuit)( JNIEnv *env, jclass cls) { const char *str; if (Android_ActivityMutex) { SDL_DestroyMutex(Android_ActivityMutex); Android_ActivityMutex = NULL; } if (Android_PauseSem) { SDL_DestroySemaphore(Android_PauseSem); Android_PauseSem = NULL; } if (Android_ResumeSem) { SDL_DestroySemaphore(Android_ResumeSem); Android_ResumeSem = NULL; } Internal_Android_Destroy_AssetManager(); str = SDL_GetError(); if (str && str[0]) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "SDLActivity thread ends (error=%s)", str); } else { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDLActivity thread ends"); } } /* Pause */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePause)( JNIEnv *env, jclass cls) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativePause()"); /* Signal the pause semaphore so the event loop knows to pause and (optionally) block itself. * Sometimes 2 pauses can be queued (eg pause/resume/pause), so it's always increased. */ SDL_SemPost(Android_PauseSem); } /* Resume */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeResume)( JNIEnv *env, jclass cls) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeResume()"); /* Signal the resume semaphore so the event loop knows to resume and restore the GL Context * We can't restore the GL Context here because it needs to be done on the SDL main thread * and this function will be called from the Java thread instead. */ SDL_SemPost(Android_ResumeSem); } JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeFocusChanged)( JNIEnv *env, jclass cls, jboolean hasFocus) { SDL_LockMutex(Android_ActivityMutex); if (Android_Window) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeFocusChanged()"); SDL_SendWindowEvent(Android_Window, (hasFocus ? SDL_WINDOWEVENT_FOCUS_GAINED : SDL_WINDOWEVENT_FOCUS_LOST), 0, 0); } SDL_UnlockMutex(Android_ActivityMutex); } JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText)( JNIEnv *env, jclass cls, jstring text, jint newCursorPosition) { const char *utftext = (*env)->GetStringUTFChars(env, text, NULL); SDL_SendKeyboardText(utftext); (*env)->ReleaseStringUTFChars(env, text, utftext); } JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancodeForUnichar)( JNIEnv *env, jclass cls, jchar chUnicode) { SDL_Scancode code = SDL_SCANCODE_UNKNOWN; uint16_t mod = 0; /* We do not care about bigger than 127. */ if (chUnicode < 127) { AndroidKeyInfo info = unicharToAndroidKeyInfoTable[chUnicode]; code = info.code; mod = info.mod; } if (mod & KMOD_SHIFT) { /* If character uses shift, press shift down */ SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT); } /* send a keydown and keyup even for the character */ SDL_SendKeyboardKey(SDL_PRESSED, code); SDL_SendKeyboardKey(SDL_RELEASED, code); if (mod & KMOD_SHIFT) { /* If character uses shift, press shift back up */ SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT); } } JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText)( JNIEnv *env, jclass cls, jstring text, jint newCursorPosition) { const char *utftext = (*env)->GetStringUTFChars(env, text, NULL); SDL_SendEditingText(utftext, 0, 0); (*env)->ReleaseStringUTFChars(env, text, utftext); } JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetHint)( JNIEnv *env, jclass cls, jstring name) { const char *utfname = (*env)->GetStringUTFChars(env, name, NULL); const char *hint = SDL_GetHint(utfname); jstring result = (*env)->NewStringUTF(env, hint); (*env)->ReleaseStringUTFChars(env, name, utfname); return result; } JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)( JNIEnv *env, jclass cls, jstring name, jstring value) { const char *utfname = (*env)->GetStringUTFChars(env, name, NULL); const char *utfvalue = (*env)->GetStringUTFChars(env, value, NULL); SDL_setenv(utfname, utfvalue, 1); (*env)->ReleaseStringUTFChars(env, name, utfname); (*env)->ReleaseStringUTFChars(env, value, utfvalue); } /******************************************************************************* Functions called by SDL into Java *******************************************************************************/ static SDL_atomic_t s_active; struct LocalReferenceHolder { JNIEnv *m_env; const char *m_func; }; static struct LocalReferenceHolder LocalReferenceHolder_Setup(const char *func) { struct LocalReferenceHolder refholder; refholder.m_env = NULL; refholder.m_func = func; #ifdef DEBUG_JNI SDL_Log("Entering function %s", func); #endif return refholder; } static SDL_bool LocalReferenceHolder_Init(struct LocalReferenceHolder *refholder, JNIEnv *env) { const int capacity = 16; if ((*env)->PushLocalFrame(env, capacity) < 0) { SDL_SetError("Failed to allocate enough JVM local references"); return SDL_FALSE; } SDL_AtomicIncRef(&s_active); refholder->m_env = env; return SDL_TRUE; } static void LocalReferenceHolder_Cleanup(struct LocalReferenceHolder *refholder) { #ifdef DEBUG_JNI SDL_Log("Leaving function %s", refholder->m_func); #endif if (refholder->m_env) { JNIEnv *env = refholder->m_env; (*env)->PopLocalFrame(env, NULL); SDL_AtomicDecRef(&s_active); } } ANativeWindow* Android_JNI_GetNativeWindow(void) { ANativeWindow *anw = NULL; jobject s; JNIEnv *env = Android_JNI_GetEnv(); s = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetNativeSurface); if (s) { anw = ANativeWindow_fromSurface(env, s); (*env)->DeleteLocalRef(env, s); } return anw; } void Android_JNI_SetSurfaceViewFormat(int format) { JNIEnv *env = Android_JNI_GetEnv(); int new_format = 0; /* Format from android/native_window.h, * convert to temporary arbitrary values, * then to java PixelFormat */ if (format == WINDOW_FORMAT_RGBA_8888) { new_format = 1; } else if (format == WINDOW_FORMAT_RGBX_8888) { new_format = 2; } else if (format == WINDOW_FORMAT_RGB_565) { /* Default */ new_format = 0; } (*env)->CallStaticVoidMethod(env, mActivityClass, midSetSurfaceViewFormat, new_format); } void Android_JNI_SetActivityTitle(const char *title) { JNIEnv *env = Android_JNI_GetEnv(); jstring jtitle = (*env)->NewStringUTF(env, title); (*env)->CallStaticBooleanMethod(env, mActivityClass, midSetActivityTitle, jtitle); (*env)->DeleteLocalRef(env, jtitle); } void Android_JNI_SetWindowStyle(SDL_bool fullscreen) { JNIEnv *env = Android_JNI_GetEnv(); (*env)->CallStaticVoidMethod(env, mActivityClass, midSetWindowStyle, fullscreen ? 1 : 0); } void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint) { JNIEnv *env = Android_JNI_GetEnv(); jstring jhint = (*env)->NewStringUTF(env, (hint ? hint : "")); (*env)->CallStaticVoidMethod(env, mActivityClass, midSetOrientation, w, h, (resizable? 1 : 0), jhint); (*env)->DeleteLocalRef(env, jhint); } void Android_JNI_MinizeWindow() { JNIEnv *env = Android_JNI_GetEnv(); (*env)->CallStaticVoidMethod(env, mActivityClass, midMinimizeWindow); } SDL_bool Android_JNI_ShouldMinimizeOnFocusLoss() { JNIEnv *env = Android_JNI_GetEnv(); return (*env)->CallStaticBooleanMethod(env, mActivityClass, midShouldMinimizeOnFocusLoss); } SDL_bool Android_JNI_GetAccelerometerValues(float values[3]) { int i; SDL_bool retval = SDL_FALSE; if (bHasNewData) { for (i = 0; i < 3; ++i) { values[i] = fLastAccelerometer[i]; } bHasNewData = SDL_FALSE; retval = SDL_TRUE; } return retval; } /* * Audio support */ static int audioBufferFormat = 0; static jobject audioBuffer = NULL; static void *audioBufferPinned = NULL; static int captureBufferFormat = 0; static jobject captureBuffer = NULL; int Android_JNI_OpenAudioDevice(int iscapture, SDL_AudioSpec *spec) { int audioformat; jobject jbufobj = NULL; jobject result; int *resultElements; jboolean isCopy; JNIEnv *env = Android_JNI_GetEnv(); switch (spec->format) { case AUDIO_U8: audioformat = ENCODING_PCM_8BIT; break; case AUDIO_S16: audioformat = ENCODING_PCM_16BIT; break; case AUDIO_F32: audioformat = ENCODING_PCM_FLOAT; break; default: return SDL_SetError("Unsupported audio format: 0x%x", spec->format); } if (iscapture) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device for capture"); result = (*env)->CallStaticObjectMethod(env, mAudioManagerClass, midCaptureOpen, spec->freq, audioformat, spec->channels, spec->samples); } else { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device for output"); result = (*env)->CallStaticObjectMethod(env, mAudioManagerClass, midAudioOpen, spec->freq, audioformat, spec->channels, spec->samples); } if (result == NULL) { /* Error during audio initialization, error printed from Java */ return SDL_SetError("Java-side initialization failed"); } if ((*env)->GetArrayLength(env, (jintArray)result) != 4) { return SDL_SetError("Unexpected results from Java, expected 4, got %d", (*env)->GetArrayLength(env, (jintArray)result)); } isCopy = JNI_FALSE; resultElements = (*env)->GetIntArrayElements(env, (jintArray)result, &isCopy); spec->freq = resultElements[0]; audioformat = resultElements[1]; switch (audioformat) { case ENCODING_PCM_8BIT: spec->format = AUDIO_U8; break; case ENCODING_PCM_16BIT: spec->format = AUDIO_S16; break; case ENCODING_PCM_FLOAT: spec->format = AUDIO_F32; break; default: return SDL_SetError("Unexpected audio format from Java: %d\n", audioformat); } spec->channels = resultElements[2]; spec->samples = resultElements[3]; (*env)->ReleaseIntArrayElements(env, (jintArray)result, resultElements, JNI_ABORT); (*env)->DeleteLocalRef(env, result); /* Allocating the audio buffer from the Java side and passing it as the return value for audioInit no longer works on * Android >= 4.2 due to a "stale global reference" error. So now we allocate this buffer directly from this side. */ switch (audioformat) { case ENCODING_PCM_8BIT: { jbyteArray audioBufferLocal = (*env)->NewByteArray(env, spec->samples * spec->channels); if (audioBufferLocal) { jbufobj = (*env)->NewGlobalRef(env, audioBufferLocal); (*env)->DeleteLocalRef(env, audioBufferLocal); } } break; case ENCODING_PCM_16BIT: { jshortArray audioBufferLocal = (*env)->NewShortArray(env, spec->samples * spec->channels); if (audioBufferLocal) { jbufobj = (*env)->NewGlobalRef(env, audioBufferLocal); (*env)->DeleteLocalRef(env, audioBufferLocal); } } break; case ENCODING_PCM_FLOAT: { jfloatArray audioBufferLocal = (*env)->NewFloatArray(env, spec->samples * spec->channels); if (audioBufferLocal) { jbufobj = (*env)->NewGlobalRef(env, audioBufferLocal); (*env)->DeleteLocalRef(env, audioBufferLocal); } } break; default: return SDL_SetError("Unexpected audio format from Java: %d\n", audioformat); } if (jbufobj == NULL) { __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: could not allocate an audio buffer"); return SDL_OutOfMemory(); } if (iscapture) { captureBufferFormat = audioformat; captureBuffer = jbufobj; } else { audioBufferFormat = audioformat; audioBuffer = jbufobj; } if (!iscapture) { isCopy = JNI_FALSE; switch (audioformat) { case ENCODING_PCM_8BIT: audioBufferPinned = (*env)->GetByteArrayElements(env, (jbyteArray)audioBuffer, &isCopy); break; case ENCODING_PCM_16BIT: audioBufferPinned = (*env)->GetShortArrayElements(env, (jshortArray)audioBuffer, &isCopy); break; case ENCODING_PCM_FLOAT: audioBufferPinned = (*env)->GetFloatArrayElements(env, (jfloatArray)audioBuffer, &isCopy); break; default: return SDL_SetError("Unexpected audio format from Java: %d\n", audioformat); } } return 0; } SDL_DisplayOrientation Android_JNI_GetDisplayOrientation(void) { return displayOrientation; } int Android_JNI_GetDisplayDPI(float *ddpi, float *xdpi, float *ydpi) { JNIEnv *env = Android_JNI_GetEnv(); jobject jDisplayObj = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetDisplayDPI); jclass jDisplayClass = (*env)->GetObjectClass(env, jDisplayObj); jfieldID fidXdpi = (*env)->GetFieldID(env, jDisplayClass, "xdpi", "F"); jfieldID fidYdpi = (*env)->GetFieldID(env, jDisplayClass, "ydpi", "F"); jfieldID fidDdpi = (*env)->GetFieldID(env, jDisplayClass, "densityDpi", "I"); float nativeXdpi = (*env)->GetFloatField(env, jDisplayObj, fidXdpi); float nativeYdpi = (*env)->GetFloatField(env, jDisplayObj, fidYdpi); int nativeDdpi = (*env)->GetIntField(env, jDisplayObj, fidDdpi); (*env)->DeleteLocalRef(env, jDisplayObj); (*env)->DeleteLocalRef(env, jDisplayClass); if (ddpi) { *ddpi = (float)nativeDdpi; } if (xdpi) { *xdpi = nativeXdpi; } if (ydpi) { *ydpi = nativeYdpi; } return 0; } void * Android_JNI_GetAudioBuffer(void) { return audioBufferPinned; } void Android_JNI_WriteAudioBuffer(void) { JNIEnv *env = Android_JNI_GetEnv(); switch (audioBufferFormat) { case ENCODING_PCM_8BIT: (*env)->ReleaseByteArrayElements(env, (jbyteArray)audioBuffer, (jbyte *)audioBufferPinned, JNI_COMMIT); (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midAudioWriteByteBuffer, (jbyteArray)audioBuffer); break; case ENCODING_PCM_16BIT: (*env)->ReleaseShortArrayElements(env, (jshortArray)audioBuffer, (jshort *)audioBufferPinned, JNI_COMMIT); (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midAudioWriteShortBuffer, (jshortArray)audioBuffer); break; case ENCODING_PCM_FLOAT: (*env)->ReleaseFloatArrayElements(env, (jfloatArray)audioBuffer, (jfloat *)audioBufferPinned, JNI_COMMIT); (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midAudioWriteFloatBuffer, (jfloatArray)audioBuffer); break; default: __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: unhandled audio buffer format"); break; } /* JNI_COMMIT means the changes are committed to the VM but the buffer remains pinned */ } int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen) { JNIEnv *env = Android_JNI_GetEnv(); jboolean isCopy = JNI_FALSE; jint br = -1; switch (captureBufferFormat) { case ENCODING_PCM_8BIT: SDL_assert((*env)->GetArrayLength(env, (jshortArray)captureBuffer) == buflen); br = (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadByteBuffer, (jbyteArray)captureBuffer, JNI_TRUE); if (br > 0) { jbyte *ptr = (*env)->GetByteArrayElements(env, (jbyteArray)captureBuffer, &isCopy); SDL_memcpy(buffer, ptr, br); (*env)->ReleaseByteArrayElements(env, (jbyteArray)captureBuffer, ptr, JNI_ABORT); } break; case ENCODING_PCM_16BIT: SDL_assert((*env)->GetArrayLength(env, (jshortArray)captureBuffer) == (buflen / sizeof(Sint16))); br = (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadShortBuffer, (jshortArray)captureBuffer, JNI_TRUE); if (br > 0) { jshort *ptr = (*env)->GetShortArrayElements(env, (jshortArray)captureBuffer, &isCopy); br *= sizeof(Sint16); SDL_memcpy(buffer, ptr, br); (*env)->ReleaseShortArrayElements(env, (jshortArray)captureBuffer, ptr, JNI_ABORT); } break; case ENCODING_PCM_FLOAT: SDL_assert((*env)->GetArrayLength(env, (jfloatArray)captureBuffer) == (buflen / sizeof(float))); br = (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadFloatBuffer, (jfloatArray)captureBuffer, JNI_TRUE); if (br > 0) { jfloat *ptr = (*env)->GetFloatArrayElements(env, (jfloatArray)captureBuffer, &isCopy); br *= sizeof(float); SDL_memcpy(buffer, ptr, br); (*env)->ReleaseFloatArrayElements(env, (jfloatArray)captureBuffer, ptr, JNI_ABORT); } break; default: __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: unhandled capture buffer format"); break; } return br; } void Android_JNI_FlushCapturedAudio(void) { JNIEnv *env = Android_JNI_GetEnv(); #if 0 /* !!! FIXME: this needs API 23, or it'll do blocking reads and never end. */ switch (captureBufferFormat) { case ENCODING_PCM_8BIT: { const jint len = (*env)->GetArrayLength(env, (jbyteArray)captureBuffer); while ((*env)->CallStaticIntMethod(env, mActivityClass, midCaptureReadByteBuffer, (jbyteArray)captureBuffer, JNI_FALSE) == len) { /* spin */ } } break; case ENCODING_PCM_16BIT: { const jint len = (*env)->GetArrayLength(env, (jshortArray)captureBuffer); while ((*env)->CallStaticIntMethod(env, mActivityClass, midCaptureReadShortBuffer, (jshortArray)captureBuffer, JNI_FALSE) == len) { /* spin */ } } break; case ENCODING_PCM_FLOAT: { const jint len = (*env)->GetArrayLength(env, (jfloatArray)captureBuffer); while ((*env)->CallStaticIntMethod(env, mActivityClass, midCaptureReadFloatBuffer, (jfloatArray)captureBuffer, JNI_FALSE) == len) { /* spin */ } } break; default: __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: flushing unhandled capture buffer format"); break; } #else switch (captureBufferFormat) { case ENCODING_PCM_8BIT: (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadByteBuffer, (jbyteArray)captureBuffer, JNI_FALSE); break; case ENCODING_PCM_16BIT: (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadShortBuffer, (jshortArray)captureBuffer, JNI_FALSE); break; case ENCODING_PCM_FLOAT: (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadFloatBuffer, (jfloatArray)captureBuffer, JNI_FALSE); break; default: __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: flushing unhandled capture buffer format"); break; } #endif } void Android_JNI_CloseAudioDevice(const int iscapture) { JNIEnv *env = Android_JNI_GetEnv(); if (iscapture) { (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midCaptureClose); if (captureBuffer) { (*env)->DeleteGlobalRef(env, captureBuffer); captureBuffer = NULL; } } else { (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midAudioClose); if (audioBuffer) { (*env)->DeleteGlobalRef(env, audioBuffer); audioBuffer = NULL; audioBufferPinned = NULL; } } } void Android_JNI_AudioSetThreadPriority(int iscapture, int device_id) { JNIEnv *env = Android_JNI_GetEnv(); (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midAudioSetThreadPriority, iscapture, device_id); } /* Test for an exception and call SDL_SetError with its detail if one occurs */ /* If the parameter silent is truthy then SDL_SetError() will not be called. */ static SDL_bool Android_JNI_ExceptionOccurred(SDL_bool silent) { JNIEnv *env = Android_JNI_GetEnv(); jthrowable exception; /* Detect mismatch LocalReferenceHolder_Init/Cleanup */ SDL_assert(SDL_AtomicGet(&s_active) > 0); exception = (*env)->ExceptionOccurred(env); if (exception != NULL) { jmethodID mid; /* Until this happens most JNI operations have undefined behaviour */ (*env)->ExceptionClear(env); if (!silent) { jclass exceptionClass = (*env)->GetObjectClass(env, exception); jclass classClass = (*env)->FindClass(env, "java/lang/Class"); jstring exceptionName; const char *exceptionNameUTF8; jstring exceptionMessage; mid = (*env)->GetMethodID(env, classClass, "getName", "()Ljava/lang/String;"); exceptionName = (jstring)(*env)->CallObjectMethod(env, exceptionClass, mid); exceptionNameUTF8 = (*env)->GetStringUTFChars(env, exceptionName, 0); mid = (*env)->GetMethodID(env, exceptionClass, "getMessage", "()Ljava/lang/String;"); exceptionMessage = (jstring)(*env)->CallObjectMethod(env, exception, mid); if (exceptionMessage != NULL) { const char *exceptionMessageUTF8 = (*env)->GetStringUTFChars(env, exceptionMessage, 0); SDL_SetError("%s: %s", exceptionNameUTF8, exceptionMessageUTF8); (*env)->ReleaseStringUTFChars(env, exceptionMessage, exceptionMessageUTF8); } else { SDL_SetError("%s", exceptionNameUTF8); } (*env)->ReleaseStringUTFChars(env, exceptionName, exceptionNameUTF8); } return SDL_TRUE; } return SDL_FALSE; } static void Internal_Android_Create_AssetManager() { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); JNIEnv *env = Android_JNI_GetEnv(); jmethodID mid; jobject context; jobject javaAssetManager; if (!LocalReferenceHolder_Init(&refs, env)) { LocalReferenceHolder_Cleanup(&refs); return; } /* context = SDLActivity.getContext(); */ context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); /* javaAssetManager = context.getAssets(); */ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context), "getAssets", "()Landroid/content/res/AssetManager;"); javaAssetManager = (*env)->CallObjectMethod(env, context, mid); /** * Given a Dalvik AssetManager object, obtain the corresponding native AAssetManager * object. Note that the caller is responsible for obtaining and holding a VM reference * to the jobject to prevent its being garbage collected while the native object is * in use. */ javaAssetManagerRef = (*env)->NewGlobalRef(env, javaAssetManager); asset_manager = AAssetManager_fromJava(env, javaAssetManagerRef); if (asset_manager == NULL) { (*env)->DeleteGlobalRef(env, javaAssetManagerRef); Android_JNI_ExceptionOccurred(SDL_TRUE); } LocalReferenceHolder_Cleanup(&refs); } static void Internal_Android_Destroy_AssetManager() { JNIEnv *env = Android_JNI_GetEnv(); if (asset_manager) { (*env)->DeleteGlobalRef(env, javaAssetManagerRef); asset_manager = NULL; } } static int Internal_Android_JNI_FileOpen(SDL_RWops *ctx) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); int result = 0; jmethodID mid; jobject context; jobject assetManager; jobject inputStream; jclass channels; jobject readableByteChannel; jstring fileNameJString; jobject fd; jclass fdCls; jfieldID descriptor; JNIEnv *env = Android_JNI_GetEnv(); if (!LocalReferenceHolder_Init(&refs, env)) { goto failure; } fileNameJString = (jstring)ctx->hidden.androidio.fileNameRef; ctx->hidden.androidio.position = 0; /* context = SDLActivity.getContext(); */ context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); /* assetManager = context.getAssets(); */ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context), "getAssets", "()Landroid/content/res/AssetManager;"); assetManager = (*env)->CallObjectMethod(env, context, mid); /* First let's try opening the file to obtain an AssetFileDescriptor. * This method reads the files directly from the APKs using standard *nix calls */ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, assetManager), "openFd", "(Ljava/lang/String;)Landroid/content/res/AssetFileDescriptor;"); inputStream = (*env)->CallObjectMethod(env, assetManager, mid, fileNameJString); if (Android_JNI_ExceptionOccurred(SDL_TRUE)) { goto fallback; } mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, inputStream), "getStartOffset", "()J"); ctx->hidden.androidio.offset = (long)(*env)->CallLongMethod(env, inputStream, mid); if (Android_JNI_ExceptionOccurred(SDL_TRUE)) { goto fallback; } mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, inputStream), "getDeclaredLength", "()J"); ctx->hidden.androidio.size = (long)(*env)->CallLongMethod(env, inputStream, mid); if (Android_JNI_ExceptionOccurred(SDL_TRUE)) { goto fallback; } mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, inputStream), "getFileDescriptor", "()Ljava/io/FileDescriptor;"); fd = (*env)->CallObjectMethod(env, inputStream, mid); fdCls = (*env)->GetObjectClass(env, fd); descriptor = (*env)->GetFieldID(env, fdCls, "descriptor", "I"); ctx->hidden.androidio.fd = (*env)->GetIntField(env, fd, descriptor); ctx->hidden.androidio.assetFileDescriptorRef = (*env)->NewGlobalRef(env, inputStream); /* Seek to the correct offset in the file. */ lseek(ctx->hidden.androidio.fd, (off_t)ctx->hidden.androidio.offset, SEEK_SET); if (0) { fallback: /* Disabled log message because of spam on the Nexus 7 */ /* __android_log_print(ANDROID_LOG_DEBUG, "SDL", "Falling back to legacy InputStream method for opening file"); */ /* Try the old method using InputStream */ ctx->hidden.androidio.assetFileDescriptorRef = NULL; /* inputStream = assetManager.open(<filename>); */ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, assetManager), "open", "(Ljava/lang/String;I)Ljava/io/InputStream;"); inputStream = (*env)->CallObjectMethod(env, assetManager, mid, fileNameJString, 1 /* ACCESS_RANDOM */); if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { /* Try fallback to APK expansion files */ inputStream = (*env)->CallStaticObjectMethod(env, mActivityClass, midOpenAPKExpansionInputStream, fileNameJString); /* Exception is checked first because it always needs to be cleared. * If no exception occurred then the last SDL error message is kept. */ if (Android_JNI_ExceptionOccurred(SDL_FALSE) || !inputStream) { goto failure; } } ctx->hidden.androidio.inputStreamRef = (*env)->NewGlobalRef(env, inputStream); /* Despite all the visible documentation on [Asset]InputStream claiming * that the .available() method is not guaranteed to return the entire file * size, comments in <sdk>/samples/<ver>/ApiDemos/src/com/example/ ... * android/apis/content/ReadAsset.java imply that Android's * AssetInputStream.available() /will/ always return the total file size */ /* size = inputStream.available(); */ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, inputStream), "available", "()I"); ctx->hidden.androidio.size = (long)(*env)->CallIntMethod(env, inputStream, mid); if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { goto failure; } /* readableByteChannel = Channels.newChannel(inputStream); */ channels = (*env)->FindClass(env, "java/nio/channels/Channels"); mid = (*env)->GetStaticMethodID(env, channels, "newChannel", "(Ljava/io/InputStream;)Ljava/nio/channels/ReadableByteChannel;"); readableByteChannel = (*env)->CallStaticObjectMethod( env, channels, mid, inputStream); if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { goto failure; } ctx->hidden.androidio.readableByteChannelRef = (*env)->NewGlobalRef(env, readableByteChannel); /* Store .read id for reading purposes */ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, readableByteChannel), "read", "(Ljava/nio/ByteBuffer;)I"); ctx->hidden.androidio.readMethod = mid; } if (0) { failure: result = -1; (*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.fileNameRef); if(ctx->hidden.androidio.inputStreamRef != NULL) { (*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.inputStreamRef); } if(ctx->hidden.androidio.readableByteChannelRef != NULL) { (*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.readableByteChannelRef); } if(ctx->hidden.androidio.assetFileDescriptorRef != NULL) { (*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.assetFileDescriptorRef); } } LocalReferenceHolder_Cleanup(&refs); return result; } int Android_JNI_FileOpen(SDL_RWops *ctx, const char *fileName, const char *mode) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); JNIEnv *env = Android_JNI_GetEnv(); int retval; jstring fileNameJString; if (!LocalReferenceHolder_Init(&refs, env)) { LocalReferenceHolder_Cleanup(&refs); return -1; } if (!ctx) { LocalReferenceHolder_Cleanup(&refs); return -1; } fileNameJString = (*env)->NewStringUTF(env, fileName); ctx->hidden.androidio.fileNameRef = (*env)->NewGlobalRef(env, fileNameJString); ctx->hidden.androidio.inputStreamRef = NULL; ctx->hidden.androidio.readableByteChannelRef = NULL; ctx->hidden.androidio.readMethod = NULL; ctx->hidden.androidio.assetFileDescriptorRef = NULL; retval = Internal_Android_JNI_FileOpen(ctx); LocalReferenceHolder_Cleanup(&refs); return retval; } size_t Android_JNI_FileRead(SDL_RWops *ctx, void *buffer, size_t size, size_t maxnum) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); if (ctx->hidden.androidio.assetFileDescriptorRef) { size_t bytesMax = size * maxnum; size_t result; if (ctx->hidden.androidio.size != -1 /* UNKNOWN_LENGTH */ && ctx->hidden.androidio.position + bytesMax > ctx->hidden.androidio.size) { bytesMax = ctx->hidden.androidio.size - ctx->hidden.androidio.position; } result = read(ctx->hidden.androidio.fd, buffer, bytesMax ); if (result > 0) { ctx->hidden.androidio.position += result; LocalReferenceHolder_Cleanup(&refs); return result / size; } LocalReferenceHolder_Cleanup(&refs); return 0; } else { jlong bytesRemaining = (jlong) (size * maxnum); jlong bytesMax = (jlong) (ctx->hidden.androidio.size - ctx->hidden.androidio.position); int bytesRead = 0; JNIEnv *env; jobject readableByteChannel; jmethodID readMethod; jobject byteBuffer; /* Don't read more bytes than those that remain in the file, otherwise we get an exception */ if (bytesRemaining > bytesMax) bytesRemaining = bytesMax; env = Android_JNI_GetEnv(); if (!LocalReferenceHolder_Init(&refs, env)) { LocalReferenceHolder_Cleanup(&refs); return 0; } readableByteChannel = (jobject)ctx->hidden.androidio.readableByteChannelRef; readMethod = (jmethodID)ctx->hidden.androidio.readMethod; byteBuffer = (*env)->NewDirectByteBuffer(env, buffer, bytesRemaining); while (bytesRemaining > 0) { /* result = readableByteChannel.read(...); */ int result = (*env)->CallIntMethod(env, readableByteChannel, readMethod, byteBuffer); if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { LocalReferenceHolder_Cleanup(&refs); return 0; } if (result < 0) { break; } bytesRemaining -= result; bytesRead += result; ctx->hidden.androidio.position += result; } LocalReferenceHolder_Cleanup(&refs); return bytesRead / size; } } size_t Android_JNI_FileWrite(SDL_RWops *ctx, const void *buffer, size_t size, size_t num) { SDL_SetError("Cannot write to Android package filesystem"); return 0; } static int Internal_Android_JNI_FileClose(SDL_RWops *ctx, SDL_bool release) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); int result = 0; JNIEnv *env = Android_JNI_GetEnv(); if (!LocalReferenceHolder_Init(&refs, env)) { LocalReferenceHolder_Cleanup(&refs); return SDL_SetError("Failed to allocate enough JVM local references"); } if (ctx) { if (release) { (*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.fileNameRef); } if (ctx->hidden.androidio.assetFileDescriptorRef) { jobject inputStream = (jobject)ctx->hidden.androidio.assetFileDescriptorRef; jmethodID mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, inputStream), "close", "()V"); (*env)->CallVoidMethod(env, inputStream, mid); (*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.assetFileDescriptorRef); if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { result = -1; } } else { jobject inputStream = (jobject)ctx->hidden.androidio.inputStreamRef; /* inputStream.close(); */ jmethodID mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, inputStream), "close", "()V"); (*env)->CallVoidMethod(env, inputStream, mid); (*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.inputStreamRef); (*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.readableByteChannelRef); if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { result = -1; } } if (release) { SDL_FreeRW(ctx); } } LocalReferenceHolder_Cleanup(&refs); return result; } Sint64 Android_JNI_FileSize(SDL_RWops *ctx) { return ctx->hidden.androidio.size; } Sint64 Android_JNI_FileSeek(SDL_RWops *ctx, Sint64 offset, int whence) { if (ctx->hidden.androidio.assetFileDescriptorRef) { off_t ret; switch (whence) { case RW_SEEK_SET: if (ctx->hidden.androidio.size != -1 /* UNKNOWN_LENGTH */ && offset > ctx->hidden.androidio.size) offset = ctx->hidden.androidio.size; offset += ctx->hidden.androidio.offset; break; case RW_SEEK_CUR: offset += ctx->hidden.androidio.position; if (ctx->hidden.androidio.size != -1 /* UNKNOWN_LENGTH */ && offset > ctx->hidden.androidio.size) offset = ctx->hidden.androidio.size; offset += ctx->hidden.androidio.offset; break; case RW_SEEK_END: offset = ctx->hidden.androidio.offset + ctx->hidden.androidio.size + offset; break; default: return SDL_SetError("Unknown value for 'whence'"); } ret = lseek(ctx->hidden.androidio.fd, (off_t)offset, SEEK_SET); if (ret == -1) return -1; ctx->hidden.androidio.position = ret - ctx->hidden.androidio.offset; } else { Sint64 newPosition; Sint64 movement; switch (whence) { case RW_SEEK_SET: newPosition = offset; break; case RW_SEEK_CUR: newPosition = ctx->hidden.androidio.position + offset; break; case RW_SEEK_END: newPosition = ctx->hidden.androidio.size + offset; break; default: return SDL_SetError("Unknown value for 'whence'"); } /* Validate the new position */ if (newPosition < 0) { return SDL_Error(SDL_EFSEEK); } if (newPosition > ctx->hidden.androidio.size) { newPosition = ctx->hidden.androidio.size; } movement = newPosition - ctx->hidden.androidio.position; if (movement > 0) { unsigned char buffer[4096]; /* The easy case where we're seeking forwards */ while (movement > 0) { Sint64 amount = sizeof (buffer); size_t result; if (amount > movement) { amount = movement; } result = Android_JNI_FileRead(ctx, buffer, 1, (size_t)amount); if (result <= 0) { /* Failed to read/skip the required amount, so fail */ return -1; } movement -= result; } } else if (movement < 0) { /* We can't seek backwards so we have to reopen the file and seek */ /* forwards which obviously isn't very efficient */ Internal_Android_JNI_FileClose(ctx, SDL_FALSE); Internal_Android_JNI_FileOpen(ctx); Android_JNI_FileSeek(ctx, newPosition, RW_SEEK_SET); } } return ctx->hidden.androidio.position; } int Android_JNI_FileClose(SDL_RWops *ctx) { return Internal_Android_JNI_FileClose(ctx, SDL_TRUE); } int Android_JNI_SetClipboardText(const char *text) { JNIEnv *env = Android_JNI_GetEnv(); jstring string = (*env)->NewStringUTF(env, text); (*env)->CallStaticVoidMethod(env, mActivityClass, midClipboardSetText, string); (*env)->DeleteLocalRef(env, string); return 0; } char* Android_JNI_GetClipboardText(void) { JNIEnv *env = Android_JNI_GetEnv(); char *text = NULL; jstring string; string = (*env)->CallStaticObjectMethod(env, mActivityClass, midClipboardGetText); if (string) { const char *utf = (*env)->GetStringUTFChars(env, string, 0); if (utf) { text = SDL_strdup(utf); (*env)->ReleaseStringUTFChars(env, string, utf); } (*env)->DeleteLocalRef(env, string); } return (text == NULL) ? SDL_strdup("") : text; } SDL_bool Android_JNI_HasClipboardText(void) { JNIEnv *env = Android_JNI_GetEnv(); jboolean retval = (*env)->CallStaticBooleanMethod(env, mActivityClass, midClipboardHasText); return (retval == JNI_TRUE) ? SDL_TRUE : SDL_FALSE; } /* returns 0 on success or -1 on error (others undefined then) * returns truthy or falsy value in plugged, charged and battery * returns the value in seconds and percent or -1 if not available */ int Android_JNI_GetPowerInfo(int *plugged, int *charged, int *battery, int *seconds, int *percent) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); JNIEnv *env = Android_JNI_GetEnv(); jmethodID mid; jobject context; jstring action; jclass cls; jobject filter; jobject intent; jstring iname; jmethodID imid; jstring bname; jmethodID bmid; if (!LocalReferenceHolder_Init(&refs, env)) { LocalReferenceHolder_Cleanup(&refs); return -1; } /* context = SDLActivity.getContext(); */ context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); action = (*env)->NewStringUTF(env, "android.intent.action.BATTERY_CHANGED"); cls = (*env)->FindClass(env, "android/content/IntentFilter"); mid = (*env)->GetMethodID(env, cls, "<init>", "(Ljava/lang/String;)V"); filter = (*env)->NewObject(env, cls, mid, action); (*env)->DeleteLocalRef(env, action); mid = (*env)->GetMethodID(env, mActivityClass, "registerReceiver", "(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;"); intent = (*env)->CallObjectMethod(env, context, mid, NULL, filter); (*env)->DeleteLocalRef(env, filter); cls = (*env)->GetObjectClass(env, intent); imid = (*env)->GetMethodID(env, cls, "getIntExtra", "(Ljava/lang/String;I)I"); /* Watch out for C89 scoping rules because of the macro */ #define GET_INT_EXTRA(var, key) \ int var; \ iname = (*env)->NewStringUTF(env, key); \ (var) = (*env)->CallIntMethod(env, intent, imid, iname, -1); \ (*env)->DeleteLocalRef(env, iname); bmid = (*env)->GetMethodID(env, cls, "getBooleanExtra", "(Ljava/lang/String;Z)Z"); /* Watch out for C89 scoping rules because of the macro */ #define GET_BOOL_EXTRA(var, key) \ int var; \ bname = (*env)->NewStringUTF(env, key); \ (var) = (*env)->CallBooleanMethod(env, intent, bmid, bname, JNI_FALSE); \ (*env)->DeleteLocalRef(env, bname); if (plugged) { /* Watch out for C89 scoping rules because of the macro */ GET_INT_EXTRA(plug, "plugged") /* == BatteryManager.EXTRA_PLUGGED (API 5) */ if (plug == -1) { LocalReferenceHolder_Cleanup(&refs); return -1; } /* 1 == BatteryManager.BATTERY_PLUGGED_AC */ /* 2 == BatteryManager.BATTERY_PLUGGED_USB */ *plugged = (0 < plug) ? 1 : 0; } if (charged) { /* Watch out for C89 scoping rules because of the macro */ GET_INT_EXTRA(status, "status") /* == BatteryManager.EXTRA_STATUS (API 5) */ if (status == -1) { LocalReferenceHolder_Cleanup(&refs); return -1; } /* 5 == BatteryManager.BATTERY_STATUS_FULL */ *charged = (status == 5) ? 1 : 0; } if (battery) { GET_BOOL_EXTRA(present, "present") /* == BatteryManager.EXTRA_PRESENT (API 5) */ *battery = present ? 1 : 0; } if (seconds) { *seconds = -1; /* not possible */ } if (percent) { int level; int scale; /* Watch out for C89 scoping rules because of the macro */ { GET_INT_EXTRA(level_temp, "level") /* == BatteryManager.EXTRA_LEVEL (API 5) */ level = level_temp; } /* Watch out for C89 scoping rules because of the macro */ { GET_INT_EXTRA(scale_temp, "scale") /* == BatteryManager.EXTRA_SCALE (API 5) */ scale = scale_temp; } if ((level == -1) || (scale == -1)) { LocalReferenceHolder_Cleanup(&refs); return -1; } *percent = level * 100 / scale; } (*env)->DeleteLocalRef(env, intent); LocalReferenceHolder_Cleanup(&refs); return 0; } /* Add all touch devices */ void Android_JNI_InitTouch() { JNIEnv *env = Android_JNI_GetEnv(); (*env)->CallStaticVoidMethod(env, mActivityClass, midInitTouch); } void Android_JNI_PollInputDevices(void) { JNIEnv *env = Android_JNI_GetEnv(); (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midPollInputDevices); } void Android_JNI_PollHapticDevices(void) { JNIEnv *env = Android_JNI_GetEnv(); (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midPollHapticDevices); } void Android_JNI_HapticRun(int device_id, float intensity, int length) { JNIEnv *env = Android_JNI_GetEnv(); (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midHapticRun, device_id, intensity, length); } void Android_JNI_HapticStop(int device_id) { JNIEnv *env = Android_JNI_GetEnv(); (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midHapticStop, device_id); } /* See SDLActivity.java for constants. */ #define COMMAND_SET_KEEP_SCREEN_ON 5 /* sends message to be handled on the UI event dispatch thread */ int Android_JNI_SendMessage(int command, int param) { JNIEnv *env = Android_JNI_GetEnv(); jboolean success; success = (*env)->CallStaticBooleanMethod(env, mActivityClass, midSendMessage, command, param); return success ? 0 : -1; } void Android_JNI_SuspendScreenSaver(SDL_bool suspend) { Android_JNI_SendMessage(COMMAND_SET_KEEP_SCREEN_ON, (suspend == SDL_FALSE) ? 0 : 1); } void Android_JNI_ShowTextInput(SDL_Rect *inputRect) { JNIEnv *env = Android_JNI_GetEnv(); (*env)->CallStaticBooleanMethod(env, mActivityClass, midShowTextInput, inputRect->x, inputRect->y, inputRect->w, inputRect->h ); } void Android_JNI_HideTextInput(void) { /* has to match Activity constant */ const int COMMAND_TEXTEDIT_HIDE = 3; Android_JNI_SendMessage(COMMAND_TEXTEDIT_HIDE, 0); } SDL_bool Android_JNI_IsScreenKeyboardShown(void) { JNIEnv *env = Android_JNI_GetEnv(); jboolean is_shown = 0; is_shown = (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsScreenKeyboardShown); return is_shown; } int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) { JNIEnv *env; jclass clazz; jmethodID mid; jobject context; jstring title; jstring message; jintArray button_flags; jintArray button_ids; jobjectArray button_texts; jintArray colors; jobject text; jint temp; int i; env = Android_JNI_GetEnv(); /* convert parameters */ clazz = (*env)->FindClass(env, "java/lang/String"); title = (*env)->NewStringUTF(env, messageboxdata->title); message = (*env)->NewStringUTF(env, messageboxdata->message); button_flags = (*env)->NewIntArray(env, messageboxdata->numbuttons); button_ids = (*env)->NewIntArray(env, messageboxdata->numbuttons); button_texts = (*env)->NewObjectArray(env, messageboxdata->numbuttons, clazz, NULL); for (i = 0; i < messageboxdata->numbuttons; ++i) { const SDL_MessageBoxButtonData *sdlButton; if (messageboxdata->flags & SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT) { sdlButton = &messageboxdata->buttons[messageboxdata->numbuttons - 1 - i]; } else { sdlButton = &messageboxdata->buttons[i]; } temp = sdlButton->flags; (*env)->SetIntArrayRegion(env, button_flags, i, 1, &temp); temp = sdlButton->buttonid; (*env)->SetIntArrayRegion(env, button_ids, i, 1, &temp); text = (*env)->NewStringUTF(env, sdlButton->text); (*env)->SetObjectArrayElement(env, button_texts, i, text); (*env)->DeleteLocalRef(env, text); } if (messageboxdata->colorScheme) { colors = (*env)->NewIntArray(env, SDL_MESSAGEBOX_COLOR_MAX); for (i = 0; i < SDL_MESSAGEBOX_COLOR_MAX; ++i) { temp = (0xFFU << 24) | (messageboxdata->colorScheme->colors[i].r << 16) | (messageboxdata->colorScheme->colors[i].g << 8) | (messageboxdata->colorScheme->colors[i].b << 0); (*env)->SetIntArrayRegion(env, colors, i, 1, &temp); } } else { colors = NULL; } (*env)->DeleteLocalRef(env, clazz); /* context = SDLActivity.getContext(); */ context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); clazz = (*env)->GetObjectClass(env, context); mid = (*env)->GetMethodID(env, clazz, "messageboxShowMessageBox", "(ILjava/lang/String;Ljava/lang/String;[I[I[Ljava/lang/String;[I)I"); *buttonid = (*env)->CallIntMethod(env, context, mid, messageboxdata->flags, title, message, button_flags, button_ids, button_texts, colors); (*env)->DeleteLocalRef(env, context); (*env)->DeleteLocalRef(env, clazz); /* delete parameters */ (*env)->DeleteLocalRef(env, title); (*env)->DeleteLocalRef(env, message); (*env)->DeleteLocalRef(env, button_flags); (*env)->DeleteLocalRef(env, button_ids); (*env)->DeleteLocalRef(env, button_texts); (*env)->DeleteLocalRef(env, colors); return 0; } /* ////////////////////////////////////////////////////////////////////////////// // // Functions exposed to SDL applications in SDL_system.h ////////////////////////////////////////////////////////////////////////////// */ void *SDL_AndroidGetJNIEnv(void) { return Android_JNI_GetEnv(); } void *SDL_AndroidGetActivity(void) { /* See SDL_system.h for caveats on using this function. */ JNIEnv *env = Android_JNI_GetEnv(); if (!env) { return NULL; } /* return SDLActivity.getContext(); */ return (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); } int SDL_GetAndroidSDKVersion(void) { static int sdk_version; if (!sdk_version) { char sdk[PROP_VALUE_MAX] = {0}; if (__system_property_get("ro.build.version.sdk", sdk) != 0) { sdk_version = SDL_atoi(sdk); } } return sdk_version; } SDL_bool SDL_IsAndroidTablet(void) { JNIEnv *env = Android_JNI_GetEnv(); return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsTablet); } SDL_bool SDL_IsAndroidTV(void) { JNIEnv *env = Android_JNI_GetEnv(); return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsAndroidTV); } SDL_bool SDL_IsChromebook(void) { JNIEnv *env = Android_JNI_GetEnv(); return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsChromebook); } SDL_bool SDL_IsDeXMode(void) { JNIEnv *env = Android_JNI_GetEnv(); return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsDeXMode); } void SDL_AndroidBackButton(void) { JNIEnv *env = Android_JNI_GetEnv(); (*env)->CallStaticVoidMethod(env, mActivityClass, midManualBackButton); } const char * SDL_AndroidGetInternalStoragePath(void) { static char *s_AndroidInternalFilesPath = NULL; if (!s_AndroidInternalFilesPath) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); jmethodID mid; jobject context; jobject fileObject; jstring pathString; const char *path; JNIEnv *env = Android_JNI_GetEnv(); if (!LocalReferenceHolder_Init(&refs, env)) { LocalReferenceHolder_Cleanup(&refs); return NULL; } /* context = SDLActivity.getContext(); */ context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); if (!context) { SDL_SetError("Couldn't get Android context!"); LocalReferenceHolder_Cleanup(&refs); return NULL; } /* fileObj = context.getFilesDir(); */ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context), "getFilesDir", "()Ljava/io/File;"); fileObject = (*env)->CallObjectMethod(env, context, mid); if (!fileObject) { SDL_SetError("Couldn't get internal directory"); LocalReferenceHolder_Cleanup(&refs); return NULL; } /* path = fileObject.getCanonicalPath(); */ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, fileObject), "getCanonicalPath", "()Ljava/lang/String;"); pathString = (jstring)(*env)->CallObjectMethod(env, fileObject, mid); if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { LocalReferenceHolder_Cleanup(&refs); return NULL; } path = (*env)->GetStringUTFChars(env, pathString, NULL); s_AndroidInternalFilesPath = SDL_strdup(path); (*env)->ReleaseStringUTFChars(env, pathString, path); LocalReferenceHolder_Cleanup(&refs); } return s_AndroidInternalFilesPath; } int SDL_AndroidGetExternalStorageState(void) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); jmethodID mid; jclass cls; jstring stateString; const char *state; int stateFlags; JNIEnv *env = Android_JNI_GetEnv(); if (!LocalReferenceHolder_Init(&refs, env)) { LocalReferenceHolder_Cleanup(&refs); return 0; } cls = (*env)->FindClass(env, "android/os/Environment"); mid = (*env)->GetStaticMethodID(env, cls, "getExternalStorageState", "()Ljava/lang/String;"); stateString = (jstring)(*env)->CallStaticObjectMethod(env, cls, mid); state = (*env)->GetStringUTFChars(env, stateString, NULL); /* Print an info message so people debugging know the storage state */ __android_log_print(ANDROID_LOG_INFO, "SDL", "external storage state: %s", state); if (SDL_strcmp(state, "mounted") == 0) { stateFlags = SDL_ANDROID_EXTERNAL_STORAGE_READ | SDL_ANDROID_EXTERNAL_STORAGE_WRITE; } else if (SDL_strcmp(state, "mounted_ro") == 0) { stateFlags = SDL_ANDROID_EXTERNAL_STORAGE_READ; } else { stateFlags = 0; } (*env)->ReleaseStringUTFChars(env, stateString, state); LocalReferenceHolder_Cleanup(&refs); return stateFlags; } const char * SDL_AndroidGetExternalStoragePath(void) { static char *s_AndroidExternalFilesPath = NULL; if (!s_AndroidExternalFilesPath) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); jmethodID mid; jobject context; jobject fileObject; jstring pathString; const char *path; JNIEnv *env = Android_JNI_GetEnv(); if (!LocalReferenceHolder_Init(&refs, env)) { LocalReferenceHolder_Cleanup(&refs); return NULL; } /* context = SDLActivity.getContext(); */ context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); /* fileObj = context.getExternalFilesDir(); */ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context), "getExternalFilesDir", "(Ljava/lang/String;)Ljava/io/File;"); fileObject = (*env)->CallObjectMethod(env, context, mid, NULL); if (!fileObject) { SDL_SetError("Couldn't get external directory"); LocalReferenceHolder_Cleanup(&refs); return NULL; } /* path = fileObject.getAbsolutePath(); */ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, fileObject), "getAbsolutePath", "()Ljava/lang/String;"); pathString = (jstring)(*env)->CallObjectMethod(env, fileObject, mid); path = (*env)->GetStringUTFChars(env, pathString, NULL); s_AndroidExternalFilesPath = SDL_strdup(path); (*env)->ReleaseStringUTFChars(env, pathString, path); LocalReferenceHolder_Cleanup(&refs); } return s_AndroidExternalFilesPath; } void Android_JNI_GetManifestEnvironmentVariables(void) { if (!mActivityClass || !midGetManifestEnvironmentVariables) { __android_log_print(ANDROID_LOG_WARN, "SDL", "Request to get environment variables before JNI is ready"); return; } if (!bHasEnvironmentVariables) { JNIEnv *env = Android_JNI_GetEnv(); SDL_bool ret = (*env)->CallStaticBooleanMethod(env, mActivityClass, midGetManifestEnvironmentVariables); if (ret) { bHasEnvironmentVariables = SDL_TRUE; } } } int Android_JNI_CreateCustomCursor(SDL_Surface *surface, int hot_x, int hot_y) { JNIEnv *env = Android_JNI_GetEnv(); int custom_cursor = 0; jintArray pixels; pixels = (*env)->NewIntArray(env, surface->w * surface->h); if (pixels) { (*env)->SetIntArrayRegion(env, pixels, 0, surface->w * surface->h, (int *)surface->pixels); custom_cursor = (*env)->CallStaticIntMethod(env, mActivityClass, midCreateCustomCursor, pixels, surface->w, surface->h, hot_x, hot_y); (*env)->DeleteLocalRef(env, pixels); } else { SDL_OutOfMemory(); } return custom_cursor; } SDL_bool Android_JNI_SetCustomCursor(int cursorID) { JNIEnv *env = Android_JNI_GetEnv(); return (*env)->CallStaticBooleanMethod(env, mActivityClass, midSetCustomCursor, cursorID); } SDL_bool Android_JNI_SetSystemCursor(int cursorID) { JNIEnv *env = Android_JNI_GetEnv(); return (*env)->CallStaticBooleanMethod(env, mActivityClass, midSetSystemCursor, cursorID); } SDL_bool Android_JNI_SupportsRelativeMouse(void) { JNIEnv *env = Android_JNI_GetEnv(); return (*env)->CallStaticBooleanMethod(env, mActivityClass, midSupportsRelativeMouse); } SDL_bool Android_JNI_SetRelativeMouseEnabled(SDL_bool enabled) { JNIEnv *env = Android_JNI_GetEnv(); return (*env)->CallStaticBooleanMethod(env, mActivityClass, midSetRelativeMouseEnabled, (enabled == 1)); } SDL_bool Android_JNI_RequestPermission(const char *permission) { JNIEnv *env = Android_JNI_GetEnv(); const int requestCode = 1; /* Wait for any pending request on another thread */ while (SDL_AtomicGet(&bPermissionRequestPending) == SDL_TRUE) { SDL_Delay(10); } SDL_AtomicSet(&bPermissionRequestPending, SDL_TRUE); jstring jpermission = (*env)->NewStringUTF(env, permission); (*env)->CallStaticVoidMethod(env, mActivityClass, midRequestPermission, jpermission, requestCode); (*env)->DeleteLocalRef(env, jpermission); /* Wait for the request to complete */ while (SDL_AtomicGet(&bPermissionRequestPending) == SDL_TRUE) { SDL_Delay(10); } return bPermissionRequestResult; } int Android_JNI_GetLocale(char *buf, size_t buflen) { AConfiguration *cfg; SDL_assert(buflen > 6); /* Need to re-create the asset manager if locale has changed (SDL_LOCALECHANGED) */ Internal_Android_Destroy_AssetManager(); if (asset_manager == NULL) { Internal_Android_Create_AssetManager(); } if (asset_manager == NULL) { return -1; } cfg = AConfiguration_new(); if (cfg == NULL) { return -1; } { char language[2] = {}; char country[2] = {}; size_t id = 0; AConfiguration_fromAssetManager(cfg, asset_manager); AConfiguration_getLanguage(cfg, language); AConfiguration_getCountry(cfg, country); /* copy language (not null terminated) */ if (language[0]) { buf[id++] = language[0]; if (language[1]) { buf[id++] = language[1]; } } buf[id++] = '_'; /* copy country (not null terminated) */ if (country[0]) { buf[id++] = country[0]; if (country[1]) { buf[id++] = country[1]; } } buf[id++] = '\0'; SDL_assert(id <= buflen); } AConfiguration_delete(cfg); return 0; } #endif /* __ANDROID__ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/android/SDL_android.c
C
apache-2.0
106,906
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #include "SDL_system.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus /* *INDENT-OFF* */ extern "C" { /* *INDENT-ON* */ #endif #include <EGL/eglplatform.h> #include <android/native_window_jni.h> #include "SDL_audio.h" #include "SDL_rect.h" #include "SDL_video.h" /* Interface from the SDL library into the Android Java activity */ extern void Android_JNI_SetActivityTitle(const char *title); extern void Android_JNI_SetWindowStyle(SDL_bool fullscreen); extern void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint); extern void Android_JNI_MinizeWindow(void); extern SDL_bool Android_JNI_ShouldMinimizeOnFocusLoss(void); extern SDL_bool Android_JNI_GetAccelerometerValues(float values[3]); extern void Android_JNI_ShowTextInput(SDL_Rect *inputRect); extern void Android_JNI_HideTextInput(void); extern SDL_bool Android_JNI_IsScreenKeyboardShown(void); extern ANativeWindow* Android_JNI_GetNativeWindow(void); extern void Android_JNI_SetSurfaceViewFormat(int format); extern SDL_DisplayOrientation Android_JNI_GetDisplayOrientation(void); extern int Android_JNI_GetDisplayDPI(float *ddpi, float *xdpi, float *ydpi); /* Audio support */ extern int Android_JNI_OpenAudioDevice(int iscapture, SDL_AudioSpec *spec); extern void* Android_JNI_GetAudioBuffer(void); extern void Android_JNI_WriteAudioBuffer(void); extern int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen); extern void Android_JNI_FlushCapturedAudio(void); extern void Android_JNI_CloseAudioDevice(const int iscapture); extern void Android_JNI_AudioSetThreadPriority(int iscapture, int device_id); /* Detecting device type */ extern SDL_bool Android_IsDeXMode(void); extern SDL_bool Android_IsChromebook(void); #include "SDL_rwops.h" int Android_JNI_FileOpen(SDL_RWops* ctx, const char* fileName, const char* mode); Sint64 Android_JNI_FileSize(SDL_RWops* ctx); Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence); size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, size_t size, size_t maxnum); size_t Android_JNI_FileWrite(SDL_RWops* ctx, const void* buffer, size_t size, size_t num); int Android_JNI_FileClose(SDL_RWops* ctx); /* Environment support */ void Android_JNI_GetManifestEnvironmentVariables(void); /* Clipboard support */ int Android_JNI_SetClipboardText(const char* text); char* Android_JNI_GetClipboardText(void); SDL_bool Android_JNI_HasClipboardText(void); /* Power support */ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seconds, int* percent); /* Joystick support */ void Android_JNI_PollInputDevices(void); /* Haptic support */ void Android_JNI_PollHapticDevices(void); void Android_JNI_HapticRun(int device_id, float intensity, int length); void Android_JNI_HapticStop(int device_id); /* Video */ void Android_JNI_SuspendScreenSaver(SDL_bool suspend); /* Touch support */ void Android_JNI_InitTouch(void); /* Threads */ #include <jni.h> JNIEnv *Android_JNI_GetEnv(void); int Android_JNI_SetupThread(void); /* Locale */ int Android_JNI_GetLocale(char *buf, size_t buflen); /* Generic messages */ int Android_JNI_SendMessage(int command, int param); /* Init */ JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls); /* MessageBox */ #include "SDL_messagebox.h" int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); /* Cursor support */ int Android_JNI_CreateCustomCursor(SDL_Surface *surface, int hot_x, int hot_y); SDL_bool Android_JNI_SetCustomCursor(int cursorID); SDL_bool Android_JNI_SetSystemCursor(int cursorID); /* Relative mouse support */ SDL_bool Android_JNI_SupportsRelativeMouse(void); SDL_bool Android_JNI_SetRelativeMouseEnabled(SDL_bool enabled); /* Request permission */ SDL_bool Android_JNI_RequestPermission(const char *permission); int SDL_GetAndroidSDKVersion(void); SDL_bool SDL_IsAndroidTablet(void); SDL_bool SDL_IsAndroidTV(void); SDL_bool SDL_IsChromebook(void); SDL_bool SDL_IsDeXMode(void); void Android_ActivityMutex_Lock(void); void Android_ActivityMutex_Unlock(void); void Android_ActivityMutex_Lock_Running(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus /* *INDENT-OFF* */ } /* *INDENT-ON* */ #endif /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/android/SDL_android.h
C
apache-2.0
5,244
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef _ANDROID_KeyInfo #define _ANDROID_KeyInfo #include "SDL_scancode.h" #include "SDL_keycode.h" /* This file is used by the keyboard code in SDL_uikitview.m to convert between characters passed in from the iPhone's virtual keyboard, and tuples of SDL_Scancode and SDL_keymods. For example unicharToUIKeyInfoTable['a'] would give you the scan code and keymod for lower case a. */ typedef struct { SDL_Scancode code; uint16_t mod; } AndroidKeyInfo; /* So far only ASCII characters here */ static AndroidKeyInfo unicharToAndroidKeyInfoTable[] = { /* 0 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 1 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 2 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 3 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 4 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 5 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 6 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 7 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 8 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 9 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 10 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 11 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 12 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 13 */ { SDL_SCANCODE_RETURN, 0 }, /* 14 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 15 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 16 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 17 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 18 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 19 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 20 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 21 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 22 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 23 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 24 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 25 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 26 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 27 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 28 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 29 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 30 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 31 */ { SDL_SCANCODE_UNKNOWN, 0 }, /* 32 */ { SDL_SCANCODE_SPACE, 0 }, /* 33 */ { SDL_SCANCODE_1, KMOD_SHIFT }, /* plus shift modifier '!' */ /* 34 */ { SDL_SCANCODE_APOSTROPHE, KMOD_SHIFT }, /* plus shift modifier '"' */ /* 35 */ { SDL_SCANCODE_3, KMOD_SHIFT }, /* plus shift modifier '#' */ /* 36 */ { SDL_SCANCODE_4, KMOD_SHIFT }, /* plus shift modifier '$' */ /* 37 */ { SDL_SCANCODE_5, KMOD_SHIFT }, /* plus shift modifier '%' */ /* 38 */ { SDL_SCANCODE_7, KMOD_SHIFT }, /* plus shift modifier '&' */ /* 39 */ { SDL_SCANCODE_APOSTROPHE, 0 }, /* ''' */ /* 40 */ { SDL_SCANCODE_9, KMOD_SHIFT }, /* plus shift modifier '(' */ /* 41 */ { SDL_SCANCODE_0, KMOD_SHIFT }, /* plus shift modifier ')' */ /* 42 */ { SDL_SCANCODE_8, KMOD_SHIFT }, /* '*' */ /* 43 */ { SDL_SCANCODE_EQUALS, KMOD_SHIFT }, /* plus shift modifier '+' */ /* 44 */ { SDL_SCANCODE_COMMA, 0 }, /* ',' */ /* 45 */ { SDL_SCANCODE_MINUS, 0 }, /* '-' */ /* 46 */ { SDL_SCANCODE_PERIOD, 0 }, /* '.' */ /* 47 */ { SDL_SCANCODE_SLASH, 0 }, /* '/' */ /* 48 */ { SDL_SCANCODE_0, 0 }, /* 49 */ { SDL_SCANCODE_1, 0 }, /* 50 */ { SDL_SCANCODE_2, 0 }, /* 51 */ { SDL_SCANCODE_3, 0 }, /* 52 */ { SDL_SCANCODE_4, 0 }, /* 53 */ { SDL_SCANCODE_5, 0 }, /* 54 */ { SDL_SCANCODE_6, 0 }, /* 55 */ { SDL_SCANCODE_7, 0 }, /* 56 */ { SDL_SCANCODE_8, 0 }, /* 57 */ { SDL_SCANCODE_9, 0 }, /* 58 */ { SDL_SCANCODE_SEMICOLON, KMOD_SHIFT }, /* plus shift modifier ';' */ /* 59 */ { SDL_SCANCODE_SEMICOLON, 0 }, /* 60 */ { SDL_SCANCODE_COMMA, KMOD_SHIFT }, /* plus shift modifier '<' */ /* 61 */ { SDL_SCANCODE_EQUALS, 0 }, /* 62 */ { SDL_SCANCODE_PERIOD, KMOD_SHIFT }, /* plus shift modifier '>' */ /* 63 */ { SDL_SCANCODE_SLASH, KMOD_SHIFT }, /* plus shift modifier '?' */ /* 64 */ { SDL_SCANCODE_2, KMOD_SHIFT }, /* plus shift modifier '@' */ /* 65 */ { SDL_SCANCODE_A, KMOD_SHIFT }, /* all the following need shift modifiers */ /* 66 */ { SDL_SCANCODE_B, KMOD_SHIFT }, /* 67 */ { SDL_SCANCODE_C, KMOD_SHIFT }, /* 68 */ { SDL_SCANCODE_D, KMOD_SHIFT }, /* 69 */ { SDL_SCANCODE_E, KMOD_SHIFT }, /* 70 */ { SDL_SCANCODE_F, KMOD_SHIFT }, /* 71 */ { SDL_SCANCODE_G, KMOD_SHIFT }, /* 72 */ { SDL_SCANCODE_H, KMOD_SHIFT }, /* 73 */ { SDL_SCANCODE_I, KMOD_SHIFT }, /* 74 */ { SDL_SCANCODE_J, KMOD_SHIFT }, /* 75 */ { SDL_SCANCODE_K, KMOD_SHIFT }, /* 76 */ { SDL_SCANCODE_L, KMOD_SHIFT }, /* 77 */ { SDL_SCANCODE_M, KMOD_SHIFT }, /* 78 */ { SDL_SCANCODE_N, KMOD_SHIFT }, /* 79 */ { SDL_SCANCODE_O, KMOD_SHIFT }, /* 80 */ { SDL_SCANCODE_P, KMOD_SHIFT }, /* 81 */ { SDL_SCANCODE_Q, KMOD_SHIFT }, /* 82 */ { SDL_SCANCODE_R, KMOD_SHIFT }, /* 83 */ { SDL_SCANCODE_S, KMOD_SHIFT }, /* 84 */ { SDL_SCANCODE_T, KMOD_SHIFT }, /* 85 */ { SDL_SCANCODE_U, KMOD_SHIFT }, /* 86 */ { SDL_SCANCODE_V, KMOD_SHIFT }, /* 87 */ { SDL_SCANCODE_W, KMOD_SHIFT }, /* 88 */ { SDL_SCANCODE_X, KMOD_SHIFT }, /* 89 */ { SDL_SCANCODE_Y, KMOD_SHIFT }, /* 90 */ { SDL_SCANCODE_Z, KMOD_SHIFT }, /* 91 */ { SDL_SCANCODE_LEFTBRACKET, 0 }, /* 92 */ { SDL_SCANCODE_BACKSLASH, 0 }, /* 93 */ { SDL_SCANCODE_RIGHTBRACKET, 0 }, /* 94 */ { SDL_SCANCODE_6, KMOD_SHIFT }, /* plus shift modifier '^' */ /* 95 */ { SDL_SCANCODE_MINUS, KMOD_SHIFT }, /* plus shift modifier '_' */ /* 96 */ { SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* '`' */ /* 97 */ { SDL_SCANCODE_A, 0 }, /* 98 */ { SDL_SCANCODE_B, 0 }, /* 99 */ { SDL_SCANCODE_C, 0 }, /* 100 */{ SDL_SCANCODE_D, 0 }, /* 101 */{ SDL_SCANCODE_E, 0 }, /* 102 */{ SDL_SCANCODE_F, 0 }, /* 103 */{ SDL_SCANCODE_G, 0 }, /* 104 */{ SDL_SCANCODE_H, 0 }, /* 105 */{ SDL_SCANCODE_I, 0 }, /* 106 */{ SDL_SCANCODE_J, 0 }, /* 107 */{ SDL_SCANCODE_K, 0 }, /* 108 */{ SDL_SCANCODE_L, 0 }, /* 109 */{ SDL_SCANCODE_M, 0 }, /* 110 */{ SDL_SCANCODE_N, 0 }, /* 111 */{ SDL_SCANCODE_O, 0 }, /* 112 */{ SDL_SCANCODE_P, 0 }, /* 113 */{ SDL_SCANCODE_Q, 0 }, /* 114 */{ SDL_SCANCODE_R, 0 }, /* 115 */{ SDL_SCANCODE_S, 0 }, /* 116 */{ SDL_SCANCODE_T, 0 }, /* 117 */{ SDL_SCANCODE_U, 0 }, /* 118 */{ SDL_SCANCODE_V, 0 }, /* 119 */{ SDL_SCANCODE_W, 0 }, /* 120 */{ SDL_SCANCODE_X, 0 }, /* 121 */{ SDL_SCANCODE_Y, 0 }, /* 122 */{ SDL_SCANCODE_Z, 0 }, /* 123 */{ SDL_SCANCODE_LEFTBRACKET, KMOD_SHIFT }, /* plus shift modifier '{' */ /* 124 */{ SDL_SCANCODE_BACKSLASH, KMOD_SHIFT }, /* plus shift modifier '|' */ /* 125 */{ SDL_SCANCODE_RIGHTBRACKET, KMOD_SHIFT }, /* plus shift modifier '}' */ /* 126 */{ SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* plus shift modifier '~' */ /* 127 */{ SDL_SCANCODE_BACKSPACE, KMOD_SHIFT } }; #endif /* _ANDROID_KeyInfo */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/android/keyinfotable.h
C
apache-2.0
7,951
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #include "SDL_dbus.h" #if SDL_USE_LIBDBUS /* we never link directly to libdbus. */ #include "SDL_loadso.h" static const char *dbus_library = "libdbus-1.so.3"; static void *dbus_handle = NULL; static unsigned int screensaver_cookie = 0; static SDL_DBusContext dbus; static int LoadDBUSSyms(void) { #define SDL_DBUS_SYM2(x, y) \ if (!(dbus.x = SDL_LoadFunction(dbus_handle, #y))) return -1 #define SDL_DBUS_SYM(x) \ SDL_DBUS_SYM2(x, dbus_##x) SDL_DBUS_SYM(bus_get_private); SDL_DBUS_SYM(bus_register); SDL_DBUS_SYM(bus_add_match); SDL_DBUS_SYM(connection_open_private); SDL_DBUS_SYM(connection_set_exit_on_disconnect); SDL_DBUS_SYM(connection_get_is_connected); SDL_DBUS_SYM(connection_add_filter); SDL_DBUS_SYM(connection_try_register_object_path); SDL_DBUS_SYM(connection_send); SDL_DBUS_SYM(connection_send_with_reply_and_block); SDL_DBUS_SYM(connection_close); SDL_DBUS_SYM(connection_unref); SDL_DBUS_SYM(connection_flush); SDL_DBUS_SYM(connection_read_write); SDL_DBUS_SYM(connection_dispatch); SDL_DBUS_SYM(message_is_signal); SDL_DBUS_SYM(message_new_method_call); SDL_DBUS_SYM(message_append_args); SDL_DBUS_SYM(message_append_args_valist); SDL_DBUS_SYM(message_iter_init_append); SDL_DBUS_SYM(message_iter_open_container); SDL_DBUS_SYM(message_iter_append_basic); SDL_DBUS_SYM(message_iter_close_container); SDL_DBUS_SYM(message_get_args); SDL_DBUS_SYM(message_get_args_valist); SDL_DBUS_SYM(message_iter_init); SDL_DBUS_SYM(message_iter_next); SDL_DBUS_SYM(message_iter_get_basic); SDL_DBUS_SYM(message_iter_get_arg_type); SDL_DBUS_SYM(message_iter_recurse); SDL_DBUS_SYM(message_unref); SDL_DBUS_SYM(threads_init_default); SDL_DBUS_SYM(error_init); SDL_DBUS_SYM(error_is_set); SDL_DBUS_SYM(error_free); SDL_DBUS_SYM(get_local_machine_id); SDL_DBUS_SYM(free); SDL_DBUS_SYM(free_string_array); SDL_DBUS_SYM(shutdown); #undef SDL_DBUS_SYM #undef SDL_DBUS_SYM2 return 0; } static void UnloadDBUSLibrary(void) { if (dbus_handle != NULL) { SDL_UnloadObject(dbus_handle); dbus_handle = NULL; } } static int LoadDBUSLibrary(void) { int retval = 0; if (dbus_handle == NULL) { dbus_handle = SDL_LoadObject(dbus_library); if (dbus_handle == NULL) { retval = -1; /* Don't call SDL_SetError(): SDL_LoadObject already did. */ } else { retval = LoadDBUSSyms(); if (retval < 0) { UnloadDBUSLibrary(); } } } return retval; } void SDL_DBus_Init(void) { static SDL_bool is_dbus_available = SDL_TRUE; if (!is_dbus_available) { return; /* don't keep trying if this fails. */ } if (!dbus.session_conn) { DBusError err; if (LoadDBUSLibrary() == -1) { is_dbus_available = SDL_FALSE; /* can't load at all? Don't keep trying. */ return; /* oh well */ } if (!dbus.threads_init_default()) { is_dbus_available = SDL_FALSE; return; } dbus.error_init(&err); /* session bus is required */ dbus.session_conn = dbus.bus_get_private(DBUS_BUS_SESSION, &err); if (dbus.error_is_set(&err)) { dbus.error_free(&err); SDL_DBus_Quit(); is_dbus_available = SDL_FALSE; return; /* oh well */ } dbus.connection_set_exit_on_disconnect(dbus.session_conn, 0); /* system bus is optional */ dbus.system_conn = dbus.bus_get_private(DBUS_BUS_SYSTEM, &err); if (!dbus.error_is_set(&err)) { dbus.connection_set_exit_on_disconnect(dbus.system_conn, 0); } dbus.error_free(&err); } } void SDL_DBus_Quit(void) { if (dbus.system_conn) { dbus.connection_close(dbus.system_conn); dbus.connection_unref(dbus.system_conn); } if (dbus.session_conn) { dbus.connection_close(dbus.session_conn); dbus.connection_unref(dbus.session_conn); } /* Don't do this - bug 3950 dbus_shutdown() is a debug feature which closes all global resources in the dbus library. Calling this should be done by the app, not a library, because if there are multiple users of dbus in the process then SDL could shut it down even though another part is using it. */ #if 0 if (dbus.shutdown) { dbus.shutdown(); } #endif SDL_zero(dbus); UnloadDBUSLibrary(); } SDL_DBusContext * SDL_DBus_GetContext(void) { if (!dbus_handle || !dbus.session_conn) { SDL_DBus_Init(); } return (dbus_handle && dbus.session_conn) ? &dbus : NULL; } static SDL_bool SDL_DBus_CallMethodInternal(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, va_list ap) { SDL_bool retval = SDL_FALSE; if (conn) { DBusMessage *msg = dbus.message_new_method_call(node, path, interface, method); if (msg) { int firstarg; va_list ap_reply; va_copy(ap_reply, ap); /* copy the arg list so we don't compete with D-Bus for it */ firstarg = va_arg(ap, int); if ((firstarg == DBUS_TYPE_INVALID) || dbus.message_append_args_valist(msg, firstarg, ap)) { DBusMessage *reply = dbus.connection_send_with_reply_and_block(conn, msg, 300, NULL); if (reply) { /* skip any input args, get to output args. */ while ((firstarg = va_arg(ap_reply, int)) != DBUS_TYPE_INVALID) { /* we assume D-Bus already validated all this. */ { void *dumpptr = va_arg(ap_reply, void*); (void) dumpptr; } if (firstarg == DBUS_TYPE_ARRAY) { { const int dumpint = va_arg(ap_reply, int); (void) dumpint; } } } firstarg = va_arg(ap_reply, int); if ((firstarg == DBUS_TYPE_INVALID) || dbus.message_get_args_valist(reply, NULL, firstarg, ap_reply)) { retval = SDL_TRUE; } dbus.message_unref(reply); } } va_end(ap_reply); dbus.message_unref(msg); } } return retval; } SDL_bool SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...) { SDL_bool retval; va_list ap; va_start(ap, method); retval = SDL_DBus_CallMethodInternal(conn, node, path, interface, method, ap); va_end(ap); return retval; } SDL_bool SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...) { SDL_bool retval; va_list ap; va_start(ap, method); retval = SDL_DBus_CallMethodInternal(dbus.session_conn, node, path, interface, method, ap); va_end(ap); return retval; } static SDL_bool SDL_DBus_CallVoidMethodInternal(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, va_list ap) { SDL_bool retval = SDL_FALSE; if (conn) { DBusMessage *msg = dbus.message_new_method_call(node, path, interface, method); if (msg) { int firstarg = va_arg(ap, int); if ((firstarg == DBUS_TYPE_INVALID) || dbus.message_append_args_valist(msg, firstarg, ap)) { if (dbus.connection_send(conn, msg, NULL)) { dbus.connection_flush(conn); retval = SDL_TRUE; } } dbus.message_unref(msg); } } return retval; } SDL_bool SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...) { SDL_bool retval; va_list ap; va_start(ap, method); retval = SDL_DBus_CallVoidMethodInternal(conn, node, path, interface, method, ap); va_end(ap); return retval; } SDL_bool SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...) { SDL_bool retval; va_list ap; va_start(ap, method); retval = SDL_DBus_CallVoidMethodInternal(dbus.session_conn, node, path, interface, method, ap); va_end(ap); return retval; } SDL_bool SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result) { SDL_bool retval = SDL_FALSE; if (conn) { DBusMessage *msg = dbus.message_new_method_call(node, path, "org.freedesktop.DBus.Properties", "Get"); if (msg) { if (dbus.message_append_args(msg, DBUS_TYPE_STRING, &interface, DBUS_TYPE_STRING, &property, DBUS_TYPE_INVALID)) { DBusMessage *reply = dbus.connection_send_with_reply_and_block(conn, msg, 300, NULL); if (reply) { DBusMessageIter iter, sub; dbus.message_iter_init(reply, &iter); if (dbus.message_iter_get_arg_type(&iter) == DBUS_TYPE_VARIANT) { dbus.message_iter_recurse(&iter, &sub); if (dbus.message_iter_get_arg_type(&sub) == expectedtype) { dbus.message_iter_get_basic(&sub, result); retval = SDL_TRUE; } } dbus.message_unref(reply); } } dbus.message_unref(msg); } } return retval; } SDL_bool SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result) { return SDL_DBus_QueryPropertyOnConnection(dbus.session_conn, node, path, interface, property, expectedtype, result); } void SDL_DBus_ScreensaverTickle(void) { if (screensaver_cookie == 0) { /* no need to tickle if we're inhibiting. */ /* org.gnome.ScreenSaver is the legacy interface, but it'll either do nothing or just be a second harmless tickle on newer systems, so we leave it for now. */ SDL_DBus_CallVoidMethod("org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID); SDL_DBus_CallVoidMethod("org.freedesktop.ScreenSaver", "/org/freedesktop/ScreenSaver", "org.freedesktop.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID); } } SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit) { if ( (inhibit && (screensaver_cookie != 0)) || (!inhibit && (screensaver_cookie == 0)) ) { return SDL_TRUE; } else { const char *node = "org.freedesktop.ScreenSaver"; const char *path = "/org/freedesktop/ScreenSaver"; const char *interface = "org.freedesktop.ScreenSaver"; if (inhibit) { const char *app = "My SDL application"; const char *reason = "Playing a game"; if (!SDL_DBus_CallMethod(node, path, interface, "Inhibit", DBUS_TYPE_STRING, &app, DBUS_TYPE_STRING, &reason, DBUS_TYPE_INVALID, DBUS_TYPE_UINT32, &screensaver_cookie, DBUS_TYPE_INVALID)) { return SDL_FALSE; } return (screensaver_cookie != 0) ? SDL_TRUE : SDL_FALSE; } else { if (!SDL_DBus_CallVoidMethod(node, path, interface, "UnInhibit", DBUS_TYPE_UINT32, &screensaver_cookie, DBUS_TYPE_INVALID)) { return SDL_FALSE; } screensaver_cookie = 0; } } return SDL_TRUE; } #endif /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/linux/SDL_dbus.c
C
apache-2.0
12,826
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifndef SDL_dbus_h_ #define SDL_dbus_h_ #ifdef HAVE_DBUS_DBUS_H #define SDL_USE_LIBDBUS 1 #include "SDL_stdinc.h" #include <dbus/dbus.h> typedef struct SDL_DBusContext { DBusConnection *session_conn; DBusConnection *system_conn; DBusConnection *(*bus_get_private)(DBusBusType, DBusError *); dbus_bool_t (*bus_register)(DBusConnection *, DBusError *); void (*bus_add_match)(DBusConnection *, const char *, DBusError *); DBusConnection * (*connection_open_private)(const char *, DBusError *); void (*connection_set_exit_on_disconnect)(DBusConnection *, dbus_bool_t); dbus_bool_t (*connection_get_is_connected)(DBusConnection *); dbus_bool_t (*connection_add_filter)(DBusConnection *, DBusHandleMessageFunction, void *, DBusFreeFunction); dbus_bool_t (*connection_try_register_object_path)(DBusConnection *, const char *, const DBusObjectPathVTable *, void *, DBusError *); dbus_bool_t (*connection_send)(DBusConnection *, DBusMessage *, dbus_uint32_t *); DBusMessage *(*connection_send_with_reply_and_block)(DBusConnection *, DBusMessage *, int, DBusError *); void (*connection_close)(DBusConnection *); void (*connection_unref)(DBusConnection *); void (*connection_flush)(DBusConnection *); dbus_bool_t (*connection_read_write)(DBusConnection *, int); DBusDispatchStatus (*connection_dispatch)(DBusConnection *); dbus_bool_t (*message_is_signal)(DBusMessage *, const char *, const char *); DBusMessage *(*message_new_method_call)(const char *, const char *, const char *, const char *); dbus_bool_t (*message_append_args)(DBusMessage *, int, ...); dbus_bool_t (*message_append_args_valist)(DBusMessage *, int, va_list); void (*message_iter_init_append)(DBusMessage *, DBusMessageIter *); dbus_bool_t (*message_iter_open_container)(DBusMessageIter *, int, const char *, DBusMessageIter *); dbus_bool_t (*message_iter_append_basic)(DBusMessageIter *, int, const void *); dbus_bool_t (*message_iter_close_container)(DBusMessageIter *, DBusMessageIter *); dbus_bool_t (*message_get_args)(DBusMessage *, DBusError *, int, ...); dbus_bool_t (*message_get_args_valist)(DBusMessage *, DBusError *, int, va_list); dbus_bool_t (*message_iter_init)(DBusMessage *, DBusMessageIter *); dbus_bool_t (*message_iter_next)(DBusMessageIter *); void (*message_iter_get_basic)(DBusMessageIter *, void *); int (*message_iter_get_arg_type)(DBusMessageIter *); void (*message_iter_recurse)(DBusMessageIter *, DBusMessageIter *); void (*message_unref)(DBusMessage *); dbus_bool_t (*threads_init_default)(void); void (*error_init)(DBusError *); dbus_bool_t (*error_is_set)(const DBusError *); void (*error_free)(DBusError *); char *(*get_local_machine_id)(void); void (*free)(void *); void (*free_string_array)(char **); void (*shutdown)(void); } SDL_DBusContext; extern void SDL_DBus_Init(void); extern void SDL_DBus_Quit(void); extern SDL_DBusContext * SDL_DBus_GetContext(void); /* These use the built-in Session connection. */ extern SDL_bool SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...); extern SDL_bool SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...); extern SDL_bool SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result); /* These use whatever connection you like. */ extern SDL_bool SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...); extern SDL_bool SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...); extern SDL_bool SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result); extern void SDL_DBus_ScreensaverTickle(void); extern SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit); #endif /* HAVE_DBUS_DBUS_H */ #endif /* SDL_dbus_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/linux/SDL_dbus.h
C
apache-2.0
5,221
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifdef SDL_INPUT_LINUXEV /* This is based on the linux joystick driver */ /* References: https://www.kernel.org/doc/Documentation/input/input.txt * https://www.kernel.org/doc/Documentation/input/event-codes.txt * /usr/include/linux/input.h * The evtest application is also useful to debug the protocol */ #include "SDL_evdev.h" #include "SDL_evdev_kbd.h" #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> #include <sys/ioctl.h> #include <linux/input.h> #include "SDL.h" #include "SDL_assert.h" #include "SDL_endian.h" #include "SDL_scancode.h" #include "../../events/SDL_events_c.h" #include "../../events/scancodes_linux.h" /* adds linux_scancode_table */ #include "../../core/linux/SDL_udev.h" /* These are not defined in older Linux kernel headers */ #ifndef SYN_DROPPED #define SYN_DROPPED 3 #endif #ifndef ABS_MT_SLOT #define ABS_MT_SLOT 0x2f #define ABS_MT_POSITION_X 0x35 #define ABS_MT_POSITION_Y 0x36 #define ABS_MT_TRACKING_ID 0x39 #define ABS_MT_PRESSURE 0x3a #endif typedef struct SDL_evdevlist_item { char *path; int fd; /* TODO: use this for every device, not just touchscreen */ int out_of_sync; /* TODO: expand on this to have data for every possible class (mouse, keyboard, touchpad, etc.). Also there's probably some things in here we can pull out to the SDL_evdevlist_item i.e. name */ int is_touchscreen; struct { char* name; int min_x, max_x, range_x; int min_y, max_y, range_y; int min_pressure, max_pressure, range_pressure; int max_slots; int current_slot; struct { enum { EVDEV_TOUCH_SLOTDELTA_NONE = 0, EVDEV_TOUCH_SLOTDELTA_DOWN, EVDEV_TOUCH_SLOTDELTA_UP, EVDEV_TOUCH_SLOTDELTA_MOVE } delta; int tracking_id; int x, y, pressure; } * slots; } * touchscreen_data; struct SDL_evdevlist_item *next; } SDL_evdevlist_item; typedef struct SDL_EVDEV_PrivateData { int ref_count; int num_devices; SDL_evdevlist_item *first; SDL_evdevlist_item *last; SDL_EVDEV_keyboard_state *kbd; } SDL_EVDEV_PrivateData; #undef _THIS #define _THIS SDL_EVDEV_PrivateData *_this static _THIS = NULL; static SDL_Scancode SDL_EVDEV_translate_keycode(int keycode); static void SDL_EVDEV_sync_device(SDL_evdevlist_item *item); static int SDL_EVDEV_device_removed(const char *dev_path); #if SDL_USE_LIBUDEV static int SDL_EVDEV_device_added(const char *dev_path, int udev_class); static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *dev_path); #endif /* SDL_USE_LIBUDEV */ static Uint8 EVDEV_MouseButtons[] = { SDL_BUTTON_LEFT, /* BTN_LEFT 0x110 */ SDL_BUTTON_RIGHT, /* BTN_RIGHT 0x111 */ SDL_BUTTON_MIDDLE, /* BTN_MIDDLE 0x112 */ SDL_BUTTON_X1, /* BTN_SIDE 0x113 */ SDL_BUTTON_X2, /* BTN_EXTRA 0x114 */ SDL_BUTTON_X2 + 1, /* BTN_FORWARD 0x115 */ SDL_BUTTON_X2 + 2, /* BTN_BACK 0x116 */ SDL_BUTTON_X2 + 3 /* BTN_TASK 0x117 */ }; static int SDL_EVDEV_SetRelativeMouseMode(SDL_bool enabled) { /* Mice already send relative events through this interface */ return 0; } int SDL_EVDEV_Init(void) { if (_this == NULL) { _this = (SDL_EVDEV_PrivateData*)SDL_calloc(1, sizeof(*_this)); if (_this == NULL) { return SDL_OutOfMemory(); } #if SDL_USE_LIBUDEV if (SDL_UDEV_Init() < 0) { SDL_free(_this); _this = NULL; return -1; } /* Set up the udev callback */ if (SDL_UDEV_AddCallback(SDL_EVDEV_udev_callback) < 0) { SDL_UDEV_Quit(); SDL_free(_this); _this = NULL; return -1; } /* Force a scan to build the initial device list */ SDL_UDEV_Scan(); #else /* TODO: Scan the devices manually, like a caveman */ #endif /* SDL_USE_LIBUDEV */ _this->kbd = SDL_EVDEV_kbd_init(); } SDL_GetMouse()->SetRelativeMouseMode = SDL_EVDEV_SetRelativeMouseMode; _this->ref_count += 1; return 0; } void SDL_EVDEV_Quit(void) { if (_this == NULL) { return; } _this->ref_count -= 1; if (_this->ref_count < 1) { #if SDL_USE_LIBUDEV SDL_UDEV_DelCallback(SDL_EVDEV_udev_callback); SDL_UDEV_Quit(); #endif /* SDL_USE_LIBUDEV */ SDL_EVDEV_kbd_quit(_this->kbd); /* Remove existing devices */ while(_this->first != NULL) { SDL_EVDEV_device_removed(_this->first->path); } SDL_assert(_this->first == NULL); SDL_assert(_this->last == NULL); SDL_assert(_this->num_devices == 0); SDL_free(_this); _this = NULL; } } #if SDL_USE_LIBUDEV static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class, const char* dev_path) { if (dev_path == NULL) { return; } switch(udev_event) { case SDL_UDEV_DEVICEADDED: if (!(udev_class & (SDL_UDEV_DEVICE_MOUSE | SDL_UDEV_DEVICE_KEYBOARD | SDL_UDEV_DEVICE_TOUCHSCREEN))) return; SDL_EVDEV_device_added(dev_path, udev_class); break; case SDL_UDEV_DEVICEREMOVED: SDL_EVDEV_device_removed(dev_path); break; default: break; } } #endif /* SDL_USE_LIBUDEV */ void SDL_EVDEV_Poll(void) { struct input_event events[32]; int i, j, len; SDL_evdevlist_item *item; SDL_Scancode scan_code; int mouse_button; SDL_Mouse *mouse; float norm_x, norm_y, norm_pressure; if (!_this) { return; } #if SDL_USE_LIBUDEV SDL_UDEV_Poll(); #endif mouse = SDL_GetMouse(); for (item = _this->first; item != NULL; item = item->next) { while ((len = read(item->fd, events, (sizeof events))) > 0) { len /= sizeof(events[0]); for (i = 0; i < len; ++i) { /* special handling for touchscreen, that should eventually be used for all devices */ if (item->out_of_sync && item->is_touchscreen && events[i].type == EV_SYN && events[i].code != SYN_REPORT) { break; } switch (events[i].type) { case EV_KEY: if (events[i].code >= BTN_MOUSE && events[i].code < BTN_MOUSE + SDL_arraysize(EVDEV_MouseButtons)) { mouse_button = events[i].code - BTN_MOUSE; if (events[i].value == 0) { SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_RELEASED, EVDEV_MouseButtons[mouse_button]); } else if (events[i].value == 1) { SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_PRESSED, EVDEV_MouseButtons[mouse_button]); } break; } /* BTH_TOUCH event value 1 indicates there is contact with a touchscreen or trackpad (earlist finger's current position is sent in EV_ABS ABS_X/ABS_Y, switching to next finger after earlist is released) */ if (item->is_touchscreen && events[i].code == BTN_TOUCH) { if (item->touchscreen_data->max_slots == 1) { if (events[i].value) item->touchscreen_data->slots[0].delta = EVDEV_TOUCH_SLOTDELTA_DOWN; else item->touchscreen_data->slots[0].delta = EVDEV_TOUCH_SLOTDELTA_UP; } break; } /* Probably keyboard */ scan_code = SDL_EVDEV_translate_keycode(events[i].code); if (scan_code != SDL_SCANCODE_UNKNOWN) { if (events[i].value == 0) { SDL_SendKeyboardKey(SDL_RELEASED, scan_code); } else if (events[i].value == 1 || events[i].value == 2 /* key repeated */) { SDL_SendKeyboardKey(SDL_PRESSED, scan_code); } } SDL_EVDEV_kbd_keycode(_this->kbd, events[i].code, events[i].value); break; case EV_ABS: switch(events[i].code) { case ABS_MT_SLOT: if (!item->is_touchscreen) /* FIXME: temp hack */ break; item->touchscreen_data->current_slot = events[i].value; break; case ABS_MT_TRACKING_ID: if (!item->is_touchscreen) /* FIXME: temp hack */ break; if (events[i].value >= 0) { item->touchscreen_data->slots[item->touchscreen_data->current_slot].tracking_id = events[i].value; item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_DOWN; } else { item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_UP; } break; case ABS_MT_POSITION_X: if (!item->is_touchscreen) /* FIXME: temp hack */ break; item->touchscreen_data->slots[item->touchscreen_data->current_slot].x = events[i].value; if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) { item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE; } break; case ABS_MT_POSITION_Y: if (!item->is_touchscreen) /* FIXME: temp hack */ break; item->touchscreen_data->slots[item->touchscreen_data->current_slot].y = events[i].value; if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) { item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE; } break; case ABS_MT_PRESSURE: if (!item->is_touchscreen) /* FIXME: temp hack */ break; item->touchscreen_data->slots[item->touchscreen_data->current_slot].pressure = events[i].value; if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) { item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE; } break; case ABS_X: if (item->is_touchscreen) { if (item->touchscreen_data->max_slots != 1) break; item->touchscreen_data->slots[0].x = events[i].value; } else SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, events[i].value, mouse->y); break; case ABS_Y: if (item->is_touchscreen) { if (item->touchscreen_data->max_slots != 1) break; item->touchscreen_data->slots[0].y = events[i].value; } else SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, mouse->x, events[i].value); break; default: break; } break; case EV_REL: switch(events[i].code) { case REL_X: SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_TRUE, events[i].value, 0); break; case REL_Y: SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_TRUE, 0, events[i].value); break; case REL_WHEEL: SDL_SendMouseWheel(mouse->focus, mouse->mouseID, 0, events[i].value, SDL_MOUSEWHEEL_NORMAL); break; case REL_HWHEEL: SDL_SendMouseWheel(mouse->focus, mouse->mouseID, events[i].value, 0, SDL_MOUSEWHEEL_NORMAL); break; default: break; } break; case EV_SYN: switch (events[i].code) { case SYN_REPORT: if (!item->is_touchscreen) /* FIXME: temp hack */ break; for(j = 0; j < item->touchscreen_data->max_slots; j++) { norm_x = (float)(item->touchscreen_data->slots[j].x - item->touchscreen_data->min_x) / (float)item->touchscreen_data->range_x; norm_y = (float)(item->touchscreen_data->slots[j].y - item->touchscreen_data->min_y) / (float)item->touchscreen_data->range_y; if (item->touchscreen_data->range_pressure > 0) { norm_pressure = (float)(item->touchscreen_data->slots[j].pressure - item->touchscreen_data->min_pressure) / (float)item->touchscreen_data->range_pressure; } else { /* This touchscreen does not support pressure */ norm_pressure = 1.0f; } /* FIXME: the touch's window shouldn't be null, but * the coordinate space of touch positions needs to * be window-relative in that case. */ switch(item->touchscreen_data->slots[j].delta) { case EVDEV_TOUCH_SLOTDELTA_DOWN: SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, SDL_TRUE, norm_x, norm_y, norm_pressure); item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE; break; case EVDEV_TOUCH_SLOTDELTA_UP: SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, SDL_FALSE, norm_x, norm_y, norm_pressure); item->touchscreen_data->slots[j].tracking_id = -1; item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE; break; case EVDEV_TOUCH_SLOTDELTA_MOVE: SDL_SendTouchMotion(item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, norm_x, norm_y, norm_pressure); item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE; break; default: break; } } if (item->out_of_sync) item->out_of_sync = 0; break; case SYN_DROPPED: if (item->is_touchscreen) item->out_of_sync = 1; SDL_EVDEV_sync_device(item); break; default: break; } break; } } } } } static SDL_Scancode SDL_EVDEV_translate_keycode(int keycode) { SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN; if (keycode < SDL_arraysize(linux_scancode_table)) { scancode = linux_scancode_table[keycode]; if (scancode == SDL_SCANCODE_UNKNOWN) { /* BTN_TOUCH is handled elsewhere, but we might still end up here if you get an unexpected BTN_TOUCH from something SDL believes is not a touch device. In this case, we'd rather not get a misleading SDL_Log message about an unknown key. */ if (keycode != BTN_TOUCH) { SDL_Log("The key you just pressed is not recognized by SDL. To help " "get this fixed, please report this to the SDL forums/mailing list " "<https://discourse.libsdl.org/> EVDEV KeyCode %d", keycode); } } } return scancode; } #ifdef SDL_USE_LIBUDEV static int SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item) { int ret, i; unsigned long xreq, yreq; char name[64]; struct input_absinfo abs_info; if (!item->is_touchscreen) return 0; item->touchscreen_data = SDL_calloc(1, sizeof(*item->touchscreen_data)); if (item->touchscreen_data == NULL) return SDL_OutOfMemory(); ret = ioctl(item->fd, EVIOCGNAME(sizeof(name)), name); if (ret < 0) { SDL_free(item->touchscreen_data); return SDL_SetError("Failed to get evdev touchscreen name"); } item->touchscreen_data->name = SDL_strdup(name); if (item->touchscreen_data->name == NULL) { SDL_free(item->touchscreen_data); return SDL_OutOfMemory(); } ret = ioctl(item->fd, EVIOCGABS(ABS_MT_SLOT), &abs_info); if (ret < 0) { SDL_free(item->touchscreen_data->name); SDL_free(item->touchscreen_data); return SDL_SetError("Failed to get evdev touchscreen limits"); } if (abs_info.maximum == 0) { item->touchscreen_data->max_slots = 1; xreq = EVIOCGABS(ABS_X); yreq = EVIOCGABS(ABS_Y); } else { item->touchscreen_data->max_slots = abs_info.maximum + 1; xreq = EVIOCGABS(ABS_MT_POSITION_X); yreq = EVIOCGABS(ABS_MT_POSITION_Y); } ret = ioctl(item->fd, xreq, &abs_info); if (ret < 0) { SDL_free(item->touchscreen_data->name); SDL_free(item->touchscreen_data); return SDL_SetError("Failed to get evdev touchscreen limits"); } item->touchscreen_data->min_x = abs_info.minimum; item->touchscreen_data->max_x = abs_info.maximum; item->touchscreen_data->range_x = abs_info.maximum - abs_info.minimum; ret = ioctl(item->fd, yreq, &abs_info); if (ret < 0) { SDL_free(item->touchscreen_data->name); SDL_free(item->touchscreen_data); return SDL_SetError("Failed to get evdev touchscreen limits"); } item->touchscreen_data->min_y = abs_info.minimum; item->touchscreen_data->max_y = abs_info.maximum; item->touchscreen_data->range_y = abs_info.maximum - abs_info.minimum; ret = ioctl(item->fd, EVIOCGABS(ABS_MT_PRESSURE), &abs_info); if (ret < 0) { SDL_free(item->touchscreen_data->name); SDL_free(item->touchscreen_data); return SDL_SetError("Failed to get evdev touchscreen limits"); } item->touchscreen_data->min_pressure = abs_info.minimum; item->touchscreen_data->max_pressure = abs_info.maximum; item->touchscreen_data->range_pressure = abs_info.maximum - abs_info.minimum; item->touchscreen_data->slots = SDL_calloc( item->touchscreen_data->max_slots, sizeof(*item->touchscreen_data->slots)); if (item->touchscreen_data->slots == NULL) { SDL_free(item->touchscreen_data->name); SDL_free(item->touchscreen_data); return SDL_OutOfMemory(); } for(i = 0; i < item->touchscreen_data->max_slots; i++) { item->touchscreen_data->slots[i].tracking_id = -1; } ret = SDL_AddTouch(item->fd, /* I guess our fd is unique enough */ SDL_TOUCH_DEVICE_DIRECT, item->touchscreen_data->name); if (ret < 0) { SDL_free(item->touchscreen_data->slots); SDL_free(item->touchscreen_data->name); SDL_free(item->touchscreen_data); return ret; } return 0; } #endif /* SDL_USE_LIBUDEV */ static void SDL_EVDEV_destroy_touchscreen(SDL_evdevlist_item* item) { if (!item->is_touchscreen) return; SDL_DelTouch(item->fd); SDL_free(item->touchscreen_data->slots); SDL_free(item->touchscreen_data->name); SDL_free(item->touchscreen_data); } static void SDL_EVDEV_sync_device(SDL_evdevlist_item *item) { #ifdef EVIOCGMTSLOTS int i, ret; struct input_absinfo abs_info; /* * struct input_mt_request_layout { * __u32 code; * __s32 values[num_slots]; * }; * * this is the structure we're trying to emulate */ Uint32* mt_req_code; Sint32* mt_req_values; size_t mt_req_size; /* TODO: sync devices other than touchscreen */ if (!item->is_touchscreen) return; mt_req_size = sizeof(*mt_req_code) + sizeof(*mt_req_values) * item->touchscreen_data->max_slots; mt_req_code = SDL_calloc(1, mt_req_size); if (mt_req_code == NULL) { return; } mt_req_values = (Sint32*)mt_req_code + 1; *mt_req_code = ABS_MT_TRACKING_ID; ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code); if (ret < 0) { SDL_free(mt_req_code); return; } for(i = 0; i < item->touchscreen_data->max_slots; i++) { /* * This doesn't account for the very edge case of the user removing their * finger and replacing it on the screen during the time we're out of sync, * which'll mean that we're not going from down -> up or up -> down, we're * going from down -> down but with a different tracking id, meaning we'd * have to tell SDL of the two events, but since we wait till SYN_REPORT in * SDL_EVDEV_Poll to tell SDL, the current structure of this code doesn't * allow it. Lets just pray to God it doesn't happen. */ if (item->touchscreen_data->slots[i].tracking_id < 0 && mt_req_values[i] >= 0) { item->touchscreen_data->slots[i].tracking_id = mt_req_values[i]; item->touchscreen_data->slots[i].delta = EVDEV_TOUCH_SLOTDELTA_DOWN; } else if (item->touchscreen_data->slots[i].tracking_id >= 0 && mt_req_values[i] < 0) { item->touchscreen_data->slots[i].tracking_id = -1; item->touchscreen_data->slots[i].delta = EVDEV_TOUCH_SLOTDELTA_UP; } } *mt_req_code = ABS_MT_POSITION_X; ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code); if (ret < 0) { SDL_free(mt_req_code); return; } for(i = 0; i < item->touchscreen_data->max_slots; i++) { if (item->touchscreen_data->slots[i].tracking_id >= 0 && item->touchscreen_data->slots[i].x != mt_req_values[i]) { item->touchscreen_data->slots[i].x = mt_req_values[i]; if (item->touchscreen_data->slots[i].delta == EVDEV_TOUCH_SLOTDELTA_NONE) { item->touchscreen_data->slots[i].delta = EVDEV_TOUCH_SLOTDELTA_MOVE; } } } *mt_req_code = ABS_MT_POSITION_Y; ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code); if (ret < 0) { SDL_free(mt_req_code); return; } for(i = 0; i < item->touchscreen_data->max_slots; i++) { if (item->touchscreen_data->slots[i].tracking_id >= 0 && item->touchscreen_data->slots[i].y != mt_req_values[i]) { item->touchscreen_data->slots[i].y = mt_req_values[i]; if (item->touchscreen_data->slots[i].delta == EVDEV_TOUCH_SLOTDELTA_NONE) { item->touchscreen_data->slots[i].delta = EVDEV_TOUCH_SLOTDELTA_MOVE; } } } *mt_req_code = ABS_MT_PRESSURE; ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code); if (ret < 0) { SDL_free(mt_req_code); return; } for(i = 0; i < item->touchscreen_data->max_slots; i++) { if (item->touchscreen_data->slots[i].tracking_id >= 0 && item->touchscreen_data->slots[i].pressure != mt_req_values[i]) { item->touchscreen_data->slots[i].pressure = mt_req_values[i]; if (item->touchscreen_data->slots[i].delta == EVDEV_TOUCH_SLOTDELTA_NONE) { item->touchscreen_data->slots[i].delta = EVDEV_TOUCH_SLOTDELTA_MOVE; } } } ret = ioctl(item->fd, EVIOCGABS(ABS_MT_SLOT), &abs_info); if (ret < 0) { SDL_free(mt_req_code); return; } item->touchscreen_data->current_slot = abs_info.value; SDL_free(mt_req_code); #endif /* EVIOCGMTSLOTS */ } #if SDL_USE_LIBUDEV static int SDL_EVDEV_device_added(const char *dev_path, int udev_class) { int ret; SDL_evdevlist_item *item; /* Check to make sure it's not already in list. */ for (item = _this->first; item != NULL; item = item->next) { if (SDL_strcmp(dev_path, item->path) == 0) { return -1; /* already have this one */ } } item = (SDL_evdevlist_item *) SDL_calloc(1, sizeof (SDL_evdevlist_item)); if (item == NULL) { return SDL_OutOfMemory(); } item->fd = open(dev_path, O_RDONLY | O_NONBLOCK); if (item->fd < 0) { SDL_free(item); return SDL_SetError("Unable to open %s", dev_path); } item->path = SDL_strdup(dev_path); if (item->path == NULL) { close(item->fd); SDL_free(item); return SDL_OutOfMemory(); } if (udev_class & SDL_UDEV_DEVICE_TOUCHSCREEN) { item->is_touchscreen = 1; if ((ret = SDL_EVDEV_init_touchscreen(item)) < 0) { close(item->fd); SDL_free(item); return ret; } } if (_this->last == NULL) { _this->first = _this->last = item; } else { _this->last->next = item; _this->last = item; } SDL_EVDEV_sync_device(item); return _this->num_devices++; } #endif /* SDL_USE_LIBUDEV */ static int SDL_EVDEV_device_removed(const char *dev_path) { SDL_evdevlist_item *item; SDL_evdevlist_item *prev = NULL; for (item = _this->first; item != NULL; item = item->next) { /* found it, remove it. */ if (SDL_strcmp(dev_path, item->path) == 0) { if (prev != NULL) { prev->next = item->next; } else { SDL_assert(_this->first == item); _this->first = item->next; } if (item == _this->last) { _this->last = prev; } if (item->is_touchscreen) { SDL_EVDEV_destroy_touchscreen(item); } close(item->fd); SDL_free(item->path); SDL_free(item); _this->num_devices--; return 0; } prev = item; } return -1; } #endif /* SDL_INPUT_LINUXEV */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/linux/SDL_evdev.c
C
apache-2.0
28,913
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifndef SDL_evdev_h_ #define SDL_evdev_h_ #ifdef SDL_INPUT_LINUXEV #include "SDL_events.h" extern int SDL_EVDEV_Init(void); extern void SDL_EVDEV_Quit(void); extern void SDL_EVDEV_Poll(void); #endif /* SDL_INPUT_LINUXEV */ #endif /* SDL_evdev_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/linux/SDL_evdev.h
C
apache-2.0
1,263
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #include "SDL_evdev_kbd.h" #include "SDL_hints.h" #ifdef SDL_INPUT_LINUXKD /* This logic is adapted from drivers/tty/vt/keyboard.c in the Linux kernel source */ #include <unistd.h> #include <fcntl.h> #include <sys/ioctl.h> #include <linux/kd.h> #include <linux/keyboard.h> #include <linux/vt.h> #include <linux/tiocl.h> /* for TIOCL_GETSHIFTSTATE */ #include <signal.h> #include "../../events/SDL_events_c.h" #include "SDL_evdev_kbd_default_accents.h" #include "SDL_evdev_kbd_default_keymap.h" /* These are not defined in older Linux kernel headers */ #ifndef K_UNICODE #define K_UNICODE 0x03 #endif #ifndef K_OFF #define K_OFF 0x04 #endif /* * Handler Tables. */ #define K_HANDLERS\ k_self, k_fn, k_spec, k_pad,\ k_dead, k_cons, k_cur, k_shift,\ k_meta, k_ascii, k_lock, k_lowercase,\ k_slock, k_dead2, k_brl, k_ignore typedef void (k_handler_fn)(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag); static k_handler_fn K_HANDLERS; static k_handler_fn *k_handler[16] = { K_HANDLERS }; typedef void (fn_handler_fn)(SDL_EVDEV_keyboard_state *kbd); static void fn_enter(SDL_EVDEV_keyboard_state *kbd); static void fn_caps_toggle(SDL_EVDEV_keyboard_state *kbd); static void fn_caps_on(SDL_EVDEV_keyboard_state *kbd); static void fn_num(SDL_EVDEV_keyboard_state *kbd); static void fn_compose(SDL_EVDEV_keyboard_state *kbd); static fn_handler_fn *fn_handler[] = { NULL, fn_enter, NULL, NULL, NULL, NULL, NULL, fn_caps_toggle, fn_num, NULL, NULL, NULL, NULL, fn_caps_on, fn_compose, NULL, NULL, NULL, NULL, fn_num }; /* * Keyboard State */ struct SDL_EVDEV_keyboard_state { int console_fd; int old_kbd_mode; unsigned short **key_maps; unsigned char shift_down[NR_SHIFT]; /* shift state counters.. */ SDL_bool dead_key_next; int npadch; /* -1 or number assembled on pad */ struct kbdiacrs *accents; unsigned int diacr; SDL_bool rep; /* flag telling character repeat */ unsigned char lockstate; unsigned char slockstate; unsigned char ledflagstate; char shift_state; char text[128]; unsigned int text_len; }; #ifdef DUMP_ACCENTS static void SDL_EVDEV_dump_accents(SDL_EVDEV_keyboard_state *kbd) { unsigned int i; printf("static struct kbdiacrs default_accents = {\n"); printf(" %d,\n", kbd->accents->kb_cnt); printf(" {\n"); for (i = 0; i < kbd->accents->kb_cnt; ++i) { struct kbdiacr *diacr = &kbd->accents->kbdiacr[i]; printf(" { 0x%.2x, 0x%.2x, 0x%.2x },\n", diacr->diacr, diacr->base, diacr->result); } while (i < 256) { printf(" { 0x00, 0x00, 0x00 },\n"); ++i; } printf(" }\n"); printf("};\n"); } #endif /* DUMP_ACCENTS */ #ifdef DUMP_KEYMAP static void SDL_EVDEV_dump_keymap(SDL_EVDEV_keyboard_state *kbd) { int i, j; for (i = 0; i < MAX_NR_KEYMAPS; ++i) { if (kbd->key_maps[i]) { printf("static unsigned short default_key_map_%d[NR_KEYS] = {", i); for (j = 0; j < NR_KEYS; ++j) { if ((j%8) == 0) { printf("\n "); } printf("0x%.4x, ", kbd->key_maps[i][j]); } printf("\n};\n"); } } printf("\n"); printf("static unsigned short *default_key_maps[MAX_NR_KEYMAPS] = {\n"); for (i = 0; i < MAX_NR_KEYMAPS; ++i) { if (kbd->key_maps[i]) { printf(" default_key_map_%d,\n", i); } else { printf(" NULL,\n"); } } printf("};\n"); } #endif /* DUMP_KEYMAP */ static int SDL_EVDEV_kbd_load_keymaps(SDL_EVDEV_keyboard_state *kbd) { int i, j; kbd->key_maps = (unsigned short **)SDL_calloc(MAX_NR_KEYMAPS, sizeof(unsigned short *)); if (!kbd->key_maps) { return -1; } for (i = 0; i < MAX_NR_KEYMAPS; ++i) { struct kbentry kbe; kbe.kb_table = i; kbe.kb_index = 0; if (ioctl(kbd->console_fd, KDGKBENT, &kbe) < 0) { return -1; } if (kbe.kb_value == K_NOSUCHMAP) { continue; } kbd->key_maps[i] = (unsigned short *)SDL_malloc(NR_KEYS * sizeof(unsigned short)); if (!kbd->key_maps[i]) { return -1; } for (j = 0; j < NR_KEYS; ++j) { kbe.kb_table = i; kbe.kb_index = j; if (ioctl(kbd->console_fd, KDGKBENT, &kbe) < 0) { return -1; } kbd->key_maps[i][j] = (kbe.kb_value ^ 0xf000); } } return 0; } static SDL_EVDEV_keyboard_state * kbd_cleanup_state = NULL; static int kbd_cleanup_sigactions_installed = 0; static int kbd_cleanup_atexit_installed = 0; static struct sigaction old_sigaction[NSIG]; static int fatal_signals[] = { /* Handlers for SIGTERM and SIGINT are installed in SDL_QuitInit. */ SIGHUP, SIGQUIT, SIGILL, SIGABRT, SIGFPE, SIGSEGV, SIGPIPE, SIGBUS, SIGSYS }; static void kbd_cleanup(void) { SDL_EVDEV_keyboard_state* kbd = kbd_cleanup_state; if (kbd == NULL) { return; } kbd_cleanup_state = NULL; ioctl(kbd->console_fd, KDSKBMODE, kbd->old_kbd_mode); } void SDL_EVDEV_kbd_reraise_signal(int sig) { raise(sig); } siginfo_t* SDL_EVDEV_kdb_cleanup_siginfo = NULL; void* SDL_EVDEV_kdb_cleanup_ucontext = NULL; static void kbd_cleanup_signal_action(int signum, siginfo_t* info, void* ucontext) { struct sigaction* old_action_p = &(old_sigaction[signum]); sigset_t sigset; /* Restore original signal handler before going any further. */ sigaction(signum, old_action_p, NULL); /* Unmask current signal. */ sigemptyset(&sigset); sigaddset(&sigset, signum); sigprocmask(SIG_UNBLOCK, &sigset, NULL); /* Save original signal info and context for archeologists. */ SDL_EVDEV_kdb_cleanup_siginfo = info; SDL_EVDEV_kdb_cleanup_ucontext = ucontext; /* Restore keyboard. */ kbd_cleanup(); /* Reraise signal. */ SDL_EVDEV_kbd_reraise_signal(signum); } static void kbd_unregister_emerg_cleanup() { int tabidx, signum; kbd_cleanup_state = NULL; if (!kbd_cleanup_sigactions_installed) { return; } kbd_cleanup_sigactions_installed = 0; for (tabidx = 0; tabidx < sizeof(fatal_signals) / sizeof(fatal_signals[0]); ++tabidx) { struct sigaction* old_action_p; struct sigaction cur_action; signum = fatal_signals[tabidx]; old_action_p = &(old_sigaction[signum]); /* Examine current signal action */ if (sigaction(signum, NULL, &cur_action)) continue; /* Check if action installed and not modifed */ if (!(cur_action.sa_flags & SA_SIGINFO) || cur_action.sa_sigaction != &kbd_cleanup_signal_action) continue; /* Restore original action */ sigaction(signum, old_action_p, NULL); } } static void kbd_cleanup_atexit(void) { /* Restore keyboard. */ kbd_cleanup(); /* Try to restore signal handlers in case shared library is being unloaded */ kbd_unregister_emerg_cleanup(); } static void kbd_register_emerg_cleanup(SDL_EVDEV_keyboard_state * kbd) { int tabidx, signum; if (kbd_cleanup_state != NULL) { return; } kbd_cleanup_state = kbd; if (!kbd_cleanup_atexit_installed) { /* Since glibc 2.2.3, atexit() (and on_exit(3)) can be used within a shared library to establish * functions that are called when the shared library is unloaded. * -- man atexit(3) */ atexit(kbd_cleanup_atexit); kbd_cleanup_atexit_installed = 1; } if (kbd_cleanup_sigactions_installed) { return; } kbd_cleanup_sigactions_installed = 1; for (tabidx = 0; tabidx < sizeof(fatal_signals) / sizeof(fatal_signals[0]); ++tabidx) { struct sigaction* old_action_p; struct sigaction new_action; signum = fatal_signals[tabidx]; old_action_p = &(old_sigaction[signum]); if (sigaction(signum, NULL, old_action_p)) continue; /* Skip SIGHUP and SIGPIPE if handler is already installed * - assume the handler will do the cleanup */ if ((signum == SIGHUP || signum == SIGPIPE) && (old_action_p->sa_handler != SIG_DFL || (void (*)(int))old_action_p->sa_sigaction != SIG_DFL)) continue; new_action = *old_action_p; new_action.sa_flags |= SA_SIGINFO; new_action.sa_sigaction = &kbd_cleanup_signal_action; sigaction(signum, &new_action, NULL); } } SDL_EVDEV_keyboard_state * SDL_EVDEV_kbd_init(void) { SDL_EVDEV_keyboard_state *kbd; int i; char flag_state; char shift_state[ sizeof (long) ] = {TIOCL_GETSHIFTSTATE, 0}; kbd = (SDL_EVDEV_keyboard_state *)SDL_calloc(1, sizeof(*kbd)); if (!kbd) { return NULL; } kbd->npadch = -1; /* This might fail if we're not connected to a tty (e.g. on the Steam Link) */ kbd->console_fd = open("/dev/tty", O_RDONLY); if (ioctl(kbd->console_fd, TIOCLINUX, shift_state) == 0) { kbd->shift_state = *shift_state; } if (ioctl(kbd->console_fd, KDGKBLED, &flag_state) == 0) { kbd->ledflagstate = flag_state; } kbd->accents = &default_accents; if (ioctl(kbd->console_fd, KDGKBDIACR, kbd->accents) < 0) { /* No worries, we'll use the default accent table */ } kbd->key_maps = default_key_maps; if (ioctl(kbd->console_fd, KDGKBMODE, &kbd->old_kbd_mode) == 0) { /* Set the keyboard in UNICODE mode and load the keymaps */ ioctl(kbd->console_fd, KDSKBMODE, K_UNICODE); if (SDL_EVDEV_kbd_load_keymaps(kbd) < 0) { for (i = 0; i < MAX_NR_KEYMAPS; ++i) { if (kbd->key_maps[i]) { SDL_free(kbd->key_maps[i]); } } SDL_free(kbd->key_maps); kbd->key_maps = default_key_maps; } /* Allow inhibiting keyboard mute with env. variable for debugging etc. */ if (getenv("SDL_INPUT_LINUX_KEEP_KBD") == NULL) { /* Mute the keyboard so keystrokes only generate evdev events * and do not leak through to the console */ ioctl(kbd->console_fd, KDSKBMODE, K_OFF); /* Make sure to restore keyboard if application fails to call * SDL_Quit before exit or fatal signal is raised. */ if (!SDL_GetHintBoolean(SDL_HINT_NO_SIGNAL_HANDLERS, SDL_FALSE)) { kbd_register_emerg_cleanup(kbd); } } } #ifdef DUMP_ACCENTS SDL_EVDEV_dump_accents(kbd); #endif #ifdef DUMP_KEYMAP SDL_EVDEV_dump_keymap(kbd); #endif return kbd; } void SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *kbd) { if (!kbd) { return; } kbd_unregister_emerg_cleanup(); if (kbd->console_fd >= 0) { /* Restore the original keyboard mode */ ioctl(kbd->console_fd, KDSKBMODE, kbd->old_kbd_mode); close(kbd->console_fd); kbd->console_fd = -1; } if (kbd->key_maps && kbd->key_maps != default_key_maps) { int i; for (i = 0; i < MAX_NR_KEYMAPS; ++i) { if (kbd->key_maps[i]) { SDL_free(kbd->key_maps[i]); } } SDL_free(kbd->key_maps); } SDL_free(kbd); } /* * Helper Functions. */ static void put_queue(SDL_EVDEV_keyboard_state *kbd, uint c) { /* c is already part of a UTF-8 sequence and safe to add as a character */ if (kbd->text_len < (sizeof(kbd->text)-1)) { kbd->text[kbd->text_len++] = (char)c; } } static void put_utf8(SDL_EVDEV_keyboard_state *kbd, uint c) { if (c < 0x80) /* 0******* */ put_queue(kbd, c); else if (c < 0x800) { /* 110***** 10****** */ put_queue(kbd, 0xc0 | (c >> 6)); put_queue(kbd, 0x80 | (c & 0x3f)); } else if (c < 0x10000) { if (c >= 0xD800 && c < 0xE000) return; if (c == 0xFFFF) return; /* 1110**** 10****** 10****** */ put_queue(kbd, 0xe0 | (c >> 12)); put_queue(kbd, 0x80 | ((c >> 6) & 0x3f)); put_queue(kbd, 0x80 | (c & 0x3f)); } else if (c < 0x110000) { /* 11110*** 10****** 10****** 10****** */ put_queue(kbd, 0xf0 | (c >> 18)); put_queue(kbd, 0x80 | ((c >> 12) & 0x3f)); put_queue(kbd, 0x80 | ((c >> 6) & 0x3f)); put_queue(kbd, 0x80 | (c & 0x3f)); } } /* * We have a combining character DIACR here, followed by the character CH. * If the combination occurs in the table, return the corresponding value. * Otherwise, if CH is a space or equals DIACR, return DIACR. * Otherwise, conclude that DIACR was not combining after all, * queue it and return CH. */ static unsigned int handle_diacr(SDL_EVDEV_keyboard_state *kbd, unsigned int ch) { unsigned int d = kbd->diacr; unsigned int i; kbd->diacr = 0; for (i = 0; i < kbd->accents->kb_cnt; i++) { if (kbd->accents->kbdiacr[i].diacr == d && kbd->accents->kbdiacr[i].base == ch) { return kbd->accents->kbdiacr[i].result; } } if (ch == ' ' || ch == d) return d; put_utf8(kbd, d); return ch; } static int vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) { return (kbd->ledflagstate & flag) != 0; } static void set_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) { kbd->ledflagstate |= flag; ioctl(kbd->console_fd, KDSETLED, (unsigned long)(kbd->ledflagstate)); } static void clr_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) { kbd->ledflagstate &= ~flag; ioctl(kbd->console_fd, KDSETLED, (unsigned long)(kbd->ledflagstate)); } static void chg_vc_kbd_lock(SDL_EVDEV_keyboard_state *kbd, int flag) { kbd->lockstate ^= 1 << flag; } static void chg_vc_kbd_slock(SDL_EVDEV_keyboard_state *kbd, int flag) { kbd->slockstate ^= 1 << flag; } static void chg_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) { kbd->ledflagstate ^= flag; ioctl(kbd->console_fd, KDSETLED, (unsigned long)(kbd->ledflagstate)); } /* * Special function handlers */ static void fn_enter(SDL_EVDEV_keyboard_state *kbd) { if (kbd->diacr) { put_utf8(kbd, kbd->diacr); kbd->diacr = 0; } } static void fn_caps_toggle(SDL_EVDEV_keyboard_state *kbd) { if (kbd->rep) return; chg_vc_kbd_led(kbd, K_CAPSLOCK); } static void fn_caps_on(SDL_EVDEV_keyboard_state *kbd) { if (kbd->rep) return; set_vc_kbd_led(kbd, K_CAPSLOCK); } static void fn_num(SDL_EVDEV_keyboard_state *kbd) { if (!kbd->rep) chg_vc_kbd_led(kbd, K_NUMLOCK); } static void fn_compose(SDL_EVDEV_keyboard_state *kbd) { kbd->dead_key_next = SDL_TRUE; } /* * Special key handlers */ static void k_ignore(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) { } static void k_spec(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) { if (up_flag) return; if (value >= SDL_arraysize(fn_handler)) return; if (fn_handler[value]) fn_handler[value](kbd); } static void k_lowercase(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) { } static void k_self(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) { if (up_flag) return; /* no action, if this is a key release */ if (kbd->diacr) value = handle_diacr(kbd, value); if (kbd->dead_key_next) { kbd->dead_key_next = SDL_FALSE; kbd->diacr = value; return; } put_utf8(kbd, value); } static void k_deadunicode(SDL_EVDEV_keyboard_state *kbd, unsigned int value, char up_flag) { if (up_flag) return; kbd->diacr = (kbd->diacr ? handle_diacr(kbd, value) : value); } static void k_dead(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) { const unsigned char ret_diacr[NR_DEAD] = {'`', '\'', '^', '~', '"', ',' }; k_deadunicode(kbd, ret_diacr[value], up_flag); } static void k_dead2(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) { k_deadunicode(kbd, value, up_flag); } static void k_cons(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) { } static void k_fn(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) { } static void k_cur(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) { } static void k_pad(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) { static const char pad_chars[] = "0123456789+-*/\015,.?()#"; if (up_flag) return; /* no action, if this is a key release */ if (!vc_kbd_led(kbd, K_NUMLOCK)) { /* unprintable action */ return; } put_queue(kbd, pad_chars[value]); } static void k_shift(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) { int old_state = kbd->shift_state; if (kbd->rep) return; /* * Mimic typewriter: * a CapsShift key acts like Shift but undoes CapsLock */ if (value == KVAL(K_CAPSSHIFT)) { value = KVAL(K_SHIFT); if (!up_flag) clr_vc_kbd_led(kbd, K_CAPSLOCK); } if (up_flag) { /* * handle the case that two shift or control * keys are depressed simultaneously */ if (kbd->shift_down[value]) kbd->shift_down[value]--; } else kbd->shift_down[value]++; if (kbd->shift_down[value]) kbd->shift_state |= (1 << value); else kbd->shift_state &= ~(1 << value); /* kludge */ if (up_flag && kbd->shift_state != old_state && kbd->npadch != -1) { put_utf8(kbd, kbd->npadch); kbd->npadch = -1; } } static void k_meta(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) { } static void k_ascii(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) { int base; if (up_flag) return; if (value < 10) { /* decimal input of code, while Alt depressed */ base = 10; } else { /* hexadecimal input of code, while AltGr depressed */ value -= 10; base = 16; } if (kbd->npadch == -1) kbd->npadch = value; else kbd->npadch = kbd->npadch * base + value; } static void k_lock(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) { if (up_flag || kbd->rep) return; chg_vc_kbd_lock(kbd, value); } static void k_slock(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) { k_shift(kbd, value, up_flag); if (up_flag || kbd->rep) return; chg_vc_kbd_slock(kbd, value); /* try to make Alt, oops, AltGr and such work */ if (!kbd->key_maps[kbd->lockstate ^ kbd->slockstate]) { kbd->slockstate = 0; chg_vc_kbd_slock(kbd, value); } } static void k_brl(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) { } void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, int down) { unsigned char shift_final; unsigned char type; unsigned short *key_map; unsigned short keysym; if (!kbd) { return; } kbd->rep = (down == 2); shift_final = (kbd->shift_state | kbd->slockstate) ^ kbd->lockstate; key_map = kbd->key_maps[shift_final]; if (!key_map) { /* Unsupported shift state (e.g. ctrl = 4, alt = 8), just reset to the default state */ kbd->shift_state = 0; kbd->slockstate = 0; kbd->lockstate = 0; return; } if (keycode < NR_KEYS) { keysym = key_map[keycode]; } else { return; } type = KTYP(keysym); if (type < 0xf0) { if (down) { put_utf8(kbd, keysym); } } else { type -= 0xf0; /* if type is KT_LETTER then it can be affected by Caps Lock */ if (type == KT_LETTER) { type = KT_LATIN; if (vc_kbd_led(kbd, K_CAPSLOCK)) { key_map = kbd->key_maps[shift_final ^ (1 << KG_SHIFT)]; if (key_map) { keysym = key_map[keycode]; } } } (*k_handler[type])(kbd, keysym & 0xff, !down); if (type != KT_SLOCK) { kbd->slockstate = 0; } } if (kbd->text_len > 0) { kbd->text[kbd->text_len] = '\0'; SDL_SendKeyboardText(kbd->text); kbd->text_len = 0; } } #else /* !SDL_INPUT_LINUXKD */ SDL_EVDEV_keyboard_state * SDL_EVDEV_kbd_init(void) { return NULL; } void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode, int down) { } void SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *state) { } #endif /* SDL_INPUT_LINUXKD */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/linux/SDL_evdev_kbd.c
C
apache-2.0
22,105
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef SDL_evdev_kbd_h_ #define SDL_evdev_kbd_h_ struct SDL_EVDEV_keyboard_state; typedef struct SDL_EVDEV_keyboard_state SDL_EVDEV_keyboard_state; extern SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void); extern void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode, int down); extern void SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *state); #endif /* SDL_evdev_kbd_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/linux/SDL_evdev_kbd.h
C
apache-2.0
1,382
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ static struct kbdiacrs default_accents = { 68, { { 0x60, 0x41, 0xc0 }, { 0x60, 0x61, 0xe0 }, { 0x27, 0x41, 0xc1 }, { 0x27, 0x61, 0xe1 }, { 0x5e, 0x41, 0xc2 }, { 0x5e, 0x61, 0xe2 }, { 0x7e, 0x41, 0xc3 }, { 0x7e, 0x61, 0xe3 }, { 0x22, 0x41, 0xc4 }, { 0x22, 0x61, 0xe4 }, { 0x4f, 0x41, 0xc5 }, { 0x6f, 0x61, 0xe5 }, { 0x30, 0x41, 0xc5 }, { 0x30, 0x61, 0xe5 }, { 0x41, 0x41, 0xc5 }, { 0x61, 0x61, 0xe5 }, { 0x41, 0x45, 0xc6 }, { 0x61, 0x65, 0xe6 }, { 0x2c, 0x43, 0xc7 }, { 0x2c, 0x63, 0xe7 }, { 0x60, 0x45, 0xc8 }, { 0x60, 0x65, 0xe8 }, { 0x27, 0x45, 0xc9 }, { 0x27, 0x65, 0xe9 }, { 0x5e, 0x45, 0xca }, { 0x5e, 0x65, 0xea }, { 0x22, 0x45, 0xcb }, { 0x22, 0x65, 0xeb }, { 0x60, 0x49, 0xcc }, { 0x60, 0x69, 0xec }, { 0x27, 0x49, 0xcd }, { 0x27, 0x69, 0xed }, { 0x5e, 0x49, 0xce }, { 0x5e, 0x69, 0xee }, { 0x22, 0x49, 0xcf }, { 0x22, 0x69, 0xef }, { 0x2d, 0x44, 0xd0 }, { 0x2d, 0x64, 0xf0 }, { 0x7e, 0x4e, 0xd1 }, { 0x7e, 0x6e, 0xf1 }, { 0x60, 0x4f, 0xd2 }, { 0x60, 0x6f, 0xf2 }, { 0x27, 0x4f, 0xd3 }, { 0x27, 0x6f, 0xf3 }, { 0x5e, 0x4f, 0xd4 }, { 0x5e, 0x6f, 0xf4 }, { 0x7e, 0x4f, 0xd5 }, { 0x7e, 0x6f, 0xf5 }, { 0x22, 0x4f, 0xd6 }, { 0x22, 0x6f, 0xf6 }, { 0x2f, 0x4f, 0xd8 }, { 0x2f, 0x6f, 0xf8 }, { 0x60, 0x55, 0xd9 }, { 0x60, 0x75, 0xf9 }, { 0x27, 0x55, 0xda }, { 0x27, 0x75, 0xfa }, { 0x5e, 0x55, 0xdb }, { 0x5e, 0x75, 0xfb }, { 0x22, 0x55, 0xdc }, { 0x22, 0x75, 0xfc }, { 0x27, 0x59, 0xdd }, { 0x27, 0x79, 0xfd }, { 0x54, 0x48, 0xde }, { 0x74, 0x68, 0xfe }, { 0x73, 0x73, 0xdf }, { 0x22, 0x79, 0xff }, { 0x73, 0x7a, 0xdf }, { 0x69, 0x6a, 0xff }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, } }; /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/linux/SDL_evdev_kbd_default_accents.h
C
apache-2.0
8,722
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ static unsigned short default_key_map_0[NR_KEYS] = { 0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, }; static unsigned short default_key_map_1[NR_KEYS] = { 0xf200, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, }; static unsigned short default_key_map_2[NR_KEYS] = { 0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, }; static unsigned short default_key_map_3[NR_KEYS] = { 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; #ifdef INCLUDE_EXTENDED_KEYMAP static unsigned short default_key_map_4[NR_KEYS] = { 0xf200, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, }; static unsigned short default_key_map_5[NR_KEYS] = { 0xf200, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, }; static unsigned short default_key_map_6[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_7[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_8[NR_KEYS] = { 0xf200, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, }; static unsigned short default_key_map_9[NR_KEYS] = { 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_10[NR_KEYS] = { 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_11[NR_KEYS] = { 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_12[NR_KEYS] = { 0xf200, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, }; static unsigned short default_key_map_13[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_14[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_15[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_16[NR_KEYS] = { 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_17[NR_KEYS] = { 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_18[NR_KEYS] = { 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_19[NR_KEYS] = { 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_20[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_21[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_22[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_23[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_24[NR_KEYS] = { 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_25[NR_KEYS] = { 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_26[NR_KEYS] = { 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_27[NR_KEYS] = { 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_28[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_29[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_30[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_31[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_32[NR_KEYS] = { 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_33[NR_KEYS] = { 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_34[NR_KEYS] = { 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_35[NR_KEYS] = { 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_36[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_37[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_38[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_39[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_40[NR_KEYS] = { 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_41[NR_KEYS] = { 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_42[NR_KEYS] = { 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_43[NR_KEYS] = { 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_44[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_45[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_46[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_47[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_48[NR_KEYS] = { 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_49[NR_KEYS] = { 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_50[NR_KEYS] = { 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_51[NR_KEYS] = { 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_52[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_53[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_54[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_55[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_56[NR_KEYS] = { 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_57[NR_KEYS] = { 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_58[NR_KEYS] = { 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_59[NR_KEYS] = { 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_60[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_61[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_62[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_63[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_64[NR_KEYS] = { 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_65[NR_KEYS] = { 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_66[NR_KEYS] = { 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_67[NR_KEYS] = { 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_68[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_69[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_70[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_71[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_72[NR_KEYS] = { 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_73[NR_KEYS] = { 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_74[NR_KEYS] = { 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_75[NR_KEYS] = { 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_76[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_77[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_78[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_79[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_80[NR_KEYS] = { 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_81[NR_KEYS] = { 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_82[NR_KEYS] = { 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_83[NR_KEYS] = { 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_84[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_85[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_86[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_87[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_88[NR_KEYS] = { 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_89[NR_KEYS] = { 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_90[NR_KEYS] = { 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_91[NR_KEYS] = { 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_92[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_93[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_94[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_95[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_96[NR_KEYS] = { 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_97[NR_KEYS] = { 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_98[NR_KEYS] = { 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_99[NR_KEYS] = { 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_100[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_101[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_102[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_103[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_104[NR_KEYS] = { 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_105[NR_KEYS] = { 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_106[NR_KEYS] = { 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_107[NR_KEYS] = { 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_108[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_109[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_110[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_111[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_112[NR_KEYS] = { 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_113[NR_KEYS] = { 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_114[NR_KEYS] = { 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_115[NR_KEYS] = { 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_116[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_117[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_118[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_119[NR_KEYS] = { 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_120[NR_KEYS] = { 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_121[NR_KEYS] = { 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_122[NR_KEYS] = { 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_123[NR_KEYS] = { 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_124[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_125[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_126[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; static unsigned short default_key_map_127[NR_KEYS] = { 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, }; #endif /* INCLUDE_EXTENDED_KEYMAP */ static unsigned short *default_key_maps[MAX_NR_KEYMAPS] = { default_key_map_0, default_key_map_1, default_key_map_2, default_key_map_3, #ifdef INCLUDE_EXTENDED_KEYMAP default_key_map_4, default_key_map_5, default_key_map_6, default_key_map_7, default_key_map_8, default_key_map_9, default_key_map_10, default_key_map_11, default_key_map_12, default_key_map_13, default_key_map_14, default_key_map_15, default_key_map_16, default_key_map_17, default_key_map_18, default_key_map_19, default_key_map_20, default_key_map_21, default_key_map_22, default_key_map_23, default_key_map_24, default_key_map_25, default_key_map_26, default_key_map_27, default_key_map_28, default_key_map_29, default_key_map_30, default_key_map_31, default_key_map_32, default_key_map_33, default_key_map_34, default_key_map_35, default_key_map_36, default_key_map_37, default_key_map_38, default_key_map_39, default_key_map_40, default_key_map_41, default_key_map_42, default_key_map_43, default_key_map_44, default_key_map_45, default_key_map_46, default_key_map_47, default_key_map_48, default_key_map_49, default_key_map_50, default_key_map_51, default_key_map_52, default_key_map_53, default_key_map_54, default_key_map_55, default_key_map_56, default_key_map_57, default_key_map_58, default_key_map_59, default_key_map_60, default_key_map_61, default_key_map_62, default_key_map_63, default_key_map_64, default_key_map_65, default_key_map_66, default_key_map_67, default_key_map_68, default_key_map_69, default_key_map_70, default_key_map_71, default_key_map_72, default_key_map_73, default_key_map_74, default_key_map_75, default_key_map_76, default_key_map_77, default_key_map_78, default_key_map_79, default_key_map_80, default_key_map_81, default_key_map_82, default_key_map_83, default_key_map_84, default_key_map_85, default_key_map_86, default_key_map_87, default_key_map_88, default_key_map_89, default_key_map_90, default_key_map_91, default_key_map_92, default_key_map_93, default_key_map_94, default_key_map_95, default_key_map_96, default_key_map_97, default_key_map_98, default_key_map_99, default_key_map_100, default_key_map_101, default_key_map_102, default_key_map_103, default_key_map_104, default_key_map_105, default_key_map_106, default_key_map_107, default_key_map_108, default_key_map_109, default_key_map_110, default_key_map_111, default_key_map_112, default_key_map_113, default_key_map_114, default_key_map_115, default_key_map_116, default_key_map_117, default_key_map_118, default_key_map_119, default_key_map_120, default_key_map_121, default_key_map_122, default_key_map_123, default_key_map_124, default_key_map_125, default_key_map_126, default_key_map_127, #else /* !INCLUDE_EXTENDED_KEYMAP */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, #endif /* INCLUDE_EXTENDED_KEYMAP */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }; /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/linux/SDL_evdev_kbd_default_keymap.h
C
apache-2.0
296,761
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #include <unistd.h> #include "SDL_fcitx.h" #include "SDL_keycode.h" #include "SDL_keyboard.h" #include "../../events/SDL_keyboard_c.h" #include "SDL_dbus.h" #include "SDL_syswm.h" #if SDL_VIDEO_DRIVER_X11 # include "../../video/x11/SDL_x11video.h" #endif #include "SDL_hints.h" #define FCITX_DBUS_SERVICE "org.freedesktop.portal.Fcitx" #define FCITX_IM_DBUS_PATH "/org/freedesktop/portal/inputmethod" #define FCITX_IM_DBUS_INTERFACE "org.fcitx.Fcitx.InputMethod1" #define FCITX_IC_DBUS_INTERFACE "org.fcitx.Fcitx.InputContext1" #define DBUS_TIMEOUT 500 typedef struct _FcitxClient { SDL_DBusContext *dbus; char *ic_path; int id; SDL_Rect cursor_rect; } FcitxClient; static FcitxClient fcitx_client; static char* GetAppName() { #if defined(__LINUX__) || defined(__FREEBSD__) char *spot; char procfile[1024]; char linkfile[1024]; int linksize; #if defined(__LINUX__) SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/exe", getpid()); #elif defined(__FREEBSD__) SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/file", getpid()); #endif linksize = readlink(procfile, linkfile, sizeof(linkfile) - 1); if (linksize > 0) { linkfile[linksize] = '\0'; spot = SDL_strrchr(linkfile, '/'); if (spot) { return SDL_strdup(spot + 1); } else { return SDL_strdup(linkfile); } } #endif /* __LINUX__ || __FREEBSD__ */ return SDL_strdup("SDL_App"); } size_t Fcitx_GetPreeditString(SDL_DBusContext *dbus, DBusMessage *msg, char **ret) { char *text = NULL, *subtext; size_t text_bytes = 0; DBusMessageIter iter, array, sub; dbus->message_iter_init(msg, &iter); /* Message type is a(si)i, we only need string part */ if (dbus->message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) { /* First pass: calculate string length */ dbus->message_iter_recurse(&iter, &array); while (dbus->message_iter_get_arg_type(&array) == DBUS_TYPE_STRUCT) { dbus->message_iter_recurse(&array, &sub); if (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_STRING) { dbus->message_iter_get_basic(&sub, &subtext); if (subtext && *subtext) { text_bytes += SDL_strlen(subtext); } } dbus->message_iter_next(&array); } if (text_bytes) { text = SDL_malloc(text_bytes + 1); } if (text) { char* pivot = text; /* Second pass: join all the sub string */ dbus->message_iter_recurse(&iter, &array); while (dbus->message_iter_get_arg_type(&array) == DBUS_TYPE_STRUCT) { dbus->message_iter_recurse(&array, &sub); if (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_STRING) { dbus->message_iter_get_basic(&sub, &subtext); if (subtext && *subtext) { size_t length = SDL_strlen(subtext); SDL_strlcpy(pivot, subtext, length + 1); pivot += length; } } dbus->message_iter_next(&array); } } else { text_bytes = 0; } } *ret= text; return text_bytes; } static DBusHandlerResult DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) { SDL_DBusContext *dbus = (SDL_DBusContext *)data; if (dbus->message_is_signal(msg, FCITX_IC_DBUS_INTERFACE, "CommitString")) { DBusMessageIter iter; const char *text = NULL; dbus->message_iter_init(msg, &iter); dbus->message_iter_get_basic(&iter, &text); if (text) SDL_SendKeyboardText(text); return DBUS_HANDLER_RESULT_HANDLED; } if (dbus->message_is_signal(msg, FCITX_IC_DBUS_INTERFACE, "UpdateFormattedPreedit")) { char *text = NULL; size_t text_bytes = Fcitx_GetPreeditString(dbus, msg, &text); if (text_bytes) { char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; size_t i = 0; size_t cursor = 0; while (i < text_bytes) { const size_t sz = SDL_utf8strlcpy(buf, text + i, sizeof(buf)); const size_t chars = SDL_utf8strlen(buf); SDL_SendEditingText(buf, cursor, chars); i += sz; cursor += chars; } SDL_free(text); } else { SDL_SendEditingText("", 0, 0); } SDL_Fcitx_UpdateTextRect(NULL); return DBUS_HANDLER_RESULT_HANDLED; } return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } static void FcitxClientICCallMethod(FcitxClient *client, const char *method) { if (!client->ic_path) { return; } SDL_DBus_CallVoidMethod(FCITX_DBUS_SERVICE, client->ic_path, FCITX_IC_DBUS_INTERFACE, method, DBUS_TYPE_INVALID); } static void SDLCALL Fcitx_SetCapabilities(void *data, const char *name, const char *old_val, const char *internal_editing) { FcitxClient *client = (FcitxClient *)data; Uint32 caps = 0; if (!client->ic_path) { return; } if (!(internal_editing && *internal_editing == '1')) { caps |= (1 << 1); /* Preedit Flag */ caps |= (1 << 4); /* Formatted Preedit Flag */ } SDL_DBus_CallVoidMethod(FCITX_DBUS_SERVICE, client->ic_path, FCITX_IC_DBUS_INTERFACE, "SetCapability", DBUS_TYPE_UINT64, &caps, DBUS_TYPE_INVALID); } static SDL_bool FcitxCreateInputContext(SDL_DBusContext* dbus, const char *appname, char **ic_path) { const char *program = "program"; SDL_bool retval = SDL_FALSE; if (dbus->session_conn) { DBusMessage *msg = dbus->message_new_method_call(FCITX_DBUS_SERVICE, FCITX_IM_DBUS_PATH, FCITX_IM_DBUS_INTERFACE, "CreateInputContext"); if (msg) { DBusMessage *reply = NULL; DBusMessageIter args, array, sub; dbus->message_iter_init_append(msg, &args); dbus->message_iter_open_container(&args, DBUS_TYPE_ARRAY, "(ss)", &array); dbus->message_iter_open_container(&array, DBUS_TYPE_STRUCT, 0, &sub); dbus->message_iter_append_basic(&sub, DBUS_TYPE_STRING, &program); dbus->message_iter_append_basic(&sub, DBUS_TYPE_STRING, &appname); dbus->message_iter_close_container(&array, &sub); dbus->message_iter_close_container(&args, &array); reply = dbus->connection_send_with_reply_and_block(dbus->session_conn, msg, 300, NULL); if (reply) { if (dbus->message_get_args(reply, NULL, DBUS_TYPE_OBJECT_PATH, ic_path, DBUS_TYPE_INVALID)) { retval = SDL_TRUE; } dbus->message_unref(reply); } dbus->message_unref(msg); } } return retval; } static SDL_bool FcitxClientCreateIC(FcitxClient *client) { char *appname = GetAppName(); char *ic_path = NULL; SDL_DBusContext *dbus = client->dbus; /* SDL_DBus_CallMethod cannot handle a(ss) type, call dbus function directly */ if (!FcitxCreateInputContext(dbus, appname, &ic_path)) { ic_path = NULL; /* just in case. */ } SDL_free(appname); if (ic_path) { SDL_free(client->ic_path); client->ic_path = SDL_strdup(ic_path); dbus->bus_add_match(dbus->session_conn, "type='signal', interface='org.fcitx.Fcitx.InputContext1'", NULL); dbus->connection_add_filter(dbus->session_conn, &DBus_MessageFilter, dbus, NULL); dbus->connection_flush(dbus->session_conn); SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, Fcitx_SetCapabilities, client); return SDL_TRUE; } return SDL_FALSE; } static Uint32 Fcitx_ModState(void) { Uint32 fcitx_mods = 0; SDL_Keymod sdl_mods = SDL_GetModState(); if (sdl_mods & KMOD_SHIFT) fcitx_mods |= (1 << 0); if (sdl_mods & KMOD_CAPS) fcitx_mods |= (1 << 1); if (sdl_mods & KMOD_CTRL) fcitx_mods |= (1 << 2); if (sdl_mods & KMOD_ALT) fcitx_mods |= (1 << 3); if (sdl_mods & KMOD_NUM) fcitx_mods |= (1 << 4); if (sdl_mods & KMOD_MODE) fcitx_mods |= (1 << 7); if (sdl_mods & KMOD_LGUI) fcitx_mods |= (1 << 6); if (sdl_mods & KMOD_RGUI) fcitx_mods |= (1 << 28); return fcitx_mods; } SDL_bool SDL_Fcitx_Init() { fcitx_client.dbus = SDL_DBus_GetContext(); fcitx_client.cursor_rect.x = -1; fcitx_client.cursor_rect.y = -1; fcitx_client.cursor_rect.w = 0; fcitx_client.cursor_rect.h = 0; return FcitxClientCreateIC(&fcitx_client); } void SDL_Fcitx_Quit() { FcitxClientICCallMethod(&fcitx_client, "DestroyIC"); if (fcitx_client.ic_path) { SDL_free(fcitx_client.ic_path); fcitx_client.ic_path = NULL; } } void SDL_Fcitx_SetFocus(SDL_bool focused) { if (focused) { FcitxClientICCallMethod(&fcitx_client, "FocusIn"); } else { FcitxClientICCallMethod(&fcitx_client, "FocusOut"); } } void SDL_Fcitx_Reset(void) { FcitxClientICCallMethod(&fcitx_client, "Reset"); FcitxClientICCallMethod(&fcitx_client, "CloseIC"); } SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode) { Uint32 state = Fcitx_ModState(); Uint32 handled = SDL_FALSE; Uint32 is_release = SDL_FALSE; Uint32 event_time = 0; if (!fcitx_client.ic_path) { return SDL_FALSE; } if (SDL_DBus_CallMethod(FCITX_DBUS_SERVICE, fcitx_client.ic_path, FCITX_IC_DBUS_INTERFACE, "ProcessKeyEvent", DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &state, DBUS_TYPE_BOOLEAN, &is_release, DBUS_TYPE_UINT32, &event_time, DBUS_TYPE_INVALID, DBUS_TYPE_BOOLEAN, &handled, DBUS_TYPE_INVALID)) { if (handled) { SDL_Fcitx_UpdateTextRect(NULL); return SDL_TRUE; } } return SDL_FALSE; } void SDL_Fcitx_UpdateTextRect(SDL_Rect *rect) { SDL_Window *focused_win = NULL; SDL_SysWMinfo info; int x = 0, y = 0; SDL_Rect *cursor = &fcitx_client.cursor_rect; if (rect) { SDL_memcpy(cursor, rect, sizeof(SDL_Rect)); } focused_win = SDL_GetKeyboardFocus(); if (!focused_win) { return ; } SDL_VERSION(&info.version); if (!SDL_GetWindowWMInfo(focused_win, &info)) { return; } SDL_GetWindowPosition(focused_win, &x, &y); #if SDL_VIDEO_DRIVER_X11 if (info.subsystem == SDL_SYSWM_X11) { SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata; Display *x_disp = info.info.x11.display; Window x_win = info.info.x11.window; int x_screen = displaydata->screen; Window unused; X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused); } #endif if (cursor->x == -1 && cursor->y == -1 && cursor->w == 0 && cursor->h == 0) { /* move to bottom left */ int w = 0, h = 0; SDL_GetWindowSize(focused_win, &w, &h); cursor->x = 0; cursor->y = h; } x += cursor->x; y += cursor->y; SDL_DBus_CallVoidMethod(FCITX_DBUS_SERVICE, fcitx_client.ic_path, FCITX_IC_DBUS_INTERFACE, "SetCursorRect", DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_INT32, &cursor->w, DBUS_TYPE_INT32, &cursor->h, DBUS_TYPE_INVALID); } void SDL_Fcitx_PumpEvents(void) { SDL_DBusContext *dbus = fcitx_client.dbus; DBusConnection *conn = dbus->session_conn; dbus->connection_read_write(conn, 0); while (dbus->connection_dispatch(conn) == DBUS_DISPATCH_DATA_REMAINS) { /* Do nothing, actual work happens in DBus_MessageFilter */ usleep(10); } } /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/linux/SDL_fcitx.c
C
apache-2.0
12,880
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef SDL_fcitx_h_ #define SDL_fcitx_h_ #include "../../SDL_internal.h" #include "SDL_stdinc.h" #include "SDL_rect.h" extern SDL_bool SDL_Fcitx_Init(void); extern void SDL_Fcitx_Quit(void); extern void SDL_Fcitx_SetFocus(SDL_bool focused); extern void SDL_Fcitx_Reset(void); extern SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode); extern void SDL_Fcitx_UpdateTextRect(SDL_Rect *rect); extern void SDL_Fcitx_PumpEvents(void); #endif /* SDL_fcitx_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/linux/SDL_fcitx.h
C
apache-2.0
1,451
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifdef HAVE_IBUS_IBUS_H #include "SDL.h" #include "SDL_syswm.h" #include "SDL_ibus.h" #include "SDL_dbus.h" #include "../../video/SDL_sysvideo.h" #include "../../events/SDL_keyboard_c.h" #if SDL_VIDEO_DRIVER_X11 #include "../../video/x11/SDL_x11video.h" #endif #include <sys/inotify.h> #include <unistd.h> #include <fcntl.h> static const char IBUS_SERVICE[] = "org.freedesktop.IBus"; static const char IBUS_PATH[] = "/org/freedesktop/IBus"; static const char IBUS_INTERFACE[] = "org.freedesktop.IBus"; static const char IBUS_INPUT_INTERFACE[] = "org.freedesktop.IBus.InputContext"; static char *input_ctx_path = NULL; static SDL_Rect ibus_cursor_rect = { 0, 0, 0, 0 }; static DBusConnection *ibus_conn = NULL; static char *ibus_addr_file = NULL; static int inotify_fd = -1, inotify_wd = -1; static Uint32 IBus_ModState(void) { Uint32 ibus_mods = 0; SDL_Keymod sdl_mods = SDL_GetModState(); /* Not sure about MOD3, MOD4 and HYPER mappings */ if (sdl_mods & KMOD_LSHIFT) ibus_mods |= IBUS_SHIFT_MASK; if (sdl_mods & KMOD_CAPS) ibus_mods |= IBUS_LOCK_MASK; if (sdl_mods & KMOD_LCTRL) ibus_mods |= IBUS_CONTROL_MASK; if (sdl_mods & KMOD_LALT) ibus_mods |= IBUS_MOD1_MASK; if (sdl_mods & KMOD_NUM) ibus_mods |= IBUS_MOD2_MASK; if (sdl_mods & KMOD_MODE) ibus_mods |= IBUS_MOD5_MASK; if (sdl_mods & KMOD_LGUI) ibus_mods |= IBUS_SUPER_MASK; if (sdl_mods & KMOD_RGUI) ibus_mods |= IBUS_META_MASK; return ibus_mods; } static const char * IBus_GetVariantText(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus) { /* The text we need is nested weirdly, use dbus-monitor to see the structure better */ const char *text = NULL; const char *struct_id = NULL; DBusMessageIter sub1, sub2; if (dbus->message_iter_get_arg_type(iter) != DBUS_TYPE_VARIANT) { return NULL; } dbus->message_iter_recurse(iter, &sub1); if (dbus->message_iter_get_arg_type(&sub1) != DBUS_TYPE_STRUCT) { return NULL; } dbus->message_iter_recurse(&sub1, &sub2); if (dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_STRING) { return NULL; } dbus->message_iter_get_basic(&sub2, &struct_id); if (!struct_id || SDL_strncmp(struct_id, "IBusText", sizeof("IBusText")) != 0) { return NULL; } dbus->message_iter_next(&sub2); dbus->message_iter_next(&sub2); if (dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_STRING) { return NULL; } dbus->message_iter_get_basic(&sub2, &text); return text; } static DBusHandlerResult IBus_MessageHandler(DBusConnection *conn, DBusMessage *msg, void *user_data) { SDL_DBusContext *dbus = (SDL_DBusContext *)user_data; if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "CommitText")) { DBusMessageIter iter; const char *text; dbus->message_iter_init(msg, &iter); text = IBus_GetVariantText(conn, &iter, dbus); if (text && *text) { char buf[SDL_TEXTINPUTEVENT_TEXT_SIZE]; size_t text_bytes = SDL_strlen(text), i = 0; while (i < text_bytes) { size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); SDL_SendKeyboardText(buf); i += sz; } } return DBUS_HANDLER_RESULT_HANDLED; } if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "UpdatePreeditText")) { DBusMessageIter iter; const char *text; dbus->message_iter_init(msg, &iter); text = IBus_GetVariantText(conn, &iter, dbus); if (text) { char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; size_t text_bytes = SDL_strlen(text), i = 0; size_t cursor = 0; do { const size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); const size_t chars = SDL_utf8strlen(buf); SDL_SendEditingText(buf, cursor, chars); i += sz; cursor += chars; } while (i < text_bytes); } SDL_IBus_UpdateTextRect(NULL); return DBUS_HANDLER_RESULT_HANDLED; } if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "HidePreeditText")) { SDL_SendEditingText("", 0, 0); return DBUS_HANDLER_RESULT_HANDLED; } return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } static char * IBus_ReadAddressFromFile(const char *file_path) { char addr_buf[1024]; SDL_bool success = SDL_FALSE; FILE *addr_file; addr_file = fopen(file_path, "r"); if (!addr_file) { return NULL; } while (fgets(addr_buf, sizeof(addr_buf), addr_file)) { if (SDL_strncmp(addr_buf, "IBUS_ADDRESS=", sizeof("IBUS_ADDRESS=")-1) == 0) { size_t sz = SDL_strlen(addr_buf); if (addr_buf[sz-1] == '\n') addr_buf[sz-1] = 0; if (addr_buf[sz-2] == '\r') addr_buf[sz-2] = 0; success = SDL_TRUE; break; } } fclose(addr_file); if (success) { return SDL_strdup(addr_buf + (sizeof("IBUS_ADDRESS=") - 1)); } else { return NULL; } } static char * IBus_GetDBusAddressFilename(void) { SDL_DBusContext *dbus; const char *disp_env; char config_dir[PATH_MAX]; char *display = NULL; const char *addr; const char *conf_env; char *key; char file_path[PATH_MAX]; const char *host; char *disp_num, *screen_num; if (ibus_addr_file) { return SDL_strdup(ibus_addr_file); } dbus = SDL_DBus_GetContext(); if (!dbus) { return NULL; } /* Use this environment variable if it exists. */ addr = SDL_getenv("IBUS_ADDRESS"); if (addr && *addr) { return SDL_strdup(addr); } /* Otherwise, we have to get the hostname, display, machine id, config dir and look up the address from a filepath using all those bits, eek. */ disp_env = SDL_getenv("DISPLAY"); if (!disp_env || !*disp_env) { display = SDL_strdup(":0.0"); } else { display = SDL_strdup(disp_env); } host = display; disp_num = SDL_strrchr(display, ':'); screen_num = SDL_strrchr(display, '.'); if (!disp_num) { SDL_free(display); return NULL; } *disp_num = 0; disp_num++; if (screen_num) { *screen_num = 0; } if (!*host) { host = "unix"; } SDL_memset(config_dir, 0, sizeof(config_dir)); conf_env = SDL_getenv("XDG_CONFIG_HOME"); if (conf_env && *conf_env) { SDL_strlcpy(config_dir, conf_env, sizeof(config_dir)); } else { const char *home_env = SDL_getenv("HOME"); if (!home_env || !*home_env) { SDL_free(display); return NULL; } SDL_snprintf(config_dir, sizeof(config_dir), "%s/.config", home_env); } key = dbus->get_local_machine_id(); SDL_memset(file_path, 0, sizeof(file_path)); SDL_snprintf(file_path, sizeof(file_path), "%s/ibus/bus/%s-%s-%s", config_dir, key, host, disp_num); dbus->free(key); SDL_free(display); return SDL_strdup(file_path); } static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus); static void SDLCALL IBus_SetCapabilities(void *data, const char *name, const char *old_val, const char *internal_editing) { SDL_DBusContext *dbus = SDL_DBus_GetContext(); if (IBus_CheckConnection(dbus)) { Uint32 caps = IBUS_CAP_FOCUS; if (!(internal_editing && *internal_editing == '1')) { caps |= IBUS_CAP_PREEDIT_TEXT; } SDL_DBus_CallVoidMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "SetCapabilities", DBUS_TYPE_UINT32, &caps, DBUS_TYPE_INVALID); } } static SDL_bool IBus_SetupConnection(SDL_DBusContext *dbus, const char* addr) { const char *client_name = "SDL2_Application"; const char *path = NULL; SDL_bool result = SDL_FALSE; DBusObjectPathVTable ibus_vtable; SDL_zero(ibus_vtable); ibus_vtable.message_function = &IBus_MessageHandler; ibus_conn = dbus->connection_open_private(addr, NULL); if (!ibus_conn) { return SDL_FALSE; } dbus->connection_flush(ibus_conn); if (!dbus->bus_register(ibus_conn, NULL)) { ibus_conn = NULL; return SDL_FALSE; } dbus->connection_flush(ibus_conn); if (SDL_DBus_CallMethodOnConnection(ibus_conn, IBUS_SERVICE, IBUS_PATH, IBUS_INTERFACE, "CreateInputContext", DBUS_TYPE_STRING, &client_name, DBUS_TYPE_INVALID, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID)) { SDL_free(input_ctx_path); input_ctx_path = SDL_strdup(path); SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, IBus_SetCapabilities, NULL); dbus->bus_add_match(ibus_conn, "type='signal',interface='org.freedesktop.IBus.InputContext'", NULL); dbus->connection_try_register_object_path(ibus_conn, input_ctx_path, &ibus_vtable, dbus, NULL); dbus->connection_flush(ibus_conn); result = SDL_TRUE; } SDL_IBus_SetFocus(SDL_GetKeyboardFocus() != NULL); SDL_IBus_UpdateTextRect(NULL); return result; } static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus) { if (!dbus) return SDL_FALSE; if (ibus_conn && dbus->connection_get_is_connected(ibus_conn)) { return SDL_TRUE; } if (inotify_fd > 0 && inotify_wd > 0) { char buf[1024]; ssize_t readsize = read(inotify_fd, buf, sizeof(buf)); if (readsize > 0) { char *p; SDL_bool file_updated = SDL_FALSE; for (p = buf; p < buf + readsize; /**/) { struct inotify_event *event = (struct inotify_event*) p; if (event->len > 0) { char *addr_file_no_path = SDL_strrchr(ibus_addr_file, '/'); if (!addr_file_no_path) return SDL_FALSE; if (SDL_strcmp(addr_file_no_path + 1, event->name) == 0) { file_updated = SDL_TRUE; break; } } p += sizeof(struct inotify_event) + event->len; } if (file_updated) { char *addr = IBus_ReadAddressFromFile(ibus_addr_file); if (addr) { SDL_bool result = IBus_SetupConnection(dbus, addr); SDL_free(addr); return result; } } } } return SDL_FALSE; } SDL_bool SDL_IBus_Init(void) { SDL_bool result = SDL_FALSE; SDL_DBusContext *dbus = SDL_DBus_GetContext(); if (dbus) { char *addr_file = IBus_GetDBusAddressFilename(); char *addr; char *addr_file_dir; if (!addr_file) { return SDL_FALSE; } /* !!! FIXME: if ibus_addr_file != NULL, this will overwrite it and leak (twice!) */ ibus_addr_file = SDL_strdup(addr_file); addr = IBus_ReadAddressFromFile(addr_file); if (!addr) { SDL_free(addr_file); return SDL_FALSE; } if (inotify_fd < 0) { inotify_fd = inotify_init(); fcntl(inotify_fd, F_SETFL, O_NONBLOCK); } addr_file_dir = SDL_strrchr(addr_file, '/'); if (addr_file_dir) { *addr_file_dir = 0; } inotify_wd = inotify_add_watch(inotify_fd, addr_file, IN_CREATE | IN_MODIFY); SDL_free(addr_file); if (addr) { result = IBus_SetupConnection(dbus, addr); SDL_free(addr); } } return result; } void SDL_IBus_Quit(void) { SDL_DBusContext *dbus; if (input_ctx_path) { SDL_free(input_ctx_path); input_ctx_path = NULL; } if (ibus_addr_file) { SDL_free(ibus_addr_file); ibus_addr_file = NULL; } dbus = SDL_DBus_GetContext(); if (dbus && ibus_conn) { dbus->connection_close(ibus_conn); dbus->connection_unref(ibus_conn); } if (inotify_fd > 0 && inotify_wd > 0) { inotify_rm_watch(inotify_fd, inotify_wd); inotify_wd = -1; } SDL_DelHintCallback(SDL_HINT_IME_INTERNAL_EDITING, IBus_SetCapabilities, NULL); SDL_memset(&ibus_cursor_rect, 0, sizeof(ibus_cursor_rect)); } static void IBus_SimpleMessage(const char *method) { SDL_DBusContext *dbus = SDL_DBus_GetContext(); if (IBus_CheckConnection(dbus)) { SDL_DBus_CallVoidMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, method, DBUS_TYPE_INVALID); } } void SDL_IBus_SetFocus(SDL_bool focused) { const char *method = focused ? "FocusIn" : "FocusOut"; IBus_SimpleMessage(method); } void SDL_IBus_Reset(void) { IBus_SimpleMessage("Reset"); } SDL_bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode) { Uint32 result = 0; SDL_DBusContext *dbus = SDL_DBus_GetContext(); if (IBus_CheckConnection(dbus)) { Uint32 mods = IBus_ModState(); if (!SDL_DBus_CallMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "ProcessKeyEvent", DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &mods, DBUS_TYPE_INVALID, DBUS_TYPE_BOOLEAN, &result, DBUS_TYPE_INVALID)) { result = 0; } } SDL_IBus_UpdateTextRect(NULL); return result ? SDL_TRUE : SDL_FALSE; } void SDL_IBus_UpdateTextRect(SDL_Rect *rect) { SDL_Window *focused_win; SDL_SysWMinfo info; int x = 0, y = 0; SDL_DBusContext *dbus; if (rect) { SDL_memcpy(&ibus_cursor_rect, rect, sizeof(ibus_cursor_rect)); } focused_win = SDL_GetKeyboardFocus(); if (!focused_win) { return; } SDL_VERSION(&info.version); if (!SDL_GetWindowWMInfo(focused_win, &info)) { return; } SDL_GetWindowPosition(focused_win, &x, &y); #if SDL_VIDEO_DRIVER_X11 if (info.subsystem == SDL_SYSWM_X11) { SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata; Display *x_disp = info.info.x11.display; Window x_win = info.info.x11.window; int x_screen = displaydata->screen; Window unused; X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused); } #endif x += ibus_cursor_rect.x; y += ibus_cursor_rect.y; dbus = SDL_DBus_GetContext(); if (IBus_CheckConnection(dbus)) { SDL_DBus_CallVoidMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "SetCursorLocation", DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_INT32, &ibus_cursor_rect.w, DBUS_TYPE_INT32, &ibus_cursor_rect.h, DBUS_TYPE_INVALID); } } void SDL_IBus_PumpEvents(void) { SDL_DBusContext *dbus = SDL_DBus_GetContext(); if (IBus_CheckConnection(dbus)) { dbus->connection_read_write(ibus_conn, 0); while (dbus->connection_dispatch(ibus_conn) == DBUS_DISPATCH_DATA_REMAINS) { /* Do nothing, actual work happens in IBus_MessageHandler */ } } } #endif /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/linux/SDL_ibus.c
C
apache-2.0
16,850
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifndef SDL_ibus_h_ #define SDL_ibus_h_ #ifdef HAVE_IBUS_IBUS_H #define SDL_USE_IBUS 1 #include "SDL_stdinc.h" #include <ibus-1.0/ibus.h> extern SDL_bool SDL_IBus_Init(void); extern void SDL_IBus_Quit(void); /* Lets the IBus server know about changes in window focus */ extern void SDL_IBus_SetFocus(SDL_bool focused); /* Closes the candidate list and resets any text currently being edited */ extern void SDL_IBus_Reset(void); /* Sends a keypress event to IBus, returns SDL_TRUE if IBus used this event to update its candidate list or change input methods. PumpEvents should be called some time after this, to recieve the TextInput / TextEditing event back. */ extern SDL_bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode); /* Update the position of IBus' candidate list. If rect is NULL then this will just reposition it relative to the focused window's new position. */ extern void SDL_IBus_UpdateTextRect(SDL_Rect *window_relative_rect); /* Checks DBus for new IBus events, and calls SDL_SendKeyboardText / SDL_SendEditingText for each event it finds */ extern void SDL_IBus_PumpEvents(void); #endif /* HAVE_IBUS_IBUS_H */ #endif /* SDL_ibus_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/linux/SDL_ibus.h
C
apache-2.0
2,194
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "SDL_ime.h" #include "SDL_ibus.h" #include "SDL_fcitx.h" typedef SDL_bool (*_SDL_IME_Init)(); typedef void (*_SDL_IME_Quit)(); typedef void (*_SDL_IME_SetFocus)(SDL_bool); typedef void (*_SDL_IME_Reset)(); typedef SDL_bool (*_SDL_IME_ProcessKeyEvent)(Uint32, Uint32); typedef void (*_SDL_IME_UpdateTextRect)(SDL_Rect *); typedef void (*_SDL_IME_PumpEvents)(); static _SDL_IME_Init SDL_IME_Init_Real = NULL; static _SDL_IME_Quit SDL_IME_Quit_Real = NULL; static _SDL_IME_SetFocus SDL_IME_SetFocus_Real = NULL; static _SDL_IME_Reset SDL_IME_Reset_Real = NULL; static _SDL_IME_ProcessKeyEvent SDL_IME_ProcessKeyEvent_Real = NULL; static _SDL_IME_UpdateTextRect SDL_IME_UpdateTextRect_Real = NULL; static _SDL_IME_PumpEvents SDL_IME_PumpEvents_Real = NULL; static void InitIME() { static SDL_bool inited = SDL_FALSE; #ifdef HAVE_FCITX const char *im_module = SDL_getenv("SDL_IM_MODULE"); const char *xmodifiers = SDL_getenv("XMODIFIERS"); #endif if (inited == SDL_TRUE) return; inited = SDL_TRUE; /* See if fcitx IME support is being requested */ #ifdef HAVE_FCITX if (!SDL_IME_Init_Real && ((im_module && SDL_strcmp(im_module, "fcitx") == 0) || (!im_module && xmodifiers && SDL_strstr(xmodifiers, "@im=fcitx") != NULL))) { SDL_IME_Init_Real = SDL_Fcitx_Init; SDL_IME_Quit_Real = SDL_Fcitx_Quit; SDL_IME_SetFocus_Real = SDL_Fcitx_SetFocus; SDL_IME_Reset_Real = SDL_Fcitx_Reset; SDL_IME_ProcessKeyEvent_Real = SDL_Fcitx_ProcessKeyEvent; SDL_IME_UpdateTextRect_Real = SDL_Fcitx_UpdateTextRect; SDL_IME_PumpEvents_Real = SDL_Fcitx_PumpEvents; } #endif /* HAVE_FCITX */ /* default to IBus */ #ifdef HAVE_IBUS_IBUS_H if (!SDL_IME_Init_Real) { SDL_IME_Init_Real = SDL_IBus_Init; SDL_IME_Quit_Real = SDL_IBus_Quit; SDL_IME_SetFocus_Real = SDL_IBus_SetFocus; SDL_IME_Reset_Real = SDL_IBus_Reset; SDL_IME_ProcessKeyEvent_Real = SDL_IBus_ProcessKeyEvent; SDL_IME_UpdateTextRect_Real = SDL_IBus_UpdateTextRect; SDL_IME_PumpEvents_Real = SDL_IBus_PumpEvents; } #endif /* HAVE_IBUS_IBUS_H */ } SDL_bool SDL_IME_Init(void) { InitIME(); if (SDL_IME_Init_Real) { if (SDL_IME_Init_Real()) { return SDL_TRUE; } /* uhoh, the IME implementation's init failed! Disable IME support. */ SDL_IME_Init_Real = NULL; SDL_IME_Quit_Real = NULL; SDL_IME_SetFocus_Real = NULL; SDL_IME_Reset_Real = NULL; SDL_IME_ProcessKeyEvent_Real = NULL; SDL_IME_UpdateTextRect_Real = NULL; SDL_IME_PumpEvents_Real = NULL; } return SDL_FALSE; } void SDL_IME_Quit(void) { if (SDL_IME_Quit_Real) SDL_IME_Quit_Real(); } void SDL_IME_SetFocus(SDL_bool focused) { if (SDL_IME_SetFocus_Real) SDL_IME_SetFocus_Real(focused); } void SDL_IME_Reset(void) { if (SDL_IME_Reset_Real) SDL_IME_Reset_Real(); } SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode) { if (SDL_IME_ProcessKeyEvent_Real) return SDL_IME_ProcessKeyEvent_Real(keysym, keycode); return SDL_FALSE; } void SDL_IME_UpdateTextRect(SDL_Rect *rect) { if (SDL_IME_UpdateTextRect_Real) SDL_IME_UpdateTextRect_Real(rect); } void SDL_IME_PumpEvents() { if (SDL_IME_PumpEvents_Real) SDL_IME_PumpEvents_Real(); } /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/linux/SDL_ime.c
C
apache-2.0
4,390
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef SDL_ime_h_ #define SDL_ime_h_ #include "../../SDL_internal.h" #include "SDL_stdinc.h" #include "SDL_rect.h" extern SDL_bool SDL_IME_Init(void); extern void SDL_IME_Quit(void); extern void SDL_IME_SetFocus(SDL_bool focused); extern void SDL_IME_Reset(void); extern SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode); extern void SDL_IME_UpdateTextRect(SDL_Rect *rect); extern void SDL_IME_PumpEvents(void); #endif /* SDL_ime_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/linux/SDL_ime.h
C
apache-2.0
1,431
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifdef __LINUX__ #include "SDL_error.h" #include "SDL_stdinc.h" #include "SDL_thread.h" #if !SDL_THREADS_DISABLED #include <sys/time.h> #include <sys/resource.h> #include <pthread.h> #include "SDL_system.h" /* RLIMIT_RTTIME requires kernel >= 2.6.25 and is in glibc >= 2.14 */ #ifndef RLIMIT_RTTIME #define RLIMIT_RTTIME 15 #endif #include "SDL_dbus.h" #if SDL_USE_LIBDBUS #include <sched.h> /* d-bus queries to org.freedesktop.RealtimeKit1. */ #define RTKIT_DBUS_NODE "org.freedesktop.RealtimeKit1" #define RTKIT_DBUS_PATH "/org/freedesktop/RealtimeKit1" #define RTKIT_DBUS_INTERFACE "org.freedesktop.RealtimeKit1" static pthread_once_t rtkit_initialize_once = PTHREAD_ONCE_INIT; static Sint32 rtkit_min_nice_level = -20; static Sint32 rtkit_max_realtime_priority = 99; static void rtkit_initialize() { SDL_DBusContext *dbus = SDL_DBus_GetContext(); /* Try getting minimum nice level: this is often greater than PRIO_MIN (-20). */ if (!dbus || !SDL_DBus_QueryPropertyOnConnection(dbus->system_conn, RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "MinNiceLevel", DBUS_TYPE_INT32, &rtkit_min_nice_level)) { rtkit_min_nice_level = -20; } /* Try getting maximum realtime priority: this can be less than the POSIX default (99). */ if (!dbus || !SDL_DBus_QueryPropertyOnConnection(dbus->system_conn, RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "MaxRealtimePriority", DBUS_TYPE_INT32, &rtkit_max_realtime_priority)) { rtkit_max_realtime_priority = 99; } } static SDL_bool rtkit_initialize_thread() { // Following is an excerpt from rtkit README that outlines the requirements // a thread must meet before making rtkit requests: // // * Only clients with RLIMIT_RTTIME set will get RT scheduling // // * RT scheduling will only be handed out to processes with // SCHED_RESET_ON_FORK set to guarantee that the scheduling // settings cannot 'leak' to child processes, thus making sure // that 'RT fork bombs' cannot be used to bypass RLIMIT_RTTIME // and take the system down. // // * Limits are enforced on all user controllable resources, only // a maximum number of users, processes, threads can request RT // scheduling at the same time. // // * Only a limited number of threads may be made RT in a // specific time frame. // // * Client authorization is verified with PolicyKit int err; struct rlimit rlimit; int nLimit = RLIMIT_RTTIME; pid_t nPid = 0; //self int nSchedPolicy = sched_getscheduler(nPid) | SCHED_RESET_ON_FORK; struct sched_param schedParam = {}; // Requirement #1: Set RLIMIT_RTTIME err = getrlimit(nLimit, &rlimit); if (err) { return SDL_FALSE; } rlimit.rlim_cur = rlimit.rlim_max; err = setrlimit(nLimit, &rlimit); if (err) { return SDL_FALSE; } // Requirement #2: Add SCHED_RESET_ON_FORK to the scheduler policy err = sched_getparam(nPid, &schedParam); if (err) { return SDL_FALSE; } err = sched_setscheduler(nPid, nSchedPolicy, &schedParam); if (err) { return SDL_FALSE; } return SDL_TRUE; } static SDL_bool rtkit_setpriority_nice(pid_t thread, int nice_level) { Uint64 ui64 = (Uint64)thread; Sint32 si32 = (Sint32)nice_level; SDL_DBusContext *dbus = SDL_DBus_GetContext(); pthread_once(&rtkit_initialize_once, rtkit_initialize); if (si32 < rtkit_min_nice_level) si32 = rtkit_min_nice_level; // We always perform the thread state changes necessary for rtkit. // This wastes some system calls if the state is already set but // typically code sets a thread priority and leaves it so it's // not expected that this wasted effort will be an issue. // We also do not quit if this fails, we let the rtkit request // go through to determine whether it really needs to fail or not. rtkit_initialize_thread(); if (!dbus || !SDL_DBus_CallMethodOnConnection(dbus->system_conn, RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "MakeThreadHighPriority", DBUS_TYPE_UINT64, &ui64, DBUS_TYPE_INT32, &si32, DBUS_TYPE_INVALID, DBUS_TYPE_INVALID)) { return SDL_FALSE; } return SDL_TRUE; } static SDL_bool rtkit_setpriority_realtime(pid_t thread, int rt_priority) { Uint64 ui64 = (Uint64)thread; Sint32 si32 = (Sint32)rt_priority; SDL_DBusContext *dbus = SDL_DBus_GetContext(); pthread_once(&rtkit_initialize_once, rtkit_initialize); if (si32 > rtkit_max_realtime_priority) si32 = rtkit_max_realtime_priority; // We always perform the thread state changes necessary for rtkit. // This wastes some system calls if the state is already set but // typically code sets a thread priority and leaves it so it's // not expected that this wasted effort will be an issue. // We also do not quit if this fails, we let the rtkit request // go through to determine whether it really needs to fail or not. rtkit_initialize_thread(); if (!dbus || !SDL_DBus_CallMethodOnConnection(dbus->system_conn, RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "MakeThreadRealtime", DBUS_TYPE_UINT64, &ui64, DBUS_TYPE_INT32, &si32, DBUS_TYPE_INVALID, DBUS_TYPE_INVALID)) { return SDL_FALSE; } return SDL_TRUE; } #else #define rtkit_max_realtime_priority 99 #endif /* dbus */ #endif /* threads */ /* this is a public symbol, so it has to exist even if threads are disabled. */ int SDL_LinuxSetThreadPriority(Sint64 threadID, int priority) { #if SDL_THREADS_DISABLED return SDL_Unsupported(); #else if (setpriority(PRIO_PROCESS, (id_t)threadID, priority) == 0) { return 0; } #if SDL_USE_LIBDBUS /* Note that this fails you most likely: * Have your process's scheduler incorrectly configured. See the requirements at: http://git.0pointer.net/rtkit.git/tree/README#n16 * Encountered dbus/polkit security restrictions. Note that the RealtimeKit1 dbus endpoint is inaccessible over ssh connections for most common distro configs. You might want to check your local config for details: /usr/share/polkit-1/actions/org.freedesktop.RealtimeKit1.policy README and sample code at: http://git.0pointer.net/rtkit.git */ if (rtkit_setpriority_nice((pid_t)threadID, priority)) { return 0; } #endif return SDL_SetError("setpriority() failed"); #endif } /* this is a public symbol, so it has to exist even if threads are disabled. */ int SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy) { #if SDL_THREADS_DISABLED return SDL_Unsupported(); #else int osPriority; if (schedPolicy == SCHED_RR || schedPolicy == SCHED_FIFO) { if (sdlPriority == SDL_THREAD_PRIORITY_LOW) { osPriority = 1; } else if (sdlPriority == SDL_THREAD_PRIORITY_HIGH) { osPriority = rtkit_max_realtime_priority * 3 / 4; } else if (sdlPriority == SDL_THREAD_PRIORITY_TIME_CRITICAL) { osPriority = rtkit_max_realtime_priority; } else { osPriority = rtkit_max_realtime_priority / 2; } } else { if (sdlPriority == SDL_THREAD_PRIORITY_LOW) { osPriority = 19; } else if (sdlPriority == SDL_THREAD_PRIORITY_HIGH) { osPriority = -10; } else if (sdlPriority == SDL_THREAD_PRIORITY_TIME_CRITICAL) { osPriority = -20; } else { osPriority = 0; } if (setpriority(PRIO_PROCESS, (id_t)threadID, osPriority) == 0) { return 0; } } #if SDL_USE_LIBDBUS /* Note that this fails you most likely: * Have your process's scheduler incorrectly configured. See the requirements at: http://git.0pointer.net/rtkit.git/tree/README#n16 * Encountered dbus/polkit security restrictions. Note that the RealtimeKit1 dbus endpoint is inaccessible over ssh connections for most common distro configs. You might want to check your local config for details: /usr/share/polkit-1/actions/org.freedesktop.RealtimeKit1.policy README and sample code at: http://git.0pointer.net/rtkit.git */ if (schedPolicy == SCHED_RR || schedPolicy == SCHED_FIFO) { if (rtkit_setpriority_realtime((pid_t)threadID, osPriority)) { return 0; } } else { if (rtkit_setpriority_nice((pid_t)threadID, osPriority)) { return 0; } } #endif return SDL_SetError("setpriority() failed"); #endif } #endif /* __LINUX__ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/linux/SDL_threadprio.c
C
apache-2.0
9,901
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* * To list the properties of a device, try something like: * udevadm info -a -n snd/hwC0D0 (for a sound card) * udevadm info --query=all -n input/event3 (for a keyboard, mouse, etc) * udevadm info --query=property -n input/event2 */ #include "SDL_udev.h" #ifdef SDL_USE_LIBUDEV #include <linux/input.h> #include "SDL_assert.h" #include "SDL_loadso.h" #include "SDL_timer.h" #include "SDL_hints.h" #include "../unix/SDL_poll.h" static const char *SDL_UDEV_LIBS[] = { "libudev.so.1", "libudev.so.0" }; #define _THIS SDL_UDEV_PrivateData *_this static _THIS = NULL; static SDL_bool SDL_UDEV_load_sym(const char *fn, void **addr); static int SDL_UDEV_load_syms(void); static SDL_bool SDL_UDEV_hotplug_update_available(void); static void device_event(SDL_UDEV_deviceevent type, struct udev_device *dev); static SDL_bool SDL_UDEV_load_sym(const char *fn, void **addr) { *addr = SDL_LoadFunction(_this->udev_handle, fn); if (*addr == NULL) { /* Don't call SDL_SetError(): SDL_LoadFunction already did. */ return SDL_FALSE; } return SDL_TRUE; } static int SDL_UDEV_load_syms(void) { /* cast funcs to char* first, to please GCC's strict aliasing rules. */ #define SDL_UDEV_SYM(x) \ if (!SDL_UDEV_load_sym(#x, (void **) (char *) & _this->syms.x)) return -1 SDL_UDEV_SYM(udev_device_get_action); SDL_UDEV_SYM(udev_device_get_devnode); SDL_UDEV_SYM(udev_device_get_subsystem); SDL_UDEV_SYM(udev_device_get_parent_with_subsystem_devtype); SDL_UDEV_SYM(udev_device_get_property_value); SDL_UDEV_SYM(udev_device_get_sysattr_value); SDL_UDEV_SYM(udev_device_new_from_syspath); SDL_UDEV_SYM(udev_device_unref); SDL_UDEV_SYM(udev_enumerate_add_match_property); SDL_UDEV_SYM(udev_enumerate_add_match_subsystem); SDL_UDEV_SYM(udev_enumerate_get_list_entry); SDL_UDEV_SYM(udev_enumerate_new); SDL_UDEV_SYM(udev_enumerate_scan_devices); SDL_UDEV_SYM(udev_enumerate_unref); SDL_UDEV_SYM(udev_list_entry_get_name); SDL_UDEV_SYM(udev_list_entry_get_next); SDL_UDEV_SYM(udev_monitor_enable_receiving); SDL_UDEV_SYM(udev_monitor_filter_add_match_subsystem_devtype); SDL_UDEV_SYM(udev_monitor_get_fd); SDL_UDEV_SYM(udev_monitor_new_from_netlink); SDL_UDEV_SYM(udev_monitor_receive_device); SDL_UDEV_SYM(udev_monitor_unref); SDL_UDEV_SYM(udev_new); SDL_UDEV_SYM(udev_unref); SDL_UDEV_SYM(udev_device_new_from_devnum); SDL_UDEV_SYM(udev_device_get_devnum); #undef SDL_UDEV_SYM return 0; } static SDL_bool SDL_UDEV_hotplug_update_available(void) { if (_this->udev_mon != NULL) { const int fd = _this->syms.udev_monitor_get_fd(_this->udev_mon); if (SDL_IOReady(fd, SDL_FALSE, 0)) { return SDL_TRUE; } } return SDL_FALSE; } int SDL_UDEV_Init(void) { int retval = 0; if (_this == NULL) { _this = (SDL_UDEV_PrivateData *) SDL_calloc(1, sizeof(*_this)); if(_this == NULL) { return SDL_OutOfMemory(); } retval = SDL_UDEV_LoadLibrary(); if (retval < 0) { SDL_UDEV_Quit(); return retval; } /* Set up udev monitoring * Listen for input devices (mouse, keyboard, joystick, etc) and sound devices */ _this->udev = _this->syms.udev_new(); if (_this->udev == NULL) { SDL_UDEV_Quit(); return SDL_SetError("udev_new() failed"); } _this->udev_mon = _this->syms.udev_monitor_new_from_netlink(_this->udev, "udev"); if (_this->udev_mon == NULL) { SDL_UDEV_Quit(); return SDL_SetError("udev_monitor_new_from_netlink() failed"); } _this->syms.udev_monitor_filter_add_match_subsystem_devtype(_this->udev_mon, "input", NULL); _this->syms.udev_monitor_filter_add_match_subsystem_devtype(_this->udev_mon, "sound", NULL); _this->syms.udev_monitor_enable_receiving(_this->udev_mon); /* Do an initial scan of existing devices */ SDL_UDEV_Scan(); } _this->ref_count += 1; return retval; } void SDL_UDEV_Quit(void) { SDL_UDEV_CallbackList *item; if (_this == NULL) { return; } _this->ref_count -= 1; if (_this->ref_count < 1) { if (_this->udev_mon != NULL) { _this->syms.udev_monitor_unref(_this->udev_mon); _this->udev_mon = NULL; } if (_this->udev != NULL) { _this->syms.udev_unref(_this->udev); _this->udev = NULL; } /* Remove existing devices */ while (_this->first != NULL) { item = _this->first; _this->first = _this->first->next; SDL_free(item); } SDL_UDEV_UnloadLibrary(); SDL_free(_this); _this = NULL; } } void SDL_UDEV_Scan(void) { struct udev_enumerate *enumerate = NULL; struct udev_list_entry *devs = NULL; struct udev_list_entry *item = NULL; if (_this == NULL) { return; } enumerate = _this->syms.udev_enumerate_new(_this->udev); if (enumerate == NULL) { SDL_UDEV_Quit(); SDL_SetError("udev_enumerate_new() failed"); return; } _this->syms.udev_enumerate_add_match_subsystem(enumerate, "input"); _this->syms.udev_enumerate_add_match_subsystem(enumerate, "sound"); _this->syms.udev_enumerate_scan_devices(enumerate); devs = _this->syms.udev_enumerate_get_list_entry(enumerate); for (item = devs; item; item = _this->syms.udev_list_entry_get_next(item)) { const char *path = _this->syms.udev_list_entry_get_name(item); struct udev_device *dev = _this->syms.udev_device_new_from_syspath(_this->udev, path); if (dev != NULL) { device_event(SDL_UDEV_DEVICEADDED, dev); _this->syms.udev_device_unref(dev); } } _this->syms.udev_enumerate_unref(enumerate); } void SDL_UDEV_UnloadLibrary(void) { if (_this == NULL) { return; } if (_this->udev_handle != NULL) { SDL_UnloadObject(_this->udev_handle); _this->udev_handle = NULL; } } int SDL_UDEV_LoadLibrary(void) { int retval = 0, i; if (_this == NULL) { return SDL_SetError("UDEV not initialized"); } /* See if there is a udev library already loaded */ if (SDL_UDEV_load_syms() == 0) { return 0; } #ifdef SDL_UDEV_DYNAMIC /* Check for the build environment's libudev first */ if (_this->udev_handle == NULL) { _this->udev_handle = SDL_LoadObject(SDL_UDEV_DYNAMIC); if (_this->udev_handle != NULL) { retval = SDL_UDEV_load_syms(); if (retval < 0) { SDL_UDEV_UnloadLibrary(); } } } #endif if (_this->udev_handle == NULL) { for( i = 0 ; i < SDL_arraysize(SDL_UDEV_LIBS); i++) { _this->udev_handle = SDL_LoadObject(SDL_UDEV_LIBS[i]); if (_this->udev_handle != NULL) { retval = SDL_UDEV_load_syms(); if (retval < 0) { SDL_UDEV_UnloadLibrary(); } else { break; } } } if (_this->udev_handle == NULL) { retval = -1; /* Don't call SDL_SetError(): SDL_LoadObject already did. */ } } return retval; } #define BITS_PER_LONG (sizeof(unsigned long) * 8) #define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) #define OFF(x) ((x)%BITS_PER_LONG) #define LONG(x) ((x)/BITS_PER_LONG) #define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1) static void get_caps(struct udev_device *dev, struct udev_device *pdev, const char *attr, unsigned long *bitmask, size_t bitmask_len) { const char *value; char text[4096]; char *word; int i; unsigned long v; SDL_memset(bitmask, 0, bitmask_len*sizeof(*bitmask)); value = _this->syms.udev_device_get_sysattr_value(pdev, attr); if (!value) { return; } SDL_strlcpy(text, value, sizeof(text)); i = 0; while ((word = SDL_strrchr(text, ' ')) != NULL) { v = SDL_strtoul(word+1, NULL, 16); if (i < bitmask_len) { bitmask[i] = v; } ++i; *word = '\0'; } v = SDL_strtoul(text, NULL, 16); if (i < bitmask_len) { bitmask[i] = v; } } static int guess_device_class(struct udev_device *dev) { int devclass = 0; struct udev_device *pdev; unsigned long bitmask_ev[NBITS(EV_MAX)]; unsigned long bitmask_abs[NBITS(ABS_MAX)]; unsigned long bitmask_key[NBITS(KEY_MAX)]; unsigned long bitmask_rel[NBITS(REL_MAX)]; unsigned long keyboard_mask; /* walk up the parental chain until we find the real input device; the * argument is very likely a subdevice of this, like eventN */ pdev = dev; while (pdev && !_this->syms.udev_device_get_sysattr_value(pdev, "capabilities/ev")) { pdev = _this->syms.udev_device_get_parent_with_subsystem_devtype(pdev, "input", NULL); } if (!pdev) { return 0; } get_caps(dev, pdev, "capabilities/ev", bitmask_ev, SDL_arraysize(bitmask_ev)); get_caps(dev, pdev, "capabilities/abs", bitmask_abs, SDL_arraysize(bitmask_abs)); get_caps(dev, pdev, "capabilities/rel", bitmask_rel, SDL_arraysize(bitmask_rel)); get_caps(dev, pdev, "capabilities/key", bitmask_key, SDL_arraysize(bitmask_key)); if (test_bit(EV_ABS, bitmask_ev) && test_bit(ABS_X, bitmask_abs) && test_bit(ABS_Y, bitmask_abs)) { if (test_bit(BTN_STYLUS, bitmask_key) || test_bit(BTN_TOOL_PEN, bitmask_key)) { ; /* ID_INPUT_TABLET */ } else if (test_bit(BTN_TOOL_FINGER, bitmask_key) && !test_bit(BTN_TOOL_PEN, bitmask_key)) { ; /* ID_INPUT_TOUCHPAD */ } else if (test_bit(BTN_MOUSE, bitmask_key)) { devclass |= SDL_UDEV_DEVICE_MOUSE; /* ID_INPUT_MOUSE */ } else if (test_bit(BTN_TOUCH, bitmask_key)) { /* TODO: better determining between touchscreen and multitouch touchpad, see https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-input_id.c */ devclass |= SDL_UDEV_DEVICE_TOUCHSCREEN; /* ID_INPUT_TOUCHSCREEN */ } if (test_bit(BTN_TRIGGER, bitmask_key) || test_bit(BTN_A, bitmask_key) || test_bit(BTN_1, bitmask_key) || test_bit(ABS_RX, bitmask_abs) || test_bit(ABS_RY, bitmask_abs) || test_bit(ABS_RZ, bitmask_abs) || test_bit(ABS_THROTTLE, bitmask_abs) || test_bit(ABS_RUDDER, bitmask_abs) || test_bit(ABS_WHEEL, bitmask_abs) || test_bit(ABS_GAS, bitmask_abs) || test_bit(ABS_BRAKE, bitmask_abs)) { devclass |= SDL_UDEV_DEVICE_JOYSTICK; /* ID_INPUT_JOYSTICK */ } } if (test_bit(EV_REL, bitmask_ev) && test_bit(REL_X, bitmask_rel) && test_bit(REL_Y, bitmask_rel) && test_bit(BTN_MOUSE, bitmask_key)) { devclass |= SDL_UDEV_DEVICE_MOUSE; /* ID_INPUT_MOUSE */ } /* the first 32 bits are ESC, numbers, and Q to D; if we have any of * those, consider it a keyboard device; do not test KEY_RESERVED, though */ keyboard_mask = 0xFFFFFFFE; if ((bitmask_key[0] & keyboard_mask) != 0) devclass |= SDL_UDEV_DEVICE_KEYBOARD; /* ID_INPUT_KEYBOARD */ return devclass; } static void device_event(SDL_UDEV_deviceevent type, struct udev_device *dev) { const char *subsystem; const char *val = NULL; int devclass = 0; const char *path; SDL_UDEV_CallbackList *item; path = _this->syms.udev_device_get_devnode(dev); if (path == NULL) { return; } subsystem = _this->syms.udev_device_get_subsystem(dev); if (SDL_strcmp(subsystem, "sound") == 0) { devclass = SDL_UDEV_DEVICE_SOUND; } else if (SDL_strcmp(subsystem, "input") == 0) { /* udev rules reference: http://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-input_id.c */ val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_JOYSTICK"); if (val != NULL && SDL_strcmp(val, "1") == 0 ) { devclass |= SDL_UDEV_DEVICE_JOYSTICK; } val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_ACCELEROMETER"); if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE) && val != NULL && SDL_strcmp(val, "1") == 0 ) { devclass |= SDL_UDEV_DEVICE_JOYSTICK; } val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_MOUSE"); if (val != NULL && SDL_strcmp(val, "1") == 0 ) { devclass |= SDL_UDEV_DEVICE_MOUSE; } val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_TOUCHSCREEN"); if (val != NULL && SDL_strcmp(val, "1") == 0 ) { devclass |= SDL_UDEV_DEVICE_TOUCHSCREEN; } /* The undocumented rule is: - All devices with keys get ID_INPUT_KEY - From this subset, if they have ESC, numbers, and Q to D, it also gets ID_INPUT_KEYBOARD Ref: http://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-input_id.c#n183 */ val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_KEY"); if (val != NULL && SDL_strcmp(val, "1") == 0 ) { devclass |= SDL_UDEV_DEVICE_KEYBOARD; } if (devclass == 0) { /* Fall back to old style input classes */ val = _this->syms.udev_device_get_property_value(dev, "ID_CLASS"); if (val != NULL) { if (SDL_strcmp(val, "joystick") == 0) { devclass = SDL_UDEV_DEVICE_JOYSTICK; } else if (SDL_strcmp(val, "mouse") == 0) { devclass = SDL_UDEV_DEVICE_MOUSE; } else if (SDL_strcmp(val, "kbd") == 0) { devclass = SDL_UDEV_DEVICE_KEYBOARD; } else { return; } } else { /* We could be linked with libudev on a system that doesn't have udev running */ devclass = guess_device_class(dev); } } } else { return; } /* Process callbacks */ for (item = _this->first; item != NULL; item = item->next) { item->callback(type, devclass, path); } } void SDL_UDEV_Poll(void) { struct udev_device *dev = NULL; const char *action = NULL; if (_this == NULL) { return; } while (SDL_UDEV_hotplug_update_available()) { dev = _this->syms.udev_monitor_receive_device(_this->udev_mon); if (dev == NULL) { break; } action = _this->syms.udev_device_get_action(dev); if (SDL_strcmp(action, "add") == 0) { /* Wait for the device to finish initialization */ SDL_Delay(100); device_event(SDL_UDEV_DEVICEADDED, dev); } else if (SDL_strcmp(action, "remove") == 0) { device_event(SDL_UDEV_DEVICEREMOVED, dev); } _this->syms.udev_device_unref(dev); } } int SDL_UDEV_AddCallback(SDL_UDEV_Callback cb) { SDL_UDEV_CallbackList *item; item = (SDL_UDEV_CallbackList *) SDL_calloc(1, sizeof (SDL_UDEV_CallbackList)); if (item == NULL) { return SDL_OutOfMemory(); } item->callback = cb; if (_this->last == NULL) { _this->first = _this->last = item; } else { _this->last->next = item; _this->last = item; } return 1; } void SDL_UDEV_DelCallback(SDL_UDEV_Callback cb) { SDL_UDEV_CallbackList *item; SDL_UDEV_CallbackList *prev = NULL; for (item = _this->first; item != NULL; item = item->next) { /* found it, remove it. */ if (item->callback == cb) { if (prev != NULL) { prev->next = item->next; } else { SDL_assert(_this->first == item); _this->first = item->next; } if (item == _this->last) { _this->last = prev; } SDL_free(item); return; } prev = item; } } const SDL_UDEV_Symbols * SDL_UDEV_GetUdevSyms(void) { if (SDL_UDEV_Init() < 0) { SDL_SetError("Could not initialize UDEV"); return NULL; } return &_this->syms; } void SDL_UDEV_ReleaseUdevSyms(void) { SDL_UDEV_Quit(); } #endif /* SDL_USE_LIBUDEV */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/linux/SDL_udev.c
C
apache-2.0
17,828
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifndef SDL_udev_h_ #define SDL_udev_h_ #if HAVE_LIBUDEV_H #ifndef SDL_USE_LIBUDEV #define SDL_USE_LIBUDEV 1 #endif #include "SDL_loadso.h" #include "SDL_events.h" #include <libudev.h> #include <sys/time.h> #include <sys/types.h> /** * \brief Device type */ typedef enum { SDL_UDEV_DEVICEADDED = 1, SDL_UDEV_DEVICEREMOVED } SDL_UDEV_deviceevent; /* A device can be any combination of these classes */ typedef enum { SDL_UDEV_DEVICE_UNKNOWN = 0x0000, SDL_UDEV_DEVICE_MOUSE = 0x0001, SDL_UDEV_DEVICE_KEYBOARD = 0x0002, SDL_UDEV_DEVICE_JOYSTICK = 0x0004, SDL_UDEV_DEVICE_SOUND = 0x0008, SDL_UDEV_DEVICE_TOUCHSCREEN = 0x0010 } SDL_UDEV_deviceclass; typedef void (*SDL_UDEV_Callback)(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); typedef struct SDL_UDEV_CallbackList { SDL_UDEV_Callback callback; struct SDL_UDEV_CallbackList *next; } SDL_UDEV_CallbackList; typedef struct SDL_UDEV_Symbols { const char *(*udev_device_get_action)(struct udev_device *); const char *(*udev_device_get_devnode)(struct udev_device *); const char *(*udev_device_get_subsystem)(struct udev_device *); struct udev_device *(*udev_device_get_parent_with_subsystem_devtype)(struct udev_device *udev_device, const char *subsystem, const char *devtype); const char *(*udev_device_get_property_value)(struct udev_device *, const char *); const char *(*udev_device_get_sysattr_value)(struct udev_device *udev_device, const char *sysattr); struct udev_device *(*udev_device_new_from_syspath)(struct udev *, const char *); void (*udev_device_unref)(struct udev_device *); int (*udev_enumerate_add_match_property)(struct udev_enumerate *, const char *, const char *); int (*udev_enumerate_add_match_subsystem)(struct udev_enumerate *, const char *); struct udev_list_entry *(*udev_enumerate_get_list_entry)(struct udev_enumerate *); struct udev_enumerate *(*udev_enumerate_new)(struct udev *); int (*udev_enumerate_scan_devices)(struct udev_enumerate *); void (*udev_enumerate_unref)(struct udev_enumerate *); const char *(*udev_list_entry_get_name)(struct udev_list_entry *); struct udev_list_entry *(*udev_list_entry_get_next)(struct udev_list_entry *); int (*udev_monitor_enable_receiving)(struct udev_monitor *); int (*udev_monitor_filter_add_match_subsystem_devtype)(struct udev_monitor *, const char *, const char *); int (*udev_monitor_get_fd)(struct udev_monitor *); struct udev_monitor *(*udev_monitor_new_from_netlink)(struct udev *, const char *); struct udev_device *(*udev_monitor_receive_device)(struct udev_monitor *); void (*udev_monitor_unref)(struct udev_monitor *); struct udev *(*udev_new)(void); void (*udev_unref)(struct udev *); struct udev_device * (*udev_device_new_from_devnum)(struct udev *udev, char type, dev_t devnum); dev_t (*udev_device_get_devnum) (struct udev_device *udev_device); } SDL_UDEV_Symbols; typedef struct SDL_UDEV_PrivateData { const char *udev_library; void *udev_handle; struct udev *udev; struct udev_monitor *udev_mon; int ref_count; SDL_UDEV_CallbackList *first, *last; /* Function pointers */ SDL_UDEV_Symbols syms; } SDL_UDEV_PrivateData; extern int SDL_UDEV_Init(void); extern void SDL_UDEV_Quit(void); extern void SDL_UDEV_UnloadLibrary(void); extern int SDL_UDEV_LoadLibrary(void); extern void SDL_UDEV_Poll(void); extern void SDL_UDEV_Scan(void); extern int SDL_UDEV_AddCallback(SDL_UDEV_Callback cb); extern void SDL_UDEV_DelCallback(SDL_UDEV_Callback cb); extern const SDL_UDEV_Symbols *SDL_UDEV_GetUdevSyms(void); extern void SDL_UDEV_ReleaseUdevSyms(void); #endif /* HAVE_LIBUDEV_H */ #endif /* SDL_udev_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/linux/SDL_udev.h
C
apache-2.0
4,786
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #include "SDL_assert.h" #include "SDL_poll.h" #ifdef HAVE_POLL #include <poll.h> #else #include <sys/time.h> #include <sys/types.h> #include <unistd.h> #endif #include <errno.h> int SDL_IOReady(int fd, SDL_bool forWrite, int timeoutMS) { int result; /* Note: We don't bother to account for elapsed time if we get EINTR */ do { #ifdef HAVE_POLL struct pollfd info; info.fd = fd; if (forWrite) { info.events = POLLOUT; } else { info.events = POLLIN | POLLPRI; } result = poll(&info, 1, timeoutMS); #else fd_set rfdset, *rfdp = NULL; fd_set wfdset, *wfdp = NULL; struct timeval tv, *tvp = NULL; /* If this assert triggers we'll corrupt memory here */ SDL_assert(fd >= 0 && fd < FD_SETSIZE); if (forWrite) { FD_ZERO(&wfdset); FD_SET(fd, &wfdset); wfdp = &wfdset; } else { FD_ZERO(&rfdset); FD_SET(fd, &rfdset); rfdp = &rfdset; } if (timeoutMS >= 0) { tv.tv_sec = timeoutMS / 1000; tv.tv_usec = (timeoutMS % 1000) * 1000; tvp = &tv; } result = select(fd + 1, rfdp, wfdp, NULL, tvp); #endif /* HAVE_POLL */ } while ( result < 0 && errno == EINTR ); return result; } /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/unix/SDL_poll.c
C
apache-2.0
2,372
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifndef SDL_poll_h_ #define SDL_poll_h_ #include "SDL_stdinc.h" extern int SDL_IOReady(int fd, SDL_bool forWrite, int timeoutMS); #endif /* SDL_poll_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/unix/SDL_poll.h
C
apache-2.0
1,168
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifndef SDL_directx_h_ #define SDL_directx_h_ /* Include all of the DirectX 8.0 headers and adds any necessary tweaks */ #include "SDL_windows.h" #include <mmsystem.h> #ifndef WIN32 #define WIN32 #endif #undef WINNT /* Far pointers don't exist in 32-bit code */ #ifndef FAR #define FAR #endif /* Error codes not yet included in Win32 API header files */ #ifndef MAKE_HRESULT #define MAKE_HRESULT(sev,fac,code) \ ((HRESULT)(((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code)))) #endif #ifndef S_OK #define S_OK (HRESULT)0x00000000L #endif #ifndef SUCCEEDED #define SUCCEEDED(x) ((HRESULT)(x) >= 0) #endif #ifndef FAILED #define FAILED(x) ((HRESULT)(x)<0) #endif #ifndef E_FAIL #define E_FAIL (HRESULT)0x80000008L #endif #ifndef E_NOINTERFACE #define E_NOINTERFACE (HRESULT)0x80004002L #endif #ifndef E_OUTOFMEMORY #define E_OUTOFMEMORY (HRESULT)0x8007000EL #endif #ifndef E_INVALIDARG #define E_INVALIDARG (HRESULT)0x80070057L #endif #ifndef E_NOTIMPL #define E_NOTIMPL (HRESULT)0x80004001L #endif #ifndef REGDB_E_CLASSNOTREG #define REGDB_E_CLASSNOTREG (HRESULT)0x80040154L #endif /* Severity codes */ #ifndef SEVERITY_ERROR #define SEVERITY_ERROR 1 #endif /* Error facility codes */ #ifndef FACILITY_WIN32 #define FACILITY_WIN32 7 #endif #ifndef FIELD_OFFSET #define FIELD_OFFSET(type, field) ((LONG)&(((type *)0)->field)) #endif /* DirectX headers (if it isn't included, I haven't tested it yet) */ /* We need these defines to mark what version of DirectX API we use */ #define DIRECTDRAW_VERSION 0x0700 #define DIRECTSOUND_VERSION 0x0800 #define DIRECTINPUT_VERSION 0x0800 /* Need version 7 for force feedback. Need version 8 so IDirectInput8_EnumDevices doesn't leak like a sieve... */ #ifdef HAVE_DDRAW_H #include <ddraw.h> #endif #ifdef HAVE_DSOUND_H #include <dsound.h> #endif #ifdef HAVE_DINPUT_H #include <dinput.h> #else typedef struct { int unused; } DIDEVICEINSTANCE; #endif #endif /* SDL_directx_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/windows/SDL_directx.h
C
apache-2.0
3,004
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #if defined(__WIN32__) || defined(__WINRT__) #include "SDL_windows.h" #include "SDL_error.h" #include "SDL_assert.h" #include <objbase.h> /* for CoInitialize/CoUninitialize (Win32 only) */ #ifndef _WIN32_WINNT_VISTA #define _WIN32_WINNT_VISTA 0x0600 #endif #ifndef _WIN32_WINNT_WIN7 #define _WIN32_WINNT_WIN7 0x0601 #endif /* Sets an error message based on an HRESULT */ int WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr) { TCHAR buffer[1024]; char *message; FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, hr, 0, buffer, SDL_arraysize(buffer), NULL); message = WIN_StringToUTF8(buffer); SDL_SetError("%s%s%s", prefix ? prefix : "", prefix ? ": " : "", message); SDL_free(message); return -1; } /* Sets an error message based on GetLastError() */ int WIN_SetError(const char *prefix) { return WIN_SetErrorFromHRESULT(prefix, GetLastError()); } HRESULT WIN_CoInitialize(void) { /* SDL handles any threading model, so initialize with the default, which is compatible with OLE and if that doesn't work, try multi-threaded mode. If you need multi-threaded mode, call CoInitializeEx() before SDL_Init() */ #ifdef __WINRT__ /* DLudwig: On WinRT, it is assumed that COM was initialized in main(). CoInitializeEx is available (not CoInitialize though), however on WinRT, main() is typically declared with the [MTAThread] attribute, which, AFAIK, should initialize COM. */ return S_OK; #else HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); if (hr == RPC_E_CHANGED_MODE) { hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); } /* S_FALSE means success, but someone else already initialized. */ /* You still need to call CoUninitialize in this case! */ if (hr == S_FALSE) { return S_OK; } return hr; #endif } void WIN_CoUninitialize(void) { #ifndef __WINRT__ CoUninitialize(); #endif } #ifndef __WINRT__ static BOOL IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor) { OSVERSIONINFOEXW osvi; DWORDLONG const dwlConditionMask = VerSetConditionMask( VerSetConditionMask( VerSetConditionMask( 0, VER_MAJORVERSION, VER_GREATER_EQUAL ), VER_MINORVERSION, VER_GREATER_EQUAL ), VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL ); SDL_zero(osvi); osvi.dwOSVersionInfoSize = sizeof(osvi); osvi.dwMajorVersion = wMajorVersion; osvi.dwMinorVersion = wMinorVersion; osvi.wServicePackMajor = wServicePackMajor; return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE; } #endif BOOL WIN_IsWindowsVistaOrGreater(void) { #ifdef __WINRT__ return TRUE; #else return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0); #endif } BOOL WIN_IsWindows7OrGreater(void) { #ifdef __WINRT__ return TRUE; #else return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0); #endif } /* WAVExxxCAPS gives you 31 bytes for the device name, and just truncates if it's longer. However, since WinXP, you can use the WAVExxxCAPS2 structure, which will give you a name GUID. The full name is in the Windows Registry under that GUID, located here: HKLM\System\CurrentControlSet\Control\MediaCategories Note that drivers can report GUID_NULL for the name GUID, in which case, Windows makes a best effort to fill in those 31 bytes in the usual place. This info summarized from MSDN: http://web.archive.org/web/20131027093034/http://msdn.microsoft.com/en-us/library/windows/hardware/ff536382(v=vs.85).aspx Always look this up in the registry if possible, because the strings are different! At least on Win10, I see "Yeti Stereo Microphone" in the Registry, and a unhelpful "Microphone(Yeti Stereo Microph" in winmm. Sigh. (Also, DirectSound shouldn't be limited to 32 chars, but its device enum has the same problem.) WASAPI doesn't need this. This is just for DirectSound/WinMM. */ char * WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid) { #if __WINRT__ return WIN_StringToUTF8(name); /* No registry access on WinRT/UWP, go with what we've got. */ #else static const GUID nullguid = { 0 }; const unsigned char *ptr; char keystr[128]; WCHAR *strw = NULL; SDL_bool rc; HKEY hkey; DWORD len = 0; char *retval = NULL; if (WIN_IsEqualGUID(guid, &nullguid)) { return WIN_StringToUTF8(name); /* No GUID, go with what we've got. */ } ptr = (const unsigned char *) guid; SDL_snprintf(keystr, sizeof (keystr), "System\\CurrentControlSet\\Control\\MediaCategories\\{%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X}", ptr[3], ptr[2], ptr[1], ptr[0], ptr[5], ptr[4], ptr[7], ptr[6], ptr[8], ptr[9], ptr[10], ptr[11], ptr[12], ptr[13], ptr[14], ptr[15]); strw = WIN_UTF8ToString(keystr); rc = (RegOpenKeyExW(HKEY_LOCAL_MACHINE, strw, 0, KEY_QUERY_VALUE, &hkey) == ERROR_SUCCESS); SDL_free(strw); if (!rc) { return WIN_StringToUTF8(name); /* oh well. */ } rc = (RegQueryValueExW(hkey, L"Name", NULL, NULL, NULL, &len) == ERROR_SUCCESS); if (!rc) { RegCloseKey(hkey); return WIN_StringToUTF8(name); /* oh well. */ } strw = (WCHAR *) SDL_malloc(len + sizeof (WCHAR)); if (!strw) { RegCloseKey(hkey); return WIN_StringToUTF8(name); /* oh well. */ } rc = (RegQueryValueExW(hkey, L"Name", NULL, NULL, (LPBYTE) strw, &len) == ERROR_SUCCESS); RegCloseKey(hkey); if (!rc) { SDL_free(strw); return WIN_StringToUTF8(name); /* oh well. */ } strw[len / 2] = 0; /* make sure it's null-terminated. */ retval = WIN_StringToUTF8(strw); SDL_free(strw); return retval ? retval : WIN_StringToUTF8(name); #endif /* if __WINRT__ / else */ } BOOL WIN_IsEqualGUID(const GUID * a, const GUID * b) { return (SDL_memcmp(a, b, sizeof (*a)) == 0); } BOOL WIN_IsEqualIID(REFIID a, REFIID b) { return (SDL_memcmp(a, b, sizeof (*a)) == 0); } #endif /* __WIN32__ || __WINRT__ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/windows/SDL_windows.c
C
apache-2.0
7,213
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* This is an include file for windows.h with the SDL build settings */ #ifndef _INCLUDED_WINDOWS_H #define _INCLUDED_WINDOWS_H #if defined(__WIN32__) #define WIN32_LEAN_AND_MEAN #define STRICT #ifndef UNICODE #define UNICODE 1 #endif #undef _WIN32_WINNT #define _WIN32_WINNT 0x501 /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices(), 0x501 for raw input */ #endif #include <windows.h> #include <basetyps.h> /* for REFIID with broken mingw.org headers */ /* Routines to convert from UTF8 to native Windows text */ #if UNICODE #define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UTF-16LE", (char *)(S), (SDL_wcslen(S)+1)*sizeof(WCHAR)) #define WIN_UTF8ToString(S) (WCHAR *)SDL_iconv_string("UTF-16LE", "UTF-8", (char *)(S), SDL_strlen(S)+1) #else /* !!! FIXME: UTF8ToString() can just be a SDL_strdup() here. */ #define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)(S), (SDL_strlen(S)+1)) #define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)(S), SDL_strlen(S)+1) #endif /* Sets an error message based on a given HRESULT */ extern int WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr); /* Sets an error message based on GetLastError(). Always return -1. */ extern int WIN_SetError(const char *prefix); /* Wrap up the oddities of CoInitialize() into a common function. */ extern HRESULT WIN_CoInitialize(void); extern void WIN_CoUninitialize(void); /* Returns SDL_TRUE if we're running on Windows Vista and newer */ extern BOOL WIN_IsWindowsVistaOrGreater(void); /* Returns SDL_TRUE if we're running on Windows 7 and newer */ extern BOOL WIN_IsWindows7OrGreater(void); /* You need to SDL_free() the result of this call. */ extern char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid); /* Checks to see if two GUID are the same. */ extern BOOL WIN_IsEqualGUID(const GUID * a, const GUID * b); extern BOOL WIN_IsEqualIID(REFIID a, REFIID b); #endif /* _INCLUDED_WINDOWS_H */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/windows/SDL_windows.h
C
apache-2.0
2,938
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #include "SDL_assert.h" #include "SDL_xinput.h" #ifdef HAVE_XINPUT_H XInputGetState_t SDL_XInputGetState = NULL; XInputSetState_t SDL_XInputSetState = NULL; XInputGetCapabilities_t SDL_XInputGetCapabilities = NULL; XInputGetBatteryInformation_t SDL_XInputGetBatteryInformation = NULL; DWORD SDL_XInputVersion = 0; static HANDLE s_pXInputDLL = 0; static int s_XInputDLLRefCount = 0; #ifdef __WINRT__ int WIN_LoadXInputDLL(void) { /* Getting handles to system dlls (via LoadLibrary and its variants) is not * supported on WinRT, thus, pointers to XInput's functions can't be * retrieved via GetProcAddress. * * When on WinRT, assume that XInput is already loaded, and directly map * its XInput.h-declared functions to the SDL_XInput* set of function * pointers. * * Side-note: XInputGetStateEx is not available for use in WinRT. * This seems to mean that support for the guide button is not available * in WinRT, unfortunately. */ SDL_XInputGetState = (XInputGetState_t)XInputGetState; SDL_XInputSetState = (XInputSetState_t)XInputSetState; SDL_XInputGetCapabilities = (XInputGetCapabilities_t)XInputGetCapabilities; SDL_XInputGetBatteryInformation = (XInputGetBatteryInformation_t)XInputGetBatteryInformation; /* XInput 1.4 ships with Windows 8 and 8.1: */ SDL_XInputVersion = (1 << 16) | 4; return 0; } void WIN_UnloadXInputDLL(void) { } #else /* !__WINRT__ */ int WIN_LoadXInputDLL(void) { DWORD version = 0; if (s_pXInputDLL) { SDL_assert(s_XInputDLLRefCount > 0); s_XInputDLLRefCount++; return 0; /* already loaded */ } /* NOTE: Don't load XinputUap.dll * This is XInput emulation over Windows.Gaming.Input, and has all the * limitations of that API (no devices at startup, no background input, etc.) */ version = (1 << 16) | 4; s_pXInputDLL = LoadLibrary(L"XInput1_4.dll"); /* 1.4 Ships with Windows 8. */ if (!s_pXInputDLL) { version = (1 << 16) | 3; s_pXInputDLL = LoadLibrary(L"XInput1_3.dll"); /* 1.3 can be installed as a redistributable component. */ } if (!s_pXInputDLL) { s_pXInputDLL = LoadLibrary(L"bin\\XInput1_3.dll"); } if (!s_pXInputDLL) { /* "9.1.0" Ships with Vista and Win7, and is more limited than 1.3+ (e.g. XInputGetStateEx is not available.) */ s_pXInputDLL = LoadLibrary(L"XInput9_1_0.dll"); } if (!s_pXInputDLL) { return -1; } SDL_assert(s_XInputDLLRefCount == 0); SDL_XInputVersion = version; s_XInputDLLRefCount = 1; /* 100 is the ordinal for _XInputGetStateEx, which returns the same struct as XinputGetState, but with extra data in wButtons for the guide button, we think... */ SDL_XInputGetState = (XInputGetState_t)GetProcAddress((HMODULE)s_pXInputDLL, (LPCSTR)100); if (!SDL_XInputGetState) { SDL_XInputGetState = (XInputGetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetState"); } SDL_XInputSetState = (XInputSetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputSetState"); SDL_XInputGetCapabilities = (XInputGetCapabilities_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetCapabilities"); SDL_XInputGetBatteryInformation = (XInputGetBatteryInformation_t)GetProcAddress( (HMODULE)s_pXInputDLL, "XInputGetBatteryInformation" ); if (!SDL_XInputGetState || !SDL_XInputSetState || !SDL_XInputGetCapabilities) { WIN_UnloadXInputDLL(); return -1; } return 0; } void WIN_UnloadXInputDLL(void) { if (s_pXInputDLL) { SDL_assert(s_XInputDLLRefCount > 0); if (--s_XInputDLLRefCount == 0) { FreeLibrary(s_pXInputDLL); s_pXInputDLL = NULL; } } else { SDL_assert(s_XInputDLLRefCount == 0); } } #endif /* __WINRT__ */ #endif /* HAVE_XINPUT_H */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/windows/SDL_xinput.c
C
apache-2.0
4,884
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifndef SDL_xinput_h_ #define SDL_xinput_h_ #ifdef HAVE_XINPUT_H #include "SDL_windows.h" #include <xinput.h> #ifndef XUSER_MAX_COUNT #define XUSER_MAX_COUNT 4 #endif #ifndef XUSER_INDEX_ANY #define XUSER_INDEX_ANY 0x000000FF #endif #ifndef XINPUT_CAPS_FFB_SUPPORTED #define XINPUT_CAPS_FFB_SUPPORTED 0x0001 #endif #ifndef XINPUT_DEVSUBTYPE_UNKNOWN #define XINPUT_DEVSUBTYPE_UNKNOWN 0x00 #endif #ifndef XINPUT_DEVSUBTYPE_GAMEPAD #define XINPUT_DEVSUBTYPE_GAMEPAD 0x01 #endif #ifndef XINPUT_DEVSUBTYPE_WHEEL #define XINPUT_DEVSUBTYPE_WHEEL 0x02 #endif #ifndef XINPUT_DEVSUBTYPE_ARCADE_STICK #define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03 #endif #ifndef XINPUT_DEVSUBTYPE_FLIGHT_STICK #define XINPUT_DEVSUBTYPE_FLIGHT_STICK 0x04 #endif #ifndef XINPUT_DEVSUBTYPE_DANCE_PAD #define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05 #endif #ifndef XINPUT_DEVSUBTYPE_GUITAR #define XINPUT_DEVSUBTYPE_GUITAR 0x06 #endif #ifndef XINPUT_DEVSUBTYPE_GUITAR_ALTERNATE #define XINPUT_DEVSUBTYPE_GUITAR_ALTERNATE 0x07 #endif #ifndef XINPUT_DEVSUBTYPE_DRUM_KIT #define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08 #endif #ifndef XINPUT_DEVSUBTYPE_GUITAR_BASS #define XINPUT_DEVSUBTYPE_GUITAR_BASS 0x0B #endif #ifndef XINPUT_DEVSUBTYPE_ARCADE_PAD #define XINPUT_DEVSUBTYPE_ARCADE_PAD 0x13 #endif #ifndef XINPUT_GAMEPAD_GUIDE #define XINPUT_GAMEPAD_GUIDE 0x0400 #endif #ifndef BATTERY_DEVTYPE_GAMEPAD #define BATTERY_DEVTYPE_GAMEPAD 0x00 #endif #ifndef BATTERY_TYPE_WIRED #define BATTERY_TYPE_WIRED 0x01 #endif #ifndef BATTERY_TYPE_UNKNOWN #define BATTERY_TYPE_UNKNOWN 0xFF #endif #ifndef BATTERY_LEVEL_EMPTY #define BATTERY_LEVEL_EMPTY 0x00 #endif #ifndef BATTERY_LEVEL_LOW #define BATTERY_LEVEL_LOW 0x01 #endif #ifndef BATTERY_LEVEL_MEDIUM #define BATTERY_LEVEL_MEDIUM 0x02 #endif #ifndef BATTERY_LEVEL_FULL #define BATTERY_LEVEL_FULL 0x03 #endif /* typedef's for XInput structs we use */ #ifndef HAVE_XINPUT_GAMEPAD_EX typedef struct { WORD wButtons; BYTE bLeftTrigger; BYTE bRightTrigger; SHORT sThumbLX; SHORT sThumbLY; SHORT sThumbRX; SHORT sThumbRY; DWORD dwPaddingReserved; } XINPUT_GAMEPAD_EX; #endif #ifndef HAVE_XINPUT_STATE_EX typedef struct { DWORD dwPacketNumber; XINPUT_GAMEPAD_EX Gamepad; } XINPUT_STATE_EX; #endif typedef struct { BYTE BatteryType; BYTE BatteryLevel; } XINPUT_BATTERY_INFORMATION_EX; /* Forward decl's for XInput API's we load dynamically and use if available */ typedef DWORD (WINAPI *XInputGetState_t) ( DWORD dwUserIndex, /* [in] Index of the gamer associated with the device */ XINPUT_STATE_EX* pState /* [out] Receives the current state */ ); typedef DWORD (WINAPI *XInputSetState_t) ( DWORD dwUserIndex, /* [in] Index of the gamer associated with the device */ XINPUT_VIBRATION* pVibration /* [in, out] The vibration information to send to the controller */ ); typedef DWORD (WINAPI *XInputGetCapabilities_t) ( DWORD dwUserIndex, /* [in] Index of the gamer associated with the device */ DWORD dwFlags, /* [in] Input flags that identify the device type */ XINPUT_CAPABILITIES* pCapabilities /* [out] Receives the capabilities */ ); typedef DWORD (WINAPI *XInputGetBatteryInformation_t) ( DWORD dwUserIndex, BYTE devType, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation ); extern int WIN_LoadXInputDLL(void); extern void WIN_UnloadXInputDLL(void); extern XInputGetState_t SDL_XInputGetState; extern XInputSetState_t SDL_XInputSetState; extern XInputGetCapabilities_t SDL_XInputGetCapabilities; extern XInputGetBatteryInformation_t SDL_XInputGetBatteryInformation; extern DWORD SDL_XInputVersion; /* ((major << 16) & 0xFF00) | (minor & 0xFF) */ #define XINPUTGETSTATE SDL_XInputGetState #define XINPUTSETSTATE SDL_XInputSetState #define XINPUTGETCAPABILITIES SDL_XInputGetCapabilities #define XINPUTGETBATTERYINFORMATION SDL_XInputGetBatteryInformation #endif /* HAVE_XINPUT_H */ #endif /* SDL_xinput_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/windows/SDL_xinput.h
C
apache-2.0
5,171
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #include "SDL_main.h" #include "SDL_system.h" #include "SDL_winrtapp_direct3d.h" #include "SDL_winrtapp_xaml.h" #include <wrl.h> int (*WINRT_SDLAppEntryPoint)(int, char **) = NULL; extern "C" DECLSPEC int SDL_WinRTRunApp(SDL_main_func mainFunction, void * xamlBackgroundPanel) { if (xamlBackgroundPanel) { return SDL_WinRTInitXAMLApp(mainFunction, xamlBackgroundPanel); } else { if (FAILED(Windows::Foundation::Initialize(RO_INIT_MULTITHREADED))) { return 1; } return SDL_WinRTInitNonXAMLApp(mainFunction); } } extern "C" DECLSPEC SDL_WinRT_DeviceFamily SDL_WinRTGetDeviceFamily() { #if NTDDI_VERSION >= NTDDI_WIN10 /* !!! FIXME: I have no idea if this is the right test. This is a UWP API, I think. Older windows should...just return "mobile"? I don't know. --ryan. */ Platform::String^ deviceFamily = Windows::System::Profile::AnalyticsInfo::VersionInfo->DeviceFamily; if (deviceFamily->Equals("Windows.Desktop")) { return SDL_WINRT_DEVICEFAMILY_DESKTOP; } else if (deviceFamily->Equals("Windows.Mobile")) { return SDL_WINRT_DEVICEFAMILY_MOBILE; } else if (deviceFamily->Equals("Windows.Xbox")) { return SDL_WINRT_DEVICEFAMILY_XBOX; } #endif return SDL_WINRT_DEVICEFAMILY_UNKNOWN; }
YifuLiu/AliOS-Things
components/SDL2/src/core/winrt/SDL_winrtapp_common.cpp
C++
apache-2.0
2,289
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "SDL_config.h" #ifndef SDL_winrtapp_common_h_ #define SDL_winrtapp_common_h_ /* A pointer to the app's C-style main() function (which is a different function than the WinRT app's actual entry point). */ extern int (*WINRT_SDLAppEntryPoint)(int, char **); #endif // SDL_winrtapp_common_h_
YifuLiu/AliOS-Things
components/SDL2/src/core/winrt/SDL_winrtapp_common.h
C
apache-2.0
1,243
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" /* Standard C++11 includes */ #include <functional> #include <string> #include <sstream> using namespace std; /* Windows includes */ #include "ppltasks.h" using namespace concurrency; using namespace Windows::ApplicationModel; using namespace Windows::ApplicationModel::Core; using namespace Windows::ApplicationModel::Activation; using namespace Windows::Devices::Input; using namespace Windows::Graphics::Display; using namespace Windows::Foundation; using namespace Windows::System; using namespace Windows::UI::Core; using namespace Windows::UI::Input; #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP using namespace Windows::Phone::UI::Input; #endif /* SDL includes */ extern "C" { #include "SDL_assert.h" #include "SDL_events.h" #include "SDL_hints.h" #include "SDL_main.h" #include "SDL_stdinc.h" #include "SDL_render.h" #include "../../video/SDL_sysvideo.h" //#include "../../SDL_hints_c.h" #include "../../events/SDL_events_c.h" #include "../../events/SDL_keyboard_c.h" #include "../../events/SDL_mouse_c.h" #include "../../events/SDL_windowevents_c.h" #include "../../render/SDL_sysrender.h" #include "../windows/SDL_windows.h" } #include "../../video/winrt/SDL_winrtevents_c.h" #include "../../video/winrt/SDL_winrtvideo_cpp.h" #include "SDL_winrtapp_common.h" #include "SDL_winrtapp_direct3d.h" #if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED /* Calling IDXGIDevice3::Trim on the active Direct3D 11.x device is necessary * when Windows 8.1 apps are about to get suspended. */ extern "C" void D3D11_Trim(SDL_Renderer *); #endif // Compile-time debugging options: // To enable, uncomment; to disable, comment them out. //#define LOG_POINTER_EVENTS 1 //#define LOG_WINDOW_EVENTS 1 //#define LOG_ORIENTATION_EVENTS 1 // HACK, DLudwig: record a reference to the global, WinRT 'app'/view. // SDL/WinRT will use this throughout its code. // // TODO, WinRT: consider replacing SDL_WinRTGlobalApp with something // non-global, such as something created inside // SDL_InitSubSystem(SDL_INIT_VIDEO), or something inside // SDL_CreateWindow(). SDL_WinRTApp ^ SDL_WinRTGlobalApp = nullptr; ref class SDLApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource { public: virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView(); }; IFrameworkView^ SDLApplicationSource::CreateView() { // TODO, WinRT: see if this function (CreateView) can ever get called // more than once. For now, just prevent it from ever assigning // SDL_WinRTGlobalApp more than once. SDL_assert(!SDL_WinRTGlobalApp); SDL_WinRTApp ^ app = ref new SDL_WinRTApp(); if (!SDL_WinRTGlobalApp) { SDL_WinRTGlobalApp = app; } return app; } int SDL_WinRTInitNonXAMLApp(int (*mainFunction)(int, char **)) { WINRT_SDLAppEntryPoint = mainFunction; auto direct3DApplicationSource = ref new SDLApplicationSource(); CoreApplication::Run(direct3DApplicationSource); return 0; } static void SDLCALL WINRT_SetDisplayOrientationsPreference(void *userdata, const char *name, const char *oldValue, const char *newValue) { SDL_assert(SDL_strcmp(name, SDL_HINT_ORIENTATIONS) == 0); /* HACK: prevent SDL from altering an app's .appxmanifest-set orientation * from being changed on startup, by detecting when SDL_HINT_ORIENTATIONS * is getting registered. * * TODO, WinRT: consider reading in an app's .appxmanifest file, and apply its orientation when 'newValue == NULL'. */ if ((oldValue == NULL) && (newValue == NULL)) { return; } // Start with no orientation flags, then add each in as they're parsed // from newValue. unsigned int orientationFlags = 0; if (newValue) { std::istringstream tokenizer(newValue); while (!tokenizer.eof()) { std::string orientationName; std::getline(tokenizer, orientationName, ' '); if (orientationName == "LandscapeLeft") { orientationFlags |= (unsigned int) DisplayOrientations::LandscapeFlipped; } else if (orientationName == "LandscapeRight") { orientationFlags |= (unsigned int) DisplayOrientations::Landscape; } else if (orientationName == "Portrait") { orientationFlags |= (unsigned int) DisplayOrientations::Portrait; } else if (orientationName == "PortraitUpsideDown") { orientationFlags |= (unsigned int) DisplayOrientations::PortraitFlipped; } } } // If no valid orientation flags were specified, use a reasonable set of defaults: if (!orientationFlags) { // TODO, WinRT: consider seeing if an app's default orientation flags can be found out via some API call(s). orientationFlags = (unsigned int) ( \ DisplayOrientations::Landscape | DisplayOrientations::LandscapeFlipped | DisplayOrientations::Portrait | DisplayOrientations::PortraitFlipped); } // Set the orientation/rotation preferences. Please note that this does // not constitute a 100%-certain lock of a given set of possible // orientations. According to Microsoft's documentation on WinRT [1] // when a device is not capable of being rotated, Windows may ignore // the orientation preferences, and stick to what the device is capable of // displaying. // // [1] Documentation on the 'InitialRotationPreference' setting for a // Windows app's manifest file describes how some orientation/rotation // preferences may be ignored. See // http://msdn.microsoft.com/en-us/library/windows/apps/hh700343.aspx // for details. Microsoft's "Display orientation sample" also gives an // outline of how Windows treats device rotation // (http://code.msdn.microsoft.com/Display-Orientation-Sample-19a58e93). WINRT_DISPLAY_PROPERTY(AutoRotationPreferences) = (DisplayOrientations) orientationFlags; } static void WINRT_ProcessWindowSizeChange() // TODO: Pass an SDL_Window-identifying thing into WINRT_ProcessWindowSizeChange() { CoreWindow ^ coreWindow = CoreWindow::GetForCurrentThread(); if (coreWindow) { if (WINRT_GlobalSDLWindow) { SDL_Window * window = WINRT_GlobalSDLWindow; SDL_WindowData * data = (SDL_WindowData *) window->driverdata; int x = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Left); int y = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Top); int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width); int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height); #if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION == NTDDI_WIN8) /* WinPhone 8.0 always keeps its native window size in portrait, regardless of orientation. This changes in WinPhone 8.1, in which the native window's size changes along with orientation. Attempt to emulate WinPhone 8.1's behavior on WinPhone 8.0, with regards to window size. This fixes a rendering bug that occurs when a WinPhone 8.0 app is rotated to either 90 or 270 degrees. */ const DisplayOrientations currentOrientation = WINRT_DISPLAY_PROPERTY(CurrentOrientation); switch (currentOrientation) { case DisplayOrientations::Landscape: case DisplayOrientations::LandscapeFlipped: { int tmp = w; w = h; h = tmp; } break; } #endif const Uint32 latestFlags = WINRT_DetectWindowFlags(window); if (latestFlags & SDL_WINDOW_MAXIMIZED) { SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0); } else { SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0); } WINRT_UpdateWindowFlags(window, SDL_WINDOW_FULLSCREEN_DESKTOP); /* The window can move during a resize event, such as when maximizing or resizing from a corner */ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y); SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h); } } } SDL_WinRTApp::SDL_WinRTApp() : m_windowClosed(false), m_windowVisible(true) { } void SDL_WinRTApp::Initialize(CoreApplicationView^ applicationView) { applicationView->Activated += ref new TypedEventHandler<CoreApplicationView^, IActivatedEventArgs^>(this, &SDL_WinRTApp::OnAppActivated); CoreApplication::Suspending += ref new EventHandler<SuspendingEventArgs^>(this, &SDL_WinRTApp::OnSuspending); CoreApplication::Resuming += ref new EventHandler<Platform::Object^>(this, &SDL_WinRTApp::OnResuming); CoreApplication::Exiting += ref new EventHandler<Platform::Object^>(this, &SDL_WinRTApp::OnExiting); #if NTDDI_VERSION >= NTDDI_WIN10 /* HACK ALERT! Xbox One doesn't seem to detect gamepads unless something gets registered to receive Win10's Windows.Gaming.Input.Gamepad.GamepadAdded events. We'll register an event handler for these events here, to make sure that gamepad detection works later on, if requested. */ Windows::Gaming::Input::Gamepad::GamepadAdded += ref new Windows::Foundation::EventHandler<Windows::Gaming::Input::Gamepad^>( this, &SDL_WinRTApp::OnGamepadAdded ); #endif } #if NTDDI_VERSION > NTDDI_WIN8 void SDL_WinRTApp::OnOrientationChanged(DisplayInformation^ sender, Object^ args) #else void SDL_WinRTApp::OnOrientationChanged(Object^ sender) #endif { #if LOG_ORIENTATION_EVENTS==1 { CoreWindow^ window = CoreWindow::GetForCurrentThread(); if (window) { SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d, CoreWindow Bounds={%f,%f,%f,%f}\n", __FUNCTION__, WINRT_DISPLAY_PROPERTY(CurrentOrientation), WINRT_DISPLAY_PROPERTY(NativeOrientation), WINRT_DISPLAY_PROPERTY(AutoRotationPreferences), window->Bounds.X, window->Bounds.Y, window->Bounds.Width, window->Bounds.Height); } else { SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d\n", __FUNCTION__, WINRT_DISPLAY_PROPERTY(CurrentOrientation), WINRT_DISPLAY_PROPERTY(NativeOrientation), WINRT_DISPLAY_PROPERTY(AutoRotationPreferences)); } } #endif WINRT_ProcessWindowSizeChange(); #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP // HACK: Make sure that orientation changes // lead to the Direct3D renderer's viewport getting updated: // // For some reason, this doesn't seem to need to be done on Windows 8.x, // even when going from Landscape to LandscapeFlipped. It only seems to // be needed on Windows Phone, at least when I tested on my devices. // I'm not currently sure why this is, but it seems to work fine. -- David L. // // TODO, WinRT: do more extensive research into why orientation changes on Win 8.x don't need D3D changes, or if they might, in some cases SDL_Window * window = WINRT_GlobalSDLWindow; if (window) { SDL_WindowData * data = (SDL_WindowData *)window->driverdata; int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width); int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height); SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_SIZE_CHANGED, w, h); } #endif } void SDL_WinRTApp::SetWindow(CoreWindow^ window) { #if LOG_WINDOW_EVENTS==1 SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d, window bounds={%f, %f, %f,%f}\n", __FUNCTION__, WINRT_DISPLAY_PROPERTY(CurrentOrientation), WINRT_DISPLAY_PROPERTY(NativeOrientation), WINRT_DISPLAY_PROPERTY(AutoRotationPreferences), window->Bounds.X, window->Bounds.Y, window->Bounds.Width, window->Bounds.Height); #endif window->SizeChanged += ref new TypedEventHandler<CoreWindow^, WindowSizeChangedEventArgs^>(this, &SDL_WinRTApp::OnWindowSizeChanged); window->VisibilityChanged += ref new TypedEventHandler<CoreWindow^, VisibilityChangedEventArgs^>(this, &SDL_WinRTApp::OnVisibilityChanged); window->Activated += ref new TypedEventHandler<CoreWindow^, WindowActivatedEventArgs^>(this, &SDL_WinRTApp::OnWindowActivated); window->Closed += ref new TypedEventHandler<CoreWindow^, CoreWindowEventArgs^>(this, &SDL_WinRTApp::OnWindowClosed); #if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP window->PointerCursor = ref new CoreCursor(CoreCursorType::Arrow, 0); #endif window->PointerPressed += ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerPressed); window->PointerMoved += ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerMoved); window->PointerReleased += ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerReleased); window->PointerEntered += ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerEntered); window->PointerExited += ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerExited); window->PointerWheelChanged += ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerWheelChanged); #if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP // Retrieves relative-only mouse movements: Windows::Devices::Input::MouseDevice::GetForCurrentView()->MouseMoved += ref new TypedEventHandler<MouseDevice^, MouseEventArgs^>(this, &SDL_WinRTApp::OnMouseMoved); #endif window->KeyDown += ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &SDL_WinRTApp::OnKeyDown); window->KeyUp += ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &SDL_WinRTApp::OnKeyUp); window->CharacterReceived += ref new TypedEventHandler<CoreWindow^, CharacterReceivedEventArgs^>(this, &SDL_WinRTApp::OnCharacterReceived); #if NTDDI_VERSION >= NTDDI_WIN10 Windows::UI::Core::SystemNavigationManager::GetForCurrentView()->BackRequested += ref new EventHandler<BackRequestedEventArgs^>(this, &SDL_WinRTApp::OnBackButtonPressed); #elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP HardwareButtons::BackPressed += ref new EventHandler<BackPressedEventArgs^>(this, &SDL_WinRTApp::OnBackButtonPressed); #endif #if NTDDI_VERSION > NTDDI_WIN8 DisplayInformation::GetForCurrentView()->OrientationChanged += ref new TypedEventHandler<Windows::Graphics::Display::DisplayInformation^, Object^>(this, &SDL_WinRTApp::OnOrientationChanged); #else DisplayProperties::OrientationChanged += ref new DisplayPropertiesEventHandler(this, &SDL_WinRTApp::OnOrientationChanged); #endif // Register the hint, SDL_HINT_ORIENTATIONS, with SDL. // TODO, WinRT: see if an app's default orientation can be found out via WinRT API(s), then set the initial value of SDL_HINT_ORIENTATIONS accordingly. SDL_AddHintCallback(SDL_HINT_ORIENTATIONS, WINRT_SetDisplayOrientationsPreference, NULL); #if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10) // for Windows 8/8.1/RT apps... (and not Phone apps) // Make sure we know when a user has opened the app's settings pane. // This is needed in order to display a privacy policy, which needs // to be done for network-enabled apps, as per Windows Store requirements. using namespace Windows::UI::ApplicationSettings; SettingsPane::GetForCurrentView()->CommandsRequested += ref new TypedEventHandler<SettingsPane^, SettingsPaneCommandsRequestedEventArgs^> (this, &SDL_WinRTApp::OnSettingsPaneCommandsRequested); #endif } void SDL_WinRTApp::Load(Platform::String^ entryPoint) { } void SDL_WinRTApp::Run() { SDL_SetMainReady(); if (WINRT_SDLAppEntryPoint) { // TODO, WinRT: pass the C-style main() a reasonably realistic // representation of command line arguments. int argc = 0; char **argv = NULL; WINRT_SDLAppEntryPoint(argc, argv); } } static bool IsSDLWindowEventPending(SDL_WindowEventID windowEventID) { SDL_Event events[128]; const int count = SDL_PeepEvents(events, sizeof(events)/sizeof(SDL_Event), SDL_PEEKEVENT, SDL_WINDOWEVENT, SDL_WINDOWEVENT); for (int i = 0; i < count; ++i) { if (events[i].window.event == windowEventID) { return true; } } return false; } bool SDL_WinRTApp::ShouldWaitForAppResumeEvents() { /* Don't wait if the app is visible: */ if (m_windowVisible) { return false; } /* Don't wait until the window-hide events finish processing. * Do note that if an app-suspend event is sent (as indicated * by SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERBACKGROUND * events), then this code may be a moot point, as WinRT's * own event pump (aka ProcessEvents()) will pause regardless * of what we do here. This happens on Windows Phone 8, to note. * Windows 8.x apps, on the other hand, may get a chance to run * these. */ if (IsSDLWindowEventPending(SDL_WINDOWEVENT_HIDDEN)) { return false; } else if (IsSDLWindowEventPending(SDL_WINDOWEVENT_FOCUS_LOST)) { return false; } else if (IsSDLWindowEventPending(SDL_WINDOWEVENT_MINIMIZED)) { return false; } return true; } void SDL_WinRTApp::PumpEvents() { if (!m_windowClosed) { if (!ShouldWaitForAppResumeEvents()) { /* This is the normal way in which events should be pumped. * 'ProcessAllIfPresent' will make ProcessEvents() process anywhere * from zero to N events, and will then return. */ CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); } else { /* This style of event-pumping, with 'ProcessOneAndAllPending', * will cause anywhere from one to N events to be processed. If * at least one event is processed, the call will return. If * no events are pending, then the call will wait until one is * available, and will not return (to the caller) until this * happens! This should only occur when the app is hidden. */ CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending); } } } void SDL_WinRTApp::Uninitialize() { } #if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10) void SDL_WinRTApp::OnSettingsPaneCommandsRequested( Windows::UI::ApplicationSettings::SettingsPane ^p, Windows::UI::ApplicationSettings::SettingsPaneCommandsRequestedEventArgs ^args) { using namespace Platform; using namespace Windows::UI::ApplicationSettings; using namespace Windows::UI::Popups; String ^privacyPolicyURL = nullptr; // a URL to an app's Privacy Policy String ^privacyPolicyLabel = nullptr; // label/link text const char *tmpHintValue = NULL; // SDL_GetHint-retrieved value, used immediately wchar_t *tmpStr = NULL; // used for UTF8 to UCS2 conversion // Setup a 'Privacy Policy' link, if one is available (via SDL_GetHint): tmpHintValue = SDL_GetHint(SDL_HINT_WINRT_PRIVACY_POLICY_URL); if (tmpHintValue && tmpHintValue[0] != '\0') { // Convert the privacy policy's URL to UCS2: tmpStr = WIN_UTF8ToString(tmpHintValue); privacyPolicyURL = ref new String(tmpStr); SDL_free(tmpStr); // Optionally retrieve custom label-text for the link. If this isn't // available, a default value will be used instead. tmpHintValue = SDL_GetHint(SDL_HINT_WINRT_PRIVACY_POLICY_LABEL); if (tmpHintValue && tmpHintValue[0] != '\0') { tmpStr = WIN_UTF8ToString(tmpHintValue); privacyPolicyLabel = ref new String(tmpStr); SDL_free(tmpStr); } else { privacyPolicyLabel = ref new String(L"Privacy Policy"); } // Register the link, along with a handler to be called if and when it is // clicked: auto cmd = ref new SettingsCommand(L"privacyPolicy", privacyPolicyLabel, ref new UICommandInvokedHandler([=](IUICommand ^) { Windows::System::Launcher::LaunchUriAsync(ref new Uri(privacyPolicyURL)); })); args->Request->ApplicationCommands->Append(cmd); } } #endif // if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10) void SDL_WinRTApp::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args) { #if LOG_WINDOW_EVENTS==1 SDL_Log("%s, size={%f,%f}, bounds={%f,%f,%f,%f}, current orientation=%d, native orientation=%d, auto rot. pref=%d, WINRT_GlobalSDLWindow?=%s\n", __FUNCTION__, args->Size.Width, args->Size.Height, sender->Bounds.X, sender->Bounds.Y, sender->Bounds.Width, sender->Bounds.Height, WINRT_DISPLAY_PROPERTY(CurrentOrientation), WINRT_DISPLAY_PROPERTY(NativeOrientation), WINRT_DISPLAY_PROPERTY(AutoRotationPreferences), (WINRT_GlobalSDLWindow ? "yes" : "no")); #endif WINRT_ProcessWindowSizeChange(); } void SDL_WinRTApp::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args) { #if LOG_WINDOW_EVENTS==1 SDL_Log("%s, visible?=%s, bounds={%f,%f,%f,%f}, WINRT_GlobalSDLWindow?=%s\n", __FUNCTION__, (args->Visible ? "yes" : "no"), sender->Bounds.X, sender->Bounds.Y, sender->Bounds.Width, sender->Bounds.Height, (WINRT_GlobalSDLWindow ? "yes" : "no")); #endif m_windowVisible = args->Visible; if (WINRT_GlobalSDLWindow) { SDL_bool wasSDLWindowSurfaceValid = WINRT_GlobalSDLWindow->surface_valid; Uint32 latestWindowFlags = WINRT_DetectWindowFlags(WINRT_GlobalSDLWindow); if (args->Visible) { SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_SHOWN, 0, 0); SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); if (latestWindowFlags & SDL_WINDOW_MAXIMIZED) { SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_MAXIMIZED, 0, 0); } else { SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_RESTORED, 0, 0); } } else { SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_HIDDEN, 0, 0); SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_MINIMIZED, 0, 0); } // HACK: Prevent SDL's window-hide handling code, which currently // triggers a fake window resize (possibly erronously), from // marking the SDL window's surface as invalid. // // A better solution to this probably involves figuring out if the // fake window resize can be prevented. WINRT_GlobalSDLWindow->surface_valid = wasSDLWindowSurfaceValid; } } void SDL_WinRTApp::OnWindowActivated(CoreWindow^ sender, WindowActivatedEventArgs^ args) { #if LOG_WINDOW_EVENTS==1 SDL_Log("%s, WINRT_GlobalSDLWindow?=%s\n\n", __FUNCTION__, (WINRT_GlobalSDLWindow ? "yes" : "no")); #endif /* There's no property in Win 8.x to tell whether a window is active or not. [De]activation events are, however, sent to the app. We'll just record those, in case the CoreWindow gets wrapped by an SDL_Window at some future time. */ sender->CustomProperties->Insert("SDLHelperWindowActivationState", args->WindowActivationState); SDL_Window * window = WINRT_GlobalSDLWindow; if (window) { if (args->WindowActivationState != CoreWindowActivationState::Deactivated) { SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SHOWN, 0, 0); if (SDL_GetKeyboardFocus() != window) { SDL_SetKeyboardFocus(window); } /* Send a mouse-motion event as appropriate. This doesn't work when called from OnPointerEntered, at least not in WinRT CoreWindow apps (as OnPointerEntered doesn't appear to be called after window-reactivation, at least not in Windows 10, Build 10586.3 (November 2015 update, non-beta). Don't do it on WinPhone 8.0 though, as CoreWindow's 'PointerPosition' property isn't available. */ #if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION >= NTDDI_WINBLUE) Point cursorPos = WINRT_TransformCursorPosition(window, sender->PointerPosition, TransformToSDLWindowSize); SDL_SendMouseMotion(window, 0, 0, (int)cursorPos.X, (int)cursorPos.Y); #endif /* TODO, WinRT: see if the Win32 bugfix from https://hg.libsdl.org/SDL/rev/d278747da408 needs to be applied (on window activation) */ //WIN_CheckAsyncMouseRelease(data); /* TODO, WinRT: implement clipboard support, if possible */ ///* // * FIXME: Update keyboard state // */ //WIN_CheckClipboardUpdate(data->videodata); // HACK: Resetting the mouse-cursor here seems to fix // https://bugzilla.libsdl.org/show_bug.cgi?id=3217, whereby a // WinRT app's mouse cursor may switch to Windows' 'wait' cursor, // after a user alt-tabs back into a full-screened SDL app. // This bug does not appear to reproduce 100% of the time. // It may be a bug in Windows itself (v.10.0.586.36, as tested, // and the most-recent as of this writing). SDL_SetCursor(NULL); } else { if (SDL_GetKeyboardFocus() == window) { SDL_SetKeyboardFocus(NULL); } } } } void SDL_WinRTApp::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args) { #if LOG_WINDOW_EVENTS==1 SDL_Log("%s\n", __FUNCTION__); #endif m_windowClosed = true; } void SDL_WinRTApp::OnAppActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args) { CoreWindow::GetForCurrentThread()->Activate(); } void SDL_WinRTApp::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args) { // Save app state asynchronously after requesting a deferral. Holding a deferral // indicates that the application is busy performing suspending operations. Be // aware that a deferral may not be held indefinitely. After about five seconds, // the app will be forced to exit. // ... but first, let the app know it's about to go to the background. // The separation of events may be important, given that the deferral // runs in a separate thread. This'll make SDL_APP_WILLENTERBACKGROUND // the only event among the two that runs in the main thread. Given // that a few WinRT operations can only be done from the main thread // (things that access the WinRT CoreWindow are one example of this), // this could be important. SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND); SuspendingDeferral^ deferral = args->SuspendingOperation->GetDeferral(); create_task([this, deferral]() { // Send an app did-enter-background event immediately to observers. // CoreDispatcher::ProcessEvents, which is the backbone on which // SDL_WinRTApp::PumpEvents is built, will not return to its caller // once it sends out a suspend event. Any events posted to SDL's // event queue won't get received until the WinRT app is resumed. // SDL_AddEventWatch() may be used to receive app-suspend events on // WinRT. SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND); // Let the Direct3D 11 renderer prepare for the app to be backgrounded. // This is necessary for Windows 8.1, possibly elsewhere in the future. // More details at: http://msdn.microsoft.com/en-us/library/windows/apps/Hh994929.aspx #if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED if (WINRT_GlobalSDLWindow) { SDL_Renderer * renderer = SDL_GetRenderer(WINRT_GlobalSDLWindow); if (renderer && (SDL_strcmp(renderer->info.name, "direct3d11") == 0)) { D3D11_Trim(renderer); } } #endif deferral->Complete(); }); } void SDL_WinRTApp::OnResuming(Platform::Object^ sender, Platform::Object^ args) { // Restore any data or state that was unloaded on suspend. By default, data // and state are persisted when resuming from suspend. Note that these events // do not occur if the app was previously terminated. SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND); SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND); } void SDL_WinRTApp::OnExiting(Platform::Object^ sender, Platform::Object^ args) { SDL_SendAppEvent(SDL_APP_TERMINATING); } static void WINRT_LogPointerEvent(const char * header, Windows::UI::Core::PointerEventArgs ^ args, Windows::Foundation::Point transformedPoint) { Windows::UI::Input::PointerPoint ^ pt = args->CurrentPoint; SDL_Log("%s: Position={%f,%f}, Transformed Pos={%f, %f}, MouseWheelDelta=%d, FrameId=%d, PointerId=%d, SDL button=%d\n", header, pt->Position.X, pt->Position.Y, transformedPoint.X, transformedPoint.Y, pt->Properties->MouseWheelDelta, pt->FrameId, pt->PointerId, WINRT_GetSDLButtonForPointerPoint(pt)); } void SDL_WinRTApp::OnPointerPressed(CoreWindow^ sender, PointerEventArgs^ args) { #if LOG_POINTER_EVENTS WINRT_LogPointerEvent("pointer pressed", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize)); #endif WINRT_ProcessPointerPressedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint); } void SDL_WinRTApp::OnPointerMoved(CoreWindow^ sender, PointerEventArgs^ args) { #if LOG_POINTER_EVENTS WINRT_LogPointerEvent("pointer moved", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize)); #endif WINRT_ProcessPointerMovedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint); } void SDL_WinRTApp::OnPointerReleased(CoreWindow^ sender, PointerEventArgs^ args) { #if LOG_POINTER_EVENTS WINRT_LogPointerEvent("pointer released", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize)); #endif WINRT_ProcessPointerReleasedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint); } void SDL_WinRTApp::OnPointerEntered(CoreWindow^ sender, PointerEventArgs^ args) { #if LOG_POINTER_EVENTS WINRT_LogPointerEvent("pointer entered", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize)); #endif WINRT_ProcessPointerEnteredEvent(WINRT_GlobalSDLWindow, args->CurrentPoint); } void SDL_WinRTApp::OnPointerExited(CoreWindow^ sender, PointerEventArgs^ args) { #if LOG_POINTER_EVENTS WINRT_LogPointerEvent("pointer exited", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize)); #endif WINRT_ProcessPointerExitedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint); } void SDL_WinRTApp::OnPointerWheelChanged(CoreWindow^ sender, PointerEventArgs^ args) { #if LOG_POINTER_EVENTS WINRT_LogPointerEvent("pointer wheel changed", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize)); #endif WINRT_ProcessPointerWheelChangedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint); } void SDL_WinRTApp::OnMouseMoved(MouseDevice^ mouseDevice, MouseEventArgs^ args) { WINRT_ProcessMouseMovedEvent(WINRT_GlobalSDLWindow, args); } void SDL_WinRTApp::OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args) { WINRT_ProcessKeyDownEvent(args); } void SDL_WinRTApp::OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args) { WINRT_ProcessKeyUpEvent(args); } void SDL_WinRTApp::OnCharacterReceived(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CharacterReceivedEventArgs^ args) { WINRT_ProcessCharacterReceivedEvent(args); } template <typename BackButtonEventArgs> static void WINRT_OnBackButtonPressed(BackButtonEventArgs ^ args) { SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_AC_BACK); SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_AC_BACK); if (SDL_GetHintBoolean(SDL_HINT_WINRT_HANDLE_BACK_BUTTON, SDL_FALSE)) { args->Handled = true; } } #if NTDDI_VERSION >= NTDDI_WIN10 void SDL_WinRTApp::OnBackButtonPressed(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs^ args) { WINRT_OnBackButtonPressed(args); } #elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP void SDL_WinRTApp::OnBackButtonPressed(Platform::Object^ sender, Windows::Phone::UI::Input::BackPressedEventArgs^ args) { WINRT_OnBackButtonPressed(args); } #endif #if NTDDI_VERSION >= NTDDI_WIN10 void SDL_WinRTApp::OnGamepadAdded(Platform::Object ^sender, Windows::Gaming::Input::Gamepad ^gamepad) { /* HACK ALERT: Nothing needs to be done here, as this method currently only exists to allow something to be registered with Win10's GamepadAdded event, an operation that seems to be necessary to get Xinput-based detection to work on Xbox One. */ } #endif /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/core/winrt/SDL_winrtapp_direct3d.cpp
C++
apache-2.0
34,995
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include <Windows.h> extern int SDL_WinRTInitNonXAMLApp(int (*mainFunction)(int, char **)); ref class SDL_WinRTApp sealed : public Windows::ApplicationModel::Core::IFrameworkView { public: SDL_WinRTApp(); // IFrameworkView Methods. virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView); virtual void SetWindow(Windows::UI::Core::CoreWindow^ window); virtual void Load(Platform::String^ entryPoint); virtual void Run(); virtual void Uninitialize(); internal: // SDL-specific methods void PumpEvents(); protected: bool ShouldWaitForAppResumeEvents(); // Event Handlers. #if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10) // for Windows 8/8.1/RT apps... (and not Phone apps) void OnSettingsPaneCommandsRequested( Windows::UI::ApplicationSettings::SettingsPane ^p, Windows::UI::ApplicationSettings::SettingsPaneCommandsRequestedEventArgs ^args); #endif // if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10) #if NTDDI_VERSION > NTDDI_WIN8 void OnOrientationChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args); #else void OnOrientationChanged(Platform::Object^ sender); #endif void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args); void OnLogicalDpiChanged(Platform::Object^ sender); void OnAppActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args); void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args); void OnResuming(Platform::Object^ sender, Platform::Object^ args); void OnExiting(Platform::Object^ sender, Platform::Object^ args); void OnWindowActivated(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowActivatedEventArgs^ args); void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args); void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args); void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); void OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); void OnPointerWheelChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); void OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); void OnPointerEntered(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); void OnPointerExited(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); void OnMouseMoved(Windows::Devices::Input::MouseDevice^ mouseDevice, Windows::Devices::Input::MouseEventArgs^ args); void OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args); void OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args); void OnCharacterReceived(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CharacterReceivedEventArgs^ args); #if NTDDI_VERSION >= NTDDI_WIN10 void OnBackButtonPressed(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs^ args); #elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP void OnBackButtonPressed(Platform::Object^ sender, Windows::Phone::UI::Input::BackPressedEventArgs^ args); #endif #if NTDDI_VERSION >= NTDDI_WIN10 void OnGamepadAdded(Platform::Object ^sender, Windows::Gaming::Input::Gamepad ^gamepad); #endif private: bool m_windowClosed; bool m_windowVisible; }; extern SDL_WinRTApp ^ SDL_WinRTGlobalApp;
YifuLiu/AliOS-Things
components/SDL2/src/core/winrt/SDL_winrtapp_direct3d.h
C++
apache-2.0
4,790
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* Windows includes */ #include <agile.h> #include <Windows.h> #if WINAPI_FAMILY == WINAPI_FAMILY_APP #include <windows.ui.xaml.media.dxinterop.h> #endif /* SDL includes */ #include "../../SDL_internal.h" #include "SDL.h" #include "../../video/winrt/SDL_winrtevents_c.h" #include "../../video/winrt/SDL_winrtvideo_cpp.h" #include "SDL_winrtapp_common.h" #include "SDL_winrtapp_xaml.h" /* SDL-internal globals: */ SDL_bool WINRT_XAMLWasEnabled = SDL_FALSE; #if WINAPI_FAMILY == WINAPI_FAMILY_APP extern "C" ISwapChainBackgroundPanelNative * WINRT_GlobalSwapChainBackgroundPanelNative = NULL; static Windows::Foundation::EventRegistrationToken WINRT_XAMLAppEventToken; #endif /* * Input event handlers (XAML) */ #if WINAPI_FAMILY == WINAPI_FAMILY_APP static void WINRT_OnPointerPressedViaXAML(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ args) { WINRT_ProcessPointerPressedEvent(WINRT_GlobalSDLWindow, args->GetCurrentPoint(nullptr)); } static void WINRT_OnPointerMovedViaXAML(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ args) { WINRT_ProcessPointerMovedEvent(WINRT_GlobalSDLWindow, args->GetCurrentPoint(nullptr)); } static void WINRT_OnPointerReleasedViaXAML(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ args) { WINRT_ProcessPointerReleasedEvent(WINRT_GlobalSDLWindow, args->GetCurrentPoint(nullptr)); } static void WINRT_OnPointerWheelChangedViaXAML(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ args) { WINRT_ProcessPointerWheelChangedEvent(WINRT_GlobalSDLWindow, args->GetCurrentPoint(nullptr)); } #endif // WINAPI_FAMILY == WINAPI_FAMILY_APP /* * XAML-to-SDL Rendering Callback */ #if WINAPI_FAMILY == WINAPI_FAMILY_APP static void WINRT_OnRenderViaXAML(_In_ Platform::Object^ sender, _In_ Platform::Object^ args) { WINRT_CycleXAMLThread(); } #endif // WINAPI_FAMILY == WINAPI_FAMILY_APP /* * SDL + XAML Initialization */ int SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void * backgroundPanelAsIInspectable) { #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP return SDL_SetError("XAML support is not yet available in Windows Phone."); #else // Declare C++/CX namespaces: using namespace Platform; using namespace Windows::Foundation; using namespace Windows::UI::Core; using namespace Windows::UI::Xaml; using namespace Windows::UI::Xaml::Controls; using namespace Windows::UI::Xaml::Input; using namespace Windows::UI::Xaml::Media; // Make sure we have a valid XAML element (to draw onto): if ( ! backgroundPanelAsIInspectable) { return SDL_SetError("'backgroundPanelAsIInspectable' can't be NULL"); } Platform::Object ^ backgroundPanel = reinterpret_cast<Object ^>((IInspectable *) backgroundPanelAsIInspectable); SwapChainBackgroundPanel ^swapChainBackgroundPanel = dynamic_cast<SwapChainBackgroundPanel ^>(backgroundPanel); if ( ! swapChainBackgroundPanel) { return SDL_SetError("An unknown or unsupported type of XAML control was specified."); } // Setup event handlers: swapChainBackgroundPanel->PointerPressed += ref new PointerEventHandler(WINRT_OnPointerPressedViaXAML); swapChainBackgroundPanel->PointerReleased += ref new PointerEventHandler(WINRT_OnPointerReleasedViaXAML); swapChainBackgroundPanel->PointerWheelChanged += ref new PointerEventHandler(WINRT_OnPointerWheelChangedViaXAML); swapChainBackgroundPanel->PointerMoved += ref new PointerEventHandler(WINRT_OnPointerMovedViaXAML); // Setup for rendering: IInspectable *panelInspectable = (IInspectable*) reinterpret_cast<IInspectable*>(swapChainBackgroundPanel); panelInspectable->QueryInterface(__uuidof(ISwapChainBackgroundPanelNative), (void **)&WINRT_GlobalSwapChainBackgroundPanelNative); WINRT_XAMLAppEventToken = CompositionTarget::Rendering::add(ref new EventHandler<Object^>(WINRT_OnRenderViaXAML)); // Make sure the app is ready to call the SDL-centric main() function: WINRT_SDLAppEntryPoint = mainFunction; SDL_SetMainReady(); // Make sure video-init knows that we're initializing XAML: SDL_bool oldXAMLWasEnabledValue = WINRT_XAMLWasEnabled; WINRT_XAMLWasEnabled = SDL_TRUE; // Make sure video modes are detected now, while we still have access to the WinRT // CoreWindow. WinRT will not allow the app's CoreWindow to be accessed via the // SDL/WinRT thread. if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) { // SDL_InitSubSystem will, on error, set the SDL error. Let that propogate to // the caller to here: WINRT_XAMLWasEnabled = oldXAMLWasEnabledValue; return -1; } // All done, for now. return 0; #endif // WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP / else }
YifuLiu/AliOS-Things
components/SDL2/src/core/winrt/SDL_winrtapp_xaml.cpp
C++
apache-2.0
5,776
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "SDL_config.h" #ifndef SDL_winrtapp_xaml_h_ #define SDL_winrtapp_xaml_h_ #include "SDL_stdinc.h" #ifdef __cplusplus extern SDL_bool WINRT_XAMLWasEnabled; extern int SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void * backgroundPanelAsIInspectable); #endif // ifdef __cplusplus #endif // SDL_winrtapp_xaml_h_
YifuLiu/AliOS-Things
components/SDL2/src/core/winrt/SDL_winrtapp_xaml.h
C
apache-2.0
1,271
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifdef TEST_MAIN #include "SDL_config.h" #else #include "../SDL_internal.h" #endif #if defined(__WIN32__) || defined(__WINRT__) #include "../core/windows/SDL_windows.h" #endif #if defined(__OS2__) #define INCL_DOS #include <os2.h> #ifndef QSV_NUMPROCESSORS #define QSV_NUMPROCESSORS 26 #endif #endif /* CPU feature detection for SDL */ #include "SDL_cpuinfo.h" #include "SDL_assert.h" #ifdef HAVE_SYSCONF #include <unistd.h> #endif #ifdef HAVE_SYSCTLBYNAME #include <sys/types.h> #include <sys/sysctl.h> #endif #if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__)) #include <sys/sysctl.h> /* For AltiVec check */ #elif defined(__OpenBSD__) && defined(__powerpc__) #include <sys/param.h> #include <sys/sysctl.h> /* For AltiVec check */ #include <machine/cpu.h> #elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP #include <signal.h> #include <setjmp.h> #endif #if defined(__QNXNTO__) #include <sys/syspage.h> #endif #if (defined(__LINUX__) || defined(__ANDROID__)) && defined(__ARM_ARCH) /*#include <asm/hwcap.h>*/ #ifndef AT_HWCAP #define AT_HWCAP 16 #endif #ifndef AT_PLATFORM #define AT_PLATFORM 15 #endif /* Prevent compilation error when including elf.h would also try to define AT_* as an enum */ #ifndef AT_NULL #define AT_NULL 0 #endif #ifndef HWCAP_NEON #define HWCAP_NEON (1 << 12) #endif #if defined HAVE_GETAUXVAL #include <sys/auxv.h> #else #include <fcntl.h> #endif #endif #if defined(__ANDROID__) && defined(__ARM_ARCH) && !defined(HAVE_GETAUXVAL) #if __ARM_ARCH < 8 #include <cpu-features.h> #endif #endif #ifdef __RISCOS__ #include <kernel.h> #include <swis.h> #endif #define CPU_HAS_RDTSC (1 << 0) #define CPU_HAS_ALTIVEC (1 << 1) #define CPU_HAS_MMX (1 << 2) #define CPU_HAS_3DNOW (1 << 3) #define CPU_HAS_SSE (1 << 4) #define CPU_HAS_SSE2 (1 << 5) #define CPU_HAS_SSE3 (1 << 6) #define CPU_HAS_SSE41 (1 << 7) #define CPU_HAS_SSE42 (1 << 8) #define CPU_HAS_AVX (1 << 9) #define CPU_HAS_AVX2 (1 << 10) #define CPU_HAS_NEON (1 << 11) #define CPU_HAS_AVX512F (1 << 12) #define CPU_HAS_ARM_SIMD (1 << 13) #if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__ && !__OpenBSD__ /* This is the brute force way of detecting instruction sets... the idea is borrowed from the libmpeg2 library - thanks! */ static jmp_buf jmpbuf; static void illegal_instruction(int sig) { longjmp(jmpbuf, 1); } #endif /* HAVE_SETJMP */ static int CPU_haveCPUID(void) { int has_CPUID = 0; /* *INDENT-OFF* */ #ifndef SDL_CPUINFO_DISABLED #if defined(__GNUC__) && defined(i386) __asm__ ( " pushfl # Get original EFLAGS \n" " popl %%eax \n" " movl %%eax,%%ecx \n" " xorl $0x200000,%%eax # Flip ID bit in EFLAGS \n" " pushl %%eax # Save new EFLAGS value on stack \n" " popfl # Replace current EFLAGS value \n" " pushfl # Get new EFLAGS \n" " popl %%eax # Store new EFLAGS in EAX \n" " xorl %%ecx,%%eax # Can not toggle ID bit, \n" " jz 1f # Processor=80486 \n" " movl $1,%0 # We have CPUID support \n" "1: \n" : "=m" (has_CPUID) : : "%eax", "%ecx" ); #elif defined(__GNUC__) && defined(__x86_64__) /* Technically, if this is being compiled under __x86_64__ then it has CPUid by definition. But it's nice to be able to prove it. :) */ __asm__ ( " pushfq # Get original EFLAGS \n" " popq %%rax \n" " movq %%rax,%%rcx \n" " xorl $0x200000,%%eax # Flip ID bit in EFLAGS \n" " pushq %%rax # Save new EFLAGS value on stack \n" " popfq # Replace current EFLAGS value \n" " pushfq # Get new EFLAGS \n" " popq %%rax # Store new EFLAGS in EAX \n" " xorl %%ecx,%%eax # Can not toggle ID bit, \n" " jz 1f # Processor=80486 \n" " movl $1,%0 # We have CPUID support \n" "1: \n" : "=m" (has_CPUID) : : "%rax", "%rcx" ); #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__) __asm { pushfd ; Get original EFLAGS pop eax mov ecx, eax xor eax, 200000h ; Flip ID bit in EFLAGS push eax ; Save new EFLAGS value on stack popfd ; Replace current EFLAGS value pushfd ; Get new EFLAGS pop eax ; Store new EFLAGS in EAX xor eax, ecx ; Can not toggle ID bit, jz done ; Processor=80486 mov has_CPUID,1 ; We have CPUID support done: } #elif defined(_MSC_VER) && defined(_M_X64) has_CPUID = 1; #elif defined(__sun) && defined(__i386) __asm ( " pushfl \n" " popl %eax \n" " movl %eax,%ecx \n" " xorl $0x200000,%eax \n" " pushl %eax \n" " popfl \n" " pushfl \n" " popl %eax \n" " xorl %ecx,%eax \n" " jz 1f \n" " movl $1,-8(%ebp) \n" "1: \n" ); #elif defined(__sun) && defined(__amd64) __asm ( " pushfq \n" " popq %rax \n" " movq %rax,%rcx \n" " xorl $0x200000,%eax \n" " pushq %rax \n" " popfq \n" " pushfq \n" " popq %rax \n" " xorl %ecx,%eax \n" " jz 1f \n" " movl $1,-8(%rbp) \n" "1: \n" ); #endif #endif /* *INDENT-ON* */ return has_CPUID; } #if defined(__GNUC__) && defined(i386) #define cpuid(func, a, b, c, d) \ __asm__ __volatile__ ( \ " pushl %%ebx \n" \ " xorl %%ecx,%%ecx \n" \ " cpuid \n" \ " movl %%ebx, %%esi \n" \ " popl %%ebx \n" : \ "=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (func)) #elif defined(__GNUC__) && defined(__x86_64__) #define cpuid(func, a, b, c, d) \ __asm__ __volatile__ ( \ " pushq %%rbx \n" \ " xorq %%rcx,%%rcx \n" \ " cpuid \n" \ " movq %%rbx, %%rsi \n" \ " popq %%rbx \n" : \ "=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (func)) #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__) #define cpuid(func, a, b, c, d) \ __asm { \ __asm mov eax, func \ __asm xor ecx, ecx \ __asm cpuid \ __asm mov a, eax \ __asm mov b, ebx \ __asm mov c, ecx \ __asm mov d, edx \ } #elif defined(_MSC_VER) && defined(_M_X64) #define cpuid(func, a, b, c, d) \ { \ int CPUInfo[4]; \ __cpuid(CPUInfo, func); \ a = CPUInfo[0]; \ b = CPUInfo[1]; \ c = CPUInfo[2]; \ d = CPUInfo[3]; \ } #else #define cpuid(func, a, b, c, d) \ do { a = b = c = d = 0; (void) a; (void) b; (void) c; (void) d; } while (0) #endif static int CPU_CPUIDFeatures[4]; static int CPU_CPUIDMaxFunction = 0; static SDL_bool CPU_OSSavesYMM = SDL_FALSE; static SDL_bool CPU_OSSavesZMM = SDL_FALSE; static void CPU_calcCPUIDFeatures(void) { static SDL_bool checked = SDL_FALSE; if (!checked) { checked = SDL_TRUE; if (CPU_haveCPUID()) { int a, b, c, d; cpuid(0, a, b, c, d); CPU_CPUIDMaxFunction = a; if (CPU_CPUIDMaxFunction >= 1) { cpuid(1, a, b, c, d); CPU_CPUIDFeatures[0] = a; CPU_CPUIDFeatures[1] = b; CPU_CPUIDFeatures[2] = c; CPU_CPUIDFeatures[3] = d; /* Check to make sure we can call xgetbv */ if (c & 0x08000000) { /* Call xgetbv to see if YMM (etc) register state is saved */ #if defined(__GNUC__) && (defined(i386) || defined(__x86_64__)) __asm__(".byte 0x0f, 0x01, 0xd0" : "=a" (a) : "c" (0) : "%edx"); #elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) && (_MSC_FULL_VER >= 160040219) /* VS2010 SP1 */ a = (int)_xgetbv(0); #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__) __asm { xor ecx, ecx _asm _emit 0x0f _asm _emit 0x01 _asm _emit 0xd0 mov a, eax } #endif CPU_OSSavesYMM = ((a & 6) == 6) ? SDL_TRUE : SDL_FALSE; CPU_OSSavesZMM = (CPU_OSSavesYMM && ((a & 0xe0) == 0xe0)) ? SDL_TRUE : SDL_FALSE; } } } } } static int CPU_haveAltiVec(void) { volatile int altivec = 0; #ifndef SDL_CPUINFO_DISABLED #if (defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__)) #ifdef __OpenBSD__ int selectors[2] = { CTL_MACHDEP, CPU_ALTIVEC }; #else int selectors[2] = { CTL_HW, HW_VECTORUNIT }; #endif int hasVectorUnit = 0; size_t length = sizeof(hasVectorUnit); int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0); if (0 == error) altivec = (hasVectorUnit != 0); #elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP void (*handler) (int sig); handler = signal(SIGILL, illegal_instruction); if (setjmp(jmpbuf) == 0) { asm volatile ("mtspr 256, %0\n\t" "vand %%v0, %%v0, %%v0"::"r" (-1)); altivec = 1; } signal(SIGILL, handler); #endif #endif return altivec; } #if defined(__ARM_ARCH) && (__ARM_ARCH >= 6) static int CPU_haveARMSIMD(void) { return 1; } #elif !defined(__arm__) static int CPU_haveARMSIMD(void) { return 0; } #elif defined(__LINUX__) #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <elf.h> static int CPU_haveARMSIMD(void) { int arm_simd = 0; int fd; fd = open("/proc/self/auxv", O_RDONLY); if (fd >= 0) { Elf32_auxv_t aux; while (read(fd, &aux, sizeof aux) == sizeof aux) { if (aux.a_type == AT_PLATFORM) { const char *plat = (const char *) aux.a_un.a_val; if (plat) { arm_simd = strncmp(plat, "v6l", 3) == 0 || strncmp(plat, "v7l", 3) == 0; } } } close(fd); } return arm_simd; } #elif defined(__RISCOS__) static int CPU_haveARMSIMD(void) { _kernel_swi_regs regs; regs.r[0] = 0; if (_kernel_swi(OS_PlatformFeatures, &regs, &regs) != NULL) return 0; if (!(regs.r[0] & (1<<31))) return 0; regs.r[0] = 34; regs.r[1] = 29; if (_kernel_swi(OS_PlatformFeatures, &regs, &regs) != NULL) return 0; return regs.r[0]; } #else static int CPU_haveARMSIMD(void) { #warning SDL_HasARMSIMD is not implemented for this ARM platform. Write me. return 0; } #endif #if defined(__LINUX__) && defined(__ARM_ARCH) && !defined(HAVE_GETAUXVAL) static int readProcAuxvForNeon(void) { int neon = 0; int kv[2]; const int fd = open("/proc/self/auxv", O_RDONLY); if (fd != -1) { while (read(fd, kv, sizeof (kv)) == sizeof (kv)) { if (kv[0] == AT_HWCAP) { neon = ((kv[1] & HWCAP_NEON) == HWCAP_NEON); break; } } close(fd); } return neon; } #endif static int CPU_haveNEON(void) { /* The way you detect NEON is a privileged instruction on ARM, so you have query the OS kernel in a platform-specific way. :/ */ #if defined(SDL_CPUINFO_DISABLED) return 0; /* disabled */ #elif (defined(__WINDOWS__) || defined(__WINRT__)) && (defined(_M_ARM) || defined(_M_ARM64)) /* Visual Studio, for ARM, doesn't define __ARM_ARCH. Handle this first. */ /* Seems to have been removed */ # if !defined(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) # define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19 # endif /* All WinRT ARM devices are required to support NEON, but just in case. */ return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) != 0; #elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) return 1; /* ARMv8 always has non-optional NEON support. */ #elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) /* (note that sysctlbyname("hw.optional.neon") doesn't work!) */ return 1; /* all Apple ARMv7 chips and later have NEON. */ #elif defined(__APPLE__) return 0; /* assume anything else from Apple doesn't have NEON. */ #elif defined(__OpenBSD__) return 1; /* OpenBSD only supports ARMv7 CPUs that have NEON. */ #elif !defined(__arm__) return 0; /* not an ARM CPU at all. */ #elif defined(__QNXNTO__) return SYSPAGE_ENTRY(cpuinfo)->flags & ARM_CPU_FLAG_NEON; #elif (defined(__LINUX__) || defined(__ANDROID__)) && defined(HAVE_GETAUXVAL) return ((getauxval(AT_HWCAP) & HWCAP_NEON) == HWCAP_NEON); #elif defined(__LINUX__) return readProcAuxvForNeon(); #elif defined(__ANDROID__) /* Use NDK cpufeatures to read either /proc/self/auxv or /proc/cpuinfo */ { AndroidCpuFamily cpu_family = android_getCpuFamily(); if (cpu_family == ANDROID_CPU_FAMILY_ARM) { uint64_t cpu_features = android_getCpuFeatures(); if ((cpu_features & ANDROID_CPU_ARM_FEATURE_NEON) != 0) { return 1; } } return 0; } #elif defined(__RISCOS__) /* Use the VFPSupport_Features SWI to access the MVFR registers */ { _kernel_swi_regs regs; regs.r[0] = 0; if (_kernel_swi(VFPSupport_Features, &regs, &regs) == NULL) { if ((regs.r[2] & 0xFFF000) == 0x111000) { return 1; } } return 0; } #else #warning SDL_HasNEON is not implemented for this ARM platform. Write me. return 0; #endif } static int CPU_have3DNow(void) { if (CPU_CPUIDMaxFunction > 0) { /* that is, do we have CPUID at all? */ int a, b, c, d; cpuid(0x80000000, a, b, c, d); if (a >= 0x80000001) { cpuid(0x80000001, a, b, c, d); return (d & 0x80000000); } } return 0; } #define CPU_haveRDTSC() (CPU_CPUIDFeatures[3] & 0x00000010) #define CPU_haveMMX() (CPU_CPUIDFeatures[3] & 0x00800000) #define CPU_haveSSE() (CPU_CPUIDFeatures[3] & 0x02000000) #define CPU_haveSSE2() (CPU_CPUIDFeatures[3] & 0x04000000) #define CPU_haveSSE3() (CPU_CPUIDFeatures[2] & 0x00000001) #define CPU_haveSSE41() (CPU_CPUIDFeatures[2] & 0x00080000) #define CPU_haveSSE42() (CPU_CPUIDFeatures[2] & 0x00100000) #define CPU_haveAVX() (CPU_OSSavesYMM && (CPU_CPUIDFeatures[2] & 0x10000000)) static int CPU_haveAVX2(void) { if (CPU_OSSavesYMM && (CPU_CPUIDMaxFunction >= 7)) { int a, b, c, d; (void) a; (void) b; (void) c; (void) d; /* compiler warnings... */ cpuid(7, a, b, c, d); return (b & 0x00000020); } return 0; } static int CPU_haveAVX512F(void) { if (CPU_OSSavesZMM && (CPU_CPUIDMaxFunction >= 7)) { int a, b, c, d; (void) a; (void) b; (void) c; (void) d; /* compiler warnings... */ cpuid(7, a, b, c, d); return (b & 0x00010000); } return 0; } static int SDL_CPUCount = 0; int SDL_GetCPUCount(void) { if (!SDL_CPUCount) { #ifndef SDL_CPUINFO_DISABLED #if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN) if (SDL_CPUCount <= 0) { SDL_CPUCount = (int)sysconf(_SC_NPROCESSORS_ONLN); } #endif #ifdef HAVE_SYSCTLBYNAME if (SDL_CPUCount <= 0) { size_t size = sizeof(SDL_CPUCount); sysctlbyname("hw.ncpu", &SDL_CPUCount, &size, NULL, 0); } #endif #ifdef __WIN32__ if (SDL_CPUCount <= 0) { SYSTEM_INFO info; GetSystemInfo(&info); SDL_CPUCount = info.dwNumberOfProcessors; } #endif #ifdef __OS2__ if (SDL_CPUCount <= 0) { DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS, &SDL_CPUCount, sizeof(SDL_CPUCount) ); } #endif #endif /* There has to be at least 1, right? :) */ if (SDL_CPUCount <= 0) { SDL_CPUCount = 1; } } return SDL_CPUCount; } /* Oh, such a sweet sweet trick, just not very useful. :) */ static const char * SDL_GetCPUType(void) { static char SDL_CPUType[13]; if (!SDL_CPUType[0]) { int i = 0; CPU_calcCPUIDFeatures(); if (CPU_CPUIDMaxFunction > 0) { /* do we have CPUID at all? */ int a, b, c, d; cpuid(0x00000000, a, b, c, d); (void) a; SDL_CPUType[i++] = (char)(b & 0xff); b >>= 8; SDL_CPUType[i++] = (char)(b & 0xff); b >>= 8; SDL_CPUType[i++] = (char)(b & 0xff); b >>= 8; SDL_CPUType[i++] = (char)(b & 0xff); SDL_CPUType[i++] = (char)(d & 0xff); d >>= 8; SDL_CPUType[i++] = (char)(d & 0xff); d >>= 8; SDL_CPUType[i++] = (char)(d & 0xff); d >>= 8; SDL_CPUType[i++] = (char)(d & 0xff); SDL_CPUType[i++] = (char)(c & 0xff); c >>= 8; SDL_CPUType[i++] = (char)(c & 0xff); c >>= 8; SDL_CPUType[i++] = (char)(c & 0xff); c >>= 8; SDL_CPUType[i++] = (char)(c & 0xff); } if (!SDL_CPUType[0]) { SDL_strlcpy(SDL_CPUType, "Unknown", sizeof(SDL_CPUType)); } } return SDL_CPUType; } #ifdef TEST_MAIN /* !!! FIXME: only used for test at the moment. */ static const char * SDL_GetCPUName(void) { static char SDL_CPUName[48]; if (!SDL_CPUName[0]) { int i = 0; int a, b, c, d; CPU_calcCPUIDFeatures(); if (CPU_CPUIDMaxFunction > 0) { /* do we have CPUID at all? */ cpuid(0x80000000, a, b, c, d); if (a >= 0x80000004) { cpuid(0x80000002, a, b, c, d); SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8; SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8; SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8; SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8; SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8; SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8; SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8; SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8; SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8; SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8; SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8; SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8; SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8; SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8; SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8; SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8; cpuid(0x80000003, a, b, c, d); SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8; SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8; SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8; SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8; SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8; SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8; SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8; SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8; SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8; SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8; SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8; SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8; SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8; SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8; SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8; SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8; cpuid(0x80000004, a, b, c, d); SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8; SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8; SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8; SDL_CPUName[i++] = (char)(a & 0xff); a >>= 8; SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8; SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8; SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8; SDL_CPUName[i++] = (char)(b & 0xff); b >>= 8; SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8; SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8; SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8; SDL_CPUName[i++] = (char)(c & 0xff); c >>= 8; SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8; SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8; SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8; SDL_CPUName[i++] = (char)(d & 0xff); d >>= 8; } } if (!SDL_CPUName[0]) { SDL_strlcpy(SDL_CPUName, "Unknown", sizeof(SDL_CPUName)); } } return SDL_CPUName; } #endif int SDL_GetCPUCacheLineSize(void) { const char *cpuType = SDL_GetCPUType(); int a, b, c, d; (void) a; (void) b; (void) c; (void) d; if (SDL_strcmp(cpuType, "GenuineIntel") == 0) { cpuid(0x00000001, a, b, c, d); return (((b >> 8) & 0xff) * 8); } else if (SDL_strcmp(cpuType, "AuthenticAMD") == 0 || SDL_strcmp(cpuType, "HygonGenuine") == 0) { cpuid(0x80000005, a, b, c, d); return (c & 0xff); } else { /* Just make a guess here... */ return SDL_CACHELINE_SIZE; } } static Uint32 SDL_CPUFeatures = 0xFFFFFFFF; static Uint32 SDL_SIMDAlignment = 0xFFFFFFFF; static Uint32 SDL_GetCPUFeatures(void) { if (SDL_CPUFeatures == 0xFFFFFFFF) { CPU_calcCPUIDFeatures(); SDL_CPUFeatures = 0; SDL_SIMDAlignment = sizeof(void *); /* a good safe base value */ if (CPU_haveRDTSC()) { SDL_CPUFeatures |= CPU_HAS_RDTSC; } if (CPU_haveAltiVec()) { SDL_CPUFeatures |= CPU_HAS_ALTIVEC; SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16); } if (CPU_haveMMX()) { SDL_CPUFeatures |= CPU_HAS_MMX; SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 8); } if (CPU_have3DNow()) { SDL_CPUFeatures |= CPU_HAS_3DNOW; SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 8); } if (CPU_haveSSE()) { SDL_CPUFeatures |= CPU_HAS_SSE; SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16); } if (CPU_haveSSE2()) { SDL_CPUFeatures |= CPU_HAS_SSE2; SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16); } if (CPU_haveSSE3()) { SDL_CPUFeatures |= CPU_HAS_SSE3; SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16); } if (CPU_haveSSE41()) { SDL_CPUFeatures |= CPU_HAS_SSE41; SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16); } if (CPU_haveSSE42()) { SDL_CPUFeatures |= CPU_HAS_SSE42; SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16); } if (CPU_haveAVX()) { SDL_CPUFeatures |= CPU_HAS_AVX; SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 32); } if (CPU_haveAVX2()) { SDL_CPUFeatures |= CPU_HAS_AVX2; SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 32); } if (CPU_haveAVX512F()) { SDL_CPUFeatures |= CPU_HAS_AVX512F; SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 64); } if (CPU_haveARMSIMD()) { SDL_CPUFeatures |= CPU_HAS_ARM_SIMD; SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16); } if (CPU_haveNEON()) { SDL_CPUFeatures |= CPU_HAS_NEON; SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16); } } return SDL_CPUFeatures; } #define CPU_FEATURE_AVAILABLE(f) ((SDL_GetCPUFeatures() & f) ? SDL_TRUE : SDL_FALSE) SDL_bool SDL_HasRDTSC(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_RDTSC); } SDL_bool SDL_HasAltiVec(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_ALTIVEC); } SDL_bool SDL_HasMMX(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_MMX); } SDL_bool SDL_Has3DNow(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_3DNOW); } SDL_bool SDL_HasSSE(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE); } SDL_bool SDL_HasSSE2(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE2); } SDL_bool SDL_HasSSE3(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE3); } SDL_bool SDL_HasSSE41(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE41); } SDL_bool SDL_HasSSE42(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE42); } SDL_bool SDL_HasAVX(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX); } SDL_bool SDL_HasAVX2(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX2); } SDL_bool SDL_HasAVX512F(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX512F); } SDL_bool SDL_HasARMSIMD(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_ARM_SIMD); } SDL_bool SDL_HasNEON(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_NEON); } static int SDL_SystemRAM = 0; int SDL_GetSystemRAM(void) { if (!SDL_SystemRAM) { #ifndef SDL_CPUINFO_DISABLED #if defined(HAVE_SYSCONF) && defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE) if (SDL_SystemRAM <= 0) { SDL_SystemRAM = (int)((Sint64)sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE) / (1024*1024)); } #endif #ifdef HAVE_SYSCTLBYNAME if (SDL_SystemRAM <= 0) { #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) #ifdef HW_REALMEM int mib[2] = {CTL_HW, HW_REALMEM}; #else /* might only report up to 2 GiB */ int mib[2] = {CTL_HW, HW_PHYSMEM}; #endif /* HW_REALMEM */ #else int mib[2] = {CTL_HW, HW_MEMSIZE}; #endif /* __FreeBSD__ || __FreeBSD_kernel__ */ Uint64 memsize = 0; size_t len = sizeof(memsize); if (sysctl(mib, 2, &memsize, &len, NULL, 0) == 0) { SDL_SystemRAM = (int)(memsize / (1024*1024)); } } #endif #ifdef __WIN32__ if (SDL_SystemRAM <= 0) { MEMORYSTATUSEX stat; stat.dwLength = sizeof(stat); if (GlobalMemoryStatusEx(&stat)) { SDL_SystemRAM = (int)(stat.ullTotalPhys / (1024 * 1024)); } } #endif #ifdef __OS2__ if (SDL_SystemRAM <= 0) { Uint32 sysram = 0; DosQuerySysInfo(QSV_TOTPHYSMEM, QSV_TOTPHYSMEM, &sysram, 4); SDL_SystemRAM = (int) (sysram / 0x100000U); } #endif #ifdef __RISCOS__ if (SDL_SystemRAM <= 0) { _kernel_swi_regs regs; regs.r[0] = 0x108; if (_kernel_swi(OS_Memory, &regs, &regs) == NULL) { SDL_SystemRAM = (int)(regs.r[1] * regs.r[2] / (1024 * 1024)); } } #endif #endif } return SDL_SystemRAM; } size_t SDL_SIMDGetAlignment(void) { if (SDL_SIMDAlignment == 0xFFFFFFFF) { SDL_GetCPUFeatures(); /* make sure this has been calculated */ } SDL_assert(SDL_SIMDAlignment != 0); return SDL_SIMDAlignment; } void * SDL_SIMDAlloc(const size_t len) { const size_t alignment = SDL_SIMDGetAlignment(); const size_t padding = alignment - (len % alignment); const size_t padded = (padding != alignment) ? (len + padding) : len; Uint8 *retval = NULL; Uint8 *ptr = (Uint8 *) SDL_malloc(padded + alignment + sizeof (void *)); if (ptr) { /* store the actual malloc pointer right before our aligned pointer. */ retval = ptr + sizeof (void *); retval += alignment - (((size_t) retval) % alignment); *(((void **) retval) - 1) = ptr; } return retval; } void * SDL_SIMDRealloc(void *mem, const size_t len) { const size_t alignment = SDL_SIMDGetAlignment(); const size_t padding = alignment - (len % alignment); const size_t padded = (padding != alignment) ? (len + padding) : len; Uint8 *retval = (Uint8*) mem; void *oldmem = mem; size_t memdiff, ptrdiff; Uint8 *ptr; if (mem) { void **realptr = (void **) mem; realptr--; mem = *(((void **) mem) - 1); /* Check the delta between the real pointer and user pointer */ memdiff = ((size_t) oldmem) - ((size_t) mem); } ptr = (Uint8 *) SDL_realloc(mem, padded + alignment + sizeof (void *)); if (ptr == mem) { return retval; /* Pointer didn't change, nothing to do */ } if (ptr == NULL) { return NULL; /* Out of memory, bail! */ } /* Store the actual malloc pointer right before our aligned pointer. */ retval = ptr + sizeof (void *); retval += alignment - (((size_t) retval) % alignment); /* Make sure the delta is the same! */ if (mem) { ptrdiff = ((size_t) retval) - ((size_t) ptr); if (memdiff != ptrdiff) { /* Delta has changed, copy to new offset! */ oldmem = (void*) (((size_t) ptr) + memdiff); /* Even though the data past the old `len` is undefined, this is the * only length value we have, and it guarantees that we copy all the * previous memory anyhow. */ SDL_memmove(retval, oldmem, len); } } /* Actually store the malloc pointer, finally. */ *(((void **) retval) - 1) = ptr; return retval; } void SDL_SIMDFree(void *ptr) { if (ptr) { void **realptr = (void **) ptr; realptr--; SDL_free(*(((void **) ptr) - 1)); } } #ifdef TEST_MAIN #include <stdio.h> int main() { printf("CPU count: %d\n", SDL_GetCPUCount()); printf("CPU type: %s\n", SDL_GetCPUType()); printf("CPU name: %s\n", SDL_GetCPUName()); printf("CacheLine size: %d\n", SDL_GetCPUCacheLineSize()); printf("RDTSC: %d\n", SDL_HasRDTSC()); printf("Altivec: %d\n", SDL_HasAltiVec()); printf("MMX: %d\n", SDL_HasMMX()); printf("3DNow: %d\n", SDL_Has3DNow()); printf("SSE: %d\n", SDL_HasSSE()); printf("SSE2: %d\n", SDL_HasSSE2()); printf("SSE3: %d\n", SDL_HasSSE3()); printf("SSE4.1: %d\n", SDL_HasSSE41()); printf("SSE4.2: %d\n", SDL_HasSSE42()); printf("AVX: %d\n", SDL_HasAVX()); printf("AVX2: %d\n", SDL_HasAVX2()); printf("AVX-512F: %d\n", SDL_HasAVX512F()); printf("ARM SIMD: %d\n", SDL_HasARMSIMD()); printf("NEON: %d\n", SDL_HasNEON()); printf("RAM: %d MB\n", SDL_GetSystemRAM()); return 0; } #endif /* TEST_MAIN */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/cpuinfo/SDL_cpuinfo.c
C
apache-2.0
32,484
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "SDL_config.h" #include "SDL_dynapi.h" #if SDL_DYNAMIC_API #if defined(__OS2__) #define INCL_DOS #define INCL_DOSERRORS #include <os2.h> #include <dos.h> #endif #include "SDL.h" /* These headers have system specific definitions, so aren't included above */ #include "SDL_syswm.h" #include "SDL_vulkan.h" /* This is the version of the dynamic API. This doesn't match the SDL version and should not change until there's been a major revamp in API/ABI. So 2.0.5 adds functions over 2.0.4? This number doesn't change; the sizeof (jump_table) changes instead. But 2.1.0 changes how a function works in an incompatible way or removes a function? This number changes, since sizeof (jump_table) isn't sufficient anymore. It's likely we'll forget to bump every time we add a function, so this is the failsafe switch for major API change decisions. Respect it and use it sparingly. */ #define SDL_DYNAPI_VERSION 1 static void SDL_InitDynamicAPI(void); /* BE CAREFUL CALLING ANY SDL CODE IN HERE, IT WILL BLOW UP. Even self-contained stuff might call SDL_Error and break everything. */ /* behold, the macro salsa! */ /* !!! FIXME: ...disabled...until we write it. :) */ #define DISABLE_JUMP_MAGIC 1 #if DISABLE_JUMP_MAGIC /* Can't use the macro for varargs nonsense. This is atrocious. */ #define SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, logname, prio) \ _static void SDLCALL SDL_Log##logname##name(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ va_list ap; initcall; va_start(ap, fmt); \ jump_table.SDL_LogMessageV(category, SDL_LOG_PRIORITY_##prio, fmt, ap); \ va_end(ap); \ } #define SDL_DYNAPI_VARARGS(_static, name, initcall) \ _static int SDLCALL SDL_SetError##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ char buf[512]; /* !!! FIXME: dynamic allocation */ \ va_list ap; initcall; va_start(ap, fmt); \ jump_table.SDL_vsnprintf(buf, sizeof (buf), fmt, ap); \ va_end(ap); \ return jump_table.SDL_SetError("%s", buf); \ } \ _static int SDLCALL SDL_sscanf##name(const char *buf, SDL_SCANF_FORMAT_STRING const char *fmt, ...) { \ int retval; va_list ap; initcall; va_start(ap, fmt); \ retval = jump_table.SDL_vsscanf(buf, fmt, ap); \ va_end(ap); \ return retval; \ } \ _static int SDLCALL SDL_snprintf##name(SDL_OUT_Z_CAP(maxlen) char *buf, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ int retval; va_list ap; initcall; va_start(ap, fmt); \ retval = jump_table.SDL_vsnprintf(buf, maxlen, fmt, ap); \ va_end(ap); \ return retval; \ } \ _static void SDLCALL SDL_Log##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ va_list ap; initcall; va_start(ap, fmt); \ jump_table.SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, fmt, ap); \ va_end(ap); \ } \ _static void SDLCALL SDL_LogMessage##name(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ va_list ap; initcall; va_start(ap, fmt); \ jump_table.SDL_LogMessageV(category, priority, fmt, ap); \ va_end(ap); \ } \ SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Verbose, VERBOSE) \ SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Debug, DEBUG) \ SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Info, INFO) \ SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Warn, WARN) \ SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Error, ERROR) \ SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Critical, CRITICAL) #endif /* Typedefs for function pointers for jump table, and predeclare funcs */ /* The DEFAULT funcs will init jump table and then call real function. */ /* The REAL funcs are the actual functions, name-mangled to not clash. */ #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \ typedef rc (SDLCALL *SDL_DYNAPIFN_##fn) params; \ static rc SDLCALL fn##_DEFAULT params; \ extern rc SDLCALL fn##_REAL params; #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC /* The jump table! */ typedef struct { #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) SDL_DYNAPIFN_##fn fn; #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC } SDL_DYNAPI_jump_table; /* Predeclare the default functions for initializing the jump table. */ #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) static rc SDLCALL fn##_DEFAULT params; #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC /* The actual jump table. */ static SDL_DYNAPI_jump_table jump_table = { #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) fn##_DEFAULT, #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC }; /* Default functions init the function table then call right thing. */ #if DISABLE_JUMP_MAGIC #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \ static rc SDLCALL fn##_DEFAULT params { \ SDL_InitDynamicAPI(); \ ret jump_table.fn args; \ } #define SDL_DYNAPI_PROC_NO_VARARGS 1 #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC #undef SDL_DYNAPI_PROC_NO_VARARGS SDL_DYNAPI_VARARGS(static, _DEFAULT, SDL_InitDynamicAPI()) #else /* !!! FIXME: need the jump magic. */ #error Write me. #endif /* Public API functions to jump into the jump table. */ #if DISABLE_JUMP_MAGIC #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \ rc SDLCALL fn params { ret jump_table.fn args; } #define SDL_DYNAPI_PROC_NO_VARARGS 1 #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC #undef SDL_DYNAPI_PROC_NO_VARARGS SDL_DYNAPI_VARARGS(,,) #else /* !!! FIXME: need the jump magic. */ #error Write me. #endif /* we make this a static function so we can call the correct one without the system's dynamic linker resolving to the wrong version of this. */ static Sint32 initialize_jumptable(Uint32 apiver, void *table, Uint32 tablesize) { SDL_DYNAPI_jump_table *output_jump_table = (SDL_DYNAPI_jump_table *) table; if (apiver != SDL_DYNAPI_VERSION) { /* !!! FIXME: can maybe handle older versions? */ return -1; /* not compatible. */ } else if (tablesize > sizeof (jump_table)) { return -1; /* newer version of SDL with functions we can't provide. */ } /* Init our jump table first. */ #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) jump_table.fn = fn##_REAL; #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC /* Then the external table... */ if (output_jump_table != &jump_table) { jump_table.SDL_memcpy(output_jump_table, &jump_table, tablesize); } /* Safe to call SDL functions now; jump table is initialized! */ return 0; /* success! */ } /* Here's the exported entry point that fills in the jump table. */ /* Use specific types when an "int" might suffice to keep this sane. */ typedef Sint32 (SDLCALL *SDL_DYNAPI_ENTRYFN)(Uint32 apiver, void *table, Uint32 tablesize); extern DECLSPEC Sint32 SDLCALL SDL_DYNAPI_entry(Uint32, void *, Uint32); Sint32 SDL_DYNAPI_entry(Uint32 apiver, void *table, Uint32 tablesize) { return initialize_jumptable(apiver, table, tablesize); } /* Obviously we can't use SDL_LoadObject() to load SDL. :) */ /* Also obviously, we never close the loaded library. */ #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN 1 #endif #include <windows.h> static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) { HANDLE lib = LoadLibraryA(fname); void *retval = NULL; if (lib) { retval = GetProcAddress(lib, sym); if (retval == NULL) { FreeLibrary(lib); } } return retval; } #elif defined(unix) || defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__) || defined(__QNX__) #include <dlfcn.h> static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) { void *lib = dlopen(fname, RTLD_NOW | RTLD_LOCAL); void *retval = NULL; if (lib != NULL) { retval = dlsym(lib, sym); if (retval == NULL) { dlclose(lib); } } return retval; } #elif defined(__OS2__) static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) { HMODULE hmodule; PFN retval = NULL; char error[256]; if (DosLoadModule(error, sizeof(error), fname, &hmodule) == NO_ERROR) { if (DosQueryProcAddr(hmodule, 0, sym, &retval) != NO_ERROR) { DosFreeModule(hmodule); } } return (void *)retval; } #else #error Please define your platform. #endif static void dynapi_warn(const char *msg) { const char *caption = "SDL Dynamic API Failure!"; /* SDL_ShowSimpleMessageBox() is a too heavy for here. */ #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) MessageBoxA(NULL, msg, caption, MB_OK | MB_ICONERROR); #else fprintf(stderr, "\n\n%s\n%s\n\n", caption, msg); fflush(stderr); #endif } /* This is not declared in any header, although it is shared between some parts of SDL, because we don't want anything calling it without an extremely good reason. */ #if defined(__WATCOMC__) void SDL_ExitProcess(int exitcode); #pragma aux SDL_ExitProcess aborts; #endif SDL_NORETURN void SDL_ExitProcess(int exitcode); static void SDL_InitDynamicAPILocked(void) { const char *libname = SDL_getenv_REAL("SDL_DYNAMIC_API"); SDL_DYNAPI_ENTRYFN entry = NULL; /* funcs from here by default. */ SDL_bool use_internal = SDL_TRUE; if (libname) { entry = (SDL_DYNAPI_ENTRYFN) get_sdlapi_entry(libname, "SDL_DYNAPI_entry"); if (!entry) { dynapi_warn("Couldn't load overriding SDL library. Please fix or remove the SDL_DYNAMIC_API environment variable. Using the default SDL."); /* Just fill in the function pointers from this library, later. */ } } if (entry) { if (entry(SDL_DYNAPI_VERSION, &jump_table, sizeof (jump_table)) < 0) { dynapi_warn("Couldn't override SDL library. Using a newer SDL build might help. Please fix or remove the SDL_DYNAMIC_API environment variable. Using the default SDL."); /* Just fill in the function pointers from this library, later. */ } else { use_internal = SDL_FALSE; /* We overrode SDL! Don't use the internal version! */ } } /* Just fill in the function pointers from this library. */ if (use_internal) { if (initialize_jumptable(SDL_DYNAPI_VERSION, &jump_table, sizeof (jump_table)) < 0) { /* Now we're screwed. Should definitely abort now. */ dynapi_warn("Failed to initialize internal SDL dynapi. As this would otherwise crash, we have to abort now."); SDL_ExitProcess(86); } } /* we intentionally never close the newly-loaded lib, of course. */ } static void SDL_InitDynamicAPI(void) { /* So the theory is that every function in the jump table defaults to * calling this function, and then replaces itself with a version that * doesn't call this function anymore. But it's possible that, in an * extreme corner case, you can have a second thread hit this function * while the jump table is being initialized by the first. * In this case, a spinlock is really painful compared to what spinlocks * _should_ be used for, but this would only happen once, and should be * insanely rare, as you would have to spin a thread outside of SDL (as * SDL_CreateThread() would also call this function before building the * new thread). */ static SDL_bool already_initialized = SDL_FALSE; /* SDL_AtomicLock calls SDL mutex functions to emulate if SDL_ATOMIC_DISABLED, which we can't do here, so in such a configuration, you're on your own. */ #if !SDL_ATOMIC_DISABLED static SDL_SpinLock lock = 0; SDL_AtomicLock_REAL(&lock); #endif if (!already_initialized) { SDL_InitDynamicAPILocked(); already_initialized = SDL_TRUE; } #if !SDL_ATOMIC_DISABLED SDL_AtomicUnlock_REAL(&lock); #endif } #endif /* SDL_DYNAMIC_API */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/dynapi/SDL_dynapi.c
C
apache-2.0
13,142
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef SDL_dynapi_h_ #define SDL_dynapi_h_ /* IMPORTANT: This is the master switch to disabling the dynamic API. We made it so you have to hand-edit an internal source file in SDL to turn it off; you can do it if you want it badly enough, but hopefully you won't want to. You should understand the ramifications of turning this off: it makes it hard to update your SDL in the field, and impossible if you've statically linked SDL into your app. Understand that platforms change, and if we can't drop in an updated SDL, your application can definitely break some time in the future, even if it's fine today. To be sure, as new system-level video and audio APIs are introduced, an updated SDL can transparently take advantage of them, but your program will not without this feature. Think hard before turning it off. */ #ifdef SDL_DYNAMIC_API /* Tried to force it on the command line? */ #error Nope, you have to edit this file to force this off. #endif #ifdef __APPLE__ #include "TargetConditionals.h" #endif #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE || defined(__ALIOS__) /* probably not useful on iOS. */ #define SDL_DYNAMIC_API 0 #elif defined(__native_client__) && __native_client__ /* probably not useful on NACL. */ #define SDL_DYNAMIC_API 0 #elif defined(__EMSCRIPTEN__) && __EMSCRIPTEN__ /* probably not useful on Emscripten. */ #define SDL_DYNAMIC_API 0 #elif defined(SDL_BUILDING_WINRT) && SDL_BUILDING_WINRT /* probably not useful on WinRT, given current .dll loading restrictions */ #define SDL_DYNAMIC_API 0 #elif defined(__PSP__) && __PSP__ #define SDL_DYNAMIC_API 0 #elif defined(__riscos__) && __riscos__ /* probably not useful on RISC OS, since dlopen() can't be used when using static linking. */ #define SDL_DYNAMIC_API 0 #elif defined(__clang_analyzer__) #define SDL_DYNAMIC_API 0 /* Turn off for static analysis, so reports are more clear. */ #endif /* everyone else. This is where we turn on the API if nothing forced it off. */ #ifndef SDL_DYNAMIC_API #define SDL_DYNAMIC_API 1 #endif #endif /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/dynapi/SDL_dynapi.h
C
apache-2.0
3,042
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* vi: set ts=4 sw=4 expandtab: */ /* DO NOT EDIT THIS FILE BY HAND. It is autogenerated by gendynapi.pl. */ #if !SDL_DYNAMIC_API #error You should not be here. #endif #define SDL_SetError SDL_SetError_REAL #define SDL_Log SDL_Log_REAL #define SDL_LogVerbose SDL_LogVerbose_REAL #define SDL_LogDebug SDL_LogDebug_REAL #define SDL_LogInfo SDL_LogInfo_REAL #define SDL_LogWarn SDL_LogWarn_REAL #define SDL_LogError SDL_LogError_REAL #define SDL_LogCritical SDL_LogCritical_REAL #define SDL_LogMessage SDL_LogMessage_REAL #define SDL_sscanf SDL_sscanf_REAL #define SDL_snprintf SDL_snprintf_REAL #define SDL_CreateThread SDL_CreateThread_REAL #define SDL_RWFromFP SDL_RWFromFP_REAL #define SDL_RegisterApp SDL_RegisterApp_REAL #define SDL_UnregisterApp SDL_UnregisterApp_REAL #define SDL_Direct3D9GetAdapterIndex SDL_Direct3D9GetAdapterIndex_REAL #define SDL_RenderGetD3D9Device SDL_RenderGetD3D9Device_REAL #define SDL_iPhoneSetAnimationCallback SDL_iPhoneSetAnimationCallback_REAL #define SDL_iPhoneSetEventPump SDL_iPhoneSetEventPump_REAL #define SDL_AndroidGetJNIEnv SDL_AndroidGetJNIEnv_REAL #define SDL_AndroidGetActivity SDL_AndroidGetActivity_REAL #define SDL_AndroidGetInternalStoragePath SDL_AndroidGetInternalStoragePath_REAL #define SDL_AndroidGetExternalStorageState SDL_AndroidGetExternalStorageState_REAL #define SDL_AndroidGetExternalStoragePath SDL_AndroidGetExternalStoragePath_REAL #define SDL_Init SDL_Init_REAL #define SDL_InitSubSystem SDL_InitSubSystem_REAL #define SDL_QuitSubSystem SDL_QuitSubSystem_REAL #define SDL_WasInit SDL_WasInit_REAL #define SDL_Quit SDL_Quit_REAL #define SDL_ReportAssertion SDL_ReportAssertion_REAL #define SDL_SetAssertionHandler SDL_SetAssertionHandler_REAL #define SDL_GetAssertionReport SDL_GetAssertionReport_REAL #define SDL_ResetAssertionReport SDL_ResetAssertionReport_REAL #define SDL_AtomicTryLock SDL_AtomicTryLock_REAL #define SDL_AtomicLock SDL_AtomicLock_REAL #define SDL_AtomicUnlock SDL_AtomicUnlock_REAL #define SDL_AtomicCAS SDL_AtomicCAS_REAL #define SDL_AtomicSet SDL_AtomicSet_REAL #define SDL_AtomicGet SDL_AtomicGet_REAL #define SDL_AtomicAdd SDL_AtomicAdd_REAL #define SDL_AtomicCASPtr SDL_AtomicCASPtr_REAL #define SDL_AtomicSetPtr SDL_AtomicSetPtr_REAL #define SDL_AtomicGetPtr SDL_AtomicGetPtr_REAL #define SDL_GetNumAudioDrivers SDL_GetNumAudioDrivers_REAL #define SDL_GetAudioDriver SDL_GetAudioDriver_REAL #define SDL_AudioInit SDL_AudioInit_REAL #define SDL_AudioQuit SDL_AudioQuit_REAL #define SDL_GetCurrentAudioDriver SDL_GetCurrentAudioDriver_REAL #define SDL_OpenAudio SDL_OpenAudio_REAL #define SDL_GetNumAudioDevices SDL_GetNumAudioDevices_REAL #define SDL_GetAudioDeviceName SDL_GetAudioDeviceName_REAL #define SDL_OpenAudioDevice SDL_OpenAudioDevice_REAL #define SDL_GetAudioStatus SDL_GetAudioStatus_REAL #define SDL_GetAudioDeviceStatus SDL_GetAudioDeviceStatus_REAL #define SDL_PauseAudio SDL_PauseAudio_REAL #define SDL_PauseAudioDevice SDL_PauseAudioDevice_REAL #define SDL_LoadWAV_RW SDL_LoadWAV_RW_REAL #define SDL_FreeWAV SDL_FreeWAV_REAL #define SDL_BuildAudioCVT SDL_BuildAudioCVT_REAL #define SDL_ConvertAudio SDL_ConvertAudio_REAL #define SDL_MixAudio SDL_MixAudio_REAL #define SDL_MixAudioFormat SDL_MixAudioFormat_REAL #define SDL_LockAudio SDL_LockAudio_REAL #define SDL_LockAudioDevice SDL_LockAudioDevice_REAL #define SDL_UnlockAudio SDL_UnlockAudio_REAL #define SDL_UnlockAudioDevice SDL_UnlockAudioDevice_REAL #define SDL_CloseAudio SDL_CloseAudio_REAL #define SDL_CloseAudioDevice SDL_CloseAudioDevice_REAL #define SDL_SetClipboardText SDL_SetClipboardText_REAL #define SDL_GetClipboardText SDL_GetClipboardText_REAL #define SDL_HasClipboardText SDL_HasClipboardText_REAL #define SDL_GetCPUCount SDL_GetCPUCount_REAL #define SDL_GetCPUCacheLineSize SDL_GetCPUCacheLineSize_REAL #define SDL_HasRDTSC SDL_HasRDTSC_REAL #define SDL_HasAltiVec SDL_HasAltiVec_REAL #define SDL_HasMMX SDL_HasMMX_REAL #define SDL_Has3DNow SDL_Has3DNow_REAL #define SDL_HasSSE SDL_HasSSE_REAL #define SDL_HasSSE2 SDL_HasSSE2_REAL #define SDL_HasSSE3 SDL_HasSSE3_REAL #define SDL_HasSSE41 SDL_HasSSE41_REAL #define SDL_HasSSE42 SDL_HasSSE42_REAL #define SDL_GetSystemRAM SDL_GetSystemRAM_REAL #define SDL_GetError SDL_GetError_REAL #define SDL_ClearError SDL_ClearError_REAL #define SDL_Error SDL_Error_REAL #define SDL_PumpEvents SDL_PumpEvents_REAL #define SDL_PeepEvents SDL_PeepEvents_REAL #define SDL_HasEvent SDL_HasEvent_REAL #define SDL_HasEvents SDL_HasEvents_REAL #define SDL_FlushEvent SDL_FlushEvent_REAL #define SDL_FlushEvents SDL_FlushEvents_REAL #define SDL_PollEvent SDL_PollEvent_REAL #define SDL_WaitEvent SDL_WaitEvent_REAL #define SDL_WaitEventTimeout SDL_WaitEventTimeout_REAL #define SDL_PushEvent SDL_PushEvent_REAL #define SDL_SetEventFilter SDL_SetEventFilter_REAL #define SDL_GetEventFilter SDL_GetEventFilter_REAL #define SDL_AddEventWatch SDL_AddEventWatch_REAL #define SDL_DelEventWatch SDL_DelEventWatch_REAL #define SDL_FilterEvents SDL_FilterEvents_REAL #define SDL_EventState SDL_EventState_REAL #define SDL_RegisterEvents SDL_RegisterEvents_REAL #define SDL_GetBasePath SDL_GetBasePath_REAL #define SDL_GetPrefPath SDL_GetPrefPath_REAL #define SDL_GameControllerAddMapping SDL_GameControllerAddMapping_REAL #define SDL_GameControllerMappingForGUID SDL_GameControllerMappingForGUID_REAL #define SDL_GameControllerMapping SDL_GameControllerMapping_REAL #define SDL_IsGameController SDL_IsGameController_REAL #define SDL_GameControllerNameForIndex SDL_GameControllerNameForIndex_REAL #define SDL_GameControllerOpen SDL_GameControllerOpen_REAL #define SDL_GameControllerName SDL_GameControllerName_REAL #define SDL_GameControllerGetAttached SDL_GameControllerGetAttached_REAL #define SDL_GameControllerGetJoystick SDL_GameControllerGetJoystick_REAL #define SDL_GameControllerEventState SDL_GameControllerEventState_REAL #define SDL_GameControllerUpdate SDL_GameControllerUpdate_REAL #define SDL_GameControllerGetAxisFromString SDL_GameControllerGetAxisFromString_REAL #define SDL_GameControllerGetStringForAxis SDL_GameControllerGetStringForAxis_REAL #define SDL_GameControllerGetBindForAxis SDL_GameControllerGetBindForAxis_REAL #define SDL_GameControllerGetAxis SDL_GameControllerGetAxis_REAL #define SDL_GameControllerGetButtonFromString SDL_GameControllerGetButtonFromString_REAL #define SDL_GameControllerGetStringForButton SDL_GameControllerGetStringForButton_REAL #define SDL_GameControllerGetBindForButton SDL_GameControllerGetBindForButton_REAL #define SDL_GameControllerGetButton SDL_GameControllerGetButton_REAL #define SDL_GameControllerClose SDL_GameControllerClose_REAL #define SDL_RecordGesture SDL_RecordGesture_REAL #define SDL_SaveAllDollarTemplates SDL_SaveAllDollarTemplates_REAL #define SDL_SaveDollarTemplate SDL_SaveDollarTemplate_REAL #define SDL_LoadDollarTemplates SDL_LoadDollarTemplates_REAL #define SDL_NumHaptics SDL_NumHaptics_REAL #define SDL_HapticName SDL_HapticName_REAL #define SDL_HapticOpen SDL_HapticOpen_REAL #define SDL_HapticOpened SDL_HapticOpened_REAL #define SDL_HapticIndex SDL_HapticIndex_REAL #define SDL_MouseIsHaptic SDL_MouseIsHaptic_REAL #define SDL_HapticOpenFromMouse SDL_HapticOpenFromMouse_REAL #define SDL_JoystickIsHaptic SDL_JoystickIsHaptic_REAL #define SDL_HapticOpenFromJoystick SDL_HapticOpenFromJoystick_REAL #define SDL_HapticClose SDL_HapticClose_REAL #define SDL_HapticNumEffects SDL_HapticNumEffects_REAL #define SDL_HapticNumEffectsPlaying SDL_HapticNumEffectsPlaying_REAL #define SDL_HapticQuery SDL_HapticQuery_REAL #define SDL_HapticNumAxes SDL_HapticNumAxes_REAL #define SDL_HapticEffectSupported SDL_HapticEffectSupported_REAL #define SDL_HapticNewEffect SDL_HapticNewEffect_REAL #define SDL_HapticUpdateEffect SDL_HapticUpdateEffect_REAL #define SDL_HapticRunEffect SDL_HapticRunEffect_REAL #define SDL_HapticStopEffect SDL_HapticStopEffect_REAL #define SDL_HapticDestroyEffect SDL_HapticDestroyEffect_REAL #define SDL_HapticGetEffectStatus SDL_HapticGetEffectStatus_REAL #define SDL_HapticSetGain SDL_HapticSetGain_REAL #define SDL_HapticSetAutocenter SDL_HapticSetAutocenter_REAL #define SDL_HapticPause SDL_HapticPause_REAL #define SDL_HapticUnpause SDL_HapticUnpause_REAL #define SDL_HapticStopAll SDL_HapticStopAll_REAL #define SDL_HapticRumbleSupported SDL_HapticRumbleSupported_REAL #define SDL_HapticRumbleInit SDL_HapticRumbleInit_REAL #define SDL_HapticRumblePlay SDL_HapticRumblePlay_REAL #define SDL_HapticRumbleStop SDL_HapticRumbleStop_REAL #define SDL_SetHintWithPriority SDL_SetHintWithPriority_REAL #define SDL_SetHint SDL_SetHint_REAL #define SDL_GetHint SDL_GetHint_REAL #define SDL_AddHintCallback SDL_AddHintCallback_REAL #define SDL_DelHintCallback SDL_DelHintCallback_REAL #define SDL_ClearHints SDL_ClearHints_REAL #define SDL_NumJoysticks SDL_NumJoysticks_REAL #define SDL_JoystickNameForIndex SDL_JoystickNameForIndex_REAL #define SDL_JoystickOpen SDL_JoystickOpen_REAL #define SDL_JoystickName SDL_JoystickName_REAL #define SDL_JoystickGetDeviceGUID SDL_JoystickGetDeviceGUID_REAL #define SDL_JoystickGetGUID SDL_JoystickGetGUID_REAL #define SDL_JoystickGetGUIDString SDL_JoystickGetGUIDString_REAL #define SDL_JoystickGetGUIDFromString SDL_JoystickGetGUIDFromString_REAL #define SDL_JoystickGetAttached SDL_JoystickGetAttached_REAL #define SDL_JoystickInstanceID SDL_JoystickInstanceID_REAL #define SDL_JoystickNumAxes SDL_JoystickNumAxes_REAL #define SDL_JoystickNumBalls SDL_JoystickNumBalls_REAL #define SDL_JoystickNumHats SDL_JoystickNumHats_REAL #define SDL_JoystickNumButtons SDL_JoystickNumButtons_REAL #define SDL_JoystickUpdate SDL_JoystickUpdate_REAL #define SDL_JoystickEventState SDL_JoystickEventState_REAL #define SDL_JoystickGetAxis SDL_JoystickGetAxis_REAL #define SDL_JoystickGetHat SDL_JoystickGetHat_REAL #define SDL_JoystickGetBall SDL_JoystickGetBall_REAL #define SDL_JoystickGetButton SDL_JoystickGetButton_REAL #define SDL_JoystickClose SDL_JoystickClose_REAL #define SDL_GetKeyboardFocus SDL_GetKeyboardFocus_REAL #define SDL_GetKeyboardState SDL_GetKeyboardState_REAL #define SDL_GetModState SDL_GetModState_REAL #define SDL_SetModState SDL_SetModState_REAL #define SDL_GetKeyFromScancode SDL_GetKeyFromScancode_REAL #define SDL_GetScancodeFromKey SDL_GetScancodeFromKey_REAL #define SDL_GetScancodeName SDL_GetScancodeName_REAL #define SDL_GetScancodeFromName SDL_GetScancodeFromName_REAL #define SDL_GetKeyName SDL_GetKeyName_REAL #define SDL_GetKeyFromName SDL_GetKeyFromName_REAL #define SDL_StartTextInput SDL_StartTextInput_REAL #define SDL_IsTextInputActive SDL_IsTextInputActive_REAL #define SDL_StopTextInput SDL_StopTextInput_REAL #define SDL_SetTextInputRect SDL_SetTextInputRect_REAL #define SDL_HasScreenKeyboardSupport SDL_HasScreenKeyboardSupport_REAL #define SDL_IsScreenKeyboardShown SDL_IsScreenKeyboardShown_REAL #define SDL_LoadObject SDL_LoadObject_REAL #define SDL_LoadFunction SDL_LoadFunction_REAL #define SDL_UnloadObject SDL_UnloadObject_REAL #define SDL_LogSetAllPriority SDL_LogSetAllPriority_REAL #define SDL_LogSetPriority SDL_LogSetPriority_REAL #define SDL_LogGetPriority SDL_LogGetPriority_REAL #define SDL_LogResetPriorities SDL_LogResetPriorities_REAL #define SDL_LogMessageV SDL_LogMessageV_REAL #define SDL_LogGetOutputFunction SDL_LogGetOutputFunction_REAL #define SDL_LogSetOutputFunction SDL_LogSetOutputFunction_REAL #define SDL_SetMainReady SDL_SetMainReady_REAL #define SDL_ShowMessageBox SDL_ShowMessageBox_REAL #define SDL_ShowSimpleMessageBox SDL_ShowSimpleMessageBox_REAL #define SDL_GetMouseFocus SDL_GetMouseFocus_REAL #define SDL_GetMouseState SDL_GetMouseState_REAL #define SDL_GetRelativeMouseState SDL_GetRelativeMouseState_REAL #define SDL_WarpMouseInWindow SDL_WarpMouseInWindow_REAL #define SDL_SetRelativeMouseMode SDL_SetRelativeMouseMode_REAL #define SDL_GetRelativeMouseMode SDL_GetRelativeMouseMode_REAL #define SDL_CreateCursor SDL_CreateCursor_REAL #define SDL_CreateColorCursor SDL_CreateColorCursor_REAL #define SDL_CreateSystemCursor SDL_CreateSystemCursor_REAL #define SDL_SetCursor SDL_SetCursor_REAL #define SDL_GetCursor SDL_GetCursor_REAL #define SDL_GetDefaultCursor SDL_GetDefaultCursor_REAL #define SDL_FreeCursor SDL_FreeCursor_REAL #define SDL_ShowCursor SDL_ShowCursor_REAL #define SDL_CreateMutex SDL_CreateMutex_REAL #define SDL_LockMutex SDL_LockMutex_REAL #define SDL_TryLockMutex SDL_TryLockMutex_REAL #define SDL_UnlockMutex SDL_UnlockMutex_REAL #define SDL_DestroyMutex SDL_DestroyMutex_REAL #define SDL_CreateSemaphore SDL_CreateSemaphore_REAL #define SDL_DestroySemaphore SDL_DestroySemaphore_REAL #define SDL_SemWait SDL_SemWait_REAL #define SDL_SemTryWait SDL_SemTryWait_REAL #define SDL_SemWaitTimeout SDL_SemWaitTimeout_REAL #define SDL_SemPost SDL_SemPost_REAL #define SDL_SemValue SDL_SemValue_REAL #define SDL_CreateCond SDL_CreateCond_REAL #define SDL_DestroyCond SDL_DestroyCond_REAL #define SDL_CondSignal SDL_CondSignal_REAL #define SDL_CondBroadcast SDL_CondBroadcast_REAL #define SDL_CondWait SDL_CondWait_REAL #define SDL_CondWaitTimeout SDL_CondWaitTimeout_REAL #define SDL_GetPixelFormatName SDL_GetPixelFormatName_REAL #define SDL_PixelFormatEnumToMasks SDL_PixelFormatEnumToMasks_REAL #define SDL_MasksToPixelFormatEnum SDL_MasksToPixelFormatEnum_REAL #define SDL_AllocFormat SDL_AllocFormat_REAL #define SDL_FreeFormat SDL_FreeFormat_REAL #define SDL_AllocPalette SDL_AllocPalette_REAL #define SDL_SetPixelFormatPalette SDL_SetPixelFormatPalette_REAL #define SDL_SetPaletteColors SDL_SetPaletteColors_REAL #define SDL_FreePalette SDL_FreePalette_REAL #define SDL_MapRGB SDL_MapRGB_REAL #define SDL_MapRGBA SDL_MapRGBA_REAL #define SDL_GetRGB SDL_GetRGB_REAL #define SDL_GetRGBA SDL_GetRGBA_REAL #define SDL_CalculateGammaRamp SDL_CalculateGammaRamp_REAL #define SDL_GetPlatform SDL_GetPlatform_REAL #define SDL_GetPowerInfo SDL_GetPowerInfo_REAL #define SDL_HasIntersection SDL_HasIntersection_REAL #define SDL_IntersectRect SDL_IntersectRect_REAL #define SDL_UnionRect SDL_UnionRect_REAL #define SDL_EnclosePoints SDL_EnclosePoints_REAL #define SDL_IntersectRectAndLine SDL_IntersectRectAndLine_REAL #define SDL_GetNumRenderDrivers SDL_GetNumRenderDrivers_REAL #define SDL_GetRenderDriverInfo SDL_GetRenderDriverInfo_REAL #define SDL_CreateWindowAndRenderer SDL_CreateWindowAndRenderer_REAL #define SDL_CreateRenderer SDL_CreateRenderer_REAL #define SDL_CreateSoftwareRenderer SDL_CreateSoftwareRenderer_REAL #define SDL_GetRenderer SDL_GetRenderer_REAL #define SDL_GetRendererInfo SDL_GetRendererInfo_REAL #define SDL_GetRendererOutputSize SDL_GetRendererOutputSize_REAL #define SDL_CreateTexture SDL_CreateTexture_REAL #define SDL_CreateTextureFromSurface SDL_CreateTextureFromSurface_REAL #define SDL_QueryTexture SDL_QueryTexture_REAL #define SDL_SetTextureColorMod SDL_SetTextureColorMod_REAL #define SDL_GetTextureColorMod SDL_GetTextureColorMod_REAL #define SDL_SetTextureAlphaMod SDL_SetTextureAlphaMod_REAL #define SDL_GetTextureAlphaMod SDL_GetTextureAlphaMod_REAL #define SDL_SetTextureBlendMode SDL_SetTextureBlendMode_REAL #define SDL_GetTextureBlendMode SDL_GetTextureBlendMode_REAL #define SDL_UpdateTexture SDL_UpdateTexture_REAL #define SDL_UpdateYUVTexture SDL_UpdateYUVTexture_REAL #define SDL_LockTexture SDL_LockTexture_REAL #define SDL_UnlockTexture SDL_UnlockTexture_REAL #define SDL_RenderTargetSupported SDL_RenderTargetSupported_REAL #define SDL_SetRenderTarget SDL_SetRenderTarget_REAL #define SDL_GetRenderTarget SDL_GetRenderTarget_REAL #define SDL_RenderSetLogicalSize SDL_RenderSetLogicalSize_REAL #define SDL_RenderGetLogicalSize SDL_RenderGetLogicalSize_REAL #define SDL_RenderSetViewport SDL_RenderSetViewport_REAL #define SDL_RenderGetViewport SDL_RenderGetViewport_REAL #define SDL_RenderSetClipRect SDL_RenderSetClipRect_REAL #define SDL_RenderGetClipRect SDL_RenderGetClipRect_REAL #define SDL_RenderSetScale SDL_RenderSetScale_REAL #define SDL_RenderGetScale SDL_RenderGetScale_REAL #define SDL_SetRenderDrawColor SDL_SetRenderDrawColor_REAL #define SDL_GetRenderDrawColor SDL_GetRenderDrawColor_REAL #define SDL_SetRenderDrawBlendMode SDL_SetRenderDrawBlendMode_REAL #define SDL_GetRenderDrawBlendMode SDL_GetRenderDrawBlendMode_REAL #define SDL_RenderClear SDL_RenderClear_REAL #define SDL_RenderDrawPoint SDL_RenderDrawPoint_REAL #define SDL_RenderDrawPoints SDL_RenderDrawPoints_REAL #define SDL_RenderDrawLine SDL_RenderDrawLine_REAL #define SDL_RenderDrawLines SDL_RenderDrawLines_REAL #define SDL_RenderDrawRect SDL_RenderDrawRect_REAL #define SDL_RenderDrawRects SDL_RenderDrawRects_REAL #define SDL_RenderFillRect SDL_RenderFillRect_REAL #define SDL_RenderFillRects SDL_RenderFillRects_REAL #define SDL_RenderCopy SDL_RenderCopy_REAL #define SDL_RenderCopyEx SDL_RenderCopyEx_REAL #define SDL_RenderReadPixels SDL_RenderReadPixels_REAL #define SDL_RenderPresent SDL_RenderPresent_REAL #define SDL_DestroyTexture SDL_DestroyTexture_REAL #define SDL_DestroyRenderer SDL_DestroyRenderer_REAL #define SDL_GL_BindTexture SDL_GL_BindTexture_REAL #define SDL_GL_UnbindTexture SDL_GL_UnbindTexture_REAL #define SDL_RWFromFile SDL_RWFromFile_REAL #define SDL_RWFromMem SDL_RWFromMem_REAL #define SDL_RWFromConstMem SDL_RWFromConstMem_REAL #define SDL_AllocRW SDL_AllocRW_REAL #define SDL_FreeRW SDL_FreeRW_REAL #define SDL_ReadU8 SDL_ReadU8_REAL #define SDL_ReadLE16 SDL_ReadLE16_REAL #define SDL_ReadBE16 SDL_ReadBE16_REAL #define SDL_ReadLE32 SDL_ReadLE32_REAL #define SDL_ReadBE32 SDL_ReadBE32_REAL #define SDL_ReadLE64 SDL_ReadLE64_REAL #define SDL_ReadBE64 SDL_ReadBE64_REAL #define SDL_WriteU8 SDL_WriteU8_REAL #define SDL_WriteLE16 SDL_WriteLE16_REAL #define SDL_WriteBE16 SDL_WriteBE16_REAL #define SDL_WriteLE32 SDL_WriteLE32_REAL #define SDL_WriteBE32 SDL_WriteBE32_REAL #define SDL_WriteLE64 SDL_WriteLE64_REAL #define SDL_WriteBE64 SDL_WriteBE64_REAL #define SDL_CreateShapedWindow SDL_CreateShapedWindow_REAL #define SDL_IsShapedWindow SDL_IsShapedWindow_REAL #define SDL_SetWindowShape SDL_SetWindowShape_REAL #define SDL_GetShapedWindowMode SDL_GetShapedWindowMode_REAL #define SDL_malloc SDL_malloc_REAL #define SDL_calloc SDL_calloc_REAL #define SDL_realloc SDL_realloc_REAL #define SDL_free SDL_free_REAL #define SDL_getenv SDL_getenv_REAL #define SDL_setenv SDL_setenv_REAL #define SDL_qsort SDL_qsort_REAL #define SDL_abs SDL_abs_REAL #define SDL_isdigit SDL_isdigit_REAL #define SDL_isspace SDL_isspace_REAL #define SDL_toupper SDL_toupper_REAL #define SDL_tolower SDL_tolower_REAL #define SDL_memset SDL_memset_REAL #define SDL_memcpy SDL_memcpy_REAL #define SDL_memmove SDL_memmove_REAL #define SDL_memcmp SDL_memcmp_REAL #define SDL_wcslen SDL_wcslen_REAL #define SDL_wcslcpy SDL_wcslcpy_REAL #define SDL_wcslcat SDL_wcslcat_REAL #define SDL_strlen SDL_strlen_REAL #define SDL_strlcpy SDL_strlcpy_REAL #define SDL_utf8strlcpy SDL_utf8strlcpy_REAL #define SDL_strlcat SDL_strlcat_REAL #define SDL_strdup SDL_strdup_REAL #define SDL_strrev SDL_strrev_REAL #define SDL_strupr SDL_strupr_REAL #define SDL_strlwr SDL_strlwr_REAL #define SDL_strchr SDL_strchr_REAL #define SDL_strrchr SDL_strrchr_REAL #define SDL_strstr SDL_strstr_REAL #define SDL_itoa SDL_itoa_REAL #define SDL_uitoa SDL_uitoa_REAL #define SDL_ltoa SDL_ltoa_REAL #define SDL_ultoa SDL_ultoa_REAL #define SDL_lltoa SDL_lltoa_REAL #define SDL_ulltoa SDL_ulltoa_REAL #define SDL_atoi SDL_atoi_REAL #define SDL_atof SDL_atof_REAL #define SDL_strtol SDL_strtol_REAL #define SDL_strtoul SDL_strtoul_REAL #define SDL_strtoll SDL_strtoll_REAL #define SDL_strtoull SDL_strtoull_REAL #define SDL_strtod SDL_strtod_REAL #define SDL_strcmp SDL_strcmp_REAL #define SDL_strncmp SDL_strncmp_REAL #define SDL_strcasecmp SDL_strcasecmp_REAL #define SDL_strncasecmp SDL_strncasecmp_REAL #define SDL_vsnprintf SDL_vsnprintf_REAL #define SDL_acos SDL_acos_REAL #define SDL_asin SDL_asin_REAL #define SDL_atan SDL_atan_REAL #define SDL_atan2 SDL_atan2_REAL #define SDL_ceil SDL_ceil_REAL #define SDL_copysign SDL_copysign_REAL #define SDL_cos SDL_cos_REAL #define SDL_cosf SDL_cosf_REAL #define SDL_fabs SDL_fabs_REAL #define SDL_floor SDL_floor_REAL #define SDL_log SDL_log_REAL #define SDL_pow SDL_pow_REAL #define SDL_scalbn SDL_scalbn_REAL #define SDL_sin SDL_sin_REAL #define SDL_sinf SDL_sinf_REAL #define SDL_sqrt SDL_sqrt_REAL #define SDL_iconv_open SDL_iconv_open_REAL #define SDL_iconv_close SDL_iconv_close_REAL #define SDL_iconv SDL_iconv_REAL #define SDL_iconv_string SDL_iconv_string_REAL #define SDL_CreateRGBSurfaceWithFormat SDL_CreateRGBSurfaceWithFormat_REAL #define SDL_CreateRGBSurfaceWithFormatFrom SDL_CreateRGBSurfaceWithFormatFrom_REAL #define SDL_CreateRGBSurface SDL_CreateRGBSurface_REAL #define SDL_CreateRGBSurfaceFrom SDL_CreateRGBSurfaceFrom_REAL #define SDL_FreeSurface SDL_FreeSurface_REAL #define SDL_SetSurfacePalette SDL_SetSurfacePalette_REAL #define SDL_LockSurface SDL_LockSurface_REAL #define SDL_UnlockSurface SDL_UnlockSurface_REAL #define SDL_LoadBMP_RW SDL_LoadBMP_RW_REAL #define SDL_SaveBMP_RW SDL_SaveBMP_RW_REAL #define SDL_SetSurfaceRLE SDL_SetSurfaceRLE_REAL #define SDL_SetColorKey SDL_SetColorKey_REAL #define SDL_GetColorKey SDL_GetColorKey_REAL #define SDL_SetSurfaceColorMod SDL_SetSurfaceColorMod_REAL #define SDL_GetSurfaceColorMod SDL_GetSurfaceColorMod_REAL #define SDL_SetSurfaceAlphaMod SDL_SetSurfaceAlphaMod_REAL #define SDL_GetSurfaceAlphaMod SDL_GetSurfaceAlphaMod_REAL #define SDL_SetSurfaceBlendMode SDL_SetSurfaceBlendMode_REAL #define SDL_GetSurfaceBlendMode SDL_GetSurfaceBlendMode_REAL #define SDL_SetClipRect SDL_SetClipRect_REAL #define SDL_GetClipRect SDL_GetClipRect_REAL #define SDL_ConvertSurface SDL_ConvertSurface_REAL #define SDL_ConvertSurfaceFormat SDL_ConvertSurfaceFormat_REAL #define SDL_ConvertPixels SDL_ConvertPixels_REAL #define SDL_FillRect SDL_FillRect_REAL #define SDL_FillRects SDL_FillRects_REAL #define SDL_UpperBlit SDL_UpperBlit_REAL #define SDL_LowerBlit SDL_LowerBlit_REAL #define SDL_SoftStretch SDL_SoftStretch_REAL #define SDL_UpperBlitScaled SDL_UpperBlitScaled_REAL #define SDL_LowerBlitScaled SDL_LowerBlitScaled_REAL #define SDL_GetWindowWMInfo SDL_GetWindowWMInfo_REAL #define SDL_GetThreadName SDL_GetThreadName_REAL #define SDL_ThreadID SDL_ThreadID_REAL #define SDL_GetThreadID SDL_GetThreadID_REAL #define SDL_SetThreadPriority SDL_SetThreadPriority_REAL #define SDL_WaitThread SDL_WaitThread_REAL #define SDL_DetachThread SDL_DetachThread_REAL #define SDL_TLSCreate SDL_TLSCreate_REAL #define SDL_TLSGet SDL_TLSGet_REAL #define SDL_TLSSet SDL_TLSSet_REAL #define SDL_GetTicks SDL_GetTicks_REAL #define SDL_GetPerformanceCounter SDL_GetPerformanceCounter_REAL #define SDL_GetPerformanceFrequency SDL_GetPerformanceFrequency_REAL #define SDL_Delay SDL_Delay_REAL #define SDL_AddTimer SDL_AddTimer_REAL #define SDL_RemoveTimer SDL_RemoveTimer_REAL #define SDL_GetNumTouchDevices SDL_GetNumTouchDevices_REAL #define SDL_GetTouchDevice SDL_GetTouchDevice_REAL #define SDL_GetNumTouchFingers SDL_GetNumTouchFingers_REAL #define SDL_GetTouchFinger SDL_GetTouchFinger_REAL #define SDL_GetVersion SDL_GetVersion_REAL #define SDL_GetRevision SDL_GetRevision_REAL #define SDL_GetRevisionNumber SDL_GetRevisionNumber_REAL #define SDL_GetNumVideoDrivers SDL_GetNumVideoDrivers_REAL #define SDL_GetVideoDriver SDL_GetVideoDriver_REAL #define SDL_VideoInit SDL_VideoInit_REAL #define SDL_VideoQuit SDL_VideoQuit_REAL #define SDL_GetCurrentVideoDriver SDL_GetCurrentVideoDriver_REAL #define SDL_GetNumVideoDisplays SDL_GetNumVideoDisplays_REAL #define SDL_GetDisplayName SDL_GetDisplayName_REAL #define SDL_GetDisplayBounds SDL_GetDisplayBounds_REAL #define SDL_GetDisplayDPI SDL_GetDisplayDPI_REAL #define SDL_GetNumDisplayModes SDL_GetNumDisplayModes_REAL #define SDL_GetDisplayMode SDL_GetDisplayMode_REAL #define SDL_GetDesktopDisplayMode SDL_GetDesktopDisplayMode_REAL #define SDL_GetCurrentDisplayMode SDL_GetCurrentDisplayMode_REAL #define SDL_GetClosestDisplayMode SDL_GetClosestDisplayMode_REAL #define SDL_GetWindowDisplayIndex SDL_GetWindowDisplayIndex_REAL #define SDL_SetWindowDisplayMode SDL_SetWindowDisplayMode_REAL #define SDL_GetWindowDisplayMode SDL_GetWindowDisplayMode_REAL #define SDL_GetWindowPixelFormat SDL_GetWindowPixelFormat_REAL #define SDL_CreateWindow SDL_CreateWindow_REAL #define SDL_CreateWindowFrom SDL_CreateWindowFrom_REAL #define SDL_GetWindowID SDL_GetWindowID_REAL #define SDL_GetWindowFromID SDL_GetWindowFromID_REAL #define SDL_GetWindowFlags SDL_GetWindowFlags_REAL #define SDL_SetWindowTitle SDL_SetWindowTitle_REAL #define SDL_GetWindowTitle SDL_GetWindowTitle_REAL #define SDL_SetWindowIcon SDL_SetWindowIcon_REAL #define SDL_SetWindowData SDL_SetWindowData_REAL #define SDL_GetWindowData SDL_GetWindowData_REAL #define SDL_SetWindowPosition SDL_SetWindowPosition_REAL #define SDL_GetWindowPosition SDL_GetWindowPosition_REAL #define SDL_SetWindowSize SDL_SetWindowSize_REAL #define SDL_GetWindowSize SDL_GetWindowSize_REAL #define SDL_SetWindowMinimumSize SDL_SetWindowMinimumSize_REAL #define SDL_GetWindowMinimumSize SDL_GetWindowMinimumSize_REAL #define SDL_SetWindowMaximumSize SDL_SetWindowMaximumSize_REAL #define SDL_GetWindowMaximumSize SDL_GetWindowMaximumSize_REAL #define SDL_SetWindowBordered SDL_SetWindowBordered_REAL #define SDL_ShowWindow SDL_ShowWindow_REAL #define SDL_HideWindow SDL_HideWindow_REAL #define SDL_RaiseWindow SDL_RaiseWindow_REAL #define SDL_MaximizeWindow SDL_MaximizeWindow_REAL #define SDL_MinimizeWindow SDL_MinimizeWindow_REAL #define SDL_RestoreWindow SDL_RestoreWindow_REAL #define SDL_SetWindowFullscreen SDL_SetWindowFullscreen_REAL #define SDL_GetWindowSurface SDL_GetWindowSurface_REAL #define SDL_UpdateWindowSurface SDL_UpdateWindowSurface_REAL #define SDL_UpdateWindowSurfaceRects SDL_UpdateWindowSurfaceRects_REAL #define SDL_SetWindowGrab SDL_SetWindowGrab_REAL #define SDL_GetWindowGrab SDL_GetWindowGrab_REAL #define SDL_SetWindowBrightness SDL_SetWindowBrightness_REAL #define SDL_GetWindowBrightness SDL_GetWindowBrightness_REAL #define SDL_SetWindowGammaRamp SDL_SetWindowGammaRamp_REAL #define SDL_GetWindowGammaRamp SDL_GetWindowGammaRamp_REAL #define SDL_DestroyWindow SDL_DestroyWindow_REAL #define SDL_IsScreenSaverEnabled SDL_IsScreenSaverEnabled_REAL #define SDL_EnableScreenSaver SDL_EnableScreenSaver_REAL #define SDL_DisableScreenSaver SDL_DisableScreenSaver_REAL #define SDL_GL_LoadLibrary SDL_GL_LoadLibrary_REAL #define SDL_GL_GetProcAddress SDL_GL_GetProcAddress_REAL #define SDL_GL_UnloadLibrary SDL_GL_UnloadLibrary_REAL #define SDL_GL_ExtensionSupported SDL_GL_ExtensionSupported_REAL #define SDL_GL_SetAttribute SDL_GL_SetAttribute_REAL #define SDL_GL_GetAttribute SDL_GL_GetAttribute_REAL #define SDL_GL_CreateContext SDL_GL_CreateContext_REAL #define SDL_GL_MakeCurrent SDL_GL_MakeCurrent_REAL #define SDL_GL_GetCurrentWindow SDL_GL_GetCurrentWindow_REAL #define SDL_GL_GetCurrentContext SDL_GL_GetCurrentContext_REAL #define SDL_GL_GetDrawableSize SDL_GL_GetDrawableSize_REAL #define SDL_GL_SetSwapInterval SDL_GL_SetSwapInterval_REAL #define SDL_GL_GetSwapInterval SDL_GL_GetSwapInterval_REAL #define SDL_GL_SwapWindow SDL_GL_SwapWindow_REAL #define SDL_GL_DeleteContext SDL_GL_DeleteContext_REAL #define SDL_vsscanf SDL_vsscanf_REAL #define SDL_GameControllerAddMappingsFromRW SDL_GameControllerAddMappingsFromRW_REAL #define SDL_GL_ResetAttributes SDL_GL_ResetAttributes_REAL #define SDL_HasAVX SDL_HasAVX_REAL #define SDL_GetDefaultAssertionHandler SDL_GetDefaultAssertionHandler_REAL #define SDL_GetAssertionHandler SDL_GetAssertionHandler_REAL #define SDL_DXGIGetOutputInfo SDL_DXGIGetOutputInfo_REAL #define SDL_RenderIsClipEnabled SDL_RenderIsClipEnabled_REAL #define SDL_WinRTRunApp SDL_WinRTRunApp_REAL #define SDL_WarpMouseGlobal SDL_WarpMouseGlobal_REAL #define SDL_WinRTGetFSPathUNICODE SDL_WinRTGetFSPathUNICODE_REAL #define SDL_WinRTGetFSPathUTF8 SDL_WinRTGetFSPathUTF8_REAL #define SDL_WinRTRunApp SDL_WinRTRunApp_REAL #define SDL_sqrtf SDL_sqrtf_REAL #define SDL_tan SDL_tan_REAL #define SDL_tanf SDL_tanf_REAL #define SDL_CaptureMouse SDL_CaptureMouse_REAL #define SDL_SetWindowHitTest SDL_SetWindowHitTest_REAL #define SDL_GetGlobalMouseState SDL_GetGlobalMouseState_REAL #define SDL_HasAVX2 SDL_HasAVX2_REAL #define SDL_QueueAudio SDL_QueueAudio_REAL #define SDL_GetQueuedAudioSize SDL_GetQueuedAudioSize_REAL #define SDL_ClearQueuedAudio SDL_ClearQueuedAudio_REAL #define SDL_GetGrabbedWindow SDL_GetGrabbedWindow_REAL #define SDL_SetWindowsMessageHook SDL_SetWindowsMessageHook_REAL #define SDL_JoystickCurrentPowerLevel SDL_JoystickCurrentPowerLevel_REAL #define SDL_GameControllerFromInstanceID SDL_GameControllerFromInstanceID_REAL #define SDL_JoystickFromInstanceID SDL_JoystickFromInstanceID_REAL #define SDL_GetDisplayUsableBounds SDL_GetDisplayUsableBounds_REAL #define SDL_GetWindowBordersSize SDL_GetWindowBordersSize_REAL #define SDL_SetWindowOpacity SDL_SetWindowOpacity_REAL #define SDL_GetWindowOpacity SDL_GetWindowOpacity_REAL #define SDL_SetWindowInputFocus SDL_SetWindowInputFocus_REAL #define SDL_SetWindowModalFor SDL_SetWindowModalFor_REAL #define SDL_RenderSetIntegerScale SDL_RenderSetIntegerScale_REAL #define SDL_RenderGetIntegerScale SDL_RenderGetIntegerScale_REAL #define SDL_DequeueAudio SDL_DequeueAudio_REAL #define SDL_SetWindowResizable SDL_SetWindowResizable_REAL #define SDL_CreateRGBSurfaceWithFormat SDL_CreateRGBSurfaceWithFormat_REAL #define SDL_CreateRGBSurfaceWithFormatFrom SDL_CreateRGBSurfaceWithFormatFrom_REAL #define SDL_GetHintBoolean SDL_GetHintBoolean_REAL #define SDL_JoystickGetDeviceVendor SDL_JoystickGetDeviceVendor_REAL #define SDL_JoystickGetDeviceProduct SDL_JoystickGetDeviceProduct_REAL #define SDL_JoystickGetDeviceProductVersion SDL_JoystickGetDeviceProductVersion_REAL #define SDL_JoystickGetVendor SDL_JoystickGetVendor_REAL #define SDL_JoystickGetProduct SDL_JoystickGetProduct_REAL #define SDL_JoystickGetProductVersion SDL_JoystickGetProductVersion_REAL #define SDL_GameControllerGetVendor SDL_GameControllerGetVendor_REAL #define SDL_GameControllerGetProduct SDL_GameControllerGetProduct_REAL #define SDL_GameControllerGetProductVersion SDL_GameControllerGetProductVersion_REAL #define SDL_HasNEON SDL_HasNEON_REAL #define SDL_GameControllerNumMappings SDL_GameControllerNumMappings_REAL #define SDL_GameControllerMappingForIndex SDL_GameControllerMappingForIndex_REAL #define SDL_JoystickGetAxisInitialState SDL_JoystickGetAxisInitialState_REAL #define SDL_JoystickGetDeviceType SDL_JoystickGetDeviceType_REAL #define SDL_JoystickGetType SDL_JoystickGetType_REAL #define SDL_MemoryBarrierReleaseFunction SDL_MemoryBarrierReleaseFunction_REAL #define SDL_MemoryBarrierAcquireFunction SDL_MemoryBarrierAcquireFunction_REAL #define SDL_JoystickGetDeviceInstanceID SDL_JoystickGetDeviceInstanceID_REAL #define SDL_utf8strlen SDL_utf8strlen_REAL #define SDL_LoadFile_RW SDL_LoadFile_RW_REAL #define SDL_wcscmp SDL_wcscmp_REAL #define SDL_ComposeCustomBlendMode SDL_ComposeCustomBlendMode_REAL #define SDL_DuplicateSurface SDL_DuplicateSurface_REAL #define SDL_Vulkan_LoadLibrary SDL_Vulkan_LoadLibrary_REAL #define SDL_Vulkan_GetVkGetInstanceProcAddr SDL_Vulkan_GetVkGetInstanceProcAddr_REAL #define SDL_Vulkan_UnloadLibrary SDL_Vulkan_UnloadLibrary_REAL #define SDL_Vulkan_GetInstanceExtensions SDL_Vulkan_GetInstanceExtensions_REAL #define SDL_Vulkan_CreateSurface SDL_Vulkan_CreateSurface_REAL #define SDL_Vulkan_GetDrawableSize SDL_Vulkan_GetDrawableSize_REAL #define SDL_LockJoysticks SDL_LockJoysticks_REAL #define SDL_UnlockJoysticks SDL_UnlockJoysticks_REAL #define SDL_GetMemoryFunctions SDL_GetMemoryFunctions_REAL #define SDL_SetMemoryFunctions SDL_SetMemoryFunctions_REAL #define SDL_GetNumAllocations SDL_GetNumAllocations_REAL #define SDL_NewAudioStream SDL_NewAudioStream_REAL #define SDL_AudioStreamPut SDL_AudioStreamPut_REAL #define SDL_AudioStreamGet SDL_AudioStreamGet_REAL #define SDL_AudioStreamClear SDL_AudioStreamClear_REAL #define SDL_AudioStreamAvailable SDL_AudioStreamAvailable_REAL #define SDL_FreeAudioStream SDL_FreeAudioStream_REAL #define SDL_AudioStreamFlush SDL_AudioStreamFlush_REAL #define SDL_acosf SDL_acosf_REAL #define SDL_asinf SDL_asinf_REAL #define SDL_atanf SDL_atanf_REAL #define SDL_atan2f SDL_atan2f_REAL #define SDL_ceilf SDL_ceilf_REAL #define SDL_copysignf SDL_copysignf_REAL #define SDL_fabsf SDL_fabsf_REAL #define SDL_floorf SDL_floorf_REAL #define SDL_logf SDL_logf_REAL #define SDL_powf SDL_powf_REAL #define SDL_scalbnf SDL_scalbnf_REAL #define SDL_fmod SDL_fmod_REAL #define SDL_fmodf SDL_fmodf_REAL #define SDL_SetYUVConversionMode SDL_SetYUVConversionMode_REAL #define SDL_GetYUVConversionMode SDL_GetYUVConversionMode_REAL #define SDL_GetYUVConversionModeForResolution SDL_GetYUVConversionModeForResolution_REAL #define SDL_RenderGetMetalLayer SDL_RenderGetMetalLayer_REAL #define SDL_RenderGetMetalCommandEncoder SDL_RenderGetMetalCommandEncoder_REAL #define SDL_IsAndroidTV SDL_IsAndroidTV_REAL #define SDL_WinRTGetDeviceFamily SDL_WinRTGetDeviceFamily_REAL #define SDL_log10 SDL_log10_REAL #define SDL_log10f SDL_log10f_REAL #define SDL_GameControllerMappingForDeviceIndex SDL_GameControllerMappingForDeviceIndex_REAL #define SDL_LinuxSetThreadPriority SDL_LinuxSetThreadPriority_REAL #define SDL_HasAVX512F SDL_HasAVX512F_REAL #define SDL_IsChromebook SDL_IsChromebook_REAL #define SDL_IsDeXMode SDL_IsDeXMode_REAL #define SDL_AndroidBackButton SDL_AndroidBackButton_REAL #define SDL_exp SDL_exp_REAL #define SDL_expf SDL_expf_REAL #define SDL_wcsdup SDL_wcsdup_REAL #define SDL_GameControllerRumble SDL_GameControllerRumble_REAL #define SDL_JoystickRumble SDL_JoystickRumble_REAL #define SDL_NumSensors SDL_NumSensors_REAL #define SDL_SensorGetDeviceName SDL_SensorGetDeviceName_REAL #define SDL_SensorGetDeviceType SDL_SensorGetDeviceType_REAL #define SDL_SensorGetDeviceNonPortableType SDL_SensorGetDeviceNonPortableType_REAL #define SDL_SensorGetDeviceInstanceID SDL_SensorGetDeviceInstanceID_REAL #define SDL_SensorOpen SDL_SensorOpen_REAL #define SDL_SensorFromInstanceID SDL_SensorFromInstanceID_REAL #define SDL_SensorGetName SDL_SensorGetName_REAL #define SDL_SensorGetType SDL_SensorGetType_REAL #define SDL_SensorGetNonPortableType SDL_SensorGetNonPortableType_REAL #define SDL_SensorGetInstanceID SDL_SensorGetInstanceID_REAL #define SDL_SensorGetData SDL_SensorGetData_REAL #define SDL_SensorClose SDL_SensorClose_REAL #define SDL_SensorUpdate SDL_SensorUpdate_REAL #define SDL_IsTablet SDL_IsTablet_REAL #define SDL_GetDisplayOrientation SDL_GetDisplayOrientation_REAL #define SDL_HasColorKey SDL_HasColorKey_REAL #define SDL_CreateThreadWithStackSize SDL_CreateThreadWithStackSize_REAL #define SDL_JoystickGetDevicePlayerIndex SDL_JoystickGetDevicePlayerIndex_REAL #define SDL_JoystickGetPlayerIndex SDL_JoystickGetPlayerIndex_REAL #define SDL_GameControllerGetPlayerIndex SDL_GameControllerGetPlayerIndex_REAL #define SDL_RenderFlush SDL_RenderFlush_REAL #define SDL_RenderDrawPointF SDL_RenderDrawPointF_REAL #define SDL_RenderDrawPointsF SDL_RenderDrawPointsF_REAL #define SDL_RenderDrawLineF SDL_RenderDrawLineF_REAL #define SDL_RenderDrawLinesF SDL_RenderDrawLinesF_REAL #define SDL_RenderDrawRectF SDL_RenderDrawRectF_REAL #define SDL_RenderDrawRectsF SDL_RenderDrawRectsF_REAL #define SDL_RenderFillRectF SDL_RenderFillRectF_REAL #define SDL_RenderFillRectsF SDL_RenderFillRectsF_REAL #define SDL_RenderCopyF SDL_RenderCopyF_REAL #define SDL_RenderCopyExF SDL_RenderCopyExF_REAL #define SDL_GetTouchDeviceType SDL_GetTouchDeviceType_REAL #define SDL_UIKitRunApp SDL_UIKitRunApp_REAL #define SDL_SIMDGetAlignment SDL_SIMDGetAlignment_REAL #define SDL_SIMDAlloc SDL_SIMDAlloc_REAL #define SDL_SIMDRealloc SDL_SIMDRealloc_REAL #define SDL_SIMDFree SDL_SIMDFree_REAL #define SDL_RWsize SDL_RWsize_REAL #define SDL_RWseek SDL_RWseek_REAL #define SDL_RWtell SDL_RWtell_REAL #define SDL_RWread SDL_RWread_REAL #define SDL_RWwrite SDL_RWwrite_REAL #define SDL_RWclose SDL_RWclose_REAL #define SDL_LoadFile SDL_LoadFile_REAL #define SDL_Metal_CreateView SDL_Metal_CreateView_REAL #define SDL_Metal_DestroyView SDL_Metal_DestroyView_REAL #define SDL_LockTextureToSurface SDL_LockTextureToSurface_REAL #define SDL_HasARMSIMD SDL_HasARMSIMD_REAL #define SDL_strtokr SDL_strtokr_REAL #define SDL_wcsstr SDL_wcsstr_REAL #define SDL_wcsncmp SDL_wcsncmp_REAL #define SDL_GameControllerTypeForIndex SDL_GameControllerTypeForIndex_REAL #define SDL_GameControllerGetType SDL_GameControllerGetType_REAL #define SDL_GameControllerFromPlayerIndex SDL_GameControllerFromPlayerIndex_REAL #define SDL_GameControllerSetPlayerIndex SDL_GameControllerSetPlayerIndex_REAL #define SDL_JoystickFromPlayerIndex SDL_JoystickFromPlayerIndex_REAL #define SDL_JoystickSetPlayerIndex SDL_JoystickSetPlayerIndex_REAL #define SDL_SetTextureScaleMode SDL_SetTextureScaleMode_REAL #define SDL_GetTextureScaleMode SDL_GetTextureScaleMode_REAL #define SDL_OnApplicationWillTerminate SDL_OnApplicationWillTerminate_REAL #define SDL_OnApplicationDidReceiveMemoryWarning SDL_OnApplicationDidReceiveMemoryWarning_REAL #define SDL_OnApplicationWillResignActive SDL_OnApplicationWillResignActive_REAL #define SDL_OnApplicationDidEnterBackground SDL_OnApplicationDidEnterBackground_REAL #define SDL_OnApplicationWillEnterForeground SDL_OnApplicationWillEnterForeground_REAL #define SDL_OnApplicationDidBecomeActive SDL_OnApplicationDidBecomeActive_REAL #define SDL_OnApplicationDidChangeStatusBarOrientation SDL_OnApplicationDidChangeStatusBarOrientation_REAL #define SDL_GetAndroidSDKVersion SDL_GetAndroidSDKVersion_REAL #define SDL_isupper SDL_isupper_REAL #define SDL_islower SDL_islower_REAL #define SDL_JoystickAttachVirtual SDL_JoystickAttachVirtual_REAL #define SDL_JoystickDetachVirtual SDL_JoystickDetachVirtual_REAL #define SDL_JoystickIsVirtual SDL_JoystickIsVirtual_REAL #define SDL_JoystickSetVirtualAxis SDL_JoystickSetVirtualAxis_REAL #define SDL_JoystickSetVirtualBall SDL_JoystickSetVirtualBall_REAL #define SDL_JoystickSetVirtualButton SDL_JoystickSetVirtualButton_REAL #define SDL_JoystickSetVirtualHat SDL_JoystickSetVirtualHat_REAL #define SDL_GetErrorMsg SDL_GetErrorMsg_REAL #define SDL_LockSensors SDL_LockSensors_REAL #define SDL_UnlockSensors SDL_UnlockSensors_REAL #define SDL_Metal_GetLayer SDL_Metal_GetLayer_REAL #define SDL_Metal_GetDrawableSize SDL_Metal_GetDrawableSize_REAL #define SDL_trunc SDL_trunc_REAL #define SDL_truncf SDL_truncf_REAL #define SDL_GetPreferredLocales SDL_GetPreferredLocales_REAL
YifuLiu/AliOS-Things
components/SDL2/src/dynapi/SDL_dynapi_overrides.h
C
apache-2.0
39,277
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* vi: set ts=4 sw=4 expandtab: */ /* DO NOT EDIT THIS FILE BY HAND. It is autogenerated by gendynapi.pl. NEVER REARRANGE THIS FILE, THE ORDER IS ABI LAW. Changing this file means bumping SDL_DYNAPI_VERSION. You can safely add new items to the end of the file, though. Also, this file gets included multiple times, don't add #pragma once, etc. */ /* direct jump magic can use these, the rest needs special code. */ #if !SDL_DYNAPI_PROC_NO_VARARGS SDL_DYNAPI_PROC(int,SDL_SetError,(SDL_PRINTF_FORMAT_STRING const char *a, ...),(a),return) SDL_DYNAPI_PROC(void,SDL_Log,(SDL_PRINTF_FORMAT_STRING const char *a, ...),(a),) SDL_DYNAPI_PROC(void,SDL_LogVerbose,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),) SDL_DYNAPI_PROC(void,SDL_LogDebug,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),) SDL_DYNAPI_PROC(void,SDL_LogInfo,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),) SDL_DYNAPI_PROC(void,SDL_LogWarn,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),) SDL_DYNAPI_PROC(void,SDL_LogError,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),) SDL_DYNAPI_PROC(void,SDL_LogCritical,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),) SDL_DYNAPI_PROC(void,SDL_LogMessage,(int a, SDL_LogPriority b, SDL_PRINTF_FORMAT_STRING const char *c, ...),(a,b,c),) SDL_DYNAPI_PROC(int,SDL_sscanf,(const char *a, SDL_SCANF_FORMAT_STRING const char *b, ...),(a,b),return) SDL_DYNAPI_PROC(int,SDL_snprintf,(SDL_OUT_Z_CAP(b) char *a, size_t b, SDL_PRINTF_FORMAT_STRING const char *c, ...),(a,b,c),return) #endif #ifdef SDL_CreateThread #undef SDL_CreateThread #endif #if defined(__WIN32__) SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return) #elif defined(__OS2__) SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return) #else SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c),(a,b,c),return) #endif #ifdef HAVE_STDIO_H SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromFP,(FILE *a, SDL_bool b),(a,b),return) #else SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromFP,(void *a, SDL_bool b),(a,b),return) #endif #ifdef __WIN32__ SDL_DYNAPI_PROC(int,SDL_RegisterApp,(char *a, Uint32 b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_UnregisterApp,(void),(),) SDL_DYNAPI_PROC(int,SDL_Direct3D9GetAdapterIndex,(int a),(a),return) SDL_DYNAPI_PROC(IDirect3DDevice9*,SDL_RenderGetD3D9Device,(SDL_Renderer *a),(a),return) #endif #ifdef __IPHONEOS__ SDL_DYNAPI_PROC(int,SDL_iPhoneSetAnimationCallback,(SDL_Window *a, int b, void c, void *d),(a,b,c,d),return) SDL_DYNAPI_PROC(void,SDL_iPhoneSetEventPump,(SDL_bool a),(a),) #endif #ifdef __ANDROID__ SDL_DYNAPI_PROC(void*,SDL_AndroidGetJNIEnv,(void),(),return) SDL_DYNAPI_PROC(void*,SDL_AndroidGetActivity,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_AndroidGetInternalStoragePath,(void),(),return) SDL_DYNAPI_PROC(int,SDL_AndroidGetExternalStorageState,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_AndroidGetExternalStoragePath,(void),(),return) #endif SDL_DYNAPI_PROC(int,SDL_Init,(Uint32 a),(a),return) SDL_DYNAPI_PROC(int,SDL_InitSubSystem,(Uint32 a),(a),return) SDL_DYNAPI_PROC(void,SDL_QuitSubSystem,(Uint32 a),(a),) SDL_DYNAPI_PROC(Uint32,SDL_WasInit,(Uint32 a),(a),return) SDL_DYNAPI_PROC(void,SDL_Quit,(void),(),) SDL_DYNAPI_PROC(SDL_assert_state,SDL_ReportAssertion,(SDL_assert_data *a, const char *b, const char *c, int d),(a,b,c,d),return) SDL_DYNAPI_PROC(void,SDL_SetAssertionHandler,(SDL_AssertionHandler a, void *b),(a,b),) SDL_DYNAPI_PROC(const SDL_assert_data*,SDL_GetAssertionReport,(void),(),return) SDL_DYNAPI_PROC(void,SDL_ResetAssertionReport,(void),(),) SDL_DYNAPI_PROC(SDL_bool,SDL_AtomicTryLock,(SDL_SpinLock *a),(a),return) SDL_DYNAPI_PROC(void,SDL_AtomicLock,(SDL_SpinLock *a),(a),) SDL_DYNAPI_PROC(void,SDL_AtomicUnlock,(SDL_SpinLock *a),(a),) SDL_DYNAPI_PROC(SDL_bool,SDL_AtomicCAS,(SDL_atomic_t *a, int b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_AtomicSet,(SDL_atomic_t *a, int b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_AtomicGet,(SDL_atomic_t *a),(a),return) SDL_DYNAPI_PROC(int,SDL_AtomicAdd,(SDL_atomic_t *a, int b),(a,b),return) SDL_DYNAPI_PROC(SDL_bool,SDL_AtomicCASPtr,(void **a, void *b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(void*,SDL_AtomicSetPtr,(void **a, void *b),(a,b),return) SDL_DYNAPI_PROC(void*,SDL_AtomicGetPtr,(void **a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetNumAudioDrivers,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetAudioDriver,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_AudioInit,(const char *a),(a),return) SDL_DYNAPI_PROC(void,SDL_AudioQuit,(void),(),) SDL_DYNAPI_PROC(const char*,SDL_GetCurrentAudioDriver,(void),(),return) SDL_DYNAPI_PROC(int,SDL_OpenAudio,(SDL_AudioSpec *a, SDL_AudioSpec *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetNumAudioDevices,(int a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetAudioDeviceName,(int a, int b),(a,b),return) SDL_DYNAPI_PROC(SDL_AudioDeviceID,SDL_OpenAudioDevice,(const char *a, int b, const SDL_AudioSpec *c, SDL_AudioSpec *d, int e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(SDL_AudioStatus,SDL_GetAudioStatus,(void),(),return) SDL_DYNAPI_PROC(SDL_AudioStatus,SDL_GetAudioDeviceStatus,(SDL_AudioDeviceID a),(a),return) SDL_DYNAPI_PROC(void,SDL_PauseAudio,(int a),(a),) SDL_DYNAPI_PROC(void,SDL_PauseAudioDevice,(SDL_AudioDeviceID a, int b),(a,b),) SDL_DYNAPI_PROC(SDL_AudioSpec*,SDL_LoadWAV_RW,(SDL_RWops *a, int b, SDL_AudioSpec *c, Uint8 **d, Uint32 *e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(void,SDL_FreeWAV,(Uint8 *a),(a),) SDL_DYNAPI_PROC(int,SDL_BuildAudioCVT,(SDL_AudioCVT *a, SDL_AudioFormat b, Uint8 c, int d, SDL_AudioFormat e, Uint8 f, int g),(a,b,c,d,e,f,g),return) SDL_DYNAPI_PROC(int,SDL_ConvertAudio,(SDL_AudioCVT *a),(a),return) SDL_DYNAPI_PROC(void,SDL_MixAudio,(Uint8 *a, const Uint8 *b, Uint32 c, int d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_MixAudioFormat,(Uint8 *a, const Uint8 *b, SDL_AudioFormat c, Uint32 d, int e),(a,b,c,d,e),) SDL_DYNAPI_PROC(void,SDL_LockAudio,(void),(),) SDL_DYNAPI_PROC(void,SDL_LockAudioDevice,(SDL_AudioDeviceID a),(a),) SDL_DYNAPI_PROC(void,SDL_UnlockAudio,(void),(),) SDL_DYNAPI_PROC(void,SDL_UnlockAudioDevice,(SDL_AudioDeviceID a),(a),) SDL_DYNAPI_PROC(void,SDL_CloseAudio,(void),(),) SDL_DYNAPI_PROC(void,SDL_CloseAudioDevice,(SDL_AudioDeviceID a),(a),) SDL_DYNAPI_PROC(int,SDL_SetClipboardText,(const char *a),(a),return) SDL_DYNAPI_PROC(char*,SDL_GetClipboardText,(void),(),return) SDL_DYNAPI_PROC(SDL_bool,SDL_HasClipboardText,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetCPUCount,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetCPUCacheLineSize,(void),(),return) SDL_DYNAPI_PROC(SDL_bool,SDL_HasRDTSC,(void),(),return) SDL_DYNAPI_PROC(SDL_bool,SDL_HasAltiVec,(void),(),return) SDL_DYNAPI_PROC(SDL_bool,SDL_HasMMX,(void),(),return) SDL_DYNAPI_PROC(SDL_bool,SDL_Has3DNow,(void),(),return) SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE,(void),(),return) SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE2,(void),(),return) SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE3,(void),(),return) SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE41,(void),(),return) SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE42,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetSystemRAM,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetError,(void),(),return) SDL_DYNAPI_PROC(void,SDL_ClearError,(void),(),) SDL_DYNAPI_PROC(int,SDL_Error,(SDL_errorcode a),(a),return) SDL_DYNAPI_PROC(void,SDL_PumpEvents,(void),(),) SDL_DYNAPI_PROC(int,SDL_PeepEvents,(SDL_Event *a, int b, SDL_eventaction c, Uint32 d, Uint32 e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(SDL_bool,SDL_HasEvent,(Uint32 a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_HasEvents,(Uint32 a, Uint32 b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_FlushEvent,(Uint32 a),(a),) SDL_DYNAPI_PROC(void,SDL_FlushEvents,(Uint32 a, Uint32 b),(a,b),) SDL_DYNAPI_PROC(int,SDL_PollEvent,(SDL_Event *a),(a),return) SDL_DYNAPI_PROC(int,SDL_WaitEvent,(SDL_Event *a),(a),return) SDL_DYNAPI_PROC(int,SDL_WaitEventTimeout,(SDL_Event *a, int b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_PushEvent,(SDL_Event *a),(a),return) SDL_DYNAPI_PROC(void,SDL_SetEventFilter,(SDL_EventFilter a, void *b),(a,b),) SDL_DYNAPI_PROC(SDL_bool,SDL_GetEventFilter,(SDL_EventFilter *a, void **b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_AddEventWatch,(SDL_EventFilter a, void *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_DelEventWatch,(SDL_EventFilter a, void *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_FilterEvents,(SDL_EventFilter a, void *b),(a,b),) SDL_DYNAPI_PROC(Uint8,SDL_EventState,(Uint32 a, int b),(a,b),return) SDL_DYNAPI_PROC(Uint32,SDL_RegisterEvents,(int a),(a),return) SDL_DYNAPI_PROC(char*,SDL_GetBasePath,(void),(),return) SDL_DYNAPI_PROC(char*,SDL_GetPrefPath,(const char *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GameControllerAddMapping,(const char *a),(a),return) SDL_DYNAPI_PROC(char*,SDL_GameControllerMappingForGUID,(SDL_JoystickGUID a),(a),return) SDL_DYNAPI_PROC(char*,SDL_GameControllerMapping,(SDL_GameController *a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_IsGameController,(int a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GameControllerNameForIndex,(int a),(a),return) SDL_DYNAPI_PROC(SDL_GameController*,SDL_GameControllerOpen,(int a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GameControllerName,(SDL_GameController *a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerGetAttached,(SDL_GameController *a),(a),return) SDL_DYNAPI_PROC(SDL_Joystick*,SDL_GameControllerGetJoystick,(SDL_GameController *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GameControllerEventState,(int a),(a),return) SDL_DYNAPI_PROC(void,SDL_GameControllerUpdate,(void),(),) SDL_DYNAPI_PROC(SDL_GameControllerAxis,SDL_GameControllerGetAxisFromString,(const char *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GameControllerGetStringForAxis,(SDL_GameControllerAxis a),(a),return) SDL_DYNAPI_PROC(SDL_GameControllerButtonBind,SDL_GameControllerGetBindForAxis,(SDL_GameController *a, SDL_GameControllerAxis b),(a,b),return) SDL_DYNAPI_PROC(Sint16,SDL_GameControllerGetAxis,(SDL_GameController *a, SDL_GameControllerAxis b),(a,b),return) SDL_DYNAPI_PROC(SDL_GameControllerButton,SDL_GameControllerGetButtonFromString,(const char *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GameControllerGetStringForButton,(SDL_GameControllerButton a),(a),return) SDL_DYNAPI_PROC(SDL_GameControllerButtonBind,SDL_GameControllerGetBindForButton,(SDL_GameController *a, SDL_GameControllerButton b),(a,b),return) SDL_DYNAPI_PROC(Uint8,SDL_GameControllerGetButton,(SDL_GameController *a, SDL_GameControllerButton b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_GameControllerClose,(SDL_GameController *a),(a),) SDL_DYNAPI_PROC(int,SDL_RecordGesture,(SDL_TouchID a),(a),return) SDL_DYNAPI_PROC(int,SDL_SaveAllDollarTemplates,(SDL_RWops *a),(a),return) SDL_DYNAPI_PROC(int,SDL_SaveDollarTemplate,(SDL_GestureID a, SDL_RWops *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_LoadDollarTemplates,(SDL_TouchID a, SDL_RWops *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_NumHaptics,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_HapticName,(int a),(a),return) SDL_DYNAPI_PROC(SDL_Haptic*,SDL_HapticOpen,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_HapticOpened,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_HapticIndex,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(int,SDL_MouseIsHaptic,(void),(),return) SDL_DYNAPI_PROC(SDL_Haptic*,SDL_HapticOpenFromMouse,(void),(),return) SDL_DYNAPI_PROC(int,SDL_JoystickIsHaptic,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(SDL_Haptic*,SDL_HapticOpenFromJoystick,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(void,SDL_HapticClose,(SDL_Haptic *a),(a),) SDL_DYNAPI_PROC(int,SDL_HapticNumEffects,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(int,SDL_HapticNumEffectsPlaying,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(unsigned int,SDL_HapticQuery,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(int,SDL_HapticNumAxes,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(int,SDL_HapticEffectSupported,(SDL_Haptic *a, SDL_HapticEffect *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_HapticNewEffect,(SDL_Haptic *a, SDL_HapticEffect *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_HapticUpdateEffect,(SDL_Haptic *a, int b, SDL_HapticEffect *c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_HapticRunEffect,(SDL_Haptic *a, int b, Uint32 c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_HapticStopEffect,(SDL_Haptic *a, int b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_HapticDestroyEffect,(SDL_Haptic *a, int b),(a,b),) SDL_DYNAPI_PROC(int,SDL_HapticGetEffectStatus,(SDL_Haptic *a, int b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_HapticSetGain,(SDL_Haptic *a, int b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_HapticSetAutocenter,(SDL_Haptic *a, int b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_HapticPause,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(int,SDL_HapticUnpause,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(int,SDL_HapticStopAll,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(int,SDL_HapticRumbleSupported,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(int,SDL_HapticRumbleInit,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(int,SDL_HapticRumblePlay,(SDL_Haptic *a, float b, Uint32 c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_HapticRumbleStop,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_SetHintWithPriority,(const char *a, const char *b, SDL_HintPriority c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_bool,SDL_SetHint,(const char *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(const char*,SDL_GetHint,(const char *a),(a),return) SDL_DYNAPI_PROC(void,SDL_AddHintCallback,(const char *a, SDL_HintCallback b, void *c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_DelHintCallback,(const char *a, SDL_HintCallback b, void *c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_ClearHints,(void),(),) SDL_DYNAPI_PROC(int,SDL_NumJoysticks,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_JoystickNameForIndex,(int a),(a),return) SDL_DYNAPI_PROC(SDL_Joystick*,SDL_JoystickOpen,(int a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_JoystickName,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(SDL_JoystickGUID,SDL_JoystickGetDeviceGUID,(int a),(a),return) SDL_DYNAPI_PROC(SDL_JoystickGUID,SDL_JoystickGetGUID,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(void,SDL_JoystickGetGUIDString,(SDL_JoystickGUID a, char *b, int c),(a,b,c),) SDL_DYNAPI_PROC(SDL_JoystickGUID,SDL_JoystickGetGUIDFromString,(const char *a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickGetAttached,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(SDL_JoystickID,SDL_JoystickInstanceID,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(int,SDL_JoystickNumAxes,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(int,SDL_JoystickNumBalls,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(int,SDL_JoystickNumHats,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(int,SDL_JoystickNumButtons,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(void,SDL_JoystickUpdate,(void),(),) SDL_DYNAPI_PROC(int,SDL_JoystickEventState,(int a),(a),return) SDL_DYNAPI_PROC(Sint16,SDL_JoystickGetAxis,(SDL_Joystick *a, int b),(a,b),return) SDL_DYNAPI_PROC(Uint8,SDL_JoystickGetHat,(SDL_Joystick *a, int b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_JoystickGetBall,(SDL_Joystick *a, int b, int *c, int *d),(a,b,c,d),return) SDL_DYNAPI_PROC(Uint8,SDL_JoystickGetButton,(SDL_Joystick *a, int b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_JoystickClose,(SDL_Joystick *a),(a),) SDL_DYNAPI_PROC(SDL_Window*,SDL_GetKeyboardFocus,(void),(),return) SDL_DYNAPI_PROC(const Uint8*,SDL_GetKeyboardState,(int *a),(a),return) SDL_DYNAPI_PROC(SDL_Keymod,SDL_GetModState,(void),(),return) SDL_DYNAPI_PROC(void,SDL_SetModState,(SDL_Keymod a),(a),) SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromScancode,(SDL_Scancode a),(a),return) SDL_DYNAPI_PROC(SDL_Scancode,SDL_GetScancodeFromKey,(SDL_Keycode a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetScancodeName,(SDL_Scancode a),(a),return) SDL_DYNAPI_PROC(SDL_Scancode,SDL_GetScancodeFromName,(const char *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetKeyName,(SDL_Keycode a),(a),return) SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromName,(const char *a),(a),return) SDL_DYNAPI_PROC(void,SDL_StartTextInput,(void),(),) SDL_DYNAPI_PROC(SDL_bool,SDL_IsTextInputActive,(void),(),return) SDL_DYNAPI_PROC(void,SDL_StopTextInput,(void),(),) SDL_DYNAPI_PROC(void,SDL_SetTextInputRect,(SDL_Rect *a),(a),) SDL_DYNAPI_PROC(SDL_bool,SDL_HasScreenKeyboardSupport,(void),(),return) SDL_DYNAPI_PROC(SDL_bool,SDL_IsScreenKeyboardShown,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(void*,SDL_LoadObject,(const char *a),(a),return) SDL_DYNAPI_PROC(void*,SDL_LoadFunction,(void *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_UnloadObject,(void *a),(a),) SDL_DYNAPI_PROC(void,SDL_LogSetAllPriority,(SDL_LogPriority a),(a),) SDL_DYNAPI_PROC(void,SDL_LogSetPriority,(int a, SDL_LogPriority b),(a,b),) SDL_DYNAPI_PROC(SDL_LogPriority,SDL_LogGetPriority,(int a),(a),return) SDL_DYNAPI_PROC(void,SDL_LogResetPriorities,(void),(),) SDL_DYNAPI_PROC(void,SDL_LogMessageV,(int a, SDL_LogPriority b, const char *c, va_list d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_LogGetOutputFunction,(SDL_LogOutputFunction *a, void **b),(a,b),) SDL_DYNAPI_PROC(void,SDL_LogSetOutputFunction,(SDL_LogOutputFunction a, void *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_SetMainReady,(void),(),) SDL_DYNAPI_PROC(int,SDL_ShowMessageBox,(const SDL_MessageBoxData *a, int *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_ShowSimpleMessageBox,(Uint32 a, const char *b, const char *c, SDL_Window *d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_GetMouseFocus,(void),(),return) SDL_DYNAPI_PROC(Uint32,SDL_GetMouseState,(int *a, int *b),(a,b),return) SDL_DYNAPI_PROC(Uint32,SDL_GetRelativeMouseState,(int *a, int *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_WarpMouseInWindow,(SDL_Window *a, int b, int c),(a,b,c),) SDL_DYNAPI_PROC(int,SDL_SetRelativeMouseMode,(SDL_bool a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_GetRelativeMouseMode,(void),(),return) SDL_DYNAPI_PROC(SDL_Cursor*,SDL_CreateCursor,(const Uint8 *a, const Uint8 *b, int c, int d, int e, int f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(SDL_Cursor*,SDL_CreateColorCursor,(SDL_Surface *a, int b, int c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_Cursor*,SDL_CreateSystemCursor,(SDL_SystemCursor a),(a),return) SDL_DYNAPI_PROC(void,SDL_SetCursor,(SDL_Cursor *a),(a),) SDL_DYNAPI_PROC(SDL_Cursor*,SDL_GetCursor,(void),(),return) SDL_DYNAPI_PROC(SDL_Cursor*,SDL_GetDefaultCursor,(void),(),return) SDL_DYNAPI_PROC(void,SDL_FreeCursor,(SDL_Cursor *a),(a),) SDL_DYNAPI_PROC(int,SDL_ShowCursor,(int a),(a),return) SDL_DYNAPI_PROC(SDL_mutex*,SDL_CreateMutex,(void),(),return) SDL_DYNAPI_PROC(int,SDL_LockMutex,(SDL_mutex *a),(a),return) SDL_DYNAPI_PROC(int,SDL_TryLockMutex,(SDL_mutex *a),(a),return) SDL_DYNAPI_PROC(int,SDL_UnlockMutex,(SDL_mutex *a),(a),return) SDL_DYNAPI_PROC(void,SDL_DestroyMutex,(SDL_mutex *a),(a),) SDL_DYNAPI_PROC(SDL_sem*,SDL_CreateSemaphore,(Uint32 a),(a),return) SDL_DYNAPI_PROC(void,SDL_DestroySemaphore,(SDL_sem *a),(a),) SDL_DYNAPI_PROC(int,SDL_SemWait,(SDL_sem *a),(a),return) SDL_DYNAPI_PROC(int,SDL_SemTryWait,(SDL_sem *a),(a),return) SDL_DYNAPI_PROC(int,SDL_SemWaitTimeout,(SDL_sem *a, Uint32 b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SemPost,(SDL_sem *a),(a),return) SDL_DYNAPI_PROC(Uint32,SDL_SemValue,(SDL_sem *a),(a),return) SDL_DYNAPI_PROC(SDL_cond*,SDL_CreateCond,(void),(),return) SDL_DYNAPI_PROC(void,SDL_DestroyCond,(SDL_cond *a),(a),) SDL_DYNAPI_PROC(int,SDL_CondSignal,(SDL_cond *a),(a),return) SDL_DYNAPI_PROC(int,SDL_CondBroadcast,(SDL_cond *a),(a),return) SDL_DYNAPI_PROC(int,SDL_CondWait,(SDL_cond *a, SDL_mutex *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_CondWaitTimeout,(SDL_cond *a, SDL_mutex *b, Uint32 c),(a,b,c),return) SDL_DYNAPI_PROC(const char*,SDL_GetPixelFormatName,(Uint32 a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_PixelFormatEnumToMasks,(Uint32 a, int *b, Uint32 *c, Uint32 *d, Uint32 *e, Uint32 *f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(Uint32,SDL_MasksToPixelFormatEnum,(int a, Uint32 b, Uint32 c, Uint32 d, Uint32 e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(SDL_PixelFormat*,SDL_AllocFormat,(Uint32 a),(a),return) SDL_DYNAPI_PROC(void,SDL_FreeFormat,(SDL_PixelFormat *a),(a),) SDL_DYNAPI_PROC(SDL_Palette*,SDL_AllocPalette,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_SetPixelFormatPalette,(SDL_PixelFormat *a, SDL_Palette *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SetPaletteColors,(SDL_Palette *a, const SDL_Color *b, int c, int d),(a,b,c,d),return) SDL_DYNAPI_PROC(void,SDL_FreePalette,(SDL_Palette *a),(a),) SDL_DYNAPI_PROC(Uint32,SDL_MapRGB,(const SDL_PixelFormat *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return) SDL_DYNAPI_PROC(Uint32,SDL_MapRGBA,(const SDL_PixelFormat *a, Uint8 b, Uint8 c, Uint8 d, Uint8 e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(void,SDL_GetRGB,(Uint32 a, const SDL_PixelFormat *b, Uint8 *c, Uint8 *d, Uint8 *e),(a,b,c,d,e),) SDL_DYNAPI_PROC(void,SDL_GetRGBA,(Uint32 a, const SDL_PixelFormat *b, Uint8 *c, Uint8 *d, Uint8 *e, Uint8 *f),(a,b,c,d,e,f),) SDL_DYNAPI_PROC(void,SDL_CalculateGammaRamp,(float a, Uint16 *b),(a,b),) SDL_DYNAPI_PROC(const char*,SDL_GetPlatform,(void),(),return) SDL_DYNAPI_PROC(SDL_PowerState,SDL_GetPowerInfo,(int *a, int *b),(a,b),return) SDL_DYNAPI_PROC(SDL_bool,SDL_HasIntersection,(const SDL_Rect *a, const SDL_Rect *b),(a,b),return) SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectRect,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_UnionRect,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c),(a,b,c),) SDL_DYNAPI_PROC(SDL_bool,SDL_EnclosePoints,(const SDL_Point *a, int b, const SDL_Rect *c, SDL_Rect *d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectRectAndLine,(const SDL_Rect *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(int,SDL_GetNumRenderDrivers,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetRenderDriverInfo,(int a, SDL_RendererInfo *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_CreateWindowAndRenderer,(int a, int b, Uint32 c, SDL_Window **d, SDL_Renderer **e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateRenderer,(SDL_Window *a, int b, Uint32 c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateSoftwareRenderer,(SDL_Surface *a),(a),return) SDL_DYNAPI_PROC(SDL_Renderer*,SDL_GetRenderer,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetRendererInfo,(SDL_Renderer *a, SDL_RendererInfo *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetRendererOutputSize,(SDL_Renderer *a, int *b, int *c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_Texture*,SDL_CreateTexture,(SDL_Renderer *a, Uint32 b, int c, int d, int e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(SDL_Texture*,SDL_CreateTextureFromSurface,(SDL_Renderer *a, SDL_Surface *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_QueryTexture,(SDL_Texture *a, Uint32 *b, int *c, int *d, int *e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(int,SDL_SetTextureColorMod,(SDL_Texture *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_GetTextureColorMod,(SDL_Texture *a, Uint8 *b, Uint8 *c, Uint8 *d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_SetTextureAlphaMod,(SDL_Texture *a, Uint8 b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetTextureAlphaMod,(SDL_Texture *a, Uint8 *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SetTextureBlendMode,(SDL_Texture *a, SDL_BlendMode b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetTextureBlendMode,(SDL_Texture *a, SDL_BlendMode *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_UpdateTexture,(SDL_Texture *a, const SDL_Rect *b, const void *c, int d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_UpdateYUVTexture,(SDL_Texture *a, const SDL_Rect *b, const Uint8 *c, int d, const Uint8 *e, int f, const Uint8 *g, int h),(a,b,c,d,e,f,g,h),return) SDL_DYNAPI_PROC(int,SDL_LockTexture,(SDL_Texture *a, const SDL_Rect *b, void **c, int *d),(a,b,c,d),return) SDL_DYNAPI_PROC(void,SDL_UnlockTexture,(SDL_Texture *a),(a),) SDL_DYNAPI_PROC(SDL_bool,SDL_RenderTargetSupported,(SDL_Renderer *a),(a),return) SDL_DYNAPI_PROC(int,SDL_SetRenderTarget,(SDL_Renderer *a, SDL_Texture *b),(a,b),return) SDL_DYNAPI_PROC(SDL_Texture*,SDL_GetRenderTarget,(SDL_Renderer *a),(a),return) SDL_DYNAPI_PROC(int,SDL_RenderSetLogicalSize,(SDL_Renderer *a, int b, int c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_RenderGetLogicalSize,(SDL_Renderer *a, int *b, int *c),(a,b,c),) SDL_DYNAPI_PROC(int,SDL_RenderSetViewport,(SDL_Renderer *a, const SDL_Rect *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_RenderGetViewport,(SDL_Renderer *a, SDL_Rect *b),(a,b),) SDL_DYNAPI_PROC(int,SDL_RenderSetClipRect,(SDL_Renderer *a, const SDL_Rect *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_RenderGetClipRect,(SDL_Renderer *a, SDL_Rect *b),(a,b),) SDL_DYNAPI_PROC(int,SDL_RenderSetScale,(SDL_Renderer *a, float b, float c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_RenderGetScale,(SDL_Renderer *a, float *b, float *c),(a,b,c),) SDL_DYNAPI_PROC(int,SDL_SetRenderDrawColor,(SDL_Renderer *a, Uint8 b, Uint8 c, Uint8 d, Uint8 e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(int,SDL_GetRenderDrawColor,(SDL_Renderer *a, Uint8 *b, Uint8 *c, Uint8 *d, Uint8 *e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(int,SDL_SetRenderDrawBlendMode,(SDL_Renderer *a, SDL_BlendMode b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetRenderDrawBlendMode,(SDL_Renderer *a, SDL_BlendMode *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_RenderClear,(SDL_Renderer *a),(a),return) SDL_DYNAPI_PROC(int,SDL_RenderDrawPoint,(SDL_Renderer *a, int b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_RenderDrawPoints,(SDL_Renderer *a, const SDL_Point *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_RenderDrawLine,(SDL_Renderer *a, int b, int c, int d, int e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(int,SDL_RenderDrawLines,(SDL_Renderer *a, const SDL_Point *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_RenderDrawRect,(SDL_Renderer *a, const SDL_Rect *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_RenderDrawRects,(SDL_Renderer *a, const SDL_Rect *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_RenderFillRect,(SDL_Renderer *a, const SDL_Rect *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_RenderFillRects,(SDL_Renderer *a, const SDL_Rect *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_RenderCopy,(SDL_Renderer *a, SDL_Texture *b, const SDL_Rect *c, const SDL_Rect *d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_RenderCopyEx,(SDL_Renderer *a, SDL_Texture *b, const SDL_Rect *c, const SDL_Rect *d, const double e, const SDL_Point *f, const SDL_RendererFlip g),(a,b,c,d,e,f,g),return) SDL_DYNAPI_PROC(int,SDL_RenderReadPixels,(SDL_Renderer *a, const SDL_Rect *b, Uint32 c, void *d, int e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(void,SDL_RenderPresent,(SDL_Renderer *a),(a),) SDL_DYNAPI_PROC(void,SDL_DestroyTexture,(SDL_Texture *a),(a),) SDL_DYNAPI_PROC(void,SDL_DestroyRenderer,(SDL_Renderer *a),(a),) SDL_DYNAPI_PROC(int,SDL_GL_BindTexture,(SDL_Texture *a, float *b, float *c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_GL_UnbindTexture,(SDL_Texture *a),(a),return) SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromFile,(const char *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromMem,(void *a, int b),(a,b),return) SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromConstMem,(const void *a, int b),(a,b),return) SDL_DYNAPI_PROC(SDL_RWops*,SDL_AllocRW,(void),(),return) SDL_DYNAPI_PROC(void,SDL_FreeRW,(SDL_RWops *a),(a),) SDL_DYNAPI_PROC(Uint8,SDL_ReadU8,(SDL_RWops *a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_ReadLE16,(SDL_RWops *a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_ReadBE16,(SDL_RWops *a),(a),return) SDL_DYNAPI_PROC(Uint32,SDL_ReadLE32,(SDL_RWops *a),(a),return) SDL_DYNAPI_PROC(Uint32,SDL_ReadBE32,(SDL_RWops *a),(a),return) SDL_DYNAPI_PROC(Uint64,SDL_ReadLE64,(SDL_RWops *a),(a),return) SDL_DYNAPI_PROC(Uint64,SDL_ReadBE64,(SDL_RWops *a),(a),return) SDL_DYNAPI_PROC(size_t,SDL_WriteU8,(SDL_RWops *a, Uint8 b),(a,b),return) SDL_DYNAPI_PROC(size_t,SDL_WriteLE16,(SDL_RWops *a, Uint16 b),(a,b),return) SDL_DYNAPI_PROC(size_t,SDL_WriteBE16,(SDL_RWops *a, Uint16 b),(a,b),return) SDL_DYNAPI_PROC(size_t,SDL_WriteLE32,(SDL_RWops *a, Uint32 b),(a,b),return) SDL_DYNAPI_PROC(size_t,SDL_WriteBE32,(SDL_RWops *a, Uint32 b),(a,b),return) SDL_DYNAPI_PROC(size_t,SDL_WriteLE64,(SDL_RWops *a, Uint64 b),(a,b),return) SDL_DYNAPI_PROC(size_t,SDL_WriteBE64,(SDL_RWops *a, Uint64 b),(a,b),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_CreateShapedWindow,(const char *a, unsigned int b, unsigned int c, unsigned int d, unsigned int e, Uint32 f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(SDL_bool,SDL_IsShapedWindow,(const SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_SetWindowShape,(SDL_Window *a, SDL_Surface *b, SDL_WindowShapeMode *c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_GetShapedWindowMode,(SDL_Window *a, SDL_WindowShapeMode *b),(a,b),return) SDL_DYNAPI_PROC(void*,SDL_malloc,(size_t a),(a),return) SDL_DYNAPI_PROC(void*,SDL_calloc,(size_t a, size_t b),(a,b),return) SDL_DYNAPI_PROC(void*,SDL_realloc,(void *a, size_t b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_free,(void *a),(a),) SDL_DYNAPI_PROC(char*,SDL_getenv,(const char *a),(a),return) SDL_DYNAPI_PROC(int,SDL_setenv,(const char *a, const char *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_qsort,(void *a, size_t b, size_t c, int (*d)(const void *, const void *)),(a,b,c,d),) SDL_DYNAPI_PROC(int,SDL_abs,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_isdigit,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_isspace,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_toupper,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_tolower,(int a),(a),return) SDL_DYNAPI_PROC(void*,SDL_memset,(SDL_OUT_BYTECAP(c) void *a, int b, size_t c),(a,b,c),return) SDL_DYNAPI_PROC(void*,SDL_memcpy,(SDL_OUT_BYTECAP(c) void *a, SDL_IN_BYTECAP(c) const void *b, size_t c),(a,b,c),return) SDL_DYNAPI_PROC(void*,SDL_memmove,(SDL_OUT_BYTECAP(c) void *a, SDL_IN_BYTECAP(c) const void *b, size_t c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_memcmp,(const void *a, const void *b, size_t c),(a,b,c),return) SDL_DYNAPI_PROC(size_t,SDL_wcslen,(const wchar_t *a),(a),return) SDL_DYNAPI_PROC(size_t,SDL_wcslcpy,(SDL_OUT_Z_CAP(c) wchar_t *a, const wchar_t *b, size_t c),(a,b,c),return) SDL_DYNAPI_PROC(size_t,SDL_wcslcat,(SDL_INOUT_Z_CAP(c) wchar_t *a, const wchar_t *b, size_t c),(a,b,c),return) SDL_DYNAPI_PROC(size_t,SDL_strlen,(const char *a),(a),return) SDL_DYNAPI_PROC(size_t,SDL_strlcpy,(SDL_OUT_Z_CAP(c) char *a, const char *b, size_t c),(a,b,c),return) SDL_DYNAPI_PROC(size_t,SDL_utf8strlcpy,(SDL_OUT_Z_CAP(c) char *a, const char *b, size_t c),(a,b,c),return) SDL_DYNAPI_PROC(size_t,SDL_strlcat,(SDL_INOUT_Z_CAP(c) char *a, const char *b, size_t c),(a,b,c),return) SDL_DYNAPI_PROC(char*,SDL_strdup,(const char *a),(a),return) SDL_DYNAPI_PROC(char*,SDL_strrev,(char *a),(a),return) SDL_DYNAPI_PROC(char*,SDL_strupr,(char *a),(a),return) SDL_DYNAPI_PROC(char*,SDL_strlwr,(char *a),(a),return) SDL_DYNAPI_PROC(char*,SDL_strchr,(const char *a, int b),(a,b),return) SDL_DYNAPI_PROC(char*,SDL_strrchr,(const char *a, int b),(a,b),return) SDL_DYNAPI_PROC(char*,SDL_strstr,(const char *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(char*,SDL_itoa,(int a, char *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(char*,SDL_uitoa,(unsigned int a, char *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(char*,SDL_ltoa,(long a, char *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(char*,SDL_ultoa,(unsigned long a, char *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(char*,SDL_lltoa,(Sint64 a, char *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(char*,SDL_ulltoa,(Uint64 a, char *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_atoi,(const char *a),(a),return) SDL_DYNAPI_PROC(double,SDL_atof,(const char *a),(a),return) SDL_DYNAPI_PROC(long,SDL_strtol,(const char *a, char **b, int c),(a,b,c),return) SDL_DYNAPI_PROC(unsigned long,SDL_strtoul,(const char *a, char **b, int c),(a,b,c),return) SDL_DYNAPI_PROC(Sint64,SDL_strtoll,(const char *a, char **b, int c),(a,b,c),return) SDL_DYNAPI_PROC(Uint64,SDL_strtoull,(const char *a, char **b, int c),(a,b,c),return) SDL_DYNAPI_PROC(double,SDL_strtod,(const char *a, char **b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_strcmp,(const char *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_strncmp,(const char *a, const char *b, size_t c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_strcasecmp,(const char *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_strncasecmp,(const char *a, const char *b, size_t c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_vsnprintf,(SDL_OUT_Z_CAP(b) char *a, size_t b, const char *c, va_list d),(a,b,c,d),return) SDL_DYNAPI_PROC(double,SDL_acos,(double a),(a),return) SDL_DYNAPI_PROC(double,SDL_asin,(double a),(a),return) SDL_DYNAPI_PROC(double,SDL_atan,(double a),(a),return) SDL_DYNAPI_PROC(double,SDL_atan2,(double a, double b),(a,b),return) SDL_DYNAPI_PROC(double,SDL_ceil,(double a),(a),return) SDL_DYNAPI_PROC(double,SDL_copysign,(double a, double b),(a,b),return) SDL_DYNAPI_PROC(double,SDL_cos,(double a),(a),return) SDL_DYNAPI_PROC(float,SDL_cosf,(float a),(a),return) SDL_DYNAPI_PROC(double,SDL_fabs,(double a),(a),return) SDL_DYNAPI_PROC(double,SDL_floor,(double a),(a),return) SDL_DYNAPI_PROC(double,SDL_log,(double a),(a),return) SDL_DYNAPI_PROC(double,SDL_pow,(double a, double b),(a,b),return) SDL_DYNAPI_PROC(double,SDL_scalbn,(double a, int b),(a,b),return) SDL_DYNAPI_PROC(double,SDL_sin,(double a),(a),return) SDL_DYNAPI_PROC(float,SDL_sinf,(float a),(a),return) SDL_DYNAPI_PROC(double,SDL_sqrt,(double a),(a),return) SDL_DYNAPI_PROC(SDL_iconv_t,SDL_iconv_open,(const char *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_iconv_close,(SDL_iconv_t a),(a),return) SDL_DYNAPI_PROC(size_t,SDL_iconv,(SDL_iconv_t a, const char **b, size_t *c, char **d, size_t *e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(char*,SDL_iconv_string,(const char *a, const char *b, const char *c, size_t d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurface,(Uint32 a, int b, int c, int d, Uint32 e, Uint32 f, Uint32 g, Uint32 h),(a,b,c,d,e,f,g,h),return) SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurfaceFrom,(void *a, int b, int c, int d, int e, Uint32 f, Uint32 g, Uint32 h, Uint32 i),(a,b,c,d,e,f,g,h,i),return) SDL_DYNAPI_PROC(void,SDL_FreeSurface,(SDL_Surface *a),(a),) SDL_DYNAPI_PROC(int,SDL_SetSurfacePalette,(SDL_Surface *a, SDL_Palette *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_LockSurface,(SDL_Surface *a),(a),return) SDL_DYNAPI_PROC(void,SDL_UnlockSurface,(SDL_Surface *a),(a),) SDL_DYNAPI_PROC(SDL_Surface*,SDL_LoadBMP_RW,(SDL_RWops *a, int b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SaveBMP_RW,(SDL_Surface *a, SDL_RWops *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_SetSurfaceRLE,(SDL_Surface *a, int b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SetColorKey,(SDL_Surface *a, int b, Uint32 c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_GetColorKey,(SDL_Surface *a, Uint32 *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SetSurfaceColorMod,(SDL_Surface *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_GetSurfaceColorMod,(SDL_Surface *a, Uint8 *b, Uint8 *c, Uint8 *d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_SetSurfaceAlphaMod,(SDL_Surface *a, Uint8 b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetSurfaceAlphaMod,(SDL_Surface *a, Uint8 *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode *b),(a,b),return) SDL_DYNAPI_PROC(SDL_bool,SDL_SetClipRect,(SDL_Surface *a, const SDL_Rect *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_GetClipRect,(SDL_Surface *a, SDL_Rect *b),(a,b),) SDL_DYNAPI_PROC(SDL_Surface*,SDL_ConvertSurface,(SDL_Surface *a, const SDL_PixelFormat *b, Uint32 c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_Surface*,SDL_ConvertSurfaceFormat,(SDL_Surface *a, Uint32 b, Uint32 c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_ConvertPixels,(int a, int b, Uint32 c, const void *d, int e, Uint32 f, void *g, int h),(a,b,c,d,e,f,g,h),return) SDL_DYNAPI_PROC(int,SDL_FillRect,(SDL_Surface *a, const SDL_Rect *b, Uint32 c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_FillRects,(SDL_Surface *a, const SDL_Rect *b, int c, Uint32 d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_UpperBlit,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_LowerBlit,(SDL_Surface *a, SDL_Rect *b, SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_SoftStretch,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_UpperBlitScaled,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_LowerBlitScaled,(SDL_Surface *a, SDL_Rect *b, SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowWMInfo,(SDL_Window *a, SDL_SysWMinfo *b),(a,b),return) SDL_DYNAPI_PROC(const char*,SDL_GetThreadName,(SDL_Thread *a),(a),return) SDL_DYNAPI_PROC(SDL_threadID,SDL_ThreadID,(void),(),return) SDL_DYNAPI_PROC(SDL_threadID,SDL_GetThreadID,(SDL_Thread *a),(a),return) SDL_DYNAPI_PROC(int,SDL_SetThreadPriority,(SDL_ThreadPriority a),(a),return) SDL_DYNAPI_PROC(void,SDL_WaitThread,(SDL_Thread *a, int *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_DetachThread,(SDL_Thread *a),(a),) SDL_DYNAPI_PROC(SDL_TLSID,SDL_TLSCreate,(void),(),return) SDL_DYNAPI_PROC(void*,SDL_TLSGet,(SDL_TLSID a),(a),return) SDL_DYNAPI_PROC(int,SDL_TLSSet,(SDL_TLSID a, const void *b, void (*c)(void*)),(a,b,c),return) SDL_DYNAPI_PROC(Uint32,SDL_GetTicks,(void),(),return) SDL_DYNAPI_PROC(Uint64,SDL_GetPerformanceCounter,(void),(),return) SDL_DYNAPI_PROC(Uint64,SDL_GetPerformanceFrequency,(void),(),return) SDL_DYNAPI_PROC(void,SDL_Delay,(Uint32 a),(a),) SDL_DYNAPI_PROC(SDL_TimerID,SDL_AddTimer,(Uint32 a, SDL_TimerCallback b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_bool,SDL_RemoveTimer,(SDL_TimerID a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetNumTouchDevices,(void),(),return) SDL_DYNAPI_PROC(SDL_TouchID,SDL_GetTouchDevice,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetNumTouchFingers,(SDL_TouchID a),(a),return) SDL_DYNAPI_PROC(SDL_Finger*,SDL_GetTouchFinger,(SDL_TouchID a, int b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_GetVersion,(SDL_version *a),(a),) SDL_DYNAPI_PROC(const char*,SDL_GetRevision,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetRevisionNumber,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetNumVideoDrivers,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetVideoDriver,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_VideoInit,(const char *a),(a),return) SDL_DYNAPI_PROC(void,SDL_VideoQuit,(void),(),) SDL_DYNAPI_PROC(const char*,SDL_GetCurrentVideoDriver,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetNumVideoDisplays,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetDisplayName,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetDisplayBounds,(int a, SDL_Rect *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetNumDisplayModes,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetDisplayMode,(int a, int b, SDL_DisplayMode *c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_GetDesktopDisplayMode,(int a, SDL_DisplayMode *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetCurrentDisplayMode,(int a, SDL_DisplayMode *b),(a,b),return) SDL_DYNAPI_PROC(SDL_DisplayMode*,SDL_GetClosestDisplayMode,(int a, const SDL_DisplayMode *b, SDL_DisplayMode *c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_GetWindowDisplayIndex,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_SetWindowDisplayMode,(SDL_Window *a, const SDL_DisplayMode *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetWindowDisplayMode,(SDL_Window *a, SDL_DisplayMode *b),(a,b),return) SDL_DYNAPI_PROC(Uint32,SDL_GetWindowPixelFormat,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_CreateWindow,(const char *a, int b, int c, int d, int e, Uint32 f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_CreateWindowFrom,(const void *a),(a),return) SDL_DYNAPI_PROC(Uint32,SDL_GetWindowID,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_GetWindowFromID,(Uint32 a),(a),return) SDL_DYNAPI_PROC(Uint32,SDL_GetWindowFlags,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(void,SDL_SetWindowTitle,(SDL_Window *a, const char *b),(a,b),) SDL_DYNAPI_PROC(const char*,SDL_GetWindowTitle,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(void,SDL_SetWindowIcon,(SDL_Window *a, SDL_Surface *b),(a,b),) SDL_DYNAPI_PROC(void*,SDL_SetWindowData,(SDL_Window *a, const char *b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(void*,SDL_GetWindowData,(SDL_Window *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_SetWindowPosition,(SDL_Window *a, int b, int c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_GetWindowPosition,(SDL_Window *a, int *b, int *c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_SetWindowSize,(SDL_Window *a, int b, int c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_GetWindowSize,(SDL_Window *a, int *b, int *c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_SetWindowMinimumSize,(SDL_Window *a, int b, int c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_GetWindowMinimumSize,(SDL_Window *a, int *b, int *c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_SetWindowMaximumSize,(SDL_Window *a, int b, int c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_GetWindowMaximumSize,(SDL_Window *a, int *b, int *c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_SetWindowBordered,(SDL_Window *a, SDL_bool b),(a,b),) SDL_DYNAPI_PROC(void,SDL_ShowWindow,(SDL_Window *a),(a),) SDL_DYNAPI_PROC(void,SDL_HideWindow,(SDL_Window *a),(a),) SDL_DYNAPI_PROC(void,SDL_RaiseWindow,(SDL_Window *a),(a),) SDL_DYNAPI_PROC(void,SDL_MaximizeWindow,(SDL_Window *a),(a),) SDL_DYNAPI_PROC(void,SDL_MinimizeWindow,(SDL_Window *a),(a),) SDL_DYNAPI_PROC(void,SDL_RestoreWindow,(SDL_Window *a),(a),) SDL_DYNAPI_PROC(int,SDL_SetWindowFullscreen,(SDL_Window *a, Uint32 b),(a,b),return) SDL_DYNAPI_PROC(SDL_Surface*,SDL_GetWindowSurface,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_UpdateWindowSurface,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_UpdateWindowSurfaceRects,(SDL_Window *a, const SDL_Rect *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_SetWindowGrab,(SDL_Window *a, SDL_bool b),(a,b),) SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowGrab,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_SetWindowBrightness,(SDL_Window *a, float b),(a,b),return) SDL_DYNAPI_PROC(float,SDL_GetWindowBrightness,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_SetWindowGammaRamp,(SDL_Window *a, const Uint16 *b, const Uint16 *c, const Uint16 *d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_GetWindowGammaRamp,(SDL_Window *a, Uint16 *b, Uint16 *c, Uint16 *d),(a,b,c,d),return) SDL_DYNAPI_PROC(void,SDL_DestroyWindow,(SDL_Window *a),(a),) SDL_DYNAPI_PROC(SDL_bool,SDL_IsScreenSaverEnabled,(void),(),return) SDL_DYNAPI_PROC(void,SDL_EnableScreenSaver,(void),(),) SDL_DYNAPI_PROC(void,SDL_DisableScreenSaver,(void),(),) SDL_DYNAPI_PROC(int,SDL_GL_LoadLibrary,(const char *a),(a),return) SDL_DYNAPI_PROC(void*,SDL_GL_GetProcAddress,(const char *a),(a),return) SDL_DYNAPI_PROC(void,SDL_GL_UnloadLibrary,(void),(),) SDL_DYNAPI_PROC(SDL_bool,SDL_GL_ExtensionSupported,(const char *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GL_SetAttribute,(SDL_GLattr a, int b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GL_GetAttribute,(SDL_GLattr a, int *b),(a,b),return) SDL_DYNAPI_PROC(SDL_GLContext,SDL_GL_CreateContext,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GL_MakeCurrent,(SDL_Window *a, SDL_GLContext b),(a,b),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_GL_GetCurrentWindow,(void),(),return) SDL_DYNAPI_PROC(SDL_GLContext,SDL_GL_GetCurrentContext,(void),(),return) SDL_DYNAPI_PROC(void,SDL_GL_GetDrawableSize,(SDL_Window *a, int *b, int *c),(a,b,c),) SDL_DYNAPI_PROC(int,SDL_GL_SetSwapInterval,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_GL_GetSwapInterval,(void),(),return) SDL_DYNAPI_PROC(void,SDL_GL_SwapWindow,(SDL_Window *a),(a),) SDL_DYNAPI_PROC(void,SDL_GL_DeleteContext,(SDL_GLContext a),(a),) SDL_DYNAPI_PROC(int,SDL_vsscanf,(const char *a, const char *b, va_list c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_GameControllerAddMappingsFromRW,(SDL_RWops *a, int b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_GL_ResetAttributes,(void),(),) SDL_DYNAPI_PROC(SDL_bool,SDL_HasAVX,(void),(),return) SDL_DYNAPI_PROC(SDL_AssertionHandler,SDL_GetDefaultAssertionHandler,(void),(),return) SDL_DYNAPI_PROC(SDL_AssertionHandler,SDL_GetAssertionHandler,(void **a),(a),return) #ifdef __WIN32__ SDL_DYNAPI_PROC(SDL_bool,SDL_DXGIGetOutputInfo,(int a,int *b, int *c),(a,b,c),return) #endif SDL_DYNAPI_PROC(SDL_bool,SDL_RenderIsClipEnabled,(SDL_Renderer *a),(a),return) #ifdef __WINRT__ SDL_DYNAPI_PROC(int,SDL_WinRTRunApp,(int a, char **b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(const wchar_t*,SDL_WinRTGetFSPathUNICODE,(SDL_WinRT_Path a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_WinRTGetFSPathUTF8,(SDL_WinRT_Path a),(a),return) #endif SDL_DYNAPI_PROC(int,SDL_WarpMouseGlobal,(int a, int b),(a,b),return) SDL_DYNAPI_PROC(float,SDL_sqrtf,(float a),(a),return) SDL_DYNAPI_PROC(double,SDL_tan,(double a),(a),return) SDL_DYNAPI_PROC(float,SDL_tanf,(float a),(a),return) SDL_DYNAPI_PROC(int,SDL_CaptureMouse,(SDL_bool a),(a),return) SDL_DYNAPI_PROC(int,SDL_SetWindowHitTest,(SDL_Window *a, SDL_HitTest b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(Uint32,SDL_GetGlobalMouseState,(int *a, int *b),(a,b),return) SDL_DYNAPI_PROC(SDL_bool,SDL_HasAVX2,(void),(),return) SDL_DYNAPI_PROC(int,SDL_QueueAudio,(SDL_AudioDeviceID a, const void *b, Uint32 c),(a,b,c),return) SDL_DYNAPI_PROC(Uint32,SDL_GetQueuedAudioSize,(SDL_AudioDeviceID a),(a),return) SDL_DYNAPI_PROC(void,SDL_ClearQueuedAudio,(SDL_AudioDeviceID a),(a),) SDL_DYNAPI_PROC(SDL_Window*,SDL_GetGrabbedWindow,(void),(),return) #ifdef __WIN32__ SDL_DYNAPI_PROC(void,SDL_SetWindowsMessageHook,(SDL_WindowsMessageHook a, void *b),(a,b),) #endif SDL_DYNAPI_PROC(int,SDL_GetDisplayDPI,(int a, float *b, float *c, float *d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_JoystickPowerLevel,SDL_JoystickCurrentPowerLevel,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(SDL_GameController*,SDL_GameControllerFromInstanceID,(SDL_JoystickID a),(a),return) SDL_DYNAPI_PROC(SDL_Joystick*,SDL_JoystickFromInstanceID,(SDL_JoystickID a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetDisplayUsableBounds,(int a, SDL_Rect *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetWindowBordersSize,(SDL_Window *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(int,SDL_SetWindowOpacity,(SDL_Window *a, float b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetWindowOpacity,(SDL_Window *a, float *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SetWindowInputFocus,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_SetWindowModalFor,(SDL_Window *a, SDL_Window *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_RenderSetIntegerScale,(SDL_Renderer *a, SDL_bool b),(a,b),return) SDL_DYNAPI_PROC(SDL_bool,SDL_RenderGetIntegerScale,(SDL_Renderer *a),(a),return) SDL_DYNAPI_PROC(Uint32,SDL_DequeueAudio,(SDL_AudioDeviceID a, void *b, Uint32 c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_SetWindowResizable,(SDL_Window *a, SDL_bool b),(a,b),) SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurfaceWithFormat,(Uint32 a, int b, int c, int d, Uint32 e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurfaceWithFormatFrom,(void *a, int b, int c, int d, int e, Uint32 f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(SDL_bool,SDL_GetHintBoolean,(const char *a, SDL_bool b),(a,b),return) SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetDeviceVendor,(int a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetDeviceProduct,(int a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetDeviceProductVersion,(int a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetVendor,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetProduct,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetProductVersion,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_GameControllerGetVendor,(SDL_GameController *a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_GameControllerGetProduct,(SDL_GameController *a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_GameControllerGetProductVersion,(SDL_GameController *a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_HasNEON,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GameControllerNumMappings,(void),(),return) SDL_DYNAPI_PROC(char*,SDL_GameControllerMappingForIndex,(int a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickGetAxisInitialState,(SDL_Joystick *a, int b, Sint16 *c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_JoystickType,SDL_JoystickGetDeviceType,(int a),(a),return) SDL_DYNAPI_PROC(SDL_JoystickType,SDL_JoystickGetType,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(void,SDL_MemoryBarrierReleaseFunction,(void),(),) SDL_DYNAPI_PROC(void,SDL_MemoryBarrierAcquireFunction,(void),(),) SDL_DYNAPI_PROC(SDL_JoystickID,SDL_JoystickGetDeviceInstanceID,(int a),(a),return) SDL_DYNAPI_PROC(size_t,SDL_utf8strlen,(const char *a),(a),return) SDL_DYNAPI_PROC(void*,SDL_LoadFile_RW,(SDL_RWops *a, size_t *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_wcscmp,(const wchar_t *a, const wchar_t *b),(a,b),return) SDL_DYNAPI_PROC(SDL_BlendMode,SDL_ComposeCustomBlendMode,(SDL_BlendFactor a, SDL_BlendFactor b, SDL_BlendOperation c, SDL_BlendFactor d, SDL_BlendFactor e, SDL_BlendOperation f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(SDL_Surface*,SDL_DuplicateSurface,(SDL_Surface *a),(a),return) SDL_DYNAPI_PROC(int,SDL_Vulkan_LoadLibrary,(const char *a),(a),return) SDL_DYNAPI_PROC(void*,SDL_Vulkan_GetVkGetInstanceProcAddr,(void),(),return) SDL_DYNAPI_PROC(void,SDL_Vulkan_UnloadLibrary,(void),(),) SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_GetInstanceExtensions,(SDL_Window *a, unsigned int *b, const char **c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_CreateSurface,(SDL_Window *a, VkInstance b, VkSurfaceKHR *c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_Vulkan_GetDrawableSize,(SDL_Window *a, int *b, int *c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_LockJoysticks,(void),(),) SDL_DYNAPI_PROC(void,SDL_UnlockJoysticks,(void),(),) SDL_DYNAPI_PROC(void,SDL_GetMemoryFunctions,(SDL_malloc_func *a, SDL_calloc_func *b, SDL_realloc_func *c, SDL_free_func *d),(a,b,c,d),) SDL_DYNAPI_PROC(int,SDL_SetMemoryFunctions,(SDL_malloc_func a, SDL_calloc_func b, SDL_realloc_func c, SDL_free_func d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_GetNumAllocations,(void),(),return) SDL_DYNAPI_PROC(SDL_AudioStream*,SDL_NewAudioStream,(const SDL_AudioFormat a, const Uint8 b, const int c, const SDL_AudioFormat d, const Uint8 e, const int f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(int,SDL_AudioStreamPut,(SDL_AudioStream *a, const void *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_AudioStreamGet,(SDL_AudioStream *a, void *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_AudioStreamClear,(SDL_AudioStream *a),(a),) SDL_DYNAPI_PROC(int,SDL_AudioStreamAvailable,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(void,SDL_FreeAudioStream,(SDL_AudioStream *a),(a),) SDL_DYNAPI_PROC(int,SDL_AudioStreamFlush,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(float,SDL_acosf,(float a),(a),return) SDL_DYNAPI_PROC(float,SDL_asinf,(float a),(a),return) SDL_DYNAPI_PROC(float,SDL_atanf,(float a),(a),return) SDL_DYNAPI_PROC(float,SDL_atan2f,(float a, float b),(a,b),return) SDL_DYNAPI_PROC(float,SDL_ceilf,(float a),(a),return) SDL_DYNAPI_PROC(float,SDL_copysignf,(float a, float b),(a,b),return) SDL_DYNAPI_PROC(float,SDL_fabsf,(float a),(a),return) SDL_DYNAPI_PROC(float,SDL_floorf,(float a),(a),return) SDL_DYNAPI_PROC(float,SDL_logf,(float a),(a),return) SDL_DYNAPI_PROC(float,SDL_powf,(float a, float b),(a,b),return) SDL_DYNAPI_PROC(float,SDL_scalbnf,(float a, int b),(a,b),return) SDL_DYNAPI_PROC(double,SDL_fmod,(double a, double b),(a,b),return) SDL_DYNAPI_PROC(float,SDL_fmodf,(float a, float b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_SetYUVConversionMode,(SDL_YUV_CONVERSION_MODE a),(a),) SDL_DYNAPI_PROC(SDL_YUV_CONVERSION_MODE,SDL_GetYUVConversionMode,(void),(),return) SDL_DYNAPI_PROC(SDL_YUV_CONVERSION_MODE,SDL_GetYUVConversionModeForResolution,(int a, int b),(a,b),return) SDL_DYNAPI_PROC(void*,SDL_RenderGetMetalLayer,(SDL_Renderer *a),(a),return) SDL_DYNAPI_PROC(void*,SDL_RenderGetMetalCommandEncoder,(SDL_Renderer *a),(a),return) #ifdef __WINRT__ SDL_DYNAPI_PROC(SDL_WinRT_DeviceFamily,SDL_WinRTGetDeviceFamily,(void),(),return) #endif #ifdef __ANDROID__ SDL_DYNAPI_PROC(SDL_bool,SDL_IsAndroidTV,(void),(),return) #endif SDL_DYNAPI_PROC(double,SDL_log10,(double a),(a),return) SDL_DYNAPI_PROC(float,SDL_log10f,(float a),(a),return) SDL_DYNAPI_PROC(char*,SDL_GameControllerMappingForDeviceIndex,(int a),(a),return) #ifdef __LINUX__ SDL_DYNAPI_PROC(int,SDL_LinuxSetThreadPriority,(Sint64 a, int b),(a,b),return) #endif SDL_DYNAPI_PROC(SDL_bool,SDL_HasAVX512F,(void),(),return) #ifdef __ANDROID__ SDL_DYNAPI_PROC(SDL_bool,SDL_IsChromebook,(void),(),return) SDL_DYNAPI_PROC(SDL_bool,SDL_IsDeXMode,(void),(),return) SDL_DYNAPI_PROC(void,SDL_AndroidBackButton,(void),(),) #endif SDL_DYNAPI_PROC(double,SDL_exp,(double a),(a),return) SDL_DYNAPI_PROC(float,SDL_expf,(float a),(a),return) SDL_DYNAPI_PROC(wchar_t*,SDL_wcsdup,(const wchar_t *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GameControllerRumble,(SDL_GameController *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_JoystickRumble,(SDL_Joystick *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_NumSensors,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_SensorGetDeviceName,(int a),(a),return) SDL_DYNAPI_PROC(SDL_SensorType,SDL_SensorGetDeviceType,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_SensorGetDeviceNonPortableType,(int a),(a),return) SDL_DYNAPI_PROC(SDL_SensorID,SDL_SensorGetDeviceInstanceID,(int a),(a),return) SDL_DYNAPI_PROC(SDL_Sensor*,SDL_SensorOpen,(int a),(a),return) SDL_DYNAPI_PROC(SDL_Sensor*,SDL_SensorFromInstanceID,(SDL_SensorID a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_SensorGetName,(SDL_Sensor *a),(a),return) SDL_DYNAPI_PROC(SDL_SensorType,SDL_SensorGetType,(SDL_Sensor *a),(a),return) SDL_DYNAPI_PROC(int,SDL_SensorGetNonPortableType,(SDL_Sensor *a),(a),return) SDL_DYNAPI_PROC(SDL_SensorID,SDL_SensorGetInstanceID,(SDL_Sensor *a),(a),return) SDL_DYNAPI_PROC(int,SDL_SensorGetData,(SDL_Sensor *a, float *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_SensorClose,(SDL_Sensor *a),(a),) SDL_DYNAPI_PROC(void,SDL_SensorUpdate,(void),(),) SDL_DYNAPI_PROC(SDL_bool,SDL_IsTablet,(void),(),return) SDL_DYNAPI_PROC(SDL_DisplayOrientation,SDL_GetDisplayOrientation,(int a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_HasColorKey,(SDL_Surface *a),(a),return) #ifdef SDL_CreateThreadWithStackSize #undef SDL_CreateThreadWithStackSize #endif #if defined(__WIN32__) SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a, const char *b, const size_t c, void *d, pfnSDL_CurrentBeginThread e, pfnSDL_CurrentEndThread f),(a,b,c,d,e,f),return) #elif defined(__OS2__) SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a, const char *b, const size_t c, void *d, pfnSDL_CurrentBeginThread e, pfnSDL_CurrentEndThread f),(a,b,c,d,e,f),return) #else SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a, const char *b, const size_t c, void *d),(a,b,c,d),return) #endif SDL_DYNAPI_PROC(int,SDL_JoystickGetDevicePlayerIndex,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_JoystickGetPlayerIndex,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GameControllerGetPlayerIndex,(SDL_GameController *a),(a),return) SDL_DYNAPI_PROC(int,SDL_RenderFlush,(SDL_Renderer *a),(a),return) SDL_DYNAPI_PROC(int,SDL_RenderDrawPointF,(SDL_Renderer *a, float b, float c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_RenderDrawPointsF,(SDL_Renderer *a, const SDL_FPoint *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_RenderDrawLineF,(SDL_Renderer *a, float b, float c, float d, float e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(int,SDL_RenderDrawLinesF,(SDL_Renderer *a, const SDL_FPoint *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_RenderDrawRectF,(SDL_Renderer *a, const SDL_FRect *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_RenderDrawRectsF,(SDL_Renderer *a, const SDL_FRect *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_RenderFillRectF,(SDL_Renderer *a, const SDL_FRect *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_RenderFillRectsF,(SDL_Renderer *a, const SDL_FRect *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_RenderCopyF,(SDL_Renderer *a, SDL_Texture *b, const SDL_Rect *c, const SDL_FRect *d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_RenderCopyExF,(SDL_Renderer *a, SDL_Texture *b, const SDL_Rect *c, const SDL_FRect *d, const double e, const SDL_FPoint *f, const SDL_RendererFlip g),(a,b,c,d,e,f,g),return) SDL_DYNAPI_PROC(SDL_TouchDeviceType,SDL_GetTouchDeviceType,(SDL_TouchID a),(a),return) #ifdef __IPHONEOS__ SDL_DYNAPI_PROC(int,SDL_UIKitRunApp,(int a, char *b, SDL_main_func c),(a,b,c),return) #endif SDL_DYNAPI_PROC(size_t,SDL_SIMDGetAlignment,(void),(),return) SDL_DYNAPI_PROC(void*,SDL_SIMDAlloc,(const size_t a),(a),return) SDL_DYNAPI_PROC(void*,SDL_SIMDRealloc,(void *a, const size_t b),(a, b),return) SDL_DYNAPI_PROC(void,SDL_SIMDFree,(void *a),(a),) SDL_DYNAPI_PROC(Sint64,SDL_RWsize,(SDL_RWops *a),(a),return) SDL_DYNAPI_PROC(Sint64,SDL_RWseek,(SDL_RWops *a, Sint64 b, int c),(a,b,c),return) SDL_DYNAPI_PROC(Sint64,SDL_RWtell,(SDL_RWops *a),(a),return) SDL_DYNAPI_PROC(size_t,SDL_RWread,(SDL_RWops *a, void *b, size_t c, size_t d),(a,b,c,d),return) SDL_DYNAPI_PROC(size_t,SDL_RWwrite,(SDL_RWops *a, const void *b, size_t c, size_t d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_RWclose,(SDL_RWops *a),(a),return) SDL_DYNAPI_PROC(void*,SDL_LoadFile,(const char *a, size_t *b),(a,b),return) SDL_DYNAPI_PROC(SDL_MetalView,SDL_Metal_CreateView,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(void,SDL_Metal_DestroyView,(SDL_MetalView a),(a),) SDL_DYNAPI_PROC(int,SDL_LockTextureToSurface,(SDL_Texture *a, const SDL_Rect *b, SDL_Surface **c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_bool,SDL_HasARMSIMD,(void),(),return) SDL_DYNAPI_PROC(char*,SDL_strtokr,(char *a, const char *b, char **c),(a,b,c),return) SDL_DYNAPI_PROC(wchar_t*,SDL_wcsstr,(const wchar_t *a, const wchar_t *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_wcsncmp,(const wchar_t *a, const wchar_t *b, size_t c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_GameControllerType,SDL_GameControllerTypeForIndex,(int a),(a),return) SDL_DYNAPI_PROC(SDL_GameControllerType,SDL_GameControllerGetType,(SDL_GameController *a),(a),return) SDL_DYNAPI_PROC(SDL_GameController*,SDL_GameControllerFromPlayerIndex,(int a),(a),return) SDL_DYNAPI_PROC(void,SDL_GameControllerSetPlayerIndex,(SDL_GameController *a, int b),(a,b),) SDL_DYNAPI_PROC(SDL_Joystick*,SDL_JoystickFromPlayerIndex,(int a),(a),return) SDL_DYNAPI_PROC(void,SDL_JoystickSetPlayerIndex,(SDL_Joystick *a, int b),(a,b),) SDL_DYNAPI_PROC(int,SDL_SetTextureScaleMode,(SDL_Texture *a, SDL_ScaleMode b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetTextureScaleMode,(SDL_Texture *a, SDL_ScaleMode *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_OnApplicationWillTerminate,(void),(),) SDL_DYNAPI_PROC(void,SDL_OnApplicationDidReceiveMemoryWarning,(void),(),) SDL_DYNAPI_PROC(void,SDL_OnApplicationWillResignActive,(void),(),) SDL_DYNAPI_PROC(void,SDL_OnApplicationDidEnterBackground,(void),(),) SDL_DYNAPI_PROC(void,SDL_OnApplicationWillEnterForeground,(void),(),) SDL_DYNAPI_PROC(void,SDL_OnApplicationDidBecomeActive,(void),(),) #ifdef __IPHONEOS__ SDL_DYNAPI_PROC(void,SDL_OnApplicationDidChangeStatusBarOrientation,(void),(),) #endif #ifdef __ANDROID__ SDL_DYNAPI_PROC(int,SDL_GetAndroidSDKVersion,(void),(),return) #endif SDL_DYNAPI_PROC(int,SDL_isupper,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_islower,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_JoystickAttachVirtual,(SDL_JoystickType a, int b, int c, int d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_JoystickDetachVirtual,(int a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickIsVirtual,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_JoystickSetVirtualAxis,(SDL_Joystick *a, int b, Sint16 c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_JoystickSetVirtualButton,(SDL_Joystick *a, int b, Uint8 c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_JoystickSetVirtualHat,(SDL_Joystick *a, int b, Uint8 c),(a,b,c),return) SDL_DYNAPI_PROC(char*,SDL_GetErrorMsg,(char *a, int b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_LockSensors,(void),(),) SDL_DYNAPI_PROC(void,SDL_UnlockSensors,(void),(),) SDL_DYNAPI_PROC(void*,SDL_Metal_GetLayer,(SDL_MetalView a),(a),return) SDL_DYNAPI_PROC(void,SDL_Metal_GetDrawableSize,(SDL_Window *a, int *b, int *c),(a,b,c),) SDL_DYNAPI_PROC(double,SDL_trunc,(double a),(a),return) SDL_DYNAPI_PROC(float,SDL_truncf,(float a),(a),return) SDL_DYNAPI_PROC(SDL_Locale *,SDL_GetPreferredLocales,(void),(),return)
YifuLiu/AliOS-Things
components/SDL2/src/dynapi/SDL_dynapi_procs.h
C
apache-2.0
61,171
#!/usr/bin/perl -w # Simple DirectMedia Layer # Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # arising from the use of this software. # # Permission is granted to anyone to use this software for any purpose, # including commercial applications, and to alter it and redistribute it # freely, subject to the following restrictions: # # 1. The origin of this software must not be misrepresented; you must not # claim that you wrote the original software. If you use this software # in a product, an acknowledgment in the product documentation would be # appreciated but is not required. # 2. Altered source versions must be plainly marked as such, and must not be # misrepresented as being the original software. # 3. This notice may not be removed or altered from any source distribution. # WHAT IS THIS? # When you add a public API to SDL, please run this script, make sure the # output looks sane (hg diff, it adds to existing files), and commit it. # It keeps the dynamic API jump table operating correctly. # If you wanted this to be readable, you shouldn't have used perl. use warnings; use strict; use File::Basename; chdir(dirname(__FILE__) . '/../..'); my $sdl_dynapi_procs_h = "src/dynapi/SDL_dynapi_procs.h"; my $sdl_dynapi_overrides_h = "src/dynapi/SDL_dynapi_overrides.h"; my %existing = (); if (-f $sdl_dynapi_procs_h) { open(SDL_DYNAPI_PROCS_H, '<', $sdl_dynapi_procs_h) or die("Can't open $sdl_dynapi_procs_h: $!\n"); while (<SDL_DYNAPI_PROCS_H>) { if (/\ASDL_DYNAPI_PROC\(.*?,(.*?),/) { $existing{$1} = 1; } } close(SDL_DYNAPI_PROCS_H) } open(SDL_DYNAPI_PROCS_H, '>>', $sdl_dynapi_procs_h) or die("Can't open $sdl_dynapi_procs_h: $!\n"); open(SDL_DYNAPI_OVERRIDES_H, '>>', $sdl_dynapi_overrides_h) or die("Can't open $sdl_dynapi_overrides_h: $!\n"); opendir(HEADERS, 'include') or die("Can't open include dir: $!\n"); while (my $d = readdir(HEADERS)) { next if not $d =~ /\.h\Z/; my $header = "include/$d"; open(HEADER, '<', $header) or die("Can't open $header: $!\n"); while (<HEADER>) { chomp; next if not /\A\s*extern\s+DECLSPEC/; my $decl = "$_ "; if (not $decl =~ /\)\s*;/) { while (<HEADER>) { chomp; s/\A\s+//; s/\s+\Z//; $decl .= "$_ "; last if /\)\s*;/; } } $decl =~ s/\s+\Z//; #print("DECL: [$decl]\n"); if ($decl =~ /\A\s*extern\s+DECLSPEC\s+(const\s+|)(unsigned\s+|)(.*?)\s*(\*?)\s*SDLCALL\s+(.*?)\s*\((.*?)\);/) { my $rc = "$1$2$3$4"; my $fn = $5; next if $existing{$fn}; # already slotted into the jump table. my @params = split(',', $6); #print("rc == '$rc', fn == '$fn', params == '$params'\n"); my $retstr = ($rc eq 'void') ? '' : 'return'; my $paramstr = '('; my $argstr = '('; my $i = 0; foreach (@params) { my $str = $_; $str =~ s/\A\s+//; $str =~ s/\s+\Z//; #print("1PARAM: $str\n"); if ($str eq 'void') { $paramstr .= 'void'; } elsif ($str eq '...') { if ($i > 0) { $paramstr .= ', '; } $paramstr .= $str; } elsif ($str =~ /\A\s*((const\s+|)(unsigned\s+|)([a-zA-Z0-9_]*)\s*([\*\s]*))\s*(.*?)\Z/) { #print("PARSED: [$1], [$2], [$3], [$4], [$5]\n"); my $type = $1; my $var = $6; $type =~ s/\A\s+//; $type =~ s/\s+\Z//; $var =~ s/\A\s+//; $var =~ s/\s+\Z//; $type =~ s/\s*\*\Z/*/g; $type =~ s/\s*(\*+)\Z/ $1/; #print("SPLIT: ($type, $var)\n"); my $name = chr(ord('a') + $i); if ($i > 0) { $paramstr .= ', '; $argstr .= ','; } my $spc = ($type =~ /\*\Z/) ? '' : ' '; $paramstr .= "$type$spc$name"; $argstr .= "$name"; } $i++; } $paramstr = '(void' if ($i == 0); # Just to make this consistent. $paramstr .= ')'; $argstr .= ')'; print("NEW: $decl\n"); print SDL_DYNAPI_PROCS_H "SDL_DYNAPI_PROC($rc,$fn,$paramstr,$argstr,$retstr)\n"; print SDL_DYNAPI_OVERRIDES_H "#define $fn ${fn}_REAL\n"; } else { print("Failed to parse decl [$decl]!\n"); } } close(HEADER); } closedir(HEADERS); close(SDL_DYNAPI_PROCS_H); close(SDL_DYNAPI_OVERRIDES_H); # vi: set ts=4 sw=4 expandtab:
YifuLiu/AliOS-Things
components/SDL2/src/dynapi/gendynapi.pl
Perl
apache-2.0
5,093
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" /* Clipboard event handling code for SDL */ #include "SDL_events.h" #include "SDL_events_c.h" #include "SDL_clipboardevents_c.h" int SDL_SendClipboardUpdate(void) { int posted; /* Post the event, if desired */ posted = 0; if (SDL_GetEventState(SDL_CLIPBOARDUPDATE) == SDL_ENABLE) { SDL_Event event; event.type = SDL_CLIPBOARDUPDATE; posted = (SDL_PushEvent(&event) > 0); } return (posted); } /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/SDL_clipboardevents.c
C
apache-2.0
1,450
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" #ifndef SDL_clipboardevents_c_h_ #define SDL_clipboardevents_c_h_ extern int SDL_SendClipboardUpdate(void); #endif /* SDL_clipboardevents_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/SDL_clipboardevents_c.h
C
apache-2.0
1,153
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" /* Display event handling code for SDL */ #include "SDL_events.h" #include "SDL_events_c.h" int SDL_SendDisplayEvent(SDL_VideoDisplay *display, Uint8 displayevent, int data1) { int posted; if (!display) { return 0; } switch (displayevent) { case SDL_DISPLAYEVENT_ORIENTATION: if (data1 == SDL_ORIENTATION_UNKNOWN || data1 == display->orientation) { return 0; } display->orientation = (SDL_DisplayOrientation)data1; break; } /* Post the event, if desired */ posted = 0; if (SDL_GetEventState(SDL_DISPLAYEVENT) == SDL_ENABLE) { SDL_Event event; event.type = SDL_DISPLAYEVENT; event.display.event = displayevent; event.display.display = SDL_GetIndexOfDisplay(display); event.display.data1 = data1; posted = (SDL_PushEvent(&event) > 0); } return (posted); } /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/SDL_displayevents.c
C
apache-2.0
1,909
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" #ifndef SDL_displayevents_c_h_ #define SDL_displayevents_c_h_ extern int SDL_SendDisplayEvent(SDL_VideoDisplay *display, Uint8 displayevent, int data1); #endif /* SDL_displayevents_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/SDL_displayevents_c.h
C
apache-2.0
1,196
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" /* Drag and drop event handling code for SDL */ #include "SDL_events.h" #include "SDL_events_c.h" #include "SDL_dropevents_c.h" #include "../video/SDL_sysvideo.h" /* for SDL_Window internals. */ static int SDL_SendDrop(SDL_Window *window, const SDL_EventType evtype, const char *data) { static SDL_bool app_is_dropping = SDL_FALSE; int posted = 0; /* Post the event, if desired */ if (SDL_GetEventState(evtype) == SDL_ENABLE) { const SDL_bool need_begin = window ? !window->is_dropping : !app_is_dropping; SDL_Event event; if (need_begin) { SDL_zero(event); event.type = SDL_DROPBEGIN; if (window) { event.drop.windowID = window->id; } posted = (SDL_PushEvent(&event) > 0); if (!posted) { return 0; } if (window) { window->is_dropping = SDL_TRUE; } else { app_is_dropping = SDL_TRUE; } } SDL_zero(event); event.type = evtype; event.drop.file = data ? SDL_strdup(data) : NULL; event.drop.windowID = window ? window->id : 0; posted = (SDL_PushEvent(&event) > 0); if (posted && (evtype == SDL_DROPCOMPLETE)) { if (window) { window->is_dropping = SDL_FALSE; } else { app_is_dropping = SDL_FALSE; } } } return posted; } int SDL_SendDropFile(SDL_Window *window, const char *file) { return SDL_SendDrop(window, SDL_DROPFILE, file); } int SDL_SendDropText(SDL_Window *window, const char *text) { return SDL_SendDrop(window, SDL_DROPTEXT, text); } int SDL_SendDropComplete(SDL_Window *window) { return SDL_SendDrop(window, SDL_DROPCOMPLETE, NULL); } /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/SDL_dropevents.c
C
apache-2.0
2,837
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" #ifndef SDL_dropevents_c_h_ #define SDL_dropevents_c_h_ extern int SDL_SendDropFile(SDL_Window *window, const char *file); extern int SDL_SendDropText(SDL_Window *window, const char *text); extern int SDL_SendDropComplete(SDL_Window *window); #endif /* SDL_dropevents_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/SDL_dropevents_c.h
C
apache-2.0
1,283
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" /* General event handling code for SDL */ #include "SDL.h" #include "SDL_events.h" #include "SDL_thread.h" #include "SDL_events_c.h" #include "../timer/SDL_timer_c.h" #if !SDL_JOYSTICK_DISABLED #include "../joystick/SDL_joystick_c.h" #endif #include "../video/SDL_sysvideo.h" #include "SDL_syswm.h" #undef SDL_PRIs64 #ifdef __WIN32__ #define SDL_PRIs64 "I64d" #else #define SDL_PRIs64 "lld" #endif /* An arbitrary limit so we don't have unbounded growth */ #define SDL_MAX_QUEUED_EVENTS 65535 typedef struct SDL_EventWatcher { SDL_EventFilter callback; void *userdata; SDL_bool removed; } SDL_EventWatcher; static SDL_mutex *SDL_event_watchers_lock; static SDL_EventWatcher SDL_EventOK; static SDL_EventWatcher *SDL_event_watchers = NULL; static int SDL_event_watchers_count = 0; static SDL_bool SDL_event_watchers_dispatching = SDL_FALSE; static SDL_bool SDL_event_watchers_removed = SDL_FALSE; typedef struct { Uint32 bits[8]; } SDL_DisabledEventBlock; static SDL_DisabledEventBlock *SDL_disabled_events[256]; static Uint32 SDL_userevents = SDL_USEREVENT; /* Private data -- event queue */ typedef struct _SDL_EventEntry { SDL_Event event; SDL_SysWMmsg msg; struct _SDL_EventEntry *prev; struct _SDL_EventEntry *next; } SDL_EventEntry; typedef struct _SDL_SysWMEntry { SDL_SysWMmsg msg; struct _SDL_SysWMEntry *next; } SDL_SysWMEntry; static struct { SDL_mutex *lock; SDL_atomic_t active; SDL_atomic_t count; int max_events_seen; SDL_EventEntry *head; SDL_EventEntry *tail; SDL_EventEntry *free; SDL_SysWMEntry *wmmsg_used; SDL_SysWMEntry *wmmsg_free; } SDL_EventQ = { NULL, { 1 }, { 0 }, 0, NULL, NULL, NULL, NULL, NULL }; /* 0 (default) means no logging, 1 means logging, 2 means logging with mouse and finger motion */ static int SDL_DoEventLogging = 0; static void SDLCALL SDL_EventLoggingChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { SDL_DoEventLogging = (hint && *hint) ? SDL_max(SDL_min(SDL_atoi(hint), 2), 0) : 0; } static void SDL_LogEvent(const SDL_Event *event) { char name[32]; char details[128]; /* mouse/finger motion are spammy, ignore these if they aren't demanded. */ if ( (SDL_DoEventLogging < 2) && ( (event->type == SDL_MOUSEMOTION) || (event->type == SDL_FINGERMOTION) ) ) { return; } /* this is to make SDL_snprintf() calls cleaner. */ #define uint unsigned int name[0] = '\0'; details[0] = '\0'; /* !!! FIXME: This code is kinda ugly, sorry. */ if ((event->type >= SDL_USEREVENT) && (event->type <= SDL_LASTEVENT)) { char plusstr[16]; SDL_strlcpy(name, "SDL_USEREVENT", sizeof (name)); if (event->type > SDL_USEREVENT) { SDL_snprintf(plusstr, sizeof (plusstr), "+%u", ((uint) event->type) - SDL_USEREVENT); } else { plusstr[0] = '\0'; } SDL_snprintf(details, sizeof (details), "%s (timestamp=%u windowid=%u code=%d data1=%p data2=%p)", plusstr, (uint) event->user.timestamp, (uint) event->user.windowID, (int) event->user.code, event->user.data1, event->user.data2); } switch (event->type) { #define SDL_EVENT_CASE(x) case x: SDL_strlcpy(name, #x, sizeof (name)); SDL_EVENT_CASE(SDL_FIRSTEVENT) SDL_strlcpy(details, " (THIS IS PROBABLY A BUG!)", sizeof (details)); break; SDL_EVENT_CASE(SDL_QUIT) SDL_snprintf(details, sizeof (details), " (timestamp=%u)", (uint) event->quit.timestamp); break; SDL_EVENT_CASE(SDL_APP_TERMINATING) break; SDL_EVENT_CASE(SDL_APP_LOWMEMORY) break; SDL_EVENT_CASE(SDL_APP_WILLENTERBACKGROUND) break; SDL_EVENT_CASE(SDL_APP_DIDENTERBACKGROUND) break; SDL_EVENT_CASE(SDL_APP_WILLENTERFOREGROUND) break; SDL_EVENT_CASE(SDL_APP_DIDENTERFOREGROUND) break; SDL_EVENT_CASE(SDL_KEYMAPCHANGED) break; SDL_EVENT_CASE(SDL_CLIPBOARDUPDATE) break; SDL_EVENT_CASE(SDL_RENDER_TARGETS_RESET) break; SDL_EVENT_CASE(SDL_RENDER_DEVICE_RESET) break; SDL_EVENT_CASE(SDL_WINDOWEVENT) { char name2[64]; switch(event->window.event) { case SDL_WINDOWEVENT_NONE: SDL_strlcpy(name2, "SDL_WINDOWEVENT_NONE (THIS IS PROBABLY A BUG!)", sizeof (name2)); break; #define SDL_WINDOWEVENT_CASE(x) case x: SDL_strlcpy(name2, #x, sizeof (name2)); break SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_SHOWN); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_HIDDEN); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_EXPOSED); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MOVED); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_RESIZED); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_SIZE_CHANGED); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MINIMIZED); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MAXIMIZED); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_RESTORED); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_ENTER); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_LEAVE); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_FOCUS_GAINED); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_FOCUS_LOST); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_CLOSE); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_TAKE_FOCUS); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_HIT_TEST); #undef SDL_WINDOWEVENT_CASE default: SDL_strlcpy(name2, "UNKNOWN (bug? fixme?)", sizeof (name2)); break; } SDL_snprintf(details, sizeof (details), " (timestamp=%u windowid=%u event=%s data1=%d data2=%d)", (uint) event->window.timestamp, (uint) event->window.windowID, name2, (int) event->window.data1, (int) event->window.data2); break; } SDL_EVENT_CASE(SDL_SYSWMEVENT) /* !!! FIXME: we don't delve further at the moment. */ SDL_snprintf(details, sizeof (details), " (timestamp=%u)", (uint) event->syswm.timestamp); break; #define PRINT_KEY_EVENT(event) \ SDL_snprintf(details, sizeof (details), " (timestamp=%u windowid=%u state=%s repeat=%s scancode=%u keycode=%u mod=%u)", \ (uint) event->key.timestamp, (uint) event->key.windowID, \ event->key.state == SDL_PRESSED ? "pressed" : "released", \ event->key.repeat ? "true" : "false", \ (uint) event->key.keysym.scancode, \ (uint) event->key.keysym.sym, \ (uint) event->key.keysym.mod) SDL_EVENT_CASE(SDL_KEYDOWN) PRINT_KEY_EVENT(event); break; SDL_EVENT_CASE(SDL_KEYUP) PRINT_KEY_EVENT(event); break; #undef PRINT_KEY_EVENT SDL_EVENT_CASE(SDL_TEXTEDITING) SDL_snprintf(details, sizeof (details), " (timestamp=%u windowid=%u text='%s' start=%d length=%d)", (uint) event->edit.timestamp, (uint) event->edit.windowID, event->edit.text, (int) event->edit.start, (int) event->edit.length); break; SDL_EVENT_CASE(SDL_TEXTINPUT) SDL_snprintf(details, sizeof (details), " (timestamp=%u windowid=%u text='%s')", (uint) event->text.timestamp, (uint) event->text.windowID, event->text.text); break; SDL_EVENT_CASE(SDL_MOUSEMOTION) SDL_snprintf(details, sizeof (details), " (timestamp=%u windowid=%u which=%u state=%u x=%d y=%d xrel=%d yrel=%d)", (uint) event->motion.timestamp, (uint) event->motion.windowID, (uint) event->motion.which, (uint) event->motion.state, (int) event->motion.x, (int) event->motion.y, (int) event->motion.xrel, (int) event->motion.yrel); break; #define PRINT_MBUTTON_EVENT(event) \ SDL_snprintf(details, sizeof (details), " (timestamp=%u windowid=%u which=%u button=%u state=%s clicks=%u x=%d y=%d)", \ (uint) event->button.timestamp, (uint) event->button.windowID, \ (uint) event->button.which, (uint) event->button.button, \ event->button.state == SDL_PRESSED ? "pressed" : "released", \ (uint) event->button.clicks, (int) event->button.x, (int) event->button.y) SDL_EVENT_CASE(SDL_MOUSEBUTTONDOWN) PRINT_MBUTTON_EVENT(event); break; SDL_EVENT_CASE(SDL_MOUSEBUTTONUP) PRINT_MBUTTON_EVENT(event); break; #undef PRINT_MBUTTON_EVENT SDL_EVENT_CASE(SDL_MOUSEWHEEL) SDL_snprintf(details, sizeof (details), " (timestamp=%u windowid=%u which=%u x=%d y=%d direction=%s)", (uint) event->wheel.timestamp, (uint) event->wheel.windowID, (uint) event->wheel.which, (int) event->wheel.x, (int) event->wheel.y, event->wheel.direction == SDL_MOUSEWHEEL_NORMAL ? "normal" : "flipped"); break; SDL_EVENT_CASE(SDL_JOYAXISMOTION) SDL_snprintf(details, sizeof (details), " (timestamp=%u which=%d axis=%u value=%d)", (uint) event->jaxis.timestamp, (int) event->jaxis.which, (uint) event->jaxis.axis, (int) event->jaxis.value); break; SDL_EVENT_CASE(SDL_JOYBALLMOTION) SDL_snprintf(details, sizeof (details), " (timestamp=%u which=%d ball=%u xrel=%d yrel=%d)", (uint) event->jball.timestamp, (int) event->jball.which, (uint) event->jball.ball, (int) event->jball.xrel, (int) event->jball.yrel); break; SDL_EVENT_CASE(SDL_JOYHATMOTION) SDL_snprintf(details, sizeof (details), " (timestamp=%u which=%d hat=%u value=%u)", (uint) event->jhat.timestamp, (int) event->jhat.which, (uint) event->jhat.hat, (uint) event->jhat.value); break; #define PRINT_JBUTTON_EVENT(event) \ SDL_snprintf(details, sizeof (details), " (timestamp=%u which=%d button=%u state=%s)", \ (uint) event->jbutton.timestamp, (int) event->jbutton.which, \ (uint) event->jbutton.button, event->jbutton.state == SDL_PRESSED ? "pressed" : "released") SDL_EVENT_CASE(SDL_JOYBUTTONDOWN) PRINT_JBUTTON_EVENT(event); break; SDL_EVENT_CASE(SDL_JOYBUTTONUP) PRINT_JBUTTON_EVENT(event); break; #undef PRINT_JBUTTON_EVENT #define PRINT_JOYDEV_EVENT(event) SDL_snprintf(details, sizeof (details), " (timestamp=%u which=%d)", (uint) event->jdevice.timestamp, (int) event->jdevice.which) SDL_EVENT_CASE(SDL_JOYDEVICEADDED) PRINT_JOYDEV_EVENT(event); break; SDL_EVENT_CASE(SDL_JOYDEVICEREMOVED) PRINT_JOYDEV_EVENT(event); break; #undef PRINT_JOYDEV_EVENT SDL_EVENT_CASE(SDL_CONTROLLERAXISMOTION) SDL_snprintf(details, sizeof (details), " (timestamp=%u which=%d axis=%u value=%d)", (uint) event->caxis.timestamp, (int) event->caxis.which, (uint) event->caxis.axis, (int) event->caxis.value); break; #define PRINT_CBUTTON_EVENT(event) \ SDL_snprintf(details, sizeof (details), " (timestamp=%u which=%d button=%u state=%s)", \ (uint) event->cbutton.timestamp, (int) event->cbutton.which, \ (uint) event->cbutton.button, event->cbutton.state == SDL_PRESSED ? "pressed" : "released") SDL_EVENT_CASE(SDL_CONTROLLERBUTTONDOWN) PRINT_CBUTTON_EVENT(event); break; SDL_EVENT_CASE(SDL_CONTROLLERBUTTONUP) PRINT_CBUTTON_EVENT(event); break; #undef PRINT_CBUTTON_EVENT #define PRINT_CONTROLLERDEV_EVENT(event) SDL_snprintf(details, sizeof (details), " (timestamp=%u which=%d)", (uint) event->cdevice.timestamp, (int) event->cdevice.which) SDL_EVENT_CASE(SDL_CONTROLLERDEVICEADDED) PRINT_CONTROLLERDEV_EVENT(event); break; SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMOVED) PRINT_CONTROLLERDEV_EVENT(event); break; SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMAPPED) PRINT_CONTROLLERDEV_EVENT(event); break; #undef PRINT_CONTROLLERDEV_EVENT #define PRINT_FINGER_EVENT(event) \ SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" fingerid=%"SDL_PRIs64" x=%f y=%f dx=%f dy=%f pressure=%f)", \ (uint) event->tfinger.timestamp, (long long)event->tfinger.touchId, \ (long long)event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \ event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure) SDL_EVENT_CASE(SDL_FINGERDOWN) PRINT_FINGER_EVENT(event); break; SDL_EVENT_CASE(SDL_FINGERUP) PRINT_FINGER_EVENT(event); break; SDL_EVENT_CASE(SDL_FINGERMOTION) PRINT_FINGER_EVENT(event); break; #undef PRINT_FINGER_EVENT #define PRINT_DOLLAR_EVENT(event) \ SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" gestureid=%"SDL_PRIs64" numfingers=%u error=%f x=%f y=%f)", \ (uint) event->dgesture.timestamp, (long long)event->dgesture.touchId, \ (long long)event->dgesture.gestureId, (uint) event->dgesture.numFingers, \ event->dgesture.error, event->dgesture.x, event->dgesture.y); SDL_EVENT_CASE(SDL_DOLLARGESTURE) PRINT_DOLLAR_EVENT(event); break; SDL_EVENT_CASE(SDL_DOLLARRECORD) PRINT_DOLLAR_EVENT(event); break; #undef PRINT_DOLLAR_EVENT SDL_EVENT_CASE(SDL_MULTIGESTURE) SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" dtheta=%f ddist=%f x=%f y=%f numfingers=%u)", (uint) event->mgesture.timestamp, (long long)event->mgesture.touchId, event->mgesture.dTheta, event->mgesture.dDist, event->mgesture.x, event->mgesture.y, (uint) event->mgesture.numFingers); break; #define PRINT_DROP_EVENT(event) SDL_snprintf(details, sizeof (details), " (file='%s' timestamp=%u windowid=%u)", event->drop.file, (uint) event->drop.timestamp, (uint) event->drop.windowID) SDL_EVENT_CASE(SDL_DROPFILE) PRINT_DROP_EVENT(event); break; SDL_EVENT_CASE(SDL_DROPTEXT) PRINT_DROP_EVENT(event); break; SDL_EVENT_CASE(SDL_DROPBEGIN) PRINT_DROP_EVENT(event); break; SDL_EVENT_CASE(SDL_DROPCOMPLETE) PRINT_DROP_EVENT(event); break; #undef PRINT_DROP_EVENT #define PRINT_AUDIODEV_EVENT(event) SDL_snprintf(details, sizeof (details), " (timestamp=%u which=%u iscapture=%s)", (uint) event->adevice.timestamp, (uint) event->adevice.which, event->adevice.iscapture ? "true" : "false"); SDL_EVENT_CASE(SDL_AUDIODEVICEADDED) PRINT_AUDIODEV_EVENT(event); break; SDL_EVENT_CASE(SDL_AUDIODEVICEREMOVED) PRINT_AUDIODEV_EVENT(event); break; #undef PRINT_AUDIODEV_EVENT #undef SDL_EVENT_CASE default: if (!name[0]) { SDL_strlcpy(name, "UNKNOWN", sizeof (name)); SDL_snprintf(details, sizeof (details), " #%u! (Bug? FIXME?)", (uint) event->type); } break; } if (name[0]) { SDL_Log("SDL EVENT: %s%s", name, details); } #undef uint } /* Public functions */ void SDL_StopEventLoop(void) { const char *report = SDL_GetHint("SDL_EVENT_QUEUE_STATISTICS"); int i; SDL_EventEntry *entry; SDL_SysWMEntry *wmmsg; if (SDL_EventQ.lock) { SDL_LockMutex(SDL_EventQ.lock); } SDL_AtomicSet(&SDL_EventQ.active, 0); if (report && SDL_atoi(report)) { SDL_Log("SDL EVENT QUEUE: Maximum events in-flight: %d\n", SDL_EventQ.max_events_seen); } /* Clean out EventQ */ for (entry = SDL_EventQ.head; entry; ) { SDL_EventEntry *next = entry->next; SDL_free(entry); entry = next; } for (entry = SDL_EventQ.free; entry; ) { SDL_EventEntry *next = entry->next; SDL_free(entry); entry = next; } for (wmmsg = SDL_EventQ.wmmsg_used; wmmsg; ) { SDL_SysWMEntry *next = wmmsg->next; SDL_free(wmmsg); wmmsg = next; } for (wmmsg = SDL_EventQ.wmmsg_free; wmmsg; ) { SDL_SysWMEntry *next = wmmsg->next; SDL_free(wmmsg); wmmsg = next; } SDL_AtomicSet(&SDL_EventQ.count, 0); SDL_EventQ.max_events_seen = 0; SDL_EventQ.head = NULL; SDL_EventQ.tail = NULL; SDL_EventQ.free = NULL; SDL_EventQ.wmmsg_used = NULL; SDL_EventQ.wmmsg_free = NULL; /* Clear disabled event state */ for (i = 0; i < SDL_arraysize(SDL_disabled_events); ++i) { SDL_free(SDL_disabled_events[i]); SDL_disabled_events[i] = NULL; } if (SDL_event_watchers_lock) { SDL_DestroyMutex(SDL_event_watchers_lock); SDL_event_watchers_lock = NULL; } if (SDL_event_watchers) { SDL_free(SDL_event_watchers); SDL_event_watchers = NULL; SDL_event_watchers_count = 0; } SDL_zero(SDL_EventOK); if (SDL_EventQ.lock) { SDL_UnlockMutex(SDL_EventQ.lock); SDL_DestroyMutex(SDL_EventQ.lock); SDL_EventQ.lock = NULL; } } /* This function (and associated calls) may be called more than once */ int SDL_StartEventLoop(void) { /* We'll leave the event queue alone, since we might have gotten some important events at launch (like SDL_DROPFILE) FIXME: Does this introduce any other bugs with events at startup? */ /* Create the lock and set ourselves active */ #if !SDL_THREADS_DISABLED if (!SDL_EventQ.lock) { SDL_EventQ.lock = SDL_CreateMutex(); if (SDL_EventQ.lock == NULL) { return -1; } } if (!SDL_event_watchers_lock) { SDL_event_watchers_lock = SDL_CreateMutex(); if (SDL_event_watchers_lock == NULL) { return -1; } } #endif /* !SDL_THREADS_DISABLED */ /* Process most event types */ SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE); SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE); SDL_EventState(SDL_SYSWMEVENT, SDL_DISABLE); #if 0 /* Leave these events enabled so apps can respond to items being dragged onto them at startup */ SDL_EventState(SDL_DROPFILE, SDL_DISABLE); SDL_EventState(SDL_DROPTEXT, SDL_DISABLE); #endif SDL_AtomicSet(&SDL_EventQ.active, 1); return 0; } /* Add an event to the event queue -- called with the queue locked */ static int SDL_AddEvent(SDL_Event * event) { SDL_EventEntry *entry; const int initial_count = SDL_AtomicGet(&SDL_EventQ.count); int final_count; if (initial_count >= SDL_MAX_QUEUED_EVENTS) { SDL_SetError("Event queue is full (%d events)", initial_count); return 0; } if (SDL_EventQ.free == NULL) { entry = (SDL_EventEntry *)SDL_malloc(sizeof(*entry)); if (!entry) { return 0; } } else { entry = SDL_EventQ.free; SDL_EventQ.free = entry->next; } if (SDL_DoEventLogging) { SDL_LogEvent(event); } entry->event = *event; if (event->type == SDL_SYSWMEVENT) { entry->msg = *event->syswm.msg; entry->event.syswm.msg = &entry->msg; } if (SDL_EventQ.tail) { SDL_EventQ.tail->next = entry; entry->prev = SDL_EventQ.tail; SDL_EventQ.tail = entry; entry->next = NULL; } else { SDL_assert(!SDL_EventQ.head); SDL_EventQ.head = entry; SDL_EventQ.tail = entry; entry->prev = NULL; entry->next = NULL; } final_count = SDL_AtomicAdd(&SDL_EventQ.count, 1) + 1; if (final_count > SDL_EventQ.max_events_seen) { SDL_EventQ.max_events_seen = final_count; } return 1; } /* Remove an event from the queue -- called with the queue locked */ static void SDL_CutEvent(SDL_EventEntry *entry) { if (entry->prev) { entry->prev->next = entry->next; } if (entry->next) { entry->next->prev = entry->prev; } if (entry == SDL_EventQ.head) { SDL_assert(entry->prev == NULL); SDL_EventQ.head = entry->next; } if (entry == SDL_EventQ.tail) { SDL_assert(entry->next == NULL); SDL_EventQ.tail = entry->prev; } entry->next = SDL_EventQ.free; SDL_EventQ.free = entry; SDL_assert(SDL_AtomicGet(&SDL_EventQ.count) > 0); SDL_AtomicAdd(&SDL_EventQ.count, -1); } /* Lock the event queue, take a peep at it, and unlock it */ int SDL_PeepEvents(SDL_Event * events, int numevents, SDL_eventaction action, Uint32 minType, Uint32 maxType) { int i, used; /* Don't look after we've quit */ if (!SDL_AtomicGet(&SDL_EventQ.active)) { /* We get a few spurious events at shutdown, so don't warn then */ if (action != SDL_ADDEVENT) { SDL_SetError("The event system has been shut down"); } return (-1); } /* Lock the event queue */ used = 0; if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) { if (action == SDL_ADDEVENT) { for (i = 0; i < numevents; ++i) { used += SDL_AddEvent(&events[i]); } } else { SDL_EventEntry *entry, *next; SDL_SysWMEntry *wmmsg, *wmmsg_next; Uint32 type; if (action == SDL_GETEVENT) { /* Clean out any used wmmsg data FIXME: Do we want to retain the data for some period of time? */ for (wmmsg = SDL_EventQ.wmmsg_used; wmmsg; wmmsg = wmmsg_next) { wmmsg_next = wmmsg->next; wmmsg->next = SDL_EventQ.wmmsg_free; SDL_EventQ.wmmsg_free = wmmsg; } SDL_EventQ.wmmsg_used = NULL; } for (entry = SDL_EventQ.head; entry && (!events || used < numevents); entry = next) { next = entry->next; type = entry->event.type; if (minType <= type && type <= maxType) { if (events) { events[used] = entry->event; if (entry->event.type == SDL_SYSWMEVENT) { /* We need to copy the wmmsg somewhere safe. For now we'll guarantee it's valid at least until the next call to SDL_PeepEvents() */ if (SDL_EventQ.wmmsg_free) { wmmsg = SDL_EventQ.wmmsg_free; SDL_EventQ.wmmsg_free = wmmsg->next; } else { wmmsg = (SDL_SysWMEntry *)SDL_malloc(sizeof(*wmmsg)); } wmmsg->msg = *entry->event.syswm.msg; wmmsg->next = SDL_EventQ.wmmsg_used; SDL_EventQ.wmmsg_used = wmmsg; events[used].syswm.msg = &wmmsg->msg; } if (action == SDL_GETEVENT) { SDL_CutEvent(entry); } } ++used; } } } if (SDL_EventQ.lock) { SDL_UnlockMutex(SDL_EventQ.lock); } } else { return SDL_SetError("Couldn't lock event queue"); } return (used); } SDL_bool SDL_HasEvent(Uint32 type) { return (SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, type, type) > 0); } SDL_bool SDL_HasEvents(Uint32 minType, Uint32 maxType) { return (SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, minType, maxType) > 0); } void SDL_FlushEvent(Uint32 type) { SDL_FlushEvents(type, type); } void SDL_FlushEvents(Uint32 minType, Uint32 maxType) { /* !!! FIXME: we need to manually SDL_free() the strings in TEXTINPUT and drag'n'drop events if we're flushing them without passing them to the app, but I don't know if this is the right place to do that. */ /* Don't look after we've quit */ if (!SDL_AtomicGet(&SDL_EventQ.active)) { return; } /* Make sure the events are current */ #if 0 /* Actually, we can't do this since we might be flushing while processing a resize event, and calling this might trigger further resize events. */ SDL_PumpEvents(); #endif /* Lock the event queue */ if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) { SDL_EventEntry *entry, *next; Uint32 type; for (entry = SDL_EventQ.head; entry; entry = next) { next = entry->next; type = entry->event.type; if (minType <= type && type <= maxType) { SDL_CutEvent(entry); } } if (SDL_EventQ.lock) { SDL_UnlockMutex(SDL_EventQ.lock); } } } /* Run the system dependent event loops */ void SDL_PumpEvents(void) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); /* Release any keys held down from last frame */ SDL_ReleaseAutoReleaseKeys(); /* Get events from the video subsystem */ if (_this) { _this->PumpEvents(_this); } #if !SDL_JOYSTICK_DISABLED /* Check for joystick state change */ if ((!SDL_disabled_events[SDL_JOYAXISMOTION >> 8] || SDL_JoystickEventState(SDL_QUERY))) { SDL_JoystickUpdate(); } #endif #if !SDL_SENSOR_DISABLED /* Check for sensor state change */ if (!SDL_disabled_events[SDL_SENSORUPDATE >> 8]) { SDL_SensorUpdate(); } #endif SDL_SendPendingSignalEvents(); /* in case we had a signal handler fire, etc. */ } /* Public functions */ int SDL_PollEvent(SDL_Event * event) { return SDL_WaitEventTimeout(event, 0); } int SDL_WaitEvent(SDL_Event * event) { return SDL_WaitEventTimeout(event, -1); } int SDL_WaitEventTimeout(SDL_Event * event, int timeout) { Uint32 expiration = 0; if (timeout > 0) expiration = SDL_GetTicks() + timeout; for (;;) { SDL_PumpEvents(); switch (SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT)) { case -1: return 0; case 0: if (timeout == 0) { /* Polling and no events, just return */ return 0; } if (timeout > 0 && SDL_TICKS_PASSED(SDL_GetTicks(), expiration)) { /* Timeout expired and no events */ return 0; } SDL_Delay(1); break; default: /* Has events */ return 1; } } } int SDL_PushEvent(SDL_Event * event) { event->common.timestamp = SDL_GetTicks(); if (SDL_EventOK.callback || SDL_event_watchers_count > 0) { if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) { if (SDL_EventOK.callback && !SDL_EventOK.callback(SDL_EventOK.userdata, event)) { if (SDL_event_watchers_lock) { SDL_UnlockMutex(SDL_event_watchers_lock); } return 0; } if (SDL_event_watchers_count > 0) { /* Make sure we only dispatch the current watcher list */ int i, event_watchers_count = SDL_event_watchers_count; SDL_event_watchers_dispatching = SDL_TRUE; for (i = 0; i < event_watchers_count; ++i) { if (!SDL_event_watchers[i].removed) { SDL_event_watchers[i].callback(SDL_event_watchers[i].userdata, event); } } SDL_event_watchers_dispatching = SDL_FALSE; if (SDL_event_watchers_removed) { for (i = SDL_event_watchers_count; i--; ) { if (SDL_event_watchers[i].removed) { --SDL_event_watchers_count; if (i < SDL_event_watchers_count) { SDL_memmove(&SDL_event_watchers[i], &SDL_event_watchers[i+1], (SDL_event_watchers_count - i) * sizeof(SDL_event_watchers[i])); } } } SDL_event_watchers_removed = SDL_FALSE; } } if (SDL_event_watchers_lock) { SDL_UnlockMutex(SDL_event_watchers_lock); } } } if (SDL_PeepEvents(event, 1, SDL_ADDEVENT, 0, 0) <= 0) { return -1; } SDL_GestureProcessEvent(event); return 1; } void SDL_SetEventFilter(SDL_EventFilter filter, void *userdata) { if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) { /* Set filter and discard pending events */ SDL_EventOK.callback = filter; SDL_EventOK.userdata = userdata; SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT); if (SDL_event_watchers_lock) { SDL_UnlockMutex(SDL_event_watchers_lock); } } } SDL_bool SDL_GetEventFilter(SDL_EventFilter * filter, void **userdata) { SDL_EventWatcher event_ok; if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) { event_ok = SDL_EventOK; if (SDL_event_watchers_lock) { SDL_UnlockMutex(SDL_event_watchers_lock); } } else { SDL_zero(event_ok); } if (filter) { *filter = event_ok.callback; } if (userdata) { *userdata = event_ok.userdata; } return event_ok.callback ? SDL_TRUE : SDL_FALSE; } void SDL_AddEventWatch(SDL_EventFilter filter, void *userdata) { if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) { SDL_EventWatcher *event_watchers; event_watchers = SDL_realloc(SDL_event_watchers, (SDL_event_watchers_count + 1) * sizeof(*event_watchers)); if (event_watchers) { SDL_EventWatcher *watcher; SDL_event_watchers = event_watchers; watcher = &SDL_event_watchers[SDL_event_watchers_count]; watcher->callback = filter; watcher->userdata = userdata; watcher->removed = SDL_FALSE; ++SDL_event_watchers_count; } if (SDL_event_watchers_lock) { SDL_UnlockMutex(SDL_event_watchers_lock); } } } void SDL_DelEventWatch(SDL_EventFilter filter, void *userdata) { if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) { int i; for (i = 0; i < SDL_event_watchers_count; ++i) { if (SDL_event_watchers[i].callback == filter && SDL_event_watchers[i].userdata == userdata) { if (SDL_event_watchers_dispatching) { SDL_event_watchers[i].removed = SDL_TRUE; SDL_event_watchers_removed = SDL_TRUE; } else { --SDL_event_watchers_count; if (i < SDL_event_watchers_count) { SDL_memmove(&SDL_event_watchers[i], &SDL_event_watchers[i+1], (SDL_event_watchers_count - i) * sizeof(SDL_event_watchers[i])); } } break; } } if (SDL_event_watchers_lock) { SDL_UnlockMutex(SDL_event_watchers_lock); } } } void SDL_FilterEvents(SDL_EventFilter filter, void *userdata) { if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) { SDL_EventEntry *entry, *next; for (entry = SDL_EventQ.head; entry; entry = next) { next = entry->next; if (!filter(userdata, &entry->event)) { SDL_CutEvent(entry); } } if (SDL_EventQ.lock) { SDL_UnlockMutex(SDL_EventQ.lock); } } } Uint8 SDL_EventState(Uint32 type, int state) { const SDL_bool isdnd = ((state == SDL_DISABLE) || (state == SDL_ENABLE)) && ((type == SDL_DROPFILE) || (type == SDL_DROPTEXT)); Uint8 current_state; Uint8 hi = ((type >> 8) & 0xff); Uint8 lo = (type & 0xff); if (SDL_disabled_events[hi] && (SDL_disabled_events[hi]->bits[lo/32] & (1 << (lo&31)))) { current_state = SDL_DISABLE; } else { current_state = SDL_ENABLE; } if (state != current_state) { switch (state) { case SDL_DISABLE: /* Disable this event type and discard pending events */ if (!SDL_disabled_events[hi]) { SDL_disabled_events[hi] = (SDL_DisabledEventBlock*) SDL_calloc(1, sizeof(SDL_DisabledEventBlock)); if (!SDL_disabled_events[hi]) { /* Out of memory, nothing we can do... */ break; } } SDL_disabled_events[hi]->bits[lo/32] |= (1 << (lo&31)); SDL_FlushEvent(type); break; case SDL_ENABLE: SDL_disabled_events[hi]->bits[lo/32] &= ~(1 << (lo&31)); break; default: /* Querying state... */ break; } } /* turn off drag'n'drop support if we've disabled the events. This might change some UI details at the OS level. */ if (isdnd) { SDL_ToggleDragAndDropSupport(); } return current_state; } Uint32 SDL_RegisterEvents(int numevents) { Uint32 event_base; if ((numevents > 0) && (SDL_userevents+numevents <= SDL_LASTEVENT)) { event_base = SDL_userevents; SDL_userevents += numevents; } else { event_base = (Uint32)-1; } return event_base; } int SDL_SendAppEvent(SDL_EventType eventType) { int posted; posted = 0; if (SDL_GetEventState(eventType) == SDL_ENABLE) { SDL_Event event; event.type = eventType; posted = (SDL_PushEvent(&event) > 0); } return (posted); } int SDL_SendSysWMEvent(SDL_SysWMmsg * message) { int posted; posted = 0; if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) { SDL_Event event; SDL_memset(&event, 0, sizeof(event)); event.type = SDL_SYSWMEVENT; event.syswm.msg = message; posted = (SDL_PushEvent(&event) > 0); } /* Update internal event state */ return (posted); } int SDL_SendKeymapChangedEvent(void) { return SDL_SendAppEvent(SDL_KEYMAPCHANGED); } int SDL_SendLocaleChangedEvent(void) { return SDL_SendAppEvent(SDL_LOCALECHANGED); } int SDL_EventsInit(void) { SDL_AddHintCallback(SDL_HINT_EVENT_LOGGING, SDL_EventLoggingChanged, NULL); if (SDL_StartEventLoop() < 0) { SDL_DelHintCallback(SDL_HINT_EVENT_LOGGING, SDL_EventLoggingChanged, NULL); return -1; } SDL_QuitInit(); return 0; } void SDL_EventsQuit(void) { SDL_QuitQuit(); SDL_StopEventLoop(); SDL_DelHintCallback(SDL_HINT_EVENT_LOGGING, SDL_EventLoggingChanged, NULL); } /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/SDL_events.c
C
apache-2.0
36,078
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef SDL_events_c_h_ #define SDL_events_c_h_ #include "../SDL_internal.h" /* Useful functions and variables from SDL_events.c */ #include "SDL_events.h" #include "SDL_thread.h" #include "../video/SDL_sysvideo.h" #include "SDL_clipboardevents_c.h" #include "SDL_displayevents_c.h" #include "SDL_dropevents_c.h" #include "SDL_gesture_c.h" #include "SDL_keyboard_c.h" #include "SDL_mouse_c.h" #include "SDL_touch_c.h" #include "SDL_windowevents_c.h" /* Start and stop the event processing loop */ extern int SDL_StartEventLoop(void); extern void SDL_StopEventLoop(void); extern void SDL_QuitInterrupt(void); extern int SDL_SendAppEvent(SDL_EventType eventType); extern int SDL_SendSysWMEvent(SDL_SysWMmsg * message); extern int SDL_SendKeymapChangedEvent(void); extern int SDL_SendLocaleChangedEvent(void); extern int SDL_SendQuit(void); extern int SDL_EventsInit(void); extern void SDL_EventsQuit(void); extern void SDL_SendPendingSignalEvents(void); extern int SDL_QuitInit(void); extern void SDL_QuitQuit(void); #endif /* SDL_events_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/SDL_events_c.h
C
apache-2.0
2,030
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" /* General gesture handling code for SDL */ #include "SDL_events.h" #include "SDL_endian.h" #include "SDL_events_c.h" #include "SDL_gesture_c.h" /* #include <stdio.h> */ /* TODO: Replace with malloc */ #define MAXPATHSIZE 1024 #define ENABLE_DOLLAR #define DOLLARNPOINTS 64 #if defined(ENABLE_DOLLAR) # define DOLLARSIZE 256 # define PHI 0.618033989 #endif typedef struct { float x,y; } SDL_FloatPoint; typedef struct { float length; int numPoints; SDL_FloatPoint p[MAXPATHSIZE]; } SDL_DollarPath; typedef struct { SDL_FloatPoint path[DOLLARNPOINTS]; unsigned long hash; } SDL_DollarTemplate; typedef struct { SDL_TouchID id; SDL_FloatPoint centroid; SDL_DollarPath dollarPath; Uint16 numDownFingers; int numDollarTemplates; SDL_DollarTemplate *dollarTemplate; SDL_bool recording; } SDL_GestureTouch; static SDL_GestureTouch *SDL_gestureTouch; static int SDL_numGestureTouches = 0; static SDL_bool recordAll; #if 0 static void PrintPath(SDL_FloatPoint *path) { int i; printf("Path:"); for (i=0; i<DOLLARNPOINTS; i++) { printf(" (%f,%f)",path[i].x,path[i].y); } printf("\n"); } #endif int SDL_RecordGesture(SDL_TouchID touchId) { int i; if (touchId < 0) recordAll = SDL_TRUE; for (i = 0; i < SDL_numGestureTouches; i++) { if ((touchId < 0) || (SDL_gestureTouch[i].id == touchId)) { SDL_gestureTouch[i].recording = SDL_TRUE; if (touchId >= 0) return 1; } } return (touchId < 0); } void SDL_GestureQuit() { SDL_free(SDL_gestureTouch); SDL_gestureTouch = NULL; } static unsigned long SDL_HashDollar(SDL_FloatPoint* points) { unsigned long hash = 5381; int i; for (i = 0; i < DOLLARNPOINTS; i++) { hash = ((hash<<5) + hash) + (unsigned long)points[i].x; hash = ((hash<<5) + hash) + (unsigned long)points[i].y; } return hash; } static int SaveTemplate(SDL_DollarTemplate *templ, SDL_RWops *dst) { if (dst == NULL) { return 0; } /* No Longer storing the Hash, rehash on load */ /* if (SDL_RWops.write(dst, &(templ->hash), sizeof(templ->hash), 1) != 1) return 0; */ #if SDL_BYTEORDER == SDL_LIL_ENDIAN if (SDL_RWwrite(dst, templ->path, sizeof(templ->path[0]),DOLLARNPOINTS) != DOLLARNPOINTS) { return 0; } #else { SDL_DollarTemplate copy = *templ; SDL_FloatPoint *p = copy.path; int i; for (i = 0; i < DOLLARNPOINTS; i++, p++) { p->x = SDL_SwapFloatLE(p->x); p->y = SDL_SwapFloatLE(p->y); } if (SDL_RWwrite(dst, copy.path, sizeof(copy.path[0]),DOLLARNPOINTS) != DOLLARNPOINTS) { return 0; } } #endif return 1; } int SDL_SaveAllDollarTemplates(SDL_RWops *dst) { int i,j,rtrn = 0; for (i = 0; i < SDL_numGestureTouches; i++) { SDL_GestureTouch* touch = &SDL_gestureTouch[i]; for (j = 0; j < touch->numDollarTemplates; j++) { rtrn += SaveTemplate(&touch->dollarTemplate[j], dst); } } return rtrn; } int SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_RWops *dst) { int i,j; for (i = 0; i < SDL_numGestureTouches; i++) { SDL_GestureTouch* touch = &SDL_gestureTouch[i]; for (j = 0; j < touch->numDollarTemplates; j++) { if (touch->dollarTemplate[j].hash == gestureId) { return SaveTemplate(&touch->dollarTemplate[j], dst); } } } return SDL_SetError("Unknown gestureId"); } /* path is an already sampled set of points Returns the index of the gesture on success, or -1 */ static int SDL_AddDollarGesture_one(SDL_GestureTouch* inTouch, SDL_FloatPoint* path) { SDL_DollarTemplate* dollarTemplate; SDL_DollarTemplate *templ; int index; index = inTouch->numDollarTemplates; dollarTemplate = (SDL_DollarTemplate *)SDL_realloc(inTouch->dollarTemplate, (index + 1) * sizeof(SDL_DollarTemplate)); if (!dollarTemplate) { return SDL_OutOfMemory(); } inTouch->dollarTemplate = dollarTemplate; templ = &inTouch->dollarTemplate[index]; SDL_memcpy(templ->path, path, DOLLARNPOINTS*sizeof(SDL_FloatPoint)); templ->hash = SDL_HashDollar(templ->path); inTouch->numDollarTemplates++; return index; } static int SDL_AddDollarGesture(SDL_GestureTouch* inTouch, SDL_FloatPoint* path) { int index = -1; int i = 0; if (inTouch == NULL) { if (SDL_numGestureTouches == 0) return SDL_SetError("no gesture touch devices registered"); for (i = 0; i < SDL_numGestureTouches; i++) { inTouch = &SDL_gestureTouch[i]; index = SDL_AddDollarGesture_one(inTouch, path); if (index < 0) return -1; } /* Use the index of the last one added. */ return index; } return SDL_AddDollarGesture_one(inTouch, path); } int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src) { int i,loaded = 0; SDL_GestureTouch *touch = NULL; if (src == NULL) return 0; if (touchId >= 0) { for (i = 0; i < SDL_numGestureTouches; i++) { if (SDL_gestureTouch[i].id == touchId) { touch = &SDL_gestureTouch[i]; } } if (touch == NULL) { return SDL_SetError("given touch id not found"); } } while (1) { SDL_DollarTemplate templ; if (SDL_RWread(src,templ.path,sizeof(templ.path[0]),DOLLARNPOINTS) < DOLLARNPOINTS) { if (loaded == 0) { return SDL_SetError("could not read any dollar gesture from rwops"); } break; } #if SDL_BYTEORDER != SDL_LIL_ENDIAN for (i = 0; i < DOLLARNPOINTS; i++) { SDL_FloatPoint *p = &templ.path[i]; p->x = SDL_SwapFloatLE(p->x); p->y = SDL_SwapFloatLE(p->y); } #endif if (touchId >= 0) { /* printf("Adding loaded gesture to 1 touch\n"); */ if (SDL_AddDollarGesture(touch, templ.path) >= 0) loaded++; } else { /* printf("Adding to: %i touches\n",SDL_numGestureTouches); */ for (i = 0; i < SDL_numGestureTouches; i++) { touch = &SDL_gestureTouch[i]; /* printf("Adding loaded gesture to + touches\n"); */ /* TODO: What if this fails? */ SDL_AddDollarGesture(touch,templ.path); } loaded++; } } return loaded; } #if defined(ENABLE_DOLLAR) static float dollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ,float ang) { /* SDL_FloatPoint p[DOLLARNPOINTS]; */ float dist = 0; SDL_FloatPoint p; int i; for (i = 0; i < DOLLARNPOINTS; i++) { p.x = (float)(points[i].x * SDL_cos(ang) - points[i].y * SDL_sin(ang)); p.y = (float)(points[i].x * SDL_sin(ang) + points[i].y * SDL_cos(ang)); dist += (float)(SDL_sqrt((p.x-templ[i].x)*(p.x-templ[i].x)+ (p.y-templ[i].y)*(p.y-templ[i].y))); } return dist/DOLLARNPOINTS; } static float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ) { /*------------BEGIN DOLLAR BLACKBOX------------------ -TRANSLATED DIRECTLY FROM PSUDEO-CODE AVAILABLE AT- -"http://depts.washington.edu/aimgroup/proj/dollar/" */ double ta = -M_PI/4; double tb = M_PI/4; double dt = M_PI/90; float x1 = (float)(PHI*ta + (1-PHI)*tb); float f1 = dollarDifference(points,templ,x1); float x2 = (float)((1-PHI)*ta + PHI*tb); float f2 = dollarDifference(points,templ,x2); while (SDL_fabs(ta-tb) > dt) { if (f1 < f2) { tb = x2; x2 = x1; f2 = f1; x1 = (float)(PHI*ta + (1-PHI)*tb); f1 = dollarDifference(points,templ,x1); } else { ta = x1; x1 = x2; f1 = f2; x2 = (float)((1-PHI)*ta + PHI*tb); f2 = dollarDifference(points,templ,x2); } } /* if (f1 <= f2) printf("Min angle (x1): %f\n",x1); else if (f1 > f2) printf("Min angle (x2): %f\n",x2); */ return SDL_min(f1,f2); } /* DollarPath contains raw points, plus (possibly) the calculated length */ static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points, SDL_bool is_recording) { int i; float interval; float dist; int numPoints = 0; SDL_FloatPoint centroid; float xmin,xmax,ymin,ymax; float ang; float w,h; float length = path->length; /* Calculate length if it hasn't already been done */ if (length <= 0) { for (i=1;i < path->numPoints; i++) { float dx = path->p[i ].x - path->p[i-1].x; float dy = path->p[i ].y - path->p[i-1].y; length += (float)(SDL_sqrt(dx*dx+dy*dy)); } } /* Resample */ interval = length/(DOLLARNPOINTS - 1); dist = interval; centroid.x = 0;centroid.y = 0; /* printf("(%f,%f)\n",path->p[path->numPoints-1].x,path->p[path->numPoints-1].y); */ for (i = 1; i < path->numPoints; i++) { float d = (float)(SDL_sqrt((path->p[i-1].x-path->p[i].x)*(path->p[i-1].x-path->p[i].x)+ (path->p[i-1].y-path->p[i].y)*(path->p[i-1].y-path->p[i].y))); /* printf("d = %f dist = %f/%f\n",d,dist,interval); */ while (dist + d > interval) { points[numPoints].x = path->p[i-1].x + ((interval-dist)/d)*(path->p[i].x-path->p[i-1].x); points[numPoints].y = path->p[i-1].y + ((interval-dist)/d)*(path->p[i].y-path->p[i-1].y); centroid.x += points[numPoints].x; centroid.y += points[numPoints].y; numPoints++; dist -= interval; } dist += d; } if (numPoints < DOLLARNPOINTS-1) { if (is_recording) { SDL_SetError("ERROR: NumPoints = %i", numPoints); } return 0; } /* copy the last point */ points[DOLLARNPOINTS-1] = path->p[path->numPoints-1]; numPoints = DOLLARNPOINTS; centroid.x /= numPoints; centroid.y /= numPoints; /* printf("Centroid (%f,%f)",centroid.x,centroid.y); */ /* Rotate Points so point 0 is left of centroid and solve for the bounding box */ xmin = centroid.x; xmax = centroid.x; ymin = centroid.y; ymax = centroid.y; ang = (float)(SDL_atan2(centroid.y - points[0].y, centroid.x - points[0].x)); for (i = 0; i<numPoints; i++) { float px = points[i].x; float py = points[i].y; points[i].x = (float)((px - centroid.x)*SDL_cos(ang) - (py - centroid.y)*SDL_sin(ang) + centroid.x); points[i].y = (float)((px - centroid.x)*SDL_sin(ang) + (py - centroid.y)*SDL_cos(ang) + centroid.y); if (points[i].x < xmin) xmin = points[i].x; if (points[i].x > xmax) xmax = points[i].x; if (points[i].y < ymin) ymin = points[i].y; if (points[i].y > ymax) ymax = points[i].y; } /* Scale points to DOLLARSIZE, and translate to the origin */ w = xmax-xmin; h = ymax-ymin; for (i=0; i<numPoints; i++) { points[i].x = (points[i].x - centroid.x)*DOLLARSIZE/w; points[i].y = (points[i].y - centroid.y)*DOLLARSIZE/h; } return numPoints; } static float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_GestureTouch* touch) { SDL_FloatPoint points[DOLLARNPOINTS]; int i; float bestDiff = 10000; SDL_memset(points, 0, sizeof(points)); dollarNormalize(path, points, SDL_FALSE); /* PrintPath(points); */ *bestTempl = -1; for (i = 0; i < touch->numDollarTemplates; i++) { float diff = bestDollarDifference(points,touch->dollarTemplate[i].path); if (diff < bestDiff) {bestDiff = diff; *bestTempl = i;} } return bestDiff; } #endif int SDL_GestureAddTouch(SDL_TouchID touchId) { SDL_GestureTouch *gestureTouch = (SDL_GestureTouch *)SDL_realloc(SDL_gestureTouch, (SDL_numGestureTouches + 1) * sizeof(SDL_GestureTouch)); if (!gestureTouch) { return SDL_OutOfMemory(); } SDL_gestureTouch = gestureTouch; SDL_zero(SDL_gestureTouch[SDL_numGestureTouches]); SDL_gestureTouch[SDL_numGestureTouches].id = touchId; SDL_numGestureTouches++; return 0; } int SDL_GestureDelTouch(SDL_TouchID touchId) { int i; for (i = 0; i < SDL_numGestureTouches; i++) { if (SDL_gestureTouch[i].id == touchId) { break; } } if (i == SDL_numGestureTouches) { /* not found */ return -1; } SDL_free(SDL_gestureTouch[i].dollarTemplate); SDL_zero(SDL_gestureTouch[i]); SDL_numGestureTouches--; SDL_memcpy(&SDL_gestureTouch[i], &SDL_gestureTouch[SDL_numGestureTouches], sizeof(SDL_gestureTouch[i])); return 0; } static SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id) { int i; for (i = 0; i < SDL_numGestureTouches; i++) { /* printf("%i ?= %i\n",SDL_gestureTouch[i].id,id); */ if (SDL_gestureTouch[i].id == id) return &SDL_gestureTouch[i]; } return NULL; } static void SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist) { if (SDL_GetEventState(SDL_MULTIGESTURE) == SDL_ENABLE) { SDL_Event event; event.mgesture.type = SDL_MULTIGESTURE; event.mgesture.touchId = touch->id; event.mgesture.x = touch->centroid.x; event.mgesture.y = touch->centroid.y; event.mgesture.dTheta = dTheta; event.mgesture.dDist = dDist; event.mgesture.numFingers = touch->numDownFingers; SDL_PushEvent(&event); } } #if defined(ENABLE_DOLLAR) static void SDL_SendGestureDollar(SDL_GestureTouch* touch, SDL_GestureID gestureId,float error) { if (SDL_GetEventState(SDL_DOLLARGESTURE) == SDL_ENABLE) { SDL_Event event; event.dgesture.type = SDL_DOLLARGESTURE; event.dgesture.touchId = touch->id; event.dgesture.x = touch->centroid.x; event.dgesture.y = touch->centroid.y; event.dgesture.gestureId = gestureId; event.dgesture.error = error; /* A finger came up to trigger this event. */ event.dgesture.numFingers = touch->numDownFingers + 1; SDL_PushEvent(&event); } } static void SDL_SendDollarRecord(SDL_GestureTouch* touch,SDL_GestureID gestureId) { if (SDL_GetEventState(SDL_DOLLARRECORD) == SDL_ENABLE) { SDL_Event event; event.dgesture.type = SDL_DOLLARRECORD; event.dgesture.touchId = touch->id; event.dgesture.gestureId = gestureId; SDL_PushEvent(&event); } } #endif void SDL_GestureProcessEvent(SDL_Event* event) { float x,y; #if defined(ENABLE_DOLLAR) int index; int i; float pathDx, pathDy; #endif SDL_FloatPoint lastP; SDL_FloatPoint lastCentroid; float lDist; float Dist; float dtheta; float dDist; if (event->type == SDL_FINGERMOTION || event->type == SDL_FINGERDOWN || event->type == SDL_FINGERUP) { SDL_GestureTouch* inTouch = SDL_GetGestureTouch(event->tfinger.touchId); /* Shouldn't be possible */ if (inTouch == NULL) return; x = event->tfinger.x; y = event->tfinger.y; /* Finger Up */ if (event->type == SDL_FINGERUP) { #if defined(ENABLE_DOLLAR) SDL_FloatPoint path[DOLLARNPOINTS]; #endif inTouch->numDownFingers--; #if defined(ENABLE_DOLLAR) if (inTouch->recording) { inTouch->recording = SDL_FALSE; dollarNormalize(&inTouch->dollarPath, path, SDL_TRUE); /* PrintPath(path); */ if (recordAll) { index = SDL_AddDollarGesture(NULL,path); for (i = 0; i < SDL_numGestureTouches; i++) SDL_gestureTouch[i].recording = SDL_FALSE; } else { index = SDL_AddDollarGesture(inTouch,path); } if (index >= 0) { SDL_SendDollarRecord(inTouch,inTouch->dollarTemplate[index].hash); } else { SDL_SendDollarRecord(inTouch,-1); } } else { int bestTempl; float error; error = dollarRecognize(&inTouch->dollarPath, &bestTempl,inTouch); if (bestTempl >= 0){ /* Send Event */ unsigned long gestureId = inTouch->dollarTemplate[bestTempl].hash; SDL_SendGestureDollar(inTouch,gestureId,error); /* printf ("%s\n",);("Dollar error: %f\n",error); */ } } #endif /* inTouch->gestureLast[j] = inTouch->gestureLast[inTouch->numDownFingers]; */ if (inTouch->numDownFingers > 0) { inTouch->centroid.x = (inTouch->centroid.x*(inTouch->numDownFingers+1)- x)/inTouch->numDownFingers; inTouch->centroid.y = (inTouch->centroid.y*(inTouch->numDownFingers+1)- y)/inTouch->numDownFingers; } } else if (event->type == SDL_FINGERMOTION) { float dx = event->tfinger.dx; float dy = event->tfinger.dy; #if defined(ENABLE_DOLLAR) SDL_DollarPath* path = &inTouch->dollarPath; if (path->numPoints < MAXPATHSIZE) { path->p[path->numPoints].x = inTouch->centroid.x; path->p[path->numPoints].y = inTouch->centroid.y; pathDx = (path->p[path->numPoints].x-path->p[path->numPoints-1].x); pathDy = (path->p[path->numPoints].y-path->p[path->numPoints-1].y); path->length += (float)SDL_sqrt(pathDx*pathDx + pathDy*pathDy); path->numPoints++; } #endif lastP.x = x - dx; lastP.y = y - dy; lastCentroid = inTouch->centroid; inTouch->centroid.x += dx/inTouch->numDownFingers; inTouch->centroid.y += dy/inTouch->numDownFingers; /* printf("Centrid : (%f,%f)\n",inTouch->centroid.x,inTouch->centroid.y); */ if (inTouch->numDownFingers > 1) { SDL_FloatPoint lv; /* Vector from centroid to last x,y position */ SDL_FloatPoint v; /* Vector from centroid to current x,y position */ /* lv = inTouch->gestureLast[j].cv; */ lv.x = lastP.x - lastCentroid.x; lv.y = lastP.y - lastCentroid.y; lDist = (float)SDL_sqrt(lv.x*lv.x + lv.y*lv.y); /* printf("lDist = %f\n",lDist); */ v.x = x - inTouch->centroid.x; v.y = y - inTouch->centroid.y; /* inTouch->gestureLast[j].cv = v; */ Dist = (float)SDL_sqrt(v.x*v.x+v.y*v.y); /* SDL_cos(dTheta) = (v . lv)/(|v| * |lv|) */ /* Normalize Vectors to simplify angle calculation */ lv.x/=lDist; lv.y/=lDist; v.x/=Dist; v.y/=Dist; dtheta = (float)SDL_atan2(lv.x*v.y - lv.y*v.x,lv.x*v.x + lv.y*v.y); dDist = (Dist - lDist); if (lDist == 0) {dDist = 0;dtheta = 0;} /* To avoid impossible values */ /* inTouch->gestureLast[j].dDist = dDist; inTouch->gestureLast[j].dtheta = dtheta; printf("dDist = %f, dTheta = %f\n",dDist,dtheta); gdtheta = gdtheta*.9 + dtheta*.1; gdDist = gdDist*.9 + dDist*.1 knob.r += dDist/numDownFingers; knob.ang += dtheta; printf("thetaSum = %f, distSum = %f\n",gdtheta,gdDist); printf("id: %i dTheta = %f, dDist = %f\n",j,dtheta,dDist); */ SDL_SendGestureMulti(inTouch,dtheta,dDist); } else { /* inTouch->gestureLast[j].dDist = 0; inTouch->gestureLast[j].dtheta = 0; inTouch->gestureLast[j].cv.x = 0; inTouch->gestureLast[j].cv.y = 0; */ } /* inTouch->gestureLast[j].f.p.x = x; inTouch->gestureLast[j].f.p.y = y; break; pressure? */ } else if (event->type == SDL_FINGERDOWN) { inTouch->numDownFingers++; inTouch->centroid.x = (inTouch->centroid.x*(inTouch->numDownFingers - 1)+ x)/inTouch->numDownFingers; inTouch->centroid.y = (inTouch->centroid.y*(inTouch->numDownFingers - 1)+ y)/inTouch->numDownFingers; /* printf("Finger Down: (%f,%f). Centroid: (%f,%f\n",x,y, inTouch->centroid.x,inTouch->centroid.y); */ #if defined(ENABLE_DOLLAR) inTouch->dollarPath.length = 0; inTouch->dollarPath.p[0].x = x; inTouch->dollarPath.p[0].y = y; inTouch->dollarPath.numPoints = 1; #endif } } } /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/SDL_gesture.c
C
apache-2.0
22,792
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" #ifndef SDL_gesture_c_h_ #define SDL_gesture_c_h_ extern int SDL_GestureAddTouch(SDL_TouchID touchId); extern int SDL_GestureDelTouch(SDL_TouchID touchId); extern void SDL_GestureProcessEvent(SDL_Event* event); extern void SDL_GestureQuit(void); #endif /* SDL_gesture_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/SDL_gesture_c.h
C
apache-2.0
1,285
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" /* General keyboard handling code for SDL */ #include "SDL_timer.h" #include "SDL_events.h" #include "SDL_events_c.h" #include "SDL_assert.h" #include "../video/SDL_sysvideo.h" /* #define DEBUG_KEYBOARD */ /* Global keyboard information */ #define KEYBOARD_HARDWARE 0x01 #define KEYBOARD_AUTORELEASE 0x02 typedef struct SDL_Keyboard SDL_Keyboard; struct SDL_Keyboard { /* Data common to all keyboards */ SDL_Window *focus; Uint16 modstate; Uint8 keysource[SDL_NUM_SCANCODES]; Uint8 keystate[SDL_NUM_SCANCODES]; SDL_Keycode keymap[SDL_NUM_SCANCODES]; SDL_bool autorelease_pending; }; static SDL_Keyboard SDL_keyboard; static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES] = { 0, 0, 0, 0, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', SDLK_RETURN, SDLK_ESCAPE, SDLK_BACKSPACE, SDLK_TAB, SDLK_SPACE, '-', '=', '[', ']', '\\', '#', ';', '\'', '`', ',', '.', '/', SDLK_CAPSLOCK, SDLK_F1, SDLK_F2, SDLK_F3, SDLK_F4, SDLK_F5, SDLK_F6, SDLK_F7, SDLK_F8, SDLK_F9, SDLK_F10, SDLK_F11, SDLK_F12, SDLK_PRINTSCREEN, SDLK_SCROLLLOCK, SDLK_PAUSE, SDLK_INSERT, SDLK_HOME, SDLK_PAGEUP, SDLK_DELETE, SDLK_END, SDLK_PAGEDOWN, SDLK_RIGHT, SDLK_LEFT, SDLK_DOWN, SDLK_UP, SDLK_NUMLOCKCLEAR, SDLK_KP_DIVIDE, SDLK_KP_MULTIPLY, SDLK_KP_MINUS, SDLK_KP_PLUS, SDLK_KP_ENTER, SDLK_KP_1, SDLK_KP_2, SDLK_KP_3, SDLK_KP_4, SDLK_KP_5, SDLK_KP_6, SDLK_KP_7, SDLK_KP_8, SDLK_KP_9, SDLK_KP_0, SDLK_KP_PERIOD, 0, SDLK_APPLICATION, SDLK_POWER, SDLK_KP_EQUALS, SDLK_F13, SDLK_F14, SDLK_F15, SDLK_F16, SDLK_F17, SDLK_F18, SDLK_F19, SDLK_F20, SDLK_F21, SDLK_F22, SDLK_F23, SDLK_F24, SDLK_EXECUTE, SDLK_HELP, SDLK_MENU, SDLK_SELECT, SDLK_STOP, SDLK_AGAIN, SDLK_UNDO, SDLK_CUT, SDLK_COPY, SDLK_PASTE, SDLK_FIND, SDLK_MUTE, SDLK_VOLUMEUP, SDLK_VOLUMEDOWN, 0, 0, 0, SDLK_KP_COMMA, SDLK_KP_EQUALSAS400, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, SDLK_ALTERASE, SDLK_SYSREQ, SDLK_CANCEL, SDLK_CLEAR, SDLK_PRIOR, SDLK_RETURN2, SDLK_SEPARATOR, SDLK_OUT, SDLK_OPER, SDLK_CLEARAGAIN, SDLK_CRSEL, SDLK_EXSEL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, SDLK_KP_00, SDLK_KP_000, SDLK_THOUSANDSSEPARATOR, SDLK_DECIMALSEPARATOR, SDLK_CURRENCYUNIT, SDLK_CURRENCYSUBUNIT, SDLK_KP_LEFTPAREN, SDLK_KP_RIGHTPAREN, SDLK_KP_LEFTBRACE, SDLK_KP_RIGHTBRACE, SDLK_KP_TAB, SDLK_KP_BACKSPACE, SDLK_KP_A, SDLK_KP_B, SDLK_KP_C, SDLK_KP_D, SDLK_KP_E, SDLK_KP_F, SDLK_KP_XOR, SDLK_KP_POWER, SDLK_KP_PERCENT, SDLK_KP_LESS, SDLK_KP_GREATER, SDLK_KP_AMPERSAND, SDLK_KP_DBLAMPERSAND, SDLK_KP_VERTICALBAR, SDLK_KP_DBLVERTICALBAR, SDLK_KP_COLON, SDLK_KP_HASH, SDLK_KP_SPACE, SDLK_KP_AT, SDLK_KP_EXCLAM, SDLK_KP_MEMSTORE, SDLK_KP_MEMRECALL, SDLK_KP_MEMCLEAR, SDLK_KP_MEMADD, SDLK_KP_MEMSUBTRACT, SDLK_KP_MEMMULTIPLY, SDLK_KP_MEMDIVIDE, SDLK_KP_PLUSMINUS, SDLK_KP_CLEAR, SDLK_KP_CLEARENTRY, SDLK_KP_BINARY, SDLK_KP_OCTAL, SDLK_KP_DECIMAL, SDLK_KP_HEXADECIMAL, 0, 0, SDLK_LCTRL, SDLK_LSHIFT, SDLK_LALT, SDLK_LGUI, SDLK_RCTRL, SDLK_RSHIFT, SDLK_RALT, SDLK_RGUI, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, SDLK_MODE, SDLK_AUDIONEXT, SDLK_AUDIOPREV, SDLK_AUDIOSTOP, SDLK_AUDIOPLAY, SDLK_AUDIOMUTE, SDLK_MEDIASELECT, SDLK_WWW, SDLK_MAIL, SDLK_CALCULATOR, SDLK_COMPUTER, SDLK_AC_SEARCH, SDLK_AC_HOME, SDLK_AC_BACK, SDLK_AC_FORWARD, SDLK_AC_STOP, SDLK_AC_REFRESH, SDLK_AC_BOOKMARKS, SDLK_BRIGHTNESSDOWN, SDLK_BRIGHTNESSUP, SDLK_DISPLAYSWITCH, SDLK_KBDILLUMTOGGLE, SDLK_KBDILLUMDOWN, SDLK_KBDILLUMUP, SDLK_EJECT, SDLK_SLEEP, SDLK_APP1, SDLK_APP2, SDLK_AUDIOREWIND, SDLK_AUDIOFASTFORWARD, }; static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = { NULL, NULL, NULL, NULL, "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "Return", "Escape", "Backspace", "Tab", "Space", "-", "=", "[", "]", "\\", "#", ";", "'", "`", ",", ".", "/", "CapsLock", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "PrintScreen", "ScrollLock", "Pause", "Insert", "Home", "PageUp", "Delete", "End", "PageDown", "Right", "Left", "Down", "Up", "Numlock", "Keypad /", "Keypad *", "Keypad -", "Keypad +", "Keypad Enter", "Keypad 1", "Keypad 2", "Keypad 3", "Keypad 4", "Keypad 5", "Keypad 6", "Keypad 7", "Keypad 8", "Keypad 9", "Keypad 0", "Keypad .", NULL, "Application", "Power", "Keypad =", "F13", "F14", "F15", "F16", "F17", "F18", "F19", "F20", "F21", "F22", "F23", "F24", "Execute", "Help", "Menu", "Select", "Stop", "Again", "Undo", "Cut", "Copy", "Paste", "Find", "Mute", "VolumeUp", "VolumeDown", NULL, NULL, NULL, "Keypad ,", "Keypad = (AS400)", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "AltErase", "SysReq", "Cancel", "Clear", "Prior", "Return", "Separator", "Out", "Oper", "Clear / Again", "CrSel", "ExSel", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "Keypad 00", "Keypad 000", "ThousandsSeparator", "DecimalSeparator", "CurrencyUnit", "CurrencySubUnit", "Keypad (", "Keypad )", "Keypad {", "Keypad }", "Keypad Tab", "Keypad Backspace", "Keypad A", "Keypad B", "Keypad C", "Keypad D", "Keypad E", "Keypad F", "Keypad XOR", "Keypad ^", "Keypad %", "Keypad <", "Keypad >", "Keypad &", "Keypad &&", "Keypad |", "Keypad ||", "Keypad :", "Keypad #", "Keypad Space", "Keypad @", "Keypad !", "Keypad MemStore", "Keypad MemRecall", "Keypad MemClear", "Keypad MemAdd", "Keypad MemSubtract", "Keypad MemMultiply", "Keypad MemDivide", "Keypad +/-", "Keypad Clear", "Keypad ClearEntry", "Keypad Binary", "Keypad Octal", "Keypad Decimal", "Keypad Hexadecimal", NULL, NULL, "Left Ctrl", "Left Shift", "Left Alt", "Left GUI", "Right Ctrl", "Right Shift", "Right Alt", "Right GUI", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "ModeSwitch", "AudioNext", "AudioPrev", "AudioStop", "AudioPlay", "AudioMute", "MediaSelect", "WWW", "Mail", "Calculator", "Computer", "AC Search", "AC Home", "AC Back", "AC Forward", "AC Stop", "AC Refresh", "AC Bookmarks", "BrightnessDown", "BrightnessUp", "DisplaySwitch", "KBDIllumToggle", "KBDIllumDown", "KBDIllumUp", "Eject", "Sleep", "App1", "App2", "AudioRewind", "AudioFastForward", }; /* Taken from SDL_iconv() */ char * SDL_UCS4ToUTF8(Uint32 ch, char *dst) { Uint8 *p = (Uint8 *) dst; if (ch <= 0x7F) { *p = (Uint8) ch; ++dst; } else if (ch <= 0x7FF) { p[0] = 0xC0 | (Uint8) ((ch >> 6) & 0x1F); p[1] = 0x80 | (Uint8) (ch & 0x3F); dst += 2; } else if (ch <= 0xFFFF) { p[0] = 0xE0 | (Uint8) ((ch >> 12) & 0x0F); p[1] = 0x80 | (Uint8) ((ch >> 6) & 0x3F); p[2] = 0x80 | (Uint8) (ch & 0x3F); dst += 3; } else if (ch <= 0x1FFFFF) { p[0] = 0xF0 | (Uint8) ((ch >> 18) & 0x07); p[1] = 0x80 | (Uint8) ((ch >> 12) & 0x3F); p[2] = 0x80 | (Uint8) ((ch >> 6) & 0x3F); p[3] = 0x80 | (Uint8) (ch & 0x3F); dst += 4; } else if (ch <= 0x3FFFFFF) { p[0] = 0xF8 | (Uint8) ((ch >> 24) & 0x03); p[1] = 0x80 | (Uint8) ((ch >> 18) & 0x3F); p[2] = 0x80 | (Uint8) ((ch >> 12) & 0x3F); p[3] = 0x80 | (Uint8) ((ch >> 6) & 0x3F); p[4] = 0x80 | (Uint8) (ch & 0x3F); dst += 5; } else { p[0] = 0xFC | (Uint8) ((ch >> 30) & 0x01); p[1] = 0x80 | (Uint8) ((ch >> 24) & 0x3F); p[2] = 0x80 | (Uint8) ((ch >> 18) & 0x3F); p[3] = 0x80 | (Uint8) ((ch >> 12) & 0x3F); p[4] = 0x80 | (Uint8) ((ch >> 6) & 0x3F); p[5] = 0x80 | (Uint8) (ch & 0x3F); dst += 6; } return dst; } /* Public functions */ int SDL_KeyboardInit(void) { SDL_Keyboard *keyboard = &SDL_keyboard; /* Set the default keymap */ SDL_memcpy(keyboard->keymap, SDL_default_keymap, sizeof(SDL_default_keymap)); return (0); } void SDL_ResetKeyboard(void) { SDL_Keyboard *keyboard = &SDL_keyboard; SDL_Scancode scancode; #ifdef DEBUG_KEYBOARD printf("Resetting keyboard\n"); #endif for (scancode = (SDL_Scancode) 0; scancode < SDL_NUM_SCANCODES; ++scancode) { if (keyboard->keystate[scancode] == SDL_PRESSED) { SDL_SendKeyboardKey(SDL_RELEASED, scancode); } } } void SDL_GetDefaultKeymap(SDL_Keycode * keymap) { SDL_memcpy(keymap, SDL_default_keymap, sizeof(SDL_default_keymap)); } void SDL_SetKeymap(int start, SDL_Keycode * keys, int length) { SDL_Keyboard *keyboard = &SDL_keyboard; SDL_Scancode scancode; if (start < 0 || start + length > SDL_NUM_SCANCODES) { return; } SDL_memcpy(&keyboard->keymap[start], keys, sizeof(*keys) * length); /* The number key scancodes always map to the number key keycodes. * On AZERTY layouts these technically are symbols, but users (and games) * always think of them and view them in UI as number keys. */ keyboard->keymap[SDL_SCANCODE_0] = SDLK_0; for (scancode = SDL_SCANCODE_1; scancode <= SDL_SCANCODE_9; ++scancode) { keyboard->keymap[scancode] = SDLK_1 + (scancode - SDL_SCANCODE_1); } } void SDL_SetScancodeName(SDL_Scancode scancode, const char *name) { SDL_scancode_names[scancode] = name; } SDL_Window * SDL_GetKeyboardFocus(void) { SDL_Keyboard *keyboard = &SDL_keyboard; return keyboard->focus; } void SDL_SetKeyboardFocus(SDL_Window * window) { SDL_Keyboard *keyboard = &SDL_keyboard; if (keyboard->focus && !window) { /* We won't get anymore keyboard messages, so reset keyboard state */ SDL_ResetKeyboard(); } /* See if the current window has lost focus */ if (keyboard->focus && keyboard->focus != window) { /* new window shouldn't think it has mouse captured. */ SDL_assert(!window || !(window->flags & SDL_WINDOW_MOUSE_CAPTURE)); /* old window must lose an existing mouse capture. */ if (keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE) { SDL_CaptureMouse(SDL_FALSE); /* drop the capture. */ SDL_assert(!(keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE)); } SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); /* Ensures IME compositions are committed */ if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { SDL_VideoDevice *video = SDL_GetVideoDevice(); if (video && video->StopTextInput) { video->StopTextInput(video); } } } keyboard->focus = window; if (keyboard->focus) { SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { SDL_VideoDevice *video = SDL_GetVideoDevice(); if (video && video->StartTextInput) { video->StartTextInput(video); } } } } static int SDL_SendKeyboardKeyInternal(Uint8 source, Uint8 state, SDL_Scancode scancode) { SDL_Keyboard *keyboard = &SDL_keyboard; int posted; SDL_Keymod modifier; SDL_Keycode keycode; Uint32 type; Uint8 repeat = SDL_FALSE; if (scancode == SDL_SCANCODE_UNKNOWN) { return 0; } #ifdef DEBUG_KEYBOARD printf("The '%s' key has been %s\n", SDL_GetScancodeName(scancode), state == SDL_PRESSED ? "pressed" : "released"); #endif /* Figure out what type of event this is */ switch (state) { case SDL_PRESSED: type = SDL_KEYDOWN; break; case SDL_RELEASED: type = SDL_KEYUP; break; default: /* Invalid state -- bail */ return 0; } /* Drop events that don't change state */ if (state) { if (keyboard->keystate[scancode]) { if (!(keyboard->keysource[scancode] & source)) { keyboard->keysource[scancode] |= source; return 0; } repeat = SDL_TRUE; } keyboard->keysource[scancode] |= source; } else { if (!keyboard->keystate[scancode]) { return 0; } keyboard->keysource[scancode] = 0; } /* Update internal keyboard state */ keyboard->keystate[scancode] = state; keycode = keyboard->keymap[scancode]; if (source == KEYBOARD_AUTORELEASE) { keyboard->autorelease_pending = SDL_TRUE; } /* Update modifiers state if applicable */ switch (keycode) { case SDLK_LCTRL: modifier = KMOD_LCTRL; break; case SDLK_RCTRL: modifier = KMOD_RCTRL; break; case SDLK_LSHIFT: modifier = KMOD_LSHIFT; break; case SDLK_RSHIFT: modifier = KMOD_RSHIFT; break; case SDLK_LALT: modifier = KMOD_LALT; break; case SDLK_RALT: modifier = KMOD_RALT; break; case SDLK_LGUI: modifier = KMOD_LGUI; break; case SDLK_RGUI: modifier = KMOD_RGUI; break; case SDLK_MODE: modifier = KMOD_MODE; break; default: modifier = KMOD_NONE; break; } if (SDL_KEYDOWN == type) { switch (keycode) { case SDLK_NUMLOCKCLEAR: keyboard->modstate ^= KMOD_NUM; break; case SDLK_CAPSLOCK: keyboard->modstate ^= KMOD_CAPS; break; default: keyboard->modstate |= modifier; break; } } else { keyboard->modstate &= ~modifier; } /* Post the event, if desired */ posted = 0; if (SDL_GetEventState(type) == SDL_ENABLE) { SDL_Event event; event.key.type = type; event.key.state = state; event.key.repeat = repeat; event.key.keysym.scancode = scancode; event.key.keysym.sym = keycode; event.key.keysym.mod = keyboard->modstate; event.key.windowID = keyboard->focus ? keyboard->focus->id : 0; posted = (SDL_PushEvent(&event) > 0); } return (posted); } int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode) { return SDL_SendKeyboardKeyInternal(KEYBOARD_HARDWARE, state, scancode); } int SDL_SendKeyboardKeyAutoRelease(SDL_Scancode scancode) { return SDL_SendKeyboardKeyInternal(KEYBOARD_AUTORELEASE, SDL_PRESSED, scancode); } void SDL_ReleaseAutoReleaseKeys(void) { SDL_Keyboard *keyboard = &SDL_keyboard; SDL_Scancode scancode; if (keyboard->autorelease_pending) { for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_NUM_SCANCODES; ++scancode) { if (keyboard->keysource[scancode] == KEYBOARD_AUTORELEASE) { SDL_SendKeyboardKeyInternal(KEYBOARD_AUTORELEASE, SDL_RELEASED, scancode); } } keyboard->autorelease_pending = SDL_FALSE; } } SDL_bool SDL_HardwareKeyboardKeyPressed(void) { SDL_Keyboard *keyboard = &SDL_keyboard; SDL_Scancode scancode; for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_NUM_SCANCODES; ++scancode) { if ((keyboard->keysource[scancode] & KEYBOARD_HARDWARE) != 0) { return SDL_TRUE; } } return SDL_FALSE; } int SDL_SendKeyboardText(const char *text) { SDL_Keyboard *keyboard = &SDL_keyboard; int posted; /* Don't post text events for unprintable characters */ if ((unsigned char)*text < ' ' || *text == 127) { return 0; } /* Post the event, if desired */ posted = 0; if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) { SDL_Event event; event.text.type = SDL_TEXTINPUT; event.text.windowID = keyboard->focus ? keyboard->focus->id : 0; SDL_utf8strlcpy(event.text.text, text, SDL_arraysize(event.text.text)); posted = (SDL_PushEvent(&event) > 0); } return (posted); } int SDL_SendEditingText(const char *text, int start, int length) { SDL_Keyboard *keyboard = &SDL_keyboard; int posted; /* Post the event, if desired */ posted = 0; if (SDL_GetEventState(SDL_TEXTEDITING) == SDL_ENABLE) { SDL_Event event; event.edit.type = SDL_TEXTEDITING; event.edit.windowID = keyboard->focus ? keyboard->focus->id : 0; event.edit.start = start; event.edit.length = length; SDL_utf8strlcpy(event.edit.text, text, SDL_arraysize(event.edit.text)); posted = (SDL_PushEvent(&event) > 0); } return (posted); } void SDL_KeyboardQuit(void) { } const Uint8 * SDL_GetKeyboardState(int *numkeys) { SDL_Keyboard *keyboard = &SDL_keyboard; if (numkeys != (int *) 0) { *numkeys = SDL_NUM_SCANCODES; } return keyboard->keystate; } SDL_Keymod SDL_GetModState(void) { SDL_Keyboard *keyboard = &SDL_keyboard; return (SDL_Keymod) keyboard->modstate; } void SDL_SetModState(SDL_Keymod modstate) { SDL_Keyboard *keyboard = &SDL_keyboard; keyboard->modstate = modstate; } /* Note that SDL_ToggleModState() is not a public API. SDL_SetModState() is. */ void SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle) { SDL_Keyboard *keyboard = &SDL_keyboard; if (toggle) { keyboard->modstate |= modstate; } else { keyboard->modstate &= ~modstate; } } SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode) { SDL_Keyboard *keyboard = &SDL_keyboard; if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) { SDL_InvalidParamError("scancode"); return 0; } return keyboard->keymap[scancode]; } SDL_Scancode SDL_GetScancodeFromKey(SDL_Keycode key) { SDL_Keyboard *keyboard = &SDL_keyboard; SDL_Scancode scancode; for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_NUM_SCANCODES; ++scancode) { if (keyboard->keymap[scancode] == key) { return scancode; } } return SDL_SCANCODE_UNKNOWN; } const char * SDL_GetScancodeName(SDL_Scancode scancode) { const char *name; if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) { SDL_InvalidParamError("scancode"); return ""; } name = SDL_scancode_names[scancode]; if (name) return name; else return ""; } SDL_Scancode SDL_GetScancodeFromName(const char *name) { int i; if (!name || !*name) { SDL_InvalidParamError("name"); return SDL_SCANCODE_UNKNOWN; } for (i = 0; i < SDL_arraysize(SDL_scancode_names); ++i) { if (!SDL_scancode_names[i]) { continue; } if (SDL_strcasecmp(name, SDL_scancode_names[i]) == 0) { return (SDL_Scancode)i; } } SDL_InvalidParamError("name"); return SDL_SCANCODE_UNKNOWN; } const char * SDL_GetKeyName(SDL_Keycode key) { static char name[8]; char *end; if (key & SDLK_SCANCODE_MASK) { return SDL_GetScancodeName((SDL_Scancode) (key & ~SDLK_SCANCODE_MASK)); } switch (key) { case SDLK_RETURN: return SDL_GetScancodeName(SDL_SCANCODE_RETURN); case SDLK_ESCAPE: return SDL_GetScancodeName(SDL_SCANCODE_ESCAPE); case SDLK_BACKSPACE: return SDL_GetScancodeName(SDL_SCANCODE_BACKSPACE); case SDLK_TAB: return SDL_GetScancodeName(SDL_SCANCODE_TAB); case SDLK_SPACE: return SDL_GetScancodeName(SDL_SCANCODE_SPACE); case SDLK_DELETE: return SDL_GetScancodeName(SDL_SCANCODE_DELETE); default: /* Unaccented letter keys on latin keyboards are normally labeled in upper case (and probably on others like Greek or Cyrillic too, so if you happen to know for sure, please adapt this). */ if (key >= 'a' && key <= 'z') { key -= 32; } end = SDL_UCS4ToUTF8((Uint32) key, name); *end = '\0'; return name; } } SDL_Keycode SDL_GetKeyFromName(const char *name) { SDL_Keycode key; /* Check input */ if (name == NULL) { return SDLK_UNKNOWN; } /* If it's a single UTF-8 character, then that's the keycode itself */ key = *(const unsigned char *)name; if (key >= 0xF0) { if (SDL_strlen(name) == 4) { int i = 0; key = (Uint16)(name[i]&0x07) << 18; key |= (Uint16)(name[++i]&0x3F) << 12; key |= (Uint16)(name[++i]&0x3F) << 6; key |= (Uint16)(name[++i]&0x3F); return key; } return SDLK_UNKNOWN; } else if (key >= 0xE0) { if (SDL_strlen(name) == 3) { int i = 0; key = (Uint16)(name[i]&0x0F) << 12; key |= (Uint16)(name[++i]&0x3F) << 6; key |= (Uint16)(name[++i]&0x3F); return key; } return SDLK_UNKNOWN; } else if (key >= 0xC0) { if (SDL_strlen(name) == 2) { int i = 0; key = (Uint16)(name[i]&0x1F) << 6; key |= (Uint16)(name[++i]&0x3F); return key; } return SDLK_UNKNOWN; } else { if (SDL_strlen(name) == 1) { if (key >= 'A' && key <= 'Z') { key += 32; } return key; } /* Get the scancode for this name, and the associated keycode */ return SDL_default_keymap[SDL_GetScancodeFromName(name)]; } } /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/SDL_keyboard.c
C
apache-2.0
24,338
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" #ifndef SDL_keyboard_c_h_ #define SDL_keyboard_c_h_ #include "SDL_keycode.h" #include "SDL_events.h" /* Initialize the keyboard subsystem */ extern int SDL_KeyboardInit(void); /* Clear the state of the keyboard */ extern void SDL_ResetKeyboard(void); /* Get the default keymap */ extern void SDL_GetDefaultKeymap(SDL_Keycode * keymap); /* Set the mapping of scancode to key codes */ extern void SDL_SetKeymap(int start, SDL_Keycode * keys, int length); /* Set a platform-dependent key name, overriding the default platform-agnostic name. Encoded as UTF-8. The string is not copied, thus the pointer given to this function must stay valid forever (or at least until the call to VideoQuit()). */ extern void SDL_SetScancodeName(SDL_Scancode scancode, const char *name); /* Set the keyboard focus window */ extern void SDL_SetKeyboardFocus(SDL_Window * window); /* Send a keyboard key event */ extern int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode); extern int SDL_SendKeyboardKeyAutoRelease(SDL_Scancode scancode); /* Release all the autorelease keys */ extern void SDL_ReleaseAutoReleaseKeys(void); /* Return true if any hardware key is pressed */ extern SDL_bool SDL_HardwareKeyboardKeyPressed(void); /* Send keyboard text input */ extern int SDL_SendKeyboardText(const char *text); /* Send editing text for selected range from start to end */ extern int SDL_SendEditingText(const char *text, int start, int end); /* Shutdown the keyboard subsystem */ extern void SDL_KeyboardQuit(void); /* Convert to UTF-8 */ extern char *SDL_UCS4ToUTF8(Uint32 ch, char *dst); /* Toggle on or off pieces of the keyboard mod state. */ extern void SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle); #endif /* SDL_keyboard_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/SDL_keyboard_c.h
C
apache-2.0
2,774
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" /* General mouse handling code for SDL */ #include "SDL_assert.h" #include "SDL_hints.h" #include "SDL_timer.h" #include "SDL_events.h" #include "SDL_events_c.h" #include "../SDL_hints_c.h" #include "../video/SDL_sysvideo.h" #ifdef __WIN32__ #include "../core/windows/SDL_windows.h" // For GetDoubleClickTime() #endif /* #define DEBUG_MOUSE */ /* The mouse state */ static SDL_Mouse SDL_mouse; /* for mapping mouse events to touch */ static SDL_bool track_mouse_down = SDL_FALSE; static int SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y); static void SDLCALL SDL_MouseDoubleClickTimeChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { SDL_Mouse *mouse = (SDL_Mouse *)userdata; if (hint && *hint) { mouse->double_click_time = SDL_atoi(hint); } else { #ifdef __WIN32__ mouse->double_click_time = GetDoubleClickTime(); #else mouse->double_click_time = 500; #endif } } static void SDLCALL SDL_MouseDoubleClickRadiusChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { SDL_Mouse *mouse = (SDL_Mouse *)userdata; if (hint && *hint) { mouse->double_click_radius = SDL_atoi(hint); } else { mouse->double_click_radius = 32; /* 32 pixels seems about right for touch interfaces */ } } static void SDLCALL SDL_MouseNormalSpeedScaleChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { SDL_Mouse *mouse = (SDL_Mouse *)userdata; if (hint && *hint) { mouse->normal_speed_scale = (float)SDL_atof(hint); } else { mouse->normal_speed_scale = 1.0f; } } static void SDLCALL SDL_MouseRelativeSpeedScaleChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { SDL_Mouse *mouse = (SDL_Mouse *)userdata; if (hint && *hint) { mouse->relative_speed_scale = (float)SDL_atof(hint); } else { mouse->relative_speed_scale = 1.0f; } } static void SDLCALL SDL_TouchMouseEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { SDL_Mouse *mouse = (SDL_Mouse *)userdata; mouse->touch_mouse_events = SDL_GetStringBoolean(hint, SDL_TRUE); } static void SDLCALL SDL_MouseTouchEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { SDL_Mouse *mouse = (SDL_Mouse *)userdata; SDL_bool default_value; #if defined(__ANDROID__) || (defined(__IPHONEOS__) && !defined(__TVOS__)) default_value = SDL_TRUE; #else default_value = SDL_FALSE; #endif mouse->mouse_touch_events = SDL_GetStringBoolean(hint, default_value); if (mouse->mouse_touch_events) { SDL_AddTouch(SDL_MOUSE_TOUCHID, SDL_TOUCH_DEVICE_DIRECT, "mouse_input"); } } /* Public functions */ int SDL_MouseInit(void) { SDL_Mouse *mouse = SDL_GetMouse(); SDL_zerop(mouse); SDL_AddHintCallback(SDL_HINT_MOUSE_DOUBLE_CLICK_TIME, SDL_MouseDoubleClickTimeChanged, mouse); SDL_AddHintCallback(SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS, SDL_MouseDoubleClickRadiusChanged, mouse); SDL_AddHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE, SDL_MouseNormalSpeedScaleChanged, mouse); SDL_AddHintCallback(SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE, SDL_MouseRelativeSpeedScaleChanged, mouse); SDL_AddHintCallback(SDL_HINT_TOUCH_MOUSE_EVENTS, SDL_TouchMouseEventsChanged, mouse); SDL_AddHintCallback(SDL_HINT_MOUSE_TOUCH_EVENTS, SDL_MouseTouchEventsChanged, mouse); mouse->was_touch_mouse_events = SDL_FALSE; /* no touch to mouse movement event pending */ mouse->cursor_shown = SDL_TRUE; return (0); } void SDL_SetDefaultCursor(SDL_Cursor * cursor) { SDL_Mouse *mouse = SDL_GetMouse(); mouse->def_cursor = cursor; if (!mouse->cur_cursor) { SDL_SetCursor(cursor); } } SDL_Mouse * SDL_GetMouse(void) { return &SDL_mouse; } SDL_Window * SDL_GetMouseFocus(void) { SDL_Mouse *mouse = SDL_GetMouse(); return mouse->focus; } #if 0 void SDL_ResetMouse(void) { SDL_Mouse *mouse = SDL_GetMouse(); Uint8 i; #ifdef DEBUG_MOUSE printf("Resetting mouse\n"); #endif for (i = 1; i <= sizeof(mouse->buttonstate)*8; ++i) { if (mouse->buttonstate & SDL_BUTTON(i)) { SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_RELEASED, i); } } SDL_assert(mouse->buttonstate == 0); } #endif void SDL_SetMouseFocus(SDL_Window * window) { SDL_Mouse *mouse = SDL_GetMouse(); if (mouse->focus == window) { return; } /* Actually, this ends up being a bad idea, because most operating systems have an implicit grab when you press the mouse button down so you can drag things out of the window and then get the mouse up when it happens. So, #if 0... */ #if 0 if (mouse->focus && !window) { /* We won't get anymore mouse messages, so reset mouse state */ SDL_ResetMouse(); } #endif /* See if the current window has lost focus */ if (mouse->focus) { SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_LEAVE, 0, 0); } mouse->focus = window; mouse->has_position = SDL_FALSE; if (mouse->focus) { SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_ENTER, 0, 0); } /* Update cursor visibility */ SDL_SetCursor(NULL); } /* Check to see if we need to synthesize focus events */ static SDL_bool SDL_UpdateMouseFocus(SDL_Window * window, int x, int y, Uint32 buttonstate, SDL_bool send_mouse_motion) { SDL_Mouse *mouse = SDL_GetMouse(); SDL_bool inWindow = SDL_TRUE; if (window && ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0)) { int w, h; SDL_GetWindowSize(window, &w, &h); if (x < 0 || y < 0 || x >= w || y >= h) { inWindow = SDL_FALSE; } } /* Linux doesn't give you mouse events outside your window unless you grab the pointer. Windows doesn't give you mouse events outside your window unless you call SetCapture(). Both of these are slightly scary changes, so for now we'll punt and if the mouse leaves the window you'll lose mouse focus and reset button state. */ #ifdef SUPPORT_DRAG_OUTSIDE_WINDOW if (!inWindow && !buttonstate) { #else if (!inWindow) { #endif if (window == mouse->focus) { #ifdef DEBUG_MOUSE printf("Mouse left window, synthesizing move & focus lost event\n"); #endif if (send_mouse_motion) { SDL_PrivateSendMouseMotion(window, mouse->mouseID, 0, x, y); } SDL_SetMouseFocus(NULL); } return SDL_FALSE; } if (window != mouse->focus) { #ifdef DEBUG_MOUSE printf("Mouse entered window, synthesizing focus gain & move event\n"); #endif SDL_SetMouseFocus(window); if (send_mouse_motion) { SDL_PrivateSendMouseMotion(window, mouse->mouseID, 0, x, y); } } return SDL_TRUE; } int SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y) { if (window && !relative) { SDL_Mouse *mouse = SDL_GetMouse(); if (!SDL_UpdateMouseFocus(window, x, y, mouse->buttonstate, (mouseID == SDL_TOUCH_MOUSEID) ? SDL_FALSE : SDL_TRUE)) { return 0; } } return SDL_PrivateSendMouseMotion(window, mouseID, relative, x, y); } static int GetScaledMouseDelta(float scale, int value, float *accum) { if (scale != 1.0f) { *accum += scale * value; if (*accum >= 0.0f) { value = (int)SDL_floor(*accum); } else { value = (int)SDL_ceil(*accum); } *accum -= value; } return value; } static int SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y) { SDL_Mouse *mouse = SDL_GetMouse(); int posted; int xrel; int yrel; /* SDL_HINT_MOUSE_TOUCH_EVENTS: controlling whether mouse events should generate synthetic touch events */ if (mouse->mouse_touch_events) { if (mouseID != SDL_TOUCH_MOUSEID && !relative && track_mouse_down) { if (window) { float fx = (float)x / (float)window->w; float fy = (float)y / (float)window->h; SDL_SendTouchMotion(SDL_MOUSE_TOUCHID, 0, window, fx, fy, 1.0f); } } } /* SDL_HINT_TOUCH_MOUSE_EVENTS: if not set, discard synthetic mouse events coming from platform layer */ if (mouse->touch_mouse_events == 0) { if (mouseID == SDL_TOUCH_MOUSEID) { return 0; } } if (mouseID != SDL_TOUCH_MOUSEID && mouse->relative_mode_warp) { int center_x = 0, center_y = 0; SDL_GetWindowSize(window, &center_x, &center_y); center_x /= 2; center_y /= 2; if (x == center_x && y == center_y) { mouse->last_x = center_x; mouse->last_y = center_y; return 0; } SDL_WarpMouseInWindow(window, center_x, center_y); } if (relative) { if (mouse->relative_mode) { x = GetScaledMouseDelta(mouse->relative_speed_scale, x, &mouse->scale_accum_x); y = GetScaledMouseDelta(mouse->relative_speed_scale, y, &mouse->scale_accum_y); } else { x = GetScaledMouseDelta(mouse->normal_speed_scale, x, &mouse->scale_accum_x); y = GetScaledMouseDelta(mouse->normal_speed_scale, y, &mouse->scale_accum_y); } xrel = x; yrel = y; x = (mouse->last_x + xrel); y = (mouse->last_y + yrel); } else { xrel = x - mouse->last_x; yrel = y - mouse->last_y; } /* Ignore relative motion when first positioning the mouse */ if (!mouse->has_position) { xrel = 0; yrel = 0; mouse->has_position = SDL_TRUE; } else if (!xrel && !yrel) { /* Drop events that don't change state */ #ifdef DEBUG_MOUSE printf("Mouse event didn't change state - dropped!\n"); #endif return 0; } /* Ignore relative motion positioning the first touch */ if (mouseID == SDL_TOUCH_MOUSEID && !mouse->buttonstate) { xrel = 0; yrel = 0; } /* Update internal mouse coordinates */ if (!mouse->relative_mode) { mouse->x = x; mouse->y = y; } else { mouse->x += xrel; mouse->y += yrel; } /* make sure that the pointers find themselves inside the windows, unless we have the mouse captured. */ if (window && ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0)) { int x_max = 0, y_max = 0; /* !!! FIXME: shouldn't this be (window) instead of (mouse->focus)? */ SDL_GetWindowSize(mouse->focus, &x_max, &y_max); --x_max; --y_max; if (mouse->x > x_max) { mouse->x = x_max; } if (mouse->x < 0) { mouse->x = 0; } if (mouse->y > y_max) { mouse->y = y_max; } if (mouse->y < 0) { mouse->y = 0; } } mouse->xdelta += xrel; mouse->ydelta += yrel; /* Move the mouse cursor, if needed */ if (mouse->cursor_shown && !mouse->relative_mode && mouse->MoveCursor && mouse->cur_cursor) { mouse->MoveCursor(mouse->cur_cursor); } /* Post the event, if desired */ posted = 0; if (SDL_GetEventState(SDL_MOUSEMOTION) == SDL_ENABLE) { SDL_Event event; event.motion.type = SDL_MOUSEMOTION; event.motion.windowID = mouse->focus ? mouse->focus->id : 0; event.motion.which = mouseID; /* Set us pending (or clear during a normal mouse movement event) as having triggered */ mouse->was_touch_mouse_events = (mouseID == SDL_TOUCH_MOUSEID)? SDL_TRUE : SDL_FALSE; event.motion.state = mouse->buttonstate; event.motion.x = mouse->x; event.motion.y = mouse->y; event.motion.xrel = xrel; event.motion.yrel = yrel; posted = (SDL_PushEvent(&event) > 0); } if (relative) { mouse->last_x = mouse->x; mouse->last_y = mouse->y; } else { /* Use unclamped values if we're getting events outside the window */ mouse->last_x = x; mouse->last_y = y; } return posted; } static SDL_MouseClickState *GetMouseClickState(SDL_Mouse *mouse, Uint8 button) { if (button >= mouse->num_clickstates) { int i, count = button + 1; SDL_MouseClickState *clickstate = (SDL_MouseClickState *)SDL_realloc(mouse->clickstate, count * sizeof(*mouse->clickstate)); if (!clickstate) { return NULL; } mouse->clickstate = clickstate; for (i = mouse->num_clickstates; i < count; ++i) { SDL_zero(mouse->clickstate[i]); } mouse->num_clickstates = count; } return &mouse->clickstate[button]; } static int SDL_PrivateSendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks) { SDL_Mouse *mouse = SDL_GetMouse(); int posted; Uint32 type; Uint32 buttonstate = mouse->buttonstate; /* SDL_HINT_MOUSE_TOUCH_EVENTS: controlling whether mouse events should generate synthetic touch events */ if (mouse->mouse_touch_events) { if (mouseID != SDL_TOUCH_MOUSEID && button == SDL_BUTTON_LEFT) { if (state == SDL_PRESSED) { track_mouse_down = SDL_TRUE; } else { track_mouse_down = SDL_FALSE; } if (window) { float fx = (float)mouse->x / (float)window->w; float fy = (float)mouse->y / (float)window->h; SDL_SendTouch(SDL_MOUSE_TOUCHID, 0, window, track_mouse_down, fx, fy, 1.0f); } } } /* SDL_HINT_TOUCH_MOUSE_EVENTS: if not set, discard synthetic mouse events coming from platform layer */ if (mouse->touch_mouse_events == 0) { if (mouseID == SDL_TOUCH_MOUSEID) { return 0; } } /* Figure out which event to perform */ switch (state) { case SDL_PRESSED: type = SDL_MOUSEBUTTONDOWN; buttonstate |= SDL_BUTTON(button); break; case SDL_RELEASED: type = SDL_MOUSEBUTTONUP; buttonstate &= ~SDL_BUTTON(button); break; default: /* Invalid state -- bail */ return 0; } /* We do this after calculating buttonstate so button presses gain focus */ if (window && state == SDL_PRESSED) { SDL_UpdateMouseFocus(window, mouse->x, mouse->y, buttonstate, SDL_TRUE); } if (buttonstate == mouse->buttonstate) { /* Ignore this event, no state change */ return 0; } mouse->buttonstate = buttonstate; if (clicks < 0) { SDL_MouseClickState *clickstate = GetMouseClickState(mouse, button); if (clickstate) { if (state == SDL_PRESSED) { Uint32 now = SDL_GetTicks(); if (SDL_TICKS_PASSED(now, clickstate->last_timestamp + mouse->double_click_time) || SDL_abs(mouse->x - clickstate->last_x) > mouse->double_click_radius || SDL_abs(mouse->y - clickstate->last_y) > mouse->double_click_radius) { clickstate->click_count = 0; } clickstate->last_timestamp = now; clickstate->last_x = mouse->x; clickstate->last_y = mouse->y; if (clickstate->click_count < 255) { ++clickstate->click_count; } } clicks = clickstate->click_count; } else { clicks = 1; } } /* Post the event, if desired */ posted = 0; if (SDL_GetEventState(type) == SDL_ENABLE) { SDL_Event event; event.type = type; event.button.windowID = mouse->focus ? mouse->focus->id : 0; event.button.which = mouseID; event.button.state = state; event.button.button = button; event.button.clicks = (Uint8) SDL_min(clicks, 255); event.button.x = mouse->x; event.button.y = mouse->y; posted = (SDL_PushEvent(&event) > 0); } /* We do this after dispatching event so button releases can lose focus */ if (window && state == SDL_RELEASED) { SDL_UpdateMouseFocus(window, mouse->x, mouse->y, buttonstate, SDL_TRUE); } return posted; } int SDL_SendMouseButtonClicks(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks) { clicks = SDL_max(clicks, 0); return SDL_PrivateSendMouseButton(window, mouseID, state, button, clicks); } int SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button) { return SDL_PrivateSendMouseButton(window, mouseID, state, button, -1); } int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction) { SDL_Mouse *mouse = SDL_GetMouse(); int posted; int integral_x, integral_y; if (window) { SDL_SetMouseFocus(window); } if (x == 0.0f && y == 0.0f) { return 0; } mouse->accumulated_wheel_x += x; if (mouse->accumulated_wheel_x > 0) { integral_x = (int)SDL_floor(mouse->accumulated_wheel_x); } else if (mouse->accumulated_wheel_x < 0) { integral_x = (int)SDL_ceil(mouse->accumulated_wheel_x); } else { integral_x = 0; } mouse->accumulated_wheel_x -= integral_x; mouse->accumulated_wheel_y += y; if (mouse->accumulated_wheel_y > 0) { integral_y = (int)SDL_floor(mouse->accumulated_wheel_y); } else if (mouse->accumulated_wheel_y < 0) { integral_y = (int)SDL_ceil(mouse->accumulated_wheel_y); } else { integral_y = 0; } mouse->accumulated_wheel_y -= integral_y; /* Post the event, if desired */ posted = 0; if (SDL_GetEventState(SDL_MOUSEWHEEL) == SDL_ENABLE) { SDL_Event event; event.type = SDL_MOUSEWHEEL; event.wheel.windowID = mouse->focus ? mouse->focus->id : 0; event.wheel.which = mouseID; #if 0 /* Uncomment this when it goes in for SDL 2.1 */ event.wheel.preciseX = x; event.wheel.preciseY = y; #endif event.wheel.x = integral_x; event.wheel.y = integral_y; event.wheel.direction = (Uint32)direction; posted = (SDL_PushEvent(&event) > 0); } return posted; } void SDL_MouseQuit(void) { SDL_Cursor *cursor, *next; SDL_Mouse *mouse = SDL_GetMouse(); if (mouse->CaptureMouse) { SDL_CaptureMouse(SDL_FALSE); } SDL_SetRelativeMouseMode(SDL_FALSE); SDL_ShowCursor(1); cursor = mouse->cursors; while (cursor) { next = cursor->next; SDL_FreeCursor(cursor); cursor = next; } mouse->cursors = NULL; mouse->cur_cursor = NULL; if (mouse->def_cursor && mouse->FreeCursor) { mouse->FreeCursor(mouse->def_cursor); mouse->def_cursor = NULL; } if (mouse->clickstate) { SDL_free(mouse->clickstate); mouse->clickstate = NULL; } SDL_DelHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE, SDL_MouseNormalSpeedScaleChanged, mouse); SDL_DelHintCallback(SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE, SDL_MouseRelativeSpeedScaleChanged, mouse); } Uint32 SDL_GetMouseState(int *x, int *y) { SDL_Mouse *mouse = SDL_GetMouse(); if (x) { *x = mouse->x; } if (y) { *y = mouse->y; } return mouse->buttonstate; } Uint32 SDL_GetRelativeMouseState(int *x, int *y) { SDL_Mouse *mouse = SDL_GetMouse(); if (x) { *x = mouse->xdelta; } if (y) { *y = mouse->ydelta; } mouse->xdelta = 0; mouse->ydelta = 0; return mouse->buttonstate; } Uint32 SDL_GetGlobalMouseState(int *x, int *y) { SDL_Mouse *mouse = SDL_GetMouse(); if (mouse->GetGlobalMouseState) { int tmpx, tmpy; /* make sure these are never NULL for the backend implementations... */ if (!x) { x = &tmpx; } if (!y) { y = &tmpy; } *x = *y = 0; return mouse->GetGlobalMouseState(x, y); } else { return SDL_GetMouseState(x, y); } } void SDL_WarpMouseInWindow(SDL_Window * window, int x, int y) { SDL_Mouse *mouse = SDL_GetMouse(); if (window == NULL) { window = mouse->focus; } if (window == NULL) { return; } if (mouse->WarpMouse) { mouse->WarpMouse(window, x, y); } else { SDL_SendMouseMotion(window, mouse->mouseID, 0, x, y); } } int SDL_WarpMouseGlobal(int x, int y) { SDL_Mouse *mouse = SDL_GetMouse(); if (mouse->WarpMouseGlobal) { return mouse->WarpMouseGlobal(x, y); } return SDL_Unsupported(); } static SDL_bool ShouldUseRelativeModeWarp(SDL_Mouse *mouse) { if (!mouse->WarpMouse) { /* Need this functionality for relative mode warp implementation */ return SDL_FALSE; } return SDL_GetHintBoolean(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, SDL_FALSE); } int SDL_SetRelativeMouseMode(SDL_bool enabled) { SDL_Mouse *mouse = SDL_GetMouse(); SDL_Window *focusWindow = SDL_GetKeyboardFocus(); if (enabled == mouse->relative_mode) { return 0; } /* Set the relative mode */ if (!enabled && mouse->relative_mode_warp) { mouse->relative_mode_warp = SDL_FALSE; } else if (enabled && ShouldUseRelativeModeWarp(mouse)) { mouse->relative_mode_warp = SDL_TRUE; } else if (!mouse->SetRelativeMouseMode || mouse->SetRelativeMouseMode(enabled) < 0) { if (enabled) { /* Fall back to warp mode if native relative mode failed */ if (!mouse->WarpMouse) { return SDL_SetError("No relative mode implementation available"); } mouse->relative_mode_warp = SDL_TRUE; } } mouse->relative_mode = enabled; mouse->scale_accum_x = 0.0f; mouse->scale_accum_y = 0.0f; if (enabled && focusWindow) { /* Center it in the focused window to prevent clicks from going through * to background windows. */ SDL_SetMouseFocus(focusWindow); SDL_WarpMouseInWindow(focusWindow, focusWindow->w/2, focusWindow->h/2); } if (mouse->focus) { SDL_UpdateWindowGrab(mouse->focus); /* Put the cursor back to where the application expects it */ if (!enabled) { SDL_WarpMouseInWindow(mouse->focus, mouse->x, mouse->y); } } /* Flush pending mouse motion - ideally we would pump events, but that's not always safe */ SDL_FlushEvent(SDL_MOUSEMOTION); /* Update cursor visibility */ SDL_SetCursor(NULL); return 0; } SDL_bool SDL_GetRelativeMouseMode() { SDL_Mouse *mouse = SDL_GetMouse(); return mouse->relative_mode; } int SDL_CaptureMouse(SDL_bool enabled) { SDL_Mouse *mouse = SDL_GetMouse(); SDL_Window *focusWindow; SDL_bool isCaptured; if (!mouse->CaptureMouse) { return SDL_Unsupported(); } focusWindow = SDL_GetKeyboardFocus(); isCaptured = focusWindow && (focusWindow->flags & SDL_WINDOW_MOUSE_CAPTURE); if (isCaptured == enabled) { return 0; /* already done! */ } if (enabled) { if (!focusWindow) { return SDL_SetError("No window has focus"); } else if (mouse->CaptureMouse(focusWindow) == -1) { return -1; /* CaptureMouse() should call SetError */ } focusWindow->flags |= SDL_WINDOW_MOUSE_CAPTURE; } else { if (mouse->CaptureMouse(NULL) == -1) { return -1; /* CaptureMouse() should call SetError */ } focusWindow->flags &= ~SDL_WINDOW_MOUSE_CAPTURE; } return 0; } SDL_Cursor * SDL_CreateCursor(const Uint8 * data, const Uint8 * mask, int w, int h, int hot_x, int hot_y) { SDL_Surface *surface; SDL_Cursor *cursor; int x, y; Uint32 *pixel; Uint8 datab = 0, maskb = 0; const Uint32 black = 0xFF000000; const Uint32 white = 0xFFFFFFFF; const Uint32 transparent = 0x00000000; /* Make sure the width is a multiple of 8 */ w = ((w + 7) & ~7); /* Create the surface from a bitmap */ surface = SDL_CreateRGBSurface(0, w, h, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000); if (!surface) { return NULL; } for (y = 0; y < h; ++y) { pixel = (Uint32 *) ((Uint8 *) surface->pixels + y * surface->pitch); for (x = 0; x < w; ++x) { if ((x % 8) == 0) { datab = *data++; maskb = *mask++; } if (maskb & 0x80) { *pixel++ = (datab & 0x80) ? black : white; } else { *pixel++ = (datab & 0x80) ? black : transparent; } datab <<= 1; maskb <<= 1; } } cursor = SDL_CreateColorCursor(surface, hot_x, hot_y); SDL_FreeSurface(surface); return cursor; } SDL_Cursor * SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y) { SDL_Mouse *mouse = SDL_GetMouse(); SDL_Surface *temp = NULL; SDL_Cursor *cursor; if (!surface) { SDL_SetError("Passed NULL cursor surface"); return NULL; } if (!mouse->CreateCursor) { SDL_SetError("Cursors are not currently supported"); return NULL; } /* Sanity check the hot spot */ if ((hot_x < 0) || (hot_y < 0) || (hot_x >= surface->w) || (hot_y >= surface->h)) { SDL_SetError("Cursor hot spot doesn't lie within cursor"); return NULL; } if (surface->format->format != SDL_PIXELFORMAT_ARGB8888) { temp = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ARGB8888, 0); if (!temp) { return NULL; } surface = temp; } cursor = mouse->CreateCursor(surface, hot_x, hot_y); if (cursor) { cursor->next = mouse->cursors; mouse->cursors = cursor; } SDL_FreeSurface(temp); return cursor; } SDL_Cursor * SDL_CreateSystemCursor(SDL_SystemCursor id) { SDL_Mouse *mouse = SDL_GetMouse(); SDL_Cursor *cursor; if (!mouse->CreateSystemCursor) { SDL_SetError("CreateSystemCursor is not currently supported"); return NULL; } cursor = mouse->CreateSystemCursor(id); if (cursor) { cursor->next = mouse->cursors; mouse->cursors = cursor; } return cursor; } /* SDL_SetCursor(NULL) can be used to force the cursor redraw, if this is desired for any reason. This is used when setting the video mode and when the SDL window gains the mouse focus. */ void SDL_SetCursor(SDL_Cursor * cursor) { SDL_Mouse *mouse = SDL_GetMouse(); /* Set the new cursor */ if (cursor) { /* Make sure the cursor is still valid for this mouse */ if (cursor != mouse->def_cursor) { SDL_Cursor *found; for (found = mouse->cursors; found; found = found->next) { if (found == cursor) { break; } } if (!found) { SDL_SetError("Cursor not associated with the current mouse"); return; } } mouse->cur_cursor = cursor; } else { if (mouse->focus) { cursor = mouse->cur_cursor; } else { cursor = mouse->def_cursor; } } if (cursor && mouse->cursor_shown && !mouse->relative_mode) { if (mouse->ShowCursor) { mouse->ShowCursor(cursor); } } else { if (mouse->ShowCursor) { mouse->ShowCursor(NULL); } } } SDL_Cursor * SDL_GetCursor(void) { SDL_Mouse *mouse = SDL_GetMouse(); if (!mouse) { return NULL; } return mouse->cur_cursor; } SDL_Cursor * SDL_GetDefaultCursor(void) { SDL_Mouse *mouse = SDL_GetMouse(); if (!mouse) { return NULL; } return mouse->def_cursor; } void SDL_FreeCursor(SDL_Cursor * cursor) { SDL_Mouse *mouse = SDL_GetMouse(); SDL_Cursor *curr, *prev; if (!cursor) { return; } if (cursor == mouse->def_cursor) { return; } if (cursor == mouse->cur_cursor) { SDL_SetCursor(mouse->def_cursor); } for (prev = NULL, curr = mouse->cursors; curr; prev = curr, curr = curr->next) { if (curr == cursor) { if (prev) { prev->next = curr->next; } else { mouse->cursors = curr->next; } if (mouse->FreeCursor) { mouse->FreeCursor(curr); } return; } } } int SDL_ShowCursor(int toggle) { SDL_Mouse *mouse = SDL_GetMouse(); SDL_bool shown; if (!mouse) { return 0; } shown = mouse->cursor_shown; if (toggle >= 0) { if (toggle) { mouse->cursor_shown = SDL_TRUE; } else { mouse->cursor_shown = SDL_FALSE; } if (mouse->cursor_shown != shown) { SDL_SetCursor(NULL); } } return shown; } /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/SDL_mouse.c
C
apache-2.0
30,667
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" #ifndef SDL_mouse_c_h_ #define SDL_mouse_c_h_ #include "SDL_mouse.h" typedef Uint32 SDL_MouseID; struct SDL_Cursor { struct SDL_Cursor *next; void *driverdata; }; typedef struct { int last_x, last_y; Uint32 last_timestamp; Uint8 click_count; } SDL_MouseClickState; typedef struct { /* Create a cursor from a surface */ SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y); /* Create a system cursor */ SDL_Cursor *(*CreateSystemCursor) (SDL_SystemCursor id); /* Show the specified cursor, or hide if cursor is NULL */ int (*ShowCursor) (SDL_Cursor * cursor); /* This is called when a mouse motion event occurs */ void (*MoveCursor) (SDL_Cursor * cursor); /* Free a window manager cursor */ void (*FreeCursor) (SDL_Cursor * cursor); /* Warp the mouse to (x,y) within a window */ void (*WarpMouse) (SDL_Window * window, int x, int y); /* Warp the mouse to (x,y) in screen space */ int (*WarpMouseGlobal) (int x, int y); /* Set relative mode */ int (*SetRelativeMouseMode) (SDL_bool enabled); /* Set mouse capture */ int (*CaptureMouse) (SDL_Window * window); /* Get absolute mouse coordinates. (x) and (y) are never NULL and set to zero before call. */ Uint32 (*GetGlobalMouseState) (int *x, int *y); /* Data common to all mice */ SDL_MouseID mouseID; SDL_Window *focus; int x; int y; int xdelta; int ydelta; int last_x, last_y; /* the last reported x and y coordinates */ float accumulated_wheel_x; float accumulated_wheel_y; Uint32 buttonstate; SDL_bool has_position; SDL_bool relative_mode; SDL_bool relative_mode_warp; float normal_speed_scale; float relative_speed_scale; float scale_accum_x; float scale_accum_y; Uint32 double_click_time; int double_click_radius; SDL_bool touch_mouse_events; SDL_bool mouse_touch_events; SDL_bool was_touch_mouse_events; /* Was a touch-mouse event pending? */ /* Data for double-click tracking */ int num_clickstates; SDL_MouseClickState *clickstate; SDL_Cursor *cursors; SDL_Cursor *def_cursor; SDL_Cursor *cur_cursor; SDL_bool cursor_shown; /* Driver-dependent data. */ void *driverdata; } SDL_Mouse; /* Initialize the mouse subsystem */ extern int SDL_MouseInit(void); /* Get the mouse state structure */ SDL_Mouse *SDL_GetMouse(void); /* Set the default mouse cursor */ extern void SDL_SetDefaultCursor(SDL_Cursor * cursor); /* Set the mouse focus window */ extern void SDL_SetMouseFocus(SDL_Window * window); /* Send a mouse motion event */ extern int SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y); /* Send a mouse button event */ extern int SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button); /* Send a mouse button event with a click count */ extern int SDL_SendMouseButtonClicks(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks); /* Send a mouse wheel event */ extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction); /* Shutdown the mouse subsystem */ extern void SDL_MouseQuit(void); #endif /* SDL_mouse_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/SDL_mouse_c.h
C
apache-2.0
4,333
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" #include "SDL_hints.h" #include "SDL_assert.h" /* General quit handling code for SDL */ #ifdef HAVE_SIGNAL_H #include <signal.h> #endif #include "SDL_events.h" #include "SDL_events_c.h" #if defined(HAVE_SIGNAL_H) || defined(HAVE_SIGACTION) #define HAVE_SIGNAL_SUPPORT 1 #endif #ifdef HAVE_SIGNAL_SUPPORT static SDL_bool disable_signals = SDL_FALSE; static SDL_bool send_quit_pending = SDL_FALSE; #ifdef SDL_BACKGROUNDING_SIGNAL static SDL_bool send_backgrounding_pending = SDL_FALSE; #endif #ifdef SDL_FOREGROUNDING_SIGNAL static SDL_bool send_foregrounding_pending = SDL_FALSE; #endif static void SDL_HandleSIG(int sig) { /* Reset the signal handler */ signal(sig, SDL_HandleSIG); /* Send a quit event next time the event loop pumps. */ /* We can't send it in signal handler; malloc() might be interrupted! */ if ((sig == SIGINT) || (sig == SIGTERM)) { send_quit_pending = SDL_TRUE; } #ifdef SDL_BACKGROUNDING_SIGNAL else if (sig == SDL_BACKGROUNDING_SIGNAL) { send_backgrounding_pending = SDL_TRUE; } #endif #ifdef SDL_FOREGROUNDING_SIGNAL else if (sig == SDL_FOREGROUNDING_SIGNAL) { send_foregrounding_pending = SDL_TRUE; } #endif } static void SDL_EventSignal_Init(const int sig) { #ifdef HAVE_SIGACTION struct sigaction action; sigaction(sig, NULL, &action); #ifdef HAVE_SA_SIGACTION if ( action.sa_handler == SIG_DFL && (void (*)(int))action.sa_sigaction == SIG_DFL ) { #else if ( action.sa_handler == SIG_DFL ) { #endif action.sa_handler = SDL_HandleSIG; sigaction(sig, &action, NULL); } #elif HAVE_SIGNAL_H void (*ohandler) (int) = signal(sig, SDL_HandleSIG); if (ohandler != SIG_DFL) { signal(sig, ohandler); } #endif } static void SDL_EventSignal_Quit(const int sig) { #ifdef HAVE_SIGACTION struct sigaction action; sigaction(sig, NULL, &action); if ( action.sa_handler == SDL_HandleSIG ) { action.sa_handler = SIG_DFL; sigaction(sig, &action, NULL); } #elif HAVE_SIGNAL_H void (*ohandler) (int) = signal(sig, SIG_DFL); if (ohandler != SDL_HandleSIG) { signal(sig, ohandler); } #endif /* HAVE_SIGNAL_H */ } /* Public functions */ static int SDL_QuitInit_Internal(void) { /* Both SIGINT and SIGTERM are translated into quit interrupts */ /* and SDL can be built to simulate iOS/Android semantics with arbitrary signals. */ SDL_EventSignal_Init(SIGINT); SDL_EventSignal_Init(SIGTERM); #ifdef SDL_BACKGROUNDING_SIGNAL SDL_EventSignal_Init(SDL_BACKGROUNDING_SIGNAL); #endif #ifdef SDL_FOREGROUNDING_SIGNAL SDL_EventSignal_Init(SDL_FOREGROUNDING_SIGNAL); #endif /* That's it! */ return 0; } static void SDL_QuitQuit_Internal(void) { SDL_EventSignal_Quit(SIGINT); SDL_EventSignal_Quit(SIGTERM); #ifdef SDL_BACKGROUNDING_SIGNAL SDL_EventSignal_Quit(SDL_BACKGROUNDING_SIGNAL); #endif #ifdef SDL_FOREGROUNDING_SIGNAL SDL_EventSignal_Quit(SDL_FOREGROUNDING_SIGNAL); #endif } #endif int SDL_QuitInit(void) { #ifdef HAVE_SIGNAL_SUPPORT if (!SDL_GetHintBoolean(SDL_HINT_NO_SIGNAL_HANDLERS, SDL_FALSE)) { return SDL_QuitInit_Internal(); } #endif return 0; } void SDL_QuitQuit(void) { #ifdef HAVE_SIGNAL_SUPPORT if (!disable_signals) { SDL_QuitQuit_Internal(); } #endif } void SDL_SendPendingSignalEvents(void) { #ifdef HAVE_SIGNAL_SUPPORT if (send_quit_pending) { SDL_SendQuit(); SDL_assert(!send_quit_pending); } #ifdef SDL_BACKGROUNDING_SIGNAL if (send_backgrounding_pending) { send_backgrounding_pending = SDL_FALSE; SDL_OnApplicationWillResignActive(); } #endif #ifdef SDL_FOREGROUNDING_SIGNAL if (send_foregrounding_pending) { send_foregrounding_pending = SDL_FALSE; SDL_OnApplicationDidBecomeActive(); } #endif #endif } /* This function returns 1 if it's okay to close the application window */ int SDL_SendQuit(void) { #ifdef HAVE_SIGNAL_SUPPORT send_quit_pending = SDL_FALSE; #endif return SDL_SendAppEvent(SDL_QUIT); } /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/SDL_quit.c
C
apache-2.0
5,155
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" #include "../video/SDL_sysvideo.h" /* Useful functions and variables from SDL_sysevents.c */ #if defined(__HAIKU__) /* The Haiku event loops run in a separate thread */ #define MUST_THREAD_EVENTS #endif #ifdef __WIN32__ /* Windows doesn't allow a separate event thread */ #define CANT_THREAD_EVENTS #endif /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/SDL_sysevents.h
C
apache-2.0
1,327
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" /* General touch handling code for SDL */ #include "SDL_assert.h" #include "SDL_events.h" #include "SDL_events_c.h" #include "../video/SDL_sysvideo.h" static int SDL_num_touch = 0; static SDL_Touch **SDL_touchDevices = NULL; /* for mapping touch events to mice */ #define SYNTHESIZE_TOUCH_TO_MOUSE 1 #if SYNTHESIZE_TOUCH_TO_MOUSE static SDL_bool finger_touching = SDL_FALSE; static SDL_FingerID track_fingerid; static SDL_TouchID track_touchid; #endif /* Public functions */ int SDL_TouchInit(void) { return (0); } int SDL_GetNumTouchDevices(void) { return SDL_num_touch; } SDL_TouchID SDL_GetTouchDevice(int index) { if (index < 0 || index >= SDL_num_touch) { SDL_SetError("Unknown touch device index %d", index); return 0; } return SDL_touchDevices[index]->id; } static int SDL_GetTouchIndex(SDL_TouchID id) { int index; SDL_Touch *touch; for (index = 0; index < SDL_num_touch; ++index) { touch = SDL_touchDevices[index]; if (touch->id == id) { return index; } } return -1; } SDL_Touch * SDL_GetTouch(SDL_TouchID id) { int index = SDL_GetTouchIndex(id); if (index < 0 || index >= SDL_num_touch) { if (SDL_GetVideoDevice()->ResetTouch != NULL) { SDL_SetError("Unknown touch id %d, resetting", (int) id); (SDL_GetVideoDevice()->ResetTouch)(SDL_GetVideoDevice()); } else { SDL_SetError("Unknown touch device id %d, cannot reset", (int) id); } return NULL; } return SDL_touchDevices[index]; } SDL_TouchDeviceType SDL_GetTouchDeviceType(SDL_TouchID id) { SDL_Touch *touch = SDL_GetTouch(id); if (touch) { return touch->type; } return SDL_TOUCH_DEVICE_INVALID; } static int SDL_GetFingerIndex(const SDL_Touch * touch, SDL_FingerID fingerid) { int index; for (index = 0; index < touch->num_fingers; ++index) { if (touch->fingers[index]->id == fingerid) { return index; } } return -1; } static SDL_Finger * SDL_GetFinger(const SDL_Touch * touch, SDL_FingerID id) { int index = SDL_GetFingerIndex(touch, id); if (index < 0 || index >= touch->num_fingers) { return NULL; } return touch->fingers[index]; } int SDL_GetNumTouchFingers(SDL_TouchID touchID) { SDL_Touch *touch = SDL_GetTouch(touchID); if (touch) { return touch->num_fingers; } return 0; } SDL_Finger * SDL_GetTouchFinger(SDL_TouchID touchID, int index) { SDL_Touch *touch = SDL_GetTouch(touchID); if (!touch) { return NULL; } if (index < 0 || index >= touch->num_fingers) { SDL_SetError("Unknown touch finger"); return NULL; } return touch->fingers[index]; } int SDL_AddTouch(SDL_TouchID touchID, SDL_TouchDeviceType type, const char *name) { SDL_Touch **touchDevices; int index; index = SDL_GetTouchIndex(touchID); if (index >= 0) { return index; } /* Add the touch to the list of touch */ touchDevices = (SDL_Touch **) SDL_realloc(SDL_touchDevices, (SDL_num_touch + 1) * sizeof(*touchDevices)); if (!touchDevices) { return SDL_OutOfMemory(); } SDL_touchDevices = touchDevices; index = SDL_num_touch; SDL_touchDevices[index] = (SDL_Touch *) SDL_malloc(sizeof(*SDL_touchDevices[index])); if (!SDL_touchDevices[index]) { return SDL_OutOfMemory(); } /* Added touch to list */ ++SDL_num_touch; /* we're setting the touch properties */ SDL_touchDevices[index]->id = touchID; SDL_touchDevices[index]->type = type; SDL_touchDevices[index]->num_fingers = 0; SDL_touchDevices[index]->max_fingers = 0; SDL_touchDevices[index]->fingers = NULL; /* Record this touch device for gestures */ /* We could do this on the fly in the gesture code if we wanted */ SDL_GestureAddTouch(touchID); return index; } static int SDL_AddFinger(SDL_Touch *touch, SDL_FingerID fingerid, float x, float y, float pressure) { SDL_Finger *finger; if (touch->num_fingers == touch->max_fingers) { SDL_Finger **new_fingers; new_fingers = (SDL_Finger **)SDL_realloc(touch->fingers, (touch->max_fingers+1)*sizeof(*touch->fingers)); if (!new_fingers) { return SDL_OutOfMemory(); } touch->fingers = new_fingers; touch->fingers[touch->max_fingers] = (SDL_Finger *)SDL_malloc(sizeof(*finger)); if (!touch->fingers[touch->max_fingers]) { return SDL_OutOfMemory(); } touch->max_fingers++; } finger = touch->fingers[touch->num_fingers++]; finger->id = fingerid; finger->x = x; finger->y = y; finger->pressure = pressure; return 0; } static int SDL_DelFinger(SDL_Touch* touch, SDL_FingerID fingerid) { SDL_Finger *temp; int index = SDL_GetFingerIndex(touch, fingerid); if (index < 0) { return -1; } touch->num_fingers--; temp = touch->fingers[index]; touch->fingers[index] = touch->fingers[touch->num_fingers]; touch->fingers[touch->num_fingers] = temp; return 0; } int SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window, SDL_bool down, float x, float y, float pressure) { int posted; SDL_Finger *finger; SDL_Mouse *mouse; SDL_Touch* touch = SDL_GetTouch(id); if (!touch) { return -1; } mouse = SDL_GetMouse(); #if SYNTHESIZE_TOUCH_TO_MOUSE /* SDL_HINT_TOUCH_MOUSE_EVENTS: controlling whether touch events should generate synthetic mouse events */ { if (mouse->touch_mouse_events) { /* FIXME: maybe we should only restrict to a few SDL_TouchDeviceType */ if (id != SDL_MOUSE_TOUCHID) { if (window) { if (down) { if (finger_touching == SDL_FALSE) { int pos_x = (int)(x * (float)window->w); int pos_y = (int)(y * (float)window->h); if (pos_x < 0) pos_x = 0; if (pos_x > window->w - 1) pos_x = window->w - 1; if (pos_y < 0) pos_y = 0; if (pos_y > window->h - 1) pos_y = window->h - 1; SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, pos_x, pos_y); SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT); } } else { if (finger_touching == SDL_TRUE && track_touchid == id && track_fingerid == fingerid) { SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT); } } } if (down) { if (finger_touching == SDL_FALSE) { finger_touching = SDL_TRUE; track_touchid = id; track_fingerid = fingerid; } } else { if (finger_touching == SDL_TRUE && track_touchid == id && track_fingerid == fingerid) { finger_touching = SDL_FALSE; } } } } } #endif /* SDL_HINT_MOUSE_TOUCH_EVENTS: if not set, discard synthetic touch events coming from platform layer */ if (mouse->mouse_touch_events == 0) { if (id == SDL_MOUSE_TOUCHID) { return 0; } } finger = SDL_GetFinger(touch, fingerid); if (down) { if (finger) { /* This finger is already down */ return 0; } if (SDL_AddFinger(touch, fingerid, x, y, pressure) < 0) { return 0; } posted = 0; if (SDL_GetEventState(SDL_FINGERDOWN) == SDL_ENABLE) { SDL_Event event; event.tfinger.type = SDL_FINGERDOWN; event.tfinger.touchId = id; event.tfinger.fingerId = fingerid; event.tfinger.x = x; event.tfinger.y = y; event.tfinger.dx = 0; event.tfinger.dy = 0; event.tfinger.pressure = pressure; event.tfinger.windowID = window ? SDL_GetWindowID(window) : 0; posted = (SDL_PushEvent(&event) > 0); } } else { if (!finger) { /* This finger is already up */ return 0; } posted = 0; if (SDL_GetEventState(SDL_FINGERUP) == SDL_ENABLE) { SDL_Event event; event.tfinger.type = SDL_FINGERUP; event.tfinger.touchId = id; event.tfinger.fingerId = fingerid; /* I don't trust the coordinates passed on fingerUp */ event.tfinger.x = finger->x; event.tfinger.y = finger->y; event.tfinger.dx = 0; event.tfinger.dy = 0; event.tfinger.pressure = pressure; event.tfinger.windowID = window ? SDL_GetWindowID(window) : 0; posted = (SDL_PushEvent(&event) > 0); } SDL_DelFinger(touch, fingerid); } return posted; } int SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window, float x, float y, float pressure) { SDL_Touch *touch; SDL_Finger *finger; SDL_Mouse *mouse; int posted; float xrel, yrel, prel; touch = SDL_GetTouch(id); if (!touch) { return -1; } mouse = SDL_GetMouse(); #if SYNTHESIZE_TOUCH_TO_MOUSE /* SDL_HINT_TOUCH_MOUSE_EVENTS: controlling whether touch events should generate synthetic mouse events */ { if (mouse->touch_mouse_events) { if (id != SDL_MOUSE_TOUCHID) { if (window) { if (finger_touching == SDL_TRUE && track_touchid == id && track_fingerid == fingerid) { int pos_x = (int)(x * (float)window->w); int pos_y = (int)(y * (float)window->h); if (pos_x < 0) pos_x = 0; if (pos_x > window->w - 1) pos_x = window->w - 1; if (pos_y < 0) pos_y = 0; if (pos_y > window->h - 1) pos_y = window->h - 1; SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, pos_x, pos_y); } } } } } #endif /* SDL_HINT_MOUSE_TOUCH_EVENTS: if not set, discard synthetic touch events coming from platform layer */ if (mouse->mouse_touch_events == 0) { if (id == SDL_MOUSE_TOUCHID) { return 0; } } finger = SDL_GetFinger(touch,fingerid); if (!finger) { return SDL_SendTouch(id, fingerid, window, SDL_TRUE, x, y, pressure); } xrel = x - finger->x; yrel = y - finger->y; prel = pressure - finger->pressure; /* Drop events that don't change state */ if (xrel == 0.0f && yrel == 0.0f && prel == 0.0f) { #if 0 printf("Touch event didn't change state - dropped!\n"); #endif return 0; } /* Update internal touch coordinates */ finger->x = x; finger->y = y; finger->pressure = pressure; /* Post the event, if desired */ posted = 0; if (SDL_GetEventState(SDL_FINGERMOTION) == SDL_ENABLE) { SDL_Event event; event.tfinger.type = SDL_FINGERMOTION; event.tfinger.touchId = id; event.tfinger.fingerId = fingerid; event.tfinger.x = x; event.tfinger.y = y; event.tfinger.dx = xrel; event.tfinger.dy = yrel; event.tfinger.pressure = pressure; event.tfinger.windowID = window ? SDL_GetWindowID(window) : 0; posted = (SDL_PushEvent(&event) > 0); } return posted; } void SDL_DelTouch(SDL_TouchID id) { int i; int index = SDL_GetTouchIndex(id); SDL_Touch *touch = SDL_GetTouch(id); if (!touch) { return; } for (i = 0; i < touch->max_fingers; ++i) { SDL_free(touch->fingers[i]); } SDL_free(touch->fingers); SDL_free(touch); SDL_num_touch--; SDL_touchDevices[index] = SDL_touchDevices[SDL_num_touch]; /* Delete this touch device for gestures */ SDL_GestureDelTouch(id); } void SDL_TouchQuit(void) { int i; for (i = SDL_num_touch; i--; ) { SDL_DelTouch(SDL_touchDevices[i]->id); } SDL_assert(SDL_num_touch == 0); SDL_free(SDL_touchDevices); SDL_touchDevices = NULL; SDL_GestureQuit(); } /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/SDL_touch.c
C
apache-2.0
13,653
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" #include "../../include/SDL_touch.h" #ifndef SDL_touch_c_h_ #define SDL_touch_c_h_ typedef struct SDL_Touch { SDL_TouchID id; SDL_TouchDeviceType type; int num_fingers; int max_fingers; SDL_Finger** fingers; } SDL_Touch; /* Initialize the touch subsystem */ extern int SDL_TouchInit(void); /* Add a touch, returning the index of the touch, or -1 if there was an error. */ extern int SDL_AddTouch(SDL_TouchID id, SDL_TouchDeviceType type, const char *name); /* Get the touch with a given id */ extern SDL_Touch *SDL_GetTouch(SDL_TouchID id); /* Send a touch down/up event for a touch */ extern int SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window, SDL_bool down, float x, float y, float pressure); /* Send a touch motion event for a touch */ extern int SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window, float x, float y, float pressure); /* Remove a touch */ extern void SDL_DelTouch(SDL_TouchID id); /* Shutdown the touch subsystem */ extern void SDL_TouchQuit(void); #endif /* SDL_touch_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/SDL_touch_c.h
C
apache-2.0
2,141
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" /* Window event handling code for SDL */ #include "SDL_events.h" #include "SDL_events_c.h" #include "SDL_mouse_c.h" static int SDLCALL RemovePendingSizeChangedAndResizedEvents(void * userdata, SDL_Event *event) { SDL_Event *new_event = (SDL_Event *)userdata; if (event->type == SDL_WINDOWEVENT && (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED || event->window.event == SDL_WINDOWEVENT_RESIZED) && event->window.windowID == new_event->window.windowID) { /* We're about to post a new size event, drop the old one */ return 0; } return 1; } static int SDLCALL RemovePendingMoveEvents(void * userdata, SDL_Event *event) { SDL_Event *new_event = (SDL_Event *)userdata; if (event->type == SDL_WINDOWEVENT && event->window.event == SDL_WINDOWEVENT_MOVED && event->window.windowID == new_event->window.windowID) { /* We're about to post a new move event, drop the old one */ return 0; } return 1; } static int SDLCALL RemovePendingExposedEvents(void * userdata, SDL_Event *event) { SDL_Event *new_event = (SDL_Event *)userdata; if (event->type == SDL_WINDOWEVENT && event->window.event == SDL_WINDOWEVENT_EXPOSED && event->window.windowID == new_event->window.windowID) { /* We're about to post a new exposed event, drop the old one */ return 0; } return 1; } int SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1, int data2) { int posted; if (!window) { return 0; } switch (windowevent) { case SDL_WINDOWEVENT_SHOWN: if (window->flags & SDL_WINDOW_SHOWN) { return 0; } window->flags &= ~(SDL_WINDOW_HIDDEN | SDL_WINDOW_MINIMIZED); window->flags |= SDL_WINDOW_SHOWN; SDL_OnWindowShown(window); break; case SDL_WINDOWEVENT_HIDDEN: if (!(window->flags & SDL_WINDOW_SHOWN)) { return 0; } window->flags &= ~SDL_WINDOW_SHOWN; window->flags |= SDL_WINDOW_HIDDEN; SDL_OnWindowHidden(window); break; case SDL_WINDOWEVENT_MOVED: if (SDL_WINDOWPOS_ISUNDEFINED(data1) || SDL_WINDOWPOS_ISUNDEFINED(data2)) { return 0; } if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { window->windowed.x = data1; window->windowed.y = data2; } if (data1 == window->x && data2 == window->y) { return 0; } window->x = data1; window->y = data2; break; case SDL_WINDOWEVENT_RESIZED: if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { window->windowed.w = data1; window->windowed.h = data2; } if (data1 == window->w && data2 == window->h) { return 0; } window->w = data1; window->h = data2; SDL_OnWindowResized(window); break; case SDL_WINDOWEVENT_MINIMIZED: if (window->flags & SDL_WINDOW_MINIMIZED) { return 0; } window->flags &= ~SDL_WINDOW_MAXIMIZED; window->flags |= SDL_WINDOW_MINIMIZED; SDL_OnWindowMinimized(window); break; case SDL_WINDOWEVENT_MAXIMIZED: if (window->flags & SDL_WINDOW_MAXIMIZED) { return 0; } window->flags &= ~SDL_WINDOW_MINIMIZED; window->flags |= SDL_WINDOW_MAXIMIZED; break; case SDL_WINDOWEVENT_RESTORED: if (!(window->flags & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED))) { return 0; } window->flags &= ~(SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED); SDL_OnWindowRestored(window); break; case SDL_WINDOWEVENT_ENTER: if (window->flags & SDL_WINDOW_MOUSE_FOCUS) { return 0; } window->flags |= SDL_WINDOW_MOUSE_FOCUS; SDL_OnWindowEnter(window); break; case SDL_WINDOWEVENT_LEAVE: if (!(window->flags & SDL_WINDOW_MOUSE_FOCUS)) { return 0; } window->flags &= ~SDL_WINDOW_MOUSE_FOCUS; SDL_OnWindowLeave(window); break; case SDL_WINDOWEVENT_FOCUS_GAINED: if (window->flags & SDL_WINDOW_INPUT_FOCUS) { return 0; } window->flags |= SDL_WINDOW_INPUT_FOCUS; SDL_OnWindowFocusGained(window); break; case SDL_WINDOWEVENT_FOCUS_LOST: if (!(window->flags & SDL_WINDOW_INPUT_FOCUS)) { return 0; } window->flags &= ~SDL_WINDOW_INPUT_FOCUS; SDL_OnWindowFocusLost(window); break; } /* Post the event, if desired */ posted = 0; if (SDL_GetEventState(SDL_WINDOWEVENT) == SDL_ENABLE) { SDL_Event event; event.type = SDL_WINDOWEVENT; event.window.event = windowevent; event.window.data1 = data1; event.window.data2 = data2; event.window.windowID = window->id; /* Fixes queue overflow with resize events that aren't processed */ if (windowevent == SDL_WINDOWEVENT_SIZE_CHANGED) { SDL_FilterEvents(RemovePendingSizeChangedAndResizedEvents, &event); } if (windowevent == SDL_WINDOWEVENT_MOVED) { SDL_FilterEvents(RemovePendingMoveEvents, &event); } if (windowevent == SDL_WINDOWEVENT_EXPOSED) { SDL_FilterEvents(RemovePendingExposedEvents, &event); } posted = (SDL_PushEvent(&event) > 0); } if (windowevent == SDL_WINDOWEVENT_CLOSE) { if ( !window->prev && !window->next ) { /* This is the last window in the list so send the SDL_QUIT event */ SDL_SendQuit(); } } return (posted); } /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/SDL_windowevents.c
C
apache-2.0
6,778
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" #ifndef SDL_windowevents_c_h_ #define SDL_windowevents_c_h_ extern int SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1, int data2); #endif /* SDL_windowevents_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/SDL_windowevents_c.h
C
apache-2.0
1,227
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * A default blank 8x8 cursor */ #define BLANK_CWIDTH 8 #define BLANK_CHEIGHT 8 #define BLANK_CHOTX 0 #define BLANK_CHOTY 0 static const unsigned char blank_cdata[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; static const unsigned char blank_cmask[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/events/blank_cursor.h
C
apache-2.0
1,377
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* Mac virtual key code to SDL scancode mapping table Sources: - Inside Macintosh: Text <http://developer.apple.com/documentation/mac/Text/Text-571.html> - Apple USB keyboard driver source <http://darwinsource.opendarwin.org/10.4.6.ppc/IOHIDFamily-172.8/IOHIDFamily/Cosmo_USB2ADB.c> - experimentation on various ADB and USB ISO keyboards and one ADB ANSI keyboard */ /* *INDENT-OFF* */ static const SDL_Scancode darwin_scancode_table[] = { /* 0 */ SDL_SCANCODE_A, /* 1 */ SDL_SCANCODE_S, /* 2 */ SDL_SCANCODE_D, /* 3 */ SDL_SCANCODE_F, /* 4 */ SDL_SCANCODE_H, /* 5 */ SDL_SCANCODE_G, /* 6 */ SDL_SCANCODE_Z, /* 7 */ SDL_SCANCODE_X, /* 8 */ SDL_SCANCODE_C, /* 9 */ SDL_SCANCODE_V, /* 10 */ SDL_SCANCODE_NONUSBACKSLASH, /* SDL_SCANCODE_NONUSBACKSLASH on ANSI and JIS keyboards (if this key would exist there), SDL_SCANCODE_GRAVE on ISO. (The USB keyboard driver actually translates these usage codes to different virtual key codes depending on whether the keyboard is ISO/ANSI/JIS. That's why you have to help it identify the keyboard type when you plug in a PC USB keyboard. It's a historical thing - ADB keyboards are wired this way.) */ /* 11 */ SDL_SCANCODE_B, /* 12 */ SDL_SCANCODE_Q, /* 13 */ SDL_SCANCODE_W, /* 14 */ SDL_SCANCODE_E, /* 15 */ SDL_SCANCODE_R, /* 16 */ SDL_SCANCODE_Y, /* 17 */ SDL_SCANCODE_T, /* 18 */ SDL_SCANCODE_1, /* 19 */ SDL_SCANCODE_2, /* 20 */ SDL_SCANCODE_3, /* 21 */ SDL_SCANCODE_4, /* 22 */ SDL_SCANCODE_6, /* 23 */ SDL_SCANCODE_5, /* 24 */ SDL_SCANCODE_EQUALS, /* 25 */ SDL_SCANCODE_9, /* 26 */ SDL_SCANCODE_7, /* 27 */ SDL_SCANCODE_MINUS, /* 28 */ SDL_SCANCODE_8, /* 29 */ SDL_SCANCODE_0, /* 30 */ SDL_SCANCODE_RIGHTBRACKET, /* 31 */ SDL_SCANCODE_O, /* 32 */ SDL_SCANCODE_U, /* 33 */ SDL_SCANCODE_LEFTBRACKET, /* 34 */ SDL_SCANCODE_I, /* 35 */ SDL_SCANCODE_P, /* 36 */ SDL_SCANCODE_RETURN, /* 37 */ SDL_SCANCODE_L, /* 38 */ SDL_SCANCODE_J, /* 39 */ SDL_SCANCODE_APOSTROPHE, /* 40 */ SDL_SCANCODE_K, /* 41 */ SDL_SCANCODE_SEMICOLON, /* 42 */ SDL_SCANCODE_BACKSLASH, /* 43 */ SDL_SCANCODE_COMMA, /* 44 */ SDL_SCANCODE_SLASH, /* 45 */ SDL_SCANCODE_N, /* 46 */ SDL_SCANCODE_M, /* 47 */ SDL_SCANCODE_PERIOD, /* 48 */ SDL_SCANCODE_TAB, /* 49 */ SDL_SCANCODE_SPACE, /* 50 */ SDL_SCANCODE_GRAVE, /* SDL_SCANCODE_GRAVE on ANSI and JIS keyboards, SDL_SCANCODE_NONUSBACKSLASH on ISO (see comment about virtual key code 10 above) */ /* 51 */ SDL_SCANCODE_BACKSPACE, /* 52 */ SDL_SCANCODE_KP_ENTER, /* keyboard enter on portables */ /* 53 */ SDL_SCANCODE_ESCAPE, /* 54 */ SDL_SCANCODE_RGUI, /* 55 */ SDL_SCANCODE_LGUI, /* 56 */ SDL_SCANCODE_LSHIFT, /* 57 */ SDL_SCANCODE_CAPSLOCK, /* 58 */ SDL_SCANCODE_LALT, /* 59 */ SDL_SCANCODE_LCTRL, /* 60 */ SDL_SCANCODE_RSHIFT, /* 61 */ SDL_SCANCODE_RALT, /* 62 */ SDL_SCANCODE_RCTRL, /* 63 */ SDL_SCANCODE_RGUI, /* fn on portables, acts as a hardware-level modifier already, so we don't generate events for it, also XK_Meta_R */ /* 64 */ SDL_SCANCODE_F17, /* 65 */ SDL_SCANCODE_KP_PERIOD, /* 66 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */ /* 67 */ SDL_SCANCODE_KP_MULTIPLY, /* 68 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */ /* 69 */ SDL_SCANCODE_KP_PLUS, /* 70 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */ /* 71 */ SDL_SCANCODE_NUMLOCKCLEAR, /* 72 */ SDL_SCANCODE_VOLUMEUP, /* 73 */ SDL_SCANCODE_VOLUMEDOWN, /* 74 */ SDL_SCANCODE_MUTE, /* 75 */ SDL_SCANCODE_KP_DIVIDE, /* 76 */ SDL_SCANCODE_KP_ENTER, /* keypad enter on external keyboards, fn-return on portables */ /* 77 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */ /* 78 */ SDL_SCANCODE_KP_MINUS, /* 79 */ SDL_SCANCODE_F18, /* 80 */ SDL_SCANCODE_F19, /* 81 */ SDL_SCANCODE_KP_EQUALS, /* 82 */ SDL_SCANCODE_KP_0, /* 83 */ SDL_SCANCODE_KP_1, /* 84 */ SDL_SCANCODE_KP_2, /* 85 */ SDL_SCANCODE_KP_3, /* 86 */ SDL_SCANCODE_KP_4, /* 87 */ SDL_SCANCODE_KP_5, /* 88 */ SDL_SCANCODE_KP_6, /* 89 */ SDL_SCANCODE_KP_7, /* 90 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */ /* 91 */ SDL_SCANCODE_KP_8, /* 92 */ SDL_SCANCODE_KP_9, /* 93 */ SDL_SCANCODE_INTERNATIONAL3, /* Cosmo_USB2ADB.c says "Yen (JIS)" */ /* 94 */ SDL_SCANCODE_INTERNATIONAL1, /* Cosmo_USB2ADB.c says "Ro (JIS)" */ /* 95 */ SDL_SCANCODE_KP_COMMA, /* Cosmo_USB2ADB.c says ", JIS only" */ /* 96 */ SDL_SCANCODE_F5, /* 97 */ SDL_SCANCODE_F6, /* 98 */ SDL_SCANCODE_F7, /* 99 */ SDL_SCANCODE_F3, /* 100 */ SDL_SCANCODE_F8, /* 101 */ SDL_SCANCODE_F9, /* 102 */ SDL_SCANCODE_LANG2, /* Cosmo_USB2ADB.c says "Eisu" */ /* 103 */ SDL_SCANCODE_F11, /* 104 */ SDL_SCANCODE_LANG1, /* Cosmo_USB2ADB.c says "Kana" */ /* 105 */ SDL_SCANCODE_PRINTSCREEN, /* On ADB keyboards, this key is labeled "F13/print screen". Problem: USB has different usage codes for these two functions. On Apple USB keyboards, the key is labeled "F13" and sends the F13 usage code (SDL_SCANCODE_F13). I decided to use SDL_SCANCODE_PRINTSCREEN here nevertheless since SDL applications are more likely to assume the presence of a print screen key than an F13 key. */ /* 106 */ SDL_SCANCODE_F16, /* 107 */ SDL_SCANCODE_SCROLLLOCK, /* F14/scroll lock, see comment about F13/print screen above */ /* 108 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */ /* 109 */ SDL_SCANCODE_F10, /* 110 */ SDL_SCANCODE_APPLICATION, /* windows contextual menu key, fn-enter on portables */ /* 111 */ SDL_SCANCODE_F12, /* 112 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */ /* 113 */ SDL_SCANCODE_PAUSE, /* F15/pause, see comment about F13/print screen above */ /* 114 */ SDL_SCANCODE_INSERT, /* the key is actually labeled "help" on Apple keyboards, and works as such in Mac OS, but it sends the "insert" usage code even on Apple USB keyboards */ /* 115 */ SDL_SCANCODE_HOME, /* 116 */ SDL_SCANCODE_PAGEUP, /* 117 */ SDL_SCANCODE_DELETE, /* 118 */ SDL_SCANCODE_F4, /* 119 */ SDL_SCANCODE_END, /* 120 */ SDL_SCANCODE_F2, /* 121 */ SDL_SCANCODE_PAGEDOWN, /* 122 */ SDL_SCANCODE_F1, /* 123 */ SDL_SCANCODE_LEFT, /* 124 */ SDL_SCANCODE_RIGHT, /* 125 */ SDL_SCANCODE_DOWN, /* 126 */ SDL_SCANCODE_UP, /* 127 */ SDL_SCANCODE_POWER }; /* *INDENT-ON* */
YifuLiu/AliOS-Things
components/SDL2/src/events/scancodes_darwin.h
C
apache-2.0
7,802
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../include/SDL_scancode.h" /* Linux virtual key code to SDL_Keycode mapping table Sources: - Linux kernel source input.h */ /* *INDENT-OFF* */ static SDL_Scancode const linux_scancode_table[] = { /* 0 */ SDL_SCANCODE_UNKNOWN, /* 1 */ SDL_SCANCODE_ESCAPE, /* 2 */ SDL_SCANCODE_1, /* 3 */ SDL_SCANCODE_2, /* 4 */ SDL_SCANCODE_3, /* 5 */ SDL_SCANCODE_4, /* 6 */ SDL_SCANCODE_5, /* 7 */ SDL_SCANCODE_6, /* 8 */ SDL_SCANCODE_7, /* 9 */ SDL_SCANCODE_8, /* 10 */ SDL_SCANCODE_9, /* 11 */ SDL_SCANCODE_0, /* 12 */ SDL_SCANCODE_MINUS, /* 13 */ SDL_SCANCODE_EQUALS, /* 14 */ SDL_SCANCODE_BACKSPACE, /* 15 */ SDL_SCANCODE_TAB, /* 16 */ SDL_SCANCODE_Q, /* 17 */ SDL_SCANCODE_W, /* 18 */ SDL_SCANCODE_E, /* 19 */ SDL_SCANCODE_R, /* 20 */ SDL_SCANCODE_T, /* 21 */ SDL_SCANCODE_Y, /* 22 */ SDL_SCANCODE_U, /* 23 */ SDL_SCANCODE_I, /* 24 */ SDL_SCANCODE_O, /* 25 */ SDL_SCANCODE_P, /* 26 */ SDL_SCANCODE_LEFTBRACKET, /* 27 */ SDL_SCANCODE_RIGHTBRACKET, /* 28 */ SDL_SCANCODE_RETURN, /* 29 */ SDL_SCANCODE_LCTRL, /* 30 */ SDL_SCANCODE_A, /* 31 */ SDL_SCANCODE_S, /* 32 */ SDL_SCANCODE_D, /* 33 */ SDL_SCANCODE_F, /* 34 */ SDL_SCANCODE_G, /* 35 */ SDL_SCANCODE_H, /* 36 */ SDL_SCANCODE_J, /* 37 */ SDL_SCANCODE_K, /* 38 */ SDL_SCANCODE_L, /* 39 */ SDL_SCANCODE_SEMICOLON, /* 40 */ SDL_SCANCODE_APOSTROPHE, /* 41 */ SDL_SCANCODE_GRAVE, /* 42 */ SDL_SCANCODE_LSHIFT, /* 43 */ SDL_SCANCODE_BACKSLASH, /* 44 */ SDL_SCANCODE_Z, /* 45 */ SDL_SCANCODE_X, /* 46 */ SDL_SCANCODE_C, /* 47 */ SDL_SCANCODE_V, /* 48 */ SDL_SCANCODE_B, /* 49 */ SDL_SCANCODE_N, /* 50 */ SDL_SCANCODE_M, /* 51 */ SDL_SCANCODE_COMMA, /* 52 */ SDL_SCANCODE_PERIOD, /* 53 */ SDL_SCANCODE_SLASH, /* 54 */ SDL_SCANCODE_RSHIFT, /* 55 */ SDL_SCANCODE_KP_MULTIPLY, /* 56 */ SDL_SCANCODE_LALT, /* 57 */ SDL_SCANCODE_SPACE, /* 58 */ SDL_SCANCODE_CAPSLOCK, /* 59 */ SDL_SCANCODE_F1, /* 60 */ SDL_SCANCODE_F2, /* 61 */ SDL_SCANCODE_F3, /* 62 */ SDL_SCANCODE_F4, /* 63 */ SDL_SCANCODE_F5, /* 64 */ SDL_SCANCODE_F6, /* 65 */ SDL_SCANCODE_F7, /* 66 */ SDL_SCANCODE_F8, /* 67 */ SDL_SCANCODE_F9, /* 68 */ SDL_SCANCODE_F10, /* 69 */ SDL_SCANCODE_NUMLOCKCLEAR, /* 70 */ SDL_SCANCODE_SCROLLLOCK, /* 71 */ SDL_SCANCODE_KP_7, /* 72 */ SDL_SCANCODE_KP_8, /* 73 */ SDL_SCANCODE_KP_9, /* 74 */ SDL_SCANCODE_KP_MINUS, /* 75 */ SDL_SCANCODE_KP_4, /* 76 */ SDL_SCANCODE_KP_5, /* 77 */ SDL_SCANCODE_KP_6, /* 78 */ SDL_SCANCODE_KP_PLUS, /* 79 */ SDL_SCANCODE_KP_1, /* 80 */ SDL_SCANCODE_KP_2, /* 81 */ SDL_SCANCODE_KP_3, /* 82 */ SDL_SCANCODE_KP_0, /* 83 */ SDL_SCANCODE_KP_PERIOD, 0, /* 85 */ SDL_SCANCODE_LANG5, /* KEY_ZENKAKUHANKAKU */ /* 86 */ SDL_SCANCODE_NONUSBACKSLASH, /* KEY_102ND */ /* 87 */ SDL_SCANCODE_F11, /* 88 */ SDL_SCANCODE_F12, /* 89 */ SDL_SCANCODE_INTERNATIONAL1, /* KEY_RO */ /* 90 */ SDL_SCANCODE_LANG3, /* KEY_KATAKANA */ /* 91 */ SDL_SCANCODE_LANG4, /* KEY_HIRAGANA */ /* 92 */ SDL_SCANCODE_INTERNATIONAL4, /* KEY_HENKAN */ /* 93 */ SDL_SCANCODE_INTERNATIONAL2, /* KEY_KATAKANAHIRAGANA */ /* 94 */ SDL_SCANCODE_INTERNATIONAL5, /* KEY_MUHENKAN */ /* 95 */ SDL_SCANCODE_INTERNATIONAL5, /* KEY_KPJPCOMMA */ /* 96 */ SDL_SCANCODE_KP_ENTER, /* 97 */ SDL_SCANCODE_RCTRL, /* 98 */ SDL_SCANCODE_KP_DIVIDE, /* 99 */ SDL_SCANCODE_SYSREQ, /* 100 */ SDL_SCANCODE_RALT, /* 101 */ SDL_SCANCODE_UNKNOWN, /* KEY_LINEFEED */ /* 102 */ SDL_SCANCODE_HOME, /* 103 */ SDL_SCANCODE_UP, /* 104 */ SDL_SCANCODE_PAGEUP, /* 105 */ SDL_SCANCODE_LEFT, /* 106 */ SDL_SCANCODE_RIGHT, /* 107 */ SDL_SCANCODE_END, /* 108 */ SDL_SCANCODE_DOWN, /* 109 */ SDL_SCANCODE_PAGEDOWN, /* 110 */ SDL_SCANCODE_INSERT, /* 111 */ SDL_SCANCODE_DELETE, /* 112 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO */ /* 113 */ SDL_SCANCODE_MUTE, /* 114 */ SDL_SCANCODE_VOLUMEDOWN, /* 115 */ SDL_SCANCODE_VOLUMEUP, /* 116 */ SDL_SCANCODE_POWER, /* 117 */ SDL_SCANCODE_KP_EQUALS, /* 118 */ SDL_SCANCODE_KP_PLUSMINUS, /* 119 */ SDL_SCANCODE_PAUSE, 0, /* 121 */ SDL_SCANCODE_KP_COMMA, /* 122 */ SDL_SCANCODE_LANG1, /* KEY_HANGUEL */ /* 123 */ SDL_SCANCODE_LANG2, /* KEY_HANJA */ /* 124 */ SDL_SCANCODE_INTERNATIONAL3, /* KEY_YEN */ /* 125 */ SDL_SCANCODE_LGUI, /* 126 */ SDL_SCANCODE_RGUI, /* 127 */ SDL_SCANCODE_APPLICATION, /* KEY_COMPOSE */ /* 128 */ SDL_SCANCODE_STOP, /* 129 */ SDL_SCANCODE_AGAIN, /* 130 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROPS */ /* 131 */ SDL_SCANCODE_UNDO, /* 132 */ SDL_SCANCODE_UNKNOWN, /* KEY_FRONT */ /* 133 */ SDL_SCANCODE_COPY, /* 134 */ SDL_SCANCODE_UNKNOWN, /* KEY_OPEN */ /* 135 */ SDL_SCANCODE_PASTE, /* 136 */ SDL_SCANCODE_FIND, /* 137 */ SDL_SCANCODE_CUT, /* 138 */ SDL_SCANCODE_HELP, /* 139 */ SDL_SCANCODE_MENU, /* 140 */ SDL_SCANCODE_CALCULATOR, /* 141 */ SDL_SCANCODE_UNKNOWN, /* KEY_SETUP */ /* 142 */ SDL_SCANCODE_SLEEP, /* 143 */ SDL_SCANCODE_UNKNOWN, /* KEY_WAKEUP */ /* 144 */ SDL_SCANCODE_UNKNOWN, /* KEY_FILE */ /* 145 */ SDL_SCANCODE_UNKNOWN, /* KEY_SENDFILE */ /* 146 */ SDL_SCANCODE_UNKNOWN, /* KEY_DELETEFILE */ /* 147 */ SDL_SCANCODE_UNKNOWN, /* KEY_XFER */ /* 148 */ SDL_SCANCODE_APP1, /* KEY_PROG1 */ /* 149 */ SDL_SCANCODE_APP2, /* KEY_PROG2 */ /* 150 */ SDL_SCANCODE_WWW, /* KEY_WWW */ /* 151 */ SDL_SCANCODE_UNKNOWN, /* KEY_MSDOS */ /* 152 */ SDL_SCANCODE_UNKNOWN, /* KEY_COFFEE */ /* 153 */ SDL_SCANCODE_UNKNOWN, /* KEY_DIRECTION */ /* 154 */ SDL_SCANCODE_UNKNOWN, /* KEY_CYCLEWINDOWS */ /* 155 */ SDL_SCANCODE_MAIL, /* 156 */ SDL_SCANCODE_AC_BOOKMARKS, /* 157 */ SDL_SCANCODE_COMPUTER, /* 158 */ SDL_SCANCODE_AC_BACK, /* 159 */ SDL_SCANCODE_AC_FORWARD, /* 160 */ SDL_SCANCODE_UNKNOWN, /* KEY_CLOSECD */ /* 161 */ SDL_SCANCODE_EJECT, /* KEY_EJECTCD */ /* 162 */ SDL_SCANCODE_UNKNOWN, /* KEY_EJECTCLOSECD */ /* 163 */ SDL_SCANCODE_AUDIONEXT, /* KEY_NEXTSONG */ /* 164 */ SDL_SCANCODE_AUDIOPLAY, /* KEY_PLAYPAUSE */ /* 165 */ SDL_SCANCODE_AUDIOPREV, /* KEY_PREVIOUSSONG */ /* 166 */ SDL_SCANCODE_AUDIOSTOP, /* KEY_STOPCD */ /* 167 */ SDL_SCANCODE_UNKNOWN, /* KEY_RECORD */ /* 168 */ SDL_SCANCODE_AUDIOREWIND, /* KEY_REWIND */ /* 169 */ SDL_SCANCODE_UNKNOWN, /* KEY_PHONE */ /* 170 */ SDL_SCANCODE_UNKNOWN, /* KEY_ISO */ /* 171 */ SDL_SCANCODE_UNKNOWN, /* KEY_CONFIG */ /* 172 */ SDL_SCANCODE_AC_HOME, /* 173 */ SDL_SCANCODE_AC_REFRESH, /* 174 */ SDL_SCANCODE_UNKNOWN, /* KEY_EXIT */ /* 175 */ SDL_SCANCODE_UNKNOWN, /* KEY_MOVE */ /* 176 */ SDL_SCANCODE_UNKNOWN, /* KEY_EDIT */ /* 177 */ SDL_SCANCODE_UNKNOWN, /* KEY_SCROLLUP */ /* 178 */ SDL_SCANCODE_UNKNOWN, /* KEY_SCROLLDOWN */ /* 179 */ SDL_SCANCODE_KP_LEFTPAREN, /* 180 */ SDL_SCANCODE_KP_RIGHTPAREN, /* 181 */ SDL_SCANCODE_UNKNOWN, /* KEY_NEW */ /* 182 */ SDL_SCANCODE_UNKNOWN, /* KEY_REDO */ /* 183 */ SDL_SCANCODE_F13, /* 184 */ SDL_SCANCODE_F14, /* 185 */ SDL_SCANCODE_F15, /* 186 */ SDL_SCANCODE_F16, /* 187 */ SDL_SCANCODE_F17, /* 188 */ SDL_SCANCODE_F18, /* 189 */ SDL_SCANCODE_F19, /* 190 */ SDL_SCANCODE_F20, /* 191 */ SDL_SCANCODE_F21, /* 192 */ SDL_SCANCODE_F22, /* 193 */ SDL_SCANCODE_F23, /* 194 */ SDL_SCANCODE_F24, 0, 0, 0, 0, 0, /* 200 */ SDL_SCANCODE_UNKNOWN, /* KEY_PLAYCD */ /* 201 */ SDL_SCANCODE_UNKNOWN, /* KEY_PAUSECD */ /* 202 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROG3 */ /* 203 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROG4 */ 0, /* 205 */ SDL_SCANCODE_UNKNOWN, /* KEY_SUSPEND */ /* 206 */ SDL_SCANCODE_UNKNOWN, /* KEY_CLOSE */ /* 207 */ SDL_SCANCODE_UNKNOWN, /* KEY_PLAY */ /* 208 */ SDL_SCANCODE_AUDIOFASTFORWARD, /* KEY_FASTFORWARD */ /* 209 */ SDL_SCANCODE_UNKNOWN, /* KEY_BASSBOOST */ /* 210 */ SDL_SCANCODE_UNKNOWN, /* KEY_PRINT */ /* 211 */ SDL_SCANCODE_UNKNOWN, /* KEY_HP */ /* 212 */ SDL_SCANCODE_UNKNOWN, /* KEY_CAMERA */ /* 213 */ SDL_SCANCODE_UNKNOWN, /* KEY_SOUND */ /* 214 */ SDL_SCANCODE_UNKNOWN, /* KEY_QUESTION */ /* 215 */ SDL_SCANCODE_UNKNOWN, /* KEY_EMAIL */ /* 216 */ SDL_SCANCODE_UNKNOWN, /* KEY_CHAT */ /* 217 */ SDL_SCANCODE_AC_SEARCH, /* 218 */ SDL_SCANCODE_UNKNOWN, /* KEY_CONNECT */ /* 219 */ SDL_SCANCODE_UNKNOWN, /* KEY_FINANCE */ /* 220 */ SDL_SCANCODE_UNKNOWN, /* KEY_SPORT */ /* 221 */ SDL_SCANCODE_UNKNOWN, /* KEY_SHOP */ /* 222 */ SDL_SCANCODE_ALTERASE, /* 223 */ SDL_SCANCODE_CANCEL, /* 224 */ SDL_SCANCODE_BRIGHTNESSDOWN, /* 225 */ SDL_SCANCODE_BRIGHTNESSUP, /* 226 */ SDL_SCANCODE_UNKNOWN, /* KEY_MEDIA */ /* 227 */ SDL_SCANCODE_DISPLAYSWITCH, /* KEY_SWITCHVIDEOMODE */ /* 228 */ SDL_SCANCODE_KBDILLUMTOGGLE, /* 229 */ SDL_SCANCODE_KBDILLUMDOWN, /* 230 */ SDL_SCANCODE_KBDILLUMUP, /* 231 */ SDL_SCANCODE_UNKNOWN, /* KEY_SEND */ /* 232 */ SDL_SCANCODE_UNKNOWN, /* KEY_REPLY */ /* 233 */ SDL_SCANCODE_UNKNOWN, /* KEY_FORWARDMAIL */ /* 234 */ SDL_SCANCODE_UNKNOWN, /* KEY_SAVE */ /* 235 */ SDL_SCANCODE_UNKNOWN, /* KEY_DOCUMENTS */ /* 236 */ SDL_SCANCODE_UNKNOWN, /* KEY_BATTERY */ }; /* *INDENT-ON* */
YifuLiu/AliOS-Things
components/SDL2/src/events/scancodes_linux.h
C
apache-2.0
11,347
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../include/SDL_scancode.h" /* Windows scancode to SDL scancode mapping table */ /* derived from Microsoft scan code document, http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/scancode.doc */ /* *INDENT-OFF* */ static const SDL_Scancode windows_scancode_table[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_ESCAPE, SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_3, SDL_SCANCODE_4, SDL_SCANCODE_5, SDL_SCANCODE_6, /* 0 */ SDL_SCANCODE_7, SDL_SCANCODE_8, SDL_SCANCODE_9, SDL_SCANCODE_0, SDL_SCANCODE_MINUS, SDL_SCANCODE_EQUALS, SDL_SCANCODE_BACKSPACE, SDL_SCANCODE_TAB, /* 0 */ SDL_SCANCODE_Q, SDL_SCANCODE_W, SDL_SCANCODE_E, SDL_SCANCODE_R, SDL_SCANCODE_T, SDL_SCANCODE_Y, SDL_SCANCODE_U, SDL_SCANCODE_I, /* 1 */ SDL_SCANCODE_O, SDL_SCANCODE_P, SDL_SCANCODE_LEFTBRACKET, SDL_SCANCODE_RIGHTBRACKET, SDL_SCANCODE_RETURN, SDL_SCANCODE_LCTRL, SDL_SCANCODE_A, SDL_SCANCODE_S, /* 1 */ SDL_SCANCODE_D, SDL_SCANCODE_F, SDL_SCANCODE_G, SDL_SCANCODE_H, SDL_SCANCODE_J, SDL_SCANCODE_K, SDL_SCANCODE_L, SDL_SCANCODE_SEMICOLON, /* 2 */ SDL_SCANCODE_APOSTROPHE, SDL_SCANCODE_GRAVE, SDL_SCANCODE_LSHIFT, SDL_SCANCODE_BACKSLASH, SDL_SCANCODE_Z, SDL_SCANCODE_X, SDL_SCANCODE_C, SDL_SCANCODE_V, /* 2 */ SDL_SCANCODE_B, SDL_SCANCODE_N, SDL_SCANCODE_M, SDL_SCANCODE_COMMA, SDL_SCANCODE_PERIOD, SDL_SCANCODE_SLASH, SDL_SCANCODE_RSHIFT, SDL_SCANCODE_PRINTSCREEN,/* 3 */ SDL_SCANCODE_LALT, SDL_SCANCODE_SPACE, SDL_SCANCODE_CAPSLOCK, SDL_SCANCODE_F1, SDL_SCANCODE_F2, SDL_SCANCODE_F3, SDL_SCANCODE_F4, SDL_SCANCODE_F5, /* 3 */ SDL_SCANCODE_F6, SDL_SCANCODE_F7, SDL_SCANCODE_F8, SDL_SCANCODE_F9, SDL_SCANCODE_F10, SDL_SCANCODE_NUMLOCKCLEAR, SDL_SCANCODE_SCROLLLOCK, SDL_SCANCODE_HOME, /* 4 */ SDL_SCANCODE_UP, SDL_SCANCODE_PAGEUP, SDL_SCANCODE_KP_MINUS, SDL_SCANCODE_LEFT, SDL_SCANCODE_KP_5, SDL_SCANCODE_RIGHT, SDL_SCANCODE_KP_PLUS, SDL_SCANCODE_END, /* 4 */ SDL_SCANCODE_DOWN, SDL_SCANCODE_PAGEDOWN, SDL_SCANCODE_INSERT, SDL_SCANCODE_DELETE, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_NONUSBACKSLASH,SDL_SCANCODE_F11, /* 5 */ SDL_SCANCODE_F12, SDL_SCANCODE_PAUSE, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_LGUI, SDL_SCANCODE_RGUI, SDL_SCANCODE_APPLICATION, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, /* 5 */ SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_F13, SDL_SCANCODE_F14, SDL_SCANCODE_F15, SDL_SCANCODE_F16, /* 6 */ SDL_SCANCODE_F17, SDL_SCANCODE_F18, SDL_SCANCODE_F19, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, /* 6 */ SDL_SCANCODE_INTERNATIONAL2, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL1, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, /* 7 */ SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL4, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL5, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL3, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN /* 7 */ }; /* *INDENT-ON* */
YifuLiu/AliOS-Things
components/SDL2/src/events/scancodes_windows.h
C
apache-2.0
4,283
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef scancodes_xfree86_h_ #define scancodes_xfree86_h_ #include "../../include/SDL_scancode.h" /* XFree86 key code to SDL scancode mapping table Sources: - atKeyNames.h from XFree86 source code */ /* *INDENT-OFF* */ static const SDL_Scancode xfree86_scancode_table[] = { /* 0 */ SDL_SCANCODE_UNKNOWN, /* 1 */ SDL_SCANCODE_ESCAPE, /* 2 */ SDL_SCANCODE_1, /* 3 */ SDL_SCANCODE_2, /* 4 */ SDL_SCANCODE_3, /* 5 */ SDL_SCANCODE_4, /* 6 */ SDL_SCANCODE_5, /* 7 */ SDL_SCANCODE_6, /* 8 */ SDL_SCANCODE_7, /* 9 */ SDL_SCANCODE_8, /* 10 */ SDL_SCANCODE_9, /* 11 */ SDL_SCANCODE_0, /* 12 */ SDL_SCANCODE_MINUS, /* 13 */ SDL_SCANCODE_EQUALS, /* 14 */ SDL_SCANCODE_BACKSPACE, /* 15 */ SDL_SCANCODE_TAB, /* 16 */ SDL_SCANCODE_Q, /* 17 */ SDL_SCANCODE_W, /* 18 */ SDL_SCANCODE_E, /* 19 */ SDL_SCANCODE_R, /* 20 */ SDL_SCANCODE_T, /* 21 */ SDL_SCANCODE_Y, /* 22 */ SDL_SCANCODE_U, /* 23 */ SDL_SCANCODE_I, /* 24 */ SDL_SCANCODE_O, /* 25 */ SDL_SCANCODE_P, /* 26 */ SDL_SCANCODE_LEFTBRACKET, /* 27 */ SDL_SCANCODE_RIGHTBRACKET, /* 28 */ SDL_SCANCODE_RETURN, /* 29 */ SDL_SCANCODE_LCTRL, /* 30 */ SDL_SCANCODE_A, /* 31 */ SDL_SCANCODE_S, /* 32 */ SDL_SCANCODE_D, /* 33 */ SDL_SCANCODE_F, /* 34 */ SDL_SCANCODE_G, /* 35 */ SDL_SCANCODE_H, /* 36 */ SDL_SCANCODE_J, /* 37 */ SDL_SCANCODE_K, /* 38 */ SDL_SCANCODE_L, /* 39 */ SDL_SCANCODE_SEMICOLON, /* 40 */ SDL_SCANCODE_APOSTROPHE, /* 41 */ SDL_SCANCODE_GRAVE, /* 42 */ SDL_SCANCODE_LSHIFT, /* 43 */ SDL_SCANCODE_BACKSLASH, /* 44 */ SDL_SCANCODE_Z, /* 45 */ SDL_SCANCODE_X, /* 46 */ SDL_SCANCODE_C, /* 47 */ SDL_SCANCODE_V, /* 48 */ SDL_SCANCODE_B, /* 49 */ SDL_SCANCODE_N, /* 50 */ SDL_SCANCODE_M, /* 51 */ SDL_SCANCODE_COMMA, /* 52 */ SDL_SCANCODE_PERIOD, /* 53 */ SDL_SCANCODE_SLASH, /* 54 */ SDL_SCANCODE_RSHIFT, /* 55 */ SDL_SCANCODE_KP_MULTIPLY, /* 56 */ SDL_SCANCODE_LALT, /* 57 */ SDL_SCANCODE_SPACE, /* 58 */ SDL_SCANCODE_CAPSLOCK, /* 59 */ SDL_SCANCODE_F1, /* 60 */ SDL_SCANCODE_F2, /* 61 */ SDL_SCANCODE_F3, /* 62 */ SDL_SCANCODE_F4, /* 63 */ SDL_SCANCODE_F5, /* 64 */ SDL_SCANCODE_F6, /* 65 */ SDL_SCANCODE_F7, /* 66 */ SDL_SCANCODE_F8, /* 67 */ SDL_SCANCODE_F9, /* 68 */ SDL_SCANCODE_F10, /* 69 */ SDL_SCANCODE_NUMLOCKCLEAR, /* 70 */ SDL_SCANCODE_SCROLLLOCK, /* 71 */ SDL_SCANCODE_KP_7, /* 72 */ SDL_SCANCODE_KP_8, /* 73 */ SDL_SCANCODE_KP_9, /* 74 */ SDL_SCANCODE_KP_MINUS, /* 75 */ SDL_SCANCODE_KP_4, /* 76 */ SDL_SCANCODE_KP_5, /* 77 */ SDL_SCANCODE_KP_6, /* 78 */ SDL_SCANCODE_KP_PLUS, /* 79 */ SDL_SCANCODE_KP_1, /* 80 */ SDL_SCANCODE_KP_2, /* 81 */ SDL_SCANCODE_KP_3, /* 82 */ SDL_SCANCODE_KP_0, /* 83 */ SDL_SCANCODE_KP_PERIOD, /* 84 */ SDL_SCANCODE_SYSREQ, /* 85 */ SDL_SCANCODE_MODE, /* 86 */ SDL_SCANCODE_NONUSBACKSLASH, /* 87 */ SDL_SCANCODE_F11, /* 88 */ SDL_SCANCODE_F12, /* 89 */ SDL_SCANCODE_HOME, /* 90 */ SDL_SCANCODE_UP, /* 91 */ SDL_SCANCODE_PAGEUP, /* 92 */ SDL_SCANCODE_LEFT, /* 93 */ SDL_SCANCODE_BRIGHTNESSDOWN, /* on PowerBook G4 / KEY_Begin */ /* 94 */ SDL_SCANCODE_RIGHT, /* 95 */ SDL_SCANCODE_END, /* 96 */ SDL_SCANCODE_DOWN, /* 97 */ SDL_SCANCODE_PAGEDOWN, /* 98 */ SDL_SCANCODE_INSERT, /* 99 */ SDL_SCANCODE_DELETE, /* 100 */ SDL_SCANCODE_KP_ENTER, /* 101 */ SDL_SCANCODE_RCTRL, /* 102 */ SDL_SCANCODE_PAUSE, /* 103 */ SDL_SCANCODE_PRINTSCREEN, /* 104 */ SDL_SCANCODE_KP_DIVIDE, /* 105 */ SDL_SCANCODE_RALT, /* 106 */ SDL_SCANCODE_UNKNOWN, /* BREAK */ /* 107 */ SDL_SCANCODE_LGUI, /* 108 */ SDL_SCANCODE_RGUI, /* 109 */ SDL_SCANCODE_APPLICATION, /* 110 */ SDL_SCANCODE_F13, /* 111 */ SDL_SCANCODE_F14, /* 112 */ SDL_SCANCODE_F15, /* 113 */ SDL_SCANCODE_F16, /* 114 */ SDL_SCANCODE_F17, /* 115 */ SDL_SCANCODE_INTERNATIONAL1, /* \_ */ /* 116 */ SDL_SCANCODE_UNKNOWN, /* is translated to XK_ISO_Level3_Shift by my X server, but I have no keyboard that generates this code, so I don't know what the correct SDL_SCANCODE_* for it is */ /* 117 */ SDL_SCANCODE_UNKNOWN, /* 118 */ SDL_SCANCODE_KP_EQUALS, /* 119 */ SDL_SCANCODE_UNKNOWN, /* 120 */ SDL_SCANCODE_UNKNOWN, /* 121 */ SDL_SCANCODE_INTERNATIONAL4, /* Henkan_Mode */ /* 122 */ SDL_SCANCODE_UNKNOWN, /* 123 */ SDL_SCANCODE_INTERNATIONAL5, /* Muhenkan */ /* 124 */ SDL_SCANCODE_UNKNOWN, /* 125 */ SDL_SCANCODE_INTERNATIONAL3, /* Yen */ /* 126 */ SDL_SCANCODE_UNKNOWN, /* 127 */ SDL_SCANCODE_UNKNOWN, /* 128 */ SDL_SCANCODE_UNKNOWN, /* 129 */ SDL_SCANCODE_UNKNOWN, /* 130 */ SDL_SCANCODE_UNKNOWN, /* 131 */ SDL_SCANCODE_UNKNOWN, /* 132 */ SDL_SCANCODE_POWER, /* 133 */ SDL_SCANCODE_MUTE, /* 134 */ SDL_SCANCODE_VOLUMEDOWN, /* 135 */ SDL_SCANCODE_VOLUMEUP, /* 136 */ SDL_SCANCODE_HELP, /* 137 */ SDL_SCANCODE_STOP, /* 138 */ SDL_SCANCODE_AGAIN, /* 139 */ SDL_SCANCODE_UNKNOWN, /* PROPS */ /* 140 */ SDL_SCANCODE_UNDO, /* 141 */ SDL_SCANCODE_UNKNOWN, /* FRONT */ /* 142 */ SDL_SCANCODE_COPY, /* 143 */ SDL_SCANCODE_UNKNOWN, /* OPEN */ /* 144 */ SDL_SCANCODE_PASTE, /* 145 */ SDL_SCANCODE_FIND, /* 146 */ SDL_SCANCODE_CUT, }; /* for wireless usb keyboard (manufacturer TRUST) without numpad. */ static const SDL_Scancode xfree86_scancode_table2[] = { /* 0 */ SDL_SCANCODE_UNKNOWN, /* 1 */ SDL_SCANCODE_ESCAPE, /* 2 */ SDL_SCANCODE_1, /* 3 */ SDL_SCANCODE_2, /* 4 */ SDL_SCANCODE_3, /* 5 */ SDL_SCANCODE_4, /* 6 */ SDL_SCANCODE_5, /* 7 */ SDL_SCANCODE_6, /* 8 */ SDL_SCANCODE_7, /* 9 */ SDL_SCANCODE_8, /* 10 */ SDL_SCANCODE_9, /* 11 */ SDL_SCANCODE_0, /* 12 */ SDL_SCANCODE_MINUS, /* 13 */ SDL_SCANCODE_EQUALS, /* 14 */ SDL_SCANCODE_BACKSPACE, /* 15 */ SDL_SCANCODE_TAB, /* 16 */ SDL_SCANCODE_Q, /* 17 */ SDL_SCANCODE_W, /* 18 */ SDL_SCANCODE_E, /* 19 */ SDL_SCANCODE_R, /* 20 */ SDL_SCANCODE_T, /* 21 */ SDL_SCANCODE_Y, /* 22 */ SDL_SCANCODE_U, /* 23 */ SDL_SCANCODE_I, /* 24 */ SDL_SCANCODE_O, /* 25 */ SDL_SCANCODE_P, /* 26 */ SDL_SCANCODE_LEFTBRACKET, /* 27 */ SDL_SCANCODE_RIGHTBRACKET, /* 28 */ SDL_SCANCODE_RETURN, /* 29 */ SDL_SCANCODE_LCTRL, /* 30 */ SDL_SCANCODE_A, /* 31 */ SDL_SCANCODE_S, /* 32 */ SDL_SCANCODE_D, /* 33 */ SDL_SCANCODE_F, /* 34 */ SDL_SCANCODE_G, /* 35 */ SDL_SCANCODE_H, /* 36 */ SDL_SCANCODE_J, /* 37 */ SDL_SCANCODE_K, /* 38 */ SDL_SCANCODE_L, /* 39 */ SDL_SCANCODE_SEMICOLON, /* 40 */ SDL_SCANCODE_APOSTROPHE, /* 41 */ SDL_SCANCODE_GRAVE, /* 42 */ SDL_SCANCODE_LSHIFT, /* 43 */ SDL_SCANCODE_BACKSLASH, /* 44 */ SDL_SCANCODE_Z, /* 45 */ SDL_SCANCODE_X, /* 46 */ SDL_SCANCODE_C, /* 47 */ SDL_SCANCODE_V, /* 48 */ SDL_SCANCODE_B, /* 49 */ SDL_SCANCODE_N, /* 50 */ SDL_SCANCODE_M, /* 51 */ SDL_SCANCODE_COMMA, /* 52 */ SDL_SCANCODE_PERIOD, /* 53 */ SDL_SCANCODE_SLASH, /* 54 */ SDL_SCANCODE_RSHIFT, /* 55 */ SDL_SCANCODE_KP_MULTIPLY, /* 56 */ SDL_SCANCODE_LALT, /* 57 */ SDL_SCANCODE_SPACE, /* 58 */ SDL_SCANCODE_CAPSLOCK, /* 59 */ SDL_SCANCODE_F1, /* 60 */ SDL_SCANCODE_F2, /* 61 */ SDL_SCANCODE_F3, /* 62 */ SDL_SCANCODE_F4, /* 63 */ SDL_SCANCODE_F5, /* 64 */ SDL_SCANCODE_F6, /* 65 */ SDL_SCANCODE_F7, /* 66 */ SDL_SCANCODE_F8, /* 67 */ SDL_SCANCODE_F9, /* 68 */ SDL_SCANCODE_F10, /* 69 */ SDL_SCANCODE_NUMLOCKCLEAR, /* 70 */ SDL_SCANCODE_SCROLLLOCK, /* 71 */ SDL_SCANCODE_KP_7, /* 72 */ SDL_SCANCODE_KP_8, /* 73 */ SDL_SCANCODE_KP_9, /* 74 */ SDL_SCANCODE_KP_MINUS, /* 75 */ SDL_SCANCODE_KP_4, /* 76 */ SDL_SCANCODE_KP_5, /* 77 */ SDL_SCANCODE_KP_6, /* 78 */ SDL_SCANCODE_KP_PLUS, /* 79 */ SDL_SCANCODE_KP_1, /* 80 */ SDL_SCANCODE_KP_2, /* 81 */ SDL_SCANCODE_KP_3, /* 82 */ SDL_SCANCODE_KP_0, /* 83 */ SDL_SCANCODE_KP_PERIOD, /* 84 */ SDL_SCANCODE_SYSREQ, /* ???? */ /* 85 */ SDL_SCANCODE_MODE, /* ???? */ /* 86 */ SDL_SCANCODE_NONUSBACKSLASH, /* 87 */ SDL_SCANCODE_F11, /* 88 */ SDL_SCANCODE_F12, /* 89 */ SDL_SCANCODE_INTERNATIONAL1, /* \_ */ /* 90 */ SDL_SCANCODE_UNKNOWN, /* Katakana */ /* 91 */ SDL_SCANCODE_UNKNOWN, /* Hiragana */ /* 92 */ SDL_SCANCODE_INTERNATIONAL4, /* Henkan_Mode */ /* 93 */ SDL_SCANCODE_INTERNATIONAL2, /* Hiragana_Katakana */ /* 94 */ SDL_SCANCODE_INTERNATIONAL5, /* Muhenkan */ /* 95 */ SDL_SCANCODE_UNKNOWN, /* 96 */ SDL_SCANCODE_KP_ENTER, /* 97 */ SDL_SCANCODE_RCTRL, /* 98 */ SDL_SCANCODE_KP_DIVIDE, /* 99 */ SDL_SCANCODE_PRINTSCREEN, /* 100 */ SDL_SCANCODE_RALT, /* ISO_Level3_Shift, ALTGR, RALT */ /* 101 */ SDL_SCANCODE_UNKNOWN, /* Linefeed */ /* 102 */ SDL_SCANCODE_HOME, /* 103 */ SDL_SCANCODE_UP, /* 104 */ SDL_SCANCODE_PAGEUP, /* 105 */ SDL_SCANCODE_LEFT, /* 106 */ SDL_SCANCODE_RIGHT, /* 107 */ SDL_SCANCODE_END, /* 108 */ SDL_SCANCODE_DOWN, /* 109 */ SDL_SCANCODE_PAGEDOWN, /* 110 */ SDL_SCANCODE_INSERT, /* 111 */ SDL_SCANCODE_DELETE, /* 112 */ SDL_SCANCODE_UNKNOWN, /* 113 */ SDL_SCANCODE_MUTE, /* 114 */ SDL_SCANCODE_VOLUMEDOWN, /* 115 */ SDL_SCANCODE_VOLUMEUP, /* 116 */ SDL_SCANCODE_POWER, /* 117 */ SDL_SCANCODE_KP_EQUALS, /* 118 */ SDL_SCANCODE_KP_PLUSMINUS, /* plusminus */ /* 119 */ SDL_SCANCODE_PAUSE, /* 120 */ SDL_SCANCODE_UNKNOWN, /* XF86LaunchA */ /* 121 */ SDL_SCANCODE_KP_COMMA, /* KP_Decimal */ /* 122 */ SDL_SCANCODE_LANG1, /* Hangul */ /* 123 */ SDL_SCANCODE_LANG2, /* Hangul_Hanja */ /* 124 */ SDL_SCANCODE_INTERNATIONAL3, /* Yen */ /* 125 */ SDL_SCANCODE_LGUI, /* 126 */ SDL_SCANCODE_RGUI, /* 127 */ SDL_SCANCODE_APPLICATION, /* 128 */ SDL_SCANCODE_CANCEL, /* 129 */ SDL_SCANCODE_AGAIN, /* 130 */ SDL_SCANCODE_UNKNOWN, /* SunProps */ /* 131 */ SDL_SCANCODE_UNDO, /* 132 */ SDL_SCANCODE_UNKNOWN, /* SunFront */ /* 133 */ SDL_SCANCODE_COPY, /* 134 */ SDL_SCANCODE_UNKNOWN, /* SunOpen */ /* 135 */ SDL_SCANCODE_PASTE, /* 136 */ SDL_SCANCODE_FIND, /* 137 */ SDL_SCANCODE_CUT, /* 138 */ SDL_SCANCODE_HELP, /* 139 */ SDL_SCANCODE_MENU, /* XF86MenuKB */ /* 140 */ SDL_SCANCODE_CALCULATOR, /* 141 */ SDL_SCANCODE_UNKNOWN, /* 142 */ SDL_SCANCODE_SLEEP, /* 143 */ SDL_SCANCODE_UNKNOWN, /* XF86WakeUp */ /* 144 */ SDL_SCANCODE_UNKNOWN, /* XF86Explorer */ /* 145 */ SDL_SCANCODE_UNKNOWN, /* XF86Send */ /* 146 */ SDL_SCANCODE_UNKNOWN, /* 147 */ SDL_SCANCODE_UNKNOWN, /* XF86Xfer */ /* 148 */ SDL_SCANCODE_APP1, /* XF86Launch1 */ /* 149 */ SDL_SCANCODE_APP2, /* XF86Launch2 */ /* 150 */ SDL_SCANCODE_WWW, /* 151 */ SDL_SCANCODE_UNKNOWN, /* XF86DOS */ /* 152 */ SDL_SCANCODE_UNKNOWN, /* XF86ScreenSaver */ /* 153 */ SDL_SCANCODE_UNKNOWN, /* 154 */ SDL_SCANCODE_UNKNOWN, /* XF86RotateWindows */ /* 155 */ SDL_SCANCODE_MAIL, /* 156 */ SDL_SCANCODE_AC_BOOKMARKS, /* XF86Favorites */ /* 157 */ SDL_SCANCODE_COMPUTER, /* 158 */ SDL_SCANCODE_AC_BACK, /* 159 */ SDL_SCANCODE_AC_FORWARD, /* 160 */ SDL_SCANCODE_UNKNOWN, /* 161 */ SDL_SCANCODE_EJECT, /* 162 */ SDL_SCANCODE_EJECT, /* 163 */ SDL_SCANCODE_AUDIONEXT, /* 164 */ SDL_SCANCODE_AUDIOPLAY, /* 165 */ SDL_SCANCODE_AUDIOPREV, /* 166 */ SDL_SCANCODE_AUDIOSTOP, /* 167 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioRecord */ /* 168 */ SDL_SCANCODE_AUDIOREWIND, /* XF86AudioRewind */ /* 169 */ SDL_SCANCODE_UNKNOWN, /* XF86Phone */ /* 170 */ SDL_SCANCODE_UNKNOWN, /* 171 */ SDL_SCANCODE_F13, /* XF86Tools */ /* 172 */ SDL_SCANCODE_AC_HOME, /* 173 */ SDL_SCANCODE_AC_REFRESH, /* 174 */ SDL_SCANCODE_UNKNOWN, /* XF86Close */ /* 175 */ SDL_SCANCODE_UNKNOWN, /* 176 */ SDL_SCANCODE_UNKNOWN, /* 177 */ SDL_SCANCODE_UNKNOWN, /* XF86ScrollUp */ /* 178 */ SDL_SCANCODE_UNKNOWN, /* XF86ScrollDown */ /* 179 */ SDL_SCANCODE_KP_LEFTPAREN, /* parenleft */ /* 180 */ SDL_SCANCODE_KP_RIGHTPAREN, /* parenright */ /* 181 */ SDL_SCANCODE_UNKNOWN, /* XF86New */ /* 182 */ SDL_SCANCODE_AGAIN, /* 183 */ SDL_SCANCODE_F13, /* XF86Tools */ /* 184 */ SDL_SCANCODE_F14, /* XF86Launch5 */ /* 185 */ SDL_SCANCODE_F15, /* XF86Launch6 */ /* 186 */ SDL_SCANCODE_F16, /* XF86Launch7 */ /* 187 */ SDL_SCANCODE_F17, /* XF86Launch8 */ /* 188 */ SDL_SCANCODE_F18, /* XF86Launch9 */ /* 189 */ SDL_SCANCODE_F19, /* null keysym */ /* 190 */ SDL_SCANCODE_F20, /* 191 */ SDL_SCANCODE_UNKNOWN, /* 192 */ SDL_SCANCODE_UNKNOWN, /* XF86TouchpadToggle */ /* 193 */ SDL_SCANCODE_UNKNOWN, /* 194 */ SDL_SCANCODE_UNKNOWN, /* 195 */ SDL_SCANCODE_MODE, /* 196 */ SDL_SCANCODE_UNKNOWN, /* 197 */ SDL_SCANCODE_UNKNOWN, /* 198 */ SDL_SCANCODE_UNKNOWN, /* 199 */ SDL_SCANCODE_UNKNOWN, /* 200 */ SDL_SCANCODE_AUDIOPLAY, /* 201 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioPause */ /* 202 */ SDL_SCANCODE_UNKNOWN, /* XF86Launch3 */ /* 203 */ SDL_SCANCODE_UNKNOWN, /* XF86Launch4 */ /* 204 */ SDL_SCANCODE_UNKNOWN, /* XF86LaunchB */ /* 205 */ SDL_SCANCODE_UNKNOWN, /* XF86Suspend */ /* 206 */ SDL_SCANCODE_UNKNOWN, /* XF86Close */ /* 207 */ SDL_SCANCODE_AUDIOPLAY, /* 208 */ SDL_SCANCODE_AUDIOFASTFORWARD, /* 209 */ SDL_SCANCODE_UNKNOWN, /* 210 */ SDL_SCANCODE_PRINTSCREEN, /* 211 */ SDL_SCANCODE_UNKNOWN, /* 212 */ SDL_SCANCODE_UNKNOWN, /* XF86WebCam */ /* 213 */ SDL_SCANCODE_UNKNOWN, /* 214 */ SDL_SCANCODE_UNKNOWN, /* 215 */ SDL_SCANCODE_MAIL, /* 216 */ SDL_SCANCODE_UNKNOWN, /* 217 */ SDL_SCANCODE_AC_SEARCH, /* 218 */ SDL_SCANCODE_UNKNOWN, /* 219 */ SDL_SCANCODE_UNKNOWN, /* XF86Finance */ /* 220 */ SDL_SCANCODE_UNKNOWN, /* 221 */ SDL_SCANCODE_UNKNOWN, /* XF86Shop */ /* 222 */ SDL_SCANCODE_UNKNOWN, /* 223 */ SDL_SCANCODE_STOP, /* 224 */ SDL_SCANCODE_BRIGHTNESSDOWN, /* 225 */ SDL_SCANCODE_BRIGHTNESSUP, /* 226 */ SDL_SCANCODE_MEDIASELECT, /* 227 */ SDL_SCANCODE_DISPLAYSWITCH, /* 228 */ SDL_SCANCODE_KBDILLUMTOGGLE, /* 229 */ SDL_SCANCODE_KBDILLUMDOWN, /* 230 */ SDL_SCANCODE_KBDILLUMUP, /* 231 */ SDL_SCANCODE_UNKNOWN, /* XF86Send */ /* 232 */ SDL_SCANCODE_UNKNOWN, /* XF86Reply */ /* 233 */ SDL_SCANCODE_UNKNOWN, /* XF86MailForward */ /* 234 */ SDL_SCANCODE_UNKNOWN, /* XF86Save */ /* 235 */ SDL_SCANCODE_UNKNOWN, /* XF86Documents */ /* 236 */ SDL_SCANCODE_UNKNOWN, /* XF86Battery */ /* 237 */ SDL_SCANCODE_UNKNOWN, /* XF86Bluetooth */ /* 238 */ SDL_SCANCODE_UNKNOWN, /* XF86WLAN */ }; /* Xvnc / Xtightvnc scancodes from xmodmap -pk */ static const SDL_Scancode xvnc_scancode_table[] = { /* 0 */ SDL_SCANCODE_LCTRL, /* 1 */ SDL_SCANCODE_RCTRL, /* 2 */ SDL_SCANCODE_LSHIFT, /* 3 */ SDL_SCANCODE_RSHIFT, /* 4 */ SDL_SCANCODE_UNKNOWN, /* Meta_L */ /* 5 */ SDL_SCANCODE_UNKNOWN, /* Meta_R */ /* 6 */ SDL_SCANCODE_LALT, /* 7 */ SDL_SCANCODE_RALT, /* 8 */ SDL_SCANCODE_SPACE, /* 9 */ SDL_SCANCODE_0, /* 10 */ SDL_SCANCODE_1, /* 11 */ SDL_SCANCODE_2, /* 12 */ SDL_SCANCODE_3, /* 13 */ SDL_SCANCODE_4, /* 14 */ SDL_SCANCODE_5, /* 15 */ SDL_SCANCODE_6, /* 16 */ SDL_SCANCODE_7, /* 17 */ SDL_SCANCODE_8, /* 18 */ SDL_SCANCODE_9, /* 19 */ SDL_SCANCODE_MINUS, /* 20 */ SDL_SCANCODE_EQUALS, /* 21 */ SDL_SCANCODE_LEFTBRACKET, /* 22 */ SDL_SCANCODE_RIGHTBRACKET, /* 23 */ SDL_SCANCODE_SEMICOLON, /* 24 */ SDL_SCANCODE_APOSTROPHE, /* 25 */ SDL_SCANCODE_GRAVE, /* 26 */ SDL_SCANCODE_COMMA, /* 27 */ SDL_SCANCODE_PERIOD, /* 28 */ SDL_SCANCODE_SLASH, /* 29 */ SDL_SCANCODE_BACKSLASH, /* 30 */ SDL_SCANCODE_A, /* 31 */ SDL_SCANCODE_B, /* 32 */ SDL_SCANCODE_C, /* 33 */ SDL_SCANCODE_D, /* 34 */ SDL_SCANCODE_E, /* 35 */ SDL_SCANCODE_F, /* 36 */ SDL_SCANCODE_G, /* 37 */ SDL_SCANCODE_H, /* 38 */ SDL_SCANCODE_I, /* 39 */ SDL_SCANCODE_J, /* 40 */ SDL_SCANCODE_K, /* 41 */ SDL_SCANCODE_L, /* 42 */ SDL_SCANCODE_M, /* 43 */ SDL_SCANCODE_N, /* 44 */ SDL_SCANCODE_O, /* 45 */ SDL_SCANCODE_P, /* 46 */ SDL_SCANCODE_Q, /* 47 */ SDL_SCANCODE_R, /* 48 */ SDL_SCANCODE_S, /* 49 */ SDL_SCANCODE_T, /* 50 */ SDL_SCANCODE_U, /* 51 */ SDL_SCANCODE_V, /* 52 */ SDL_SCANCODE_W, /* 53 */ SDL_SCANCODE_X, /* 54 */ SDL_SCANCODE_Y, /* 55 */ SDL_SCANCODE_Z, /* 56 */ SDL_SCANCODE_BACKSPACE, /* 57 */ SDL_SCANCODE_RETURN, /* 58 */ SDL_SCANCODE_TAB, /* 59 */ SDL_SCANCODE_ESCAPE, /* 60 */ SDL_SCANCODE_DELETE, /* 61 */ SDL_SCANCODE_HOME, /* 62 */ SDL_SCANCODE_END, /* 63 */ SDL_SCANCODE_PAGEUP, /* 64 */ SDL_SCANCODE_PAGEDOWN, /* 65 */ SDL_SCANCODE_UP, /* 66 */ SDL_SCANCODE_DOWN, /* 67 */ SDL_SCANCODE_LEFT, /* 68 */ SDL_SCANCODE_RIGHT, /* 69 */ SDL_SCANCODE_F1, /* 70 */ SDL_SCANCODE_F2, /* 71 */ SDL_SCANCODE_F3, /* 72 */ SDL_SCANCODE_F4, /* 73 */ SDL_SCANCODE_F5, /* 74 */ SDL_SCANCODE_F6, /* 75 */ SDL_SCANCODE_F7, /* 76 */ SDL_SCANCODE_F8, /* 77 */ SDL_SCANCODE_F9, /* 78 */ SDL_SCANCODE_F10, /* 79 */ SDL_SCANCODE_F11, /* 80 */ SDL_SCANCODE_F12, }; #endif /* scancodes_xfree86_h_ */ /* *INDENT-ON* */
YifuLiu/AliOS-Things
components/SDL2/src/events/scancodes_xfree86.h
C
apache-2.0
19,980
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* We won't get fseeko64 on QNX if _LARGEFILE64_SOURCE is defined, but the configure script knows the C runtime has it and enables it. */ #ifndef __QNXNTO__ /* Need this so Linux systems define fseek64o, ftell64o and off64_t */ #ifndef _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE #endif #endif #include "../SDL_internal.h" #if defined(__WIN32__) #include "../core/windows/SDL_windows.h" #endif #ifdef HAVE_STDIO_H #include <stdio.h> #endif #ifdef HAVE_LIMITS_H #include <limits.h> #endif /* This file provides a general interface for SDL to read and write data sources. It can easily be extended to files, memory, etc. */ #include "SDL_endian.h" #include "SDL_rwops.h" #ifdef __APPLE__ #include "cocoa/SDL_rwopsbundlesupport.h" #endif /* __APPLE__ */ #ifdef __ANDROID__ #include "../core/android/SDL_android.h" #include "SDL_system.h" #endif #if __NACL__ #ifndef __ALIOS__ #include "nacl_io/nacl_io.h" #endif #endif #ifdef __WIN32__ /* Functions to read/write Win32 API file pointers */ #ifndef INVALID_SET_FILE_POINTER #define INVALID_SET_FILE_POINTER 0xFFFFFFFF #endif #define READAHEAD_BUFFER_SIZE 1024 static int SDLCALL windows_file_open(SDL_RWops * context, const char *filename, const char *mode) { UINT old_error_mode; HANDLE h; DWORD r_right, w_right; DWORD must_exist, truncate; int a_mode; if (!context) return -1; /* failed (invalid call) */ context->hidden.windowsio.h = INVALID_HANDLE_VALUE; /* mark this as unusable */ context->hidden.windowsio.buffer.data = NULL; context->hidden.windowsio.buffer.size = 0; context->hidden.windowsio.buffer.left = 0; /* "r" = reading, file must exist */ /* "w" = writing, truncate existing, file may not exist */ /* "r+"= reading or writing, file must exist */ /* "a" = writing, append file may not exist */ /* "a+"= append + read, file may not exist */ /* "w+" = read, write, truncate. file may not exist */ must_exist = (SDL_strchr(mode, 'r') != NULL) ? OPEN_EXISTING : 0; truncate = (SDL_strchr(mode, 'w') != NULL) ? CREATE_ALWAYS : 0; r_right = (SDL_strchr(mode, '+') != NULL || must_exist) ? GENERIC_READ : 0; a_mode = (SDL_strchr(mode, 'a') != NULL) ? OPEN_ALWAYS : 0; w_right = (a_mode || SDL_strchr(mode, '+') || truncate) ? GENERIC_WRITE : 0; if (!r_right && !w_right) /* inconsistent mode */ return -1; /* failed (invalid call) */ context->hidden.windowsio.buffer.data = (char *) SDL_malloc(READAHEAD_BUFFER_SIZE); if (!context->hidden.windowsio.buffer.data) { return SDL_OutOfMemory(); } /* Do not open a dialog box if failure */ old_error_mode = SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS); { LPTSTR tstr = WIN_UTF8ToString(filename); h = CreateFile(tstr, (w_right | r_right), (w_right) ? 0 : FILE_SHARE_READ, NULL, (must_exist | truncate | a_mode), FILE_ATTRIBUTE_NORMAL, NULL); SDL_free(tstr); } /* restore old behavior */ SetErrorMode(old_error_mode); if (h == INVALID_HANDLE_VALUE) { SDL_free(context->hidden.windowsio.buffer.data); context->hidden.windowsio.buffer.data = NULL; SDL_SetError("Couldn't open %s", filename); return -2; /* failed (CreateFile) */ } context->hidden.windowsio.h = h; context->hidden.windowsio.append = a_mode ? SDL_TRUE : SDL_FALSE; return 0; /* ok */ } static Sint64 SDLCALL windows_file_size(SDL_RWops * context) { LARGE_INTEGER size; if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE) { return SDL_SetError("windows_file_size: invalid context/file not opened"); } if (!GetFileSizeEx(context->hidden.windowsio.h, &size)) { return WIN_SetError("windows_file_size"); } return size.QuadPart; } static Sint64 SDLCALL windows_file_seek(SDL_RWops * context, Sint64 offset, int whence) { DWORD windowswhence; LARGE_INTEGER windowsoffset; if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE) { return SDL_SetError("windows_file_seek: invalid context/file not opened"); } /* FIXME: We may be able to satisfy the seek within buffered data */ if (whence == RW_SEEK_CUR && context->hidden.windowsio.buffer.left) { offset -= (long)context->hidden.windowsio.buffer.left; } context->hidden.windowsio.buffer.left = 0; switch (whence) { case RW_SEEK_SET: windowswhence = FILE_BEGIN; break; case RW_SEEK_CUR: windowswhence = FILE_CURRENT; break; case RW_SEEK_END: windowswhence = FILE_END; break; default: return SDL_SetError("windows_file_seek: Unknown value for 'whence'"); } windowsoffset.QuadPart = offset; if (!SetFilePointerEx(context->hidden.windowsio.h, windowsoffset, &windowsoffset, windowswhence)) { return WIN_SetError("windows_file_seek"); } return windowsoffset.QuadPart; } static size_t SDLCALL windows_file_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum) { size_t total_need; size_t total_read = 0; size_t read_ahead; DWORD byte_read; total_need = size * maxnum; if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE || !total_need) return 0; if (context->hidden.windowsio.buffer.left > 0) { void *data = (char *) context->hidden.windowsio.buffer.data + context->hidden.windowsio.buffer.size - context->hidden.windowsio.buffer.left; read_ahead = SDL_min(total_need, context->hidden.windowsio.buffer.left); SDL_memcpy(ptr, data, read_ahead); context->hidden.windowsio.buffer.left -= read_ahead; if (read_ahead == total_need) { return maxnum; } ptr = (char *) ptr + read_ahead; total_need -= read_ahead; total_read += read_ahead; } if (total_need < READAHEAD_BUFFER_SIZE) { if (!ReadFile (context->hidden.windowsio.h, context->hidden.windowsio.buffer.data, READAHEAD_BUFFER_SIZE, &byte_read, NULL)) { SDL_Error(SDL_EFREAD); return 0; } read_ahead = SDL_min(total_need, (int) byte_read); SDL_memcpy(ptr, context->hidden.windowsio.buffer.data, read_ahead); context->hidden.windowsio.buffer.size = byte_read; context->hidden.windowsio.buffer.left = byte_read - read_ahead; total_read += read_ahead; } else { if (!ReadFile (context->hidden.windowsio.h, ptr, (DWORD)total_need, &byte_read, NULL)) { SDL_Error(SDL_EFREAD); return 0; } total_read += byte_read; } return (total_read / size); } static size_t SDLCALL windows_file_write(SDL_RWops * context, const void *ptr, size_t size, size_t num) { size_t total_bytes; DWORD byte_written; size_t nwritten; total_bytes = size * num; if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE || total_bytes <= 0 || !size) return 0; if (context->hidden.windowsio.buffer.left) { SetFilePointer(context->hidden.windowsio.h, -(LONG)context->hidden.windowsio.buffer.left, NULL, FILE_CURRENT); context->hidden.windowsio.buffer.left = 0; } /* if in append mode, we must go to the EOF before write */ if (context->hidden.windowsio.append) { if (SetFilePointer(context->hidden.windowsio.h, 0L, NULL, FILE_END) == INVALID_SET_FILE_POINTER) { SDL_Error(SDL_EFWRITE); return 0; } } if (!WriteFile (context->hidden.windowsio.h, ptr, (DWORD)total_bytes, &byte_written, NULL)) { SDL_Error(SDL_EFWRITE); return 0; } nwritten = byte_written / size; return nwritten; } static int SDLCALL windows_file_close(SDL_RWops * context) { if (context) { if (context->hidden.windowsio.h != INVALID_HANDLE_VALUE) { CloseHandle(context->hidden.windowsio.h); context->hidden.windowsio.h = INVALID_HANDLE_VALUE; /* to be sure */ } SDL_free(context->hidden.windowsio.buffer.data); context->hidden.windowsio.buffer.data = NULL; SDL_FreeRW(context); } return 0; } #endif /* __WIN32__ */ #ifdef HAVE_STDIO_H #ifdef HAVE_FOPEN64 #define fopen fopen64 #endif #ifdef HAVE_FSEEKO64 #define fseek_off_t off64_t #define fseek fseeko64 #define ftell ftello64 #elif defined(HAVE_FSEEKO) #if defined(OFF_MIN) && defined(OFF_MAX) #define FSEEK_OFF_MIN OFF_MIN #define FSEEK_OFF_MAX OFF_MAX #elif defined(HAVE_LIMITS_H) /* POSIX doesn't specify the minimum and maximum macros for off_t so * we have to improvise and dance around implementation-defined * behavior. This may fail if the off_t type has padding bits or * is not a two's-complement representation. The compilers will detect * and eliminate the dead code if off_t has 64 bits. */ #define FSEEK_OFF_MAX (((((off_t)1 << (sizeof(off_t) * CHAR_BIT - 2)) - 1) << 1) + 1) #define FSEEK_OFF_MIN (-(FSEEK_OFF_MAX) - 1) #endif #define fseek_off_t off_t #define fseek fseeko #define ftell ftello #elif defined(HAVE__FSEEKI64) #define fseek_off_t __int64 #define fseek _fseeki64 #define ftell _ftelli64 #else #ifdef HAVE_LIMITS_H #define FSEEK_OFF_MIN LONG_MIN #define FSEEK_OFF_MAX LONG_MAX #endif #define fseek_off_t long #endif /* Functions to read/write stdio file pointers */ static Sint64 SDLCALL stdio_size(SDL_RWops * context) { Sint64 pos, size; pos = SDL_RWseek(context, 0, RW_SEEK_CUR); if (pos < 0) { return -1; } size = SDL_RWseek(context, 0, RW_SEEK_END); SDL_RWseek(context, pos, RW_SEEK_SET); return size; } static Sint64 SDLCALL stdio_seek(SDL_RWops * context, Sint64 offset, int whence) { int stdiowhence; switch (whence) { case RW_SEEK_SET: stdiowhence = SEEK_SET; break; case RW_SEEK_CUR: stdiowhence = SEEK_CUR; break; case RW_SEEK_END: stdiowhence = SEEK_END; break; default: return SDL_SetError("Unknown value for 'whence'"); } #if defined(FSEEK_OFF_MIN) && defined(FSEEK_OFF_MAX) if (offset < (Sint64)(FSEEK_OFF_MIN) || offset > (Sint64)(FSEEK_OFF_MAX)) { return SDL_SetError("Seek offset out of range"); } #endif if (fseek(context->hidden.stdio.fp, (fseek_off_t)offset, stdiowhence) == 0) { Sint64 pos = ftell(context->hidden.stdio.fp); if (pos < 0) { return SDL_SetError("Couldn't get stream offset"); } return pos; } return SDL_Error(SDL_EFSEEK); } static size_t SDLCALL stdio_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum) { size_t nread; nread = fread(ptr, size, maxnum, context->hidden.stdio.fp); if (nread == 0 && ferror(context->hidden.stdio.fp)) { SDL_Error(SDL_EFREAD); } return nread; } static size_t SDLCALL stdio_write(SDL_RWops * context, const void *ptr, size_t size, size_t num) { size_t nwrote; nwrote = fwrite(ptr, size, num, context->hidden.stdio.fp); if (nwrote == 0 && ferror(context->hidden.stdio.fp)) { SDL_Error(SDL_EFWRITE); } return nwrote; } static int SDLCALL stdio_close(SDL_RWops * context) { int status = 0; if (context) { if (context->hidden.stdio.autoclose) { /* WARNING: Check the return value here! */ if (fclose(context->hidden.stdio.fp) != 0) { status = SDL_Error(SDL_EFWRITE); } } SDL_FreeRW(context); } return status; } #endif /* !HAVE_STDIO_H */ /* Functions to read/write memory pointers */ static Sint64 SDLCALL mem_size(SDL_RWops * context) { return (Sint64)(context->hidden.mem.stop - context->hidden.mem.base); } static Sint64 SDLCALL mem_seek(SDL_RWops * context, Sint64 offset, int whence) { Uint8 *newpos; switch (whence) { case RW_SEEK_SET: newpos = context->hidden.mem.base + offset; break; case RW_SEEK_CUR: newpos = context->hidden.mem.here + offset; break; case RW_SEEK_END: newpos = context->hidden.mem.stop + offset; break; default: return SDL_SetError("Unknown value for 'whence'"); } if (newpos < context->hidden.mem.base) { newpos = context->hidden.mem.base; } if (newpos > context->hidden.mem.stop) { newpos = context->hidden.mem.stop; } context->hidden.mem.here = newpos; return (Sint64)(context->hidden.mem.here - context->hidden.mem.base); } static size_t SDLCALL mem_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum) { size_t total_bytes; size_t mem_available; total_bytes = (maxnum * size); if ((maxnum <= 0) || (size <= 0) || ((total_bytes / maxnum) != size)) { return 0; } mem_available = (context->hidden.mem.stop - context->hidden.mem.here); if (total_bytes > mem_available) { total_bytes = mem_available; } SDL_memcpy(ptr, context->hidden.mem.here, total_bytes); context->hidden.mem.here += total_bytes; return (total_bytes / size); } static size_t SDLCALL mem_write(SDL_RWops * context, const void *ptr, size_t size, size_t num) { if ((context->hidden.mem.here + (num * size)) > context->hidden.mem.stop) { num = (context->hidden.mem.stop - context->hidden.mem.here) / size; } SDL_memcpy(context->hidden.mem.here, ptr, num * size); context->hidden.mem.here += num * size; return num; } static size_t SDLCALL mem_writeconst(SDL_RWops * context, const void *ptr, size_t size, size_t num) { SDL_SetError("Can't write to read-only memory"); return 0; } static int SDLCALL mem_close(SDL_RWops * context) { if (context) { SDL_FreeRW(context); } return 0; } /* Functions to create SDL_RWops structures from various data sources */ SDL_RWops * SDL_RWFromFile(const char *file, const char *mode) { SDL_RWops *rwops = NULL; if (!file || !*file || !mode || !*mode) { SDL_SetError("SDL_RWFromFile(): No file or no mode specified"); return NULL; } #if defined(__ANDROID__) #ifdef HAVE_STDIO_H /* Try to open the file on the filesystem first */ if (*file == '/') { FILE *fp = fopen(file, mode); if (fp) { return SDL_RWFromFP(fp, 1); } } else { /* Try opening it from internal storage if it's a relative path */ char *path; FILE *fp; /* !!! FIXME: why not just "char path[PATH_MAX];" ? */ path = SDL_stack_alloc(char, PATH_MAX); if (path) { SDL_snprintf(path, PATH_MAX, "%s/%s", SDL_AndroidGetInternalStoragePath(), file); fp = fopen(path, mode); SDL_stack_free(path); if (fp) { return SDL_RWFromFP(fp, 1); } } } #endif /* HAVE_STDIO_H */ /* Try to open the file from the asset system */ rwops = SDL_AllocRW(); if (!rwops) return NULL; /* SDL_SetError already setup by SDL_AllocRW() */ if (Android_JNI_FileOpen(rwops, file, mode) < 0) { SDL_FreeRW(rwops); return NULL; } rwops->size = Android_JNI_FileSize; rwops->seek = Android_JNI_FileSeek; rwops->read = Android_JNI_FileRead; rwops->write = Android_JNI_FileWrite; rwops->close = Android_JNI_FileClose; rwops->type = SDL_RWOPS_JNIFILE; #elif defined(__WIN32__) rwops = SDL_AllocRW(); if (!rwops) return NULL; /* SDL_SetError already setup by SDL_AllocRW() */ if (windows_file_open(rwops, file, mode) < 0) { SDL_FreeRW(rwops); return NULL; } rwops->size = windows_file_size; rwops->seek = windows_file_seek; rwops->read = windows_file_read; rwops->write = windows_file_write; rwops->close = windows_file_close; rwops->type = SDL_RWOPS_WINFILE; #elif HAVE_STDIO_H { #ifdef __APPLE__ FILE *fp = SDL_OpenFPFromBundleOrFallback(file, mode); #elif __WINRT__ FILE *fp = NULL; fopen_s(&fp, file, mode); #else FILE *fp = fopen(file, mode); #endif if (fp == NULL) { SDL_SetError("Couldn't open %s", file); } else { rwops = SDL_RWFromFP(fp, SDL_TRUE); if (!rwops) printf("rwops is null xxx\n"); } } #else SDL_SetError("SDL not compiled with stdio support"); #endif /* !HAVE_STDIO_H */ return rwops; } #ifdef HAVE_STDIO_H SDL_RWops * SDL_RWFromFP(FILE * fp, SDL_bool autoclose) { SDL_RWops *rwops = NULL; rwops = SDL_AllocRW(); if (rwops != NULL) { rwops->size = stdio_size; rwops->seek = stdio_seek; rwops->read = stdio_read; rwops->write = stdio_write; rwops->close = stdio_close; rwops->hidden.stdio.fp = fp; rwops->hidden.stdio.autoclose = autoclose; rwops->type = SDL_RWOPS_STDFILE; } return rwops; } #else SDL_RWops * SDL_RWFromFP(void * fp, SDL_bool autoclose) { SDL_SetError("SDL not compiled with stdio support"); return NULL; } #endif /* HAVE_STDIO_H */ SDL_RWops * SDL_RWFromMem(void *mem, int size) { SDL_RWops *rwops = NULL; if (!mem) { SDL_InvalidParamError("mem"); return rwops; } if (!size) { SDL_InvalidParamError("size"); return rwops; } rwops = SDL_AllocRW(); if (rwops != NULL) { rwops->size = mem_size; rwops->seek = mem_seek; rwops->read = mem_read; rwops->write = mem_write; rwops->close = mem_close; rwops->hidden.mem.base = (Uint8 *) mem; rwops->hidden.mem.here = rwops->hidden.mem.base; rwops->hidden.mem.stop = rwops->hidden.mem.base + size; rwops->type = SDL_RWOPS_MEMORY; } return rwops; } SDL_RWops * SDL_RWFromConstMem(const void *mem, int size) { SDL_RWops *rwops = NULL; if (!mem) { SDL_InvalidParamError("mem"); return rwops; } if (!size) { SDL_InvalidParamError("size"); return rwops; } rwops = SDL_AllocRW(); if (rwops != NULL) { rwops->size = mem_size; rwops->seek = mem_seek; rwops->read = mem_read; rwops->write = mem_writeconst; rwops->close = mem_close; rwops->hidden.mem.base = (Uint8 *) mem; rwops->hidden.mem.here = rwops->hidden.mem.base; rwops->hidden.mem.stop = rwops->hidden.mem.base + size; rwops->type = SDL_RWOPS_MEMORY_RO; } return rwops; } SDL_RWops * SDL_AllocRW(void) { SDL_RWops *area; area = (SDL_RWops *) SDL_malloc(sizeof *area); if (area == NULL) { SDL_OutOfMemory(); } else { area->type = SDL_RWOPS_UNKNOWN; } return area; } void SDL_FreeRW(SDL_RWops * area) { SDL_free(area); } /* Load all the data from an SDL data stream */ void * SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize, int freesrc) { const int FILE_CHUNK_SIZE = 1024; Sint64 size; size_t size_read, size_total; void *data = NULL, *newdata; if (!src) { SDL_InvalidParamError("src"); return NULL; } size = SDL_RWsize(src); if (size < 0) { size = FILE_CHUNK_SIZE; } data = SDL_malloc((size_t)(size + 1)); size_total = 0; for (;;) { if ((((Sint64)size_total) + FILE_CHUNK_SIZE) > size) { size = (size_total + FILE_CHUNK_SIZE); newdata = SDL_realloc(data, (size_t)(size + 1)); if (!newdata) { SDL_free(data); data = NULL; SDL_OutOfMemory(); goto done; } data = newdata; } size_read = SDL_RWread(src, (char *)data+size_total, 1, (size_t)(size-size_total)); if (size_read == 0) { break; } size_total += size_read; } if (datasize) { *datasize = size_total; } ((char *)data)[size_total] = '\0'; done: if (freesrc && src) { SDL_RWclose(src); } return data; } void * SDL_LoadFile(const char *file, size_t *datasize) { return SDL_LoadFile_RW(SDL_RWFromFile(file, "rb"), datasize, 1); } Sint64 SDL_RWsize(SDL_RWops *context) { return context->size(context); } Sint64 SDL_RWseek(SDL_RWops *context, Sint64 offset, int whence) { return context->seek(context, offset, whence); } Sint64 SDL_RWtell(SDL_RWops *context) { return context->seek(context, 0, RW_SEEK_CUR); } size_t SDL_RWread(SDL_RWops *context, void *ptr, size_t size, size_t maxnum) { return context->read(context, ptr, size, maxnum); } size_t SDL_RWwrite(SDL_RWops *context, const void *ptr, size_t size, size_t num) { return context->write(context, ptr, size, num); } int SDL_RWclose(SDL_RWops *context) { return context->close(context); } /* Functions for dynamically reading and writing endian-specific values */ Uint8 SDL_ReadU8(SDL_RWops * src) { Uint8 value = 0; SDL_RWread(src, &value, sizeof (value), 1); return value; } Uint16 SDL_ReadLE16(SDL_RWops * src) { Uint16 value = 0; SDL_RWread(src, &value, sizeof (value), 1); return SDL_SwapLE16(value); } Uint16 SDL_ReadBE16(SDL_RWops * src) { Uint16 value = 0; SDL_RWread(src, &value, sizeof (value), 1); return SDL_SwapBE16(value); } Uint32 SDL_ReadLE32(SDL_RWops * src) { Uint32 value = 0; SDL_RWread(src, &value, sizeof (value), 1); return SDL_SwapLE32(value); } Uint32 SDL_ReadBE32(SDL_RWops * src) { Uint32 value = 0; SDL_RWread(src, &value, sizeof (value), 1); return SDL_SwapBE32(value); } Uint64 SDL_ReadLE64(SDL_RWops * src) { Uint64 value = 0; SDL_RWread(src, &value, sizeof (value), 1); return SDL_SwapLE64(value); } Uint64 SDL_ReadBE64(SDL_RWops * src) { Uint64 value = 0; SDL_RWread(src, &value, sizeof (value), 1); return SDL_SwapBE64(value); } size_t SDL_WriteU8(SDL_RWops * dst, Uint8 value) { return SDL_RWwrite(dst, &value, sizeof (value), 1); } size_t SDL_WriteLE16(SDL_RWops * dst, Uint16 value) { const Uint16 swapped = SDL_SwapLE16(value); return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1); } size_t SDL_WriteBE16(SDL_RWops * dst, Uint16 value) { const Uint16 swapped = SDL_SwapBE16(value); return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1); } size_t SDL_WriteLE32(SDL_RWops * dst, Uint32 value) { const Uint32 swapped = SDL_SwapLE32(value); return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1); } size_t SDL_WriteBE32(SDL_RWops * dst, Uint32 value) { const Uint32 swapped = SDL_SwapBE32(value); return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1); } size_t SDL_WriteLE64(SDL_RWops * dst, Uint64 value) { const Uint64 swapped = SDL_SwapLE64(value); return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1); } size_t SDL_WriteBE64(SDL_RWops * dst, Uint64 value) { const Uint64 swapped = SDL_SwapBE64(value); return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1); } /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/file/SDL_rwops.c
C
apache-2.0
24,435
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifdef __APPLE__ #include <stdio.h> #ifndef SDL_rwopsbundlesupport_h #define SDL_rwopsbundlesupport_h FILE* SDL_OpenFPFromBundleOrFallback(const char *file, const char *mode); #endif #endif
YifuLiu/AliOS-Things
components/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.h
C
apache-2.0
1,132
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifdef __APPLE__ #import <Foundation/Foundation.h> #include "SDL_rwopsbundlesupport.h" /* For proper OS X applications, the resources are contained inside the application bundle. So the strategy is to first check the application bundle for the file, then fallback to the current working directory. Note: One additional corner-case is if the resource is in a framework's resource bundle instead of the app. We might want to use bundle identifiers, e.g. org.libsdl.sdl to get the bundle for the framework, but we would somehow need to know what the bundle identifiers we need to search are. Also, note the bundle layouts are different for iPhone and Mac. */ FILE* SDL_OpenFPFromBundleOrFallback(const char *file, const char *mode) { @autoreleasepool { FILE* fp = NULL; /* If the file mode is writable, skip all the bundle stuff because generally the bundle is read-only. */ if(strcmp("r", mode) && strcmp("rb", mode)) { return fopen(file, mode); } NSFileManager* file_manager = [NSFileManager defaultManager]; NSString* resource_path = [[NSBundle mainBundle] resourcePath]; NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)]; NSString* full_path_with_file_to_try = [resource_path stringByAppendingPathComponent:ns_string_file_component]; if([file_manager fileExistsAtPath:full_path_with_file_to_try]) { fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode); } else { fp = fopen(file, mode); } return fp; }} #endif /* __APPLE__ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.m
Objective-C
apache-2.0
2,600
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifdef SDL_FILESYSTEM_ANDROID /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* System dependent filesystem routines */ #include <unistd.h> #include "SDL_error.h" #include "SDL_filesystem.h" #include "SDL_system.h" char * SDL_GetBasePath(void) { /* The current working directory is / on Android */ SDL_Unsupported(); return NULL; } char * SDL_GetPrefPath(const char *org, const char *app) { const char *path = SDL_AndroidGetInternalStoragePath(); if (path) { size_t pathlen = SDL_strlen(path)+2; char *fullpath = (char *)SDL_malloc(pathlen); if (!fullpath) { SDL_OutOfMemory(); return NULL; } SDL_snprintf(fullpath, pathlen, "%s/", path); return fullpath; } return NULL; } #endif /* SDL_FILESYSTEM_ANDROID */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/filesystem/android/SDL_sysfilesystem.c
C
apache-2.0
1,882
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifdef SDL_FILESYSTEM_COCOA /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* System dependent filesystem routines */ #include <Foundation/Foundation.h> #include <sys/stat.h> #include <sys/types.h> #include "SDL_error.h" #include "SDL_stdinc.h" #include "SDL_filesystem.h" char * SDL_GetBasePath(void) { @autoreleasepool { NSBundle *bundle = [NSBundle mainBundle]; const char* baseType = [[[bundle infoDictionary] objectForKey:@"SDL_FILESYSTEM_BASE_DIR_TYPE"] UTF8String]; const char *base = NULL; char *retval = NULL; if (baseType == NULL) { baseType = "resource"; } if (SDL_strcasecmp(baseType, "bundle")==0) { base = [[bundle bundlePath] fileSystemRepresentation]; } else if (SDL_strcasecmp(baseType, "parent")==0) { base = [[[bundle bundlePath] stringByDeletingLastPathComponent] fileSystemRepresentation]; } else { /* this returns the exedir for non-bundled and the resourceDir for bundled apps */ base = [[bundle resourcePath] fileSystemRepresentation]; } if (base) { const size_t len = SDL_strlen(base) + 2; retval = (char *) SDL_malloc(len); if (retval == NULL) { SDL_OutOfMemory(); } else { SDL_snprintf(retval, len, "%s/", base); } } return retval; }} char * SDL_GetPrefPath(const char *org, const char *app) { @autoreleasepool { if (!app) { SDL_InvalidParamError("app"); return NULL; } if (!org) { org = ""; } char *retval = NULL; #if !TARGET_OS_TV NSArray *array = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); #else /* tvOS does not have persistent local storage! * The only place on-device where we can store data is * a cache directory that the OS can empty at any time. * * It's therefore very likely that save data will be erased * between sessions. If you want your app's save data to * actually stick around, you'll need to use iCloud storage. */ static SDL_bool shown = SDL_FALSE; if (!shown) { shown = SDL_TRUE; SDL_LogCritical(SDL_LOG_CATEGORY_SYSTEM, "tvOS does not have persistent local storage! Use iCloud storage if you want your data to persist between sessions.\n"); } NSArray *array = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); #endif /* !TARGET_OS_TV */ if ([array count] > 0) { /* we only want the first item in the list. */ NSString *str = [array objectAtIndex:0]; const char *base = [str fileSystemRepresentation]; if (base) { const size_t len = SDL_strlen(base) + SDL_strlen(org) + SDL_strlen(app) + 4; retval = (char *) SDL_malloc(len); if (retval == NULL) { SDL_OutOfMemory(); } else { char *ptr; if (*org) { SDL_snprintf(retval, len, "%s/%s/%s/", base, org, app); } else { SDL_snprintf(retval, len, "%s/%s/", base, app); } for (ptr = retval+1; *ptr; ptr++) { if (*ptr == '/') { *ptr = '\0'; mkdir(retval, 0700); *ptr = '/'; } } mkdir(retval, 0700); } } } return retval; }} #endif /* SDL_FILESYSTEM_COCOA */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/filesystem/cocoa/SDL_sysfilesystem.m
Objective-C
apache-2.0
4,570
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #if defined(SDL_FILESYSTEM_DUMMY) || defined(SDL_FILESYSTEM_DISABLED) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* System dependent filesystem routines */ #include "SDL_error.h" #include "SDL_filesystem.h" char * SDL_GetBasePath(void) { SDL_Unsupported(); return NULL; } char * SDL_GetPrefPath(const char *org, const char *app) { SDL_Unsupported(); return NULL; } #endif /* SDL_FILESYSTEM_DUMMY || SDL_FILESYSTEM_DISABLED */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/filesystem/dummy/SDL_sysfilesystem.c
C
apache-2.0
1,517
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifdef SDL_FILESYSTEM_EMSCRIPTEN /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* System dependent filesystem routines */ #include <errno.h> #include <sys/stat.h> #include "SDL_error.h" #include "SDL_filesystem.h" #include <emscripten/emscripten.h> char * SDL_GetBasePath(void) { char *retval = "/"; return SDL_strdup(retval); } char * SDL_GetPrefPath(const char *org, const char *app) { const char *append = "/libsdl/"; char *retval; size_t len = 0; if (!app) { SDL_InvalidParamError("app"); return NULL; } if (!org) { org = ""; } len = SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3; retval = (char *) SDL_malloc(len); if (!retval) { SDL_OutOfMemory(); return NULL; } if (*org) { SDL_snprintf(retval, len, "%s%s/%s/", append, org, app); } else { SDL_snprintf(retval, len, "%s%s/", append, app); } if (mkdir(retval, 0700) != 0 && errno != EEXIST) { SDL_SetError("Couldn't create directory '%s': '%s'", retval, strerror(errno)); SDL_free(retval); return NULL; } return retval; } #endif /* SDL_FILESYSTEM_EMSCRIPTEN */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/filesystem/emscripten/SDL_sysfilesystem.c
C
apache-2.0
2,264
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifdef SDL_FILESYSTEM_HAIKU /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* System dependent filesystem routines */ #include <kernel/image.h> #include <storage/Directory.h> #include <storage/Entry.h> #include <storage/Path.h> #include "SDL_error.h" #include "SDL_stdinc.h" #include "SDL_assert.h" #include "SDL_filesystem.h" char * SDL_GetBasePath(void) { image_info info; int32 cookie = 0; while (get_next_image_info(0, &cookie, &info) == B_OK) { if (info.type == B_APP_IMAGE) { break; } } BEntry entry(info.name, true); BPath path; status_t rc = entry.GetPath(&path); /* (path) now has binary's path. */ SDL_assert(rc == B_OK); rc = path.GetParent(&path); /* chop filename, keep directory. */ SDL_assert(rc == B_OK); const char *str = path.Path(); SDL_assert(str != NULL); const size_t len = SDL_strlen(str); char *retval = (char *) SDL_malloc(len + 2); if (!retval) { SDL_OutOfMemory(); return NULL; } SDL_memcpy(retval, str, len); retval[len] = '/'; retval[len+1] = '\0'; return retval; } char * SDL_GetPrefPath(const char *org, const char *app) { // !!! FIXME: is there a better way to do this? const char *home = SDL_getenv("HOME"); const char *append = "/config/settings/"; size_t len = SDL_strlen(home); if (!app) { SDL_InvalidParamError("app"); return NULL; } if (!org) { org = ""; } if (!len || (home[len - 1] == '/')) { ++append; // home empty or ends with separator, skip the one from append } len += SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3; char *retval = (char *) SDL_malloc(len); if (!retval) { SDL_OutOfMemory(); } else { if (*org) { SDL_snprintf(retval, len, "%s%s%s/%s/", home, append, org, app); } else { SDL_snprintf(retval, len, "%s%s%s/", home, append, app); } create_directory(retval, 0700); // Haiku api: creates missing dirs } return retval; } #endif /* SDL_FILESYSTEM_HAIKU */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/filesystem/haiku/SDL_sysfilesystem.cc
C++
apache-2.0
3,190
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #include "SDL_error.h" #include "SDL_filesystem.h" #ifdef SDL_FILESYSTEM_NACL char * SDL_GetBasePath(void) { SDL_Unsupported(); return NULL; } char * SDL_GetPrefPath(const char *org, const char *app) { SDL_Unsupported(); return NULL; } #endif /* SDL_FILESYSTEM_NACL */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/filesystem/nacl/SDL_sysfilesystem.c
C
apache-2.0
1,296
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifdef SDL_FILESYSTEM_UNIX /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* System dependent filesystem routines */ #include <errno.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> #include <limits.h> #include <fcntl.h> #if defined(__FREEBSD__) || defined(__OPENBSD__) #include <sys/sysctl.h> #endif #include "SDL_error.h" #include "SDL_stdinc.h" #include "SDL_filesystem.h" #include "SDL_rwops.h" /* QNX's /proc/self/exefile is a text file and not a symlink. */ #if !defined(__QNXNTO__) static char * readSymLink(const char *path) { char *retval = NULL; ssize_t len = 64; ssize_t rc = -1; while (1) { char *ptr = (char *) SDL_realloc(retval, (size_t) len); if (ptr == NULL) { SDL_OutOfMemory(); break; } retval = ptr; rc = readlink(path, retval, len); if (rc == -1) { break; /* not a symlink, i/o error, etc. */ } else if (rc < len) { retval[rc] = '\0'; /* readlink doesn't null-terminate. */ return retval; /* we're good to go. */ } len *= 2; /* grow buffer, try again. */ } SDL_free(retval); return NULL; } #endif char * SDL_GetBasePath(void) { char *retval = NULL; #if defined(__FREEBSD__) char fullpath[PATH_MAX]; size_t buflen = sizeof (fullpath); const int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; if (sysctl(mib, SDL_arraysize(mib), fullpath, &buflen, NULL, 0) != -1) { retval = SDL_strdup(fullpath); if (!retval) { SDL_OutOfMemory(); return NULL; } } #endif #if defined(__OPENBSD__) char **retvalargs; size_t len; const int mib[] = { CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_ARGV }; if (sysctl(mib, 4, NULL, &len, NULL, 0) != -1) { retvalargs = SDL_malloc(len); if (!retvalargs) { SDL_OutOfMemory(); return NULL; } sysctl(mib, 4, retvalargs, &len, NULL, 0); retval = SDL_malloc(PATH_MAX + 1); if (retval) realpath(retvalargs[0], retval); SDL_free(retvalargs); } #endif #if defined(__SOLARIS__) const char *path = getexecname(); if ((path != NULL) && (path[0] == '/')) { /* must be absolute path... */ retval = SDL_strdup(path); if (!retval) { SDL_OutOfMemory(); return NULL; } } #endif /* is a Linux-style /proc filesystem available? */ if (!retval && (access("/proc", F_OK) == 0)) { /* !!! FIXME: after 2.0.6 ships, let's delete this code and just use the /proc/%llu version. There's no reason to have two copies of this plus all the #ifdefs. --ryan. */ #if defined(__FREEBSD__) retval = readSymLink("/proc/curproc/file"); #elif defined(__NETBSD__) retval = readSymLink("/proc/curproc/exe"); #elif defined(__QNXNTO__) retval = SDL_LoadFile("/proc/self/exefile", NULL); #else retval = readSymLink("/proc/self/exe"); /* linux. */ if (retval == NULL) { /* older kernels don't have /proc/self ... try PID version... */ char path[64]; const int rc = SDL_snprintf(path, sizeof(path), "/proc/%llu/exe", (unsigned long long) getpid()); if ( (rc > 0) && (rc < sizeof(path)) ) { retval = readSymLink(path); } } #endif } /* If we had access to argv[0] here, we could check it for a path, or troll through $PATH looking for it, too. */ if (retval != NULL) { /* chop off filename. */ char *ptr = SDL_strrchr(retval, '/'); if (ptr != NULL) { *(ptr+1) = '\0'; } else { /* shouldn't happen, but just in case... */ SDL_free(retval); retval = NULL; } } if (retval != NULL) { /* try to shrink buffer... */ char *ptr = (char *) SDL_realloc(retval, strlen(retval) + 1); if (ptr != NULL) retval = ptr; /* oh well if it failed. */ } return retval; } char * SDL_GetPrefPath(const char *org, const char *app) { /* * We use XDG's base directory spec, even if you're not on Linux. * This isn't strictly correct, but the results are relatively sane * in any case. * * http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html */ const char *envr = SDL_getenv("XDG_DATA_HOME"); const char *append; char *retval = NULL; char *ptr = NULL; size_t len = 0; if (!app) { SDL_InvalidParamError("app"); return NULL; } if (!org) { org = ""; } if (!envr) { /* You end up with "$HOME/.local/share/Game Name 2" */ envr = SDL_getenv("HOME"); if (!envr) { /* we could take heroic measures with /etc/passwd, but oh well. */ SDL_SetError("neither XDG_DATA_HOME nor HOME environment is set"); return NULL; } append = "/.local/share/"; } else { append = "/"; } len = SDL_strlen(envr); if (envr[len - 1] == '/') append += 1; len += SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3; retval = (char *) SDL_malloc(len); if (!retval) { SDL_OutOfMemory(); return NULL; } if (*org) { SDL_snprintf(retval, len, "%s%s%s/%s/", envr, append, org, app); } else { SDL_snprintf(retval, len, "%s%s%s/", envr, append, app); } for (ptr = retval+1; *ptr; ptr++) { if (*ptr == '/') { *ptr = '\0'; if (mkdir(retval, 0700) != 0 && errno != EEXIST) goto error; *ptr = '/'; } } if (mkdir(retval, 0700) != 0 && errno != EEXIST) { error: SDL_SetError("Couldn't create directory '%s': '%s'", retval, strerror(errno)); SDL_free(retval); return NULL; } return retval; } #endif /* SDL_FILESYSTEM_UNIX */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/filesystem/unix/SDL_sysfilesystem.c
C
apache-2.0
7,245
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifdef SDL_FILESYSTEM_WINDOWS /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* System dependent filesystem routines */ #include "../../core/windows/SDL_windows.h" #include <shlobj.h> #include "SDL_assert.h" #include "SDL_error.h" #include "SDL_stdinc.h" #include "SDL_filesystem.h" char * SDL_GetBasePath(void) { typedef DWORD (WINAPI *GetModuleFileNameExW_t)(HANDLE, HMODULE, LPWSTR, DWORD); GetModuleFileNameExW_t pGetModuleFileNameExW; DWORD buflen = 128; WCHAR *path = NULL; HANDLE psapi = LoadLibrary(L"psapi.dll"); char *retval = NULL; DWORD len = 0; int i; if (!psapi) { WIN_SetError("Couldn't load psapi.dll"); return NULL; } pGetModuleFileNameExW = (GetModuleFileNameExW_t)GetProcAddress(psapi, "GetModuleFileNameExW"); if (!pGetModuleFileNameExW) { WIN_SetError("Couldn't find GetModuleFileNameExW"); FreeLibrary(psapi); return NULL; } while (SDL_TRUE) { void *ptr = SDL_realloc(path, buflen * sizeof (WCHAR)); if (!ptr) { SDL_free(path); FreeLibrary(psapi); SDL_OutOfMemory(); return NULL; } path = (WCHAR *) ptr; len = pGetModuleFileNameExW(GetCurrentProcess(), NULL, path, buflen); if (len != buflen) { break; } /* buffer too small? Try again. */ buflen *= 2; } FreeLibrary(psapi); if (len == 0) { SDL_free(path); WIN_SetError("Couldn't locate our .exe"); return NULL; } for (i = len-1; i > 0; i--) { if (path[i] == '\\') { break; } } SDL_assert(i > 0); /* Should have been an absolute path. */ path[i+1] = '\0'; /* chop off filename. */ retval = WIN_StringToUTF8(path); SDL_free(path); return retval; } char * SDL_GetPrefPath(const char *org, const char *app) { /* * Vista and later has a new API for this, but SHGetFolderPath works there, * and apparently just wraps the new API. This is the new way to do it: * * SHGetKnownFolderPath(FOLDERID_RoamingAppData, KF_FLAG_CREATE, * NULL, &wszPath); */ WCHAR path[MAX_PATH]; char *retval = NULL; WCHAR* worg = NULL; WCHAR* wapp = NULL; size_t new_wpath_len = 0; BOOL api_result = FALSE; if (!app) { SDL_InvalidParamError("app"); return NULL; } if (!org) { org = ""; } if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, path))) { WIN_SetError("Couldn't locate our prefpath"); return NULL; } worg = WIN_UTF8ToString(org); if (worg == NULL) { SDL_OutOfMemory(); return NULL; } wapp = WIN_UTF8ToString(app); if (wapp == NULL) { SDL_free(worg); SDL_OutOfMemory(); return NULL; } new_wpath_len = lstrlenW(worg) + lstrlenW(wapp) + lstrlenW(path) + 3; if ((new_wpath_len + 1) > MAX_PATH) { SDL_free(worg); SDL_free(wapp); WIN_SetError("Path too long."); return NULL; } if (*worg) { lstrcatW(path, L"\\"); lstrcatW(path, worg); } SDL_free(worg); api_result = CreateDirectoryW(path, NULL); if (api_result == FALSE) { if (GetLastError() != ERROR_ALREADY_EXISTS) { SDL_free(wapp); WIN_SetError("Couldn't create a prefpath."); return NULL; } } lstrcatW(path, L"\\"); lstrcatW(path, wapp); SDL_free(wapp); api_result = CreateDirectoryW(path, NULL); if (api_result == FALSE) { if (GetLastError() != ERROR_ALREADY_EXISTS) { WIN_SetError("Couldn't create a prefpath."); return NULL; } } lstrcatW(path, L"\\"); retval = WIN_StringToUTF8(path); return retval; } #endif /* SDL_FILESYSTEM_WINDOWS */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/filesystem/windows/SDL_sysfilesystem.c
C
apache-2.0
5,022
/* Simple DirectMedia Layer Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" /* TODO, WinRT: remove the need to compile this with C++/CX (/ZW) extensions, and if possible, without C++ at all */ #ifdef __WINRT__ extern "C" { #include "SDL_filesystem.h" #include "SDL_error.h" #include "SDL_hints.h" #include "SDL_stdinc.h" #include "SDL_system.h" #include "../../core/windows/SDL_windows.h" } #include <string> #include <unordered_map> using namespace std; using namespace Windows::Storage; extern "C" const wchar_t * SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType) { switch (pathType) { case SDL_WINRT_PATH_INSTALLED_LOCATION: { static wstring path; if (path.empty()) { path = Windows::ApplicationModel::Package::Current->InstalledLocation->Path->Data(); } return path.c_str(); } case SDL_WINRT_PATH_LOCAL_FOLDER: { static wstring path; if (path.empty()) { path = ApplicationData::Current->LocalFolder->Path->Data(); } return path.c_str(); } #if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION > NTDDI_WIN8) case SDL_WINRT_PATH_ROAMING_FOLDER: { static wstring path; if (path.empty()) { path = ApplicationData::Current->RoamingFolder->Path->Data(); } return path.c_str(); } case SDL_WINRT_PATH_TEMP_FOLDER: { static wstring path; if (path.empty()) { path = ApplicationData::Current->TemporaryFolder->Path->Data(); } return path.c_str(); } #endif default: break; } SDL_Unsupported(); return NULL; } extern "C" const char * SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType) { typedef unordered_map<SDL_WinRT_Path, string> UTF8PathMap; static UTF8PathMap utf8Paths; UTF8PathMap::iterator searchResult = utf8Paths.find(pathType); if (searchResult != utf8Paths.end()) { return searchResult->second.c_str(); } const wchar_t * ucs2Path = SDL_WinRTGetFSPathUNICODE(pathType); if (!ucs2Path) { return NULL; } char * utf8Path = WIN_StringToUTF8(ucs2Path); utf8Paths[pathType] = utf8Path; SDL_free(utf8Path); return utf8Paths[pathType].c_str(); } extern "C" char * SDL_GetBasePath(void) { const char * srcPath = SDL_WinRTGetFSPathUTF8(SDL_WINRT_PATH_INSTALLED_LOCATION); size_t destPathLen; char * destPath = NULL; if (!srcPath) { SDL_SetError("Couldn't locate our basepath: %s", SDL_GetError()); return NULL; } destPathLen = SDL_strlen(srcPath) + 2; destPath = (char *) SDL_malloc(destPathLen); if (!destPath) { SDL_OutOfMemory(); return NULL; } SDL_snprintf(destPath, destPathLen, "%s\\", srcPath); return destPath; } extern "C" char * SDL_GetPrefPath(const char *org, const char *app) { /* WinRT note: The 'SHGetFolderPath' API that is used in Windows 7 and * earlier is not available on WinRT or Windows Phone. WinRT provides * a similar API, but SHGetFolderPath can't be called, at least not * without violating Microsoft's app-store requirements. */ const WCHAR * srcPath = NULL; WCHAR path[MAX_PATH]; char *retval = NULL; WCHAR* worg = NULL; WCHAR* wapp = NULL; size_t new_wpath_len = 0; BOOL api_result = FALSE; if (!app) { SDL_InvalidParamError("app"); return NULL; } if (!org) { org = ""; } srcPath = SDL_WinRTGetFSPathUNICODE(SDL_WINRT_PATH_LOCAL_FOLDER); if ( ! srcPath) { SDL_SetError("Unable to find a source path"); return NULL; } if (SDL_wcslen(srcPath) >= MAX_PATH) { SDL_SetError("Path too long."); return NULL; } SDL_wcslcpy(path, srcPath, SDL_arraysize(path)); worg = WIN_UTF8ToString(org); if (worg == NULL) { SDL_OutOfMemory(); return NULL; } wapp = WIN_UTF8ToString(app); if (wapp == NULL) { SDL_free(worg); SDL_OutOfMemory(); return NULL; } new_wpath_len = SDL_wcslen(worg) + SDL_wcslen(wapp) + SDL_wcslen(path) + 3; if ((new_wpath_len + 1) > MAX_PATH) { SDL_free(worg); SDL_free(wapp); SDL_SetError("Path too long."); return NULL; } if (*worg) { SDL_wcslcat(path, L"\\", new_wpath_len + 1); SDL_wcslcat(path, worg, new_wpath_len + 1); SDL_free(worg); } api_result = CreateDirectoryW(path, NULL); if (api_result == FALSE) { if (GetLastError() != ERROR_ALREADY_EXISTS) { SDL_free(wapp); WIN_SetError("Couldn't create a prefpath."); return NULL; } } SDL_wcslcat(path, L"\\", new_wpath_len + 1); SDL_wcslcat(path, wapp, new_wpath_len + 1); SDL_free(wapp); api_result = CreateDirectoryW(path, NULL); if (api_result == FALSE) { if (GetLastError() != ERROR_ALREADY_EXISTS) { WIN_SetError("Couldn't create a prefpath."); return NULL; } } SDL_wcslcat(path, L"\\", new_wpath_len + 1); retval = WIN_StringToUTF8(path); return retval; } #endif /* __WINRT__ */ /* vi: set ts=4 sw=4 expandtab: */
YifuLiu/AliOS-Things
components/SDL2/src/filesystem/winrt/SDL_sysfilesystem.cpp
C++
apache-2.0
6,299
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>SDL_gfx: I:/Sources/sdlgfx/README File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SDL_gfx &#160;<span id="projectnumber">2.0.25</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.8.0 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="headertitle"> <div class="title">I:/Sources/sdlgfx/README File Reference</div> </div> </div><!--header--> <div class="contents"> <p><a href="_r_e_a_d_m_e_source.html">Go to the source code of this file.</a></p> </div><!-- contents --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.0 </small></address> </body> </html>
YifuLiu/AliOS-Things
components/SDL2/src/gfx/Docs/html/_r_e_a_d_m_e.html
HTML
apache-2.0
1,873
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>SDL_gfx: I:/Sources/sdlgfx/README Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SDL_gfx &#160;<span id="projectnumber">2.0.25</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.8.0 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="headertitle"> <div class="title">I:/Sources/sdlgfx/README</div> </div> </div><!--header--> <div class="contents"> <a href="_r_e_a_d_m_e.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 </pre></div></div><!-- contents --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.0 </small></address> </body> </html>
YifuLiu/AliOS-Things
components/SDL2/src/gfx/Docs/html/_r_e_a_d_m_e_source.html
HTML
apache-2.0
1,925
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>SDL_gfx: I:/Sources/sdlgfx/SDL_framerate.c File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SDL_gfx &#160;<span id="projectnumber">2.0.25</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.8.0 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">I:/Sources/sdlgfx/SDL_framerate.c File Reference</div> </div> </div><!--header--> <div class="contents"> <div class="textblock"><code>#include &quot;<a class="el" href="_s_d_l__framerate_8h_source.html">SDL_framerate.h</a>&quot;</code><br/> </div> <p><a href="_s_d_l__framerate_8c_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:a3bed31ab61648f7d69c8f47c90161cfe"><td class="memItemLeft" align="right" valign="top">Uint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__framerate_8c.html#a3bed31ab61648f7d69c8f47c90161cfe">_getTicks</a> ()</td></tr> <tr class="memdesc:a3bed31ab61648f7d69c8f47c90161cfe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal wrapper to SDL_GetTicks that ensures a non-zero return value. <a href="#a3bed31ab61648f7d69c8f47c90161cfe"></a><br/></td></tr> <tr class="memitem:a444ebaaaa6b1ceeafa921562bdab1a44"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__framerate_8c.html#a444ebaaaa6b1ceeafa921562bdab1a44">SDL_initFramerate</a> (<a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *manager)</td></tr> <tr class="memdesc:a444ebaaaa6b1ceeafa921562bdab1a44"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the framerate manager. <a href="#a444ebaaaa6b1ceeafa921562bdab1a44"></a><br/></td></tr> <tr class="memitem:afad4b503cf9719daced45fa4d9653d72"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__framerate_8c.html#afad4b503cf9719daced45fa4d9653d72">SDL_setFramerate</a> (<a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *manager, Uint32 rate)</td></tr> <tr class="memdesc:afad4b503cf9719daced45fa4d9653d72"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the framerate in Hz. <a href="#afad4b503cf9719daced45fa4d9653d72"></a><br/></td></tr> <tr class="memitem:a575bb511d6f817ad846a788cbd08ae91"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__framerate_8c.html#a575bb511d6f817ad846a788cbd08ae91">SDL_getFramerate</a> (<a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *manager)</td></tr> <tr class="memdesc:a575bb511d6f817ad846a788cbd08ae91"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the current target framerate in Hz. <a href="#a575bb511d6f817ad846a788cbd08ae91"></a><br/></td></tr> <tr class="memitem:a96b13e26f8436222e866904a592a6eec"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__framerate_8c.html#a96b13e26f8436222e866904a592a6eec">SDL_getFramecount</a> (<a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *manager)</td></tr> <tr class="memdesc:a96b13e26f8436222e866904a592a6eec"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the current framecount. <a href="#a96b13e26f8436222e866904a592a6eec"></a><br/></td></tr> <tr class="memitem:afce13fa3dd37130deb4975d8b230c3ba"><td class="memItemLeft" align="right" valign="top">Uint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__framerate_8c.html#afce13fa3dd37130deb4975d8b230c3ba">SDL_framerateDelay</a> (<a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *manager)</td></tr> <tr class="memdesc:afce13fa3dd37130deb4975d8b230c3ba"><td class="mdescLeft">&#160;</td><td class="mdescRight">Delay execution to maintain a constant framerate and calculate fps. <a href="#afce13fa3dd37130deb4975d8b230c3ba"></a><br/></td></tr> </table> <hr/><h2>Function Documentation</h2> <a class="anchor" id="a3bed31ab61648f7d69c8f47c90161cfe"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">Uint32 <a class="el" href="_s_d_l__framerate_8c.html#a3bed31ab61648f7d69c8f47c90161cfe">_getTicks</a> </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal wrapper to SDL_GetTicks that ensures a non-zero return value. </p> <dl class="section return"><dt>Returns:</dt><dd>The tick count. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__framerate_8c_source.html#l00037">37</a> of file <a class="el" href="_s_d_l__framerate_8c_source.html">SDL_framerate.c</a>.</p> </div> </div> <a class="anchor" id="afce13fa3dd37130deb4975d8b230c3ba"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">Uint32 <a class="el" href="_s_d_l__framerate_8h.html#a2c452933d7376dbb0083304b760ed63b">SDL_framerateDelay</a> </td> <td>(</td> <td class="paramtype"><a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *&#160;</td> <td class="paramname"><em>manager</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Delay execution to maintain a constant framerate and calculate fps. </p> <p>Generate a delay to accomodate currently set framerate. Call once in the graphics/rendering loop. If the computer cannot keep up with the rate (i.e. drawing too slow), the delay is zero and the delay interpolation is reset.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">manager</td><td>Pointer to the framerate manager.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>The time that passed since the last call to the function in ms. May return 0. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__framerate_8c_source.html#l00146">146</a> of file <a class="el" href="_s_d_l__framerate_8c_source.html">SDL_framerate.c</a>.</p> </div> </div> <a class="anchor" id="a96b13e26f8436222e866904a592a6eec"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__framerate_8h.html#a3f3b7da73f3d92ff82b069b6108aa7ad">SDL_getFramecount</a> </td> <td>(</td> <td class="paramtype"><a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *&#160;</td> <td class="paramname"><em>manager</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Return the current framecount. </p> <p>Get the current framecount from the framerate manager. A frame is counted each time SDL_framerateDelay is called.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">manager</td><td>Pointer to the framerate manager.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Current frame count or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__framerate_8c_source.html#l00126">126</a> of file <a class="el" href="_s_d_l__framerate_8c_source.html">SDL_framerate.c</a>.</p> </div> </div> <a class="anchor" id="a575bb511d6f817ad846a788cbd08ae91"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__framerate_8h.html#adeb2ddd02412527aad226ba453a21999">SDL_getFramerate</a> </td> <td>(</td> <td class="paramtype"><a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *&#160;</td> <td class="paramname"><em>manager</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Return the current target framerate in Hz. </p> <p>Get the currently set framerate of the manager.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">manager</td><td>Pointer to the framerate manager.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Current framerate in Hz or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__framerate_8c_source.html#l00107">107</a> of file <a class="el" href="_s_d_l__framerate_8c_source.html">SDL_framerate.c</a>.</p> </div> </div> <a class="anchor" id="a444ebaaaa6b1ceeafa921562bdab1a44"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void <a class="el" href="_s_d_l__framerate_8h.html#a3ca69231486837c809fdcbe5b0a10787">SDL_initFramerate</a> </td> <td>(</td> <td class="paramtype"><a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *&#160;</td> <td class="paramname"><em>manager</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Initialize the framerate manager. </p> <p>Initialize the framerate manager, set default framerate of 30Hz and reset delay interpolation.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">manager</td><td>Pointer to the framerate manager. </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="_s_d_l__framerate_8c_source.html#l00062">62</a> of file <a class="el" href="_s_d_l__framerate_8c_source.html">SDL_framerate.c</a>.</p> </div> </div> <a class="anchor" id="afad4b503cf9719daced45fa4d9653d72"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__framerate_8h.html#a186ef8e6b1ee4ab36e05b162545fb0e4">SDL_setFramerate</a> </td> <td>(</td> <td class="paramtype"><a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *&#160;</td> <td class="paramname"><em>manager</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>rate</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Set the framerate in Hz. </p> <p>Sets a new framerate for the manager and reset delay interpolation. Rate values must be between FPS_LOWER_LIMIT and FPS_UPPER_LIMIT inclusive to be accepted.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">manager</td><td>Pointer to the framerate manager. </td></tr> <tr><td class="paramname">rate</td><td>The new framerate in Hz (frames per second).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>0 for sucess and -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__framerate_8c_source.html#l00086">86</a> of file <a class="el" href="_s_d_l__framerate_8c_source.html">SDL_framerate.c</a>.</p> </div> </div> </div><!-- contents --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.0 </small></address> </body> </html>
YifuLiu/AliOS-Things
components/SDL2/src/gfx/Docs/html/_s_d_l__framerate_8c.html
HTML
apache-2.0
12,818
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>SDL_gfx: I:/Sources/sdlgfx/SDL_framerate.c Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SDL_gfx &#160;<span id="projectnumber">2.0.25</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.8.0 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="headertitle"> <div class="title">I:/Sources/sdlgfx/SDL_framerate.c</div> </div> </div><!--header--> <div class="contents"> <a href="_s_d_l__framerate_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"></span> <a name="l00003"></a>00003 <span class="comment">SDL_framerate.c: framerate manager</span> <a name="l00004"></a>00004 <span class="comment"></span> <a name="l00005"></a>00005 <span class="comment">Copyright (C) 2001-2012 Andreas Schiffler</span> <a name="l00006"></a>00006 <span class="comment"></span> <a name="l00007"></a>00007 <span class="comment">This software is provided &#39;as-is&#39;, without any express or implied</span> <a name="l00008"></a>00008 <span class="comment">warranty. In no event will the authors be held liable for any damages</span> <a name="l00009"></a>00009 <span class="comment">arising from the use of this software.</span> <a name="l00010"></a>00010 <span class="comment"></span> <a name="l00011"></a>00011 <span class="comment">Permission is granted to anyone to use this software for any purpose,</span> <a name="l00012"></a>00012 <span class="comment">including commercial applications, and to alter it and redistribute it</span> <a name="l00013"></a>00013 <span class="comment">freely, subject to the following restrictions:</span> <a name="l00014"></a>00014 <span class="comment"></span> <a name="l00015"></a>00015 <span class="comment">1. The origin of this software must not be misrepresented; you must not</span> <a name="l00016"></a>00016 <span class="comment">claim that you wrote the original software. If you use this software</span> <a name="l00017"></a>00017 <span class="comment">in a product, an acknowledgment in the product documentation would be</span> <a name="l00018"></a>00018 <span class="comment">appreciated but is not required.</span> <a name="l00019"></a>00019 <span class="comment"></span> <a name="l00020"></a>00020 <span class="comment">2. Altered source versions must be plainly marked as such, and must not be</span> <a name="l00021"></a>00021 <span class="comment">misrepresented as being the original software.</span> <a name="l00022"></a>00022 <span class="comment"></span> <a name="l00023"></a>00023 <span class="comment">3. This notice may not be removed or altered from any source</span> <a name="l00024"></a>00024 <span class="comment">distribution.</span> <a name="l00025"></a>00025 <span class="comment"></span> <a name="l00026"></a>00026 <span class="comment">Andreas Schiffler -- aschiffler at ferzkopp dot net</span> <a name="l00027"></a>00027 <span class="comment"></span> <a name="l00028"></a>00028 <span class="comment">*/</span> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="preprocessor">#include &quot;<a class="code" href="_s_d_l__framerate_8h.html">SDL_framerate.h</a>&quot;</span> <a name="l00031"></a>00031 <a name="l00037"></a><a class="code" href="_s_d_l__framerate_8c.html#a3bed31ab61648f7d69c8f47c90161cfe">00037</a> Uint32 <a class="code" href="_s_d_l__framerate_8c.html#a3bed31ab61648f7d69c8f47c90161cfe" title="Internal wrapper to SDL_GetTicks that ensures a non-zero return value.">_getTicks</a>() <a name="l00038"></a>00038 { <a name="l00039"></a>00039 Uint32 ticks = SDL_GetTicks(); <a name="l00040"></a>00040 <a name="l00041"></a>00041 <span class="comment">/* </span> <a name="l00042"></a>00042 <span class="comment"> * Since baseticks!=0 is used to track initialization</span> <a name="l00043"></a>00043 <span class="comment"> * we need to ensure that the tick count is always &gt;0 </span> <a name="l00044"></a>00044 <span class="comment"> * since SDL_GetTicks may not have incremented yet and</span> <a name="l00045"></a>00045 <span class="comment"> * return 0 depending on the timing of the calls.</span> <a name="l00046"></a>00046 <span class="comment"> */</span> <a name="l00047"></a>00047 <span class="keywordflow">if</span> (ticks == 0) { <a name="l00048"></a>00048 <span class="keywordflow">return</span> 1; <a name="l00049"></a>00049 } <span class="keywordflow">else</span> { <a name="l00050"></a>00050 <span class="keywordflow">return</span> ticks; <a name="l00051"></a>00051 } <a name="l00052"></a>00052 } <a name="l00053"></a>00053 <a name="l00062"></a><a class="code" href="_s_d_l__framerate_8h.html#a3ca69231486837c809fdcbe5b0a10787">00062</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__framerate_8c.html#a444ebaaaa6b1ceeafa921562bdab1a44" title="Initialize the framerate manager.">SDL_initFramerate</a>(<a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a> * manager) <a name="l00063"></a>00063 { <a name="l00064"></a>00064 <span class="comment">/*</span> <a name="l00065"></a>00065 <span class="comment"> * Store some sane values </span> <a name="l00066"></a>00066 <span class="comment"> */</span> <a name="l00067"></a>00067 manager-&gt;<a class="code" href="struct_f_p_smanager.html#a05019faae5de8486dbb69d24b24eed78">framecount</a> = 0; <a name="l00068"></a>00068 manager-&gt;<a class="code" href="struct_f_p_smanager.html#af7eec7342fd8eb48d5f49ba7f5b91853">rate</a> = <a class="code" href="_s_d_l__framerate_8h.html#ab3ac02e6acb348129a019b9f20aa5c90" title="Default rate of framerate controller in Hz (1/s).">FPS_DEFAULT</a>; <a name="l00069"></a>00069 manager-&gt;<a class="code" href="struct_f_p_smanager.html#a48695d55d40900a197688bb773b9d431">rateticks</a> = (1000.0f / (float) <a class="code" href="_s_d_l__framerate_8h.html#ab3ac02e6acb348129a019b9f20aa5c90" title="Default rate of framerate controller in Hz (1/s).">FPS_DEFAULT</a>); <a name="l00070"></a>00070 manager-&gt;<a class="code" href="struct_f_p_smanager.html#ad853f9c03e200a77fd897c1ea3aec43d">baseticks</a> = <a class="code" href="_s_d_l__framerate_8c.html#a3bed31ab61648f7d69c8f47c90161cfe" title="Internal wrapper to SDL_GetTicks that ensures a non-zero return value.">_getTicks</a>(); <a name="l00071"></a>00071 manager-&gt;<a class="code" href="struct_f_p_smanager.html#aa7716779b7cc57dee24c15d7c5d62e55">lastticks</a> = manager-&gt;<a class="code" href="struct_f_p_smanager.html#ad853f9c03e200a77fd897c1ea3aec43d">baseticks</a>; <a name="l00072"></a>00072 <a name="l00073"></a>00073 } <a name="l00074"></a>00074 <a name="l00086"></a><a class="code" href="_s_d_l__framerate_8h.html#a186ef8e6b1ee4ab36e05b162545fb0e4">00086</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__framerate_8c.html#afad4b503cf9719daced45fa4d9653d72" title="Set the framerate in Hz.">SDL_setFramerate</a>(<a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a> * manager, Uint32 rate) <a name="l00087"></a>00087 { <a name="l00088"></a>00088 <span class="keywordflow">if</span> ((rate &gt;= <a class="code" href="_s_d_l__framerate_8h.html#a9555dceeaaffdd2669c991e6a300085b" title="Lowest possible rate supported by framerate controller in Hz (1/s).">FPS_LOWER_LIMIT</a>) &amp;&amp; (rate &lt;= <a class="code" href="_s_d_l__framerate_8h.html#aeaeac0f0b439344496e29abf60904d58" title="Highest possible rate supported by framerate controller in Hz (1/s).">FPS_UPPER_LIMIT</a>)) { <a name="l00089"></a>00089 manager-&gt;<a class="code" href="struct_f_p_smanager.html#a05019faae5de8486dbb69d24b24eed78">framecount</a> = 0; <a name="l00090"></a>00090 manager-&gt;<a class="code" href="struct_f_p_smanager.html#af7eec7342fd8eb48d5f49ba7f5b91853">rate</a> = rate; <a name="l00091"></a>00091 manager-&gt;<a class="code" href="struct_f_p_smanager.html#a48695d55d40900a197688bb773b9d431">rateticks</a> = (1000.0f / (float) rate); <a name="l00092"></a>00092 <span class="keywordflow">return</span> (0); <a name="l00093"></a>00093 } <span class="keywordflow">else</span> { <a name="l00094"></a>00094 <span class="keywordflow">return</span> (-1); <a name="l00095"></a>00095 } <a name="l00096"></a>00096 } <a name="l00097"></a>00097 <a name="l00107"></a><a class="code" href="_s_d_l__framerate_8h.html#adeb2ddd02412527aad226ba453a21999">00107</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__framerate_8c.html#a575bb511d6f817ad846a788cbd08ae91" title="Return the current target framerate in Hz.">SDL_getFramerate</a>(<a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a> * manager) <a name="l00108"></a>00108 { <a name="l00109"></a>00109 <span class="keywordflow">if</span> (manager == NULL) { <a name="l00110"></a>00110 <span class="keywordflow">return</span> (-1); <a name="l00111"></a>00111 } <span class="keywordflow">else</span> { <a name="l00112"></a>00112 <span class="keywordflow">return</span> ((<span class="keywordtype">int</span>)manager-&gt;<a class="code" href="struct_f_p_smanager.html#af7eec7342fd8eb48d5f49ba7f5b91853">rate</a>); <a name="l00113"></a>00113 } <a name="l00114"></a>00114 } <a name="l00115"></a>00115 <a name="l00126"></a><a class="code" href="_s_d_l__framerate_8h.html#a3f3b7da73f3d92ff82b069b6108aa7ad">00126</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__framerate_8c.html#a96b13e26f8436222e866904a592a6eec" title="Return the current framecount.">SDL_getFramecount</a>(<a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a> * manager) <a name="l00127"></a>00127 { <a name="l00128"></a>00128 <span class="keywordflow">if</span> (manager == NULL) { <a name="l00129"></a>00129 <span class="keywordflow">return</span> (-1); <a name="l00130"></a>00130 } <span class="keywordflow">else</span> { <a name="l00131"></a>00131 <span class="keywordflow">return</span> ((<span class="keywordtype">int</span>)manager-&gt;<a class="code" href="struct_f_p_smanager.html#a05019faae5de8486dbb69d24b24eed78">framecount</a>); <a name="l00132"></a>00132 } <a name="l00133"></a>00133 } <a name="l00134"></a>00134 <a name="l00146"></a><a class="code" href="_s_d_l__framerate_8h.html#a2c452933d7376dbb0083304b760ed63b">00146</a> Uint32 <a class="code" href="_s_d_l__framerate_8c.html#afce13fa3dd37130deb4975d8b230c3ba" title="Delay execution to maintain a constant framerate and calculate fps.">SDL_framerateDelay</a>(<a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a> * manager) <a name="l00147"></a>00147 { <a name="l00148"></a>00148 Uint32 current_ticks; <a name="l00149"></a>00149 Uint32 target_ticks; <a name="l00150"></a>00150 Uint32 the_delay; <a name="l00151"></a>00151 Uint32 time_passed = 0; <a name="l00152"></a>00152 <a name="l00153"></a>00153 <span class="comment">/*</span> <a name="l00154"></a>00154 <span class="comment"> * No manager, no delay</span> <a name="l00155"></a>00155 <span class="comment"> */</span> <a name="l00156"></a>00156 <span class="keywordflow">if</span> (manager == NULL) { <a name="l00157"></a>00157 <span class="keywordflow">return</span> 0; <a name="l00158"></a>00158 } <a name="l00159"></a>00159 <a name="l00160"></a>00160 <span class="comment">/*</span> <a name="l00161"></a>00161 <span class="comment"> * Initialize uninitialized manager </span> <a name="l00162"></a>00162 <span class="comment"> */</span> <a name="l00163"></a>00163 <span class="keywordflow">if</span> (manager-&gt;<a class="code" href="struct_f_p_smanager.html#ad853f9c03e200a77fd897c1ea3aec43d">baseticks</a> == 0) { <a name="l00164"></a>00164 <a class="code" href="_s_d_l__framerate_8c.html#a444ebaaaa6b1ceeafa921562bdab1a44" title="Initialize the framerate manager.">SDL_initFramerate</a>(manager); <a name="l00165"></a>00165 } <a name="l00166"></a>00166 <a name="l00167"></a>00167 <span class="comment">/*</span> <a name="l00168"></a>00168 <span class="comment"> * Next frame </span> <a name="l00169"></a>00169 <span class="comment"> */</span> <a name="l00170"></a>00170 manager-&gt;<a class="code" href="struct_f_p_smanager.html#a05019faae5de8486dbb69d24b24eed78">framecount</a>++; <a name="l00171"></a>00171 <a name="l00172"></a>00172 <span class="comment">/*</span> <a name="l00173"></a>00173 <span class="comment"> * Get/calc ticks </span> <a name="l00174"></a>00174 <span class="comment"> */</span> <a name="l00175"></a>00175 current_ticks = <a class="code" href="_s_d_l__framerate_8c.html#a3bed31ab61648f7d69c8f47c90161cfe" title="Internal wrapper to SDL_GetTicks that ensures a non-zero return value.">_getTicks</a>(); <a name="l00176"></a>00176 time_passed = current_ticks - manager-&gt;<a class="code" href="struct_f_p_smanager.html#aa7716779b7cc57dee24c15d7c5d62e55">lastticks</a>; <a name="l00177"></a>00177 manager-&gt;<a class="code" href="struct_f_p_smanager.html#aa7716779b7cc57dee24c15d7c5d62e55">lastticks</a> = current_ticks; <a name="l00178"></a>00178 target_ticks = manager-&gt;<a class="code" href="struct_f_p_smanager.html#ad853f9c03e200a77fd897c1ea3aec43d">baseticks</a> + (Uint32) ((<span class="keywordtype">float</span>) manager-&gt;<a class="code" href="struct_f_p_smanager.html#a05019faae5de8486dbb69d24b24eed78">framecount</a> * manager-&gt;<a class="code" href="struct_f_p_smanager.html#a48695d55d40900a197688bb773b9d431">rateticks</a>); <a name="l00179"></a>00179 <a name="l00180"></a>00180 <span class="keywordflow">if</span> (current_ticks &lt;= target_ticks) { <a name="l00181"></a>00181 the_delay = target_ticks - current_ticks; <a name="l00182"></a>00182 SDL_Delay(the_delay); <a name="l00183"></a>00183 } <span class="keywordflow">else</span> { <a name="l00184"></a>00184 manager-&gt;<a class="code" href="struct_f_p_smanager.html#a05019faae5de8486dbb69d24b24eed78">framecount</a> = 0; <a name="l00185"></a>00185 manager-&gt;<a class="code" href="struct_f_p_smanager.html#ad853f9c03e200a77fd897c1ea3aec43d">baseticks</a> = <a class="code" href="_s_d_l__framerate_8c.html#a3bed31ab61648f7d69c8f47c90161cfe" title="Internal wrapper to SDL_GetTicks that ensures a non-zero return value.">_getTicks</a>(); <a name="l00186"></a>00186 } <a name="l00187"></a>00187 <a name="l00188"></a>00188 <span class="keywordflow">return</span> time_passed; <a name="l00189"></a>00189 } </pre></div></div><!-- contents --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.0 </small></address> </body> </html>
YifuLiu/AliOS-Things
components/SDL2/src/gfx/Docs/html/_s_d_l__framerate_8c_source.html
HTML
apache-2.0
16,737
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>SDL_gfx: I:/Sources/sdlgfx/SDL_framerate.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SDL_gfx &#160;<span id="projectnumber">2.0.25</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.8.0 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#nested-classes">Data Structures</a> &#124; <a href="#define-members">Defines</a> &#124; <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">I:/Sources/sdlgfx/SDL_framerate.h File Reference</div> </div> </div><!--header--> <div class="contents"> <div class="textblock"><code>#include &quot;SDL.h&quot;</code><br/> </div> <p><a href="_s_d_l__framerate_8h_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="nested-classes"></a> Data Structures</h2></td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_f_p_smanager.html">FPSmanager</a></td></tr> <tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Structure holding the state and timing information of the framerate controller. <a href="struct_f_p_smanager.html#details">More...</a><br/></td></tr> <tr><td colspan="2"><h2><a name="define-members"></a> Defines</h2></td></tr> <tr class="memitem:aeaeac0f0b439344496e29abf60904d58"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__framerate_8h.html#aeaeac0f0b439344496e29abf60904d58">FPS_UPPER_LIMIT</a>&#160;&#160;&#160;200</td></tr> <tr class="memdesc:aeaeac0f0b439344496e29abf60904d58"><td class="mdescLeft">&#160;</td><td class="mdescRight">Highest possible rate supported by framerate controller in Hz (1/s). <a href="#aeaeac0f0b439344496e29abf60904d58"></a><br/></td></tr> <tr class="memitem:a9555dceeaaffdd2669c991e6a300085b"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__framerate_8h.html#a9555dceeaaffdd2669c991e6a300085b">FPS_LOWER_LIMIT</a>&#160;&#160;&#160;1</td></tr> <tr class="memdesc:a9555dceeaaffdd2669c991e6a300085b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Lowest possible rate supported by framerate controller in Hz (1/s). <a href="#a9555dceeaaffdd2669c991e6a300085b"></a><br/></td></tr> <tr class="memitem:ab3ac02e6acb348129a019b9f20aa5c90"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__framerate_8h.html#ab3ac02e6acb348129a019b9f20aa5c90">FPS_DEFAULT</a>&#160;&#160;&#160;30</td></tr> <tr class="memdesc:ab3ac02e6acb348129a019b9f20aa5c90"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default rate of framerate controller in Hz (1/s). <a href="#ab3ac02e6acb348129a019b9f20aa5c90"></a><br/></td></tr> <tr class="memitem:a3dea4aed583d439f014e606c18da6fe4"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a>&#160;&#160;&#160;extern</td></tr> <tr><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:a3ca69231486837c809fdcbe5b0a10787"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a> void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__framerate_8h.html#a3ca69231486837c809fdcbe5b0a10787">SDL_initFramerate</a> (<a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *manager)</td></tr> <tr class="memdesc:a3ca69231486837c809fdcbe5b0a10787"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the framerate manager. <a href="#a3ca69231486837c809fdcbe5b0a10787"></a><br/></td></tr> <tr class="memitem:a186ef8e6b1ee4ab36e05b162545fb0e4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__framerate_8h.html#a186ef8e6b1ee4ab36e05b162545fb0e4">SDL_setFramerate</a> (<a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *manager, Uint32 rate)</td></tr> <tr class="memdesc:a186ef8e6b1ee4ab36e05b162545fb0e4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the framerate in Hz. <a href="#a186ef8e6b1ee4ab36e05b162545fb0e4"></a><br/></td></tr> <tr class="memitem:adeb2ddd02412527aad226ba453a21999"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__framerate_8h.html#adeb2ddd02412527aad226ba453a21999">SDL_getFramerate</a> (<a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *manager)</td></tr> <tr class="memdesc:adeb2ddd02412527aad226ba453a21999"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the current target framerate in Hz. <a href="#adeb2ddd02412527aad226ba453a21999"></a><br/></td></tr> <tr class="memitem:a3f3b7da73f3d92ff82b069b6108aa7ad"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__framerate_8h.html#a3f3b7da73f3d92ff82b069b6108aa7ad">SDL_getFramecount</a> (<a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *manager)</td></tr> <tr class="memdesc:a3f3b7da73f3d92ff82b069b6108aa7ad"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the current framecount. <a href="#a3f3b7da73f3d92ff82b069b6108aa7ad"></a><br/></td></tr> <tr class="memitem:a2c452933d7376dbb0083304b760ed63b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a> Uint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__framerate_8h.html#a2c452933d7376dbb0083304b760ed63b">SDL_framerateDelay</a> (<a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *manager)</td></tr> <tr class="memdesc:a2c452933d7376dbb0083304b760ed63b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Delay execution to maintain a constant framerate and calculate fps. <a href="#a2c452933d7376dbb0083304b760ed63b"></a><br/></td></tr> </table> <hr/><h2>Define Documentation</h2> <a class="anchor" id="ab3ac02e6acb348129a019b9f20aa5c90"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__framerate_8h.html#ab3ac02e6acb348129a019b9f20aa5c90">FPS_DEFAULT</a>&#160;&#160;&#160;30</td> </tr> </table> </div> <div class="memdoc"> <p>Default rate of framerate controller in Hz (1/s). </p> <p>Definition at line <a class="el" href="_s_d_l__framerate_8h_source.html#l00057">57</a> of file <a class="el" href="_s_d_l__framerate_8h_source.html">SDL_framerate.h</a>.</p> </div> </div> <a class="anchor" id="a9555dceeaaffdd2669c991e6a300085b"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__framerate_8h.html#a9555dceeaaffdd2669c991e6a300085b">FPS_LOWER_LIMIT</a>&#160;&#160;&#160;1</td> </tr> </table> </div> <div class="memdoc"> <p>Lowest possible rate supported by framerate controller in Hz (1/s). </p> <p>Definition at line <a class="el" href="_s_d_l__framerate_8h_source.html#l00052">52</a> of file <a class="el" href="_s_d_l__framerate_8h_source.html">SDL_framerate.h</a>.</p> </div> </div> <a class="anchor" id="aeaeac0f0b439344496e29abf60904d58"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__framerate_8h.html#aeaeac0f0b439344496e29abf60904d58">FPS_UPPER_LIMIT</a>&#160;&#160;&#160;200</td> </tr> </table> </div> <div class="memdoc"> <p>Highest possible rate supported by framerate controller in Hz (1/s). </p> <p>Definition at line <a class="el" href="_s_d_l__framerate_8h_source.html#l00047">47</a> of file <a class="el" href="_s_d_l__framerate_8h_source.html">SDL_framerate.h</a>.</p> </div> </div> <a class="anchor" id="a3dea4aed583d439f014e606c18da6fe4"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a>&#160;&#160;&#160;extern</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__framerate_8h_source.html#l00082">82</a> of file <a class="el" href="_s_d_l__framerate_8h_source.html">SDL_framerate.h</a>.</p> </div> </div> <hr/><h2>Function Documentation</h2> <a class="anchor" id="a2c452933d7376dbb0083304b760ed63b"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a> Uint32 <a class="el" href="_s_d_l__framerate_8h.html#a2c452933d7376dbb0083304b760ed63b">SDL_framerateDelay</a> </td> <td>(</td> <td class="paramtype"><a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *&#160;</td> <td class="paramname"><em>manager</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Delay execution to maintain a constant framerate and calculate fps. </p> <p>Generate a delay to accomodate currently set framerate. Call once in the graphics/rendering loop. If the computer cannot keep up with the rate (i.e. drawing too slow), the delay is zero and the delay interpolation is reset.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">manager</td><td>Pointer to the framerate manager.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>The time that passed since the last call to the function in ms. May return 0. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__framerate_8c_source.html#l00146">146</a> of file <a class="el" href="_s_d_l__framerate_8c_source.html">SDL_framerate.c</a>.</p> </div> </div> <a class="anchor" id="a3f3b7da73f3d92ff82b069b6108aa7ad"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a> int <a class="el" href="_s_d_l__framerate_8h.html#a3f3b7da73f3d92ff82b069b6108aa7ad">SDL_getFramecount</a> </td> <td>(</td> <td class="paramtype"><a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *&#160;</td> <td class="paramname"><em>manager</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Return the current framecount. </p> <p>Get the current framecount from the framerate manager. A frame is counted each time SDL_framerateDelay is called.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">manager</td><td>Pointer to the framerate manager.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Current frame count or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__framerate_8c_source.html#l00126">126</a> of file <a class="el" href="_s_d_l__framerate_8c_source.html">SDL_framerate.c</a>.</p> </div> </div> <a class="anchor" id="adeb2ddd02412527aad226ba453a21999"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a> int <a class="el" href="_s_d_l__framerate_8h.html#adeb2ddd02412527aad226ba453a21999">SDL_getFramerate</a> </td> <td>(</td> <td class="paramtype"><a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *&#160;</td> <td class="paramname"><em>manager</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Return the current target framerate in Hz. </p> <p>Get the currently set framerate of the manager.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">manager</td><td>Pointer to the framerate manager.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Current framerate in Hz or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__framerate_8c_source.html#l00107">107</a> of file <a class="el" href="_s_d_l__framerate_8c_source.html">SDL_framerate.c</a>.</p> </div> </div> <a class="anchor" id="a3ca69231486837c809fdcbe5b0a10787"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a> void <a class="el" href="_s_d_l__framerate_8h.html#a3ca69231486837c809fdcbe5b0a10787">SDL_initFramerate</a> </td> <td>(</td> <td class="paramtype"><a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *&#160;</td> <td class="paramname"><em>manager</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Initialize the framerate manager. </p> <p>Initialize the framerate manager, set default framerate of 30Hz and reset delay interpolation.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">manager</td><td>Pointer to the framerate manager. </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="_s_d_l__framerate_8c_source.html#l00062">62</a> of file <a class="el" href="_s_d_l__framerate_8c_source.html">SDL_framerate.c</a>.</p> </div> </div> <a class="anchor" id="a186ef8e6b1ee4ab36e05b162545fb0e4"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a> int <a class="el" href="_s_d_l__framerate_8h.html#a186ef8e6b1ee4ab36e05b162545fb0e4">SDL_setFramerate</a> </td> <td>(</td> <td class="paramtype"><a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *&#160;</td> <td class="paramname"><em>manager</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>rate</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Set the framerate in Hz. </p> <p>Sets a new framerate for the manager and reset delay interpolation. Rate values must be between FPS_LOWER_LIMIT and FPS_UPPER_LIMIT inclusive to be accepted.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">manager</td><td>Pointer to the framerate manager. </td></tr> <tr><td class="paramname">rate</td><td>The new framerate in Hz (frames per second).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>0 for sucess and -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__framerate_8c_source.html#l00086">86</a> of file <a class="el" href="_s_d_l__framerate_8c_source.html">SDL_framerate.c</a>.</p> </div> </div> </div><!-- contents --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.0 </small></address> </body> </html>
YifuLiu/AliOS-Things
components/SDL2/src/gfx/Docs/html/_s_d_l__framerate_8h.html
HTML
apache-2.0
17,598
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>SDL_gfx: I:/Sources/sdlgfx/SDL_framerate.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SDL_gfx &#160;<span id="projectnumber">2.0.25</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.8.0 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="headertitle"> <div class="title">I:/Sources/sdlgfx/SDL_framerate.h</div> </div> </div><!--header--> <div class="contents"> <a href="_s_d_l__framerate_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"></span> <a name="l00003"></a>00003 <span class="comment">SDL_framerate.h: framerate manager</span> <a name="l00004"></a>00004 <span class="comment"></span> <a name="l00005"></a>00005 <span class="comment">Copyright (C) 2001-2012 Andreas Schiffler</span> <a name="l00006"></a>00006 <span class="comment"></span> <a name="l00007"></a>00007 <span class="comment">This software is provided &#39;as-is&#39;, without any express or implied</span> <a name="l00008"></a>00008 <span class="comment">warranty. In no event will the authors be held liable for any damages</span> <a name="l00009"></a>00009 <span class="comment">arising from the use of this software.</span> <a name="l00010"></a>00010 <span class="comment"></span> <a name="l00011"></a>00011 <span class="comment">Permission is granted to anyone to use this software for any purpose,</span> <a name="l00012"></a>00012 <span class="comment">including commercial applications, and to alter it and redistribute it</span> <a name="l00013"></a>00013 <span class="comment">freely, subject to the following restrictions:</span> <a name="l00014"></a>00014 <span class="comment"></span> <a name="l00015"></a>00015 <span class="comment">1. The origin of this software must not be misrepresented; you must not</span> <a name="l00016"></a>00016 <span class="comment">claim that you wrote the original software. If you use this software</span> <a name="l00017"></a>00017 <span class="comment">in a product, an acknowledgment in the product documentation would be</span> <a name="l00018"></a>00018 <span class="comment">appreciated but is not required.</span> <a name="l00019"></a>00019 <span class="comment"></span> <a name="l00020"></a>00020 <span class="comment">2. Altered source versions must be plainly marked as such, and must not be</span> <a name="l00021"></a>00021 <span class="comment">misrepresented as being the original software.</span> <a name="l00022"></a>00022 <span class="comment"></span> <a name="l00023"></a>00023 <span class="comment">3. This notice may not be removed or altered from any source</span> <a name="l00024"></a>00024 <span class="comment">distribution.</span> <a name="l00025"></a>00025 <span class="comment"></span> <a name="l00026"></a>00026 <span class="comment">Andreas Schiffler -- aschiffler at ferzkopp dot net</span> <a name="l00027"></a>00027 <span class="comment"></span> <a name="l00028"></a>00028 <span class="comment">*/</span> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="preprocessor">#ifndef _SDL_framerate_h</span> <a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#define _SDL_framerate_h</span> <a name="l00032"></a>00032 <span class="preprocessor"></span> <a name="l00033"></a>00033 <span class="comment">/* Set up for C function definitions, even when using C++ */</span> <a name="l00034"></a>00034 <span class="preprocessor">#ifdef __cplusplus</span> <a name="l00035"></a>00035 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> { <a name="l00036"></a>00036 <span class="preprocessor">#endif</span> <a name="l00037"></a>00037 <span class="preprocessor"></span> <a name="l00038"></a>00038 <span class="comment">/* --- */</span> <a name="l00039"></a>00039 <a name="l00040"></a>00040 <span class="preprocessor">#include &quot;SDL.h&quot;</span> <a name="l00041"></a>00041 <a name="l00042"></a>00042 <span class="comment">/* --------- Definitions */</span> <a name="l00043"></a>00043 <a name="l00047"></a><a class="code" href="_s_d_l__framerate_8h.html#aeaeac0f0b439344496e29abf60904d58">00047</a> <span class="preprocessor">#define FPS_UPPER_LIMIT 200</span> <a name="l00048"></a>00048 <span class="preprocessor"></span> <a name="l00052"></a><a class="code" href="_s_d_l__framerate_8h.html#a9555dceeaaffdd2669c991e6a300085b">00052</a> <span class="preprocessor">#define FPS_LOWER_LIMIT 1</span> <a name="l00053"></a>00053 <span class="preprocessor"></span> <a name="l00057"></a><a class="code" href="_s_d_l__framerate_8h.html#ab3ac02e6acb348129a019b9f20aa5c90">00057</a> <span class="preprocessor">#define FPS_DEFAULT 30</span> <a name="l00058"></a>00058 <span class="preprocessor"></span> <a name="l00062"></a><a class="code" href="struct_f_p_smanager.html">00062</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{ <a name="l00063"></a><a class="code" href="struct_f_p_smanager.html#a05019faae5de8486dbb69d24b24eed78">00063</a> Uint32 <a class="code" href="struct_f_p_smanager.html#a05019faae5de8486dbb69d24b24eed78">framecount</a>; <a name="l00064"></a><a class="code" href="struct_f_p_smanager.html#a48695d55d40900a197688bb773b9d431">00064</a> <span class="keywordtype">float</span> <a class="code" href="struct_f_p_smanager.html#a48695d55d40900a197688bb773b9d431">rateticks</a>; <a name="l00065"></a><a class="code" href="struct_f_p_smanager.html#ad853f9c03e200a77fd897c1ea3aec43d">00065</a> Uint32 <a class="code" href="struct_f_p_smanager.html#ad853f9c03e200a77fd897c1ea3aec43d">baseticks</a>; <a name="l00066"></a><a class="code" href="struct_f_p_smanager.html#aa7716779b7cc57dee24c15d7c5d62e55">00066</a> Uint32 <a class="code" href="struct_f_p_smanager.html#aa7716779b7cc57dee24c15d7c5d62e55">lastticks</a>; <a name="l00067"></a><a class="code" href="struct_f_p_smanager.html#af7eec7342fd8eb48d5f49ba7f5b91853">00067</a> Uint32 <a class="code" href="struct_f_p_smanager.html#af7eec7342fd8eb48d5f49ba7f5b91853">rate</a>; <a name="l00068"></a>00068 } <a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a>; <a name="l00069"></a>00069 <a name="l00070"></a>00070 <span class="comment">/* ---- Function Prototypes */</span> <a name="l00071"></a>00071 <a name="l00072"></a>00072 <span class="preprocessor">#ifdef _MSC_VER</span> <a name="l00073"></a>00073 <span class="preprocessor"></span><span class="preprocessor"># if defined(DLL_EXPORT) &amp;&amp; !defined(LIBSDL_GFX_DLL_IMPORT)</span> <a name="l00074"></a>00074 <span class="preprocessor"></span><span class="preprocessor"># define SDL_FRAMERATE_SCOPE __declspec(dllexport)</span> <a name="l00075"></a>00075 <span class="preprocessor"></span><span class="preprocessor"># else</span> <a name="l00076"></a>00076 <span class="preprocessor"></span><span class="preprocessor"># ifdef LIBSDL_GFX_DLL_IMPORT</span> <a name="l00077"></a>00077 <span class="preprocessor"></span><span class="preprocessor"># define SDL_FRAMERATE_SCOPE __declspec(dllimport)</span> <a name="l00078"></a>00078 <span class="preprocessor"></span><span class="preprocessor"># endif</span> <a name="l00079"></a>00079 <span class="preprocessor"></span><span class="preprocessor"># endif</span> <a name="l00080"></a>00080 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00081"></a>00081 <span class="preprocessor"></span><span class="preprocessor">#ifndef SDL_FRAMERATE_SCOPE</span> <a name="l00082"></a><a class="code" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">00082</a> <span class="preprocessor"></span><span class="preprocessor"># define SDL_FRAMERATE_SCOPE extern</span> <a name="l00083"></a>00083 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00084"></a>00084 <span class="preprocessor"></span> <a name="l00085"></a>00085 <span class="comment">/* Functions return 0 or value for sucess and -1 for error */</span> <a name="l00086"></a>00086 <a name="l00087"></a>00087 <a class="code" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__framerate_8c.html#a444ebaaaa6b1ceeafa921562bdab1a44" title="Initialize the framerate manager.">SDL_initFramerate</a>(<a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a> * manager); <a name="l00088"></a>00088 <a class="code" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__framerate_8c.html#afad4b503cf9719daced45fa4d9653d72" title="Set the framerate in Hz.">SDL_setFramerate</a>(<a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a> * manager, Uint32 rate); <a name="l00089"></a>00089 <a class="code" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__framerate_8c.html#a575bb511d6f817ad846a788cbd08ae91" title="Return the current target framerate in Hz.">SDL_getFramerate</a>(<a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a> * manager); <a name="l00090"></a>00090 <a class="code" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__framerate_8c.html#a96b13e26f8436222e866904a592a6eec" title="Return the current framecount.">SDL_getFramecount</a>(<a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a> * manager); <a name="l00091"></a>00091 <a class="code" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a> Uint32 <a class="code" href="_s_d_l__framerate_8c.html#afce13fa3dd37130deb4975d8b230c3ba" title="Delay execution to maintain a constant framerate and calculate fps.">SDL_framerateDelay</a>(<a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a> * manager); <a name="l00092"></a>00092 <a name="l00093"></a>00093 <span class="comment">/* --- */</span> <a name="l00094"></a>00094 <a name="l00095"></a>00095 <span class="comment">/* Ends C function definitions when using C++ */</span> <a name="l00096"></a>00096 <span class="preprocessor">#ifdef __cplusplus</span> <a name="l00097"></a>00097 <span class="preprocessor"></span>} <a name="l00098"></a>00098 <span class="preprocessor">#endif</span> <a name="l00099"></a>00099 <span class="preprocessor"></span> <a name="l00100"></a>00100 <span class="preprocessor">#endif </span><span class="comment">/* _SDL_framerate_h */</span> </pre></div></div><!-- contents --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.0 </small></address> </body> </html>
YifuLiu/AliOS-Things
components/SDL2/src/gfx/Docs/html/_s_d_l__framerate_8h_source.html
HTML
apache-2.0
12,851
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>SDL_gfx: I:/Sources/sdlgfx/SDL_gfxBlitFunc.c File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SDL_gfx &#160;<span id="projectnumber">2.0.25</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.8.0 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#func-members">Functions</a> &#124; <a href="#var-members">Variables</a> </div> <div class="headertitle"> <div class="title">I:/Sources/sdlgfx/SDL_gfxBlitFunc.c File Reference</div> </div> </div><!--header--> <div class="contents"> <div class="textblock"><code>#include &quot;<a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>&quot;</code><br/> </div> <p><a href="_s_d_l__gfx_blit_func_8c_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:a7ec9cde56a58eee4e6182c32dd8cbee7"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_blit_func_8c.html#a7ec9cde56a58eee4e6182c32dd8cbee7">_SDL_gfxBlitBlitterRGBA</a> (<a class="el" href="struct_s_d_l__gfx_blit_info.html">SDL_gfxBlitInfo</a> *info)</td></tr> <tr class="memdesc:a7ec9cde56a58eee4e6182c32dd8cbee7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal blitter using adjusted destination alpha during RGBA-&gt;RGBA blits. <a href="#a7ec9cde56a58eee4e6182c32dd8cbee7"></a><br/></td></tr> <tr class="memitem:a9375eac21cc799258f971034a3be57b5"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_blit_func_8c.html#a9375eac21cc799258f971034a3be57b5">_SDL_gfxBlitRGBACall</a> (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)</td></tr> <tr class="memdesc:a9375eac21cc799258f971034a3be57b5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal blitter setup wrapper for RGBA-&gt;RGBA blits. <a href="#a9375eac21cc799258f971034a3be57b5"></a><br/></td></tr> <tr class="memitem:ac51ff40d39f3dd0bd08116e8953960f8"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_blit_func_8c.html#ac51ff40d39f3dd0bd08116e8953960f8">SDL_gfxBlitRGBA</a> (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)</td></tr> <tr class="memdesc:ac51ff40d39f3dd0bd08116e8953960f8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Blitter for RGBA-&gt;RGBA blits with alpha adjustment. <a href="#ac51ff40d39f3dd0bd08116e8953960f8"></a><br/></td></tr> <tr class="memitem:a09a376775f9d8c933c7121e34fe5ecfc"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_blit_func_8c.html#a09a376775f9d8c933c7121e34fe5ecfc">SDL_gfxSetAlpha</a> (SDL_Surface *src, Uint8 a)</td></tr> <tr class="memdesc:a09a376775f9d8c933c7121e34fe5ecfc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the alpha channel in a 32 bit surface. <a href="#a09a376775f9d8c933c7121e34fe5ecfc"></a><br/></td></tr> <tr class="memitem:a4ece530dca0ae46b1f5a780f85371687"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_blit_func_8c.html#a4ece530dca0ae46b1f5a780f85371687">SDL_gfxMultiplyAlpha</a> (SDL_Surface *src, Uint8 a)</td></tr> <tr class="memdesc:a4ece530dca0ae46b1f5a780f85371687"><td class="mdescLeft">&#160;</td><td class="mdescRight">Multiply the alpha channel in a 32bit surface. <a href="#a4ece530dca0ae46b1f5a780f85371687"></a><br/></td></tr> <tr><td colspan="2"><h2><a name="var-members"></a> Variables</h2></td></tr> <tr class="memitem:a6d0c17342154e14322a281603960691a"><td class="memItemLeft" align="right" valign="top">const unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_blit_func_8c.html#a6d0c17342154e14322a281603960691a">GFX_ALPHA_ADJUST_ARRAY</a> [256]</td></tr> <tr class="memdesc:a6d0c17342154e14322a281603960691a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Alpha adjustment table for custom blitter. <a href="#a6d0c17342154e14322a281603960691a"></a><br/></td></tr> </table> <hr/><h2>Function Documentation</h2> <a class="anchor" id="a7ec9cde56a58eee4e6182c32dd8cbee7"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void <a class="el" href="_s_d_l__gfx_blit_func_8c.html#a7ec9cde56a58eee4e6182c32dd8cbee7">_SDL_gfxBlitBlitterRGBA</a> </td> <td>(</td> <td class="paramtype"><a class="el" href="struct_s_d_l__gfx_blit_info.html">SDL_gfxBlitInfo</a> *&#160;</td> <td class="paramname"><em>info</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal blitter using adjusted destination alpha during RGBA-&gt;RGBA blits. </p> <p>Performs the blit based on the 'info' structure and applies the transfer function to the destination 'a' values.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">info</td><td>The blit info to use. </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8c_source.html#l00306">306</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8c_source.html">SDL_gfxBlitFunc.c</a>.</p> </div> </div> <a class="anchor" id="a9375eac21cc799258f971034a3be57b5"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_blit_func_8c.html#a9375eac21cc799258f971034a3be57b5">_SDL_gfxBlitRGBACall</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">SDL_Rect *&#160;</td> <td class="paramname"><em>srcrect</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">SDL_Rect *&#160;</td> <td class="paramname"><em>dstrect</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal blitter setup wrapper for RGBA-&gt;RGBA blits. </p> <p>Sets up the blitter info based on the 'src' and 'dst' surfaces and rectangles.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">src</td><td>The source surface. </td></tr> <tr><td class="paramname">srcrect</td><td>The source rectangle. </td></tr> <tr><td class="paramname">dst</td><td>The destination surface. </td></tr> <tr><td class="paramname">dstrect</td><td>The destination rectangle.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if blit was performed, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8c_source.html#l00356">356</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8c_source.html">SDL_gfxBlitFunc.c</a>.</p> </div> </div> <a class="anchor" id="ac51ff40d39f3dd0bd08116e8953960f8"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_blit_func_8h.html#ab49c560e89b8305051b2e6b347215f03">SDL_gfxBlitRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">SDL_Rect *&#160;</td> <td class="paramname"><em>srcrect</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">SDL_Rect *&#160;</td> <td class="paramname"><em>dstrect</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Blitter for RGBA-&gt;RGBA blits with alpha adjustment. </p> <p>Verifies the input 'src' and 'dst' surfaces and rectangles and performs blit. The destination clip rectangle is honored.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">src</td><td>The source surface. </td></tr> <tr><td class="paramname">srcrect</td><td>The source rectangle. </td></tr> <tr><td class="paramname">dst</td><td>The destination surface. </td></tr> <tr><td class="paramname">dstrect</td><td>The destination rectangle.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if blit was performed, 0 otherwise, or -1 if an error occured. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8c_source.html#l00411">411</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8c_source.html">SDL_gfxBlitFunc.c</a>.</p> </div> </div> <a class="anchor" id="a4ece530dca0ae46b1f5a780f85371687"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a7c93594525ae349b5cef0156b8f758fc">SDL_gfxMultiplyAlpha</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Multiply the alpha channel in a 32bit surface. </p> <p>Helper function that multiplies the alpha channel in a 32 bit surface with a constant value. The final alpha is always scaled to the range 0-255 (i.e. the factor is a/256).</p> <p>Only 32 bit surfaces can be used with this function.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">src</td><td>Pointer to the target surface to change. </td></tr> <tr><td class="paramname">a</td><td>The alpha value to multiply with. When a is 255, this function is a NoOp.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if alpha was changed, 0 otherwise. Returns -1 if input surface is invalid. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8c_source.html#l00587">587</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8c_source.html">SDL_gfxBlitFunc.c</a>.</p> </div> </div> <a class="anchor" id="a09a376775f9d8c933c7121e34fe5ecfc"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a4627ae4a0037d0b248bed87f3c294735">SDL_gfxSetAlpha</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Sets the alpha channel in a 32 bit surface. </p> <p>Helper function that sets the alpha channel in a 32 bit surface to a constant value. Only 32 bit surfaces can be used with this function.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">src</td><td>Pointer to the target surface to change. </td></tr> <tr><td class="paramname">a</td><td>The alpha value to set.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if alpha was changed, -1 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8c_source.html#l00524">524</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8c_source.html">SDL_gfxBlitFunc.c</a>.</p> </div> </div> <hr/><h2>Variable Documentation</h2> <a class="anchor" id="a6d0c17342154e14322a281603960691a"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const unsigned int <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a6d0c17342154e14322a281603960691a">GFX_ALPHA_ADJUST_ARRAY</a>[256]</td> </tr> </table> </div> <div class="memdoc"> <p>Alpha adjustment table for custom blitter. </p> <p>The table provides values for a modified, non-linear transfer function which maintain brightness. </p> <p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8c_source.html#l00039">39</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8c_source.html">SDL_gfxBlitFunc.c</a>.</p> </div> </div> </div><!-- contents --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.0 </small></address> </body> </html>
YifuLiu/AliOS-Things
components/SDL2/src/gfx/Docs/html/_s_d_l__gfx_blit_func_8c.html
HTML
apache-2.0
15,131
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>SDL_gfx: I:/Sources/sdlgfx/SDL_gfxBlitFunc.c Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SDL_gfx &#160;<span id="projectnumber">2.0.25</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.8.0 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="headertitle"> <div class="title">I:/Sources/sdlgfx/SDL_gfxBlitFunc.c</div> </div> </div><!--header--> <div class="contents"> <a href="_s_d_l__gfx_blit_func_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* </span> <a name="l00002"></a>00002 <span class="comment"></span> <a name="l00003"></a>00003 <span class="comment">SDL_gfxBlitFunc.c: custom blitters</span> <a name="l00004"></a>00004 <span class="comment"></span> <a name="l00005"></a>00005 <span class="comment">Copyright (C) 2001-2012 Andreas Schiffler</span> <a name="l00006"></a>00006 <span class="comment"></span> <a name="l00007"></a>00007 <span class="comment">This software is provided &#39;as-is&#39;, without any express or implied</span> <a name="l00008"></a>00008 <span class="comment">warranty. In no event will the authors be held liable for any damages</span> <a name="l00009"></a>00009 <span class="comment">arising from the use of this software.</span> <a name="l00010"></a>00010 <span class="comment"></span> <a name="l00011"></a>00011 <span class="comment">Permission is granted to anyone to use this software for any purpose,</span> <a name="l00012"></a>00012 <span class="comment">including commercial applications, and to alter it and redistribute it</span> <a name="l00013"></a>00013 <span class="comment">freely, subject to the following restrictions:</span> <a name="l00014"></a>00014 <span class="comment"></span> <a name="l00015"></a>00015 <span class="comment">1. The origin of this software must not be misrepresented; you must not</span> <a name="l00016"></a>00016 <span class="comment">claim that you wrote the original software. If you use this software</span> <a name="l00017"></a>00017 <span class="comment">in a product, an acknowledgment in the product documentation would be</span> <a name="l00018"></a>00018 <span class="comment">appreciated but is not required.</span> <a name="l00019"></a>00019 <span class="comment"></span> <a name="l00020"></a>00020 <span class="comment">2. Altered source versions must be plainly marked as such, and must not be</span> <a name="l00021"></a>00021 <span class="comment">misrepresented as being the original software.</span> <a name="l00022"></a>00022 <span class="comment"></span> <a name="l00023"></a>00023 <span class="comment">3. This notice may not be removed or altered from any source</span> <a name="l00024"></a>00024 <span class="comment">distribution.</span> <a name="l00025"></a>00025 <span class="comment"></span> <a name="l00026"></a>00026 <span class="comment">Andreas Schiffler -- aschiffler at ferzkopp dot net</span> <a name="l00027"></a>00027 <span class="comment"></span> <a name="l00028"></a>00028 <span class="comment">*/</span> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="preprocessor">#include &quot;<a class="code" href="_s_d_l__gfx_blit_func_8h.html">SDL_gfxBlitFunc.h</a>&quot;</span> <a name="l00031"></a>00031 <a name="l00039"></a><a class="code" href="_s_d_l__gfx_blit_func_8h.html#a6d0c17342154e14322a281603960691a">00039</a> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_blit_func_8c.html#a6d0c17342154e14322a281603960691a" title="Alpha adjustment table for custom blitter.">GFX_ALPHA_ADJUST_ARRAY</a>[256] = { <a name="l00040"></a>00040 0, <span class="comment">/* 0 */</span> <a name="l00041"></a>00041 15, <span class="comment">/* 1 */</span> <a name="l00042"></a>00042 22, <span class="comment">/* 2 */</span> <a name="l00043"></a>00043 27, <span class="comment">/* 3 */</span> <a name="l00044"></a>00044 31, <span class="comment">/* 4 */</span> <a name="l00045"></a>00045 35, <span class="comment">/* 5 */</span> <a name="l00046"></a>00046 39, <span class="comment">/* 6 */</span> <a name="l00047"></a>00047 42, <span class="comment">/* 7 */</span> <a name="l00048"></a>00048 45, <span class="comment">/* 8 */</span> <a name="l00049"></a>00049 47, <span class="comment">/* 9 */</span> <a name="l00050"></a>00050 50, <span class="comment">/* 10 */</span> <a name="l00051"></a>00051 52, <span class="comment">/* 11 */</span> <a name="l00052"></a>00052 55, <span class="comment">/* 12 */</span> <a name="l00053"></a>00053 57, <span class="comment">/* 13 */</span> <a name="l00054"></a>00054 59, <span class="comment">/* 14 */</span> <a name="l00055"></a>00055 61, <span class="comment">/* 15 */</span> <a name="l00056"></a>00056 63, <span class="comment">/* 16 */</span> <a name="l00057"></a>00057 65, <span class="comment">/* 17 */</span> <a name="l00058"></a>00058 67, <span class="comment">/* 18 */</span> <a name="l00059"></a>00059 69, <span class="comment">/* 19 */</span> <a name="l00060"></a>00060 71, <span class="comment">/* 20 */</span> <a name="l00061"></a>00061 73, <span class="comment">/* 21 */</span> <a name="l00062"></a>00062 74, <span class="comment">/* 22 */</span> <a name="l00063"></a>00063 76, <span class="comment">/* 23 */</span> <a name="l00064"></a>00064 78, <span class="comment">/* 24 */</span> <a name="l00065"></a>00065 79, <span class="comment">/* 25 */</span> <a name="l00066"></a>00066 81, <span class="comment">/* 26 */</span> <a name="l00067"></a>00067 82, <span class="comment">/* 27 */</span> <a name="l00068"></a>00068 84, <span class="comment">/* 28 */</span> <a name="l00069"></a>00069 85, <span class="comment">/* 29 */</span> <a name="l00070"></a>00070 87, <span class="comment">/* 30 */</span> <a name="l00071"></a>00071 88, <span class="comment">/* 31 */</span> <a name="l00072"></a>00072 90, <span class="comment">/* 32 */</span> <a name="l00073"></a>00073 91, <span class="comment">/* 33 */</span> <a name="l00074"></a>00074 93, <span class="comment">/* 34 */</span> <a name="l00075"></a>00075 94, <span class="comment">/* 35 */</span> <a name="l00076"></a>00076 95, <span class="comment">/* 36 */</span> <a name="l00077"></a>00077 97, <span class="comment">/* 37 */</span> <a name="l00078"></a>00078 98, <span class="comment">/* 38 */</span> <a name="l00079"></a>00079 99, <span class="comment">/* 39 */</span> <a name="l00080"></a>00080 100, <span class="comment">/* 40 */</span> <a name="l00081"></a>00081 102, <span class="comment">/* 41 */</span> <a name="l00082"></a>00082 103, <span class="comment">/* 42 */</span> <a name="l00083"></a>00083 104, <span class="comment">/* 43 */</span> <a name="l00084"></a>00084 105, <span class="comment">/* 44 */</span> <a name="l00085"></a>00085 107, <span class="comment">/* 45 */</span> <a name="l00086"></a>00086 108, <span class="comment">/* 46 */</span> <a name="l00087"></a>00087 109, <span class="comment">/* 47 */</span> <a name="l00088"></a>00088 110, <span class="comment">/* 48 */</span> <a name="l00089"></a>00089 111, <span class="comment">/* 49 */</span> <a name="l00090"></a>00090 112, <span class="comment">/* 50 */</span> <a name="l00091"></a>00091 114, <span class="comment">/* 51 */</span> <a name="l00092"></a>00092 115, <span class="comment">/* 52 */</span> <a name="l00093"></a>00093 116, <span class="comment">/* 53 */</span> <a name="l00094"></a>00094 117, <span class="comment">/* 54 */</span> <a name="l00095"></a>00095 118, <span class="comment">/* 55 */</span> <a name="l00096"></a>00096 119, <span class="comment">/* 56 */</span> <a name="l00097"></a>00097 120, <span class="comment">/* 57 */</span> <a name="l00098"></a>00098 121, <span class="comment">/* 58 */</span> <a name="l00099"></a>00099 122, <span class="comment">/* 59 */</span> <a name="l00100"></a>00100 123, <span class="comment">/* 60 */</span> <a name="l00101"></a>00101 124, <span class="comment">/* 61 */</span> <a name="l00102"></a>00102 125, <span class="comment">/* 62 */</span> <a name="l00103"></a>00103 126, <span class="comment">/* 63 */</span> <a name="l00104"></a>00104 127, <span class="comment">/* 64 */</span> <a name="l00105"></a>00105 128, <span class="comment">/* 65 */</span> <a name="l00106"></a>00106 129, <span class="comment">/* 66 */</span> <a name="l00107"></a>00107 130, <span class="comment">/* 67 */</span> <a name="l00108"></a>00108 131, <span class="comment">/* 68 */</span> <a name="l00109"></a>00109 132, <span class="comment">/* 69 */</span> <a name="l00110"></a>00110 133, <span class="comment">/* 70 */</span> <a name="l00111"></a>00111 134, <span class="comment">/* 71 */</span> <a name="l00112"></a>00112 135, <span class="comment">/* 72 */</span> <a name="l00113"></a>00113 136, <span class="comment">/* 73 */</span> <a name="l00114"></a>00114 137, <span class="comment">/* 74 */</span> <a name="l00115"></a>00115 138, <span class="comment">/* 75 */</span> <a name="l00116"></a>00116 139, <span class="comment">/* 76 */</span> <a name="l00117"></a>00117 140, <span class="comment">/* 77 */</span> <a name="l00118"></a>00118 141, <span class="comment">/* 78 */</span> <a name="l00119"></a>00119 141, <span class="comment">/* 79 */</span> <a name="l00120"></a>00120 142, <span class="comment">/* 80 */</span> <a name="l00121"></a>00121 143, <span class="comment">/* 81 */</span> <a name="l00122"></a>00122 144, <span class="comment">/* 82 */</span> <a name="l00123"></a>00123 145, <span class="comment">/* 83 */</span> <a name="l00124"></a>00124 146, <span class="comment">/* 84 */</span> <a name="l00125"></a>00125 147, <span class="comment">/* 85 */</span> <a name="l00126"></a>00126 148, <span class="comment">/* 86 */</span> <a name="l00127"></a>00127 148, <span class="comment">/* 87 */</span> <a name="l00128"></a>00128 149, <span class="comment">/* 88 */</span> <a name="l00129"></a>00129 150, <span class="comment">/* 89 */</span> <a name="l00130"></a>00130 151, <span class="comment">/* 90 */</span> <a name="l00131"></a>00131 152, <span class="comment">/* 91 */</span> <a name="l00132"></a>00132 153, <span class="comment">/* 92 */</span> <a name="l00133"></a>00133 153, <span class="comment">/* 93 */</span> <a name="l00134"></a>00134 154, <span class="comment">/* 94 */</span> <a name="l00135"></a>00135 155, <span class="comment">/* 95 */</span> <a name="l00136"></a>00136 156, <span class="comment">/* 96 */</span> <a name="l00137"></a>00137 157, <span class="comment">/* 97 */</span> <a name="l00138"></a>00138 158, <span class="comment">/* 98 */</span> <a name="l00139"></a>00139 158, <span class="comment">/* 99 */</span> <a name="l00140"></a>00140 159, <span class="comment">/* 100 */</span> <a name="l00141"></a>00141 160, <span class="comment">/* 101 */</span> <a name="l00142"></a>00142 161, <span class="comment">/* 102 */</span> <a name="l00143"></a>00143 162, <span class="comment">/* 103 */</span> <a name="l00144"></a>00144 162, <span class="comment">/* 104 */</span> <a name="l00145"></a>00145 163, <span class="comment">/* 105 */</span> <a name="l00146"></a>00146 164, <span class="comment">/* 106 */</span> <a name="l00147"></a>00147 165, <span class="comment">/* 107 */</span> <a name="l00148"></a>00148 165, <span class="comment">/* 108 */</span> <a name="l00149"></a>00149 166, <span class="comment">/* 109 */</span> <a name="l00150"></a>00150 167, <span class="comment">/* 110 */</span> <a name="l00151"></a>00151 168, <span class="comment">/* 111 */</span> <a name="l00152"></a>00152 168, <span class="comment">/* 112 */</span> <a name="l00153"></a>00153 169, <span class="comment">/* 113 */</span> <a name="l00154"></a>00154 170, <span class="comment">/* 114 */</span> <a name="l00155"></a>00155 171, <span class="comment">/* 115 */</span> <a name="l00156"></a>00156 171, <span class="comment">/* 116 */</span> <a name="l00157"></a>00157 172, <span class="comment">/* 117 */</span> <a name="l00158"></a>00158 173, <span class="comment">/* 118 */</span> <a name="l00159"></a>00159 174, <span class="comment">/* 119 */</span> <a name="l00160"></a>00160 174, <span class="comment">/* 120 */</span> <a name="l00161"></a>00161 175, <span class="comment">/* 121 */</span> <a name="l00162"></a>00162 176, <span class="comment">/* 122 */</span> <a name="l00163"></a>00163 177, <span class="comment">/* 123 */</span> <a name="l00164"></a>00164 177, <span class="comment">/* 124 */</span> <a name="l00165"></a>00165 178, <span class="comment">/* 125 */</span> <a name="l00166"></a>00166 179, <span class="comment">/* 126 */</span> <a name="l00167"></a>00167 179, <span class="comment">/* 127 */</span> <a name="l00168"></a>00168 180, <span class="comment">/* 128 */</span> <a name="l00169"></a>00169 181, <span class="comment">/* 129 */</span> <a name="l00170"></a>00170 182, <span class="comment">/* 130 */</span> <a name="l00171"></a>00171 182, <span class="comment">/* 131 */</span> <a name="l00172"></a>00172 183, <span class="comment">/* 132 */</span> <a name="l00173"></a>00173 184, <span class="comment">/* 133 */</span> <a name="l00174"></a>00174 184, <span class="comment">/* 134 */</span> <a name="l00175"></a>00175 185, <span class="comment">/* 135 */</span> <a name="l00176"></a>00176 186, <span class="comment">/* 136 */</span> <a name="l00177"></a>00177 186, <span class="comment">/* 137 */</span> <a name="l00178"></a>00178 187, <span class="comment">/* 138 */</span> <a name="l00179"></a>00179 188, <span class="comment">/* 139 */</span> <a name="l00180"></a>00180 188, <span class="comment">/* 140 */</span> <a name="l00181"></a>00181 189, <span class="comment">/* 141 */</span> <a name="l00182"></a>00182 190, <span class="comment">/* 142 */</span> <a name="l00183"></a>00183 190, <span class="comment">/* 143 */</span> <a name="l00184"></a>00184 191, <span class="comment">/* 144 */</span> <a name="l00185"></a>00185 192, <span class="comment">/* 145 */</span> <a name="l00186"></a>00186 192, <span class="comment">/* 146 */</span> <a name="l00187"></a>00187 193, <span class="comment">/* 147 */</span> <a name="l00188"></a>00188 194, <span class="comment">/* 148 */</span> <a name="l00189"></a>00189 194, <span class="comment">/* 149 */</span> <a name="l00190"></a>00190 195, <span class="comment">/* 150 */</span> <a name="l00191"></a>00191 196, <span class="comment">/* 151 */</span> <a name="l00192"></a>00192 196, <span class="comment">/* 152 */</span> <a name="l00193"></a>00193 197, <span class="comment">/* 153 */</span> <a name="l00194"></a>00194 198, <span class="comment">/* 154 */</span> <a name="l00195"></a>00195 198, <span class="comment">/* 155 */</span> <a name="l00196"></a>00196 199, <span class="comment">/* 156 */</span> <a name="l00197"></a>00197 200, <span class="comment">/* 157 */</span> <a name="l00198"></a>00198 200, <span class="comment">/* 158 */</span> <a name="l00199"></a>00199 201, <span class="comment">/* 159 */</span> <a name="l00200"></a>00200 201, <span class="comment">/* 160 */</span> <a name="l00201"></a>00201 202, <span class="comment">/* 161 */</span> <a name="l00202"></a>00202 203, <span class="comment">/* 162 */</span> <a name="l00203"></a>00203 203, <span class="comment">/* 163 */</span> <a name="l00204"></a>00204 204, <span class="comment">/* 164 */</span> <a name="l00205"></a>00205 205, <span class="comment">/* 165 */</span> <a name="l00206"></a>00206 205, <span class="comment">/* 166 */</span> <a name="l00207"></a>00207 206, <span class="comment">/* 167 */</span> <a name="l00208"></a>00208 206, <span class="comment">/* 168 */</span> <a name="l00209"></a>00209 207, <span class="comment">/* 169 */</span> <a name="l00210"></a>00210 208, <span class="comment">/* 170 */</span> <a name="l00211"></a>00211 208, <span class="comment">/* 171 */</span> <a name="l00212"></a>00212 209, <span class="comment">/* 172 */</span> <a name="l00213"></a>00213 210, <span class="comment">/* 173 */</span> <a name="l00214"></a>00214 210, <span class="comment">/* 174 */</span> <a name="l00215"></a>00215 211, <span class="comment">/* 175 */</span> <a name="l00216"></a>00216 211, <span class="comment">/* 176 */</span> <a name="l00217"></a>00217 212, <span class="comment">/* 177 */</span> <a name="l00218"></a>00218 213, <span class="comment">/* 178 */</span> <a name="l00219"></a>00219 213, <span class="comment">/* 179 */</span> <a name="l00220"></a>00220 214, <span class="comment">/* 180 */</span> <a name="l00221"></a>00221 214, <span class="comment">/* 181 */</span> <a name="l00222"></a>00222 215, <span class="comment">/* 182 */</span> <a name="l00223"></a>00223 216, <span class="comment">/* 183 */</span> <a name="l00224"></a>00224 216, <span class="comment">/* 184 */</span> <a name="l00225"></a>00225 217, <span class="comment">/* 185 */</span> <a name="l00226"></a>00226 217, <span class="comment">/* 186 */</span> <a name="l00227"></a>00227 218, <span class="comment">/* 187 */</span> <a name="l00228"></a>00228 218, <span class="comment">/* 188 */</span> <a name="l00229"></a>00229 219, <span class="comment">/* 189 */</span> <a name="l00230"></a>00230 220, <span class="comment">/* 190 */</span> <a name="l00231"></a>00231 220, <span class="comment">/* 191 */</span> <a name="l00232"></a>00232 221, <span class="comment">/* 192 */</span> <a name="l00233"></a>00233 221, <span class="comment">/* 193 */</span> <a name="l00234"></a>00234 222, <span class="comment">/* 194 */</span> <a name="l00235"></a>00235 222, <span class="comment">/* 195 */</span> <a name="l00236"></a>00236 223, <span class="comment">/* 196 */</span> <a name="l00237"></a>00237 224, <span class="comment">/* 197 */</span> <a name="l00238"></a>00238 224, <span class="comment">/* 198 */</span> <a name="l00239"></a>00239 225, <span class="comment">/* 199 */</span> <a name="l00240"></a>00240 225, <span class="comment">/* 200 */</span> <a name="l00241"></a>00241 226, <span class="comment">/* 201 */</span> <a name="l00242"></a>00242 226, <span class="comment">/* 202 */</span> <a name="l00243"></a>00243 227, <span class="comment">/* 203 */</span> <a name="l00244"></a>00244 228, <span class="comment">/* 204 */</span> <a name="l00245"></a>00245 228, <span class="comment">/* 205 */</span> <a name="l00246"></a>00246 229, <span class="comment">/* 206 */</span> <a name="l00247"></a>00247 229, <span class="comment">/* 207 */</span> <a name="l00248"></a>00248 230, <span class="comment">/* 208 */</span> <a name="l00249"></a>00249 230, <span class="comment">/* 209 */</span> <a name="l00250"></a>00250 231, <span class="comment">/* 210 */</span> <a name="l00251"></a>00251 231, <span class="comment">/* 211 */</span> <a name="l00252"></a>00252 232, <span class="comment">/* 212 */</span> <a name="l00253"></a>00253 233, <span class="comment">/* 213 */</span> <a name="l00254"></a>00254 233, <span class="comment">/* 214 */</span> <a name="l00255"></a>00255 234, <span class="comment">/* 215 */</span> <a name="l00256"></a>00256 234, <span class="comment">/* 216 */</span> <a name="l00257"></a>00257 235, <span class="comment">/* 217 */</span> <a name="l00258"></a>00258 235, <span class="comment">/* 218 */</span> <a name="l00259"></a>00259 236, <span class="comment">/* 219 */</span> <a name="l00260"></a>00260 236, <span class="comment">/* 220 */</span> <a name="l00261"></a>00261 237, <span class="comment">/* 221 */</span> <a name="l00262"></a>00262 237, <span class="comment">/* 222 */</span> <a name="l00263"></a>00263 238, <span class="comment">/* 223 */</span> <a name="l00264"></a>00264 238, <span class="comment">/* 224 */</span> <a name="l00265"></a>00265 239, <span class="comment">/* 225 */</span> <a name="l00266"></a>00266 240, <span class="comment">/* 226 */</span> <a name="l00267"></a>00267 240, <span class="comment">/* 227 */</span> <a name="l00268"></a>00268 241, <span class="comment">/* 228 */</span> <a name="l00269"></a>00269 241, <span class="comment">/* 229 */</span> <a name="l00270"></a>00270 242, <span class="comment">/* 230 */</span> <a name="l00271"></a>00271 242, <span class="comment">/* 231 */</span> <a name="l00272"></a>00272 243, <span class="comment">/* 232 */</span> <a name="l00273"></a>00273 243, <span class="comment">/* 233 */</span> <a name="l00274"></a>00274 244, <span class="comment">/* 234 */</span> <a name="l00275"></a>00275 244, <span class="comment">/* 235 */</span> <a name="l00276"></a>00276 245, <span class="comment">/* 236 */</span> <a name="l00277"></a>00277 245, <span class="comment">/* 237 */</span> <a name="l00278"></a>00278 246, <span class="comment">/* 238 */</span> <a name="l00279"></a>00279 246, <span class="comment">/* 239 */</span> <a name="l00280"></a>00280 247, <span class="comment">/* 240 */</span> <a name="l00281"></a>00281 247, <span class="comment">/* 241 */</span> <a name="l00282"></a>00282 248, <span class="comment">/* 242 */</span> <a name="l00283"></a>00283 248, <span class="comment">/* 243 */</span> <a name="l00284"></a>00284 249, <span class="comment">/* 244 */</span> <a name="l00285"></a>00285 249, <span class="comment">/* 245 */</span> <a name="l00286"></a>00286 250, <span class="comment">/* 246 */</span> <a name="l00287"></a>00287 250, <span class="comment">/* 247 */</span> <a name="l00288"></a>00288 251, <span class="comment">/* 248 */</span> <a name="l00289"></a>00289 251, <span class="comment">/* 249 */</span> <a name="l00290"></a>00290 252, <span class="comment">/* 250 */</span> <a name="l00291"></a>00291 252, <span class="comment">/* 251 */</span> <a name="l00292"></a>00292 253, <span class="comment">/* 252 */</span> <a name="l00293"></a>00293 253, <span class="comment">/* 253 */</span> <a name="l00294"></a>00294 254, <span class="comment">/* 254 */</span> <a name="l00295"></a>00295 255 <span class="comment">/* 255 */</span> <a name="l00296"></a>00296 }; <a name="l00297"></a>00297 <a name="l00306"></a><a class="code" href="_s_d_l__gfx_blit_func_8c.html#a7ec9cde56a58eee4e6182c32dd8cbee7">00306</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__gfx_blit_func_8c.html#a7ec9cde56a58eee4e6182c32dd8cbee7" title="Internal blitter using adjusted destination alpha during RGBA-&gt;RGBA blits.">_SDL_gfxBlitBlitterRGBA</a>(<a class="code" href="struct_s_d_l__gfx_blit_info.html" title="The structure passed to the low level blit functions.">SDL_gfxBlitInfo</a> * info) <a name="l00307"></a>00307 { <a name="l00308"></a>00308 <span class="keywordtype">int</span> width = info-&gt;<a class="code" href="struct_s_d_l__gfx_blit_info.html#ad49412925c79a9894ea598530ea39b00">d_width</a>; <a name="l00309"></a>00309 <span class="keywordtype">int</span> height = info-&gt;<a class="code" href="struct_s_d_l__gfx_blit_info.html#ad31494204fdd3d2cb30faba527cfb9fa">d_height</a>; <a name="l00310"></a>00310 Uint8 *src = info-&gt;<a class="code" href="struct_s_d_l__gfx_blit_info.html#a03dd1de15b100cd491eff7d823284189">s_pixels</a>; <a name="l00311"></a>00311 <span class="keywordtype">int</span> srcskip = info-&gt;<a class="code" href="struct_s_d_l__gfx_blit_info.html#a25b822e4773e1db6d38aadc5c0bb126f">s_skip</a>; <a name="l00312"></a>00312 Uint8 *dst = info-&gt;<a class="code" href="struct_s_d_l__gfx_blit_info.html#ae9146d0f8b236274984127a7a1528966">d_pixels</a>; <a name="l00313"></a>00313 <span class="keywordtype">int</span> dstskip = info-&gt;<a class="code" href="struct_s_d_l__gfx_blit_info.html#a9055858de99c49d16ef903fed31715b7">d_skip</a>; <a name="l00314"></a>00314 SDL_PixelFormat *srcfmt = info-&gt;<a class="code" href="struct_s_d_l__gfx_blit_info.html#a1ce90142d08a06fede5e2a13d66d17f6">src</a>; <a name="l00315"></a>00315 SDL_PixelFormat *dstfmt = info-&gt;<a class="code" href="struct_s_d_l__gfx_blit_info.html#a177d476cb937246853b74253490436db">dst</a>; <a name="l00316"></a>00316 Uint8 srcbpp = srcfmt-&gt;BytesPerPixel; <a name="l00317"></a>00317 Uint8 dstbpp = dstfmt-&gt;BytesPerPixel; <a name="l00318"></a>00318 <a name="l00319"></a>00319 <span class="keywordflow">while</span> (height--) { <a name="l00320"></a>00320 <a class="code" href="_s_d_l__gfx_blit_func_8h.html#a44c498dca765a515f40eecad8f19aac4" title="4-times unrolled DUFFs loop.">GFX_DUFFS_LOOP4</a>( { <a name="l00321"></a>00321 Uint32 pixel; <a name="l00322"></a>00322 <span class="keywordtype">unsigned</span> sR; <a name="l00323"></a>00323 <span class="keywordtype">unsigned</span> sG; <a name="l00324"></a>00324 <span class="keywordtype">unsigned</span> sB; <a name="l00325"></a>00325 <span class="keywordtype">unsigned</span> sA; <a name="l00326"></a>00326 <span class="keywordtype">unsigned</span> dR; <a name="l00327"></a>00327 <span class="keywordtype">unsigned</span> dG; <a name="l00328"></a>00328 <span class="keywordtype">unsigned</span> dB; <a name="l00329"></a>00329 <span class="keywordtype">unsigned</span> dA; <a name="l00330"></a>00330 <span class="keywordtype">unsigned</span> sAA; <a name="l00331"></a>00331 <a class="code" href="_s_d_l__gfx_blit_func_8h.html#a7dda3984ca04929e2ea0a3679f7452a9" title="Disassemble buffer pointer into a pixel and separate RGBA values.">GFX_DISASSEMBLE_RGBA</a>(src, srcbpp, srcfmt, pixel, sR, sG, sB, sA); <a name="l00332"></a>00332 <a class="code" href="_s_d_l__gfx_blit_func_8h.html#a7dda3984ca04929e2ea0a3679f7452a9" title="Disassemble buffer pointer into a pixel and separate RGBA values.">GFX_DISASSEMBLE_RGBA</a>(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA); <a name="l00333"></a>00333 sAA=<a class="code" href="_s_d_l__gfx_blit_func_8c.html#a6d0c17342154e14322a281603960691a" title="Alpha adjustment table for custom blitter.">GFX_ALPHA_ADJUST_ARRAY</a>[sA &amp; 255]; <a name="l00334"></a>00334 <a class="code" href="_s_d_l__gfx_blit_func_8h.html#ae3efb9e67172838c394c148a62822da6" title="Blend the RGB values of two pixels based on a source alpha value.">GFX_ALPHA_BLEND</a>(sR, sG, sB, sAA, dR, dG, dB); <a name="l00335"></a>00335 dA |= sAA; <a name="l00336"></a>00336 <a class="code" href="_s_d_l__gfx_blit_func_8h.html#a4e59f926fb98a86c01a4ffc5cc20e8d5" title="Assemble pixel into buffer pointer from separate RGBA values.">GFX_ASSEMBLE_RGBA</a>(dst, dstbpp, dstfmt, dR, dG, dB, dA); <a name="l00337"></a>00337 src += srcbpp; dst += dstbpp; <a name="l00338"></a>00338 }, width); <a name="l00339"></a>00339 src += srcskip; <a name="l00340"></a>00340 dst += dstskip; <a name="l00341"></a>00341 } <a name="l00342"></a>00342 } <a name="l00343"></a>00343 <a name="l00356"></a><a class="code" href="_s_d_l__gfx_blit_func_8c.html#a9375eac21cc799258f971034a3be57b5">00356</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_blit_func_8c.html#a9375eac21cc799258f971034a3be57b5" title="Internal blitter setup wrapper for RGBA-&gt;RGBA blits.">_SDL_gfxBlitRGBACall</a>(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect) <a name="l00357"></a>00357 { <a name="l00358"></a>00358 <span class="comment">/*</span> <a name="l00359"></a>00359 <span class="comment"> * Set up source and destination buffer pointers, then blit </span> <a name="l00360"></a>00360 <span class="comment"> */</span> <a name="l00361"></a>00361 <span class="keywordflow">if</span> (srcrect-&gt;w &amp;&amp; srcrect-&gt;h) { <a name="l00362"></a>00362 <a class="code" href="struct_s_d_l__gfx_blit_info.html" title="The structure passed to the low level blit functions.">SDL_gfxBlitInfo</a> info; <a name="l00363"></a>00363 <a name="l00364"></a>00364 <span class="comment">/*</span> <a name="l00365"></a>00365 <span class="comment"> * Set up the blit information </span> <a name="l00366"></a>00366 <span class="comment"> */</span> <a name="l00367"></a>00367 <span class="preprocessor">#if (SDL_MINOR_VERSION == 3)</span> <a name="l00368"></a>00368 <span class="preprocessor"></span> info.<a class="code" href="struct_s_d_l__gfx_blit_info.html#a03dd1de15b100cd491eff7d823284189">s_pixels</a> = (Uint8 *) src-&gt;pixels + (Uint16) srcrect-&gt;y * src-&gt;pitch + (Uint16) srcrect-&gt;x * src-&gt;format-&gt;BytesPerPixel; <a name="l00369"></a>00369 #<span class="keywordflow">else</span> <a name="l00370"></a>00370 info.<a class="code" href="struct_s_d_l__gfx_blit_info.html#a03dd1de15b100cd491eff7d823284189">s_pixels</a> = (Uint8 *) src-&gt;pixels + src-&gt;offset + (Uint16) srcrect-&gt;y * src-&gt;pitch + (Uint16) srcrect-&gt;x * src-&gt;format-&gt;BytesPerPixel; <a name="l00371"></a>00371 <span class="preprocessor">#endif</span> <a name="l00372"></a>00372 <span class="preprocessor"></span> info.<a class="code" href="struct_s_d_l__gfx_blit_info.html#ad2f7fa9a764e75639fdb6e3b0f8a68fc">s_width</a> = srcrect-&gt;w; <a name="l00373"></a>00373 info.<a class="code" href="struct_s_d_l__gfx_blit_info.html#aeeec65f001e54fb93ba97cb85cb61592">s_height</a> = srcrect-&gt;h; <a name="l00374"></a>00374 info.<a class="code" href="struct_s_d_l__gfx_blit_info.html#a25b822e4773e1db6d38aadc5c0bb126f">s_skip</a> = (int)(src-&gt;pitch - info.<a class="code" href="struct_s_d_l__gfx_blit_info.html#ad2f7fa9a764e75639fdb6e3b0f8a68fc">s_width</a> * src-&gt;format-&gt;BytesPerPixel); <a name="l00375"></a>00375 <span class="preprocessor">#if (SDL_MINOR_VERSION == 3)</span> <a name="l00376"></a>00376 <span class="preprocessor"></span> info.<a class="code" href="struct_s_d_l__gfx_blit_info.html#ae9146d0f8b236274984127a7a1528966">d_pixels</a> = (Uint8 *) dst-&gt;pixels + (Uint16) dstrect-&gt;y * dst-&gt;pitch + (Uint16) dstrect-&gt;x * dst-&gt;format-&gt;BytesPerPixel; <a name="l00377"></a>00377 #<span class="keywordflow">else</span> <a name="l00378"></a>00378 info.<a class="code" href="struct_s_d_l__gfx_blit_info.html#ae9146d0f8b236274984127a7a1528966">d_pixels</a> = (Uint8 *) dst-&gt;pixels + dst-&gt;offset + (Uint16) dstrect-&gt;y * dst-&gt;pitch + (Uint16) dstrect-&gt;x * dst-&gt;format-&gt;BytesPerPixel; <a name="l00379"></a>00379 <span class="preprocessor">#endif</span> <a name="l00380"></a>00380 <span class="preprocessor"></span> info.<a class="code" href="struct_s_d_l__gfx_blit_info.html#ad49412925c79a9894ea598530ea39b00">d_width</a> = dstrect-&gt;w; <a name="l00381"></a>00381 info.<a class="code" href="struct_s_d_l__gfx_blit_info.html#ad31494204fdd3d2cb30faba527cfb9fa">d_height</a> = dstrect-&gt;h; <a name="l00382"></a>00382 info.<a class="code" href="struct_s_d_l__gfx_blit_info.html#a9055858de99c49d16ef903fed31715b7">d_skip</a> = (int)(dst-&gt;pitch - info.<a class="code" href="struct_s_d_l__gfx_blit_info.html#ad49412925c79a9894ea598530ea39b00">d_width</a> * dst-&gt;format-&gt;BytesPerPixel); <a name="l00383"></a>00383 info.<a class="code" href="struct_s_d_l__gfx_blit_info.html#a4b938ad61daa0a9625c6892fd46f32a2">aux_data</a> = NULL; <a name="l00384"></a>00384 info.<a class="code" href="struct_s_d_l__gfx_blit_info.html#a1ce90142d08a06fede5e2a13d66d17f6">src</a> = src-&gt;format; <a name="l00385"></a>00385 info.<a class="code" href="struct_s_d_l__gfx_blit_info.html#a9596f5ea6998964e6240fae7ac17ce1e">table</a> = NULL; <a name="l00386"></a>00386 info.<a class="code" href="struct_s_d_l__gfx_blit_info.html#a177d476cb937246853b74253490436db">dst</a> = dst-&gt;format; <a name="l00387"></a>00387 <a name="l00388"></a>00388 <span class="comment">/*</span> <a name="l00389"></a>00389 <span class="comment"> * Run the actual software blitter </span> <a name="l00390"></a>00390 <span class="comment"> */</span> <a name="l00391"></a>00391 <a class="code" href="_s_d_l__gfx_blit_func_8c.html#a7ec9cde56a58eee4e6182c32dd8cbee7" title="Internal blitter using adjusted destination alpha during RGBA-&gt;RGBA blits.">_SDL_gfxBlitBlitterRGBA</a>(&amp;info); <a name="l00392"></a>00392 <span class="keywordflow">return</span> 1; <a name="l00393"></a>00393 } <a name="l00394"></a>00394 <a name="l00395"></a>00395 <span class="keywordflow">return</span> (0); <a name="l00396"></a>00396 } <a name="l00397"></a>00397 <a name="l00411"></a><a class="code" href="_s_d_l__gfx_blit_func_8h.html#ab49c560e89b8305051b2e6b347215f03">00411</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_blit_func_8c.html#ac51ff40d39f3dd0bd08116e8953960f8" title="Blitter for RGBA-&gt;RGBA blits with alpha adjustment.">SDL_gfxBlitRGBA</a>(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect) <a name="l00412"></a>00412 { <a name="l00413"></a>00413 SDL_Rect sr, dr; <a name="l00414"></a>00414 <span class="keywordtype">int</span> srcx, srcy, w, h; <a name="l00415"></a>00415 <a name="l00416"></a>00416 <span class="comment">/*</span> <a name="l00417"></a>00417 <span class="comment"> * Make sure the surfaces aren&#39;t locked </span> <a name="l00418"></a>00418 <span class="comment"> */</span> <a name="l00419"></a>00419 <span class="keywordflow">if</span> (!src || !dst) { <a name="l00420"></a>00420 SDL_SetError(<span class="stringliteral">&quot;SDL_UpperBlit: passed a NULL surface&quot;</span>); <a name="l00421"></a>00421 <span class="keywordflow">return</span> (-1); <a name="l00422"></a>00422 } <a name="l00423"></a>00423 <span class="keywordflow">if</span> ((src-&gt;locked) || (dst-&gt;locked)) { <a name="l00424"></a>00424 SDL_SetError(<span class="stringliteral">&quot;Surfaces must not be locked during blit&quot;</span>); <a name="l00425"></a>00425 <span class="keywordflow">return</span> (-1); <a name="l00426"></a>00426 } <a name="l00427"></a>00427 <a name="l00428"></a>00428 <span class="comment">/*</span> <a name="l00429"></a>00429 <span class="comment"> * If the destination rectangle is NULL, use the entire dest surface </span> <a name="l00430"></a>00430 <span class="comment"> */</span> <a name="l00431"></a>00431 <span class="keywordflow">if</span> (dstrect == NULL) { <a name="l00432"></a>00432 dr.x = dr.y = 0; <a name="l00433"></a>00433 dr.w = dst-&gt;w; <a name="l00434"></a>00434 dr.h = dst-&gt;h; <a name="l00435"></a>00435 } <span class="keywordflow">else</span> { <a name="l00436"></a>00436 dr = *dstrect; <a name="l00437"></a>00437 } <a name="l00438"></a>00438 <a name="l00439"></a>00439 <span class="comment">/*</span> <a name="l00440"></a>00440 <span class="comment"> * Clip the source rectangle to the source surface </span> <a name="l00441"></a>00441 <span class="comment"> */</span> <a name="l00442"></a>00442 <span class="keywordflow">if</span> (srcrect) { <a name="l00443"></a>00443 <span class="keywordtype">int</span> maxw, maxh; <a name="l00444"></a>00444 <a name="l00445"></a>00445 srcx = srcrect-&gt;x; <a name="l00446"></a>00446 w = srcrect-&gt;w; <a name="l00447"></a>00447 <span class="keywordflow">if</span> (srcx &lt; 0) { <a name="l00448"></a>00448 w += srcx; <a name="l00449"></a>00449 dr.x -= srcx; <a name="l00450"></a>00450 srcx = 0; <a name="l00451"></a>00451 } <a name="l00452"></a>00452 maxw = src-&gt;w - srcx; <a name="l00453"></a>00453 <span class="keywordflow">if</span> (maxw &lt; w) <a name="l00454"></a>00454 w = maxw; <a name="l00455"></a>00455 <a name="l00456"></a>00456 srcy = srcrect-&gt;y; <a name="l00457"></a>00457 h = srcrect-&gt;h; <a name="l00458"></a>00458 <span class="keywordflow">if</span> (srcy &lt; 0) { <a name="l00459"></a>00459 h += srcy; <a name="l00460"></a>00460 dr.y -= srcy; <a name="l00461"></a>00461 srcy = 0; <a name="l00462"></a>00462 } <a name="l00463"></a>00463 maxh = src-&gt;h - srcy; <a name="l00464"></a>00464 <span class="keywordflow">if</span> (maxh &lt; h) <a name="l00465"></a>00465 h = maxh; <a name="l00466"></a>00466 <a name="l00467"></a>00467 } <span class="keywordflow">else</span> { <a name="l00468"></a>00468 srcx = srcy = 0; <a name="l00469"></a>00469 w = src-&gt;w; <a name="l00470"></a>00470 h = src-&gt;h; <a name="l00471"></a>00471 } <a name="l00472"></a>00472 <a name="l00473"></a>00473 <span class="comment">/*</span> <a name="l00474"></a>00474 <span class="comment"> * Clip the destination rectangle against the clip rectangle </span> <a name="l00475"></a>00475 <span class="comment"> */</span> <a name="l00476"></a>00476 { <a name="l00477"></a>00477 SDL_Rect *clip = &amp;dst-&gt;clip_rect; <a name="l00478"></a>00478 <span class="keywordtype">int</span> dx, dy; <a name="l00479"></a>00479 <a name="l00480"></a>00480 dx = clip-&gt;x - dr.x; <a name="l00481"></a>00481 <span class="keywordflow">if</span> (dx &gt; 0) { <a name="l00482"></a>00482 w -= dx; <a name="l00483"></a>00483 dr.x += dx; <a name="l00484"></a>00484 srcx += dx; <a name="l00485"></a>00485 } <a name="l00486"></a>00486 dx = dr.x + w - clip-&gt;x - clip-&gt;w; <a name="l00487"></a>00487 <span class="keywordflow">if</span> (dx &gt; 0) <a name="l00488"></a>00488 w -= dx; <a name="l00489"></a>00489 <a name="l00490"></a>00490 dy = clip-&gt;y - dr.y; <a name="l00491"></a>00491 <span class="keywordflow">if</span> (dy &gt; 0) { <a name="l00492"></a>00492 h -= dy; <a name="l00493"></a>00493 dr.y += dy; <a name="l00494"></a>00494 srcy += dy; <a name="l00495"></a>00495 } <a name="l00496"></a>00496 dy = dr.y + h - clip-&gt;y - clip-&gt;h; <a name="l00497"></a>00497 <span class="keywordflow">if</span> (dy &gt; 0) <a name="l00498"></a>00498 h -= dy; <a name="l00499"></a>00499 } <a name="l00500"></a>00500 <a name="l00501"></a>00501 <span class="keywordflow">if</span> (w &gt; 0 &amp;&amp; h &gt; 0) { <a name="l00502"></a>00502 sr.x = srcx; <a name="l00503"></a>00503 sr.y = srcy; <a name="l00504"></a>00504 sr.w = dr.w = w; <a name="l00505"></a>00505 sr.h = dr.h = h; <a name="l00506"></a>00506 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_blit_func_8c.html#a9375eac21cc799258f971034a3be57b5" title="Internal blitter setup wrapper for RGBA-&gt;RGBA blits.">_SDL_gfxBlitRGBACall</a>(src, &amp;sr, dst, &amp;dr)); <a name="l00507"></a>00507 } <a name="l00508"></a>00508 <a name="l00509"></a>00509 <span class="keywordflow">return</span> 0; <a name="l00510"></a>00510 } <a name="l00511"></a>00511 <a name="l00524"></a><a class="code" href="_s_d_l__gfx_blit_func_8h.html#a4627ae4a0037d0b248bed87f3c294735">00524</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_blit_func_8c.html#a09a376775f9d8c933c7121e34fe5ecfc" title="Sets the alpha channel in a 32 bit surface.">SDL_gfxSetAlpha</a>(SDL_Surface *src, Uint8 a) <a name="l00525"></a>00525 { <a name="l00526"></a>00526 <span class="preprocessor">#if SDL_BYTEORDER == SDL_BIG_ENDIAN</span> <a name="l00527"></a>00527 <span class="preprocessor"></span> <span class="keyword">const</span> <span class="keywordtype">int</span> alpha_offset = 0; <a name="l00528"></a>00528 <span class="preprocessor">#else</span> <a name="l00529"></a>00529 <span class="preprocessor"></span> <span class="keyword">const</span> <span class="keywordtype">int</span> alpha_offset = 3; <a name="l00530"></a>00530 <span class="preprocessor">#endif</span> <a name="l00531"></a>00531 <span class="preprocessor"></span> <span class="keywordtype">int</span> i, j, row_skip; <a name="l00532"></a>00532 Uint8 *pixels; <a name="l00533"></a>00533 <a name="l00534"></a>00534 <span class="comment">/* Check if we have a 32bit surface */</span> <a name="l00535"></a>00535 <span class="keywordflow">if</span> ( (src==NULL) || <a name="l00536"></a>00536 (src-&gt;format==NULL) || <a name="l00537"></a>00537 (src-&gt;format-&gt;BytesPerPixel!=4) ) { <a name="l00538"></a>00538 SDL_SetError(<span class="stringliteral">&quot;SDL_gfxSetAlpha: Invalid input surface.&quot;</span>); <a name="l00539"></a>00539 <span class="keywordflow">return</span> -1; <a name="l00540"></a>00540 } <a name="l00541"></a>00541 <a name="l00542"></a>00542 <span class="comment">/*</span> <a name="l00543"></a>00543 <span class="comment"> * Lock the surface </span> <a name="l00544"></a>00544 <span class="comment"> */</span> <a name="l00545"></a>00545 <span class="keywordflow">if</span> (SDL_MUSTLOCK(src)) { <a name="l00546"></a>00546 <span class="keywordflow">if</span> (SDL_LockSurface(src) &lt; 0) { <a name="l00547"></a>00547 <span class="keywordflow">return</span> (-1); <a name="l00548"></a>00548 } <a name="l00549"></a>00549 } <a name="l00550"></a>00550 <a name="l00551"></a>00551 <span class="comment">/* Process */</span> <a name="l00552"></a>00552 pixels = (Uint8 *)src-&gt;pixels; <a name="l00553"></a>00553 row_skip = (src-&gt;pitch - (4*src-&gt;w)); <a name="l00554"></a>00554 pixels += alpha_offset; <a name="l00555"></a>00555 <span class="keywordflow">for</span> ( i=0; i&lt;src-&gt;h; i++ ) { <a name="l00556"></a>00556 <span class="keywordflow">for</span> ( j=0; j&lt;src-&gt;w; j++ ) { <a name="l00557"></a>00557 *pixels = a; <a name="l00558"></a>00558 pixels += 4; <a name="l00559"></a>00559 } <a name="l00560"></a>00560 pixels += row_skip; <a name="l00561"></a>00561 } <a name="l00562"></a>00562 <a name="l00563"></a>00563 <span class="comment">/*</span> <a name="l00564"></a>00564 <span class="comment"> * Unlock surface </span> <a name="l00565"></a>00565 <span class="comment"> */</span> <a name="l00566"></a>00566 <span class="keywordflow">if</span> (SDL_MUSTLOCK(src)) { <a name="l00567"></a>00567 SDL_UnlockSurface(src); <a name="l00568"></a>00568 } <a name="l00569"></a>00569 <a name="l00570"></a>00570 <span class="keywordflow">return</span> 1; <a name="l00571"></a>00571 } <a name="l00572"></a>00572 <a name="l00587"></a><a class="code" href="_s_d_l__gfx_blit_func_8h.html#a7c93594525ae349b5cef0156b8f758fc">00587</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_blit_func_8c.html#a4ece530dca0ae46b1f5a780f85371687" title="Multiply the alpha channel in a 32bit surface.">SDL_gfxMultiplyAlpha</a>(SDL_Surface *src, Uint8 a) <a name="l00588"></a>00588 { <a name="l00589"></a>00589 <span class="preprocessor">#if SDL_BYTEORDER == SDL_BIG_ENDIAN</span> <a name="l00590"></a>00590 <span class="preprocessor"></span> <span class="keyword">const</span> <span class="keywordtype">int</span> alpha_offset = 0; <a name="l00591"></a>00591 <span class="preprocessor">#else</span> <a name="l00592"></a>00592 <span class="preprocessor"></span> <span class="keyword">const</span> <span class="keywordtype">int</span> alpha_offset = 3; <a name="l00593"></a>00593 <span class="preprocessor">#endif</span> <a name="l00594"></a>00594 <span class="preprocessor"></span> <span class="keywordtype">int</span> i, j, row_skip; <a name="l00595"></a>00595 Uint8 *pixels; <a name="l00596"></a>00596 <a name="l00597"></a>00597 <span class="comment">/* Check if we have a 32bit surface */</span> <a name="l00598"></a>00598 <span class="keywordflow">if</span> ( (src==NULL) || <a name="l00599"></a>00599 (src-&gt;format==NULL) || <a name="l00600"></a>00600 (src-&gt;format-&gt;BytesPerPixel!=4) ) { <a name="l00601"></a>00601 SDL_SetError(<span class="stringliteral">&quot;SDL_gfxMultiplyAlpha: Invalid input surface.&quot;</span>); <a name="l00602"></a>00602 <span class="keywordflow">return</span> -1; <a name="l00603"></a>00603 } <a name="l00604"></a>00604 <a name="l00605"></a>00605 <span class="comment">/* Check if multiplication is needed */</span> <a name="l00606"></a>00606 <span class="keywordflow">if</span> (a==255) { <a name="l00607"></a>00607 <span class="keywordflow">return</span> 0; <a name="l00608"></a>00608 } <a name="l00609"></a>00609 <a name="l00610"></a>00610 <span class="comment">/*</span> <a name="l00611"></a>00611 <span class="comment"> * Lock the surface </span> <a name="l00612"></a>00612 <span class="comment"> */</span> <a name="l00613"></a>00613 <span class="keywordflow">if</span> (SDL_MUSTLOCK(src)) { <a name="l00614"></a>00614 <span class="keywordflow">if</span> (SDL_LockSurface(src) &lt; 0) { <a name="l00615"></a>00615 <span class="keywordflow">return</span> (-1); <a name="l00616"></a>00616 } <a name="l00617"></a>00617 } <a name="l00618"></a>00618 <a name="l00619"></a>00619 <span class="comment">/* Process */</span> <a name="l00620"></a>00620 pixels = (Uint8 *)src-&gt;pixels; <a name="l00621"></a>00621 row_skip = (src-&gt;pitch - (4*src-&gt;w)); <a name="l00622"></a>00622 pixels += alpha_offset; <a name="l00623"></a>00623 <span class="keywordflow">for</span> ( i=0; i&lt;src-&gt;h; i++ ) { <a name="l00624"></a>00624 <span class="keywordflow">for</span> ( j=0; j&lt;src-&gt;w; j++ ) { <a name="l00625"></a>00625 *pixels = (Uint8)(((<span class="keywordtype">int</span>)(*pixels)*a)&gt;&gt;8); <a name="l00626"></a>00626 pixels += 4; <a name="l00627"></a>00627 } <a name="l00628"></a>00628 pixels += row_skip; <a name="l00629"></a>00629 } <a name="l00630"></a>00630 <a name="l00631"></a>00631 <span class="comment">/*</span> <a name="l00632"></a>00632 <span class="comment"> * Unlock surface </span> <a name="l00633"></a>00633 <span class="comment"> */</span> <a name="l00634"></a>00634 <span class="keywordflow">if</span> (SDL_MUSTLOCK(src)) { <a name="l00635"></a>00635 SDL_UnlockSurface(src); <a name="l00636"></a>00636 } <a name="l00637"></a>00637 <a name="l00638"></a>00638 <span class="keywordflow">return</span> 1; <a name="l00639"></a>00639 } </pre></div></div><!-- contents --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.0 </small></address> </body> </html>
YifuLiu/AliOS-Things
components/SDL2/src/gfx/Docs/html/_s_d_l__gfx_blit_func_8c_source.html
HTML
apache-2.0
51,604
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>SDL_gfx: I:/Sources/sdlgfx/SDL_gfxBlitFunc.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SDL_gfx &#160;<span id="projectnumber">2.0.25</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.8.0 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#nested-classes">Data Structures</a> &#124; <a href="#define-members">Defines</a> &#124; <a href="#func-members">Functions</a> &#124; <a href="#var-members">Variables</a> </div> <div class="headertitle"> <div class="title">I:/Sources/sdlgfx/SDL_gfxBlitFunc.h File Reference</div> </div> </div><!--header--> <div class="contents"> <div class="textblock"><code>#include &lt;stdio.h&gt;</code><br/> <code>#include &lt;stdlib.h&gt;</code><br/> <code>#include &quot;SDL.h&quot;</code><br/> <code>#include &quot;SDL_video.h&quot;</code><br/> </div> <p><a href="_s_d_l__gfx_blit_func_8h_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="nested-classes"></a> Data Structures</h2></td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_blit_info.html">SDL_gfxBlitInfo</a></td></tr> <tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">The structure passed to the low level blit functions. <a href="struct_s_d_l__gfx_blit_info.html#details">More...</a><br/></td></tr> <tr><td colspan="2"><h2><a name="define-members"></a> Defines</h2></td></tr> <tr class="memitem:a8fcea397327309f4ab31a3251f15f911"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_blit_func_8h.html#a8fcea397327309f4ab31a3251f15f911">SDL_GFXBLITFUNC_SCOPE</a>&#160;&#160;&#160;extern</td></tr> <tr class="memitem:ae6b2c815be86ad92310efb40d4b0b30e"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_blit_func_8h.html#ae6b2c815be86ad92310efb40d4b0b30e">GFX_RGBA_FROM_PIXEL</a>(pixel, fmt, r, g, b, a)</td></tr> <tr class="memdesc:ae6b2c815be86ad92310efb40d4b0b30e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Unwrap RGBA values from a pixel using mask, shift and loss for surface. <a href="#ae6b2c815be86ad92310efb40d4b0b30e"></a><br/></td></tr> <tr class="memitem:a7dda3984ca04929e2ea0a3679f7452a9"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_blit_func_8h.html#a7dda3984ca04929e2ea0a3679f7452a9">GFX_DISASSEMBLE_RGBA</a>(buf, bpp, fmt, pixel, r, g, b, a)</td></tr> <tr class="memdesc:a7dda3984ca04929e2ea0a3679f7452a9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disassemble buffer pointer into a pixel and separate RGBA values. <a href="#a7dda3984ca04929e2ea0a3679f7452a9"></a><br/></td></tr> <tr class="memitem:a64927ca5690904716f7ac93b1fcd4420"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_blit_func_8h.html#a64927ca5690904716f7ac93b1fcd4420">GFX_PIXEL_FROM_RGBA</a>(pixel, fmt, r, g, b, a)</td></tr> <tr class="memdesc:a64927ca5690904716f7ac93b1fcd4420"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wrap a pixel from RGBA values using mask, shift and loss for surface. <a href="#a64927ca5690904716f7ac93b1fcd4420"></a><br/></td></tr> <tr class="memitem:a4e59f926fb98a86c01a4ffc5cc20e8d5"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_blit_func_8h.html#a4e59f926fb98a86c01a4ffc5cc20e8d5">GFX_ASSEMBLE_RGBA</a>(buf, bpp, fmt, r, g, b, a)</td></tr> <tr class="memdesc:a4e59f926fb98a86c01a4ffc5cc20e8d5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Assemble pixel into buffer pointer from separate RGBA values. <a href="#a4e59f926fb98a86c01a4ffc5cc20e8d5"></a><br/></td></tr> <tr class="memitem:ae3efb9e67172838c394c148a62822da6"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_blit_func_8h.html#ae3efb9e67172838c394c148a62822da6">GFX_ALPHA_BLEND</a>(sR, sG, sB, A, dR, dG, dB)</td></tr> <tr class="memdesc:ae3efb9e67172838c394c148a62822da6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Blend the RGB values of two pixels based on a source alpha value. <a href="#ae3efb9e67172838c394c148a62822da6"></a><br/></td></tr> <tr class="memitem:a44c498dca765a515f40eecad8f19aac4"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_blit_func_8h.html#a44c498dca765a515f40eecad8f19aac4">GFX_DUFFS_LOOP4</a>(pixel_copy_increment, width)</td></tr> <tr class="memdesc:a44c498dca765a515f40eecad8f19aac4"><td class="mdescLeft">&#160;</td><td class="mdescRight">4-times unrolled DUFFs loop. <a href="#a44c498dca765a515f40eecad8f19aac4"></a><br/></td></tr> <tr><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:ab49c560e89b8305051b2e6b347215f03"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_blit_func_8h.html#a8fcea397327309f4ab31a3251f15f911">SDL_GFXBLITFUNC_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_blit_func_8h.html#ab49c560e89b8305051b2e6b347215f03">SDL_gfxBlitRGBA</a> (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)</td></tr> <tr class="memdesc:ab49c560e89b8305051b2e6b347215f03"><td class="mdescLeft">&#160;</td><td class="mdescRight">Blitter for RGBA-&gt;RGBA blits with alpha adjustment. <a href="#ab49c560e89b8305051b2e6b347215f03"></a><br/></td></tr> <tr class="memitem:a4627ae4a0037d0b248bed87f3c294735"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_blit_func_8h.html#a8fcea397327309f4ab31a3251f15f911">SDL_GFXBLITFUNC_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_blit_func_8h.html#a4627ae4a0037d0b248bed87f3c294735">SDL_gfxSetAlpha</a> (SDL_Surface *src, Uint8 a)</td></tr> <tr class="memdesc:a4627ae4a0037d0b248bed87f3c294735"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the alpha channel in a 32 bit surface. <a href="#a4627ae4a0037d0b248bed87f3c294735"></a><br/></td></tr> <tr class="memitem:a7c93594525ae349b5cef0156b8f758fc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_blit_func_8h.html#a8fcea397327309f4ab31a3251f15f911">SDL_GFXBLITFUNC_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_blit_func_8h.html#a7c93594525ae349b5cef0156b8f758fc">SDL_gfxMultiplyAlpha</a> (SDL_Surface *src, Uint8 a)</td></tr> <tr class="memdesc:a7c93594525ae349b5cef0156b8f758fc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Multiply the alpha channel in a 32bit surface. <a href="#a7c93594525ae349b5cef0156b8f758fc"></a><br/></td></tr> <tr><td colspan="2"><h2><a name="var-members"></a> Variables</h2></td></tr> <tr class="memitem:a6d0c17342154e14322a281603960691a"><td class="memItemLeft" align="right" valign="top">const unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_blit_func_8h.html#a6d0c17342154e14322a281603960691a">GFX_ALPHA_ADJUST_ARRAY</a> [256]</td></tr> <tr class="memdesc:a6d0c17342154e14322a281603960691a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Alpha adjustment table for custom blitter. <a href="#a6d0c17342154e14322a281603960691a"></a><br/></td></tr> </table> <hr/><h2>Define Documentation</h2> <a class="anchor" id="ae3efb9e67172838c394c148a62822da6"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_blit_func_8h.html#ae3efb9e67172838c394c148a62822da6">GFX_ALPHA_BLEND</a></td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">sR, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">sG, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">sB, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">A, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">dR, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">dG, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">dB&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <b>Value:</b><div class="fragment"><pre class="fragment"><span class="keywordflow">do</span> { \ dR = (((sR-dR)*(A))/255)+dR; \ dG = (((sG-dG)*(A))/255)+dG; \ dB = (((sB-dB)*(A))/255)+dB; \ } <span class="keywordflow">while</span>(0) </pre></div> <p>Blend the RGB values of two pixels based on a source alpha value. </p> <p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html#l00138">138</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>.</p> </div> </div> <a class="anchor" id="a4e59f926fb98a86c01a4ffc5cc20e8d5"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a4e59f926fb98a86c01a4ffc5cc20e8d5">GFX_ASSEMBLE_RGBA</a></td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">buf, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">bpp, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">fmt, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">r, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">g, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">b, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">a&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <b>Value:</b><div class="fragment"><pre class="fragment">{ \ Uint32 pixel; <a class="code" href="_s_d_l__gfx_blit_func_8h.html#a64927ca5690904716f7ac93b1fcd4420" title="Wrap a pixel from RGBA values using mask, shift and loss for surface.">\</a> <a class="code" href="_s_d_l__gfx_blit_func_8h.html#a64927ca5690904716f7ac93b1fcd4420" title="Wrap a pixel from RGBA values using mask, shift and loss for surface."> \</a> <a class="code" href="_s_d_l__gfx_blit_func_8h.html#a64927ca5690904716f7ac93b1fcd4420" title="Wrap a pixel from RGBA values using mask, shift and loss for surface."> GFX_PIXEL_FROM_RGBA</a>(pixel, fmt, r, g, b, a); \ *((Uint32 *)(buf)) = pixel; \ } </pre></div> <p>Assemble pixel into buffer pointer from separate RGBA values. </p> <p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html#l00127">127</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>.</p> </div> </div> <a class="anchor" id="a7dda3984ca04929e2ea0a3679f7452a9"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a7dda3984ca04929e2ea0a3679f7452a9">GFX_DISASSEMBLE_RGBA</a></td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">buf, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">bpp, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">fmt, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">pixel, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">r, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">g, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">b, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">a&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <b>Value:</b><div class="fragment"><pre class="fragment"><span class="keywordflow">do</span> { \ pixel = *((Uint32 *)(buf)); \ GFX_RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a); \ pixel &amp;= ~fmt-&gt;Amask; \ } <span class="keywordflow">while</span>(0) </pre></div> <p>Disassemble buffer pointer into a pixel and separate RGBA values. </p> <p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html#l00106">106</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>.</p> </div> </div> <a class="anchor" id="a44c498dca765a515f40eecad8f19aac4"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a44c498dca765a515f40eecad8f19aac4">GFX_DUFFS_LOOP4</a></td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">pixel_copy_increment, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">width&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <b>Value:</b><div class="fragment"><pre class="fragment">{ <span class="keywordtype">int</span> n = (width+3)/4; \ switch (width &amp; 3) { \ case 0: <span class="keywordflow">do</span> { pixel_copy_increment; \ case 3: pixel_copy_increment; \ case 2: pixel_copy_increment; \ case 1: pixel_copy_increment; \ } <span class="keywordflow">while</span> ( --n &gt; 0 ); \ } \ } </pre></div> <p>4-times unrolled DUFFs loop. </p> <p>This is a very useful loop for optimizing blitters. </p> <p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html#l00150">150</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>.</p> </div> </div> <a class="anchor" id="a64927ca5690904716f7ac93b1fcd4420"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a64927ca5690904716f7ac93b1fcd4420">GFX_PIXEL_FROM_RGBA</a></td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">pixel, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">fmt, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">r, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">g, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">b, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">a&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <b>Value:</b><div class="fragment"><pre class="fragment">{ \ pixel = ((r&gt;&gt;fmt-&gt;Rloss)&lt;&lt;fmt-&gt;Rshift)| \ ((g&gt;&gt;fmt-&gt;Gloss)&lt;&lt;fmt-&gt;Gshift)| \ ((b&gt;&gt;fmt-&gt;Bloss)&lt;&lt;fmt-&gt;Bshift)| \ ((a&lt;&lt;fmt-&gt;Aloss)&lt;&lt;fmt-&gt;Ashift); \ } </pre></div> <p>Wrap a pixel from RGBA values using mask, shift and loss for surface. </p> <p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html#l00116">116</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>.</p> </div> </div> <a class="anchor" id="ae6b2c815be86ad92310efb40d4b0b30e"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_blit_func_8h.html#ae6b2c815be86ad92310efb40d4b0b30e">GFX_RGBA_FROM_PIXEL</a></td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">pixel, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">fmt, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">r, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">g, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">b, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">a&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <b>Value:</b><div class="fragment"><pre class="fragment">{ \ r = ((pixel&amp;fmt-&gt;Rmask)&gt;&gt;fmt-&gt;Rshift)&lt;&lt;fmt-&gt;Rloss; \ g = ((pixel&amp;fmt-&gt;Gmask)&gt;&gt;fmt-&gt;Gshift)&lt;&lt;fmt-&gt;Gloss; \ b = ((pixel&amp;fmt-&gt;Bmask)&gt;&gt;fmt-&gt;Bshift)&lt;&lt;fmt-&gt;Bloss; \ a = ((pixel&amp;fmt-&gt;Amask)&gt;&gt;fmt-&gt;Ashift)&lt;&lt;fmt-&gt;Aloss; \ } </pre></div> <p>Unwrap RGBA values from a pixel using mask, shift and loss for surface. </p> <p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html#l00095">95</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>.</p> </div> </div> <a class="anchor" id="a8fcea397327309f4ab31a3251f15f911"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a8fcea397327309f4ab31a3251f15f911">SDL_GFXBLITFUNC_SCOPE</a>&#160;&#160;&#160;extern</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html#l00059">59</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>.</p> </div> </div> <hr/><h2>Function Documentation</h2> <a class="anchor" id="ab49c560e89b8305051b2e6b347215f03"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_blit_func_8h.html#a8fcea397327309f4ab31a3251f15f911">SDL_GFXBLITFUNC_SCOPE</a> int <a class="el" href="_s_d_l__gfx_blit_func_8h.html#ab49c560e89b8305051b2e6b347215f03">SDL_gfxBlitRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">SDL_Rect *&#160;</td> <td class="paramname"><em>srcrect</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">SDL_Rect *&#160;</td> <td class="paramname"><em>dstrect</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Blitter for RGBA-&gt;RGBA blits with alpha adjustment. </p> <p>Verifies the input 'src' and 'dst' surfaces and rectangles and performs blit. The destination clip rectangle is honored.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">src</td><td>The source surface. </td></tr> <tr><td class="paramname">srcrect</td><td>The source rectangle. </td></tr> <tr><td class="paramname">dst</td><td>The destination surface. </td></tr> <tr><td class="paramname">dstrect</td><td>The destination rectangle.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if blit was performed, 0 otherwise, or -1 if an error occured. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8c_source.html#l00411">411</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8c_source.html">SDL_gfxBlitFunc.c</a>.</p> </div> </div> <a class="anchor" id="a7c93594525ae349b5cef0156b8f758fc"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_blit_func_8h.html#a8fcea397327309f4ab31a3251f15f911">SDL_GFXBLITFUNC_SCOPE</a> int <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a7c93594525ae349b5cef0156b8f758fc">SDL_gfxMultiplyAlpha</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Multiply the alpha channel in a 32bit surface. </p> <p>Helper function that multiplies the alpha channel in a 32 bit surface with a constant value. The final alpha is always scaled to the range 0-255 (i.e. the factor is a/256).</p> <p>Only 32 bit surfaces can be used with this function.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">src</td><td>Pointer to the target surface to change. </td></tr> <tr><td class="paramname">a</td><td>The alpha value to multiply with. When a is 255, this function is a NoOp.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if alpha was changed, 0 otherwise. Returns -1 if input surface is invalid. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8c_source.html#l00587">587</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8c_source.html">SDL_gfxBlitFunc.c</a>.</p> </div> </div> <a class="anchor" id="a4627ae4a0037d0b248bed87f3c294735"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_blit_func_8h.html#a8fcea397327309f4ab31a3251f15f911">SDL_GFXBLITFUNC_SCOPE</a> int <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a4627ae4a0037d0b248bed87f3c294735">SDL_gfxSetAlpha</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Sets the alpha channel in a 32 bit surface. </p> <p>Helper function that sets the alpha channel in a 32 bit surface to a constant value. Only 32 bit surfaces can be used with this function.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">src</td><td>Pointer to the target surface to change. </td></tr> <tr><td class="paramname">a</td><td>The alpha value to set.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if alpha was changed, -1 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8c_source.html#l00524">524</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8c_source.html">SDL_gfxBlitFunc.c</a>.</p> </div> </div> <hr/><h2>Variable Documentation</h2> <a class="anchor" id="a6d0c17342154e14322a281603960691a"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const unsigned int <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a6d0c17342154e14322a281603960691a">GFX_ALPHA_ADJUST_ARRAY</a>[256]</td> </tr> </table> </div> <div class="memdoc"> <p>Alpha adjustment table for custom blitter. </p> <p>The table provides values for a modified, non-linear transfer function which maintain brightness. </p> <p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8c_source.html#l00039">39</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8c_source.html">SDL_gfxBlitFunc.c</a>.</p> </div> </div> </div><!-- contents --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.0 </small></address> </body> </html>
YifuLiu/AliOS-Things
components/SDL2/src/gfx/Docs/html/_s_d_l__gfx_blit_func_8h.html
HTML
apache-2.0
30,016
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>SDL_gfx: I:/Sources/sdlgfx/SDL_gfxBlitFunc.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SDL_gfx &#160;<span id="projectnumber">2.0.25</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.8.0 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="headertitle"> <div class="title">I:/Sources/sdlgfx/SDL_gfxBlitFunc.h</div> </div> </div><!--header--> <div class="contents"> <a href="_s_d_l__gfx_blit_func_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* </span> <a name="l00002"></a>00002 <span class="comment"></span> <a name="l00003"></a>00003 <span class="comment">SDL_gfxBlitFunc.h: custom blitters</span> <a name="l00004"></a>00004 <span class="comment"></span> <a name="l00005"></a>00005 <span class="comment">Copyright (C) 2001-2012 Andreas Schiffler</span> <a name="l00006"></a>00006 <span class="comment"></span> <a name="l00007"></a>00007 <span class="comment">This software is provided &#39;as-is&#39;, without any express or implied</span> <a name="l00008"></a>00008 <span class="comment">warranty. In no event will the authors be held liable for any damages</span> <a name="l00009"></a>00009 <span class="comment">arising from the use of this software.</span> <a name="l00010"></a>00010 <span class="comment"></span> <a name="l00011"></a>00011 <span class="comment">Permission is granted to anyone to use this software for any purpose,</span> <a name="l00012"></a>00012 <span class="comment">including commercial applications, and to alter it and redistribute it</span> <a name="l00013"></a>00013 <span class="comment">freely, subject to the following restrictions:</span> <a name="l00014"></a>00014 <span class="comment"></span> <a name="l00015"></a>00015 <span class="comment">1. The origin of this software must not be misrepresented; you must not</span> <a name="l00016"></a>00016 <span class="comment">claim that you wrote the original software. If you use this software</span> <a name="l00017"></a>00017 <span class="comment">in a product, an acknowledgment in the product documentation would be</span> <a name="l00018"></a>00018 <span class="comment">appreciated but is not required.</span> <a name="l00019"></a>00019 <span class="comment"></span> <a name="l00020"></a>00020 <span class="comment">2. Altered source versions must be plainly marked as such, and must not be</span> <a name="l00021"></a>00021 <span class="comment">misrepresented as being the original software.</span> <a name="l00022"></a>00022 <span class="comment"></span> <a name="l00023"></a>00023 <span class="comment">3. This notice may not be removed or altered from any source</span> <a name="l00024"></a>00024 <span class="comment">distribution.</span> <a name="l00025"></a>00025 <span class="comment"></span> <a name="l00026"></a>00026 <span class="comment">Andreas Schiffler -- aschiffler at ferzkopp dot net</span> <a name="l00027"></a>00027 <span class="comment"></span> <a name="l00028"></a>00028 <span class="comment">*/</span> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="preprocessor">#ifndef _SDL_gfxBlitFunc_h</span> <a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#define _SDL_gfxBlitFunc_h</span> <a name="l00032"></a>00032 <span class="preprocessor"></span> <a name="l00033"></a>00033 <span class="comment">/* Set up for C function definitions, even when using C++ */</span> <a name="l00034"></a>00034 <span class="preprocessor">#ifdef __cplusplus</span> <a name="l00035"></a>00035 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> { <a name="l00036"></a>00036 <span class="preprocessor">#endif</span> <a name="l00037"></a>00037 <span class="preprocessor"></span> <a name="l00038"></a>00038 <span class="preprocessor">#include &lt;stdio.h&gt;</span> <a name="l00039"></a>00039 <span class="preprocessor">#include &lt;stdlib.h&gt;</span> <a name="l00040"></a>00040 <a name="l00041"></a>00041 <span class="preprocessor">#include &quot;SDL.h&quot;</span> <a name="l00042"></a>00042 <span class="preprocessor">#include &quot;SDL_video.h&quot;</span> <a name="l00043"></a>00043 <a name="l00044"></a>00044 <a name="l00045"></a>00045 <span class="keyword">extern</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_blit_func_8c.html#a6d0c17342154e14322a281603960691a" title="Alpha adjustment table for custom blitter.">GFX_ALPHA_ADJUST_ARRAY</a>[256]; <a name="l00046"></a>00046 <a name="l00047"></a>00047 <span class="comment">/* ---- Function Prototypes */</span> <a name="l00048"></a>00048 <a name="l00049"></a>00049 <span class="preprocessor">#ifdef _MSC_VER</span> <a name="l00050"></a>00050 <span class="preprocessor"></span><span class="preprocessor"># if defined(DLL_EXPORT) &amp;&amp; !defined(LIBSDL_GFX_DLL_IMPORT)</span> <a name="l00051"></a>00051 <span class="preprocessor"></span><span class="preprocessor"># define SDL_GFXBLITFUNC_SCOPE __declspec(dllexport)</span> <a name="l00052"></a>00052 <span class="preprocessor"></span><span class="preprocessor"># else</span> <a name="l00053"></a>00053 <span class="preprocessor"></span><span class="preprocessor"># ifdef LIBSDL_GFX_DLL_IMPORT</span> <a name="l00054"></a>00054 <span class="preprocessor"></span><span class="preprocessor"># define SDL_GFXBLITFUNC_SCOPE __declspec(dllimport)</span> <a name="l00055"></a>00055 <span class="preprocessor"></span><span class="preprocessor"># endif</span> <a name="l00056"></a>00056 <span class="preprocessor"></span><span class="preprocessor"># endif</span> <a name="l00057"></a>00057 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00058"></a>00058 <span class="preprocessor"></span><span class="preprocessor">#ifndef SDL_GFXBLITFUNC_SCOPE</span> <a name="l00059"></a><a class="code" href="_s_d_l__gfx_blit_func_8h.html#a8fcea397327309f4ab31a3251f15f911">00059</a> <span class="preprocessor"></span><span class="preprocessor"># define SDL_GFXBLITFUNC_SCOPE extern</span> <a name="l00060"></a>00060 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00061"></a>00061 <span class="preprocessor"></span> <a name="l00062"></a>00062 <a name="l00063"></a>00063 <a class="code" href="_s_d_l__gfx_blit_func_8h.html#a8fcea397327309f4ab31a3251f15f911">SDL_GFXBLITFUNC_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_blit_func_8c.html#ac51ff40d39f3dd0bd08116e8953960f8" title="Blitter for RGBA-&gt;RGBA blits with alpha adjustment.">SDL_gfxBlitRGBA</a>(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect); <a name="l00064"></a>00064 <a name="l00065"></a>00065 <a class="code" href="_s_d_l__gfx_blit_func_8h.html#a8fcea397327309f4ab31a3251f15f911">SDL_GFXBLITFUNC_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_blit_func_8c.html#a09a376775f9d8c933c7121e34fe5ecfc" title="Sets the alpha channel in a 32 bit surface.">SDL_gfxSetAlpha</a>(SDL_Surface * src, Uint8 a); <a name="l00066"></a>00066 <a name="l00067"></a>00067 <a class="code" href="_s_d_l__gfx_blit_func_8h.html#a8fcea397327309f4ab31a3251f15f911">SDL_GFXBLITFUNC_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_blit_func_8c.html#a4ece530dca0ae46b1f5a780f85371687" title="Multiply the alpha channel in a 32bit surface.">SDL_gfxMultiplyAlpha</a>(SDL_Surface * src, Uint8 a); <a name="l00068"></a>00068 <a name="l00069"></a>00069 <span class="comment">/* -------- Macros */</span> <a name="l00070"></a>00070 <a name="l00071"></a>00071 <span class="comment">/* Define SDL macros locally as a substitute for an #include &quot;SDL_blit.h&quot;, */</span> <a name="l00072"></a>00072 <span class="comment">/* which doesn&#39;t work since the include file doesn&#39;t get installed. */</span> <a name="l00073"></a>00073 <a name="l00077"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html">00077</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{ <a name="l00078"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#a03dd1de15b100cd491eff7d823284189">00078</a> Uint8 *<a class="code" href="struct_s_d_l__gfx_blit_info.html#a03dd1de15b100cd491eff7d823284189">s_pixels</a>; <a name="l00079"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#ad2f7fa9a764e75639fdb6e3b0f8a68fc">00079</a> <span class="keywordtype">int</span> <a class="code" href="struct_s_d_l__gfx_blit_info.html#ad2f7fa9a764e75639fdb6e3b0f8a68fc">s_width</a>; <a name="l00080"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#aeeec65f001e54fb93ba97cb85cb61592">00080</a> <span class="keywordtype">int</span> <a class="code" href="struct_s_d_l__gfx_blit_info.html#aeeec65f001e54fb93ba97cb85cb61592">s_height</a>; <a name="l00081"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#a25b822e4773e1db6d38aadc5c0bb126f">00081</a> <span class="keywordtype">int</span> <a class="code" href="struct_s_d_l__gfx_blit_info.html#a25b822e4773e1db6d38aadc5c0bb126f">s_skip</a>; <a name="l00082"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#ae9146d0f8b236274984127a7a1528966">00082</a> Uint8 *<a class="code" href="struct_s_d_l__gfx_blit_info.html#ae9146d0f8b236274984127a7a1528966">d_pixels</a>; <a name="l00083"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#ad49412925c79a9894ea598530ea39b00">00083</a> <span class="keywordtype">int</span> <a class="code" href="struct_s_d_l__gfx_blit_info.html#ad49412925c79a9894ea598530ea39b00">d_width</a>; <a name="l00084"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#ad31494204fdd3d2cb30faba527cfb9fa">00084</a> <span class="keywordtype">int</span> <a class="code" href="struct_s_d_l__gfx_blit_info.html#ad31494204fdd3d2cb30faba527cfb9fa">d_height</a>; <a name="l00085"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#a9055858de99c49d16ef903fed31715b7">00085</a> <span class="keywordtype">int</span> <a class="code" href="struct_s_d_l__gfx_blit_info.html#a9055858de99c49d16ef903fed31715b7">d_skip</a>; <a name="l00086"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#a4b938ad61daa0a9625c6892fd46f32a2">00086</a> <span class="keywordtype">void</span> *<a class="code" href="struct_s_d_l__gfx_blit_info.html#a4b938ad61daa0a9625c6892fd46f32a2">aux_data</a>; <a name="l00087"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#a1ce90142d08a06fede5e2a13d66d17f6">00087</a> SDL_PixelFormat *<a class="code" href="struct_s_d_l__gfx_blit_info.html#a1ce90142d08a06fede5e2a13d66d17f6">src</a>; <a name="l00088"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#a9596f5ea6998964e6240fae7ac17ce1e">00088</a> Uint8 *<a class="code" href="struct_s_d_l__gfx_blit_info.html#a9596f5ea6998964e6240fae7ac17ce1e">table</a>; <a name="l00089"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#a177d476cb937246853b74253490436db">00089</a> SDL_PixelFormat *<a class="code" href="struct_s_d_l__gfx_blit_info.html#a177d476cb937246853b74253490436db">dst</a>; <a name="l00090"></a>00090 } <a class="code" href="struct_s_d_l__gfx_blit_info.html" title="The structure passed to the low level blit functions.">SDL_gfxBlitInfo</a>; <a name="l00091"></a>00091 <a name="l00095"></a><a class="code" href="_s_d_l__gfx_blit_func_8h.html#ae6b2c815be86ad92310efb40d4b0b30e">00095</a> <span class="preprocessor">#define GFX_RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a) \</span> <a name="l00096"></a>00096 <span class="preprocessor"> { \</span> <a name="l00097"></a>00097 <span class="preprocessor"> r = ((pixel&amp;fmt-&gt;Rmask)&gt;&gt;fmt-&gt;Rshift)&lt;&lt;fmt-&gt;Rloss; \</span> <a name="l00098"></a>00098 <span class="preprocessor"> g = ((pixel&amp;fmt-&gt;Gmask)&gt;&gt;fmt-&gt;Gshift)&lt;&lt;fmt-&gt;Gloss; \</span> <a name="l00099"></a>00099 <span class="preprocessor"> b = ((pixel&amp;fmt-&gt;Bmask)&gt;&gt;fmt-&gt;Bshift)&lt;&lt;fmt-&gt;Bloss; \</span> <a name="l00100"></a>00100 <span class="preprocessor"> a = ((pixel&amp;fmt-&gt;Amask)&gt;&gt;fmt-&gt;Ashift)&lt;&lt;fmt-&gt;Aloss; \</span> <a name="l00101"></a>00101 <span class="preprocessor"> }</span> <a name="l00102"></a>00102 <span class="preprocessor"></span> <a name="l00106"></a><a class="code" href="_s_d_l__gfx_blit_func_8h.html#a7dda3984ca04929e2ea0a3679f7452a9">00106</a> <span class="preprocessor">#define GFX_DISASSEMBLE_RGBA(buf, bpp, fmt, pixel, r, g, b, a) \</span> <a name="l00107"></a>00107 <span class="preprocessor"> do { \</span> <a name="l00108"></a>00108 <span class="preprocessor"> pixel = *((Uint32 *)(buf)); \</span> <a name="l00109"></a>00109 <span class="preprocessor"> GFX_RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a); \</span> <a name="l00110"></a>00110 <span class="preprocessor"> pixel &amp;= ~fmt-&gt;Amask; \</span> <a name="l00111"></a>00111 <span class="preprocessor"> } while(0)</span> <a name="l00112"></a>00112 <span class="preprocessor"></span> <a name="l00116"></a><a class="code" href="_s_d_l__gfx_blit_func_8h.html#a64927ca5690904716f7ac93b1fcd4420">00116</a> <span class="preprocessor">#define GFX_PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a) \</span> <a name="l00117"></a>00117 <span class="preprocessor"> { \</span> <a name="l00118"></a>00118 <span class="preprocessor"> pixel = ((r&gt;&gt;fmt-&gt;Rloss)&lt;&lt;fmt-&gt;Rshift)| \</span> <a name="l00119"></a>00119 <span class="preprocessor"> ((g&gt;&gt;fmt-&gt;Gloss)&lt;&lt;fmt-&gt;Gshift)| \</span> <a name="l00120"></a>00120 <span class="preprocessor"> ((b&gt;&gt;fmt-&gt;Bloss)&lt;&lt;fmt-&gt;Bshift)| \</span> <a name="l00121"></a>00121 <span class="preprocessor"> ((a&lt;&lt;fmt-&gt;Aloss)&lt;&lt;fmt-&gt;Ashift); \</span> <a name="l00122"></a>00122 <span class="preprocessor"> }</span> <a name="l00123"></a>00123 <span class="preprocessor"></span> <a name="l00127"></a><a class="code" href="_s_d_l__gfx_blit_func_8h.html#a4e59f926fb98a86c01a4ffc5cc20e8d5">00127</a> <span class="preprocessor">#define GFX_ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a) \</span> <a name="l00128"></a>00128 <span class="preprocessor"> { \</span> <a name="l00129"></a>00129 <span class="preprocessor"> Uint32 pixel; \</span> <a name="l00130"></a>00130 <span class="preprocessor"> \</span> <a name="l00131"></a>00131 <span class="preprocessor"> GFX_PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a); \</span> <a name="l00132"></a>00132 <span class="preprocessor"> *((Uint32 *)(buf)) = pixel; \</span> <a name="l00133"></a>00133 <span class="preprocessor"> }</span> <a name="l00134"></a>00134 <span class="preprocessor"></span> <a name="l00138"></a><a class="code" href="_s_d_l__gfx_blit_func_8h.html#ae3efb9e67172838c394c148a62822da6">00138</a> <span class="preprocessor">#define GFX_ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB) \</span> <a name="l00139"></a>00139 <span class="preprocessor"> do { \</span> <a name="l00140"></a>00140 <span class="preprocessor"> dR = (((sR-dR)*(A))/255)+dR; \</span> <a name="l00141"></a>00141 <span class="preprocessor"> dG = (((sG-dG)*(A))/255)+dG; \</span> <a name="l00142"></a>00142 <span class="preprocessor"> dB = (((sB-dB)*(A))/255)+dB; \</span> <a name="l00143"></a>00143 <span class="preprocessor"> } while(0)</span> <a name="l00144"></a>00144 <span class="preprocessor"></span> <a name="l00150"></a><a class="code" href="_s_d_l__gfx_blit_func_8h.html#a44c498dca765a515f40eecad8f19aac4">00150</a> <span class="preprocessor">#define GFX_DUFFS_LOOP4(pixel_copy_increment, width) \</span> <a name="l00151"></a>00151 <span class="preprocessor"> { int n = (width+3)/4; \</span> <a name="l00152"></a>00152 <span class="preprocessor"> switch (width &amp; 3) { \</span> <a name="l00153"></a>00153 <span class="preprocessor"> case 0: do { pixel_copy_increment; \</span> <a name="l00154"></a>00154 <span class="preprocessor"> case 3: pixel_copy_increment; \</span> <a name="l00155"></a>00155 <span class="preprocessor"> case 2: pixel_copy_increment; \</span> <a name="l00156"></a>00156 <span class="preprocessor"> case 1: pixel_copy_increment; \</span> <a name="l00157"></a>00157 <span class="preprocessor"> } while ( --n &gt; 0 ); \</span> <a name="l00158"></a>00158 <span class="preprocessor"> } \</span> <a name="l00159"></a>00159 <span class="preprocessor"> }</span> <a name="l00160"></a>00160 <span class="preprocessor"></span> <a name="l00161"></a>00161 <a name="l00162"></a>00162 <a name="l00163"></a>00163 <span class="comment">/* Ends C function definitions when using C++ */</span> <a name="l00164"></a>00164 <span class="preprocessor">#ifdef __cplusplus</span> <a name="l00165"></a>00165 <span class="preprocessor"></span>} <a name="l00166"></a>00166 <span class="preprocessor">#endif</span> <a name="l00167"></a>00167 <span class="preprocessor"></span> <a name="l00168"></a>00168 <span class="preprocessor">#endif </span><span class="comment">/* _SDL_gfxBlitFunc_h */</span> </pre></div></div><!-- contents --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.0 </small></address> </body> </html>
YifuLiu/AliOS-Things
components/SDL2/src/gfx/Docs/html/_s_d_l__gfx_blit_func_8h_source.html
HTML
apache-2.0
20,076
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>SDL_gfx: I:/Sources/sdlgfx/SDL_gfxPrimitives.c File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SDL_gfx &#160;<span id="projectnumber">2.0.25</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.8.0 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#nested-classes">Data Structures</a> &#124; <a href="#define-members">Defines</a> &#124; <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">I:/Sources/sdlgfx/SDL_gfxPrimitives.c File Reference</div> </div> </div><!--header--> <div class="contents"> <div class="textblock"><code>#include &lt;stdio.h&gt;</code><br/> <code>#include &lt;stdlib.h&gt;</code><br/> <code>#include &lt;math.h&gt;</code><br/> <code>#include &lt;string.h&gt;</code><br/> <code>#include &quot;<a class="el" href="_s_d_l__gfx_primitives_8h_source.html">SDL_gfxPrimitives.h</a>&quot;</code><br/> <code>#include &quot;<a class="el" href="_s_d_l__rotozoom_8h_source.html">SDL_rotozoom.h</a>&quot;</code><br/> <code>#include &quot;<a class="el" href="_s_d_l__gfx_primitives__font_8h_source.html">SDL_gfxPrimitives_font.h</a>&quot;</code><br/> <code>#include &quot;<a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>&quot;</code><br/> </div> <p><a href="_s_d_l__gfx_primitives_8c_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="nested-classes"></a> Data Structures</h2></td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html">SDL_gfxBresenhamIterator</a></td></tr> <tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">The structure passed to the internal Bresenham iterator. <a href="struct_s_d_l__gfx_bresenham_iterator.html#details">More...</a><br/></td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html">SDL_gfxMurphyIterator</a></td></tr> <tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">The structure passed to the internal Murphy iterator. <a href="struct_s_d_l__gfx_murphy_iterator.html#details">More...</a><br/></td></tr> <tr><td colspan="2"><h2><a name="define-members"></a> Defines</h2></td></tr> <tr class="memitem:aa992e3a7310145e9f9c36edee5795996"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#aa992e3a7310145e9f9c36edee5795996">DEFAULT_ALPHA_PIXEL_ROUTINE</a></td></tr> <tr class="memitem:aa24430b32607587eae143f31c1ad14dd"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#aa24430b32607587eae143f31c1ad14dd">ALPHA_PIXEL_ADDITIVE_BLEND</a></td></tr> <tr class="memitem:adeb851ac45f74ddec914212dd3297433"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#adeb851ac45f74ddec914212dd3297433">clip_xmin</a>(surface)&#160;&#160;&#160;surface-&gt;clip_rect.x</td></tr> <tr class="memitem:add68946c6ecf1a5b8935309d30b85cab"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#add68946c6ecf1a5b8935309d30b85cab">clip_xmax</a>(surface)&#160;&#160;&#160;surface-&gt;clip_rect.x+surface-&gt;clip_rect.w-1</td></tr> <tr class="memitem:afc94a05f9b044427c21a77cc468aa5d4"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#afc94a05f9b044427c21a77cc468aa5d4">clip_ymin</a>(surface)&#160;&#160;&#160;surface-&gt;clip_rect.y</td></tr> <tr class="memitem:a2f0d9475a02c76e14c8bcba854ac7067"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a2f0d9475a02c76e14c8bcba854ac7067">clip_ymax</a>(surface)&#160;&#160;&#160;surface-&gt;clip_rect.y+surface-&gt;clip_rect.h-1</td></tr> <tr class="memitem:ac7260a99c00538400ab4be67304ad36c"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#ac7260a99c00538400ab4be67304ad36c">CLIP_LEFT_EDGE</a>&#160;&#160;&#160;0x1</td></tr> <tr class="memitem:a0f5e2b2e79afa32c688c77f776a84308"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a0f5e2b2e79afa32c688c77f776a84308">CLIP_RIGHT_EDGE</a>&#160;&#160;&#160;0x2</td></tr> <tr class="memitem:ae4fa529c5f9a39310b98769cdb007c2d"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#ae4fa529c5f9a39310b98769cdb007c2d">CLIP_BOTTOM_EDGE</a>&#160;&#160;&#160;0x4</td></tr> <tr class="memitem:acd233fdea48722eb128c4c48f619a605"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#acd233fdea48722eb128c4c48f619a605">CLIP_TOP_EDGE</a>&#160;&#160;&#160;0x8</td></tr> <tr class="memitem:a3f497d83ed5f593a5bc56c2ba7e13f5b"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a3f497d83ed5f593a5bc56c2ba7e13f5b">CLIP_INSIDE</a>(a)&#160;&#160;&#160;(!a)</td></tr> <tr class="memitem:ac1e60af8e37b6b372dcfd2d88299b662"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#ac1e60af8e37b6b372dcfd2d88299b662">CLIP_REJECT</a>(a, b)&#160;&#160;&#160;(a&amp;b)</td></tr> <tr class="memitem:a004c35133422cb574c41bb114d4592c6"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a004c35133422cb574c41bb114d4592c6">CLIP_ACCEPT</a>(a, b)&#160;&#160;&#160;(!(a|b))</td></tr> <tr class="memitem:ae2f08dc603ae93c402abd918ba4e23e1"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#ae2f08dc603ae93c402abd918ba4e23e1">ABS</a>(a)&#160;&#160;&#160;(((a)&lt;0) ? -(a) : (a))</td></tr> <tr class="memitem:a519bc2d4d753c51da1b956d6c200bff1"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a519bc2d4d753c51da1b956d6c200bff1">AAlevels</a>&#160;&#160;&#160;256</td></tr> <tr class="memitem:a2e16571bedf7a97c6fc02d86b48994eb"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a2e16571bedf7a97c6fc02d86b48994eb">AAbits</a>&#160;&#160;&#160;8</td></tr> <tr class="memitem:a764ddb925da0921f024fadb4c12d7382"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a764ddb925da0921f024fadb4c12d7382">HYPOT</a>(x, y)&#160;&#160;&#160;sqrt((double)(x)*(double)(x)+(double)(y)*(double)(y))</td></tr> <tr><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:a011e3e26d7216998357fb1a089f8f742"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742">fastPixelColorNolock</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)</td></tr> <tr class="memdesc:a011e3e26d7216998357fb1a089f8f742"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal pixel drawing - fast, no blending, no locking, clipping. <a href="#a011e3e26d7216998357fb1a089f8f742"></a><br/></td></tr> <tr class="memitem:add868bff0c4cb75012a0407af6b64f03"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#add868bff0c4cb75012a0407af6b64f03">fastPixelColorNolockNoclip</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)</td></tr> <tr class="memdesc:add868bff0c4cb75012a0407af6b64f03"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal pixel drawing - fast, no blending, no locking, no clipping. <a href="#add868bff0c4cb75012a0407af6b64f03"></a><br/></td></tr> <tr class="memitem:abeed0e873efdf3aec8c6c86188d36f89"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#abeed0e873efdf3aec8c6c86188d36f89">fastPixelColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)</td></tr> <tr class="memdesc:abeed0e873efdf3aec8c6c86188d36f89"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal pixel drawing - fast, no blending, locking, clipping. <a href="#abeed0e873efdf3aec8c6c86188d36f89"></a><br/></td></tr> <tr class="memitem:a9874fabafdc422223323751671bca7c0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a9874fabafdc422223323751671bca7c0">fastPixelRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a9874fabafdc422223323751671bca7c0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal pixel drawing - fast, no blending, locking, RGB input. <a href="#a9874fabafdc422223323751671bca7c0"></a><br/></td></tr> <tr class="memitem:a64916bb8270e75d936cda816d3694a25"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a64916bb8270e75d936cda816d3694a25">fastPixelRGBANolock</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a64916bb8270e75d936cda816d3694a25"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal pixel drawing - fast, no blending, no locking RGB input. <a href="#a64916bb8270e75d936cda816d3694a25"></a><br/></td></tr> <tr class="memitem:ad31779f1ef8bad84496d4c930ec2c208"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#ad31779f1ef8bad84496d4c930ec2c208">_putPixelAlpha</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color, Uint8 alpha)</td></tr> <tr class="memdesc:ad31779f1ef8bad84496d4c930ec2c208"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal pixel drawing function with alpha blending where input color in in destination format. <a href="#ad31779f1ef8bad84496d4c930ec2c208"></a><br/></td></tr> <tr class="memitem:ae6f8690e5c5a85d3263c8e16727b34ef"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#ae6f8690e5c5a85d3263c8e16727b34ef">pixelColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)</td></tr> <tr class="memdesc:ae6f8690e5c5a85d3263c8e16727b34ef"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pixel draw with blending enabled if a&lt;255. <a href="#ae6f8690e5c5a85d3263c8e16727b34ef"></a><br/></td></tr> <tr class="memitem:ae94ba03884eee47c3bcc8e2fc35da9f0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0">pixelColorNolock</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)</td></tr> <tr class="memdesc:ae94ba03884eee47c3bcc8e2fc35da9f0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pixel draw with blending enabled if a&lt;255 - no surface locking. <a href="#ae94ba03884eee47c3bcc8e2fc35da9f0"></a><br/></td></tr> <tr class="memitem:ada8cf05419af4be65d3ea5f7c7384e58"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#ada8cf05419af4be65d3ea5f7c7384e58">_filledRectAlpha</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color, Uint8 alpha)</td></tr> <tr class="memdesc:ada8cf05419af4be65d3ea5f7c7384e58"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal function to draw filled rectangle with alpha blending. <a href="#ada8cf05419af4be65d3ea5f7c7384e58"></a><br/></td></tr> <tr class="memitem:ace9f2505c12c5dacc778509991cd3716"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#ace9f2505c12c5dacc778509991cd3716">filledRectAlpha</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)</td></tr> <tr class="memdesc:ace9f2505c12c5dacc778509991cd3716"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled rectangle of RGBA color with alpha blending. <a href="#ace9f2505c12c5dacc778509991cd3716"></a><br/></td></tr> <tr class="memitem:a9eb9c20c69b527cda814a19212270efa"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a9eb9c20c69b527cda814a19212270efa">_HLineAlpha</a> (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)</td></tr> <tr class="memdesc:a9eb9c20c69b527cda814a19212270efa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal function to draw horizontal line of RGBA color with alpha blending. <a href="#a9eb9c20c69b527cda814a19212270efa"></a><br/></td></tr> <tr class="memitem:a61dd5e7523ce84fb103da3338acd3a37"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a61dd5e7523ce84fb103da3338acd3a37">_VLineAlpha</a> (SDL_Surface *dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)</td></tr> <tr class="memdesc:a61dd5e7523ce84fb103da3338acd3a37"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal function to draw vertical line of RGBA color with alpha blending. <a href="#a61dd5e7523ce84fb103da3338acd3a37"></a><br/></td></tr> <tr class="memitem:af9269ad9bbfa20980d5947c85dda63d5"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#af9269ad9bbfa20980d5947c85dda63d5">pixelColorWeight</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color, Uint32 weight)</td></tr> <tr class="memdesc:af9269ad9bbfa20980d5947c85dda63d5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pixel draw with blending enabled and using alpha weight on color. <a href="#af9269ad9bbfa20980d5947c85dda63d5"></a><br/></td></tr> <tr class="memitem:a93c580afe80682f06ef4f1655180aff1"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1">pixelColorWeightNolock</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color, Uint32 weight)</td></tr> <tr class="memdesc:a93c580afe80682f06ef4f1655180aff1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pixel draw with blending enabled and using alpha weight on color - no locking. <a href="#a93c580afe80682f06ef4f1655180aff1"></a><br/></td></tr> <tr class="memitem:a7b6f83bdef72f6b356664a93841381c0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a7b6f83bdef72f6b356664a93841381c0">pixelRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a7b6f83bdef72f6b356664a93841381c0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pixel draw with blending enabled if a&lt;255. <a href="#a7b6f83bdef72f6b356664a93841381c0"></a><br/></td></tr> <tr class="memitem:af20de4fe06f4d997eb2ab01a2252f071"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#af20de4fe06f4d997eb2ab01a2252f071">hlineColorStore</a> (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)</td></tr> <tr class="memdesc:af20de4fe06f4d997eb2ab01a2252f071"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw horizontal line without blending;. <a href="#af20de4fe06f4d997eb2ab01a2252f071"></a><br/></td></tr> <tr class="memitem:a1b22ffb35c7690b4b0d8ba901640edae"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a1b22ffb35c7690b4b0d8ba901640edae">hlineRGBAStore</a> (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a1b22ffb35c7690b4b0d8ba901640edae"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw horizontal line without blending. <a href="#a1b22ffb35c7690b4b0d8ba901640edae"></a><br/></td></tr> <tr class="memitem:ac211a904dce45093315e15b10c80d8ac"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac">hlineColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)</td></tr> <tr class="memdesc:ac211a904dce45093315e15b10c80d8ac"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw horizontal line with blending. <a href="#ac211a904dce45093315e15b10c80d8ac"></a><br/></td></tr> <tr class="memitem:a6608a0d1d4c7e16fa1afcbd3eb5c3850"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a6608a0d1d4c7e16fa1afcbd3eb5c3850">hlineRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a6608a0d1d4c7e16fa1afcbd3eb5c3850"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw horizontal line with blending. <a href="#a6608a0d1d4c7e16fa1afcbd3eb5c3850"></a><br/></td></tr> <tr class="memitem:a9b45060155a19fee24f998d7790f1d67"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67">vlineColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)</td></tr> <tr class="memdesc:a9b45060155a19fee24f998d7790f1d67"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw vertical line with blending. <a href="#a9b45060155a19fee24f998d7790f1d67"></a><br/></td></tr> <tr class="memitem:a8b79ac1e779755aee92b04f3a6cfc5d7"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a8b79ac1e779755aee92b04f3a6cfc5d7">vlineRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a8b79ac1e779755aee92b04f3a6cfc5d7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw vertical line with blending. <a href="#a8b79ac1e779755aee92b04f3a6cfc5d7"></a><br/></td></tr> <tr class="memitem:a6ab25c393f6e5f8d68ea3365f6ea98d2"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a6ab25c393f6e5f8d68ea3365f6ea98d2">rectangleColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)</td></tr> <tr class="memdesc:a6ab25c393f6e5f8d68ea3365f6ea98d2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw rectangle with blending. <a href="#a6ab25c393f6e5f8d68ea3365f6ea98d2"></a><br/></td></tr> <tr class="memitem:a40991c6eeb936d35d0a8e8aa95268f72"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a40991c6eeb936d35d0a8e8aa95268f72">rectangleRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a40991c6eeb936d35d0a8e8aa95268f72"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw rectangle with blending. <a href="#a40991c6eeb936d35d0a8e8aa95268f72"></a><br/></td></tr> <tr class="memitem:a830dd9dcfa39f4718aa2c269060326d0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a830dd9dcfa39f4718aa2c269060326d0">roundedRectangleColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)</td></tr> <tr class="memdesc:a830dd9dcfa39f4718aa2c269060326d0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw rounded-corner rectangle with blending. <a href="#a830dd9dcfa39f4718aa2c269060326d0"></a><br/></td></tr> <tr class="memitem:a300272b3b799f09ca6cd5c541b19f07a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a300272b3b799f09ca6cd5c541b19f07a">roundedRectangleRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a300272b3b799f09ca6cd5c541b19f07a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw rounded-corner rectangle with blending. <a href="#a300272b3b799f09ca6cd5c541b19f07a"></a><br/></td></tr> <tr class="memitem:a718c4f31d1e145106959c2a77d5fee9d"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a718c4f31d1e145106959c2a77d5fee9d">roundedBoxColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)</td></tr> <tr class="memdesc:a718c4f31d1e145106959c2a77d5fee9d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw rounded-corner box (filled rectangle) with blending. <a href="#a718c4f31d1e145106959c2a77d5fee9d"></a><br/></td></tr> <tr class="memitem:aad706348fec18631d7bc48a2d91f5b4d"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#aad706348fec18631d7bc48a2d91f5b4d">roundedBoxRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:aad706348fec18631d7bc48a2d91f5b4d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw rounded-corner box (filled rectangle) with blending. <a href="#aad706348fec18631d7bc48a2d91f5b4d"></a><br/></td></tr> <tr class="memitem:a6bb30dfc32d0aee20271a0356a2e2fd0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a6bb30dfc32d0aee20271a0356a2e2fd0">boxColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)</td></tr> <tr class="memdesc:a6bb30dfc32d0aee20271a0356a2e2fd0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw box (filled rectangle) with blending. <a href="#a6bb30dfc32d0aee20271a0356a2e2fd0"></a><br/></td></tr> <tr class="memitem:a1864b3062793a7f7dd81aaf8c8abd6b0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a1864b3062793a7f7dd81aaf8c8abd6b0">boxRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a1864b3062793a7f7dd81aaf8c8abd6b0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw box (filled rectangle) with blending. <a href="#a1864b3062793a7f7dd81aaf8c8abd6b0"></a><br/></td></tr> <tr class="memitem:ad44c550fab3cb736eb049713ede94052"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#ad44c550fab3cb736eb049713ede94052">lineColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)</td></tr> <tr class="memdesc:ad44c550fab3cb736eb049713ede94052"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw line with alpha blending. <a href="#ad44c550fab3cb736eb049713ede94052"></a><br/></td></tr> <tr class="memitem:a760139e11a9ae5defeb755ca0c794f5f"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a760139e11a9ae5defeb755ca0c794f5f">lineRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a760139e11a9ae5defeb755ca0c794f5f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw line with alpha blending. <a href="#a760139e11a9ae5defeb755ca0c794f5f"></a><br/></td></tr> <tr class="memitem:a41cb32b84aee2742fabd5bbaced8e016"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a41cb32b84aee2742fabd5bbaced8e016">_aalineColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color, int draw_endpoint)</td></tr> <tr class="memdesc:a41cb32b84aee2742fabd5bbaced8e016"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal function to draw anti-aliased line with alpha blending and endpoint control. <a href="#a41cb32b84aee2742fabd5bbaced8e016"></a><br/></td></tr> <tr class="memitem:a25c56f2def855db01dcf7ff7f7356182"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a25c56f2def855db01dcf7ff7f7356182">aalineColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)</td></tr> <tr class="memdesc:a25c56f2def855db01dcf7ff7f7356182"><td class="mdescLeft">&#160;</td><td class="mdescRight">Ddraw anti-aliased line with alpha blending. <a href="#a25c56f2def855db01dcf7ff7f7356182"></a><br/></td></tr> <tr class="memitem:a716b29af8cfc638fad0cfa0f1af15f23"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a716b29af8cfc638fad0cfa0f1af15f23">aalineRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a716b29af8cfc638fad0cfa0f1af15f23"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw anti-aliased line with alpha blending. <a href="#a716b29af8cfc638fad0cfa0f1af15f23"></a><br/></td></tr> <tr class="memitem:aa99bd361cc947b448142720f2ca3320e"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#aa99bd361cc947b448142720f2ca3320e">circleColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)</td></tr> <tr class="memdesc:aa99bd361cc947b448142720f2ca3320e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw circle with blending. <a href="#aa99bd361cc947b448142720f2ca3320e"></a><br/></td></tr> <tr class="memitem:a7fe51d4c9426c8795e58c7ddd313b0a4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a7fe51d4c9426c8795e58c7ddd313b0a4">circleRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a7fe51d4c9426c8795e58c7ddd313b0a4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw circle with blending. <a href="#a7fe51d4c9426c8795e58c7ddd313b0a4"></a><br/></td></tr> <tr class="memitem:a461b8ac31e00306aee5f8a4c242671d2"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a461b8ac31e00306aee5f8a4c242671d2">arcColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)</td></tr> <tr class="memdesc:a461b8ac31e00306aee5f8a4c242671d2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Arc with blending. <a href="#a461b8ac31e00306aee5f8a4c242671d2"></a><br/></td></tr> <tr class="memitem:a2aff993d0d8d64564e16145f401d3cf1"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a2aff993d0d8d64564e16145f401d3cf1">arcRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a2aff993d0d8d64564e16145f401d3cf1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Arc with blending. <a href="#a2aff993d0d8d64564e16145f401d3cf1"></a><br/></td></tr> <tr class="memitem:aad64361b01181e6aff940add96d23c61"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#aad64361b01181e6aff940add96d23c61">aacircleColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)</td></tr> <tr class="memdesc:aad64361b01181e6aff940add96d23c61"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw anti-aliased circle with blending. <a href="#aad64361b01181e6aff940add96d23c61"></a><br/></td></tr> <tr class="memitem:a332780885aa2cfdc2de34dcff8d67e8b"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a332780885aa2cfdc2de34dcff8d67e8b">aacircleRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a332780885aa2cfdc2de34dcff8d67e8b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw anti-aliased circle with blending. <a href="#a332780885aa2cfdc2de34dcff8d67e8b"></a><br/></td></tr> <tr class="memitem:a39147d1282ec814a1b9e31243aad0359"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a39147d1282ec814a1b9e31243aad0359">filledCircleColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)</td></tr> <tr class="memdesc:a39147d1282ec814a1b9e31243aad0359"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled circle with blending. <a href="#a39147d1282ec814a1b9e31243aad0359"></a><br/></td></tr> <tr class="memitem:a562ba6b18fb70547cd50cb3bb0f70272"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a562ba6b18fb70547cd50cb3bb0f70272">filledCircleRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a562ba6b18fb70547cd50cb3bb0f70272"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled circle with blending. <a href="#a562ba6b18fb70547cd50cb3bb0f70272"></a><br/></td></tr> <tr class="memitem:a476cff7702f4be9090871e35859782f0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a476cff7702f4be9090871e35859782f0">ellipseColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)</td></tr> <tr class="memdesc:a476cff7702f4be9090871e35859782f0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw ellipse with blending. <a href="#a476cff7702f4be9090871e35859782f0"></a><br/></td></tr> <tr class="memitem:a18c8a26c9009482eec40f9f4a6945fd1"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a18c8a26c9009482eec40f9f4a6945fd1">ellipseRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a18c8a26c9009482eec40f9f4a6945fd1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw ellipse with blending. <a href="#a18c8a26c9009482eec40f9f4a6945fd1"></a><br/></td></tr> <tr class="memitem:a1c7d20dcba8e0d7ce483f4c854c438be"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a1c7d20dcba8e0d7ce483f4c854c438be">aaellipseColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)</td></tr> <tr class="memdesc:a1c7d20dcba8e0d7ce483f4c854c438be"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw anti-aliased ellipse with blending. <a href="#a1c7d20dcba8e0d7ce483f4c854c438be"></a><br/></td></tr> <tr class="memitem:ab9f0f00d7fb2f04aa9ba1630e31a27bf"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#ab9f0f00d7fb2f04aa9ba1630e31a27bf">aaellipseRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:ab9f0f00d7fb2f04aa9ba1630e31a27bf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw anti-aliased ellipse with blending. <a href="#ab9f0f00d7fb2f04aa9ba1630e31a27bf"></a><br/></td></tr> <tr class="memitem:a8fed50800f2f1bdfaa048698f5052f25"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a8fed50800f2f1bdfaa048698f5052f25">filledEllipseColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)</td></tr> <tr class="memdesc:a8fed50800f2f1bdfaa048698f5052f25"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled ellipse with blending. <a href="#a8fed50800f2f1bdfaa048698f5052f25"></a><br/></td></tr> <tr class="memitem:a33595ad996dd0dcccde3abbcef540eec"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a33595ad996dd0dcccde3abbcef540eec">filledEllipseRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a33595ad996dd0dcccde3abbcef540eec"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled ellipse with blending. <a href="#a33595ad996dd0dcccde3abbcef540eec"></a><br/></td></tr> <tr class="memitem:ac2e0cefca34b74c900cfa68e3915487b"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#ac2e0cefca34b74c900cfa68e3915487b">_pieColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color, Uint8 filled)</td></tr> <tr class="memdesc:ac2e0cefca34b74c900cfa68e3915487b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal float (low-speed) pie-calc implementation by drawing polygons. <a href="#ac2e0cefca34b74c900cfa68e3915487b"></a><br/></td></tr> <tr class="memitem:a3c2bc64deabda74933f31daba6bed7be"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a3c2bc64deabda74933f31daba6bed7be">pieColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)</td></tr> <tr class="memdesc:a3c2bc64deabda74933f31daba6bed7be"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw pie (outline) with alpha blending. <a href="#a3c2bc64deabda74933f31daba6bed7be"></a><br/></td></tr> <tr class="memitem:a8442f2c2bedbe27c96d8d44319981992"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a8442f2c2bedbe27c96d8d44319981992">pieRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a8442f2c2bedbe27c96d8d44319981992"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw pie (outline) with alpha blending. <a href="#a8442f2c2bedbe27c96d8d44319981992"></a><br/></td></tr> <tr class="memitem:a2c30ee985b2513dc58d9b19d4e71562b"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a2c30ee985b2513dc58d9b19d4e71562b">filledPieColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)</td></tr> <tr class="memdesc:a2c30ee985b2513dc58d9b19d4e71562b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled pie with alpha blending. <a href="#a2c30ee985b2513dc58d9b19d4e71562b"></a><br/></td></tr> <tr class="memitem:a4ffdfd2834f3ef0fd0ee622b5f1d16b8"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a4ffdfd2834f3ef0fd0ee622b5f1d16b8">filledPieRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a4ffdfd2834f3ef0fd0ee622b5f1d16b8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled pie with alpha blending. <a href="#a4ffdfd2834f3ef0fd0ee622b5f1d16b8"></a><br/></td></tr> <tr class="memitem:a7465d08ef930ebb5442c7dd246fed4b5"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a7465d08ef930ebb5442c7dd246fed4b5">trigonColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)</td></tr> <tr class="memdesc:a7465d08ef930ebb5442c7dd246fed4b5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw trigon (triangle outline) with alpha blending. <a href="#a7465d08ef930ebb5442c7dd246fed4b5"></a><br/></td></tr> <tr class="memitem:a45d6a7edcd8b25e1a60e39b7f60bda3f"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a45d6a7edcd8b25e1a60e39b7f60bda3f">trigonRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a45d6a7edcd8b25e1a60e39b7f60bda3f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw trigon (triangle outline) with alpha blending. <a href="#a45d6a7edcd8b25e1a60e39b7f60bda3f"></a><br/></td></tr> <tr class="memitem:a4f928dfaef530c83e304a452d2e55190"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a4f928dfaef530c83e304a452d2e55190">aatrigonColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)</td></tr> <tr class="memdesc:a4f928dfaef530c83e304a452d2e55190"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw anti-aliased trigon (triangle outline) with alpha blending. <a href="#a4f928dfaef530c83e304a452d2e55190"></a><br/></td></tr> <tr class="memitem:ab53a84faa65b68e40cb68b8cacbb4b7d"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#ab53a84faa65b68e40cb68b8cacbb4b7d">aatrigonRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:ab53a84faa65b68e40cb68b8cacbb4b7d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw anti-aliased trigon (triangle outline) with alpha blending. <a href="#ab53a84faa65b68e40cb68b8cacbb4b7d"></a><br/></td></tr> <tr class="memitem:a78d4ed2372527f3b78f5893928b0f519"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a78d4ed2372527f3b78f5893928b0f519">filledTrigonColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)</td></tr> <tr class="memdesc:a78d4ed2372527f3b78f5893928b0f519"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled trigon (triangle) with alpha blending. <a href="#a78d4ed2372527f3b78f5893928b0f519"></a><br/></td></tr> <tr class="memitem:a8f318d776ff1e3c6790405e0e59e5356"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a8f318d776ff1e3c6790405e0e59e5356">filledTrigonRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a8f318d776ff1e3c6790405e0e59e5356"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled trigon (triangle) with alpha blending. <a href="#a8f318d776ff1e3c6790405e0e59e5356"></a><br/></td></tr> <tr class="memitem:a2d692dc25f3b579b386dff8dcd9cbc00"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a2d692dc25f3b579b386dff8dcd9cbc00">polygonColor</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)</td></tr> <tr class="memdesc:a2d692dc25f3b579b386dff8dcd9cbc00"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw polygon with alpha blending. <a href="#a2d692dc25f3b579b386dff8dcd9cbc00"></a><br/></td></tr> <tr class="memitem:ae55541ec58990420dc6dc6b9d61f33d6"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#ae55541ec58990420dc6dc6b9d61f33d6">polygonRGBA</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:ae55541ec58990420dc6dc6b9d61f33d6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw polygon with alpha blending. <a href="#ae55541ec58990420dc6dc6b9d61f33d6"></a><br/></td></tr> <tr class="memitem:a09950a50e8806e88bb20c543c58cc6a8"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a09950a50e8806e88bb20c543c58cc6a8">aapolygonColor</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)</td></tr> <tr class="memdesc:a09950a50e8806e88bb20c543c58cc6a8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw anti-aliased polygon with alpha blending. <a href="#a09950a50e8806e88bb20c543c58cc6a8"></a><br/></td></tr> <tr class="memitem:a7d08522e52d8290c5c498ce435fa51f0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a7d08522e52d8290c5c498ce435fa51f0">aapolygonRGBA</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a7d08522e52d8290c5c498ce435fa51f0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw anti-aliased polygon with alpha blending. <a href="#a7d08522e52d8290c5c498ce435fa51f0"></a><br/></td></tr> <tr class="memitem:aeba347cfe2561fdb7f86d995a941ff1a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#aeba347cfe2561fdb7f86d995a941ff1a">_gfxPrimitivesCompareInt</a> (const void *a, const void *b)</td></tr> <tr class="memdesc:aeba347cfe2561fdb7f86d995a941ff1a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal helper qsort callback functions used in filled polygon drawing. <a href="#aeba347cfe2561fdb7f86d995a941ff1a"></a><br/></td></tr> <tr class="memitem:a1f3a2dcda741a2c29b5dacce4ffe0271"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a1f3a2dcda741a2c29b5dacce4ffe0271">filledPolygonColorMT</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color, int **polyInts, int *polyAllocated)</td></tr> <tr class="memdesc:a1f3a2dcda741a2c29b5dacce4ffe0271"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled polygon with alpha blending (multi-threaded capable). <a href="#a1f3a2dcda741a2c29b5dacce4ffe0271"></a><br/></td></tr> <tr class="memitem:a586d64a80ac67de184e33609509d45a9"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a586d64a80ac67de184e33609509d45a9">filledPolygonRGBAMT</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a, int **polyInts, int *polyAllocated)</td></tr> <tr class="memdesc:a586d64a80ac67de184e33609509d45a9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled polygon with alpha blending (multi-threaded capable). <a href="#a586d64a80ac67de184e33609509d45a9"></a><br/></td></tr> <tr class="memitem:af22692175cb73329410cbcc7d7491c4d"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#af22692175cb73329410cbcc7d7491c4d">filledPolygonColor</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)</td></tr> <tr class="memdesc:af22692175cb73329410cbcc7d7491c4d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled polygon with alpha blending. <a href="#af22692175cb73329410cbcc7d7491c4d"></a><br/></td></tr> <tr class="memitem:a40ef0b898905c190c193f0f55deb5a6c"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a40ef0b898905c190c193f0f55deb5a6c">filledPolygonRGBA</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a40ef0b898905c190c193f0f55deb5a6c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled polygon with alpha blending. <a href="#a40ef0b898905c190c193f0f55deb5a6c"></a><br/></td></tr> <tr class="memitem:aba318c28a9d4dfcf6a2e413814979a5a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#aba318c28a9d4dfcf6a2e413814979a5a">_HLineTextured</a> (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, SDL_Surface *texture, int texture_dx, int texture_dy)</td></tr> <tr class="memdesc:aba318c28a9d4dfcf6a2e413814979a5a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal function to draw a textured horizontal line. <a href="#aba318c28a9d4dfcf6a2e413814979a5a"></a><br/></td></tr> <tr class="memitem:a28ae354c6272da21b5753ae4ab9e1e84"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a28ae354c6272da21b5753ae4ab9e1e84">texturedPolygonMT</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, SDL_Surface *texture, int texture_dx, int texture_dy, int **polyInts, int *polyAllocated)</td></tr> <tr class="memdesc:a28ae354c6272da21b5753ae4ab9e1e84"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draws a polygon filled with the given texture (Multi-Threading Capable). <a href="#a28ae354c6272da21b5753ae4ab9e1e84"></a><br/></td></tr> <tr class="memitem:a65137af308ea878f28abc95419e8aef5"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a65137af308ea878f28abc95419e8aef5">texturedPolygon</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, SDL_Surface *texture, int texture_dx, int texture_dy)</td></tr> <tr class="memdesc:a65137af308ea878f28abc95419e8aef5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draws a polygon filled with the given texture. <a href="#a65137af308ea878f28abc95419e8aef5"></a><br/></td></tr> <tr class="memitem:afacd57651ec0e0ccab60753636862cd0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#afacd57651ec0e0ccab60753636862cd0">gfxPrimitivesSetFont</a> (const void *fontdata, Uint32 cw, Uint32 ch)</td></tr> <tr class="memdesc:afacd57651ec0e0ccab60753636862cd0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets or resets the current global font data. <a href="#afacd57651ec0e0ccab60753636862cd0"></a><br/></td></tr> <tr class="memitem:aef6796a883f07d31bbf7c7df6d1153d2"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#aef6796a883f07d31bbf7c7df6d1153d2">gfxPrimitivesSetFontRotation</a> (Uint32 rotation)</td></tr> <tr class="memdesc:aef6796a883f07d31bbf7c7df6d1153d2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets current global font character rotation steps. <a href="#aef6796a883f07d31bbf7c7df6d1153d2"></a><br/></td></tr> <tr class="memitem:aef5fdeb16c4578d8cd50e106299e993e"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#aef5fdeb16c4578d8cd50e106299e993e">characterColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, char c, Uint32 color)</td></tr> <tr class="memdesc:aef5fdeb16c4578d8cd50e106299e993e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw a character of the currently set font. <a href="#aef5fdeb16c4578d8cd50e106299e993e"></a><br/></td></tr> <tr class="memitem:a96379d2ce808aa642afb57bced0c670e"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a96379d2ce808aa642afb57bced0c670e">characterRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a96379d2ce808aa642afb57bced0c670e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw a character of the currently set font. <a href="#a96379d2ce808aa642afb57bced0c670e"></a><br/></td></tr> <tr class="memitem:a62d2ba55abc7673f2dfa29e6bbffefdf"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a62d2ba55abc7673f2dfa29e6bbffefdf">stringColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, const char *s, Uint32 color)</td></tr> <tr class="memdesc:a62d2ba55abc7673f2dfa29e6bbffefdf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw a string in the currently set font. <a href="#a62d2ba55abc7673f2dfa29e6bbffefdf"></a><br/></td></tr> <tr class="memitem:a6ca71826e311bdd9acf13b009256aa1c"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a6ca71826e311bdd9acf13b009256aa1c">stringRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, const char *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a6ca71826e311bdd9acf13b009256aa1c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw a string in the currently set font. <a href="#a6ca71826e311bdd9acf13b009256aa1c"></a><br/></td></tr> <tr class="memitem:a888411ec724ddb9ff19cf9ba9fc067df"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a888411ec724ddb9ff19cf9ba9fc067df">_evaluateBezier</a> (double *data, int ndata, double t)</td></tr> <tr class="memdesc:a888411ec724ddb9ff19cf9ba9fc067df"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal function to calculate bezier interpolator of data array with ndata values at position 't'. <a href="#a888411ec724ddb9ff19cf9ba9fc067df"></a><br/></td></tr> <tr class="memitem:adfe8f9c42d29a090aae15eeb19b80d51"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#adfe8f9c42d29a090aae15eeb19b80d51">bezierColor</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, int s, Uint32 color)</td></tr> <tr class="memdesc:adfe8f9c42d29a090aae15eeb19b80d51"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw a bezier curve with alpha blending. <a href="#adfe8f9c42d29a090aae15eeb19b80d51"></a><br/></td></tr> <tr class="memitem:a4b7fbf6cc366abdf345a25308d53e125"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a4b7fbf6cc366abdf345a25308d53e125">bezierRGBA</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, int s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a4b7fbf6cc366abdf345a25308d53e125"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw a bezier curve with alpha blending. <a href="#a4b7fbf6cc366abdf345a25308d53e125"></a><br/></td></tr> <tr class="memitem:af77127ff68a26c573dc5eb52723fb278"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#af77127ff68a26c573dc5eb52723fb278">_bresenhamInitialize</a> (<a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html">SDL_gfxBresenhamIterator</a> *b, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2)</td></tr> <tr class="memdesc:af77127ff68a26c573dc5eb52723fb278"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal function to initialize the Bresenham line iterator. <a href="#af77127ff68a26c573dc5eb52723fb278"></a><br/></td></tr> <tr class="memitem:a4e0deda326a4dddde7adb2b20f927125"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a4e0deda326a4dddde7adb2b20f927125">_bresenhamIterate</a> (<a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html">SDL_gfxBresenhamIterator</a> *b)</td></tr> <tr class="memdesc:a4e0deda326a4dddde7adb2b20f927125"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal function to move Bresenham line iterator to the next position. <a href="#a4e0deda326a4dddde7adb2b20f927125"></a><br/></td></tr> <tr class="memitem:ae11cad619c4fc85a7ff5d3c9d9686ccb"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#ae11cad619c4fc85a7ff5d3c9d9686ccb">_murphyParaline</a> (<a class="el" href="struct_s_d_l__gfx_murphy_iterator.html">SDL_gfxMurphyIterator</a> *m, Sint16 x, Sint16 y, int d1)</td></tr> <tr class="memdesc:ae11cad619c4fc85a7ff5d3c9d9686ccb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal function to to draw parallel lines with Murphy algorithm. <a href="#ae11cad619c4fc85a7ff5d3c9d9686ccb"></a><br/></td></tr> <tr class="memitem:a9611a25f40d9cd4a70b3424dfa568b8b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a9611a25f40d9cd4a70b3424dfa568b8b">_murphyIteration</a> (<a class="el" href="struct_s_d_l__gfx_murphy_iterator.html">SDL_gfxMurphyIterator</a> *m, Uint8 miter, Uint16 ml1bx, Uint16 ml1by, Uint16 ml2bx, Uint16 ml2by, Uint16 ml1x, Uint16 ml1y, Uint16 ml2x, Uint16 ml2y)</td></tr> <tr class="memdesc:a9611a25f40d9cd4a70b3424dfa568b8b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal function to to draw one iteration of the Murphy algorithm. <a href="#a9611a25f40d9cd4a70b3424dfa568b8b"></a><br/></td></tr> <tr class="memitem:abaa64d3d707ae122c88f2a509cded121"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#abaa64d3d707ae122c88f2a509cded121">_murphyWideline</a> (<a class="el" href="struct_s_d_l__gfx_murphy_iterator.html">SDL_gfxMurphyIterator</a> *m, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 miter)</td></tr> <tr class="memdesc:abaa64d3d707ae122c88f2a509cded121"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal function to to draw wide lines with Murphy algorithm. <a href="#abaa64d3d707ae122c88f2a509cded121"></a><br/></td></tr> <tr class="memitem:a1494109358b4e4b7ec300d83e3f90300"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a1494109358b4e4b7ec300d83e3f90300">thickLineColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint32 color)</td></tr> <tr class="memdesc:a1494109358b4e4b7ec300d83e3f90300"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw a thick line with alpha blending. <a href="#a1494109358b4e4b7ec300d83e3f90300"></a><br/></td></tr> <tr class="memitem:a8b24d64b51e23592c93abc2aa50c818e"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8c.html#a8b24d64b51e23592c93abc2aa50c818e">thickLineRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a8b24d64b51e23592c93abc2aa50c818e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw a thick line with alpha blending. <a href="#a8b24d64b51e23592c93abc2aa50c818e"></a><br/></td></tr> </table> <hr/><h2>Define Documentation</h2> <a class="anchor" id="a2e16571bedf7a97c6fc02d86b48994eb"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8c.html#a2e16571bedf7a97c6fc02d86b48994eb">AAbits</a>&#160;&#160;&#160;8</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l02567">2567</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a519bc2d4d753c51da1b956d6c200bff1"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8c.html#a519bc2d4d753c51da1b956d6c200bff1">AAlevels</a>&#160;&#160;&#160;256</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l02566">2566</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="ae2f08dc603ae93c402abd918ba4e23e1"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8c.html#ae2f08dc603ae93c402abd918ba4e23e1">ABS</a></td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">a</td><td>)</td> <td>&#160;&#160;&#160;(((a)&lt;0) ? -(a) : (a))</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l02333">2333</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="aa24430b32607587eae143f31c1ad14dd"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8c.html#aa24430b32607587eae143f31c1ad14dd">ALPHA_PIXEL_ADDITIVE_BLEND</a></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00044">44</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a004c35133422cb574c41bb114d4592c6"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8c.html#a004c35133422cb574c41bb114d4592c6">CLIP_ACCEPT</a></td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">a, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">b&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td>&#160;&#160;&#160;(!(a|b))</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01991">1991</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="ae4fa529c5f9a39310b98769cdb007c2d"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8c.html#ae4fa529c5f9a39310b98769cdb007c2d">CLIP_BOTTOM_EDGE</a>&#160;&#160;&#160;0x4</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01987">1987</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a3f497d83ed5f593a5bc56c2ba7e13f5b"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8c.html#a3f497d83ed5f593a5bc56c2ba7e13f5b">CLIP_INSIDE</a></td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">a</td><td>)</td> <td>&#160;&#160;&#160;(!a)</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01989">1989</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="ac7260a99c00538400ab4be67304ad36c"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8c.html#ac7260a99c00538400ab4be67304ad36c">CLIP_LEFT_EDGE</a>&#160;&#160;&#160;0x1</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01985">1985</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="ac1e60af8e37b6b372dcfd2d88299b662"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8c.html#ac1e60af8e37b6b372dcfd2d88299b662">CLIP_REJECT</a></td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">a, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">b&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td>&#160;&#160;&#160;(a&amp;b)</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01990">1990</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a0f5e2b2e79afa32c688c77f776a84308"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8c.html#a0f5e2b2e79afa32c688c77f776a84308">CLIP_RIGHT_EDGE</a>&#160;&#160;&#160;0x2</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01986">1986</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="acd233fdea48722eb128c4c48f619a605"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8c.html#acd233fdea48722eb128c4c48f619a605">CLIP_TOP_EDGE</a>&#160;&#160;&#160;0x8</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01988">1988</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="add68946c6ecf1a5b8935309d30b85cab"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8c.html#add68946c6ecf1a5b8935309d30b85cab">clip_xmax</a></td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">surface</td><td>)</td> <td>&#160;&#160;&#160;surface-&gt;clip_rect.x+surface-&gt;clip_rect.w-1</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00073">73</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="adeb851ac45f74ddec914212dd3297433"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8c.html#adeb851ac45f74ddec914212dd3297433">clip_xmin</a></td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">surface</td><td>)</td> <td>&#160;&#160;&#160;surface-&gt;clip_rect.x</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00072">72</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a2f0d9475a02c76e14c8bcba854ac7067"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8c.html#a2f0d9475a02c76e14c8bcba854ac7067">clip_ymax</a></td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">surface</td><td>)</td> <td>&#160;&#160;&#160;surface-&gt;clip_rect.y+surface-&gt;clip_rect.h-1</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00075">75</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="afc94a05f9b044427c21a77cc468aa5d4"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8c.html#afc94a05f9b044427c21a77cc468aa5d4">clip_ymin</a></td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">surface</td><td>)</td> <td>&#160;&#160;&#160;surface-&gt;clip_rect.y</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00074">74</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="aa992e3a7310145e9f9c36edee5795996"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8c.html#aa992e3a7310145e9f9c36edee5795996">DEFAULT_ALPHA_PIXEL_ROUTINE</a></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00042">42</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a764ddb925da0921f024fadb4c12d7382"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8c.html#a764ddb925da0921f024fadb4c12d7382">HYPOT</a></td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">x, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">y&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td>&#160;&#160;&#160;sqrt((double)(x)*(double)(x)+(double)(y)*(double)(y))</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06606">6606</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <hr/><h2>Function Documentation</h2> <a class="anchor" id="a41cb32b84aee2742fabd5bbaced8e016"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#a41cb32b84aee2742fabd5bbaced8e016">_aalineColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>draw_endpoint</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal function to draw anti-aliased line with alpha blending and endpoint control. </p> <p>This implementation of the Wu antialiasing code is based on Mike Abrash's DDJ article which was reprinted as Chapter 42 of his Graphics Programming Black Book, but has been optimized to work with SDL and utilizes 32-bit fixed-point arithmetic by A. Schiffler. The endpoint control allows the supression to draw the last pixel useful for rendering continous aa-lines with alpha&lt;255.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the aa-line. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the aa-line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the aa-line. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the aa-line. </td></tr> <tr><td class="paramname">color</td><td>The color value of the aa-line to draw (0xRRGGBBAA). </td></tr> <tr><td class="paramname">draw_endpoint</td><td>Flag indicating if the endpoint should be drawn; draw if non-zero.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l02589">2589</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="af77127ff68a26c573dc5eb52723fb278"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#af77127ff68a26c573dc5eb52723fb278">_bresenhamInitialize</a> </td> <td>(</td> <td class="paramtype"><a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html">SDL_gfxBresenhamIterator</a> *&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal function to initialize the Bresenham line iterator. </p> <p>Example of use: <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html" title="The structure passed to the internal Bresenham iterator.">SDL_gfxBresenhamIterator</a> b; _bresenhamInitialize (&amp;b, x1, y1, x2, y2); do { plot(b.x, b.y); } while (_bresenhamIterate(&amp;b)==0);</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">b</td><td>Pointer to struct for bresenham line drawing state. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the line. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the line. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the line.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06323">6323</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a4e0deda326a4dddde7adb2b20f927125"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#a4e0deda326a4dddde7adb2b20f927125">_bresenhamIterate</a> </td> <td>(</td> <td class="paramtype"><a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html">SDL_gfxBresenhamIterator</a> *&#160;</td> <td class="paramname"><em>b</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal function to move Bresenham line iterator to the next position. </p> <p>Maybe updates the x and y coordinates of the iterator struct.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">b</td><td>Pointer to struct for bresenham line drawing state.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, 1 if last point was reached, 2 if moving past end-of-line, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06385">6385</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a888411ec724ddb9ff19cf9ba9fc067df"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">double <a class="el" href="_s_d_l__gfx_primitives_8c.html#a888411ec724ddb9ff19cf9ba9fc067df">_evaluateBezier</a> </td> <td>(</td> <td class="paramtype">double *&#160;</td> <td class="paramname"><em>data</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>ndata</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">double&#160;</td> <td class="paramname"><em>t</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal function to calculate bezier interpolator of data array with ndata values at position 't'. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">data</td><td>Array of values. </td></tr> <tr><td class="paramname">ndata</td><td>Size of array. </td></tr> <tr><td class="paramname">t</td><td>Position for which to calculate interpolated value. t should be between [0, ndata].</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Interpolated value at position t, value[0] when t&lt;0, value[n-1] when t&gt;n. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06162">6162</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="ada8cf05419af4be65d3ea5f7c7384e58"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#ada8cf05419af4be65d3ea5f7c7384e58">_filledRectAlpha</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>alpha</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal function to draw filled rectangle with alpha blending. </p> <p>Assumes color is in destination format.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first corner (upper left) of the rectangle. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first corner (upper left) of the rectangle. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second corner (lower right) of the rectangle. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second corner (lower right) of the rectangle. </td></tr> <tr><td class="paramname">color</td><td>The color value of the rectangle to draw (0xRRGGBBAA). </td></tr> <tr><td class="paramname">alpha</td><td>Alpha blending amount for pixels.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00595">595</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="aeba347cfe2561fdb7f86d995a941ff1a"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#aeba347cfe2561fdb7f86d995a941ff1a">_gfxPrimitivesCompareInt</a> </td> <td>(</td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>a</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>b</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal helper qsort callback functions used in filled polygon drawing. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">a</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">b</td><td>Vertex array containing X coordinates of the points of the polygon.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 if a==b, a negative number if a&lt;b or a positive number if a&gt;b. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05163">5163</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a9eb9c20c69b527cda814a19212270efa"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#a9eb9c20c69b527cda814a19212270efa">_HLineAlpha</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal function to draw horizontal line of RGBA color with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. left) of the line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. right) of the line. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the points of the line. </td></tr> <tr><td class="paramname">color</td><td>The color value of the line to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00905">905</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="aba318c28a9d4dfcf6a2e413814979a5a"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#aba318c28a9d4dfcf6a2e413814979a5a">_HLineTextured</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>texture</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>texture_dx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>texture_dy</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal function to draw a textured horizontal line. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. left) of the line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. right) of the line. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the points of the line. </td></tr> <tr><td class="paramname">texture</td><td>The texture surface to retrieve color information from. </td></tr> <tr><td class="paramname">texture_dx</td><td>The X offset for the texture lookup. </td></tr> <tr><td class="paramname">texture_dy</td><td>The Y offset for the textured lookup.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05437">5437</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a9611a25f40d9cd4a70b3424dfa568b8b"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void <a class="el" href="_s_d_l__gfx_primitives_8c.html#a9611a25f40d9cd4a70b3424dfa568b8b">_murphyIteration</a> </td> <td>(</td> <td class="paramtype"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html">SDL_gfxMurphyIterator</a> *&#160;</td> <td class="paramname"><em>m</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>miter</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint16&#160;</td> <td class="paramname"><em>ml1bx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint16&#160;</td> <td class="paramname"><em>ml1by</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint16&#160;</td> <td class="paramname"><em>ml2bx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint16&#160;</td> <td class="paramname"><em>ml2by</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint16&#160;</td> <td class="paramname"><em>ml1x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint16&#160;</td> <td class="paramname"><em>ml1y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint16&#160;</td> <td class="paramname"><em>ml2x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint16&#160;</td> <td class="paramname"><em>ml2y</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal function to to draw one iteration of the Murphy algorithm. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">m</td><td>Pointer to struct for murphy iterator. </td></tr> <tr><td class="paramname">miter</td><td>Iteration count. </td></tr> <tr><td class="paramname">ml1bx</td><td>X coordinate of a point. </td></tr> <tr><td class="paramname">ml1by</td><td>Y coordinate of a point. </td></tr> <tr><td class="paramname">ml2bx</td><td>X coordinate of a point. </td></tr> <tr><td class="paramname">ml2by</td><td>Y coordinate of a point. </td></tr> <tr><td class="paramname">ml1x</td><td>X coordinate of a point. </td></tr> <tr><td class="paramname">ml1y</td><td>Y coordinate of a point. </td></tr> <tr><td class="paramname">ml2x</td><td>X coordinate of a point. </td></tr> <tr><td class="paramname">ml2y</td><td>Y coordinate of a point. </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06490">6490</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="ae11cad619c4fc85a7ff5d3c9d9686ccb"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void <a class="el" href="_s_d_l__gfx_primitives_8c.html#ae11cad619c4fc85a7ff5d3c9d9686ccb">_murphyParaline</a> </td> <td>(</td> <td class="paramtype"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html">SDL_gfxMurphyIterator</a> *&#160;</td> <td class="paramname"><em>m</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>d1</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal function to to draw parallel lines with Murphy algorithm. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">m</td><td>Pointer to struct for murphy iterator. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of point. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of point. </td></tr> <tr><td class="paramname">d1</td><td>Direction square/diagonal. </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06428">6428</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="abaa64d3d707ae122c88f2a509cded121"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void <a class="el" href="_s_d_l__gfx_primitives_8c.html#abaa64d3d707ae122c88f2a509cded121">_murphyWideline</a> </td> <td>(</td> <td class="paramtype"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html">SDL_gfxMurphyIterator</a> *&#160;</td> <td class="paramname"><em>m</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>width</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>miter</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal function to to draw wide lines with Murphy algorithm. </p> <p>Draws lines parallel to ideal line.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">m</td><td>Pointer to struct for murphy iterator. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of first point. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of first point. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of second point. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of second point. </td></tr> <tr><td class="paramname">width</td><td>Width of line. </td></tr> <tr><td class="paramname">miter</td><td>Iteration count. </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06622">6622</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="ac2e0cefca34b74c900cfa68e3915487b"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#ac2e0cefca34b74c900cfa68e3915487b">_pieColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>start</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>end</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>filled</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal float (low-speed) pie-calc implementation by drawing polygons. </p> <p>Note: Determines vertex array and uses polygon or filledPolygon drawing routines to render.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the pie. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the pie. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the pie. </td></tr> <tr><td class="paramname">start</td><td>Starting radius in degrees of the pie. </td></tr> <tr><td class="paramname">end</td><td>Ending radius in degrees of the pie. </td></tr> <tr><td class="paramname">color</td><td>The color value of the pie to draw (0xRRGGBBAA). </td></tr> <tr><td class="paramname">filled</td><td>Flag indicating if the pie should be filled (=1) or not (=0).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04553">4553</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="ad31779f1ef8bad84496d4c930ec2c208"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#ad31779f1ef8bad84496d4c930ec2c208">_putPixelAlpha</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>alpha</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal pixel drawing function with alpha blending where input color in in destination format. </p> <p>Contains two alternative 32 bit alpha blending routines which can be enabled at the source level with the defines DEFAULT_ALPHA_PIXEL_ROUTINE or EXPERIMENTAL_ALPHA_PIXEL_ROUTINE. Only the bits up to the surface depth are significant in the color value.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>The horizontal coordinate of the pixel. </td></tr> <tr><td class="paramname">y</td><td>The vertical position of the pixel. </td></tr> <tr><td class="paramname">color</td><td>The color value of the pixel to draw. </td></tr> <tr><td class="paramname">alpha</td><td>The blend factor to apply while drawing.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00286">286</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a61dd5e7523ce84fb103da3338acd3a37"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#a61dd5e7523ce84fb103da3338acd3a37">_VLineAlpha</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal function to draw vertical line of RGBA color with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the points of the line. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (top) of the line. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (bottom) of the line. </td></tr> <tr><td class="paramname">color</td><td>The color value of the line to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00921">921</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="aad64361b01181e6aff940add96d23c61"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#aee66c744f9fbe58c9f93ad33375373c3">aacircleColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw anti-aliased circle with blending. </p> <p>Note: The AA-circle routine is based on AA-ellipse with identical radii.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the aa-circle. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the aa-circle. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the aa-circle. </td></tr> <tr><td class="paramname">color</td><td>The color value of the aa-circle to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l03512">3512</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a332780885aa2cfdc2de34dcff8d67e8b"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a613099498679e6280959cdfdcd59a143">aacircleRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw anti-aliased circle with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the aa-circle. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the aa-circle. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the aa-circle. </td></tr> <tr><td class="paramname">r</td><td>The red value of the aa-circle to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the aa-circle to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the aa-circle to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the aa-circle to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l03531">3531</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a1c7d20dcba8e0d7ce483f4c854c438be"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6edf60c54acc964cbb47ddefc6c0d450">aaellipseColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>ry</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw anti-aliased ellipse with blending. </p> <p>Note: Based on code from Anders Lindstroem, which is based on code from sge library, which is based on code from TwinLib.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the aa-ellipse. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the aa-ellipse. </td></tr> <tr><td class="paramname">rx</td><td>Horizontal radius in pixels of the aa-ellipse. </td></tr> <tr><td class="paramname">ry</td><td>Vertical radius in pixels of the aa-ellipse. </td></tr> <tr><td class="paramname">color</td><td>The color value of the aa-ellipse to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04088">4088</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="ab9f0f00d7fb2f04aa9ba1630e31a27bf"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#ab6db169d39ea972469e761f338153e21">aaellipseRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>ry</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw anti-aliased ellipse with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the aa-ellipse. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the aa-ellipse. </td></tr> <tr><td class="paramname">rx</td><td>Horizontal radius in pixels of the aa-ellipse. </td></tr> <tr><td class="paramname">ry</td><td>Vertical radius in pixels of the aa-ellipse. </td></tr> <tr><td class="paramname">r</td><td>The red value of the aa-ellipse to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the aa-ellipse to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the aa-ellipse to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the aa-ellipse to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04328">4328</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a25c56f2def855db01dcf7ff7f7356182"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a4711ada424cb411e328fcedbf28ca5bd">aalineColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Ddraw anti-aliased line with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the aa-line. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the aa-line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the aa-line. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the aa-line. </td></tr> <tr><td class="paramname">color</td><td>The color value of the aa-line to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l02828">2828</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a716b29af8cfc638fad0cfa0f1af15f23"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#aaf65728167a6aa7b37010560507fb4a2">aalineRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw anti-aliased line with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the aa-line. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the aa-line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the aa-line. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the aa-line. </td></tr> <tr><td class="paramname">r</td><td>The red value of the aa-line to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the aa-line to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the aa-line to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the aa-line to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l02848">2848</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a09950a50e8806e88bb20c543c58cc6a8"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#acee2be5e220639d3e5c5bc643e091c1c">aapolygonColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw anti-aliased polygon with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">vx</td><td>Vertex array containing X coordinates of the points of the aa-polygon. </td></tr> <tr><td class="paramname">vy</td><td>Vertex array containing Y coordinates of the points of the aa-polygon. </td></tr> <tr><td class="paramname">n</td><td>Number of points in the vertex array. Minimum number is 3. </td></tr> <tr><td class="paramname">color</td><td>The color value of the aa-polygon to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05077">5077</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a7d08522e52d8290c5c498ce435fa51f0"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#aad73d6fc11bb01946d0ffe1c9d657cb1">aapolygonRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw anti-aliased polygon with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">vx</td><td>Vertex array containing X coordinates of the points of the aa-polygon. </td></tr> <tr><td class="paramname">vy</td><td>Vertex array containing Y coordinates of the points of the aa-polygon. </td></tr> <tr><td class="paramname">n</td><td>Number of points in the vertex array. Minimum number is 3. </td></tr> <tr><td class="paramname">r</td><td>The red value of the aa-polygon to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the aa-polygon to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the aa-polygon to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the aa-polygon to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05145">5145</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a4f928dfaef530c83e304a452d2e55190"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a330917705809bb5f7d74ef232dde5f12">aatrigonColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw anti-aliased trigon (triangle outline) with alpha blending. </p> <p>Note: Creates vertex array and uses aapolygon routine to render.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the aa-trigon. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the aa-trigon. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the aa-trigon. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the aa-trigon. </td></tr> <tr><td class="paramname">x3</td><td>X coordinate of the third point of the aa-trigon. </td></tr> <tr><td class="paramname">y3</td><td>Y coordinate of the third point of the aa-trigon. </td></tr> <tr><td class="paramname">color</td><td>The color value of the aa-trigon to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04859">4859</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="ab53a84faa65b68e40cb68b8cacbb4b7d"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a5e88106c90fc2e0e25d0f7617459d4f9">aatrigonRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw anti-aliased trigon (triangle outline) with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the aa-trigon. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the aa-trigon. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the aa-trigon. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the aa-trigon. </td></tr> <tr><td class="paramname">x3</td><td>X coordinate of the third point of the aa-trigon. </td></tr> <tr><td class="paramname">y3</td><td>Y coordinate of the third point of the aa-trigon. </td></tr> <tr><td class="paramname">r</td><td>The red value of the aa-trigon to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the aa-trigon to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the aa-trigon to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the aa-trigon to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04891">4891</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a461b8ac31e00306aee5f8a4c242671d2"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6180558aff14d3c240d9e8bf919869ef">arcColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>start</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>end</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Arc with blending. </p> <p>Note Arc drawing is based on circle algorithm by A. Schiffler and written by D. Raber. Calculates which octants arc goes through and renders pixels accordingly.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the arc. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the arc. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the arc. </td></tr> <tr><td class="paramname">start</td><td>Starting radius in degrees of the arc. 0 degrees is down, increasing counterclockwise. </td></tr> <tr><td class="paramname">end</td><td>Ending radius in degrees of the arc. 0 degrees is down, increasing counterclockwise. </td></tr> <tr><td class="paramname">color</td><td>The color value of the arc to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l03117">3117</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a2aff993d0d8d64564e16145f401d3cf1"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a5d8d25ecb69e9386289125eb21668a2f">arcRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>start</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>end</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Arc with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the arc. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the arc. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the arc. </td></tr> <tr><td class="paramname">start</td><td>Starting radius in degrees of the arc. 0 degrees is down, increasing counterclockwise. </td></tr> <tr><td class="paramname">end</td><td>Ending radius in degrees of the arc. 0 degrees is down, increasing counterclockwise. </td></tr> <tr><td class="paramname">r</td><td>The red value of the arc to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the arc to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the arc to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the arc to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l03488">3488</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="adfe8f9c42d29a090aae15eeb19b80d51"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#ad82395ca72b749494ff89be78f168341">bezierColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>s</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw a bezier curve with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">vx</td><td>Vertex array containing X coordinates of the points of the bezier curve. </td></tr> <tr><td class="paramname">vy</td><td>Vertex array containing Y coordinates of the points of the bezier curve. </td></tr> <tr><td class="paramname">n</td><td>Number of points in the vertex array. Minimum number is 3. </td></tr> <tr><td class="paramname">s</td><td>Number of steps for the interpolation. Minimum number is 2. </td></tr> <tr><td class="paramname">color</td><td>The color value of the bezier curve to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06221">6221</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a4b7fbf6cc366abdf345a25308d53e125"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a7203e3a463da499b5b0cadf211d19ff3">bezierRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>s</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw a bezier curve with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">vx</td><td>Vertex array containing X coordinates of the points of the bezier curve. </td></tr> <tr><td class="paramname">vy</td><td>Vertex array containing Y coordinates of the points of the bezier curve. </td></tr> <tr><td class="paramname">n</td><td>Number of points in the vertex array. Minimum number is 3. </td></tr> <tr><td class="paramname">s</td><td>Number of steps for the interpolation. Minimum number is 2. </td></tr> <tr><td class="paramname">r</td><td>The red value of the bezier curve to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the bezier curve to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the bezier curve to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the bezier curve to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06296">6296</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a6bb30dfc32d0aee20271a0356a2e2fd0"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a16693489da67d6e65a28f9e5217b46f9">boxColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw box (filled rectangle) with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. top right) of the box. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (i.e. top right) of the box. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. bottom left) of the box. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (i.e. bottom left) of the box. </td></tr> <tr><td class="paramname">color</td><td>The color value of the box to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l02107">2107</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a1864b3062793a7f7dd81aaf8c8abd6b0"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a0ae084c90bd9b734356ad723d45973c8">boxRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw box (filled rectangle) with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. top right) of the box. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (i.e. top right) of the box. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. bottom left) of the box. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (i.e. bottom left) of the box. </td></tr> <tr><td class="paramname">r</td><td>The red value of the box to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the box to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the box to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the box to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l02319">2319</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="aef5fdeb16c4578d8cd50e106299e993e"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#af1991f2031346131db4ae8fd40492b08">characterColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">char&#160;</td> <td class="paramname"><em>c</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw a character of the currently set font. </p> <p>On first call for a particular character and color combination, the function needs to generate the character surface (slower. Subsequent calls blit a cached surface (fast). Uses alpha blending if A&lt;255 in color.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X (horizontal) coordinate of the upper left corner of the character. </td></tr> <tr><td class="paramname">y</td><td>Y (vertical) coordinate of the upper left corner of the character. </td></tr> <tr><td class="paramname">c</td><td>The character to draw. </td></tr> <tr><td class="paramname">color</td><td>The color value of the character to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05908">5908</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a96379d2ce808aa642afb57bced0c670e"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a3f2f624c33ca753d22db52a8d9363fac">characterRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">char&#160;</td> <td class="paramname"><em>c</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw a character of the currently set font. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X (horizontal) coordinate of the upper left corner of the character. </td></tr> <tr><td class="paramname">y</td><td>Y (vertical) coordinate of the upper left corner of the character. </td></tr> <tr><td class="paramname">c</td><td>The character to draw. </td></tr> <tr><td class="paramname">r</td><td>The red value of the character to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the character to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the character to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the character to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06077">6077</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="aa99bd361cc947b448142720f2ca3320e"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a58d231ecaf113f53c2a28435e0632624">circleColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw circle with blending. </p> <p>Note: Circle drawing routine is based on an algorithms from the sge library, but modified by A. Schiffler for multiple pixel-draw removal and other minor speedup changes.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the circle. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the circle. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the circle. </td></tr> <tr><td class="paramname">color</td><td>The color value of the circle to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l02872">2872</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a7fe51d4c9426c8795e58c7ddd313b0a4"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a8e0945b74c02cdb1441e1b2a29d2c87d">circleRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw circle with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the circle. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the circle. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the circle. </td></tr> <tr><td class="paramname">r</td><td>The red value of the circle to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the circle to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the circle to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the circle to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l03090">3090</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a476cff7702f4be9090871e35859782f0"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a8b46f389c626806e7a1ec148f0980737">ellipseColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>ry</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw ellipse with blending. </p> <p>Note: Based on algorithms from sge library with modifications by A. Schiffler for multiple-pixel draw removal and other minor speedup changes.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the ellipse. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the ellipse. </td></tr> <tr><td class="paramname">rx</td><td>Horizontal radius in pixels of the ellipse. </td></tr> <tr><td class="paramname">ry</td><td>Vertical radius in pixels of the ellipse. </td></tr> <tr><td class="paramname">color</td><td>The color value of the ellipse to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l03709">3709</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a18c8a26c9009482eec40f9f4a6945fd1"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a523156891302420d2296b1a302c1fc2b">ellipseRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>ry</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw ellipse with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the ellipse. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the ellipse. </td></tr> <tr><td class="paramname">rx</td><td>Horizontal radius in pixels of the ellipse. </td></tr> <tr><td class="paramname">ry</td><td>Vertical radius in pixels of the ellipse. </td></tr> <tr><td class="paramname">r</td><td>The red value of the ellipse to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the ellipse to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the ellipse to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the ellipse to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04023">4023</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="abeed0e873efdf3aec8c6c86188d36f89"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#abeed0e873efdf3aec8c6c86188d36f89">fastPixelColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal pixel drawing - fast, no blending, locking, clipping. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>The horizontal coordinate of the pixel. </td></tr> <tr><td class="paramname">y</td><td>The vertical position of the pixel. </td></tr> <tr><td class="paramname">color</td><td>The color value of the pixel to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00190">190</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a011e3e26d7216998357fb1a089f8f742"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742">fastPixelColorNolock</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal pixel drawing - fast, no blending, no locking, clipping. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>The horizontal coordinate of the pixel. </td></tr> <tr><td class="paramname">y</td><td>The vertical position of the pixel. </td></tr> <tr><td class="paramname">color</td><td>The color value of the pixel to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00087">87</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="add868bff0c4cb75012a0407af6b64f03"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#add868bff0c4cb75012a0407af6b64f03">fastPixelColorNolockNoclip</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal pixel drawing - fast, no blending, no locking, no clipping. </p> <p>Function is faster but dangerous since no clipping check is done. Code needs to make sure we stay in surface bounds before calling.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>The horizontal coordinate of the pixel. </td></tr> <tr><td class="paramname">y</td><td>The vertical position of the pixel. </td></tr> <tr><td class="paramname">color</td><td>The color value of the pixel to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00144">144</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a9874fabafdc422223323751671bca7c0"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#a9874fabafdc422223323751671bca7c0">fastPixelRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal pixel drawing - fast, no blending, locking, RGB input. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>The horizontal coordinate of the pixel. </td></tr> <tr><td class="paramname">y</td><td>The vertical position of the pixel. </td></tr> <tr><td class="paramname">r</td><td>The red value of the pixel to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the pixel to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the pixel to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the pixel to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00228">228</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a64916bb8270e75d936cda816d3694a25"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#a64916bb8270e75d936cda816d3694a25">fastPixelRGBANolock</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal pixel drawing - fast, no blending, no locking RGB input. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>The horizontal coordinate of the pixel. </td></tr> <tr><td class="paramname">y</td><td>The vertical position of the pixel. </td></tr> <tr><td class="paramname">r</td><td>The red value of the pixel to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the pixel to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the pixel to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the pixel to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00256">256</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a39147d1282ec814a1b9e31243aad0359"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a4f7b717b958ef39bfc8c958476dd0de1">filledCircleColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled circle with blending. </p> <p>Note: Based on algorithms from sge library with modifications by A. Schiffler for multiple-hline draw removal and other minor speedup changes.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the filled circle. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the filled circle. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the filled circle. </td></tr> <tr><td class="paramname">color</td><td>The color value of the filled circle to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l03556">3556</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a562ba6b18fb70547cd50cb3bb0f70272"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a01af970ce0be38cea9884bc6f816c984">filledCircleRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled circle with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the filled circle. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the filled circle. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the filled circle. </td></tr> <tr><td class="paramname">r</td><td>The red value of the filled circle to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the filled circle to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the filled circle to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the filled circle to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l03683">3683</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a8fed50800f2f1bdfaa048698f5052f25"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a36e83e5648b95d38d1efe98dcf840fab">filledEllipseColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>ry</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled ellipse with blending. </p> <p>Note: Based on algorithm from sge library with multiple-hline draw removal and other speedup changes.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the filled ellipse. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the filled ellipse. </td></tr> <tr><td class="paramname">rx</td><td>Horizontal radius in pixels of the filled ellipse. </td></tr> <tr><td class="paramname">ry</td><td>Vertical radius in pixels of the filled ellipse. </td></tr> <tr><td class="paramname">color</td><td>The color value of the filled ellipse to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04358">4358</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a33595ad996dd0dcccde3abbcef540eec"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a26f01b9c0cf7a533023869dff439254f">filledEllipseRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>ry</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled ellipse with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the filled ellipse. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the filled ellipse. </td></tr> <tr><td class="paramname">rx</td><td>Horizontal radius in pixels of the filled ellipse. </td></tr> <tr><td class="paramname">ry</td><td>Vertical radius in pixels of the filled ellipse. </td></tr> <tr><td class="paramname">r</td><td>The red value of the filled ellipse to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the filled ellipse to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the filled ellipse to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the filled ellipse to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04526">4526</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a2c30ee985b2513dc58d9b19d4e71562b"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a8f18679aa7161f885613ec08e7f41692">filledPieColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>start</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>end</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled pie with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the filled pie. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the filled pie. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the filled pie. </td></tr> <tr><td class="paramname">start</td><td>Starting radius in degrees of the filled pie. </td></tr> <tr><td class="paramname">end</td><td>Ending radius in degrees of the filled pie. </td></tr> <tr><td class="paramname">color</td><td>The color value of the filled pie to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04747">4747</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a4ffdfd2834f3ef0fd0ee622b5f1d16b8"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a1944c066d27fa9847a5fdecd1d3b9116">filledPieRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>start</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>end</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled pie with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the filled pie. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the filled pie. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the filled pie. </td></tr> <tr><td class="paramname">start</td><td>Starting radius in degrees of the filled pie. </td></tr> <tr><td class="paramname">end</td><td>Ending radius in degrees of the filled pie. </td></tr> <tr><td class="paramname">r</td><td>The red value of the filled pie to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the filled pie to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the filled pie to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the filled pie to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04768">4768</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="af22692175cb73329410cbcc7d7491c4d"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a5e1fe45b835b623f6939ff0f08277531">filledPolygonColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled polygon with alpha blending. </p> <p>Note: Standard filledPolygon function is calling multithreaded version with NULL parameters to use the global vertex cache.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">vx</td><td>Vertex array containing X coordinates of the points of the filled polygon. </td></tr> <tr><td class="paramname">vy</td><td>Vertex array containing Y coordinates of the points of the filled polygon. </td></tr> <tr><td class="paramname">n</td><td>Number of points in the vertex array. Minimum number is 3. </td></tr> <tr><td class="paramname">color</td><td>The color value of the filled polygon to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05394">5394</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a1f3a2dcda741a2c29b5dacce4ffe0271"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a0f5583d5b055f3e59a9692ca8a9dfbcf">filledPolygonColorMT</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int **&#160;</td> <td class="paramname"><em>polyInts</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int *&#160;</td> <td class="paramname"><em>polyAllocated</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled polygon with alpha blending (multi-threaded capable). </p> <p>Note: The last two parameters are optional; but are required for multithreaded operation.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">vx</td><td>Vertex array containing X coordinates of the points of the filled polygon. </td></tr> <tr><td class="paramname">vy</td><td>Vertex array containing Y coordinates of the points of the filled polygon. </td></tr> <tr><td class="paramname">n</td><td>Number of points in the vertex array. Minimum number is 3. </td></tr> <tr><td class="paramname">color</td><td>The color value of the filled polygon to draw (0xRRGGBBAA). </td></tr> <tr><td class="paramname">polyInts</td><td>Preallocated, temporary vertex array used for sorting vertices. Required for multithreaded operation; set to NULL otherwise. </td></tr> <tr><td class="paramname">polyAllocated</td><td>Flag indicating if temporary vertex array was allocated. Required for multithreaded operation; set to NULL otherwise.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05197">5197</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a40ef0b898905c190c193f0f55deb5a6c"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a2b1023ddbbb25d57bd51676b49234af4">filledPolygonRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled polygon with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">vx</td><td>Vertex array containing X coordinates of the points of the filled polygon. </td></tr> <tr><td class="paramname">vy</td><td>Vertex array containing Y coordinates of the points of the filled polygon. </td></tr> <tr><td class="paramname">n</td><td>Number of points in the vertex array. Minimum number is 3. </td></tr> <tr><td class="paramname">r</td><td>The red value of the filled polygon to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the filled polygon to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the filed polygon to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the filled polygon to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05416">5416</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a586d64a80ac67de184e33609509d45a9"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a412cddc17a592c167c060ec2d1d2fd1d">filledPolygonRGBAMT</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int **&#160;</td> <td class="paramname"><em>polyInts</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int *&#160;</td> <td class="paramname"><em>polyAllocated</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled polygon with alpha blending (multi-threaded capable). </p> <p>Note: The last two parameters are optional; but are required for multithreaded operation.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">vx</td><td>Vertex array containing X coordinates of the points of the filled polygon. </td></tr> <tr><td class="paramname">vy</td><td>Vertex array containing Y coordinates of the points of the filled polygon. </td></tr> <tr><td class="paramname">n</td><td>Number of points in the vertex array. Minimum number is 3. </td></tr> <tr><td class="paramname">r</td><td>The red value of the filled polygon to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the filled polygon to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the filed polygon to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the filled polygon to draw. </td></tr> <tr><td class="paramname">polyInts</td><td>Preallocated, temporary vertex array used for sorting vertices. Required for multithreaded operation; set to NULL otherwise. </td></tr> <tr><td class="paramname">polyAllocated</td><td>Flag indicating if temporary vertex array was allocated. Required for multithreaded operation; set to NULL otherwise.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05372">5372</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="ace9f2505c12c5dacc778509991cd3716"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#ace9f2505c12c5dacc778509991cd3716">filledRectAlpha</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled rectangle of RGBA color with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first corner (upper left) of the rectangle. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first corner (upper left) of the rectangle. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second corner (lower right) of the rectangle. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second corner (lower right) of the rectangle. </td></tr> <tr><td class="paramname">color</td><td>The color value of the rectangle to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00856">856</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a78d4ed2372527f3b78f5893928b0f519"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6adaf54b33bf067e4fe2cc5a7ae17ef6">filledTrigonColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled trigon (triangle) with alpha blending. </p> <p>Note: Creates vertex array and uses aapolygon routine to render.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the filled trigon. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the filled trigon. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the filled trigon. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the filled trigon. </td></tr> <tr><td class="paramname">x3</td><td>X coordinate of the third point of the filled trigon. </td></tr> <tr><td class="paramname">y3</td><td>Y coordinate of the third point of the filled trigon. </td></tr> <tr><td class="paramname">color</td><td>The color value of the filled trigon to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04925">4925</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a8f318d776ff1e3c6790405e0e59e5356"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a4a3318a183659aab7c12c0334e261837">filledTrigonRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled trigon (triangle) with alpha blending. </p> <p>Note: Creates vertex array and uses aapolygon routine to render.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the filled trigon. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the filled trigon. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the filled trigon. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the filled trigon. </td></tr> <tr><td class="paramname">x3</td><td>X coordinate of the third point of the filled trigon. </td></tr> <tr><td class="paramname">y3</td><td>Y coordinate of the third point of the filled trigon. </td></tr> <tr><td class="paramname">r</td><td>The red value of the filled trigon to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the filled trigon to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the filled trigon to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the filled trigon to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04959">4959</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="afacd57651ec0e0ccab60753636862cd0"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void <a class="el" href="_s_d_l__gfx_primitives_8h.html#a7cabe806643c19159948639faaf26a38">gfxPrimitivesSetFont</a> </td> <td>(</td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>fontdata</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>cw</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>ch</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Sets or resets the current global font data. </p> <p>The font data array is organized in follows: [fontdata] = [character 0][character 1]...[character 255] where [character n] = [byte 1 row 1][byte 2 row 1]...[byte {pitch} row 1][byte 1 row 2] ...[byte {pitch} row height] where [byte n] = [bit 0]...[bit 7] where [bit n] = [0 for transparent pixel|1 for colored pixel]</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">fontdata</td><td>Pointer to array of font data. Set to NULL, to reset global font to the default 8x8 font. </td></tr> <tr><td class="paramname">cw</td><td>Width of character in bytes. Ignored if fontdata==NULL. </td></tr> <tr><td class="paramname">ch</td><td>Height of character in bytes. Ignored if fontdata==NULL. </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05815">5815</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="aef6796a883f07d31bbf7c7df6d1153d2"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void <a class="el" href="_s_d_l__gfx_primitives_8h.html#a77cc480ba039c758d1cf0cd43db04bd6">gfxPrimitivesSetFontRotation</a> </td> <td>(</td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>rotation</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Sets current global font character rotation steps. </p> <p>Default is 0 (no rotation). 1 = 90deg clockwise. 2 = 180deg clockwise. 3 = 270deg clockwise. Changing the rotation, will reset the character cache.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">rotation</td><td>Number of 90deg clockwise steps to rotate </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05861">5861</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="ac211a904dce45093315e15b10c80d8ac"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a31ac87bf32186325deedf5188b987ef6">hlineColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw horizontal line with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. left) of the line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. right) of the line. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the points of the line. </td></tr> <tr><td class="paramname">color</td><td>The color value of the line to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01204">1204</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="af20de4fe06f4d997eb2ab01a2252f071"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#af20de4fe06f4d997eb2ab01a2252f071">hlineColorStore</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw horizontal line without blending;. </p> <p>Just stores the color value (including the alpha component) without blending. Only the same number of bits of the destination surface are transfered from the input color value.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. left) of the line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. right) of the line. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the points of the line. </td></tr> <tr><td class="paramname">color</td><td>The color value of the line to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01041">1041</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a6608a0d1d4c7e16fa1afcbd3eb5c3850"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#ae48e69e0f5d13ea79ffac262b146ae9e">hlineRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw horizontal line with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. left) of the line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. right) of the line. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the points of the line. </td></tr> <tr><td class="paramname">r</td><td>The red value of the line to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the line to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the line to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the line to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01373">1373</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a1b22ffb35c7690b4b0d8ba901640edae"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#a1b22ffb35c7690b4b0d8ba901640edae">hlineRGBAStore</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw horizontal line without blending. </p> <p>Just stores the color value (including the alpha component) without blending. Function should only be used for 32 bit target surfaces.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. left) of the line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. right) of the line. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the points of the line. </td></tr> <tr><td class="paramname">r</td><td>The red value of the line to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the line to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the line to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the line to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01185">1185</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="ad44c550fab3cb736eb049713ede94052"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6f37058aed308619de8109ebe84b5fe9">lineColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw line with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the line. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the line. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the line. </td></tr> <tr><td class="paramname">color</td><td>The color value of the line to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l02347">2347</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a760139e11a9ae5defeb755ca0c794f5f"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a5e4bd13b12d34698fbcb2dc9d3a0e9f3">lineRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw line with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the line. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the line. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the line. </td></tr> <tr><td class="paramname">r</td><td>The red value of the line to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the line to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the line to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the line to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l02556">2556</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a3c2bc64deabda74933f31daba6bed7be"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6476d5dad22631d10c1dc95b0e88fc65">pieColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>start</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>end</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw pie (outline) with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the pie. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the pie. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the pie. </td></tr> <tr><td class="paramname">start</td><td>Starting radius in degrees of the pie. </td></tr> <tr><td class="paramname">end</td><td>Ending radius in degrees of the pie. </td></tr> <tr><td class="paramname">color</td><td>The color value of the pie to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04703">4703</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a8442f2c2bedbe27c96d8d44319981992"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a4a5e4344913667e714560dd204473663">pieRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>start</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>end</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw pie (outline) with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the pie. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the pie. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the pie. </td></tr> <tr><td class="paramname">start</td><td>Starting radius in degrees of the pie. </td></tr> <tr><td class="paramname">end</td><td>Ending radius in degrees of the pie. </td></tr> <tr><td class="paramname">r</td><td>The red value of the pie to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the pie to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the pie to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the pie to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04726">4726</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="ae6f8690e5c5a85d3263c8e16727b34ef"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a7fe611dbb029ae70be89d5314c7e023b">pixelColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Pixel draw with blending enabled if a&lt;255. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X (horizontal) coordinate of the pixel. </td></tr> <tr><td class="paramname">y</td><td>Y (vertical) coordinate of the pixel. </td></tr> <tr><td class="paramname">color</td><td>The color value of the pixel to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00509">509</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="ae94ba03884eee47c3bcc8e2fc35da9f0"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0">pixelColorNolock</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Pixel draw with blending enabled if a&lt;255 - no surface locking. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X (horizontal) coordinate of the pixel. </td></tr> <tr><td class="paramname">y</td><td>Y (vertical) coordinate of the pixel. </td></tr> <tr><td class="paramname">color</td><td>The color value of the pixel to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00557">557</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="af9269ad9bbfa20980d5947c85dda63d5"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#af9269ad9bbfa20980d5947c85dda63d5">pixelColorWeight</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>weight</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Pixel draw with blending enabled and using alpha weight on color. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>The horizontal coordinate of the pixel. </td></tr> <tr><td class="paramname">y</td><td>The vertical position of the pixel. </td></tr> <tr><td class="paramname">color</td><td>The color value of the pixel to draw (0xRRGGBBAA). </td></tr> <tr><td class="paramname">weight</td><td>The weight multiplied into the alpha value of the pixel.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00937">937</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a93c580afe80682f06ef4f1655180aff1"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1">pixelColorWeightNolock</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>weight</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Pixel draw with blending enabled and using alpha weight on color - no locking. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>The horizontal coordinate of the pixel. </td></tr> <tr><td class="paramname">y</td><td>The vertical position of the pixel. </td></tr> <tr><td class="paramname">color</td><td>The color value of the pixel to draw (0xRRGGBBAA). </td></tr> <tr><td class="paramname">weight</td><td>The weight multiplied into the alpha value of the pixel.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00965">965</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a7b6f83bdef72f6b356664a93841381c0"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a0046efc721e77b745fd5b621fbd48513">pixelRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Pixel draw with blending enabled if a&lt;255. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X (horizontal) coordinate of the pixel. </td></tr> <tr><td class="paramname">y</td><td>Y (vertical) coordinate of the pixel. </td></tr> <tr><td class="paramname">r</td><td>The red color value of the pixel to draw. </td></tr> <tr><td class="paramname">g</td><td>The green color value of the pixel to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue color value of the pixel to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the pixel to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00995">995</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a2d692dc25f3b579b386dff8dcd9cbc00"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#abe5d0b2f6193558798eaff3e85e7a1af">polygonColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw polygon with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">vx</td><td>Vertex array containing X coordinates of the points of the polygon. </td></tr> <tr><td class="paramname">vy</td><td>Vertex array containing Y coordinates of the points of the polygon. </td></tr> <tr><td class="paramname">n</td><td>Number of points in the vertex array. Minimum number is 3. </td></tr> <tr><td class="paramname">color</td><td>The color value of the polygon to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04988">4988</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="ae55541ec58990420dc6dc6b9d61f33d6"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a46b327da5cba5d401cf400bdef7560d0">polygonRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw polygon with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">vx</td><td>Vertex array containing X coordinates of the points of the polygon. </td></tr> <tr><td class="paramname">vy</td><td>Vertex array containing Y coordinates of the points of the polygon. </td></tr> <tr><td class="paramname">n</td><td>Number of points in the vertex array. Minimum number is 3. </td></tr> <tr><td class="paramname">r</td><td>The red value of the polygon to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the polygon to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the polygon to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the polygon to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05056">5056</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a6ab25c393f6e5f8d68ea3365f6ea98d2"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a36453f52608a10f3d6b8edccae260b95">rectangleColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw rectangle with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. top right) of the rectangle. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (i.e. top right) of the rectangle. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. bottom left) of the rectangle. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (i.e. bottom left) of the rectangle. </td></tr> <tr><td class="paramname">color</td><td>The color value of the rectangle to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01580">1580</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a40991c6eeb936d35d0a8e8aa95268f72"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6c41cbfd0618262de4d4d127ed1e67fe">rectangleRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw rectangle with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. top right) of the rectangle. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (i.e. top right) of the rectangle. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. bottom left) of the rectangle. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (i.e. bottom left) of the rectangle. </td></tr> <tr><td class="paramname">r</td><td>The red value of the rectangle to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the rectangle to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the rectangle to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the rectangle to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01663">1663</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a718c4f31d1e145106959c2a77d5fee9d"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a9f9be6e605e764fd23dd154fb12b80e9">roundedBoxColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw rounded-corner box (filled rectangle) with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. top right) of the box. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (i.e. top right) of the box. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. bottom left) of the box. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (i.e. bottom left) of the box. </td></tr> <tr><td class="paramname">rad</td><td>The radius of the corner arcs of the box. </td></tr> <tr><td class="paramname">color</td><td>The color value of the box to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01837">1837</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="aad706348fec18631d7bc48a2d91f5b4d"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a7105b88e62fe42b26602d3b426547bc7">roundedBoxRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw rounded-corner box (filled rectangle) with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. top right) of the box. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (i.e. top right) of the box. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. bottom left) of the box. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (i.e. bottom left) of the box. </td></tr> <tr><td class="paramname">rad</td><td>The radius of the corner arcs of the box. </td></tr> <tr><td class="paramname">r</td><td>The red value of the box to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the box to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the box to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the box to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01970">1970</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a830dd9dcfa39f4718aa2c269060326d0"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a4109d2d1efa021c021fc4a98a0e3691b">roundedRectangleColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw rounded-corner rectangle with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. top right) of the rectangle. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (i.e. top right) of the rectangle. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. bottom left) of the rectangle. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (i.e. bottom left) of the rectangle. </td></tr> <tr><td class="paramname">rad</td><td>The radius of the corner arc. </td></tr> <tr><td class="paramname">color</td><td>The color value of the rectangle to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01685">1685</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a300272b3b799f09ca6cd5c541b19f07a"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a475432abc4756e6f30ef097d5cac02c9">roundedRectangleRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw rounded-corner rectangle with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. top right) of the rectangle. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (i.e. top right) of the rectangle. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. bottom left) of the rectangle. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (i.e. bottom left) of the rectangle. </td></tr> <tr><td class="paramname">rad</td><td>The radius of the corner arc. </td></tr> <tr><td class="paramname">r</td><td>The red value of the rectangle to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the rectangle to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the rectangle to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the rectangle to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01815">1815</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a62d2ba55abc7673f2dfa29e6bbffefdf"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a96b6a43c6ef4753996e33bb7fea483bc">stringColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>s</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw a string in the currently set font. </p> <p>The spacing between consequtive characters in the string is the fixed number of pixels of the character width of the current global font.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X (horizontal) coordinate of the upper left corner of the string. </td></tr> <tr><td class="paramname">y</td><td>Y (vertical) coordinate of the upper left corner of the string. </td></tr> <tr><td class="paramname">s</td><td>The string to draw. </td></tr> <tr><td class="paramname">color</td><td>The color value of the string to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06099">6099</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a6ca71826e311bdd9acf13b009256aa1c"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a769833ae414222099783a9b69bed4009">stringRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>s</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw a string in the currently set font. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X (horizontal) coordinate of the upper left corner of the string. </td></tr> <tr><td class="paramname">y</td><td>Y (vertical) coordinate of the upper left corner of the string. </td></tr> <tr><td class="paramname">s</td><td>The string to draw. </td></tr> <tr><td class="paramname">r</td><td>The red value of the string to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the string to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the string to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the string to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06143">6143</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a65137af308ea878f28abc95419e8aef5"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a5ca5a9bcfeba5b1a1577202e79b494d8">texturedPolygon</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>texture</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>texture_dx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>texture_dy</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draws a polygon filled with the given texture. </p> <p>This standard version is calling multithreaded versions with NULL cache parameters.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>the destination surface, </td></tr> <tr><td class="paramname">vx</td><td>array of x vector components </td></tr> <tr><td class="paramname">vy</td><td>array of x vector components </td></tr> <tr><td class="paramname">n</td><td>the amount of vectors in the vx and vy array </td></tr> <tr><td class="paramname">texture</td><td>the sdl surface to use to fill the polygon </td></tr> <tr><td class="paramname">texture_dx</td><td>the offset of the texture relative to the screeen. if you move the polygon 10 pixels to the left and want the texture to apear the same you need to increase the texture_dx value </td></tr> <tr><td class="paramname">texture_dy</td><td>see texture_dx</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05741">5741</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a28ae354c6272da21b5753ae4ab9e1e84"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a326937a19cfbebea09aa0a7c908d89aa">texturedPolygonMT</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>texture</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>texture_dx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>texture_dy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int **&#160;</td> <td class="paramname"><em>polyInts</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int *&#160;</td> <td class="paramname"><em>polyAllocated</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draws a polygon filled with the given texture (Multi-Threading Capable). </p> <p>This operation use internally SDL_BlitSurface for lines of the source texture. It supports alpha drawing.</p> <p>To get the best performance of this operation you need to make sure the texture and the dst surface have the same format (see <a href="http://docs.mandragor.org/files/Common_libs_documentation/SDL/SDL_Documentation_project_en/sdlblitsurface.html">http://docs.mandragor.org/files/Common_libs_documentation/SDL/SDL_Documentation_project_en/sdlblitsurface.html</a>). The last two parameters are optional, but required for multithreaded operation. When set to NULL, uses global static temp array.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>the destination surface, </td></tr> <tr><td class="paramname">vx</td><td>array of x vector components </td></tr> <tr><td class="paramname">vy</td><td>array of x vector components </td></tr> <tr><td class="paramname">n</td><td>the amount of vectors in the vx and vy array </td></tr> <tr><td class="paramname">texture</td><td>the sdl surface to use to fill the polygon </td></tr> <tr><td class="paramname">texture_dx</td><td>the offset of the texture relative to the screeen. if you move the polygon 10 pixels to the left and want the texture to apear the same you need to increase the texture_dx value </td></tr> <tr><td class="paramname">texture_dy</td><td>see texture_dx </td></tr> <tr><td class="paramname">polyInts</td><td>preallocated temp array storage for vertex sorting (used for multi-threaded operation) </td></tr> <tr><td class="paramname">polyAllocated</td><td>flag indicating oif the temp array was allocated (used for multi-threaded operation)</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05574">5574</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a1494109358b4e4b7ec300d83e3f90300"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a40c34464b6c99fd72c4bd7acfac5915d">thickLineColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>width</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw a thick line with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the line. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the line. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the line. </td></tr> <tr><td class="paramname">width</td><td>Width of the line in pixels. Must be &gt;0. </td></tr> <tr><td class="paramname">color</td><td>The color value of the line to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06808">6808</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a8b24d64b51e23592c93abc2aa50c818e"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#aa740c1eff9163862704eb3bb3b5964db">thickLineRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>width</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw a thick line with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the line. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the line. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the line. </td></tr> <tr><td class="paramname">width</td><td>Width of the line in pixels. Must be &gt;0. </td></tr> <tr><td class="paramname">r</td><td>The red value of the character to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the character to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the character to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the character to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06847">6847</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a7465d08ef930ebb5442c7dd246fed4b5"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#aec2a0c435b879a29167be6b1c49f1e49">trigonColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw trigon (triangle outline) with alpha blending. </p> <p>Note: Creates vertex array and uses polygon routine to render.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the trigon. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the trigon. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the trigon. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the trigon. </td></tr> <tr><td class="paramname">x3</td><td>X coordinate of the third point of the trigon. </td></tr> <tr><td class="paramname">y3</td><td>Y coordinate of the third point of the trigon. </td></tr> <tr><td class="paramname">color</td><td>The color value of the trigon to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04793">4793</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a45d6a7edcd8b25e1a60e39b7f60bda3f"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a090024f5f3e38b02b0bca704259b9d11">trigonRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw trigon (triangle outline) with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the trigon. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the trigon. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the trigon. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the trigon. </td></tr> <tr><td class="paramname">x3</td><td>X coordinate of the third point of the trigon. </td></tr> <tr><td class="paramname">y3</td><td>Y coordinate of the third point of the trigon. </td></tr> <tr><td class="paramname">r</td><td>The red value of the trigon to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the trigon to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the trigon to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the trigon to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04825">4825</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a9b45060155a19fee24f998d7790f1d67"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#ab68d565f00527a67c9d88121c753302c">vlineColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw vertical line with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the points of the line. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (i.e. top) of the line. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (i.e. bottom) of the line. </td></tr> <tr><td class="paramname">color</td><td>The color value of the line to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01392">1392</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a8b79ac1e779755aee92b04f3a6cfc5d7"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a68ed9a65e3e0de26136566b0cf0c859e">vlineRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw vertical line with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the points of the line. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (i.e. top) of the line. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (i.e. bottom) of the line. </td></tr> <tr><td class="paramname">r</td><td>The red value of the line to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the line to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the line to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the line to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01560">1560</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> </div><!-- contents --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.0 </small></address> </body> </html>
YifuLiu/AliOS-Things
components/SDL2/src/gfx/Docs/html/_s_d_l__gfx_primitives_8c.html
HTML
apache-2.0
319,525
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>SDL_gfx: I:/Sources/sdlgfx/SDL_gfxPrimitives.c Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SDL_gfx &#160;<span id="projectnumber">2.0.25</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.8.0 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="headertitle"> <div class="title">I:/Sources/sdlgfx/SDL_gfxPrimitives.c</div> </div> </div><!--header--> <div class="contents"> <a href="_s_d_l__gfx_primitives_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* </span> <a name="l00002"></a>00002 <span class="comment"></span> <a name="l00003"></a>00003 <span class="comment">SDL_gfxPrimitives.c: graphics primitives for SDL surfaces</span> <a name="l00004"></a>00004 <span class="comment"></span> <a name="l00005"></a>00005 <span class="comment">Copyright (C) 2001-2012 Andreas Schiffler</span> <a name="l00006"></a>00006 <span class="comment"></span> <a name="l00007"></a>00007 <span class="comment">This software is provided &#39;as-is&#39;, without any express or implied</span> <a name="l00008"></a>00008 <span class="comment">warranty. In no event will the authors be held liable for any damages</span> <a name="l00009"></a>00009 <span class="comment">arising from the use of this software.</span> <a name="l00010"></a>00010 <span class="comment"></span> <a name="l00011"></a>00011 <span class="comment">Permission is granted to anyone to use this software for any purpose,</span> <a name="l00012"></a>00012 <span class="comment">including commercial applications, and to alter it and redistribute it</span> <a name="l00013"></a>00013 <span class="comment">freely, subject to the following restrictions:</span> <a name="l00014"></a>00014 <span class="comment"></span> <a name="l00015"></a>00015 <span class="comment">1. The origin of this software must not be misrepresented; you must not</span> <a name="l00016"></a>00016 <span class="comment">claim that you wrote the original software. If you use this software</span> <a name="l00017"></a>00017 <span class="comment">in a product, an acknowledgment in the product documentation would be</span> <a name="l00018"></a>00018 <span class="comment">appreciated but is not required.</span> <a name="l00019"></a>00019 <span class="comment"></span> <a name="l00020"></a>00020 <span class="comment">2. Altered source versions must be plainly marked as such, and must not be</span> <a name="l00021"></a>00021 <span class="comment">misrepresented as being the original software.</span> <a name="l00022"></a>00022 <span class="comment"></span> <a name="l00023"></a>00023 <span class="comment">3. This notice may not be removed or altered from any source</span> <a name="l00024"></a>00024 <span class="comment">distribution.</span> <a name="l00025"></a>00025 <span class="comment"></span> <a name="l00026"></a>00026 <span class="comment">Andreas Schiffler -- aschiffler at ferzkopp dot net</span> <a name="l00027"></a>00027 <span class="comment"></span> <a name="l00028"></a>00028 <span class="comment">*/</span> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="preprocessor">#include &lt;stdio.h&gt;</span> <a name="l00031"></a>00031 <span class="preprocessor">#include &lt;stdlib.h&gt;</span> <a name="l00032"></a>00032 <span class="preprocessor">#include &lt;math.h&gt;</span> <a name="l00033"></a>00033 <span class="preprocessor">#include &lt;string.h&gt;</span> <a name="l00034"></a>00034 <a name="l00035"></a>00035 <span class="preprocessor">#include &quot;<a class="code" href="_s_d_l__gfx_primitives_8h.html">SDL_gfxPrimitives.h</a>&quot;</span> <a name="l00036"></a>00036 <span class="preprocessor">#include &quot;<a class="code" href="_s_d_l__rotozoom_8h.html">SDL_rotozoom.h</a>&quot;</span> <a name="l00037"></a>00037 <span class="preprocessor">#include &quot;<a class="code" href="_s_d_l__gfx_primitives__font_8h.html">SDL_gfxPrimitives_font.h</a>&quot;</span> <a name="l00038"></a>00038 <span class="preprocessor">#include &quot;<a class="code" href="_s_d_l__gfx_blit_func_8h.html">SDL_gfxBlitFunc.h</a>&quot;</span> <a name="l00039"></a>00039 <a name="l00040"></a>00040 <span class="comment">/* -===================- */</span> <a name="l00041"></a>00041 <a name="l00042"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#aa992e3a7310145e9f9c36edee5795996">00042</a> <span class="preprocessor">#define DEFAULT_ALPHA_PIXEL_ROUTINE</span> <a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#undef EXPERIMENTAL_ALPHA_PIXEL_ROUTINE</span> <a name="l00044"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#aa24430b32607587eae143f31c1ad14dd">00044</a> <span class="preprocessor"></span><span class="preprocessor">#define ALPHA_PIXEL_ADDITIVE_BLEND</span> <a name="l00045"></a>00045 <span class="preprocessor"></span> <a name="l00046"></a>00046 <span class="comment">/* ---- Structures */</span> <a name="l00047"></a>00047 <a name="l00051"></a><a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html">00051</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{ <a name="l00052"></a><a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a48ddc054175e25d435c217ad4639c3a1">00052</a> Sint16 x, <a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a48ddc054175e25d435c217ad4639c3a1">y</a>; <a name="l00053"></a><a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#ace147c79e29f2efd14e5744efcb976af">00053</a> <span class="keywordtype">int</span> dx, dy, s1, s2, <a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#ace147c79e29f2efd14e5744efcb976af">swapdir</a>, error; <a name="l00054"></a><a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a92fcd448f278df155fd5472527a6dc47">00054</a> Uint32 <a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a92fcd448f278df155fd5472527a6dc47">count</a>; <a name="l00055"></a>00055 } <a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html" title="The structure passed to the internal Bresenham iterator.">SDL_gfxBresenhamIterator</a>; <a name="l00056"></a>00056 <a name="l00060"></a><a class="code" href="struct_s_d_l__gfx_murphy_iterator.html">00060</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{ <a name="l00061"></a><a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#afd133e412238ed9f1e3ba52397115e8d">00061</a> Uint32 <a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#afd133e412238ed9f1e3ba52397115e8d">color</a>; <a name="l00062"></a><a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">00062</a> SDL_Surface *<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">dst</a>; <a name="l00063"></a><a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac8859e8c1ce357c4c8b37bbb1936ba1c">00063</a> <span class="keywordtype">int</span> u, <a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac8859e8c1ce357c4c8b37bbb1936ba1c">v</a>; <span class="comment">/* delta x , delta y */</span> <a name="l00064"></a><a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af59597daf52972ab61551495c3d7e6cd">00064</a> <span class="keywordtype">int</span> ku, kt, <a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af59597daf52972ab61551495c3d7e6cd">kv</a>, kd; <span class="comment">/* loop constants */</span> <a name="l00065"></a><a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ab9894ea9f5570af0e7fa86e61a3bb60b">00065</a> <span class="keywordtype">int</span> <a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ab9894ea9f5570af0e7fa86e61a3bb60b">oct2</a>; <a name="l00066"></a><a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac65502ab7d0d8cbf739c6e06c35d8edb">00066</a> <span class="keywordtype">int</span> <a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac65502ab7d0d8cbf739c6e06c35d8edb">quad4</a>; <a name="l00067"></a><a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a4c3e88fc7abb5715d04e28d96a154e5f">00067</a> Sint16 last1x, last1y, last2x, last2y, first1x, first1y, first2x, first2y, tempx, <a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a4c3e88fc7abb5715d04e28d96a154e5f">tempy</a>; <a name="l00068"></a>00068 } <a class="code" href="struct_s_d_l__gfx_murphy_iterator.html" title="The structure passed to the internal Murphy iterator.">SDL_gfxMurphyIterator</a>; <a name="l00069"></a>00069 <a name="l00070"></a>00070 <span class="comment">/* ----- Defines for pixel clipping tests */</span> <a name="l00071"></a>00071 <a name="l00072"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#adeb851ac45f74ddec914212dd3297433">00072</a> <span class="preprocessor">#define clip_xmin(surface) surface-&gt;clip_rect.x</span> <a name="l00073"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#add68946c6ecf1a5b8935309d30b85cab">00073</a> <span class="preprocessor"></span><span class="preprocessor">#define clip_xmax(surface) surface-&gt;clip_rect.x+surface-&gt;clip_rect.w-1</span> <a name="l00074"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#afc94a05f9b044427c21a77cc468aa5d4">00074</a> <span class="preprocessor"></span><span class="preprocessor">#define clip_ymin(surface) surface-&gt;clip_rect.y</span> <a name="l00075"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#a2f0d9475a02c76e14c8bcba854ac7067">00075</a> <span class="preprocessor"></span><span class="preprocessor">#define clip_ymax(surface) surface-&gt;clip_rect.y+surface-&gt;clip_rect.h-1</span> <a name="l00076"></a>00076 <span class="preprocessor"></span> <a name="l00087"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742">00087</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color) <a name="l00088"></a>00088 { <a name="l00089"></a>00089 <span class="keywordtype">int</span> bpp; <a name="l00090"></a>00090 Uint8 *p; <a name="l00091"></a>00091 <a name="l00092"></a>00092 <span class="comment">/*</span> <a name="l00093"></a>00093 <span class="comment"> * Honor clipping setup at pixel level </span> <a name="l00094"></a>00094 <span class="comment"> */</span> <a name="l00095"></a>00095 <span class="keywordflow">if</span> ((x &gt;= <a class="code" href="_s_d_l__gfx_primitives_8c.html#adeb851ac45f74ddec914212dd3297433">clip_xmin</a>(dst)) &amp;&amp; (x &lt;= <a class="code" href="_s_d_l__gfx_primitives_8c.html#add68946c6ecf1a5b8935309d30b85cab">clip_xmax</a>(dst)) &amp;&amp; (y &gt;= <a class="code" href="_s_d_l__gfx_primitives_8c.html#afc94a05f9b044427c21a77cc468aa5d4">clip_ymin</a>(dst)) &amp;&amp; (y &lt;= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a2f0d9475a02c76e14c8bcba854ac7067">clip_ymax</a>(dst))) { <a name="l00096"></a>00096 <a name="l00097"></a>00097 <span class="comment">/*</span> <a name="l00098"></a>00098 <span class="comment"> * Get destination format </span> <a name="l00099"></a>00099 <span class="comment"> */</span> <a name="l00100"></a>00100 bpp = dst-&gt;format-&gt;BytesPerPixel; <a name="l00101"></a>00101 p = (Uint8 *) dst-&gt;pixels + y * dst-&gt;pitch + x * bpp; <a name="l00102"></a>00102 switch (bpp) { <a name="l00103"></a>00103 <span class="keywordflow">case</span> 1: <a name="l00104"></a>00104 *p = color; <a name="l00105"></a>00105 <span class="keywordflow">break</span>; <a name="l00106"></a>00106 <span class="keywordflow">case</span> 2: <a name="l00107"></a>00107 *(Uint16 *) p = color; <a name="l00108"></a>00108 <span class="keywordflow">break</span>; <a name="l00109"></a>00109 <span class="keywordflow">case</span> 3: <a name="l00110"></a>00110 <span class="keywordflow">if</span> (SDL_BYTEORDER == SDL_BIG_ENDIAN) { <a name="l00111"></a>00111 p[0] = (color &gt;&gt; 16) &amp; 0xff; <a name="l00112"></a>00112 p[1] = (color &gt;&gt; 8) &amp; 0xff; <a name="l00113"></a>00113 p[2] = color &amp; 0xff; <a name="l00114"></a>00114 } <span class="keywordflow">else</span> { <a name="l00115"></a>00115 p[0] = color &amp; 0xff; <a name="l00116"></a>00116 p[1] = (color &gt;&gt; 8) &amp; 0xff; <a name="l00117"></a>00117 p[2] = (color &gt;&gt; 16) &amp; 0xff; <a name="l00118"></a>00118 } <a name="l00119"></a>00119 <span class="keywordflow">break</span>; <a name="l00120"></a>00120 <span class="keywordflow">case</span> 4: <a name="l00121"></a>00121 *(Uint32 *) p = color; <a name="l00122"></a>00122 <span class="keywordflow">break</span>; <a name="l00123"></a>00123 } <span class="comment">/* switch */</span> <a name="l00124"></a>00124 <a name="l00125"></a>00125 <a name="l00126"></a>00126 } <a name="l00127"></a>00127 <a name="l00128"></a>00128 <span class="keywordflow">return</span> (0); <a name="l00129"></a>00129 } <a name="l00130"></a>00130 <a name="l00144"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#add868bff0c4cb75012a0407af6b64f03">00144</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#add868bff0c4cb75012a0407af6b64f03" title="Internal pixel drawing - fast, no blending, no locking, no clipping.">fastPixelColorNolockNoclip</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color) <a name="l00145"></a>00145 { <a name="l00146"></a>00146 <span class="keywordtype">int</span> bpp; <a name="l00147"></a>00147 Uint8 *p; <a name="l00148"></a>00148 <a name="l00149"></a>00149 <span class="comment">/*</span> <a name="l00150"></a>00150 <span class="comment"> * Get destination format </span> <a name="l00151"></a>00151 <span class="comment"> */</span> <a name="l00152"></a>00152 bpp = dst-&gt;format-&gt;BytesPerPixel; <a name="l00153"></a>00153 p = (Uint8 *) dst-&gt;pixels + y * dst-&gt;pitch + x * bpp; <a name="l00154"></a>00154 switch (bpp) { <a name="l00155"></a>00155 <span class="keywordflow">case</span> 1: <a name="l00156"></a>00156 *p = color; <a name="l00157"></a>00157 <span class="keywordflow">break</span>; <a name="l00158"></a>00158 <span class="keywordflow">case</span> 2: <a name="l00159"></a>00159 *(Uint16 *) p = color; <a name="l00160"></a>00160 <span class="keywordflow">break</span>; <a name="l00161"></a>00161 <span class="keywordflow">case</span> 3: <a name="l00162"></a>00162 <span class="keywordflow">if</span> (SDL_BYTEORDER == SDL_BIG_ENDIAN) { <a name="l00163"></a>00163 p[0] = (color &gt;&gt; 16) &amp; 0xff; <a name="l00164"></a>00164 p[1] = (color &gt;&gt; 8) &amp; 0xff; <a name="l00165"></a>00165 p[2] = color &amp; 0xff; <a name="l00166"></a>00166 } <span class="keywordflow">else</span> { <a name="l00167"></a>00167 p[0] = color &amp; 0xff; <a name="l00168"></a>00168 p[1] = (color &gt;&gt; 8) &amp; 0xff; <a name="l00169"></a>00169 p[2] = (color &gt;&gt; 16) &amp; 0xff; <a name="l00170"></a>00170 } <a name="l00171"></a>00171 <span class="keywordflow">break</span>; <a name="l00172"></a>00172 <span class="keywordflow">case</span> 4: <a name="l00173"></a>00173 *(Uint32 *) p = color; <a name="l00174"></a>00174 <span class="keywordflow">break</span>; <a name="l00175"></a>00175 } <span class="comment">/* switch */</span> <a name="l00176"></a>00176 <a name="l00177"></a>00177 <span class="keywordflow">return</span> (0); <a name="l00178"></a>00178 } <a name="l00179"></a>00179 <a name="l00190"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#abeed0e873efdf3aec8c6c86188d36f89">00190</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#abeed0e873efdf3aec8c6c86188d36f89" title="Internal pixel drawing - fast, no blending, locking, clipping.">fastPixelColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color) <a name="l00191"></a>00191 { <a name="l00192"></a>00192 <span class="keywordtype">int</span> result; <a name="l00193"></a>00193 <a name="l00194"></a>00194 <span class="comment">/*</span> <a name="l00195"></a>00195 <span class="comment"> * Lock the surface </span> <a name="l00196"></a>00196 <span class="comment"> */</span> <a name="l00197"></a>00197 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l00198"></a>00198 <span class="keywordflow">if</span> (SDL_LockSurface(dst) &lt; 0) { <a name="l00199"></a>00199 <span class="keywordflow">return</span> (-1); <a name="l00200"></a>00200 } <a name="l00201"></a>00201 } <a name="l00202"></a>00202 <a name="l00203"></a>00203 result = <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, x, y, color); <a name="l00204"></a>00204 <a name="l00205"></a>00205 <span class="comment">/*</span> <a name="l00206"></a>00206 <span class="comment"> * Unlock surface </span> <a name="l00207"></a>00207 <span class="comment"> */</span> <a name="l00208"></a>00208 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l00209"></a>00209 SDL_UnlockSurface(dst); <a name="l00210"></a>00210 } <a name="l00211"></a>00211 <a name="l00212"></a>00212 <span class="keywordflow">return</span> (result); <a name="l00213"></a>00213 } <a name="l00214"></a>00214 <a name="l00228"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#a9874fabafdc422223323751671bca7c0">00228</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a9874fabafdc422223323751671bca7c0" title="Internal pixel drawing - fast, no blending, locking, RGB input.">fastPixelRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l00229"></a>00229 { <a name="l00230"></a>00230 Uint32 color; <a name="l00231"></a>00231 <a name="l00232"></a>00232 <span class="comment">/*</span> <a name="l00233"></a>00233 <span class="comment"> * Setup color </span> <a name="l00234"></a>00234 <span class="comment"> */</span> <a name="l00235"></a>00235 color = SDL_MapRGBA(dst-&gt;format, r, g, b, a); <a name="l00236"></a>00236 <a name="l00237"></a>00237 <span class="comment">/*</span> <a name="l00238"></a>00238 <span class="comment"> * Draw </span> <a name="l00239"></a>00239 <span class="comment"> */</span> <a name="l00240"></a>00240 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#abeed0e873efdf3aec8c6c86188d36f89" title="Internal pixel drawing - fast, no blending, locking, clipping.">fastPixelColor</a>(dst, x, y, color)); <a name="l00241"></a>00241 } <a name="l00242"></a>00242 <a name="l00256"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#a64916bb8270e75d936cda816d3694a25">00256</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a64916bb8270e75d936cda816d3694a25" title="Internal pixel drawing - fast, no blending, no locking RGB input.">fastPixelRGBANolock</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l00257"></a>00257 { <a name="l00258"></a>00258 Uint32 color; <a name="l00259"></a>00259 <a name="l00260"></a>00260 <span class="comment">/*</span> <a name="l00261"></a>00261 <span class="comment"> * Setup color </span> <a name="l00262"></a>00262 <span class="comment"> */</span> <a name="l00263"></a>00263 color = SDL_MapRGBA(dst-&gt;format, r, g, b, a); <a name="l00264"></a>00264 <a name="l00265"></a>00265 <span class="comment">/*</span> <a name="l00266"></a>00266 <span class="comment"> * Draw </span> <a name="l00267"></a>00267 <span class="comment"> */</span> <a name="l00268"></a>00268 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, x, y, color)); <a name="l00269"></a>00269 } <a name="l00270"></a>00270 <a name="l00286"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#ad31779f1ef8bad84496d4c930ec2c208">00286</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#ad31779f1ef8bad84496d4c930ec2c208" title="Internal pixel drawing function with alpha blending where input color in in destination format...">_putPixelAlpha</a>(SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color, Uint8 alpha) <a name="l00287"></a>00287 { <a name="l00288"></a>00288 SDL_PixelFormat *format; <a name="l00289"></a>00289 Uint32 Rmask, Gmask, Bmask, Amask; <a name="l00290"></a>00290 Uint32 Rshift, Gshift, Bshift, Ashift; <a name="l00291"></a>00291 Uint32 sR, sG, sB; <a name="l00292"></a>00292 Uint32 dR, dG, dB, dA; <a name="l00293"></a>00293 <a name="l00294"></a>00294 <span class="keywordflow">if</span> (dst == NULL) <a name="l00295"></a>00295 { <a name="l00296"></a>00296 <span class="keywordflow">return</span> (-1); <a name="l00297"></a>00297 } <a name="l00298"></a>00298 <a name="l00299"></a>00299 <span class="keywordflow">if</span> (x &gt;= <a class="code" href="_s_d_l__gfx_primitives_8c.html#adeb851ac45f74ddec914212dd3297433">clip_xmin</a>(dst) &amp;&amp; x &lt;= <a class="code" href="_s_d_l__gfx_primitives_8c.html#add68946c6ecf1a5b8935309d30b85cab">clip_xmax</a>(dst) &amp;&amp; <a name="l00300"></a>00300 y &gt;= <a class="code" href="_s_d_l__gfx_primitives_8c.html#afc94a05f9b044427c21a77cc468aa5d4">clip_ymin</a>(dst) &amp;&amp; y &lt;= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a2f0d9475a02c76e14c8bcba854ac7067">clip_ymax</a>(dst)) <a name="l00301"></a>00301 { <a name="l00302"></a>00302 <a name="l00303"></a>00303 format = dst-&gt;format; <a name="l00304"></a>00304 <a name="l00305"></a>00305 <span class="keywordflow">switch</span> (format-&gt;BytesPerPixel) { <a name="l00306"></a>00306 <span class="keywordflow">case</span> 1: <a name="l00307"></a>00307 { <span class="comment">/* Assuming 8-bpp */</span> <a name="l00308"></a>00308 Uint8 *pixel = (Uint8 *) dst-&gt;pixels + y * dst-&gt;pitch + x; <a name="l00309"></a>00309 if (alpha == 255) { <a name="l00310"></a>00310 *pixel = color; <a name="l00311"></a>00311 } <span class="keywordflow">else</span> { <a name="l00312"></a>00312 Uint8 R, G, B; <a name="l00313"></a>00313 SDL_Palette *palette = format-&gt;palette; <a name="l00314"></a>00314 SDL_Color *colors = palette-&gt;colors; <a name="l00315"></a>00315 SDL_Color dColor = colors[*pixel]; <a name="l00316"></a>00316 SDL_Color sColor = colors[color]; <a name="l00317"></a>00317 dR = dColor.r; <a name="l00318"></a>00318 dG = dColor.g; <a name="l00319"></a>00319 dB = dColor.b; <a name="l00320"></a>00320 sR = sColor.r; <a name="l00321"></a>00321 sG = sColor.g; <a name="l00322"></a>00322 sB = sColor.b; <a name="l00323"></a>00323 <a name="l00324"></a>00324 R = dR + ((sR - dR) * alpha &gt;&gt; 8); <a name="l00325"></a>00325 G = dG + ((sG - dG) * alpha &gt;&gt; 8); <a name="l00326"></a>00326 B = dB + ((sB - dB) * alpha &gt;&gt; 8); <a name="l00327"></a>00327 <a name="l00328"></a>00328 *pixel = SDL_MapRGB(format, R, G, B); <a name="l00329"></a>00329 } <a name="l00330"></a>00330 } <a name="l00331"></a>00331 <span class="keywordflow">break</span>; <a name="l00332"></a>00332 <a name="l00333"></a>00333 <span class="keywordflow">case</span> 2: <a name="l00334"></a>00334 { <span class="comment">/* Probably 15-bpp or 16-bpp */</span> <a name="l00335"></a>00335 Uint16 *pixel = (Uint16 *) dst-&gt;pixels + y * dst-&gt;pitch / 2 + x; <a name="l00336"></a>00336 if (alpha == 255) { <a name="l00337"></a>00337 *pixel = color; <a name="l00338"></a>00338 } <span class="keywordflow">else</span> { <a name="l00339"></a>00339 Uint16 R, G, B, A; <a name="l00340"></a>00340 Uint16 dc = *pixel; <a name="l00341"></a>00341 <a name="l00342"></a>00342 Rmask = format-&gt;Rmask; <a name="l00343"></a>00343 Gmask = format-&gt;Gmask; <a name="l00344"></a>00344 Bmask = format-&gt;Bmask; <a name="l00345"></a>00345 Amask = format-&gt;Amask; <a name="l00346"></a>00346 <a name="l00347"></a>00347 dR = (dc &amp; Rmask); <a name="l00348"></a>00348 dG = (dc &amp; Gmask); <a name="l00349"></a>00349 dB = (dc &amp; Bmask); <a name="l00350"></a>00350 <a name="l00351"></a>00351 R = (dR + (((color &amp; Rmask) - dR) * alpha &gt;&gt; 8)) &amp; Rmask; <a name="l00352"></a>00352 G = (dG + (((color &amp; Gmask) - dG) * alpha &gt;&gt; 8)) &amp; Gmask; <a name="l00353"></a>00353 B = (dB + (((color &amp; Bmask) - dB) * alpha &gt;&gt; 8)) &amp; Bmask; <a name="l00354"></a>00354 *pixel = R | G | B; <a name="l00355"></a>00355 <span class="keywordflow">if</span> (Amask!=0) { <a name="l00356"></a>00356 dA = (dc &amp; Amask); <a name="l00357"></a>00357 A = (dA + (((color &amp; Amask) - dA) * alpha &gt;&gt; 8)) &amp; Amask; <a name="l00358"></a>00358 *pixel |= A; <a name="l00359"></a>00359 } <a name="l00360"></a>00360 } <a name="l00361"></a>00361 } <a name="l00362"></a>00362 <span class="keywordflow">break</span>; <a name="l00363"></a>00363 <a name="l00364"></a>00364 <span class="keywordflow">case</span> 3: <a name="l00365"></a>00365 { <span class="comment">/* Slow 24-bpp mode, usually not used */</span> <a name="l00366"></a>00366 Uint8 R, G, B; <a name="l00367"></a>00367 Uint8 Rshift8, Gshift8, Bshift8; <a name="l00368"></a>00368 Uint8 *pixel = (Uint8 *) dst-&gt;pixels + y * dst-&gt;pitch + x * 3; <a name="l00369"></a>00369 <a name="l00370"></a>00370 Rshift = format-&gt;Rshift; <a name="l00371"></a>00371 Gshift = format-&gt;Gshift; <a name="l00372"></a>00372 Bshift = format-&gt;Bshift; <a name="l00373"></a>00373 <a name="l00374"></a>00374 Rshift8 = Rshift &gt;&gt; 3; <a name="l00375"></a>00375 Gshift8 = Gshift &gt;&gt; 3; <a name="l00376"></a>00376 Bshift8 = Bshift &gt;&gt; 3; <a name="l00377"></a>00377 <a name="l00378"></a>00378 sR = (color &gt;&gt; Rshift) &amp; 0xFF; <a name="l00379"></a>00379 sG = (color &gt;&gt; Gshift) &amp; 0xFF; <a name="l00380"></a>00380 sB = (color &gt;&gt; Bshift) &amp; 0xFF; <a name="l00381"></a>00381 <a name="l00382"></a>00382 <span class="keywordflow">if</span> (alpha == 255) { <a name="l00383"></a>00383 *(pixel + Rshift8) = sR; <a name="l00384"></a>00384 *(pixel + Gshift8) = sG; <a name="l00385"></a>00385 *(pixel + Bshift8) = sB; <a name="l00386"></a>00386 } <span class="keywordflow">else</span> { <a name="l00387"></a>00387 dR = *((pixel) + Rshift8); <a name="l00388"></a>00388 dG = *((pixel) + Gshift8); <a name="l00389"></a>00389 dB = *((pixel) + Bshift8); <a name="l00390"></a>00390 <a name="l00391"></a>00391 R = dR + ((sR - dR) * alpha &gt;&gt; 8); <a name="l00392"></a>00392 G = dG + ((sG - dG) * alpha &gt;&gt; 8); <a name="l00393"></a>00393 B = dB + ((sB - dB) * alpha &gt;&gt; 8); <a name="l00394"></a>00394 <a name="l00395"></a>00395 *((pixel) + Rshift8) = R; <a name="l00396"></a>00396 *((pixel) + Gshift8) = G; <a name="l00397"></a>00397 *((pixel) + Bshift8) = B; <a name="l00398"></a>00398 } <a name="l00399"></a>00399 } <a name="l00400"></a>00400 <span class="keywordflow">break</span>; <a name="l00401"></a>00401 <a name="l00402"></a>00402 <span class="preprocessor">#ifdef DEFAULT_ALPHA_PIXEL_ROUTINE</span> <a name="l00403"></a>00403 <span class="preprocessor"></span> <a name="l00404"></a>00404 <span class="keywordflow">case</span> 4: <a name="l00405"></a>00405 { <span class="comment">/* Probably :-) 32-bpp */</span> <a name="l00406"></a>00406 Uint32 R, G, B, A; <a name="l00407"></a>00407 Uint32 *pixel = (Uint32 *) dst-&gt;pixels + y * dst-&gt;pitch / 4 + x; <a name="l00408"></a>00408 if (alpha == 255) { <a name="l00409"></a>00409 *pixel = color; <a name="l00410"></a>00410 } <span class="keywordflow">else</span> { <a name="l00411"></a>00411 Uint32 dc = *pixel; <a name="l00412"></a>00412 <a name="l00413"></a>00413 Rmask = format-&gt;Rmask; <a name="l00414"></a>00414 Gmask = format-&gt;Gmask; <a name="l00415"></a>00415 Bmask = format-&gt;Bmask; <a name="l00416"></a>00416 Amask = format-&gt;Amask; <a name="l00417"></a>00417 <a name="l00418"></a>00418 Rshift = format-&gt;Rshift; <a name="l00419"></a>00419 Gshift = format-&gt;Gshift; <a name="l00420"></a>00420 Bshift = format-&gt;Bshift; <a name="l00421"></a>00421 Ashift = format-&gt;Ashift; <a name="l00422"></a>00422 <a name="l00423"></a>00423 dR = (dc &amp; Rmask) &gt;&gt; Rshift; <a name="l00424"></a>00424 dG = (dc &amp; Gmask) &gt;&gt; Gshift; <a name="l00425"></a>00425 dB = (dc &amp; Bmask) &gt;&gt; Bshift; <a name="l00426"></a>00426 <a name="l00427"></a>00427 <a name="l00428"></a>00428 R = ((dR + ((((color &amp; Rmask) &gt;&gt; Rshift) - dR) * alpha &gt;&gt; 8)) &lt;&lt; Rshift) &amp; Rmask; <a name="l00429"></a>00429 G = ((dG + ((((color &amp; Gmask) &gt;&gt; Gshift) - dG) * alpha &gt;&gt; 8)) &lt;&lt; Gshift) &amp; Gmask; <a name="l00430"></a>00430 B = ((dB + ((((color &amp; Bmask) &gt;&gt; Bshift) - dB) * alpha &gt;&gt; 8)) &lt;&lt; Bshift) &amp; Bmask; <a name="l00431"></a>00431 *pixel = R | G | B; <a name="l00432"></a>00432 <span class="keywordflow">if</span> (Amask!=0) { <a name="l00433"></a>00433 dA = (dc &amp; Amask) &gt;&gt; Ashift; <a name="l00434"></a>00434 <a name="l00435"></a>00435 <span class="preprocessor">#ifdef ALPHA_PIXEL_ADDITIVE_BLEND</span> <a name="l00436"></a>00436 <span class="preprocessor"></span> A = (dA | <a class="code" href="_s_d_l__gfx_blit_func_8c.html#a6d0c17342154e14322a281603960691a" title="Alpha adjustment table for custom blitter.">GFX_ALPHA_ADJUST_ARRAY</a>[alpha &amp; 255]) &lt;&lt; Ashift; <span class="comment">// make destination less transparent...</span> <a name="l00437"></a>00437 <span class="preprocessor">#else</span> <a name="l00438"></a>00438 <span class="preprocessor"></span> A = ((dA + ((((color &amp; Amask) &gt;&gt; Ashift) - dA) * alpha &gt;&gt; 8)) &lt;&lt; Ashift) &amp; Amask; <a name="l00439"></a>00439 <span class="preprocessor">#endif</span> <a name="l00440"></a>00440 <span class="preprocessor"></span> *pixel |= A; <a name="l00441"></a>00441 } <a name="l00442"></a>00442 } <a name="l00443"></a>00443 } <a name="l00444"></a>00444 <span class="keywordflow">break</span>; <a name="l00445"></a>00445 <span class="preprocessor">#endif</span> <a name="l00446"></a>00446 <span class="preprocessor"></span> <a name="l00447"></a>00447 <span class="preprocessor">#ifdef EXPERIMENTAL_ALPHA_PIXEL_ROUTINE</span> <a name="l00448"></a>00448 <span class="preprocessor"></span> <a name="l00449"></a>00449 <span class="keywordflow">case</span> 4:{ <span class="comment">/* Probably :-) 32-bpp */</span> <a name="l00450"></a>00450 <span class="keywordflow">if</span> (alpha == 255) { <a name="l00451"></a>00451 *((Uint32 *) dst-&gt;pixels + y * dst-&gt;pitch / 4 + x) = color; <a name="l00452"></a>00452 } <span class="keywordflow">else</span> { <a name="l00453"></a>00453 Uint32 *pixel = (Uint32 *) dst-&gt;pixels + y * dst-&gt;pitch / 4 + x; <a name="l00454"></a>00454 Uint32 dR, dG, dB, dA; <a name="l00455"></a>00455 Uint32 dc = *pixel; <a name="l00456"></a>00456 <a name="l00457"></a>00457 Uint32 surfaceAlpha, preMultR, preMultG, preMultB; <a name="l00458"></a>00458 Uint32 aTmp; <a name="l00459"></a>00459 <a name="l00460"></a>00460 Rmask = format-&gt;Rmask; <a name="l00461"></a>00461 Gmask = format-&gt;Gmask; <a name="l00462"></a>00462 Bmask = format-&gt;Bmask; <a name="l00463"></a>00463 Amask = format-&gt;Amask; <a name="l00464"></a>00464 <a name="l00465"></a>00465 dR = (color &amp; Rmask); <a name="l00466"></a>00466 dG = (color &amp; Gmask); <a name="l00467"></a>00467 dB = (color &amp; Bmask); <a name="l00468"></a>00468 dA = (color &amp; Amask); <a name="l00469"></a>00469 <a name="l00470"></a>00470 Rshift = format-&gt;Rshift; <a name="l00471"></a>00471 Gshift = format-&gt;Gshift; <a name="l00472"></a>00472 Bshift = format-&gt;Bshift; <a name="l00473"></a>00473 Ashift = format-&gt;Ashift; <a name="l00474"></a>00474 <a name="l00475"></a>00475 preMultR = (alpha * (dR &gt;&gt; Rshift)); <a name="l00476"></a>00476 preMultG = (alpha * (dG &gt;&gt; Gshift)); <a name="l00477"></a>00477 preMultB = (alpha * (dB &gt;&gt; Bshift)); <a name="l00478"></a>00478 <a name="l00479"></a>00479 surfaceAlpha = ((dc &amp; Amask) &gt;&gt; Ashift); <a name="l00480"></a>00480 aTmp = (255 - alpha); <a name="l00481"></a>00481 <span class="keywordflow">if</span> (A = 255 - ((aTmp * (255 - surfaceAlpha)) &gt;&gt; 8 )) { <a name="l00482"></a>00482 aTmp *= surfaceAlpha; <a name="l00483"></a>00483 R = (preMultR + ((aTmp * ((dc &amp; Rmask) &gt;&gt; Rshift)) &gt;&gt; 8)) / A &lt;&lt; Rshift &amp; Rmask; <a name="l00484"></a>00484 G = (preMultG + ((aTmp * ((dc &amp; Gmask) &gt;&gt; Gshift)) &gt;&gt; 8)) / A &lt;&lt; Gshift &amp; Gmask; <a name="l00485"></a>00485 B = (preMultB + ((aTmp * ((dc &amp; Bmask) &gt;&gt; Bshift)) &gt;&gt; 8)) / A &lt;&lt; Bshift &amp; Bmask; <a name="l00486"></a>00486 } <a name="l00487"></a>00487 *pixel = R | G | B | (A &lt;&lt; Ashift &amp; Amask); <a name="l00488"></a>00488 <a name="l00489"></a>00489 } <a name="l00490"></a>00490 } <a name="l00491"></a>00491 <span class="keywordflow">break</span>; <a name="l00492"></a>00492 <span class="preprocessor">#endif</span> <a name="l00493"></a>00493 <span class="preprocessor"></span> } <a name="l00494"></a>00494 } <a name="l00495"></a>00495 <a name="l00496"></a>00496 <span class="keywordflow">return</span> (0); <a name="l00497"></a>00497 } <a name="l00498"></a>00498 <a name="l00509"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a7fe611dbb029ae70be89d5314c7e023b">00509</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae6f8690e5c5a85d3263c8e16727b34ef" title="Pixel draw with blending enabled if a&lt;255.">pixelColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color) <a name="l00510"></a>00510 { <a name="l00511"></a>00511 Uint8 alpha; <a name="l00512"></a>00512 Uint32 mcolor; <a name="l00513"></a>00513 <span class="keywordtype">int</span> result = 0; <a name="l00514"></a>00514 <a name="l00515"></a>00515 <span class="comment">/*</span> <a name="l00516"></a>00516 <span class="comment"> * Lock the surface </span> <a name="l00517"></a>00517 <span class="comment"> */</span> <a name="l00518"></a>00518 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l00519"></a>00519 <span class="keywordflow">if</span> (SDL_LockSurface(dst) &lt; 0) { <a name="l00520"></a>00520 <span class="keywordflow">return</span> (-1); <a name="l00521"></a>00521 } <a name="l00522"></a>00522 } <a name="l00523"></a>00523 <a name="l00524"></a>00524 <span class="comment">/*</span> <a name="l00525"></a>00525 <span class="comment"> * Setup color </span> <a name="l00526"></a>00526 <span class="comment"> */</span> <a name="l00527"></a>00527 alpha = color &amp; 0x000000ff; <a name="l00528"></a>00528 mcolor = <a name="l00529"></a>00529 SDL_MapRGBA(dst-&gt;format, (color &amp; 0xff000000) &gt;&gt; 24, <a name="l00530"></a>00530 (color &amp; 0x00ff0000) &gt;&gt; 16, (color &amp; 0x0000ff00) &gt;&gt; 8, alpha); <a name="l00531"></a>00531 <a name="l00532"></a>00532 <span class="comment">/*</span> <a name="l00533"></a>00533 <span class="comment"> * Draw </span> <a name="l00534"></a>00534 <span class="comment"> */</span> <a name="l00535"></a>00535 result = <a class="code" href="_s_d_l__gfx_primitives_8c.html#ad31779f1ef8bad84496d4c930ec2c208" title="Internal pixel drawing function with alpha blending where input color in in destination format...">_putPixelAlpha</a>(dst, x, y, mcolor, alpha); <a name="l00536"></a>00536 <a name="l00537"></a>00537 <span class="comment">/*</span> <a name="l00538"></a>00538 <span class="comment"> * Unlock the surface </span> <a name="l00539"></a>00539 <span class="comment"> */</span> <a name="l00540"></a>00540 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l00541"></a>00541 SDL_UnlockSurface(dst); <a name="l00542"></a>00542 } <a name="l00543"></a>00543 <a name="l00544"></a>00544 <span class="keywordflow">return</span> (result); <a name="l00545"></a>00545 } <a name="l00546"></a>00546 <a name="l00557"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0">00557</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color) <a name="l00558"></a>00558 { <a name="l00559"></a>00559 Uint8 alpha; <a name="l00560"></a>00560 Uint32 mcolor; <a name="l00561"></a>00561 <span class="keywordtype">int</span> result = 0; <a name="l00562"></a>00562 <a name="l00563"></a>00563 <span class="comment">/*</span> <a name="l00564"></a>00564 <span class="comment"> * Setup color </span> <a name="l00565"></a>00565 <span class="comment"> */</span> <a name="l00566"></a>00566 alpha = color &amp; 0x000000ff; <a name="l00567"></a>00567 mcolor = <a name="l00568"></a>00568 SDL_MapRGBA(dst-&gt;format, (color &amp; 0xff000000) &gt;&gt; 24, <a name="l00569"></a>00569 (color &amp; 0x00ff0000) &gt;&gt; 16, (color &amp; 0x0000ff00) &gt;&gt; 8, alpha); <a name="l00570"></a>00570 <a name="l00571"></a>00571 <span class="comment">/*</span> <a name="l00572"></a>00572 <span class="comment"> * Draw </span> <a name="l00573"></a>00573 <span class="comment"> */</span> <a name="l00574"></a>00574 result = <a class="code" href="_s_d_l__gfx_primitives_8c.html#ad31779f1ef8bad84496d4c930ec2c208" title="Internal pixel drawing function with alpha blending where input color in in destination format...">_putPixelAlpha</a>(dst, x, y, mcolor, alpha); <a name="l00575"></a>00575 <a name="l00576"></a>00576 <span class="keywordflow">return</span> (result); <a name="l00577"></a>00577 } <a name="l00578"></a>00578 <a name="l00579"></a>00579 <a name="l00595"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#ada8cf05419af4be65d3ea5f7c7384e58">00595</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#ada8cf05419af4be65d3ea5f7c7384e58" title="Internal function to draw filled rectangle with alpha blending.">_filledRectAlpha</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color, Uint8 alpha) <a name="l00596"></a>00596 { <a name="l00597"></a>00597 SDL_PixelFormat *format; <a name="l00598"></a>00598 Uint32 Rmask, Gmask, Bmask, Amask; <a name="l00599"></a>00599 Uint32 Rshift, Gshift, Bshift, Ashift; <a name="l00600"></a>00600 Uint32 sR, sG, sB, sA; <a name="l00601"></a>00601 Uint32 dR, dG, dB, dA; <a name="l00602"></a>00602 Sint16 x, y; <a name="l00603"></a>00603 <a name="l00604"></a>00604 <span class="keywordflow">if</span> (dst == NULL) { <a name="l00605"></a>00605 <span class="keywordflow">return</span> (-1); <a name="l00606"></a>00606 } <a name="l00607"></a>00607 <a name="l00608"></a>00608 format = dst-&gt;format; <a name="l00609"></a>00609 <span class="keywordflow">switch</span> (format-&gt;BytesPerPixel) { <a name="l00610"></a>00610 <span class="keywordflow">case</span> 1: <a name="l00611"></a>00611 { <span class="comment">/* Assuming 8-bpp */</span> <a name="l00612"></a>00612 Uint8 *row, *pixel; <a name="l00613"></a>00613 Uint8 R, G, B; <a name="l00614"></a>00614 SDL_Color *colors = format-&gt;palette-&gt;colors; <a name="l00615"></a>00615 SDL_Color dColor; <a name="l00616"></a>00616 SDL_Color sColor = colors[color]; <a name="l00617"></a>00617 sR = sColor.r; <a name="l00618"></a>00618 sG = sColor.g; <a name="l00619"></a>00619 sB = sColor.b; <a name="l00620"></a>00620 <a name="l00621"></a>00621 <span class="keywordflow">for</span> (y = y1; y &lt;= y2; y++) { <a name="l00622"></a>00622 row = (Uint8 *) dst-&gt;pixels + y * dst-&gt;pitch; <a name="l00623"></a>00623 for (x = x1; x &lt;= x2; x++) { <a name="l00624"></a>00624 <span class="keywordflow">if</span> (alpha == 255) { <a name="l00625"></a>00625 *(row + x) = color; <a name="l00626"></a>00626 } <span class="keywordflow">else</span> { <a name="l00627"></a>00627 pixel = row + x; <a name="l00628"></a>00628 <a name="l00629"></a>00629 dColor = colors[*pixel]; <a name="l00630"></a>00630 dR = dColor.r; <a name="l00631"></a>00631 dG = dColor.g; <a name="l00632"></a>00632 dB = dColor.b; <a name="l00633"></a>00633 <a name="l00634"></a>00634 R = dR + ((sR - dR) * alpha &gt;&gt; 8); <a name="l00635"></a>00635 G = dG + ((sG - dG) * alpha &gt;&gt; 8); <a name="l00636"></a>00636 B = dB + ((sB - dB) * alpha &gt;&gt; 8); <a name="l00637"></a>00637 <a name="l00638"></a>00638 *pixel = SDL_MapRGB(format, R, G, B); <a name="l00639"></a>00639 } <a name="l00640"></a>00640 } <a name="l00641"></a>00641 } <a name="l00642"></a>00642 } <a name="l00643"></a>00643 <span class="keywordflow">break</span>; <a name="l00644"></a>00644 <a name="l00645"></a>00645 <span class="keywordflow">case</span> 2: <a name="l00646"></a>00646 { <span class="comment">/* Probably 15-bpp or 16-bpp */</span> <a name="l00647"></a>00647 Uint16 *row, *pixel; <a name="l00648"></a>00648 Uint16 R, G, B, A; <a name="l00649"></a>00649 Uint16 dc; <a name="l00650"></a>00650 Rmask = format-&gt;Rmask; <a name="l00651"></a>00651 Gmask = format-&gt;Gmask; <a name="l00652"></a>00652 Bmask = format-&gt;Bmask; <a name="l00653"></a>00653 Amask = format-&gt;Amask; <a name="l00654"></a>00654 <a name="l00655"></a>00655 sR = (color &amp; Rmask); <a name="l00656"></a>00656 sG = (color &amp; Gmask); <a name="l00657"></a>00657 sB = (color &amp; Bmask); <a name="l00658"></a>00658 sA = (color &amp; Amask); <a name="l00659"></a>00659 <a name="l00660"></a>00660 <span class="keywordflow">for</span> (y = y1; y &lt;= y2; y++) { <a name="l00661"></a>00661 row = (Uint16 *) dst-&gt;pixels + y * dst-&gt;pitch / 2; <a name="l00662"></a>00662 for (x = x1; x &lt;= x2; x++) { <a name="l00663"></a>00663 <span class="keywordflow">if</span> (alpha == 255) { <a name="l00664"></a>00664 *(row + x) = color; <a name="l00665"></a>00665 } <span class="keywordflow">else</span> { <a name="l00666"></a>00666 pixel = row + x; <a name="l00667"></a>00667 dc = *pixel; <a name="l00668"></a>00668 <a name="l00669"></a>00669 dR = (dc &amp; Rmask); <a name="l00670"></a>00670 dG = (dc &amp; Gmask); <a name="l00671"></a>00671 dB = (dc &amp; Bmask); <a name="l00672"></a>00672 <a name="l00673"></a>00673 R = (dR + ((sR - dR) * alpha &gt;&gt; 8)) &amp; Rmask; <a name="l00674"></a>00674 G = (dG + ((sG - dG) * alpha &gt;&gt; 8)) &amp; Gmask; <a name="l00675"></a>00675 B = (dB + ((sB - dB) * alpha &gt;&gt; 8)) &amp; Bmask; <a name="l00676"></a>00676 *pixel = R | G | B; <a name="l00677"></a>00677 <span class="keywordflow">if</span> (Amask!=0) { <a name="l00678"></a>00678 dA = (dc &amp; Amask); <a name="l00679"></a>00679 A = (dA + ((sA - dA) * alpha &gt;&gt; 8)) &amp; Amask; <a name="l00680"></a>00680 *pixel |= A; <a name="l00681"></a>00681 } <a name="l00682"></a>00682 } <a name="l00683"></a>00683 } <a name="l00684"></a>00684 } <a name="l00685"></a>00685 } <a name="l00686"></a>00686 <span class="keywordflow">break</span>; <a name="l00687"></a>00687 <a name="l00688"></a>00688 <span class="keywordflow">case</span> 3: <a name="l00689"></a>00689 { <span class="comment">/* Slow 24-bpp mode, usually not used */</span> <a name="l00690"></a>00690 Uint8 *row, *pixel; <a name="l00691"></a>00691 Uint8 R, G, B; <a name="l00692"></a>00692 Uint8 Rshift8, Gshift8, Bshift8; <a name="l00693"></a>00693 <a name="l00694"></a>00694 Rshift = format-&gt;Rshift; <a name="l00695"></a>00695 Gshift = format-&gt;Gshift; <a name="l00696"></a>00696 Bshift = format-&gt;Bshift; <a name="l00697"></a>00697 <a name="l00698"></a>00698 Rshift8 = Rshift &gt;&gt; 3; <a name="l00699"></a>00699 Gshift8 = Gshift &gt;&gt; 3; <a name="l00700"></a>00700 Bshift8 = Bshift &gt;&gt; 3; <a name="l00701"></a>00701 <a name="l00702"></a>00702 sR = (color &gt;&gt; Rshift) &amp; 0xff; <a name="l00703"></a>00703 sG = (color &gt;&gt; Gshift) &amp; 0xff; <a name="l00704"></a>00704 sB = (color &gt;&gt; Bshift) &amp; 0xff; <a name="l00705"></a>00705 <a name="l00706"></a>00706 <span class="keywordflow">for</span> (y = y1; y &lt;= y2; y++) { <a name="l00707"></a>00707 row = (Uint8 *) dst-&gt;pixels + y * dst-&gt;pitch; <a name="l00708"></a>00708 for (x = x1; x &lt;= x2; x++) { <a name="l00709"></a>00709 pixel = row + x * 3; <a name="l00710"></a>00710 <a name="l00711"></a>00711 <span class="keywordflow">if</span> (alpha == 255) { <a name="l00712"></a>00712 *(pixel + Rshift8) = sR; <a name="l00713"></a>00713 *(pixel + Gshift8) = sG; <a name="l00714"></a>00714 *(pixel + Bshift8) = sB; <a name="l00715"></a>00715 } <span class="keywordflow">else</span> { <a name="l00716"></a>00716 dR = *((pixel) + Rshift8); <a name="l00717"></a>00717 dG = *((pixel) + Gshift8); <a name="l00718"></a>00718 dB = *((pixel) + Bshift8); <a name="l00719"></a>00719 <a name="l00720"></a>00720 R = dR + ((sR - dR) * alpha &gt;&gt; 8); <a name="l00721"></a>00721 G = dG + ((sG - dG) * alpha &gt;&gt; 8); <a name="l00722"></a>00722 B = dB + ((sB - dB) * alpha &gt;&gt; 8); <a name="l00723"></a>00723 <a name="l00724"></a>00724 *((pixel) + Rshift8) = R; <a name="l00725"></a>00725 *((pixel) + Gshift8) = G; <a name="l00726"></a>00726 *((pixel) + Bshift8) = B; <a name="l00727"></a>00727 } <a name="l00728"></a>00728 } <a name="l00729"></a>00729 } <a name="l00730"></a>00730 } <a name="l00731"></a>00731 <span class="keywordflow">break</span>; <a name="l00732"></a>00732 <a name="l00733"></a>00733 <span class="preprocessor">#ifdef DEFAULT_ALPHA_PIXEL_ROUTINE</span> <a name="l00734"></a>00734 <span class="preprocessor"></span> <span class="keywordflow">case</span> 4: <a name="l00735"></a>00735 { <span class="comment">/* Probably :-) 32-bpp */</span> <a name="l00736"></a>00736 Uint32 *row, *pixel; <a name="l00737"></a>00737 Uint32 R, G, B, A; <a name="l00738"></a>00738 Uint32 dc; <a name="l00739"></a>00739 Rmask = format-&gt;Rmask; <a name="l00740"></a>00740 Gmask = format-&gt;Gmask; <a name="l00741"></a>00741 Bmask = format-&gt;Bmask; <a name="l00742"></a>00742 Amask = format-&gt;Amask; <a name="l00743"></a>00743 <a name="l00744"></a>00744 Rshift = format-&gt;Rshift; <a name="l00745"></a>00745 Gshift = format-&gt;Gshift; <a name="l00746"></a>00746 Bshift = format-&gt;Bshift; <a name="l00747"></a>00747 Ashift = format-&gt;Ashift; <a name="l00748"></a>00748 <a name="l00749"></a>00749 sR = (color &amp; Rmask) &gt;&gt; Rshift; <a name="l00750"></a>00750 sG = (color &amp; Gmask) &gt;&gt; Gshift; <a name="l00751"></a>00751 sB = (color &amp; Bmask) &gt;&gt; Bshift; <a name="l00752"></a>00752 sA = (color &amp; Amask) &gt;&gt; Ashift; <a name="l00753"></a>00753 <a name="l00754"></a>00754 <span class="keywordflow">for</span> (y = y1; y &lt;= y2; y++) { <a name="l00755"></a>00755 row = (Uint32 *) dst-&gt;pixels + y * dst-&gt;pitch / 4; <a name="l00756"></a>00756 for (x = x1; x &lt;= x2; x++) { <a name="l00757"></a>00757 <span class="keywordflow">if</span> (alpha == 255) { <a name="l00758"></a>00758 *(row + x) = color; <a name="l00759"></a>00759 } <span class="keywordflow">else</span> { <a name="l00760"></a>00760 pixel = row + x; <a name="l00761"></a>00761 dc = *pixel; <a name="l00762"></a>00762 <a name="l00763"></a>00763 dR = (dc &amp; Rmask) &gt;&gt; Rshift; <a name="l00764"></a>00764 dG = (dc &amp; Gmask) &gt;&gt; Gshift; <a name="l00765"></a>00765 dB = (dc &amp; Bmask) &gt;&gt; Bshift; <a name="l00766"></a>00766 <a name="l00767"></a>00767 R = ((dR + ((sR - dR) * alpha &gt;&gt; 8)) &lt;&lt; Rshift) &amp; Rmask; <a name="l00768"></a>00768 G = ((dG + ((sG - dG) * alpha &gt;&gt; 8)) &lt;&lt; Gshift) &amp; Gmask; <a name="l00769"></a>00769 B = ((dB + ((sB - dB) * alpha &gt;&gt; 8)) &lt;&lt; Bshift) &amp; Bmask; <a name="l00770"></a>00770 *pixel = R | G | B; <a name="l00771"></a>00771 <span class="keywordflow">if</span> (Amask!=0) { <a name="l00772"></a>00772 dA = (dc &amp; Amask) &gt;&gt; Ashift; <a name="l00773"></a>00773 <span class="preprocessor">#ifdef ALPHA_PIXEL_ADDITIVE_BLEND</span> <a name="l00774"></a>00774 <span class="preprocessor"></span> A = (dA | <a class="code" href="_s_d_l__gfx_blit_func_8c.html#a6d0c17342154e14322a281603960691a" title="Alpha adjustment table for custom blitter.">GFX_ALPHA_ADJUST_ARRAY</a>[sA &amp; 255]) &lt;&lt; Ashift; <span class="comment">// make destination less transparent...</span> <a name="l00775"></a>00775 <span class="preprocessor">#else</span> <a name="l00776"></a>00776 <span class="preprocessor"></span> A = ((dA + ((sA - dA) * alpha &gt;&gt; 8)) &lt;&lt; Ashift) &amp; Amask; <a name="l00777"></a>00777 <span class="preprocessor">#endif</span> <a name="l00778"></a>00778 <span class="preprocessor"></span> *pixel |= A; <a name="l00779"></a>00779 } <a name="l00780"></a>00780 } <a name="l00781"></a>00781 } <a name="l00782"></a>00782 } <a name="l00783"></a>00783 } <a name="l00784"></a>00784 <span class="keywordflow">break</span>; <a name="l00785"></a>00785 <span class="preprocessor">#endif</span> <a name="l00786"></a>00786 <span class="preprocessor"></span> <a name="l00787"></a>00787 <span class="preprocessor">#ifdef EXPERIMENTAL_ALPHA_PIXEL_ROUTINE</span> <a name="l00788"></a>00788 <span class="preprocessor"></span> <span class="keywordflow">case</span> 4:{ <span class="comment">/* Probably :-) 32-bpp */</span> <a name="l00789"></a>00789 Uint32 *row, *pixel; <a name="l00790"></a>00790 Uint32 dR, dG, dB, dA; <a name="l00791"></a>00791 Uint32 dc; <a name="l00792"></a>00792 Uint32 surfaceAlpha, preMultR, preMultG, preMultB; <a name="l00793"></a>00793 Uint32 aTmp; <a name="l00794"></a>00794 <a name="l00795"></a>00795 Rmask = format-&gt;Rmask; <a name="l00796"></a>00796 Gmask = format-&gt;Gmask; <a name="l00797"></a>00797 Bmask = format-&gt;Bmask; <a name="l00798"></a>00798 Amask = format-&gt;Amask; <a name="l00799"></a>00799 <a name="l00800"></a>00800 dR = (color &amp; Rmask); <a name="l00801"></a>00801 dG = (color &amp; Gmask); <a name="l00802"></a>00802 dB = (color &amp; Bmask); <a name="l00803"></a>00803 dA = (color &amp; Amask); <a name="l00804"></a>00804 <a name="l00805"></a>00805 Rshift = format-&gt;Rshift; <a name="l00806"></a>00806 Gshift = format-&gt;Gshift; <a name="l00807"></a>00807 Bshift = format-&gt;Bshift; <a name="l00808"></a>00808 Ashift = format-&gt;Ashift; <a name="l00809"></a>00809 <a name="l00810"></a>00810 preMultR = (alpha * (dR &gt;&gt; Rshift)); <a name="l00811"></a>00811 preMultG = (alpha * (dG &gt;&gt; Gshift)); <a name="l00812"></a>00812 preMultB = (alpha * (dB &gt;&gt; Bshift)); <a name="l00813"></a>00813 <a name="l00814"></a>00814 <span class="keywordflow">for</span> (y = y1; y &lt;= y2; y++) { <a name="l00815"></a>00815 row = (Uint32 *) dst-&gt;pixels + y * dst-&gt;pitch / 4; <a name="l00816"></a>00816 for (x = x1; x &lt;= x2; x++) { <a name="l00817"></a>00817 <span class="keywordflow">if</span> (alpha == 255) { <a name="l00818"></a>00818 *(row + x) = color; <a name="l00819"></a>00819 } <span class="keywordflow">else</span> { <a name="l00820"></a>00820 pixel = row + x; <a name="l00821"></a>00821 dc = *pixel; <a name="l00822"></a>00822 <a name="l00823"></a>00823 surfaceAlpha = ((dc &amp; Amask) &gt;&gt; Ashift); <a name="l00824"></a>00824 aTmp = (255 - alpha); <a name="l00825"></a>00825 <span class="keywordflow">if</span> (A = 255 - ((aTmp * (255 - surfaceAlpha)) &gt;&gt; 8 )) { <a name="l00826"></a>00826 aTmp *= surfaceAlpha; <a name="l00827"></a>00827 R = (preMultR + ((aTmp * ((dc &amp; Rmask) &gt;&gt; Rshift)) &gt;&gt; 8)) / A &lt;&lt; Rshift &amp; Rmask; <a name="l00828"></a>00828 G = (preMultG + ((aTmp * ((dc &amp; Gmask) &gt;&gt; Gshift)) &gt;&gt; 8)) / A &lt;&lt; Gshift &amp; Gmask; <a name="l00829"></a>00829 B = (preMultB + ((aTmp * ((dc &amp; Bmask) &gt;&gt; Bshift)) &gt;&gt; 8)) / A &lt;&lt; Bshift &amp; Bmask; <a name="l00830"></a>00830 } <a name="l00831"></a>00831 *pixel = R | G | B | (A &lt;&lt; Ashift &amp; Amask); <a name="l00832"></a>00832 } <a name="l00833"></a>00833 } <a name="l00834"></a>00834 } <a name="l00835"></a>00835 } <a name="l00836"></a>00836 <span class="keywordflow">break</span>; <a name="l00837"></a>00837 <span class="preprocessor">#endif</span> <a name="l00838"></a>00838 <span class="preprocessor"></span> <a name="l00839"></a>00839 } <a name="l00840"></a>00840 <a name="l00841"></a>00841 <span class="keywordflow">return</span> (0); <a name="l00842"></a>00842 } <a name="l00843"></a>00843 <a name="l00856"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#ace9f2505c12c5dacc778509991cd3716">00856</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#ace9f2505c12c5dacc778509991cd3716" title="Draw filled rectangle of RGBA color with alpha blending.">filledRectAlpha</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color) <a name="l00857"></a>00857 { <a name="l00858"></a>00858 Uint8 alpha; <a name="l00859"></a>00859 Uint32 mcolor; <a name="l00860"></a>00860 <span class="keywordtype">int</span> result = 0; <a name="l00861"></a>00861 <a name="l00862"></a>00862 <span class="comment">/*</span> <a name="l00863"></a>00863 <span class="comment"> * Lock the surface </span> <a name="l00864"></a>00864 <span class="comment"> */</span> <a name="l00865"></a>00865 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l00866"></a>00866 <span class="keywordflow">if</span> (SDL_LockSurface(dst) &lt; 0) { <a name="l00867"></a>00867 <span class="keywordflow">return</span> (-1); <a name="l00868"></a>00868 } <a name="l00869"></a>00869 } <a name="l00870"></a>00870 <a name="l00871"></a>00871 <span class="comment">/*</span> <a name="l00872"></a>00872 <span class="comment"> * Setup color </span> <a name="l00873"></a>00873 <span class="comment"> */</span> <a name="l00874"></a>00874 alpha = color &amp; 0x000000ff; <a name="l00875"></a>00875 mcolor = <a name="l00876"></a>00876 SDL_MapRGBA(dst-&gt;format, (color &amp; 0xff000000) &gt;&gt; 24, <a name="l00877"></a>00877 (color &amp; 0x00ff0000) &gt;&gt; 16, (color &amp; 0x0000ff00) &gt;&gt; 8, alpha); <a name="l00878"></a>00878 <a name="l00879"></a>00879 <span class="comment">/*</span> <a name="l00880"></a>00880 <span class="comment"> * Draw </span> <a name="l00881"></a>00881 <span class="comment"> */</span> <a name="l00882"></a>00882 result = <a class="code" href="_s_d_l__gfx_primitives_8c.html#ada8cf05419af4be65d3ea5f7c7384e58" title="Internal function to draw filled rectangle with alpha blending.">_filledRectAlpha</a>(dst, x1, y1, x2, y2, mcolor, alpha); <a name="l00883"></a>00883 <a name="l00884"></a>00884 <span class="comment">/*</span> <a name="l00885"></a>00885 <span class="comment"> * Unlock the surface </span> <a name="l00886"></a>00886 <span class="comment"> */</span> <a name="l00887"></a>00887 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l00888"></a>00888 SDL_UnlockSurface(dst); <a name="l00889"></a>00889 } <a name="l00890"></a>00890 <a name="l00891"></a>00891 <span class="keywordflow">return</span> (result); <a name="l00892"></a>00892 } <a name="l00893"></a>00893 <a name="l00905"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#a9eb9c20c69b527cda814a19212270efa">00905</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a9eb9c20c69b527cda814a19212270efa" title="Internal function to draw horizontal line of RGBA color with alpha blending.">_HLineAlpha</a>(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color) <a name="l00906"></a>00906 { <a name="l00907"></a>00907 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ace9f2505c12c5dacc778509991cd3716" title="Draw filled rectangle of RGBA color with alpha blending.">filledRectAlpha</a>(dst, x1, y, x2, y, color)); <a name="l00908"></a>00908 } <a name="l00909"></a>00909 <a name="l00921"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#a61dd5e7523ce84fb103da3338acd3a37">00921</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a61dd5e7523ce84fb103da3338acd3a37" title="Internal function to draw vertical line of RGBA color with alpha blending.">_VLineAlpha</a>(SDL_Surface * dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color) <a name="l00922"></a>00922 { <a name="l00923"></a>00923 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ace9f2505c12c5dacc778509991cd3716" title="Draw filled rectangle of RGBA color with alpha blending.">filledRectAlpha</a>(dst, x, y1, x, y2, color)); <a name="l00924"></a>00924 } <a name="l00925"></a>00925 <a name="l00937"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#af9269ad9bbfa20980d5947c85dda63d5">00937</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#af9269ad9bbfa20980d5947c85dda63d5" title="Pixel draw with blending enabled and using alpha weight on color.">pixelColorWeight</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color, Uint32 weight) <a name="l00938"></a>00938 { <a name="l00939"></a>00939 Uint32 a; <a name="l00940"></a>00940 <a name="l00941"></a>00941 <span class="comment">/*</span> <a name="l00942"></a>00942 <span class="comment"> * Get alpha </span> <a name="l00943"></a>00943 <span class="comment"> */</span> <a name="l00944"></a>00944 a = (color &amp; (Uint32) 0x000000ff); <a name="l00945"></a>00945 <a name="l00946"></a>00946 <span class="comment">/*</span> <a name="l00947"></a>00947 <span class="comment"> * Modify Alpha by weight </span> <a name="l00948"></a>00948 <span class="comment"> */</span> <a name="l00949"></a>00949 a = ((a * weight) &gt;&gt; 8); <a name="l00950"></a>00950 <a name="l00951"></a>00951 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ae6f8690e5c5a85d3263c8e16727b34ef" title="Pixel draw with blending enabled if a&lt;255.">pixelColor</a>(dst, x, y, (color &amp; (Uint32) 0xffffff00) | (Uint32) a)); <a name="l00952"></a>00952 } <a name="l00953"></a>00953 <a name="l00965"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1">00965</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color, Uint32 weight) <a name="l00966"></a>00966 { <a name="l00967"></a>00967 Uint32 a; <a name="l00968"></a>00968 <a name="l00969"></a>00969 <span class="comment">/*</span> <a name="l00970"></a>00970 <span class="comment"> * Get alpha </span> <a name="l00971"></a>00971 <span class="comment"> */</span> <a name="l00972"></a>00972 a = (color &amp; (Uint32) 0x000000ff); <a name="l00973"></a>00973 <a name="l00974"></a>00974 <span class="comment">/*</span> <a name="l00975"></a>00975 <span class="comment"> * Modify Alpha by weight </span> <a name="l00976"></a>00976 <span class="comment"> */</span> <a name="l00977"></a>00977 a = ((a * weight) &gt;&gt; 8); <a name="l00978"></a>00978 <a name="l00979"></a>00979 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(dst, x, y, (color &amp; (Uint32) 0xffffff00) | (Uint32) a)); <a name="l00980"></a>00980 } <a name="l00981"></a>00981 <a name="l00995"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a0046efc721e77b745fd5b621fbd48513">00995</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a7b6f83bdef72f6b356664a93841381c0" title="Pixel draw with blending enabled if a&lt;255.">pixelRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l00996"></a>00996 { <a name="l00997"></a>00997 Uint32 color; <a name="l00998"></a>00998 <a name="l00999"></a>00999 <span class="comment">/*</span> <a name="l01000"></a>01000 <span class="comment"> * Check Alpha </span> <a name="l01001"></a>01001 <span class="comment"> */</span> <a name="l01002"></a>01002 <span class="keywordflow">if</span> (a == 255) { <a name="l01003"></a>01003 <span class="comment">/*</span> <a name="l01004"></a>01004 <span class="comment"> * No alpha blending required </span> <a name="l01005"></a>01005 <span class="comment"> */</span> <a name="l01006"></a>01006 <span class="comment">/*</span> <a name="l01007"></a>01007 <span class="comment"> * Setup color </span> <a name="l01008"></a>01008 <span class="comment"> */</span> <a name="l01009"></a>01009 color = SDL_MapRGBA(dst-&gt;format, r, g, b, a); <a name="l01010"></a>01010 <span class="comment">/*</span> <a name="l01011"></a>01011 <span class="comment"> * Draw </span> <a name="l01012"></a>01012 <span class="comment"> */</span> <a name="l01013"></a>01013 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#abeed0e873efdf3aec8c6c86188d36f89" title="Internal pixel drawing - fast, no blending, locking, clipping.">fastPixelColor</a>(dst, x, y, color)); <a name="l01014"></a>01014 } <span class="keywordflow">else</span> { <a name="l01015"></a>01015 <span class="comment">/*</span> <a name="l01016"></a>01016 <span class="comment"> * Alpha blending required </span> <a name="l01017"></a>01017 <span class="comment"> */</span> <a name="l01018"></a>01018 <span class="comment">/*</span> <a name="l01019"></a>01019 <span class="comment"> * Draw </span> <a name="l01020"></a>01020 <span class="comment"> */</span> <a name="l01021"></a>01021 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ae6f8690e5c5a85d3263c8e16727b34ef" title="Pixel draw with blending enabled if a&lt;255.">pixelColor</a>(dst, x, y, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l01022"></a>01022 } <a name="l01023"></a>01023 } <a name="l01024"></a>01024 <a name="l01025"></a>01025 <a name="l01041"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#af20de4fe06f4d997eb2ab01a2252f071">01041</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#af20de4fe06f4d997eb2ab01a2252f071" title="Draw horizontal line without blending;.">hlineColorStore</a>(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color) <a name="l01042"></a>01042 { <a name="l01043"></a>01043 Sint16 left, right, top, bottom; <a name="l01044"></a>01044 Uint8 *pixel, *pixellast; <a name="l01045"></a>01045 <span class="keywordtype">int</span> dx; <a name="l01046"></a>01046 <span class="keywordtype">int</span> pixx, pixy; <a name="l01047"></a>01047 Sint16 w; <a name="l01048"></a>01048 Sint16 xtmp; <a name="l01049"></a>01049 <span class="keywordtype">int</span> result = -1; <a name="l01050"></a>01050 <a name="l01051"></a>01051 <span class="comment">/*</span> <a name="l01052"></a>01052 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l01053"></a>01053 <span class="comment"> */</span> <a name="l01054"></a>01054 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l01055"></a>01055 <span class="keywordflow">return</span>(0); <a name="l01056"></a>01056 } <a name="l01057"></a>01057 <a name="l01058"></a>01058 <span class="comment">/*</span> <a name="l01059"></a>01059 <span class="comment"> * Swap x1, x2 if required to ensure x1&lt;=x2</span> <a name="l01060"></a>01060 <span class="comment"> */</span> <a name="l01061"></a>01061 <span class="keywordflow">if</span> (x1 &gt; x2) { <a name="l01062"></a>01062 xtmp = x1; <a name="l01063"></a>01063 x1 = x2; <a name="l01064"></a>01064 x2 = xtmp; <a name="l01065"></a>01065 } <a name="l01066"></a>01066 <a name="l01067"></a>01067 <span class="comment">/*</span> <a name="l01068"></a>01068 <span class="comment"> * Get clipping boundary and</span> <a name="l01069"></a>01069 <span class="comment"> * check visibility of hline </span> <a name="l01070"></a>01070 <span class="comment"> */</span> <a name="l01071"></a>01071 left = dst-&gt;clip_rect.x; <a name="l01072"></a>01072 <span class="keywordflow">if</span> (x2&lt;left) { <a name="l01073"></a>01073 <span class="keywordflow">return</span>(0); <a name="l01074"></a>01074 } <a name="l01075"></a>01075 right = dst-&gt;clip_rect.x + dst-&gt;clip_rect.w - 1; <a name="l01076"></a>01076 <span class="keywordflow">if</span> (x1&gt;right) { <a name="l01077"></a>01077 <span class="keywordflow">return</span>(0); <a name="l01078"></a>01078 } <a name="l01079"></a>01079 top = dst-&gt;clip_rect.y; <a name="l01080"></a>01080 bottom = dst-&gt;clip_rect.y + dst-&gt;clip_rect.h - 1; <a name="l01081"></a>01081 <span class="keywordflow">if</span> ((y&lt;top) || (y&gt;bottom)) { <a name="l01082"></a>01082 <span class="keywordflow">return</span> (0); <a name="l01083"></a>01083 } <a name="l01084"></a>01084 <a name="l01085"></a>01085 <span class="comment">/*</span> <a name="l01086"></a>01086 <span class="comment"> * Clip x </span> <a name="l01087"></a>01087 <span class="comment"> */</span> <a name="l01088"></a>01088 <span class="keywordflow">if</span> (x1 &lt; left) { <a name="l01089"></a>01089 x1 = left; <a name="l01090"></a>01090 } <a name="l01091"></a>01091 <span class="keywordflow">if</span> (x2 &gt; right) { <a name="l01092"></a>01092 x2 = right; <a name="l01093"></a>01093 } <a name="l01094"></a>01094 <a name="l01095"></a>01095 <span class="comment">/*</span> <a name="l01096"></a>01096 <span class="comment"> * Calculate width </span> <a name="l01097"></a>01097 <span class="comment"> */</span> <a name="l01098"></a>01098 w = x2 - x1; <a name="l01099"></a>01099 <a name="l01100"></a>01100 <span class="comment">/*</span> <a name="l01101"></a>01101 <span class="comment"> * Lock the surface </span> <a name="l01102"></a>01102 <span class="comment"> */</span> <a name="l01103"></a>01103 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l01104"></a>01104 <span class="keywordflow">if</span> (SDL_LockSurface(dst) &lt; 0) { <a name="l01105"></a>01105 <span class="keywordflow">return</span> (-1); <a name="l01106"></a>01106 } <a name="l01107"></a>01107 } <a name="l01108"></a>01108 <a name="l01109"></a>01109 <span class="comment">/*</span> <a name="l01110"></a>01110 <span class="comment"> * More variable setup </span> <a name="l01111"></a>01111 <span class="comment"> */</span> <a name="l01112"></a>01112 dx = w; <a name="l01113"></a>01113 pixx = dst-&gt;format-&gt;BytesPerPixel; <a name="l01114"></a>01114 pixy = dst-&gt;pitch; <a name="l01115"></a>01115 pixel = ((Uint8 *) dst-&gt;pixels) + pixx * (int) x1 + pixy * (<span class="keywordtype">int</span>) y; <a name="l01116"></a>01116 <a name="l01117"></a>01117 <span class="comment">/*</span> <a name="l01118"></a>01118 <span class="comment"> * Draw </span> <a name="l01119"></a>01119 <span class="comment"> */</span> <a name="l01120"></a>01120 <span class="keywordflow">switch</span> (dst-&gt;format-&gt;BytesPerPixel) { <a name="l01121"></a>01121 <span class="keywordflow">case</span> 1: <a name="l01122"></a>01122 memset(pixel, color, dx+1); <a name="l01123"></a>01123 <span class="keywordflow">break</span>; <a name="l01124"></a>01124 <span class="keywordflow">case</span> 2: <a name="l01125"></a>01125 pixellast = pixel + dx + dx; <a name="l01126"></a>01126 <span class="keywordflow">for</span> (; pixel &lt;= pixellast; pixel += pixx) { <a name="l01127"></a>01127 *(Uint16 *) pixel = color; <a name="l01128"></a>01128 } <a name="l01129"></a>01129 <span class="keywordflow">break</span>; <a name="l01130"></a>01130 <span class="keywordflow">case</span> 3: <a name="l01131"></a>01131 pixellast = pixel + dx + dx + dx; <a name="l01132"></a>01132 <span class="keywordflow">for</span> (; pixel &lt;= pixellast; pixel += pixx) { <a name="l01133"></a>01133 <span class="keywordflow">if</span> (SDL_BYTEORDER == SDL_BIG_ENDIAN) { <a name="l01134"></a>01134 pixel[0] = (color &gt;&gt; 16) &amp; 0xff; <a name="l01135"></a>01135 pixel[1] = (color &gt;&gt; 8) &amp; 0xff; <a name="l01136"></a>01136 pixel[2] = color &amp; 0xff; <a name="l01137"></a>01137 } <span class="keywordflow">else</span> { <a name="l01138"></a>01138 pixel[0] = color &amp; 0xff; <a name="l01139"></a>01139 pixel[1] = (color &gt;&gt; 8) &amp; 0xff; <a name="l01140"></a>01140 pixel[2] = (color &gt;&gt; 16) &amp; 0xff; <a name="l01141"></a>01141 } <a name="l01142"></a>01142 } <a name="l01143"></a>01143 <span class="keywordflow">break</span>; <a name="l01144"></a>01144 <span class="keywordflow">default</span>: <span class="comment">/* case 4 */</span> <a name="l01145"></a>01145 dx = dx + dx; <a name="l01146"></a>01146 pixellast = pixel + dx + dx; <a name="l01147"></a>01147 <span class="keywordflow">for</span> (; pixel &lt;= pixellast; pixel += pixx) { <a name="l01148"></a>01148 *(Uint32 *) pixel = color; <a name="l01149"></a>01149 } <a name="l01150"></a>01150 <span class="keywordflow">break</span>; <a name="l01151"></a>01151 } <a name="l01152"></a>01152 <a name="l01153"></a>01153 <span class="comment">/* </span> <a name="l01154"></a>01154 <span class="comment"> * Unlock surface </span> <a name="l01155"></a>01155 <span class="comment"> */</span> <a name="l01156"></a>01156 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l01157"></a>01157 SDL_UnlockSurface(dst); <a name="l01158"></a>01158 } <a name="l01159"></a>01159 <a name="l01160"></a>01160 <span class="comment">/*</span> <a name="l01161"></a>01161 <span class="comment"> * Set result code </span> <a name="l01162"></a>01162 <span class="comment"> */</span> <a name="l01163"></a>01163 result = 0; <a name="l01164"></a>01164 <a name="l01165"></a>01165 <span class="keywordflow">return</span> (result); <a name="l01166"></a>01166 } <a name="l01167"></a>01167 <a name="l01185"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#a1b22ffb35c7690b4b0d8ba901640edae">01185</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a1b22ffb35c7690b4b0d8ba901640edae" title="Draw horizontal line without blending.">hlineRGBAStore</a>(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l01186"></a>01186 { <a name="l01187"></a>01187 <span class="comment">/*</span> <a name="l01188"></a>01188 <span class="comment"> * Draw </span> <a name="l01189"></a>01189 <span class="comment"> */</span> <a name="l01190"></a>01190 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#af20de4fe06f4d997eb2ab01a2252f071" title="Draw horizontal line without blending;.">hlineColorStore</a>(dst, x1, x2, y, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l01191"></a>01191 } <a name="l01192"></a>01192 <a name="l01204"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a31ac87bf32186325deedf5188b987ef6">01204</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color) <a name="l01205"></a>01205 { <a name="l01206"></a>01206 Sint16 left, right, top, bottom; <a name="l01207"></a>01207 Uint8 *pixel, *pixellast; <a name="l01208"></a>01208 <span class="keywordtype">int</span> dx; <a name="l01209"></a>01209 <span class="keywordtype">int</span> pixx, pixy; <a name="l01210"></a>01210 Sint16 xtmp; <a name="l01211"></a>01211 <span class="keywordtype">int</span> result = -1; <a name="l01212"></a>01212 Uint8 *colorptr; <a name="l01213"></a>01213 Uint8 color3[3]; <a name="l01214"></a>01214 <a name="l01215"></a>01215 <span class="comment">/*</span> <a name="l01216"></a>01216 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l01217"></a>01217 <span class="comment"> */</span> <a name="l01218"></a>01218 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l01219"></a>01219 <span class="keywordflow">return</span>(0); <a name="l01220"></a>01220 } <a name="l01221"></a>01221 <a name="l01222"></a>01222 <span class="comment">/*</span> <a name="l01223"></a>01223 <span class="comment"> * Swap x1, x2 if required to ensure x1&lt;=x2</span> <a name="l01224"></a>01224 <span class="comment"> */</span> <a name="l01225"></a>01225 <span class="keywordflow">if</span> (x1 &gt; x2) { <a name="l01226"></a>01226 xtmp = x1; <a name="l01227"></a>01227 x1 = x2; <a name="l01228"></a>01228 x2 = xtmp; <a name="l01229"></a>01229 } <a name="l01230"></a>01230 <a name="l01231"></a>01231 <span class="comment">/*</span> <a name="l01232"></a>01232 <span class="comment"> * Get clipping boundary and</span> <a name="l01233"></a>01233 <span class="comment"> * check visibility of hline </span> <a name="l01234"></a>01234 <span class="comment"> */</span> <a name="l01235"></a>01235 left = dst-&gt;clip_rect.x; <a name="l01236"></a>01236 <span class="keywordflow">if</span> (x2&lt;left) { <a name="l01237"></a>01237 <span class="keywordflow">return</span>(0); <a name="l01238"></a>01238 } <a name="l01239"></a>01239 right = dst-&gt;clip_rect.x + dst-&gt;clip_rect.w - 1; <a name="l01240"></a>01240 <span class="keywordflow">if</span> (x1&gt;right) { <a name="l01241"></a>01241 <span class="keywordflow">return</span>(0); <a name="l01242"></a>01242 } <a name="l01243"></a>01243 top = dst-&gt;clip_rect.y; <a name="l01244"></a>01244 bottom = dst-&gt;clip_rect.y + dst-&gt;clip_rect.h - 1; <a name="l01245"></a>01245 <span class="keywordflow">if</span> ((y&lt;top) || (y&gt;bottom)) { <a name="l01246"></a>01246 <span class="keywordflow">return</span> (0); <a name="l01247"></a>01247 } <a name="l01248"></a>01248 <a name="l01249"></a>01249 <span class="comment">/*</span> <a name="l01250"></a>01250 <span class="comment"> * Clip x </span> <a name="l01251"></a>01251 <span class="comment"> */</span> <a name="l01252"></a>01252 <span class="keywordflow">if</span> (x1 &lt; left) { <a name="l01253"></a>01253 x1 = left; <a name="l01254"></a>01254 } <a name="l01255"></a>01255 <span class="keywordflow">if</span> (x2 &gt; right) { <a name="l01256"></a>01256 x2 = right; <a name="l01257"></a>01257 } <a name="l01258"></a>01258 <a name="l01259"></a>01259 <span class="comment">/*</span> <a name="l01260"></a>01260 <span class="comment"> * Calculate width difference</span> <a name="l01261"></a>01261 <span class="comment"> */</span> <a name="l01262"></a>01262 dx = x2 - x1; <a name="l01263"></a>01263 <a name="l01264"></a>01264 <span class="comment">/*</span> <a name="l01265"></a>01265 <span class="comment"> * Alpha check </span> <a name="l01266"></a>01266 <span class="comment"> */</span> <a name="l01267"></a>01267 <span class="keywordflow">if</span> ((color &amp; 255) == 255) { <a name="l01268"></a>01268 <a name="l01269"></a>01269 <span class="comment">/*</span> <a name="l01270"></a>01270 <span class="comment"> * No alpha-blending required </span> <a name="l01271"></a>01271 <span class="comment"> */</span> <a name="l01272"></a>01272 <a name="l01273"></a>01273 <span class="comment">/*</span> <a name="l01274"></a>01274 <span class="comment"> * Setup color </span> <a name="l01275"></a>01275 <span class="comment"> */</span> <a name="l01276"></a>01276 colorptr = (Uint8 *) &amp; color; <a name="l01277"></a>01277 <span class="keywordflow">if</span> (SDL_BYTEORDER == SDL_BIG_ENDIAN) { <a name="l01278"></a>01278 color = SDL_MapRGBA(dst-&gt;format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]); <a name="l01279"></a>01279 } <span class="keywordflow">else</span> { <a name="l01280"></a>01280 color = SDL_MapRGBA(dst-&gt;format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]); <a name="l01281"></a>01281 } <a name="l01282"></a>01282 <a name="l01283"></a>01283 <span class="comment">/*</span> <a name="l01284"></a>01284 <span class="comment"> * Lock the surface </span> <a name="l01285"></a>01285 <span class="comment"> */</span> <a name="l01286"></a>01286 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l01287"></a>01287 <span class="keywordflow">if</span> (SDL_LockSurface(dst) &lt; 0) { <a name="l01288"></a>01288 <span class="keywordflow">return</span> (-1); <a name="l01289"></a>01289 } <a name="l01290"></a>01290 } <a name="l01291"></a>01291 <a name="l01292"></a>01292 <span class="comment">/*</span> <a name="l01293"></a>01293 <span class="comment"> * More variable setup </span> <a name="l01294"></a>01294 <span class="comment"> */</span> <a name="l01295"></a>01295 pixx = dst-&gt;format-&gt;BytesPerPixel; <a name="l01296"></a>01296 pixy = dst-&gt;pitch; <a name="l01297"></a>01297 pixel = ((Uint8 *) dst-&gt;pixels) + pixx * (int) x1 + pixy * (<span class="keywordtype">int</span>) y; <a name="l01298"></a>01298 <a name="l01299"></a>01299 <span class="comment">/*</span> <a name="l01300"></a>01300 <span class="comment"> * Draw </span> <a name="l01301"></a>01301 <span class="comment"> */</span> <a name="l01302"></a>01302 <span class="keywordflow">switch</span> (dst-&gt;format-&gt;BytesPerPixel) { <a name="l01303"></a>01303 <span class="keywordflow">case</span> 1: <a name="l01304"></a>01304 memset(pixel, color, dx + 1); <a name="l01305"></a>01305 <span class="keywordflow">break</span>; <a name="l01306"></a>01306 <span class="keywordflow">case</span> 2: <a name="l01307"></a>01307 pixellast = pixel + dx + dx; <a name="l01308"></a>01308 <span class="keywordflow">for</span> (; pixel &lt;= pixellast; pixel += pixx) { <a name="l01309"></a>01309 *(Uint16 *) pixel = color; <a name="l01310"></a>01310 } <a name="l01311"></a>01311 <span class="keywordflow">break</span>; <a name="l01312"></a>01312 <span class="keywordflow">case</span> 3: <a name="l01313"></a>01313 pixellast = pixel + dx + dx + dx; <a name="l01314"></a>01314 <span class="keywordflow">if</span> (SDL_BYTEORDER == SDL_BIG_ENDIAN) { <a name="l01315"></a>01315 color3[0] = (color &gt;&gt; 16) &amp; 0xff; <a name="l01316"></a>01316 color3[1] = (color &gt;&gt; 8) &amp; 0xff; <a name="l01317"></a>01317 color3[2] = color &amp; 0xff; <a name="l01318"></a>01318 } <span class="keywordflow">else</span> { <a name="l01319"></a>01319 color3[0] = color &amp; 0xff; <a name="l01320"></a>01320 color3[1] = (color &gt;&gt; 8) &amp; 0xff; <a name="l01321"></a>01321 color3[2] = (color &gt;&gt; 16) &amp; 0xff; <a name="l01322"></a>01322 } <a name="l01323"></a>01323 <span class="keywordflow">for</span> (; pixel &lt;= pixellast; pixel += pixx) { <a name="l01324"></a>01324 memcpy(pixel, color3, 3); <a name="l01325"></a>01325 } <a name="l01326"></a>01326 <span class="keywordflow">break</span>; <a name="l01327"></a>01327 <span class="keywordflow">default</span>: <span class="comment">/* case 4 */</span> <a name="l01328"></a>01328 dx = dx + dx; <a name="l01329"></a>01329 pixellast = pixel + dx + dx; <a name="l01330"></a>01330 <span class="keywordflow">for</span> (; pixel &lt;= pixellast; pixel += pixx) { <a name="l01331"></a>01331 *(Uint32 *) pixel = color; <a name="l01332"></a>01332 } <a name="l01333"></a>01333 <span class="keywordflow">break</span>; <a name="l01334"></a>01334 } <a name="l01335"></a>01335 <a name="l01336"></a>01336 <span class="comment">/* </span> <a name="l01337"></a>01337 <span class="comment"> * Unlock surface </span> <a name="l01338"></a>01338 <span class="comment"> */</span> <a name="l01339"></a>01339 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l01340"></a>01340 SDL_UnlockSurface(dst); <a name="l01341"></a>01341 } <a name="l01342"></a>01342 <a name="l01343"></a>01343 <span class="comment">/*</span> <a name="l01344"></a>01344 <span class="comment"> * Set result code </span> <a name="l01345"></a>01345 <span class="comment"> */</span> <a name="l01346"></a>01346 result = 0; <a name="l01347"></a>01347 <a name="l01348"></a>01348 } <span class="keywordflow">else</span> { <a name="l01349"></a>01349 <a name="l01350"></a>01350 <span class="comment">/*</span> <a name="l01351"></a>01351 <span class="comment"> * Alpha blending blit </span> <a name="l01352"></a>01352 <span class="comment"> */</span> <a name="l01353"></a>01353 result = <a class="code" href="_s_d_l__gfx_primitives_8c.html#a9eb9c20c69b527cda814a19212270efa" title="Internal function to draw horizontal line of RGBA color with alpha blending.">_HLineAlpha</a>(dst, x1, x1 + dx, y, color); <a name="l01354"></a>01354 } <a name="l01355"></a>01355 <a name="l01356"></a>01356 <span class="keywordflow">return</span> (result); <a name="l01357"></a>01357 } <a name="l01358"></a>01358 <a name="l01373"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#ae48e69e0f5d13ea79ffac262b146ae9e">01373</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a6608a0d1d4c7e16fa1afcbd3eb5c3850" title="Draw horizontal line with blending.">hlineRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l01374"></a>01374 { <a name="l01375"></a>01375 <span class="comment">/*</span> <a name="l01376"></a>01376 <span class="comment"> * Draw </span> <a name="l01377"></a>01377 <span class="comment"> */</span> <a name="l01378"></a>01378 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, x1, x2, y, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l01379"></a>01379 } <a name="l01380"></a>01380 <a name="l01392"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#ab68d565f00527a67c9d88121c753302c">01392</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67" title="Draw vertical line with blending.">vlineColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color) <a name="l01393"></a>01393 { <a name="l01394"></a>01394 Sint16 left, right, top, bottom; <a name="l01395"></a>01395 Uint8 *pixel, *pixellast; <a name="l01396"></a>01396 <span class="keywordtype">int</span> dy; <a name="l01397"></a>01397 <span class="keywordtype">int</span> pixx, pixy; <a name="l01398"></a>01398 Sint16 h; <a name="l01399"></a>01399 Sint16 ytmp; <a name="l01400"></a>01400 <span class="keywordtype">int</span> result = -1; <a name="l01401"></a>01401 Uint8 *colorptr; <a name="l01402"></a>01402 <a name="l01403"></a>01403 <span class="comment">/*</span> <a name="l01404"></a>01404 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l01405"></a>01405 <span class="comment"> */</span> <a name="l01406"></a>01406 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l01407"></a>01407 <span class="keywordflow">return</span>(0); <a name="l01408"></a>01408 } <a name="l01409"></a>01409 <a name="l01410"></a>01410 <span class="comment">/*</span> <a name="l01411"></a>01411 <span class="comment"> * Swap y1, y2 if required to ensure y1&lt;=y2</span> <a name="l01412"></a>01412 <span class="comment"> */</span> <a name="l01413"></a>01413 <span class="keywordflow">if</span> (y1 &gt; y2) { <a name="l01414"></a>01414 ytmp = y1; <a name="l01415"></a>01415 y1 = y2; <a name="l01416"></a>01416 y2 = ytmp; <a name="l01417"></a>01417 } <a name="l01418"></a>01418 <a name="l01419"></a>01419 <span class="comment">/*</span> <a name="l01420"></a>01420 <span class="comment"> * Get clipping boundary and</span> <a name="l01421"></a>01421 <span class="comment"> * check visibility of vline </span> <a name="l01422"></a>01422 <span class="comment"> */</span> <a name="l01423"></a>01423 left = dst-&gt;clip_rect.x; <a name="l01424"></a>01424 right = dst-&gt;clip_rect.x + dst-&gt;clip_rect.w - 1; <a name="l01425"></a>01425 <span class="keywordflow">if</span> ((x&lt;left) || (x&gt;right)) { <a name="l01426"></a>01426 <span class="keywordflow">return</span> (0); <a name="l01427"></a>01427 } <a name="l01428"></a>01428 top = dst-&gt;clip_rect.y; <a name="l01429"></a>01429 <span class="keywordflow">if</span> (y2&lt;top) { <a name="l01430"></a>01430 <span class="keywordflow">return</span>(0); <a name="l01431"></a>01431 } <a name="l01432"></a>01432 bottom = dst-&gt;clip_rect.y + dst-&gt;clip_rect.h - 1; <a name="l01433"></a>01433 <span class="keywordflow">if</span> (y1&gt;bottom) { <a name="l01434"></a>01434 <span class="keywordflow">return</span>(0); <a name="l01435"></a>01435 } <a name="l01436"></a>01436 <a name="l01437"></a>01437 <span class="comment">/*</span> <a name="l01438"></a>01438 <span class="comment"> * Clip x </span> <a name="l01439"></a>01439 <span class="comment"> */</span> <a name="l01440"></a>01440 <span class="keywordflow">if</span> (y1 &lt; top) { <a name="l01441"></a>01441 y1 = top; <a name="l01442"></a>01442 } <a name="l01443"></a>01443 <span class="keywordflow">if</span> (y2 &gt; bottom) { <a name="l01444"></a>01444 y2 = bottom; <a name="l01445"></a>01445 } <a name="l01446"></a>01446 <a name="l01447"></a>01447 <span class="comment">/*</span> <a name="l01448"></a>01448 <span class="comment"> * Calculate height</span> <a name="l01449"></a>01449 <span class="comment"> */</span> <a name="l01450"></a>01450 h = y2 - y1; <a name="l01451"></a>01451 <a name="l01452"></a>01452 <span class="comment">/*</span> <a name="l01453"></a>01453 <span class="comment"> * Alpha check </span> <a name="l01454"></a>01454 <span class="comment"> */</span> <a name="l01455"></a>01455 <span class="keywordflow">if</span> ((color &amp; 255) == 255) { <a name="l01456"></a>01456 <a name="l01457"></a>01457 <span class="comment">/*</span> <a name="l01458"></a>01458 <span class="comment"> * No alpha-blending required </span> <a name="l01459"></a>01459 <span class="comment"> */</span> <a name="l01460"></a>01460 <a name="l01461"></a>01461 <span class="comment">/*</span> <a name="l01462"></a>01462 <span class="comment"> * Setup color </span> <a name="l01463"></a>01463 <span class="comment"> */</span> <a name="l01464"></a>01464 colorptr = (Uint8 *) &amp; color; <a name="l01465"></a>01465 <span class="keywordflow">if</span> (SDL_BYTEORDER == SDL_BIG_ENDIAN) { <a name="l01466"></a>01466 color = SDL_MapRGBA(dst-&gt;format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]); <a name="l01467"></a>01467 } <span class="keywordflow">else</span> { <a name="l01468"></a>01468 color = SDL_MapRGBA(dst-&gt;format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]); <a name="l01469"></a>01469 } <a name="l01470"></a>01470 <a name="l01471"></a>01471 <span class="comment">/*</span> <a name="l01472"></a>01472 <span class="comment"> * Lock the surface </span> <a name="l01473"></a>01473 <span class="comment"> */</span> <a name="l01474"></a>01474 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l01475"></a>01475 <span class="keywordflow">if</span> (SDL_LockSurface(dst) &lt; 0) { <a name="l01476"></a>01476 <span class="keywordflow">return</span> (-1); <a name="l01477"></a>01477 } <a name="l01478"></a>01478 } <a name="l01479"></a>01479 <a name="l01480"></a>01480 <span class="comment">/*</span> <a name="l01481"></a>01481 <span class="comment"> * More variable setup </span> <a name="l01482"></a>01482 <span class="comment"> */</span> <a name="l01483"></a>01483 dy = h; <a name="l01484"></a>01484 pixx = dst-&gt;format-&gt;BytesPerPixel; <a name="l01485"></a>01485 pixy = dst-&gt;pitch; <a name="l01486"></a>01486 pixel = ((Uint8 *) dst-&gt;pixels) + pixx * (int) x + pixy * (<span class="keywordtype">int</span>) y1; <a name="l01487"></a>01487 pixellast = pixel + pixy * dy; <a name="l01488"></a>01488 <a name="l01489"></a>01489 <span class="comment">/*</span> <a name="l01490"></a>01490 <span class="comment"> * Draw </span> <a name="l01491"></a>01491 <span class="comment"> */</span> <a name="l01492"></a>01492 <span class="keywordflow">switch</span> (dst-&gt;format-&gt;BytesPerPixel) { <a name="l01493"></a>01493 <span class="keywordflow">case</span> 1: <a name="l01494"></a>01494 <span class="keywordflow">for</span> (; pixel &lt;= pixellast; pixel += pixy) { <a name="l01495"></a>01495 *(Uint8 *) pixel = color; <a name="l01496"></a>01496 } <a name="l01497"></a>01497 <span class="keywordflow">break</span>; <a name="l01498"></a>01498 <span class="keywordflow">case</span> 2: <a name="l01499"></a>01499 <span class="keywordflow">for</span> (; pixel &lt;= pixellast; pixel += pixy) { <a name="l01500"></a>01500 *(Uint16 *) pixel = color; <a name="l01501"></a>01501 } <a name="l01502"></a>01502 <span class="keywordflow">break</span>; <a name="l01503"></a>01503 <span class="keywordflow">case</span> 3: <a name="l01504"></a>01504 <span class="keywordflow">for</span> (; pixel &lt;= pixellast; pixel += pixy) { <a name="l01505"></a>01505 <span class="keywordflow">if</span> (SDL_BYTEORDER == SDL_BIG_ENDIAN) { <a name="l01506"></a>01506 pixel[0] = (color &gt;&gt; 16) &amp; 0xff; <a name="l01507"></a>01507 pixel[1] = (color &gt;&gt; 8) &amp; 0xff; <a name="l01508"></a>01508 pixel[2] = color &amp; 0xff; <a name="l01509"></a>01509 } <span class="keywordflow">else</span> { <a name="l01510"></a>01510 pixel[0] = color &amp; 0xff; <a name="l01511"></a>01511 pixel[1] = (color &gt;&gt; 8) &amp; 0xff; <a name="l01512"></a>01512 pixel[2] = (color &gt;&gt; 16) &amp; 0xff; <a name="l01513"></a>01513 } <a name="l01514"></a>01514 } <a name="l01515"></a>01515 <span class="keywordflow">break</span>; <a name="l01516"></a>01516 <span class="keywordflow">default</span>: <span class="comment">/* case 4 */</span> <a name="l01517"></a>01517 <span class="keywordflow">for</span> (; pixel &lt;= pixellast; pixel += pixy) { <a name="l01518"></a>01518 *(Uint32 *) pixel = color; <a name="l01519"></a>01519 } <a name="l01520"></a>01520 <span class="keywordflow">break</span>; <a name="l01521"></a>01521 } <a name="l01522"></a>01522 <a name="l01523"></a>01523 <span class="comment">/* Unlock surface */</span> <a name="l01524"></a>01524 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l01525"></a>01525 SDL_UnlockSurface(dst); <a name="l01526"></a>01526 } <a name="l01527"></a>01527 <a name="l01528"></a>01528 <span class="comment">/*</span> <a name="l01529"></a>01529 <span class="comment"> * Set result code </span> <a name="l01530"></a>01530 <span class="comment"> */</span> <a name="l01531"></a>01531 result = 0; <a name="l01532"></a>01532 <a name="l01533"></a>01533 } <span class="keywordflow">else</span> { <a name="l01534"></a>01534 <a name="l01535"></a>01535 <span class="comment">/*</span> <a name="l01536"></a>01536 <span class="comment"> * Alpha blending blit </span> <a name="l01537"></a>01537 <span class="comment"> */</span> <a name="l01538"></a>01538 <a name="l01539"></a>01539 result = <a class="code" href="_s_d_l__gfx_primitives_8c.html#a61dd5e7523ce84fb103da3338acd3a37" title="Internal function to draw vertical line of RGBA color with alpha blending.">_VLineAlpha</a>(dst, x, y1, y1 + h, color); <a name="l01540"></a>01540 <a name="l01541"></a>01541 } <a name="l01542"></a>01542 <a name="l01543"></a>01543 <span class="keywordflow">return</span> (result); <a name="l01544"></a>01544 } <a name="l01545"></a>01545 <a name="l01560"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a68ed9a65e3e0de26136566b0cf0c859e">01560</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a8b79ac1e779755aee92b04f3a6cfc5d7" title="Draw vertical line with blending.">vlineRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l01561"></a>01561 { <a name="l01562"></a>01562 <span class="comment">/*</span> <a name="l01563"></a>01563 <span class="comment"> * Draw </span> <a name="l01564"></a>01564 <span class="comment"> */</span> <a name="l01565"></a>01565 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67" title="Draw vertical line with blending.">vlineColor</a>(dst, x, y1, y2, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l01566"></a>01566 } <a name="l01567"></a>01567 <a name="l01580"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a36453f52608a10f3d6b8edccae260b95">01580</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a6ab25c393f6e5f8d68ea3365f6ea98d2" title="Draw rectangle with blending.">rectangleColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color) <a name="l01581"></a>01581 { <a name="l01582"></a>01582 <span class="keywordtype">int</span> result; <a name="l01583"></a>01583 Sint16 tmp; <a name="l01584"></a>01584 <a name="l01585"></a>01585 <span class="comment">/* Check destination surface */</span> <a name="l01586"></a>01586 <span class="keywordflow">if</span> (dst == NULL) <a name="l01587"></a>01587 { <a name="l01588"></a>01588 <span class="keywordflow">return</span> -1; <a name="l01589"></a>01589 } <a name="l01590"></a>01590 <a name="l01591"></a>01591 <span class="comment">/*</span> <a name="l01592"></a>01592 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l01593"></a>01593 <span class="comment"> */</span> <a name="l01594"></a>01594 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l01595"></a>01595 <span class="keywordflow">return</span> 0; <a name="l01596"></a>01596 } <a name="l01597"></a>01597 <a name="l01598"></a>01598 <span class="comment">/*</span> <a name="l01599"></a>01599 <span class="comment"> * Test for special cases of straight lines or single point </span> <a name="l01600"></a>01600 <span class="comment"> */</span> <a name="l01601"></a>01601 <span class="keywordflow">if</span> (x1 == x2) { <a name="l01602"></a>01602 <span class="keywordflow">if</span> (y1 == y2) { <a name="l01603"></a>01603 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ae6f8690e5c5a85d3263c8e16727b34ef" title="Pixel draw with blending enabled if a&lt;255.">pixelColor</a>(dst, x1, y1, color)); <a name="l01604"></a>01604 } <span class="keywordflow">else</span> { <a name="l01605"></a>01605 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67" title="Draw vertical line with blending.">vlineColor</a>(dst, x1, y1, y2, color)); <a name="l01606"></a>01606 } <a name="l01607"></a>01607 } <span class="keywordflow">else</span> { <a name="l01608"></a>01608 <span class="keywordflow">if</span> (y1 == y2) { <a name="l01609"></a>01609 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, x1, x2, y1, color)); <a name="l01610"></a>01610 } <a name="l01611"></a>01611 } <a name="l01612"></a>01612 <a name="l01613"></a>01613 <span class="comment">/*</span> <a name="l01614"></a>01614 <span class="comment"> * Swap x1, x2 if required </span> <a name="l01615"></a>01615 <span class="comment"> */</span> <a name="l01616"></a>01616 <span class="keywordflow">if</span> (x1 &gt; x2) { <a name="l01617"></a>01617 tmp = x1; <a name="l01618"></a>01618 x1 = x2; <a name="l01619"></a>01619 x2 = tmp; <a name="l01620"></a>01620 } <a name="l01621"></a>01621 <a name="l01622"></a>01622 <span class="comment">/*</span> <a name="l01623"></a>01623 <span class="comment"> * Swap y1, y2 if required </span> <a name="l01624"></a>01624 <span class="comment"> */</span> <a name="l01625"></a>01625 <span class="keywordflow">if</span> (y1 &gt; y2) { <a name="l01626"></a>01626 tmp = y1; <a name="l01627"></a>01627 y1 = y2; <a name="l01628"></a>01628 y2 = tmp; <a name="l01629"></a>01629 } <a name="l01630"></a>01630 <a name="l01631"></a>01631 <span class="comment">/*</span> <a name="l01632"></a>01632 <span class="comment"> * Draw rectangle </span> <a name="l01633"></a>01633 <span class="comment"> */</span> <a name="l01634"></a>01634 result = 0; <a name="l01635"></a>01635 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, x1, x2, y1, color); <a name="l01636"></a>01636 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, x1, x2, y2, color); <a name="l01637"></a>01637 y1 += 1; <a name="l01638"></a>01638 y2 -= 1; <a name="l01639"></a>01639 <span class="keywordflow">if</span> (y1 &lt;= y2) { <a name="l01640"></a>01640 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67" title="Draw vertical line with blending.">vlineColor</a>(dst, x1, y1, y2, color); <a name="l01641"></a>01641 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67" title="Draw vertical line with blending.">vlineColor</a>(dst, x2, y1, y2, color); <a name="l01642"></a>01642 } <a name="l01643"></a>01643 <a name="l01644"></a>01644 <span class="keywordflow">return</span> (result); <a name="l01645"></a>01645 <a name="l01646"></a>01646 } <a name="l01647"></a>01647 <a name="l01663"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a6c41cbfd0618262de4d4d127ed1e67fe">01663</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a40991c6eeb936d35d0a8e8aa95268f72" title="Draw rectangle with blending.">rectangleRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l01664"></a>01664 { <a name="l01665"></a>01665 <span class="comment">/*</span> <a name="l01666"></a>01666 <span class="comment"> * Draw </span> <a name="l01667"></a>01667 <span class="comment"> */</span> <a name="l01668"></a>01668 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a6ab25c393f6e5f8d68ea3365f6ea98d2" title="Draw rectangle with blending.">rectangleColor</a> <a name="l01669"></a>01669 (dst, x1, y1, x2, y2, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l01670"></a>01670 } <a name="l01671"></a>01671 <a name="l01685"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a4109d2d1efa021c021fc4a98a0e3691b">01685</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a830dd9dcfa39f4718aa2c269060326d0" title="Draw rounded-corner rectangle with blending.">roundedRectangleColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color) <a name="l01686"></a>01686 { <a name="l01687"></a>01687 <span class="keywordtype">int</span> result; <a name="l01688"></a>01688 Sint16 w, h, tmp; <a name="l01689"></a>01689 Sint16 xx1, xx2, yy1, yy2; <a name="l01690"></a>01690 <a name="l01691"></a>01691 <span class="comment">/* </span> <a name="l01692"></a>01692 <span class="comment"> * Check destination surface </span> <a name="l01693"></a>01693 <span class="comment"> */</span> <a name="l01694"></a>01694 <span class="keywordflow">if</span> (dst == NULL) <a name="l01695"></a>01695 { <a name="l01696"></a>01696 <span class="keywordflow">return</span> -1; <a name="l01697"></a>01697 } <a name="l01698"></a>01698 <a name="l01699"></a>01699 <span class="comment">/*</span> <a name="l01700"></a>01700 <span class="comment"> * Check radius vor valid range</span> <a name="l01701"></a>01701 <span class="comment"> */</span> <a name="l01702"></a>01702 <span class="keywordflow">if</span> (rad &lt; 0) { <a name="l01703"></a>01703 <span class="keywordflow">return</span> -1; <a name="l01704"></a>01704 } <a name="l01705"></a>01705 <a name="l01706"></a>01706 <span class="comment">/*</span> <a name="l01707"></a>01707 <span class="comment"> * Special case - no rounding</span> <a name="l01708"></a>01708 <span class="comment"> */</span> <a name="l01709"></a>01709 <span class="keywordflow">if</span> (rad == 0) { <a name="l01710"></a>01710 <span class="keywordflow">return</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a6ab25c393f6e5f8d68ea3365f6ea98d2" title="Draw rectangle with blending.">rectangleColor</a>(dst, x1, y1, x2, y2, color); <a name="l01711"></a>01711 } <a name="l01712"></a>01712 <a name="l01713"></a>01713 <span class="comment">/*</span> <a name="l01714"></a>01714 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l01715"></a>01715 <span class="comment"> */</span> <a name="l01716"></a>01716 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l01717"></a>01717 <span class="keywordflow">return</span> 0; <a name="l01718"></a>01718 } <a name="l01719"></a>01719 <a name="l01720"></a>01720 <span class="comment">/*</span> <a name="l01721"></a>01721 <span class="comment"> * Test for special cases of straight lines or single point </span> <a name="l01722"></a>01722 <span class="comment"> */</span> <a name="l01723"></a>01723 <span class="keywordflow">if</span> (x1 == x2) { <a name="l01724"></a>01724 <span class="keywordflow">if</span> (y1 == y2) { <a name="l01725"></a>01725 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ae6f8690e5c5a85d3263c8e16727b34ef" title="Pixel draw with blending enabled if a&lt;255.">pixelColor</a>(dst, x1, y1, color)); <a name="l01726"></a>01726 } <span class="keywordflow">else</span> { <a name="l01727"></a>01727 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67" title="Draw vertical line with blending.">vlineColor</a>(dst, x1, y1, y2, color)); <a name="l01728"></a>01728 } <a name="l01729"></a>01729 } <span class="keywordflow">else</span> { <a name="l01730"></a>01730 <span class="keywordflow">if</span> (y1 == y2) { <a name="l01731"></a>01731 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, x1, x2, y1, color)); <a name="l01732"></a>01732 } <a name="l01733"></a>01733 } <a name="l01734"></a>01734 <a name="l01735"></a>01735 <span class="comment">/*</span> <a name="l01736"></a>01736 <span class="comment"> * Swap x1, x2 if required </span> <a name="l01737"></a>01737 <span class="comment"> */</span> <a name="l01738"></a>01738 <span class="keywordflow">if</span> (x1 &gt; x2) { <a name="l01739"></a>01739 tmp = x1; <a name="l01740"></a>01740 x1 = x2; <a name="l01741"></a>01741 x2 = tmp; <a name="l01742"></a>01742 } <a name="l01743"></a>01743 <a name="l01744"></a>01744 <span class="comment">/*</span> <a name="l01745"></a>01745 <span class="comment"> * Swap y1, y2 if required </span> <a name="l01746"></a>01746 <span class="comment"> */</span> <a name="l01747"></a>01747 <span class="keywordflow">if</span> (y1 &gt; y2) { <a name="l01748"></a>01748 tmp = y1; <a name="l01749"></a>01749 y1 = y2; <a name="l01750"></a>01750 y2 = tmp; <a name="l01751"></a>01751 } <a name="l01752"></a>01752 <a name="l01753"></a>01753 <span class="comment">/*</span> <a name="l01754"></a>01754 <span class="comment"> * Calculate width&amp;height </span> <a name="l01755"></a>01755 <span class="comment"> */</span> <a name="l01756"></a>01756 w = x2 - x1; <a name="l01757"></a>01757 h = y2 - y1; <a name="l01758"></a>01758 <a name="l01759"></a>01759 <span class="comment">/*</span> <a name="l01760"></a>01760 <span class="comment"> * Maybe adjust radius</span> <a name="l01761"></a>01761 <span class="comment"> */</span> <a name="l01762"></a>01762 <span class="keywordflow">if</span> ((rad * 2) &gt; w) <a name="l01763"></a>01763 { <a name="l01764"></a>01764 rad = w / 2; <a name="l01765"></a>01765 } <a name="l01766"></a>01766 <span class="keywordflow">if</span> ((rad * 2) &gt; h) <a name="l01767"></a>01767 { <a name="l01768"></a>01768 rad = h / 2; <a name="l01769"></a>01769 } <a name="l01770"></a>01770 <a name="l01771"></a>01771 <span class="comment">/*</span> <a name="l01772"></a>01772 <span class="comment"> * Draw corners</span> <a name="l01773"></a>01773 <span class="comment"> */</span> <a name="l01774"></a>01774 result = 0; <a name="l01775"></a>01775 xx1 = x1 + rad; <a name="l01776"></a>01776 xx2 = x2 - rad; <a name="l01777"></a>01777 yy1 = y1 + rad; <a name="l01778"></a>01778 yy2 = y2 - rad; <a name="l01779"></a>01779 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a461b8ac31e00306aee5f8a4c242671d2" title="Arc with blending.">arcColor</a>(dst, xx1, yy1, rad, 180, 270, color); <a name="l01780"></a>01780 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a461b8ac31e00306aee5f8a4c242671d2" title="Arc with blending.">arcColor</a>(dst, xx2, yy1, rad, 270, 360, color); <a name="l01781"></a>01781 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a461b8ac31e00306aee5f8a4c242671d2" title="Arc with blending.">arcColor</a>(dst, xx1, yy2, rad, 90, 180, color); <a name="l01782"></a>01782 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a461b8ac31e00306aee5f8a4c242671d2" title="Arc with blending.">arcColor</a>(dst, xx2, yy2, rad, 0, 90, color); <a name="l01783"></a>01783 <a name="l01784"></a>01784 <span class="comment">/*</span> <a name="l01785"></a>01785 <span class="comment"> * Draw lines</span> <a name="l01786"></a>01786 <span class="comment"> */</span> <a name="l01787"></a>01787 <span class="keywordflow">if</span> (xx1 &lt;= xx2) { <a name="l01788"></a>01788 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xx1, xx2, y1, color); <a name="l01789"></a>01789 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xx1, xx2, y2, color); <a name="l01790"></a>01790 } <a name="l01791"></a>01791 <span class="keywordflow">if</span> (yy1 &lt;= yy2) { <a name="l01792"></a>01792 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67" title="Draw vertical line with blending.">vlineColor</a>(dst, x1, yy1, yy2, color); <a name="l01793"></a>01793 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67" title="Draw vertical line with blending.">vlineColor</a>(dst, x2, yy1, yy2, color); <a name="l01794"></a>01794 } <a name="l01795"></a>01795 <a name="l01796"></a>01796 <span class="keywordflow">return</span> result; <a name="l01797"></a>01797 } <a name="l01798"></a>01798 <a name="l01815"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a475432abc4756e6f30ef097d5cac02c9">01815</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a300272b3b799f09ca6cd5c541b19f07a" title="Draw rounded-corner rectangle with blending.">roundedRectangleRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l01816"></a>01816 { <a name="l01817"></a>01817 <span class="comment">/*</span> <a name="l01818"></a>01818 <span class="comment"> * Draw </span> <a name="l01819"></a>01819 <span class="comment"> */</span> <a name="l01820"></a>01820 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a830dd9dcfa39f4718aa2c269060326d0" title="Draw rounded-corner rectangle with blending.">roundedRectangleColor</a> <a name="l01821"></a>01821 (dst, x1, y1, x2, y2, rad, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l01822"></a>01822 } <a name="l01823"></a>01823 <a name="l01837"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a9f9be6e605e764fd23dd154fb12b80e9">01837</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a718c4f31d1e145106959c2a77d5fee9d" title="Draw rounded-corner box (filled rectangle) with blending.">roundedBoxColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color) <a name="l01838"></a>01838 { <a name="l01839"></a>01839 <span class="keywordtype">int</span> result; <a name="l01840"></a>01840 Sint16 w, h, tmp; <a name="l01841"></a>01841 Sint16 xx1, xx2, yy1, yy2; <a name="l01842"></a>01842 <a name="l01843"></a>01843 <span class="comment">/* </span> <a name="l01844"></a>01844 <span class="comment"> * Check destination surface </span> <a name="l01845"></a>01845 <span class="comment"> */</span> <a name="l01846"></a>01846 <span class="keywordflow">if</span> (dst == NULL) <a name="l01847"></a>01847 { <a name="l01848"></a>01848 <span class="keywordflow">return</span> -1; <a name="l01849"></a>01849 } <a name="l01850"></a>01850 <a name="l01851"></a>01851 <span class="comment">/*</span> <a name="l01852"></a>01852 <span class="comment"> * Check radius vor valid range</span> <a name="l01853"></a>01853 <span class="comment"> */</span> <a name="l01854"></a>01854 <span class="keywordflow">if</span> (rad &lt; 0) { <a name="l01855"></a>01855 <span class="keywordflow">return</span> -1; <a name="l01856"></a>01856 } <a name="l01857"></a>01857 <a name="l01858"></a>01858 <span class="comment">/*</span> <a name="l01859"></a>01859 <span class="comment"> * Special case - no rounding</span> <a name="l01860"></a>01860 <span class="comment"> */</span> <a name="l01861"></a>01861 <span class="keywordflow">if</span> (rad == 0) { <a name="l01862"></a>01862 <span class="keywordflow">return</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a6ab25c393f6e5f8d68ea3365f6ea98d2" title="Draw rectangle with blending.">rectangleColor</a>(dst, x1, y1, x2, y2, color); <a name="l01863"></a>01863 } <a name="l01864"></a>01864 <a name="l01865"></a>01865 <span class="comment">/*</span> <a name="l01866"></a>01866 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l01867"></a>01867 <span class="comment"> */</span> <a name="l01868"></a>01868 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l01869"></a>01869 <span class="keywordflow">return</span> 0; <a name="l01870"></a>01870 } <a name="l01871"></a>01871 <a name="l01872"></a>01872 <span class="comment">/*</span> <a name="l01873"></a>01873 <span class="comment"> * Test for special cases of straight lines or single point </span> <a name="l01874"></a>01874 <span class="comment"> */</span> <a name="l01875"></a>01875 <span class="keywordflow">if</span> (x1 == x2) { <a name="l01876"></a>01876 <span class="keywordflow">if</span> (y1 == y2) { <a name="l01877"></a>01877 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ae6f8690e5c5a85d3263c8e16727b34ef" title="Pixel draw with blending enabled if a&lt;255.">pixelColor</a>(dst, x1, y1, color)); <a name="l01878"></a>01878 } <span class="keywordflow">else</span> { <a name="l01879"></a>01879 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67" title="Draw vertical line with blending.">vlineColor</a>(dst, x1, y1, y2, color)); <a name="l01880"></a>01880 } <a name="l01881"></a>01881 } <span class="keywordflow">else</span> { <a name="l01882"></a>01882 <span class="keywordflow">if</span> (y1 == y2) { <a name="l01883"></a>01883 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, x1, x2, y1, color)); <a name="l01884"></a>01884 } <a name="l01885"></a>01885 } <a name="l01886"></a>01886 <a name="l01887"></a>01887 <span class="comment">/*</span> <a name="l01888"></a>01888 <span class="comment"> * Swap x1, x2 if required </span> <a name="l01889"></a>01889 <span class="comment"> */</span> <a name="l01890"></a>01890 <span class="keywordflow">if</span> (x1 &gt; x2) { <a name="l01891"></a>01891 tmp = x1; <a name="l01892"></a>01892 x1 = x2; <a name="l01893"></a>01893 x2 = tmp; <a name="l01894"></a>01894 } <a name="l01895"></a>01895 <a name="l01896"></a>01896 <span class="comment">/*</span> <a name="l01897"></a>01897 <span class="comment"> * Swap y1, y2 if required </span> <a name="l01898"></a>01898 <span class="comment"> */</span> <a name="l01899"></a>01899 <span class="keywordflow">if</span> (y1 &gt; y2) { <a name="l01900"></a>01900 tmp = y1; <a name="l01901"></a>01901 y1 = y2; <a name="l01902"></a>01902 y2 = tmp; <a name="l01903"></a>01903 } <a name="l01904"></a>01904 <a name="l01905"></a>01905 <span class="comment">/*</span> <a name="l01906"></a>01906 <span class="comment"> * Calculate width&amp;height </span> <a name="l01907"></a>01907 <span class="comment"> */</span> <a name="l01908"></a>01908 w = x2 - x1; <a name="l01909"></a>01909 h = y2 - y1; <a name="l01910"></a>01910 <a name="l01911"></a>01911 <span class="comment">/*</span> <a name="l01912"></a>01912 <span class="comment"> * Maybe adjust radius</span> <a name="l01913"></a>01913 <span class="comment"> */</span> <a name="l01914"></a>01914 <span class="keywordflow">if</span> ((rad * 2) &gt; w) <a name="l01915"></a>01915 { <a name="l01916"></a>01916 rad = w / 2; <a name="l01917"></a>01917 } <a name="l01918"></a>01918 <span class="keywordflow">if</span> ((rad * 2) &gt; h) <a name="l01919"></a>01919 { <a name="l01920"></a>01920 rad = h / 2; <a name="l01921"></a>01921 } <a name="l01922"></a>01922 <a name="l01923"></a>01923 <span class="comment">/*</span> <a name="l01924"></a>01924 <span class="comment"> * Draw corners</span> <a name="l01925"></a>01925 <span class="comment"> */</span> <a name="l01926"></a>01926 result = 0; <a name="l01927"></a>01927 xx1 = x1 + rad; <a name="l01928"></a>01928 xx2 = x2 - rad; <a name="l01929"></a>01929 yy1 = y1 + rad; <a name="l01930"></a>01930 yy2 = y2 - rad; <a name="l01931"></a>01931 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a2c30ee985b2513dc58d9b19d4e71562b" title="Draw filled pie with alpha blending.">filledPieColor</a>(dst, xx1, yy1, rad, 180, 270, color); <a name="l01932"></a>01932 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a2c30ee985b2513dc58d9b19d4e71562b" title="Draw filled pie with alpha blending.">filledPieColor</a>(dst, xx2, yy1, rad, 270, 360, color); <a name="l01933"></a>01933 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a2c30ee985b2513dc58d9b19d4e71562b" title="Draw filled pie with alpha blending.">filledPieColor</a>(dst, xx1, yy2, rad, 90, 180, color); <a name="l01934"></a>01934 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a2c30ee985b2513dc58d9b19d4e71562b" title="Draw filled pie with alpha blending.">filledPieColor</a>(dst, xx2, yy2, rad, 0, 90, color); <a name="l01935"></a>01935 <a name="l01936"></a>01936 <span class="comment">/*</span> <a name="l01937"></a>01937 <span class="comment"> * Draw body</span> <a name="l01938"></a>01938 <span class="comment"> */</span> <a name="l01939"></a>01939 xx1++; <a name="l01940"></a>01940 xx2--; <a name="l01941"></a>01941 yy1++; <a name="l01942"></a>01942 yy2--; <a name="l01943"></a>01943 <span class="keywordflow">if</span> (xx1 &lt;= xx2) { <a name="l01944"></a>01944 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a6bb30dfc32d0aee20271a0356a2e2fd0" title="Draw box (filled rectangle) with blending.">boxColor</a>(dst, xx1, y1, xx2, y2, color); <a name="l01945"></a>01945 } <a name="l01946"></a>01946 <span class="keywordflow">if</span> (yy1 &lt;= yy2) { <a name="l01947"></a>01947 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a6bb30dfc32d0aee20271a0356a2e2fd0" title="Draw box (filled rectangle) with blending.">boxColor</a>(dst, x1, yy1, xx1-1, yy2, color); <a name="l01948"></a>01948 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a6bb30dfc32d0aee20271a0356a2e2fd0" title="Draw box (filled rectangle) with blending.">boxColor</a>(dst, xx2+1, yy1, x2, yy2, color); <a name="l01949"></a>01949 } <a name="l01950"></a>01950 <a name="l01951"></a>01951 <span class="keywordflow">return</span> result; <a name="l01952"></a>01952 } <a name="l01953"></a>01953 <a name="l01970"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a7105b88e62fe42b26602d3b426547bc7">01970</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#aad706348fec18631d7bc48a2d91f5b4d" title="Draw rounded-corner box (filled rectangle) with blending.">roundedBoxRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, <a name="l01971"></a>01971 Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l01972"></a>01972 { <a name="l01973"></a>01973 <span class="comment">/*</span> <a name="l01974"></a>01974 <span class="comment"> * Draw </span> <a name="l01975"></a>01975 <span class="comment"> */</span> <a name="l01976"></a>01976 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a718c4f31d1e145106959c2a77d5fee9d" title="Draw rounded-corner box (filled rectangle) with blending.">roundedBoxColor</a> <a name="l01977"></a>01977 (dst, x1, y1, x2, y2, rad, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l01978"></a>01978 } <a name="l01979"></a>01979 <a name="l01980"></a>01980 <span class="comment">/* --------- Clipping routines for line */</span> <a name="l01981"></a>01981 <a name="l01982"></a>01982 <span class="comment">/* Clipping based heavily on code from */</span> <a name="l01983"></a>01983 <span class="comment">/* http://www.ncsa.uiuc.edu/Vis/Graphics/src/clipCohSuth.c */</span> <a name="l01984"></a>01984 <a name="l01985"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#ac7260a99c00538400ab4be67304ad36c">01985</a> <span class="preprocessor">#define CLIP_LEFT_EDGE 0x1</span> <a name="l01986"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#a0f5e2b2e79afa32c688c77f776a84308">01986</a> <span class="preprocessor"></span><span class="preprocessor">#define CLIP_RIGHT_EDGE 0x2</span> <a name="l01987"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#ae4fa529c5f9a39310b98769cdb007c2d">01987</a> <span class="preprocessor"></span><span class="preprocessor">#define CLIP_BOTTOM_EDGE 0x4</span> <a name="l01988"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#acd233fdea48722eb128c4c48f619a605">01988</a> <span class="preprocessor"></span><span class="preprocessor">#define CLIP_TOP_EDGE 0x8</span> <a name="l01989"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#a3f497d83ed5f593a5bc56c2ba7e13f5b">01989</a> <span class="preprocessor"></span><span class="preprocessor">#define CLIP_INSIDE(a) (!a)</span> <a name="l01990"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#ac1e60af8e37b6b372dcfd2d88299b662">01990</a> <span class="preprocessor"></span><span class="preprocessor">#define CLIP_REJECT(a,b) (a&amp;b)</span> <a name="l01991"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#a004c35133422cb574c41bb114d4592c6">01991</a> <span class="preprocessor"></span><span class="preprocessor">#define CLIP_ACCEPT(a,b) (!(a|b))</span> <a name="l01992"></a>01992 <span class="preprocessor"></span> <a name="l02005"></a>02005 <span class="keyword">static</span> <span class="keywordtype">int</span> _clipEncode(Sint16 x, Sint16 y, Sint16 left, Sint16 top, Sint16 right, Sint16 bottom) <a name="l02006"></a>02006 { <a name="l02007"></a>02007 <span class="keywordtype">int</span> code = 0; <a name="l02008"></a>02008 <a name="l02009"></a>02009 <span class="keywordflow">if</span> (x &lt; left) { <a name="l02010"></a>02010 code |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac7260a99c00538400ab4be67304ad36c">CLIP_LEFT_EDGE</a>; <a name="l02011"></a>02011 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (x &gt; right) { <a name="l02012"></a>02012 code |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a0f5e2b2e79afa32c688c77f776a84308">CLIP_RIGHT_EDGE</a>; <a name="l02013"></a>02013 } <a name="l02014"></a>02014 <span class="keywordflow">if</span> (y &lt; top) { <a name="l02015"></a>02015 code |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#acd233fdea48722eb128c4c48f619a605">CLIP_TOP_EDGE</a>; <a name="l02016"></a>02016 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (y &gt; bottom) { <a name="l02017"></a>02017 code |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae4fa529c5f9a39310b98769cdb007c2d">CLIP_BOTTOM_EDGE</a>; <a name="l02018"></a>02018 } <a name="l02019"></a>02019 <span class="keywordflow">return</span> code; <a name="l02020"></a>02020 } <a name="l02021"></a>02021 <a name="l02031"></a>02031 <span class="keyword">static</span> <span class="keywordtype">int</span> _clipLine(SDL_Surface * dst, Sint16 * x1, Sint16 * y1, Sint16 * x2, Sint16 * y2) <a name="l02032"></a>02032 { <a name="l02033"></a>02033 Sint16 left, right, top, bottom; <a name="l02034"></a>02034 <span class="keywordtype">int</span> code1, code2; <a name="l02035"></a>02035 <span class="keywordtype">int</span> draw = 0; <a name="l02036"></a>02036 Sint16 swaptmp; <a name="l02037"></a>02037 <span class="keywordtype">float</span> m; <a name="l02038"></a>02038 <a name="l02039"></a>02039 <span class="comment">/*</span> <a name="l02040"></a>02040 <span class="comment"> * Get clipping boundary </span> <a name="l02041"></a>02041 <span class="comment"> */</span> <a name="l02042"></a>02042 left = dst-&gt;clip_rect.x; <a name="l02043"></a>02043 right = dst-&gt;clip_rect.x + dst-&gt;clip_rect.w - 1; <a name="l02044"></a>02044 top = dst-&gt;clip_rect.y; <a name="l02045"></a>02045 bottom = dst-&gt;clip_rect.y + dst-&gt;clip_rect.h - 1; <a name="l02046"></a>02046 <a name="l02047"></a>02047 <span class="keywordflow">while</span> (1) { <a name="l02048"></a>02048 code1 = _clipEncode(*x1, *y1, left, top, right, bottom); <a name="l02049"></a>02049 code2 = _clipEncode(*x2, *y2, left, top, right, bottom); <a name="l02050"></a>02050 <span class="keywordflow">if</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a004c35133422cb574c41bb114d4592c6">CLIP_ACCEPT</a>(code1, code2)) { <a name="l02051"></a>02051 draw = 1; <a name="l02052"></a>02052 <span class="keywordflow">break</span>; <a name="l02053"></a>02053 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ac1e60af8e37b6b372dcfd2d88299b662">CLIP_REJECT</a>(code1, code2)) <a name="l02054"></a>02054 <span class="keywordflow">break</span>; <a name="l02055"></a>02055 <span class="keywordflow">else</span> { <a name="l02056"></a>02056 <span class="keywordflow">if</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a3f497d83ed5f593a5bc56c2ba7e13f5b">CLIP_INSIDE</a>(code1)) { <a name="l02057"></a>02057 swaptmp = *x2; <a name="l02058"></a>02058 *x2 = *x1; <a name="l02059"></a>02059 *x1 = swaptmp; <a name="l02060"></a>02060 swaptmp = *y2; <a name="l02061"></a>02061 *y2 = *y1; <a name="l02062"></a>02062 *y1 = swaptmp; <a name="l02063"></a>02063 swaptmp = code2; <a name="l02064"></a>02064 code2 = code1; <a name="l02065"></a>02065 code1 = swaptmp; <a name="l02066"></a>02066 } <a name="l02067"></a>02067 <span class="keywordflow">if</span> (*x2 != *x1) { <a name="l02068"></a>02068 m = (float)(*y2 - *y1) / (float)(*x2 - *x1); <a name="l02069"></a>02069 } <span class="keywordflow">else</span> { <a name="l02070"></a>02070 m = 1.0f; <a name="l02071"></a>02071 } <a name="l02072"></a>02072 <span class="keywordflow">if</span> (code1 &amp; <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac7260a99c00538400ab4be67304ad36c">CLIP_LEFT_EDGE</a>) { <a name="l02073"></a>02073 *y1 += (Sint16) ((left - *x1) * m); <a name="l02074"></a>02074 *x1 = left; <a name="l02075"></a>02075 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (code1 &amp; <a class="code" href="_s_d_l__gfx_primitives_8c.html#a0f5e2b2e79afa32c688c77f776a84308">CLIP_RIGHT_EDGE</a>) { <a name="l02076"></a>02076 *y1 += (Sint16) ((right - *x1) * m); <a name="l02077"></a>02077 *x1 = right; <a name="l02078"></a>02078 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (code1 &amp; <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae4fa529c5f9a39310b98769cdb007c2d">CLIP_BOTTOM_EDGE</a>) { <a name="l02079"></a>02079 <span class="keywordflow">if</span> (*x2 != *x1) { <a name="l02080"></a>02080 *x1 += (Sint16) ((bottom - *y1) / m); <a name="l02081"></a>02081 } <a name="l02082"></a>02082 *y1 = bottom; <a name="l02083"></a>02083 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (code1 &amp; <a class="code" href="_s_d_l__gfx_primitives_8c.html#acd233fdea48722eb128c4c48f619a605">CLIP_TOP_EDGE</a>) { <a name="l02084"></a>02084 <span class="keywordflow">if</span> (*x2 != *x1) { <a name="l02085"></a>02085 *x1 += (Sint16) ((top - *y1) / m); <a name="l02086"></a>02086 } <a name="l02087"></a>02087 *y1 = top; <a name="l02088"></a>02088 } <a name="l02089"></a>02089 } <a name="l02090"></a>02090 } <a name="l02091"></a>02091 <a name="l02092"></a>02092 <span class="keywordflow">return</span> draw; <a name="l02093"></a>02093 } <a name="l02094"></a>02094 <a name="l02107"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a16693489da67d6e65a28f9e5217b46f9">02107</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a6bb30dfc32d0aee20271a0356a2e2fd0" title="Draw box (filled rectangle) with blending.">boxColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color) <a name="l02108"></a>02108 { <a name="l02109"></a>02109 Sint16 left, right, top, bottom; <a name="l02110"></a>02110 Uint8 *pixel, *pixellast; <a name="l02111"></a>02111 <span class="keywordtype">int</span> x, dx; <a name="l02112"></a>02112 <span class="keywordtype">int</span> dy; <a name="l02113"></a>02113 <span class="keywordtype">int</span> pixx, pixy; <a name="l02114"></a>02114 Sint16 w, h, tmp; <a name="l02115"></a>02115 <span class="keywordtype">int</span> result; <a name="l02116"></a>02116 Uint8 *colorptr; <a name="l02117"></a>02117 <a name="l02118"></a>02118 <span class="comment">/*</span> <a name="l02119"></a>02119 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l02120"></a>02120 <span class="comment"> */</span> <a name="l02121"></a>02121 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l02122"></a>02122 <span class="keywordflow">return</span>(0); <a name="l02123"></a>02123 } <a name="l02124"></a>02124 <a name="l02125"></a>02125 <span class="comment">/*</span> <a name="l02126"></a>02126 <span class="comment"> * Order coordinates to ensure that</span> <a name="l02127"></a>02127 <span class="comment"> * x1&lt;=x2 and y1&lt;=y2 </span> <a name="l02128"></a>02128 <span class="comment"> */</span> <a name="l02129"></a>02129 <span class="keywordflow">if</span> (x1 &gt; x2) { <a name="l02130"></a>02130 tmp = x1; <a name="l02131"></a>02131 x1 = x2; <a name="l02132"></a>02132 x2 = tmp; <a name="l02133"></a>02133 } <a name="l02134"></a>02134 <span class="keywordflow">if</span> (y1 &gt; y2) { <a name="l02135"></a>02135 tmp = y1; <a name="l02136"></a>02136 y1 = y2; <a name="l02137"></a>02137 y2 = tmp; <a name="l02138"></a>02138 } <a name="l02139"></a>02139 <a name="l02140"></a>02140 <span class="comment">/* </span> <a name="l02141"></a>02141 <span class="comment"> * Get clipping boundary and </span> <a name="l02142"></a>02142 <span class="comment"> * check visibility </span> <a name="l02143"></a>02143 <span class="comment"> */</span> <a name="l02144"></a>02144 left = dst-&gt;clip_rect.x; <a name="l02145"></a>02145 <span class="keywordflow">if</span> (x2&lt;left) { <a name="l02146"></a>02146 <span class="keywordflow">return</span>(0); <a name="l02147"></a>02147 } <a name="l02148"></a>02148 right = dst-&gt;clip_rect.x + dst-&gt;clip_rect.w - 1; <a name="l02149"></a>02149 <span class="keywordflow">if</span> (x1&gt;right) { <a name="l02150"></a>02150 <span class="keywordflow">return</span>(0); <a name="l02151"></a>02151 } <a name="l02152"></a>02152 top = dst-&gt;clip_rect.y; <a name="l02153"></a>02153 <span class="keywordflow">if</span> (y2&lt;top) { <a name="l02154"></a>02154 <span class="keywordflow">return</span>(0); <a name="l02155"></a>02155 } <a name="l02156"></a>02156 bottom = dst-&gt;clip_rect.y + dst-&gt;clip_rect.h - 1; <a name="l02157"></a>02157 <span class="keywordflow">if</span> (y1&gt;bottom) { <a name="l02158"></a>02158 <span class="keywordflow">return</span>(0); <a name="l02159"></a>02159 } <a name="l02160"></a>02160 <a name="l02161"></a>02161 <span class="comment">/* Clip all points */</span> <a name="l02162"></a>02162 <span class="keywordflow">if</span> (x1&lt;left) { <a name="l02163"></a>02163 x1=left; <a name="l02164"></a>02164 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (x1&gt;right) { <a name="l02165"></a>02165 x1=right; <a name="l02166"></a>02166 } <a name="l02167"></a>02167 <span class="keywordflow">if</span> (x2&lt;left) { <a name="l02168"></a>02168 x2=left; <a name="l02169"></a>02169 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (x2&gt;right) { <a name="l02170"></a>02170 x2=right; <a name="l02171"></a>02171 } <a name="l02172"></a>02172 <span class="keywordflow">if</span> (y1&lt;top) { <a name="l02173"></a>02173 y1=top; <a name="l02174"></a>02174 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (y1&gt;bottom) { <a name="l02175"></a>02175 y1=bottom; <a name="l02176"></a>02176 } <a name="l02177"></a>02177 <span class="keywordflow">if</span> (y2&lt;top) { <a name="l02178"></a>02178 y2=top; <a name="l02179"></a>02179 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (y2&gt;bottom) { <a name="l02180"></a>02180 y2=bottom; <a name="l02181"></a>02181 } <a name="l02182"></a>02182 <a name="l02183"></a>02183 <span class="comment">/*</span> <a name="l02184"></a>02184 <span class="comment"> * Test for special cases of straight line or single point </span> <a name="l02185"></a>02185 <span class="comment"> */</span> <a name="l02186"></a>02186 <span class="keywordflow">if</span> (x1 == x2) { <a name="l02187"></a>02187 <span class="keywordflow">if</span> (y1 == y2) { <a name="l02188"></a>02188 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ae6f8690e5c5a85d3263c8e16727b34ef" title="Pixel draw with blending enabled if a&lt;255.">pixelColor</a>(dst, x1, y1, color)); <a name="l02189"></a>02189 } <span class="keywordflow">else</span> { <a name="l02190"></a>02190 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67" title="Draw vertical line with blending.">vlineColor</a>(dst, x1, y1, y2, color)); <a name="l02191"></a>02191 } <a name="l02192"></a>02192 } <a name="l02193"></a>02193 <span class="keywordflow">if</span> (y1 == y2) { <a name="l02194"></a>02194 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, x1, x2, y1, color)); <a name="l02195"></a>02195 } <a name="l02196"></a>02196 <a name="l02197"></a>02197 <span class="comment">/*</span> <a name="l02198"></a>02198 <span class="comment"> * Calculate width&amp;height </span> <a name="l02199"></a>02199 <span class="comment"> */</span> <a name="l02200"></a>02200 w = x2 - x1; <a name="l02201"></a>02201 h = y2 - y1; <a name="l02202"></a>02202 <a name="l02203"></a>02203 <span class="comment">/*</span> <a name="l02204"></a>02204 <span class="comment"> * Alpha check </span> <a name="l02205"></a>02205 <span class="comment"> */</span> <a name="l02206"></a>02206 <span class="keywordflow">if</span> ((color &amp; 255) == 255) { <a name="l02207"></a>02207 <a name="l02208"></a>02208 <span class="comment">/*</span> <a name="l02209"></a>02209 <span class="comment"> * No alpha-blending required </span> <a name="l02210"></a>02210 <span class="comment"> */</span> <a name="l02211"></a>02211 <a name="l02212"></a>02212 <span class="comment">/*</span> <a name="l02213"></a>02213 <span class="comment"> * Setup color </span> <a name="l02214"></a>02214 <span class="comment"> */</span> <a name="l02215"></a>02215 colorptr = (Uint8 *) &amp; color; <a name="l02216"></a>02216 <span class="keywordflow">if</span> (SDL_BYTEORDER == SDL_BIG_ENDIAN) { <a name="l02217"></a>02217 color = SDL_MapRGBA(dst-&gt;format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]); <a name="l02218"></a>02218 } <span class="keywordflow">else</span> { <a name="l02219"></a>02219 color = SDL_MapRGBA(dst-&gt;format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]); <a name="l02220"></a>02220 } <a name="l02221"></a>02221 <a name="l02222"></a>02222 <span class="comment">/*</span> <a name="l02223"></a>02223 <span class="comment"> * Lock the surface </span> <a name="l02224"></a>02224 <span class="comment"> */</span> <a name="l02225"></a>02225 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l02226"></a>02226 <span class="keywordflow">if</span> (SDL_LockSurface(dst) &lt; 0) { <a name="l02227"></a>02227 <span class="keywordflow">return</span> (-1); <a name="l02228"></a>02228 } <a name="l02229"></a>02229 } <a name="l02230"></a>02230 <a name="l02231"></a>02231 <span class="comment">/*</span> <a name="l02232"></a>02232 <span class="comment"> * More variable setup </span> <a name="l02233"></a>02233 <span class="comment"> */</span> <a name="l02234"></a>02234 dx = w; <a name="l02235"></a>02235 dy = h; <a name="l02236"></a>02236 pixx = dst-&gt;format-&gt;BytesPerPixel; <a name="l02237"></a>02237 pixy = dst-&gt;pitch; <a name="l02238"></a>02238 pixel = ((Uint8 *) dst-&gt;pixels) + pixx * (int) x1 + pixy * (<span class="keywordtype">int</span>) y1; <a name="l02239"></a>02239 pixellast = pixel + pixx * dx + pixy * dy; <a name="l02240"></a>02240 dx++; <a name="l02241"></a>02241 <a name="l02242"></a>02242 <span class="comment">/*</span> <a name="l02243"></a>02243 <span class="comment"> * Draw </span> <a name="l02244"></a>02244 <span class="comment"> */</span> <a name="l02245"></a>02245 <span class="keywordflow">switch</span> (dst-&gt;format-&gt;BytesPerPixel) { <a name="l02246"></a>02246 <span class="keywordflow">case</span> 1: <a name="l02247"></a>02247 <span class="keywordflow">for</span> (; pixel &lt;= pixellast; pixel += pixy) { <a name="l02248"></a>02248 memset(pixel, (Uint8) color, dx); <a name="l02249"></a>02249 } <a name="l02250"></a>02250 <span class="keywordflow">break</span>; <a name="l02251"></a>02251 <span class="keywordflow">case</span> 2: <a name="l02252"></a>02252 pixy -= (pixx * dx); <a name="l02253"></a>02253 <span class="keywordflow">for</span> (; pixel &lt;= pixellast; pixel += pixy) { <a name="l02254"></a>02254 <span class="keywordflow">for</span> (x = 0; x &lt; dx; x++) { <a name="l02255"></a>02255 *(Uint16*) pixel = color; <a name="l02256"></a>02256 pixel += pixx; <a name="l02257"></a>02257 } <a name="l02258"></a>02258 } <a name="l02259"></a>02259 <span class="keywordflow">break</span>; <a name="l02260"></a>02260 <span class="keywordflow">case</span> 3: <a name="l02261"></a>02261 pixy -= (pixx * dx); <a name="l02262"></a>02262 <span class="keywordflow">for</span> (; pixel &lt;= pixellast; pixel += pixy) { <a name="l02263"></a>02263 <span class="keywordflow">for</span> (x = 0; x &lt; dx; x++) { <a name="l02264"></a>02264 <span class="keywordflow">if</span> (SDL_BYTEORDER == SDL_BIG_ENDIAN) { <a name="l02265"></a>02265 pixel[0] = (color &gt;&gt; 16) &amp; 0xff; <a name="l02266"></a>02266 pixel[1] = (color &gt;&gt; 8) &amp; 0xff; <a name="l02267"></a>02267 pixel[2] = color &amp; 0xff; <a name="l02268"></a>02268 } <span class="keywordflow">else</span> { <a name="l02269"></a>02269 pixel[0] = color &amp; 0xff; <a name="l02270"></a>02270 pixel[1] = (color &gt;&gt; 8) &amp; 0xff; <a name="l02271"></a>02271 pixel[2] = (color &gt;&gt; 16) &amp; 0xff; <a name="l02272"></a>02272 } <a name="l02273"></a>02273 pixel += pixx; <a name="l02274"></a>02274 } <a name="l02275"></a>02275 } <a name="l02276"></a>02276 <span class="keywordflow">break</span>; <a name="l02277"></a>02277 <span class="keywordflow">default</span>: <span class="comment">/* case 4 */</span> <a name="l02278"></a>02278 pixy -= (pixx * dx); <a name="l02279"></a>02279 <span class="keywordflow">for</span> (; pixel &lt;= pixellast; pixel += pixy) { <a name="l02280"></a>02280 <span class="keywordflow">for</span> (x = 0; x &lt; dx; x++) { <a name="l02281"></a>02281 *(Uint32 *) pixel = color; <a name="l02282"></a>02282 pixel += pixx; <a name="l02283"></a>02283 } <a name="l02284"></a>02284 } <a name="l02285"></a>02285 <span class="keywordflow">break</span>; <a name="l02286"></a>02286 } <a name="l02287"></a>02287 <a name="l02288"></a>02288 <span class="comment">/* Unlock surface */</span> <a name="l02289"></a>02289 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l02290"></a>02290 SDL_UnlockSurface(dst); <a name="l02291"></a>02291 } <a name="l02292"></a>02292 <a name="l02293"></a>02293 result = 0; <a name="l02294"></a>02294 <a name="l02295"></a>02295 } <span class="keywordflow">else</span> { <a name="l02296"></a>02296 <a name="l02297"></a>02297 result = <a class="code" href="_s_d_l__gfx_primitives_8c.html#ace9f2505c12c5dacc778509991cd3716" title="Draw filled rectangle of RGBA color with alpha blending.">filledRectAlpha</a>(dst, x1, y1, x1 + w, y1 + h, color); <a name="l02298"></a>02298 <a name="l02299"></a>02299 } <a name="l02300"></a>02300 <a name="l02301"></a>02301 <span class="keywordflow">return</span> (result); <a name="l02302"></a>02302 } <a name="l02303"></a>02303 <a name="l02319"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a0ae084c90bd9b734356ad723d45973c8">02319</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a1864b3062793a7f7dd81aaf8c8abd6b0" title="Draw box (filled rectangle) with blending.">boxRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l02320"></a>02320 { <a name="l02321"></a>02321 <span class="comment">/*</span> <a name="l02322"></a>02322 <span class="comment"> * Draw </span> <a name="l02323"></a>02323 <span class="comment"> */</span> <a name="l02324"></a>02324 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a6bb30dfc32d0aee20271a0356a2e2fd0" title="Draw box (filled rectangle) with blending.">boxColor</a>(dst, x1, y1, x2, y2, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l02325"></a>02325 } <a name="l02326"></a>02326 <a name="l02327"></a>02327 <span class="comment">/* ----- Line */</span> <a name="l02328"></a>02328 <a name="l02329"></a>02329 <span class="comment">/* Non-alpha line drawing code adapted from routine */</span> <a name="l02330"></a>02330 <span class="comment">/* by Pete Shinners, pete@shinners.org */</span> <a name="l02331"></a>02331 <span class="comment">/* Originally from pygame, http://pygame.seul.org */</span> <a name="l02332"></a>02332 <a name="l02333"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#ae2f08dc603ae93c402abd918ba4e23e1">02333</a> <span class="preprocessor">#define ABS(a) (((a)&lt;0) ? -(a) : (a))</span> <a name="l02334"></a>02334 <span class="preprocessor"></span> <a name="l02347"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a6f37058aed308619de8109ebe84b5fe9">02347</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#ad44c550fab3cb736eb049713ede94052" title="Draw line with alpha blending.">lineColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color) <a name="l02348"></a>02348 { <a name="l02349"></a>02349 <span class="keywordtype">int</span> pixx, pixy; <a name="l02350"></a>02350 <span class="keywordtype">int</span> x, y; <a name="l02351"></a>02351 <span class="keywordtype">int</span> dx, dy; <a name="l02352"></a>02352 <span class="keywordtype">int</span> ax, ay; <a name="l02353"></a>02353 <span class="keywordtype">int</span> sx, sy; <a name="l02354"></a>02354 <span class="keywordtype">int</span> swaptmp; <a name="l02355"></a>02355 Uint8 *pixel; <a name="l02356"></a>02356 Uint8 *colorptr; <a name="l02357"></a>02357 <a name="l02358"></a>02358 <span class="comment">/*</span> <a name="l02359"></a>02359 <span class="comment"> * Clip line and test if we have to draw </span> <a name="l02360"></a>02360 <span class="comment"> */</span> <a name="l02361"></a>02361 <span class="keywordflow">if</span> (!(_clipLine(dst, &amp;x1, &amp;y1, &amp;x2, &amp;y2))) { <a name="l02362"></a>02362 <span class="keywordflow">return</span> (0); <a name="l02363"></a>02363 } <a name="l02364"></a>02364 <a name="l02365"></a>02365 <span class="comment">/*</span> <a name="l02366"></a>02366 <span class="comment"> * Test for special cases of straight lines or single point </span> <a name="l02367"></a>02367 <span class="comment"> */</span> <a name="l02368"></a>02368 <span class="keywordflow">if</span> (x1 == x2) { <a name="l02369"></a>02369 <span class="keywordflow">if</span> (y1 &lt; y2) { <a name="l02370"></a>02370 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67" title="Draw vertical line with blending.">vlineColor</a>(dst, x1, y1, y2, color)); <a name="l02371"></a>02371 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (y1 &gt; y2) { <a name="l02372"></a>02372 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67" title="Draw vertical line with blending.">vlineColor</a>(dst, x1, y2, y1, color)); <a name="l02373"></a>02373 } <span class="keywordflow">else</span> { <a name="l02374"></a>02374 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ae6f8690e5c5a85d3263c8e16727b34ef" title="Pixel draw with blending enabled if a&lt;255.">pixelColor</a>(dst, x1, y1, color)); <a name="l02375"></a>02375 } <a name="l02376"></a>02376 } <a name="l02377"></a>02377 <span class="keywordflow">if</span> (y1 == y2) { <a name="l02378"></a>02378 <span class="keywordflow">if</span> (x1 &lt; x2) { <a name="l02379"></a>02379 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, x1, x2, y1, color)); <a name="l02380"></a>02380 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (x1 &gt; x2) { <a name="l02381"></a>02381 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, x2, x1, y1, color)); <a name="l02382"></a>02382 } <a name="l02383"></a>02383 } <a name="l02384"></a>02384 <a name="l02385"></a>02385 <span class="comment">/*</span> <a name="l02386"></a>02386 <span class="comment"> * Variable setup </span> <a name="l02387"></a>02387 <span class="comment"> */</span> <a name="l02388"></a>02388 dx = x2 - x1; <a name="l02389"></a>02389 dy = y2 - y1; <a name="l02390"></a>02390 sx = (dx &gt;= 0) ? 1 : -1; <a name="l02391"></a>02391 sy = (dy &gt;= 0) ? 1 : -1; <a name="l02392"></a>02392 <a name="l02393"></a>02393 <span class="comment">/* Lock surface */</span> <a name="l02394"></a>02394 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l02395"></a>02395 <span class="keywordflow">if</span> (SDL_LockSurface(dst) &lt; 0) { <a name="l02396"></a>02396 <span class="keywordflow">return</span> (-1); <a name="l02397"></a>02397 } <a name="l02398"></a>02398 } <a name="l02399"></a>02399 <a name="l02400"></a>02400 <span class="comment">/*</span> <a name="l02401"></a>02401 <span class="comment"> * Check for alpha blending </span> <a name="l02402"></a>02402 <span class="comment"> */</span> <a name="l02403"></a>02403 <span class="keywordflow">if</span> ((color &amp; 255) == 255) { <a name="l02404"></a>02404 <a name="l02405"></a>02405 <span class="comment">/*</span> <a name="l02406"></a>02406 <span class="comment"> * No alpha blending - use fast pixel routines </span> <a name="l02407"></a>02407 <span class="comment"> */</span> <a name="l02408"></a>02408 <a name="l02409"></a>02409 <span class="comment">/*</span> <a name="l02410"></a>02410 <span class="comment"> * Setup color </span> <a name="l02411"></a>02411 <span class="comment"> */</span> <a name="l02412"></a>02412 colorptr = (Uint8 *) &amp; color; <a name="l02413"></a>02413 <span class="keywordflow">if</span> (SDL_BYTEORDER == SDL_BIG_ENDIAN) { <a name="l02414"></a>02414 color = SDL_MapRGBA(dst-&gt;format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]); <a name="l02415"></a>02415 } <span class="keywordflow">else</span> { <a name="l02416"></a>02416 color = SDL_MapRGBA(dst-&gt;format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]); <a name="l02417"></a>02417 } <a name="l02418"></a>02418 <a name="l02419"></a>02419 <span class="comment">/*</span> <a name="l02420"></a>02420 <span class="comment"> * More variable setup </span> <a name="l02421"></a>02421 <span class="comment"> */</span> <a name="l02422"></a>02422 dx = sx * dx + 1; <a name="l02423"></a>02423 dy = sy * dy + 1; <a name="l02424"></a>02424 pixx = dst-&gt;format-&gt;BytesPerPixel; <a name="l02425"></a>02425 pixy = dst-&gt;pitch; <a name="l02426"></a>02426 pixel = ((Uint8 *) dst-&gt;pixels) + pixx * (int) x1 + pixy * (<span class="keywordtype">int</span>) y1; <a name="l02427"></a>02427 pixx *= sx; <a name="l02428"></a>02428 pixy *= sy; <a name="l02429"></a>02429 <span class="keywordflow">if</span> (dx &lt; dy) { <a name="l02430"></a>02430 swaptmp = dx; <a name="l02431"></a>02431 dx = dy; <a name="l02432"></a>02432 dy = swaptmp; <a name="l02433"></a>02433 swaptmp = pixx; <a name="l02434"></a>02434 pixx = pixy; <a name="l02435"></a>02435 pixy = swaptmp; <a name="l02436"></a>02436 } <a name="l02437"></a>02437 <a name="l02438"></a>02438 <span class="comment">/*</span> <a name="l02439"></a>02439 <span class="comment"> * Draw </span> <a name="l02440"></a>02440 <span class="comment"> */</span> <a name="l02441"></a>02441 x = 0; <a name="l02442"></a>02442 y = 0; <a name="l02443"></a>02443 <span class="keywordflow">switch</span> (dst-&gt;format-&gt;BytesPerPixel) { <a name="l02444"></a>02444 <span class="keywordflow">case</span> 1: <a name="l02445"></a>02445 <span class="keywordflow">for</span> (; x &lt; dx; x++, pixel += pixx) { <a name="l02446"></a>02446 *pixel = color; <a name="l02447"></a>02447 y += dy; <a name="l02448"></a>02448 <span class="keywordflow">if</span> (y &gt;= dx) { <a name="l02449"></a>02449 y -= dx; <a name="l02450"></a>02450 pixel += pixy; <a name="l02451"></a>02451 } <a name="l02452"></a>02452 } <a name="l02453"></a>02453 <span class="keywordflow">break</span>; <a name="l02454"></a>02454 <span class="keywordflow">case</span> 2: <a name="l02455"></a>02455 <span class="keywordflow">for</span> (; x &lt; dx; x++, pixel += pixx) { <a name="l02456"></a>02456 *(Uint16 *) pixel = color; <a name="l02457"></a>02457 y += dy; <a name="l02458"></a>02458 <span class="keywordflow">if</span> (y &gt;= dx) { <a name="l02459"></a>02459 y -= dx; <a name="l02460"></a>02460 pixel += pixy; <a name="l02461"></a>02461 } <a name="l02462"></a>02462 } <a name="l02463"></a>02463 <span class="keywordflow">break</span>; <a name="l02464"></a>02464 <span class="keywordflow">case</span> 3: <a name="l02465"></a>02465 <span class="keywordflow">for</span> (; x &lt; dx; x++, pixel += pixx) { <a name="l02466"></a>02466 <span class="keywordflow">if</span> (SDL_BYTEORDER == SDL_BIG_ENDIAN) { <a name="l02467"></a>02467 pixel[0] = (color &gt;&gt; 16) &amp; 0xff; <a name="l02468"></a>02468 pixel[1] = (color &gt;&gt; 8) &amp; 0xff; <a name="l02469"></a>02469 pixel[2] = color &amp; 0xff; <a name="l02470"></a>02470 } <span class="keywordflow">else</span> { <a name="l02471"></a>02471 pixel[0] = color &amp; 0xff; <a name="l02472"></a>02472 pixel[1] = (color &gt;&gt; 8) &amp; 0xff; <a name="l02473"></a>02473 pixel[2] = (color &gt;&gt; 16) &amp; 0xff; <a name="l02474"></a>02474 } <a name="l02475"></a>02475 y += dy; <a name="l02476"></a>02476 <span class="keywordflow">if</span> (y &gt;= dx) { <a name="l02477"></a>02477 y -= dx; <a name="l02478"></a>02478 pixel += pixy; <a name="l02479"></a>02479 } <a name="l02480"></a>02480 } <a name="l02481"></a>02481 <span class="keywordflow">break</span>; <a name="l02482"></a>02482 <span class="keywordflow">default</span>: <span class="comment">/* case 4 */</span> <a name="l02483"></a>02483 <span class="keywordflow">for</span> (; x &lt; dx; x++, pixel += pixx) { <a name="l02484"></a>02484 *(Uint32 *) pixel = color; <a name="l02485"></a>02485 y += dy; <a name="l02486"></a>02486 <span class="keywordflow">if</span> (y &gt;= dx) { <a name="l02487"></a>02487 y -= dx; <a name="l02488"></a>02488 pixel += pixy; <a name="l02489"></a>02489 } <a name="l02490"></a>02490 } <a name="l02491"></a>02491 <span class="keywordflow">break</span>; <a name="l02492"></a>02492 } <a name="l02493"></a>02493 <a name="l02494"></a>02494 } <span class="keywordflow">else</span> { <a name="l02495"></a>02495 <a name="l02496"></a>02496 <span class="comment">/*</span> <a name="l02497"></a>02497 <span class="comment"> * Alpha blending required - use single-pixel blits </span> <a name="l02498"></a>02498 <span class="comment"> */</span> <a name="l02499"></a>02499 <a name="l02500"></a>02500 ax = <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae2f08dc603ae93c402abd918ba4e23e1">ABS</a>(dx) &lt;&lt; 1; <a name="l02501"></a>02501 ay = <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae2f08dc603ae93c402abd918ba4e23e1">ABS</a>(dy) &lt;&lt; 1; <a name="l02502"></a>02502 x = x1; <a name="l02503"></a>02503 y = y1; <a name="l02504"></a>02504 <span class="keywordflow">if</span> (ax &gt; ay) { <a name="l02505"></a>02505 <span class="keywordtype">int</span> d = ay - (ax &gt;&gt; 1); <a name="l02506"></a>02506 <a name="l02507"></a>02507 <span class="keywordflow">while</span> (x != x2) { <a name="l02508"></a>02508 <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, x, y, color); <a name="l02509"></a>02509 <span class="keywordflow">if</span> (d &gt; 0 || (d == 0 &amp;&amp; sx == 1)) { <a name="l02510"></a>02510 y += sy; <a name="l02511"></a>02511 d -= ax; <a name="l02512"></a>02512 } <a name="l02513"></a>02513 x += sx; <a name="l02514"></a>02514 d += ay; <a name="l02515"></a>02515 } <a name="l02516"></a>02516 } <span class="keywordflow">else</span> { <a name="l02517"></a>02517 <span class="keywordtype">int</span> d = ax - (ay &gt;&gt; 1); <a name="l02518"></a>02518 <a name="l02519"></a>02519 <span class="keywordflow">while</span> (y != y2) { <a name="l02520"></a>02520 <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, x, y, color); <a name="l02521"></a>02521 <span class="keywordflow">if</span> (d &gt; 0 || ((d == 0) &amp;&amp; (sy == 1))) { <a name="l02522"></a>02522 x += sx; <a name="l02523"></a>02523 d -= ay; <a name="l02524"></a>02524 } <a name="l02525"></a>02525 y += sy; <a name="l02526"></a>02526 d += ax; <a name="l02527"></a>02527 } <a name="l02528"></a>02528 } <a name="l02529"></a>02529 <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, x, y, color); <a name="l02530"></a>02530 <a name="l02531"></a>02531 } <a name="l02532"></a>02532 <a name="l02533"></a>02533 <span class="comment">/* Unlock surface */</span> <a name="l02534"></a>02534 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l02535"></a>02535 SDL_UnlockSurface(dst); <a name="l02536"></a>02536 } <a name="l02537"></a>02537 <a name="l02538"></a>02538 <span class="keywordflow">return</span> (0); <a name="l02539"></a>02539 } <a name="l02540"></a>02540 <a name="l02556"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a5e4bd13b12d34698fbcb2dc9d3a0e9f3">02556</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a760139e11a9ae5defeb755ca0c794f5f" title="Draw line with alpha blending.">lineRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l02557"></a>02557 { <a name="l02558"></a>02558 <span class="comment">/*</span> <a name="l02559"></a>02559 <span class="comment"> * Draw </span> <a name="l02560"></a>02560 <span class="comment"> */</span> <a name="l02561"></a>02561 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ad44c550fab3cb736eb049713ede94052" title="Draw line with alpha blending.">lineColor</a>(dst, x1, y1, x2, y2, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l02562"></a>02562 } <a name="l02563"></a>02563 <a name="l02564"></a>02564 <span class="comment">/* AA Line */</span> <a name="l02565"></a>02565 <a name="l02566"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#a519bc2d4d753c51da1b956d6c200bff1">02566</a> <span class="preprocessor">#define AAlevels 256</span> <a name="l02567"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#a2e16571bedf7a97c6fc02d86b48994eb">02567</a> <span class="preprocessor"></span><span class="preprocessor">#define AAbits 8</span> <a name="l02568"></a>02568 <span class="preprocessor"></span> <a name="l02589"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#a41cb32b84aee2742fabd5bbaced8e016">02589</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a41cb32b84aee2742fabd5bbaced8e016" title="Internal function to draw anti-aliased line with alpha blending and endpoint control.">_aalineColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color, <span class="keywordtype">int</span> draw_endpoint) <a name="l02590"></a>02590 { <a name="l02591"></a>02591 Sint32 xx0, yy0, xx1, yy1; <a name="l02592"></a>02592 <span class="keywordtype">int</span> result; <a name="l02593"></a>02593 Uint32 intshift, erracc, erradj; <a name="l02594"></a>02594 Uint32 erracctmp, wgt, wgtcompmask; <a name="l02595"></a>02595 <span class="keywordtype">int</span> dx, dy, tmp, xdir, y0p1, x0pxdir; <a name="l02596"></a>02596 <a name="l02597"></a>02597 <span class="comment">/*</span> <a name="l02598"></a>02598 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l02599"></a>02599 <span class="comment"> */</span> <a name="l02600"></a>02600 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l02601"></a>02601 <span class="keywordflow">return</span>(0); <a name="l02602"></a>02602 } <a name="l02603"></a>02603 <a name="l02604"></a>02604 <span class="comment">/*</span> <a name="l02605"></a>02605 <span class="comment"> * Clip line and test if we have to draw </span> <a name="l02606"></a>02606 <span class="comment"> */</span> <a name="l02607"></a>02607 <span class="keywordflow">if</span> (!(_clipLine(dst, &amp;x1, &amp;y1, &amp;x2, &amp;y2))) { <a name="l02608"></a>02608 <span class="keywordflow">return</span> (0); <a name="l02609"></a>02609 } <a name="l02610"></a>02610 <a name="l02611"></a>02611 <span class="comment">/*</span> <a name="l02612"></a>02612 <span class="comment"> * Keep on working with 32bit numbers </span> <a name="l02613"></a>02613 <span class="comment"> */</span> <a name="l02614"></a>02614 xx0 = x1; <a name="l02615"></a>02615 yy0 = y1; <a name="l02616"></a>02616 xx1 = x2; <a name="l02617"></a>02617 yy1 = y2; <a name="l02618"></a>02618 <a name="l02619"></a>02619 <span class="comment">/*</span> <a name="l02620"></a>02620 <span class="comment"> * Reorder points if required </span> <a name="l02621"></a>02621 <span class="comment"> */</span> <a name="l02622"></a>02622 <span class="keywordflow">if</span> (yy0 &gt; yy1) { <a name="l02623"></a>02623 tmp = yy0; <a name="l02624"></a>02624 yy0 = yy1; <a name="l02625"></a>02625 yy1 = tmp; <a name="l02626"></a>02626 tmp = xx0; <a name="l02627"></a>02627 xx0 = xx1; <a name="l02628"></a>02628 xx1 = tmp; <a name="l02629"></a>02629 } <a name="l02630"></a>02630 <a name="l02631"></a>02631 <span class="comment">/*</span> <a name="l02632"></a>02632 <span class="comment"> * Calculate distance </span> <a name="l02633"></a>02633 <span class="comment"> */</span> <a name="l02634"></a>02634 dx = xx1 - xx0; <a name="l02635"></a>02635 dy = yy1 - yy0; <a name="l02636"></a>02636 <a name="l02637"></a>02637 <span class="comment">/*</span> <a name="l02638"></a>02638 <span class="comment"> * Check for special cases </span> <a name="l02639"></a>02639 <span class="comment"> */</span> <a name="l02640"></a>02640 <span class="keywordflow">if</span> (dx == 0) { <a name="l02641"></a>02641 <span class="comment">/*</span> <a name="l02642"></a>02642 <span class="comment"> * Vertical line </span> <a name="l02643"></a>02643 <span class="comment"> */</span> <a name="l02644"></a>02644 <span class="keywordflow">if</span> (draw_endpoint) <a name="l02645"></a>02645 { <a name="l02646"></a>02646 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67" title="Draw vertical line with blending.">vlineColor</a>(dst, x1, y1, y2, color)); <a name="l02647"></a>02647 } <span class="keywordflow">else</span> { <a name="l02648"></a>02648 <span class="keywordflow">if</span> (dy&gt;0) { <a name="l02649"></a>02649 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67" title="Draw vertical line with blending.">vlineColor</a>(dst, x1, yy0, yy0+dy, color)); <a name="l02650"></a>02650 } <span class="keywordflow">else</span> { <a name="l02651"></a>02651 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ae6f8690e5c5a85d3263c8e16727b34ef" title="Pixel draw with blending enabled if a&lt;255.">pixelColor</a>(dst, x1, y1, color)); <a name="l02652"></a>02652 } <a name="l02653"></a>02653 } <a name="l02654"></a>02654 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dy == 0) { <a name="l02655"></a>02655 <span class="comment">/*</span> <a name="l02656"></a>02656 <span class="comment"> * Horizontal line </span> <a name="l02657"></a>02657 <span class="comment"> */</span> <a name="l02658"></a>02658 <span class="keywordflow">if</span> (draw_endpoint) <a name="l02659"></a>02659 { <a name="l02660"></a>02660 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, x1, x2, y1, color)); <a name="l02661"></a>02661 } <span class="keywordflow">else</span> { <a name="l02662"></a>02662 <span class="keywordflow">if</span> (dx!=0) { <a name="l02663"></a>02663 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xx0, xx0+dx, y1, color)); <a name="l02664"></a>02664 } <span class="keywordflow">else</span> { <a name="l02665"></a>02665 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ae6f8690e5c5a85d3263c8e16727b34ef" title="Pixel draw with blending enabled if a&lt;255.">pixelColor</a>(dst, x1, y1, color)); <a name="l02666"></a>02666 } <a name="l02667"></a>02667 } <a name="l02668"></a>02668 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((dx == dy) &amp;&amp; (draw_endpoint)) { <a name="l02669"></a>02669 <span class="comment">/*</span> <a name="l02670"></a>02670 <span class="comment"> * Diagonal line (with endpoint)</span> <a name="l02671"></a>02671 <span class="comment"> */</span> <a name="l02672"></a>02672 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ad44c550fab3cb736eb049713ede94052" title="Draw line with alpha blending.">lineColor</a>(dst, x1, y1, x2, y2, color)); <a name="l02673"></a>02673 } <a name="l02674"></a>02674 <a name="l02675"></a>02675 <span class="comment">/*</span> <a name="l02676"></a>02676 <span class="comment"> * Adjust for negative dx and set xdir </span> <a name="l02677"></a>02677 <span class="comment"> */</span> <a name="l02678"></a>02678 <span class="keywordflow">if</span> (dx &gt;= 0) { <a name="l02679"></a>02679 xdir = 1; <a name="l02680"></a>02680 } <span class="keywordflow">else</span> { <a name="l02681"></a>02681 xdir = -1; <a name="l02682"></a>02682 dx = (-dx); <a name="l02683"></a>02683 } <a name="l02684"></a>02684 <a name="l02685"></a>02685 <span class="comment">/*</span> <a name="l02686"></a>02686 <span class="comment"> * Line is not horizontal, vertical or diagonal (with endpoint)</span> <a name="l02687"></a>02687 <span class="comment"> */</span> <a name="l02688"></a>02688 result = 0; <a name="l02689"></a>02689 <a name="l02690"></a>02690 <span class="comment">/*</span> <a name="l02691"></a>02691 <span class="comment"> * Zero accumulator </span> <a name="l02692"></a>02692 <span class="comment"> */</span> <a name="l02693"></a>02693 erracc = 0; <a name="l02694"></a>02694 <a name="l02695"></a>02695 <span class="comment">/*</span> <a name="l02696"></a>02696 <span class="comment"> * # of bits by which to shift erracc to get intensity level </span> <a name="l02697"></a>02697 <span class="comment"> */</span> <a name="l02698"></a>02698 intshift = 32 - <a class="code" href="_s_d_l__gfx_primitives_8c.html#a2e16571bedf7a97c6fc02d86b48994eb">AAbits</a>; <a name="l02699"></a>02699 <a name="l02700"></a>02700 <span class="comment">/*</span> <a name="l02701"></a>02701 <span class="comment"> * Mask used to flip all bits in an intensity weighting </span> <a name="l02702"></a>02702 <span class="comment"> */</span> <a name="l02703"></a>02703 wgtcompmask = <a class="code" href="_s_d_l__gfx_primitives_8c.html#a519bc2d4d753c51da1b956d6c200bff1">AAlevels</a> - 1; <a name="l02704"></a>02704 <a name="l02705"></a>02705 <span class="comment">/* Lock surface */</span> <a name="l02706"></a>02706 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l02707"></a>02707 <span class="keywordflow">if</span> (SDL_LockSurface(dst) &lt; 0) { <a name="l02708"></a>02708 <span class="keywordflow">return</span> (-1); <a name="l02709"></a>02709 } <a name="l02710"></a>02710 } <a name="l02711"></a>02711 <a name="l02712"></a>02712 <span class="comment">/*</span> <a name="l02713"></a>02713 <span class="comment"> * Draw the initial pixel in the foreground color </span> <a name="l02714"></a>02714 <span class="comment"> */</span> <a name="l02715"></a>02715 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(dst, x1, y1, color); <a name="l02716"></a>02716 <a name="l02717"></a>02717 <span class="comment">/*</span> <a name="l02718"></a>02718 <span class="comment"> * x-major or y-major? </span> <a name="l02719"></a>02719 <span class="comment"> */</span> <a name="l02720"></a>02720 <span class="keywordflow">if</span> (dy &gt; dx) { <a name="l02721"></a>02721 <a name="l02722"></a>02722 <span class="comment">/*</span> <a name="l02723"></a>02723 <span class="comment"> * y-major. Calculate 16-bit fixed point fractional part of a pixel that</span> <a name="l02724"></a>02724 <span class="comment"> * X advances every time Y advances 1 pixel, truncating the result so that</span> <a name="l02725"></a>02725 <span class="comment"> * we won&#39;t overrun the endpoint along the X axis </span> <a name="l02726"></a>02726 <span class="comment"> */</span> <a name="l02727"></a>02727 <span class="comment">/*</span> <a name="l02728"></a>02728 <span class="comment"> * Not-so-portable version: erradj = ((Uint64)dx &lt;&lt; 32) / (Uint64)dy; </span> <a name="l02729"></a>02729 <span class="comment"> */</span> <a name="l02730"></a>02730 erradj = ((dx &lt;&lt; 16) / dy) &lt;&lt; 16; <a name="l02731"></a>02731 <a name="l02732"></a>02732 <span class="comment">/*</span> <a name="l02733"></a>02733 <span class="comment"> * draw all pixels other than the first and last </span> <a name="l02734"></a>02734 <span class="comment"> */</span> <a name="l02735"></a>02735 x0pxdir = xx0 + xdir; <a name="l02736"></a>02736 <span class="keywordflow">while</span> (--dy) { <a name="l02737"></a>02737 erracctmp = erracc; <a name="l02738"></a>02738 erracc += erradj; <a name="l02739"></a>02739 <span class="keywordflow">if</span> (erracc &lt;= erracctmp) { <a name="l02740"></a>02740 <span class="comment">/*</span> <a name="l02741"></a>02741 <span class="comment"> * rollover in error accumulator, x coord advances </span> <a name="l02742"></a>02742 <span class="comment"> */</span> <a name="l02743"></a>02743 xx0 = x0pxdir; <a name="l02744"></a>02744 x0pxdir += xdir; <a name="l02745"></a>02745 } <a name="l02746"></a>02746 yy0++; <span class="comment">/* y-major so always advance Y */</span> <a name="l02747"></a>02747 <a name="l02748"></a>02748 <span class="comment">/*</span> <a name="l02749"></a>02749 <span class="comment"> * the AAbits most significant bits of erracc give us the intensity</span> <a name="l02750"></a>02750 <span class="comment"> * weighting for this pixel, and the complement of the weighting for</span> <a name="l02751"></a>02751 <span class="comment"> * the paired pixel. </span> <a name="l02752"></a>02752 <span class="comment"> */</span> <a name="l02753"></a>02753 wgt = (erracc &gt;&gt; intshift) &amp; 255; <a name="l02754"></a>02754 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a> (dst, xx0, yy0, color, 255 - wgt); <a name="l02755"></a>02755 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a> (dst, x0pxdir, yy0, color, wgt); <a name="l02756"></a>02756 } <a name="l02757"></a>02757 <a name="l02758"></a>02758 } <span class="keywordflow">else</span> { <a name="l02759"></a>02759 <a name="l02760"></a>02760 <span class="comment">/*</span> <a name="l02761"></a>02761 <span class="comment"> * x-major line. Calculate 16-bit fixed-point fractional part of a pixel</span> <a name="l02762"></a>02762 <span class="comment"> * that Y advances each time X advances 1 pixel, truncating the result so</span> <a name="l02763"></a>02763 <span class="comment"> * that we won&#39;t overrun the endpoint along the X axis. </span> <a name="l02764"></a>02764 <span class="comment"> */</span> <a name="l02765"></a>02765 <span class="comment">/*</span> <a name="l02766"></a>02766 <span class="comment"> * Not-so-portable version: erradj = ((Uint64)dy &lt;&lt; 32) / (Uint64)dx; </span> <a name="l02767"></a>02767 <span class="comment"> */</span> <a name="l02768"></a>02768 erradj = ((dy &lt;&lt; 16) / dx) &lt;&lt; 16; <a name="l02769"></a>02769 <a name="l02770"></a>02770 <span class="comment">/*</span> <a name="l02771"></a>02771 <span class="comment"> * draw all pixels other than the first and last </span> <a name="l02772"></a>02772 <span class="comment"> */</span> <a name="l02773"></a>02773 y0p1 = yy0 + 1; <a name="l02774"></a>02774 <span class="keywordflow">while</span> (--dx) { <a name="l02775"></a>02775 <a name="l02776"></a>02776 erracctmp = erracc; <a name="l02777"></a>02777 erracc += erradj; <a name="l02778"></a>02778 <span class="keywordflow">if</span> (erracc &lt;= erracctmp) { <a name="l02779"></a>02779 <span class="comment">/*</span> <a name="l02780"></a>02780 <span class="comment"> * Accumulator turned over, advance y </span> <a name="l02781"></a>02781 <span class="comment"> */</span> <a name="l02782"></a>02782 yy0 = y0p1; <a name="l02783"></a>02783 y0p1++; <a name="l02784"></a>02784 } <a name="l02785"></a>02785 xx0 += xdir; <span class="comment">/* x-major so always advance X */</span> <a name="l02786"></a>02786 <span class="comment">/*</span> <a name="l02787"></a>02787 <span class="comment"> * the AAbits most significant bits of erracc give us the intensity</span> <a name="l02788"></a>02788 <span class="comment"> * weighting for this pixel, and the complement of the weighting for</span> <a name="l02789"></a>02789 <span class="comment"> * the paired pixel. </span> <a name="l02790"></a>02790 <span class="comment"> */</span> <a name="l02791"></a>02791 wgt = (erracc &gt;&gt; intshift) &amp; 255; <a name="l02792"></a>02792 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a> (dst, xx0, yy0, color, 255 - wgt); <a name="l02793"></a>02793 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a> (dst, xx0, y0p1, color, wgt); <a name="l02794"></a>02794 } <a name="l02795"></a>02795 } <a name="l02796"></a>02796 <a name="l02797"></a>02797 <span class="comment">/*</span> <a name="l02798"></a>02798 <span class="comment"> * Do we have to draw the endpoint </span> <a name="l02799"></a>02799 <span class="comment"> */</span> <a name="l02800"></a>02800 <span class="keywordflow">if</span> (draw_endpoint) { <a name="l02801"></a>02801 <span class="comment">/*</span> <a name="l02802"></a>02802 <span class="comment"> * Draw final pixel, always exactly intersected by the line and doesn&#39;t</span> <a name="l02803"></a>02803 <span class="comment"> * need to be weighted. </span> <a name="l02804"></a>02804 <span class="comment"> */</span> <a name="l02805"></a>02805 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, x2, y2, color); <a name="l02806"></a>02806 } <a name="l02807"></a>02807 <a name="l02808"></a>02808 <span class="comment">/* Unlock surface */</span> <a name="l02809"></a>02809 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l02810"></a>02810 SDL_UnlockSurface(dst); <a name="l02811"></a>02811 } <a name="l02812"></a>02812 <a name="l02813"></a>02813 <span class="keywordflow">return</span> (result); <a name="l02814"></a>02814 } <a name="l02815"></a>02815 <a name="l02828"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a4711ada424cb411e328fcedbf28ca5bd">02828</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a25c56f2def855db01dcf7ff7f7356182" title="Ddraw anti-aliased line with alpha blending.">aalineColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color) <a name="l02829"></a>02829 { <a name="l02830"></a>02830 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a41cb32b84aee2742fabd5bbaced8e016" title="Internal function to draw anti-aliased line with alpha blending and endpoint control.">_aalineColor</a>(dst, x1, y1, x2, y2, color, 1)); <a name="l02831"></a>02831 } <a name="l02832"></a>02832 <a name="l02848"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#aaf65728167a6aa7b37010560507fb4a2">02848</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a716b29af8cfc638fad0cfa0f1af15f23" title="Draw anti-aliased line with alpha blending.">aalineRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l02849"></a>02849 { <a name="l02850"></a>02850 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a41cb32b84aee2742fabd5bbaced8e016" title="Internal function to draw anti-aliased line with alpha blending and endpoint control.">_aalineColor</a> <a name="l02851"></a>02851 (dst, x1, y1, x2, y2, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a, 1)); <a name="l02852"></a>02852 } <a name="l02853"></a>02853 <a name="l02854"></a>02854 <a name="l02855"></a>02855 <span class="comment">/* ----- Circle */</span> <a name="l02856"></a>02856 <a name="l02872"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a58d231ecaf113f53c2a28435e0632624">02872</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#aa99bd361cc947b448142720f2ca3320e" title="Draw circle with blending.">circleColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color) <a name="l02873"></a>02873 { <a name="l02874"></a>02874 Sint16 left, right, top, bottom; <a name="l02875"></a>02875 <span class="keywordtype">int</span> result; <a name="l02876"></a>02876 Sint16 x1, y1, x2, y2; <a name="l02877"></a>02877 Sint16 cx = 0; <a name="l02878"></a>02878 Sint16 cy = rad; <a name="l02879"></a>02879 Sint16 df = 1 - rad; <a name="l02880"></a>02880 Sint16 d_e = 3; <a name="l02881"></a>02881 Sint16 d_se = -2 * rad + 5; <a name="l02882"></a>02882 Sint16 xpcx, xmcx, xpcy, xmcy; <a name="l02883"></a>02883 Sint16 ypcy, ymcy, ypcx, ymcx; <a name="l02884"></a>02884 Uint8 *colorptr; <a name="l02885"></a>02885 <a name="l02886"></a>02886 <span class="comment">/*</span> <a name="l02887"></a>02887 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l02888"></a>02888 <span class="comment"> */</span> <a name="l02889"></a>02889 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l02890"></a>02890 <span class="keywordflow">return</span>(0); <a name="l02891"></a>02891 } <a name="l02892"></a>02892 <a name="l02893"></a>02893 <span class="comment">/*</span> <a name="l02894"></a>02894 <span class="comment"> * Sanity check radius </span> <a name="l02895"></a>02895 <span class="comment"> */</span> <a name="l02896"></a>02896 <span class="keywordflow">if</span> (rad &lt; 0) { <a name="l02897"></a>02897 <span class="keywordflow">return</span> (-1); <a name="l02898"></a>02898 } <a name="l02899"></a>02899 <a name="l02900"></a>02900 <span class="comment">/*</span> <a name="l02901"></a>02901 <span class="comment"> * Special case for rad=0 - draw a point </span> <a name="l02902"></a>02902 <span class="comment"> */</span> <a name="l02903"></a>02903 <span class="keywordflow">if</span> (rad == 0) { <a name="l02904"></a>02904 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ae6f8690e5c5a85d3263c8e16727b34ef" title="Pixel draw with blending enabled if a&lt;255.">pixelColor</a>(dst, x, y, color)); <a name="l02905"></a>02905 } <a name="l02906"></a>02906 <a name="l02907"></a>02907 <span class="comment">/*</span> <a name="l02908"></a>02908 <span class="comment"> * Get circle and clipping boundary and </span> <a name="l02909"></a>02909 <span class="comment"> * test if bounding box of circle is visible </span> <a name="l02910"></a>02910 <span class="comment"> */</span> <a name="l02911"></a>02911 x2 = x + rad; <a name="l02912"></a>02912 left = dst-&gt;clip_rect.x; <a name="l02913"></a>02913 <span class="keywordflow">if</span> (x2&lt;left) { <a name="l02914"></a>02914 <span class="keywordflow">return</span>(0); <a name="l02915"></a>02915 } <a name="l02916"></a>02916 x1 = x - rad; <a name="l02917"></a>02917 right = dst-&gt;clip_rect.x + dst-&gt;clip_rect.w - 1; <a name="l02918"></a>02918 <span class="keywordflow">if</span> (x1&gt;right) { <a name="l02919"></a>02919 <span class="keywordflow">return</span>(0); <a name="l02920"></a>02920 } <a name="l02921"></a>02921 y2 = y + rad; <a name="l02922"></a>02922 top = dst-&gt;clip_rect.y; <a name="l02923"></a>02923 <span class="keywordflow">if</span> (y2&lt;top) { <a name="l02924"></a>02924 <span class="keywordflow">return</span>(0); <a name="l02925"></a>02925 } <a name="l02926"></a>02926 y1 = y - rad; <a name="l02927"></a>02927 bottom = dst-&gt;clip_rect.y + dst-&gt;clip_rect.h - 1; <a name="l02928"></a>02928 <span class="keywordflow">if</span> (y1&gt;bottom) { <a name="l02929"></a>02929 <span class="keywordflow">return</span>(0); <a name="l02930"></a>02930 } <a name="l02931"></a>02931 <a name="l02932"></a>02932 <span class="comment">/*</span> <a name="l02933"></a>02933 <span class="comment"> * Draw circle </span> <a name="l02934"></a>02934 <span class="comment"> */</span> <a name="l02935"></a>02935 result = 0; <a name="l02936"></a>02936 <a name="l02937"></a>02937 <span class="comment">/* Lock surface */</span> <a name="l02938"></a>02938 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l02939"></a>02939 <span class="keywordflow">if</span> (SDL_LockSurface(dst) &lt; 0) { <a name="l02940"></a>02940 <span class="keywordflow">return</span> (-1); <a name="l02941"></a>02941 } <a name="l02942"></a>02942 } <a name="l02943"></a>02943 <a name="l02944"></a>02944 <span class="comment">/*</span> <a name="l02945"></a>02945 <span class="comment"> * Alpha Check </span> <a name="l02946"></a>02946 <span class="comment"> */</span> <a name="l02947"></a>02947 <span class="keywordflow">if</span> ((color &amp; 255) == 255) { <a name="l02948"></a>02948 <a name="l02949"></a>02949 <span class="comment">/*</span> <a name="l02950"></a>02950 <span class="comment"> * No Alpha - direct memory writes </span> <a name="l02951"></a>02951 <span class="comment"> */</span> <a name="l02952"></a>02952 <a name="l02953"></a>02953 <span class="comment">/*</span> <a name="l02954"></a>02954 <span class="comment"> * Setup color </span> <a name="l02955"></a>02955 <span class="comment"> */</span> <a name="l02956"></a>02956 colorptr = (Uint8 *) &amp; color; <a name="l02957"></a>02957 <span class="keywordflow">if</span> (SDL_BYTEORDER == SDL_BIG_ENDIAN) { <a name="l02958"></a>02958 color = SDL_MapRGBA(dst-&gt;format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]); <a name="l02959"></a>02959 } <span class="keywordflow">else</span> { <a name="l02960"></a>02960 color = SDL_MapRGBA(dst-&gt;format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]); <a name="l02961"></a>02961 } <a name="l02962"></a>02962 <a name="l02963"></a>02963 <span class="comment">/*</span> <a name="l02964"></a>02964 <span class="comment"> * Draw </span> <a name="l02965"></a>02965 <span class="comment"> */</span> <a name="l02966"></a>02966 <span class="keywordflow">do</span> { <a name="l02967"></a>02967 ypcy = y + cy; <a name="l02968"></a>02968 ymcy = y - cy; <a name="l02969"></a>02969 <span class="keywordflow">if</span> (cx &gt; 0) { <a name="l02970"></a>02970 xpcx = x + cx; <a name="l02971"></a>02971 xmcx = x - cx; <a name="l02972"></a>02972 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmcx, ypcy, color); <a name="l02973"></a>02973 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xpcx, ypcy, color); <a name="l02974"></a>02974 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmcx, ymcy, color); <a name="l02975"></a>02975 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xpcx, ymcy, color); <a name="l02976"></a>02976 } <span class="keywordflow">else</span> { <a name="l02977"></a>02977 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, x, ymcy, color); <a name="l02978"></a>02978 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, x, ypcy, color); <a name="l02979"></a>02979 } <a name="l02980"></a>02980 xpcy = x + cy; <a name="l02981"></a>02981 xmcy = x - cy; <a name="l02982"></a>02982 <span class="keywordflow">if</span> ((cx &gt; 0) &amp;&amp; (cx != cy)) { <a name="l02983"></a>02983 ypcx = y + cx; <a name="l02984"></a>02984 ymcx = y - cx; <a name="l02985"></a>02985 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmcy, ypcx, color); <a name="l02986"></a>02986 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xpcy, ypcx, color); <a name="l02987"></a>02987 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmcy, ymcx, color); <a name="l02988"></a>02988 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xpcy, ymcx, color); <a name="l02989"></a>02989 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cx == 0) { <a name="l02990"></a>02990 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmcy, y, color); <a name="l02991"></a>02991 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xpcy, y, color); <a name="l02992"></a>02992 } <a name="l02993"></a>02993 <span class="comment">/*</span> <a name="l02994"></a>02994 <span class="comment"> * Update </span> <a name="l02995"></a>02995 <span class="comment"> */</span> <a name="l02996"></a>02996 <span class="keywordflow">if</span> (df &lt; 0) { <a name="l02997"></a>02997 df += d_e; <a name="l02998"></a>02998 d_e += 2; <a name="l02999"></a>02999 d_se += 2; <a name="l03000"></a>03000 } <span class="keywordflow">else</span> { <a name="l03001"></a>03001 df += d_se; <a name="l03002"></a>03002 d_e += 2; <a name="l03003"></a>03003 d_se += 4; <a name="l03004"></a>03004 cy--; <a name="l03005"></a>03005 } <a name="l03006"></a>03006 cx++; <a name="l03007"></a>03007 } <span class="keywordflow">while</span> (cx &lt;= cy); <a name="l03008"></a>03008 <a name="l03009"></a>03009 <span class="comment">/*</span> <a name="l03010"></a>03010 <span class="comment"> * Unlock surface </span> <a name="l03011"></a>03011 <span class="comment"> */</span> <a name="l03012"></a>03012 SDL_UnlockSurface(dst); <a name="l03013"></a>03013 <a name="l03014"></a>03014 } <span class="keywordflow">else</span> { <a name="l03015"></a>03015 <a name="l03016"></a>03016 <span class="comment">/*</span> <a name="l03017"></a>03017 <span class="comment"> * Using Alpha - blended pixel blits </span> <a name="l03018"></a>03018 <span class="comment"> */</span> <a name="l03019"></a>03019 <a name="l03020"></a>03020 <span class="keywordflow">do</span> { <a name="l03021"></a>03021 <span class="comment">/*</span> <a name="l03022"></a>03022 <span class="comment"> * Draw </span> <a name="l03023"></a>03023 <span class="comment"> */</span> <a name="l03024"></a>03024 ypcy = y + cy; <a name="l03025"></a>03025 ymcy = y - cy; <a name="l03026"></a>03026 <span class="keywordflow">if</span> (cx &gt; 0) { <a name="l03027"></a>03027 xpcx = x + cx; <a name="l03028"></a>03028 xmcx = x - cx; <a name="l03029"></a>03029 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xmcx, ypcy, color); <a name="l03030"></a>03030 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xpcx, ypcy, color); <a name="l03031"></a>03031 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xmcx, ymcy, color); <a name="l03032"></a>03032 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xpcx, ymcy, color); <a name="l03033"></a>03033 } <span class="keywordflow">else</span> { <a name="l03034"></a>03034 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, x, ymcy, color); <a name="l03035"></a>03035 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, x, ypcy, color); <a name="l03036"></a>03036 } <a name="l03037"></a>03037 xpcy = x + cy; <a name="l03038"></a>03038 xmcy = x - cy; <a name="l03039"></a>03039 <span class="keywordflow">if</span> ((cx &gt; 0) &amp;&amp; (cx != cy)) { <a name="l03040"></a>03040 ypcx = y + cx; <a name="l03041"></a>03041 ymcx = y - cx; <a name="l03042"></a>03042 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xmcy, ypcx, color); <a name="l03043"></a>03043 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xpcy, ypcx, color); <a name="l03044"></a>03044 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xmcy, ymcx, color); <a name="l03045"></a>03045 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xpcy, ymcx, color); <a name="l03046"></a>03046 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cx == 0) { <a name="l03047"></a>03047 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xmcy, y, color); <a name="l03048"></a>03048 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xpcy, y, color); <a name="l03049"></a>03049 } <a name="l03050"></a>03050 <span class="comment">/*</span> <a name="l03051"></a>03051 <span class="comment"> * Update </span> <a name="l03052"></a>03052 <span class="comment"> */</span> <a name="l03053"></a>03053 <span class="keywordflow">if</span> (df &lt; 0) { <a name="l03054"></a>03054 df += d_e; <a name="l03055"></a>03055 d_e += 2; <a name="l03056"></a>03056 d_se += 2; <a name="l03057"></a>03057 } <span class="keywordflow">else</span> { <a name="l03058"></a>03058 df += d_se; <a name="l03059"></a>03059 d_e += 2; <a name="l03060"></a>03060 d_se += 4; <a name="l03061"></a>03061 cy--; <a name="l03062"></a>03062 } <a name="l03063"></a>03063 cx++; <a name="l03064"></a>03064 } <span class="keywordflow">while</span> (cx &lt;= cy); <a name="l03065"></a>03065 <a name="l03066"></a>03066 } <span class="comment">/* Alpha check */</span> <a name="l03067"></a>03067 <a name="l03068"></a>03068 <span class="comment">/* Unlock surface */</span> <a name="l03069"></a>03069 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l03070"></a>03070 SDL_UnlockSurface(dst); <a name="l03071"></a>03071 } <a name="l03072"></a>03072 <a name="l03073"></a>03073 <span class="keywordflow">return</span> (result); <a name="l03074"></a>03074 } <a name="l03075"></a>03075 <a name="l03090"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a8e0945b74c02cdb1441e1b2a29d2c87d">03090</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a7fe51d4c9426c8795e58c7ddd313b0a4" title="Draw circle with blending.">circleRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l03091"></a>03091 { <a name="l03092"></a>03092 <span class="comment">/*</span> <a name="l03093"></a>03093 <span class="comment"> * Draw </span> <a name="l03094"></a>03094 <span class="comment"> */</span> <a name="l03095"></a>03095 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#aa99bd361cc947b448142720f2ca3320e" title="Draw circle with blending.">circleColor</a>(dst, x, y, rad, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l03096"></a>03096 } <a name="l03097"></a>03097 <a name="l03098"></a>03098 <span class="comment">/* ----- Arc */</span> <a name="l03099"></a>03099 <a name="l03117"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a6180558aff14d3c240d9e8bf919869ef">03117</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a461b8ac31e00306aee5f8a4c242671d2" title="Arc with blending.">arcColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color) <a name="l03118"></a>03118 { <a name="l03119"></a>03119 Sint16 left, right, top, bottom; <a name="l03120"></a>03120 <span class="keywordtype">int</span> result; <a name="l03121"></a>03121 Sint16 x1, y1, x2, y2; <a name="l03122"></a>03122 Sint16 cx = 0; <a name="l03123"></a>03123 Sint16 cy = rad; <a name="l03124"></a>03124 Sint16 df = 1 - rad; <a name="l03125"></a>03125 Sint16 d_e = 3; <a name="l03126"></a>03126 Sint16 d_se = -2 * rad + 5; <a name="l03127"></a>03127 Sint16 xpcx, xmcx, xpcy, xmcy; <a name="l03128"></a>03128 Sint16 ypcy, ymcy, ypcx, ymcx; <a name="l03129"></a>03129 Uint8 *colorptr; <a name="l03130"></a>03130 Uint8 drawoct; <a name="l03131"></a>03131 <span class="keywordtype">int</span> startoct, endoct, oct, stopval_start = 0, stopval_end = 0; <a name="l03132"></a>03132 <span class="keywordtype">double</span> dstart, dend, temp = 0.; <a name="l03133"></a>03133 <a name="l03134"></a>03134 <span class="comment">/*</span> <a name="l03135"></a>03135 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l03136"></a>03136 <span class="comment"> */</span> <a name="l03137"></a>03137 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l03138"></a>03138 <span class="keywordflow">return</span>(0); <a name="l03139"></a>03139 } <a name="l03140"></a>03140 <a name="l03141"></a>03141 <span class="comment">/*</span> <a name="l03142"></a>03142 <span class="comment"> * Sanity check radius </span> <a name="l03143"></a>03143 <span class="comment"> */</span> <a name="l03144"></a>03144 <span class="keywordflow">if</span> (rad &lt; 0) { <a name="l03145"></a>03145 <span class="keywordflow">return</span> (-1); <a name="l03146"></a>03146 } <a name="l03147"></a>03147 <a name="l03148"></a>03148 <span class="comment">/*</span> <a name="l03149"></a>03149 <span class="comment"> * Special case for rad=0 - draw a point </span> <a name="l03150"></a>03150 <span class="comment"> */</span> <a name="l03151"></a>03151 <span class="keywordflow">if</span> (rad == 0) { <a name="l03152"></a>03152 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ae6f8690e5c5a85d3263c8e16727b34ef" title="Pixel draw with blending enabled if a&lt;255.">pixelColor</a>(dst, x, y, color)); <a name="l03153"></a>03153 } <a name="l03154"></a>03154 <a name="l03155"></a>03155 <span class="comment">/*</span> <a name="l03156"></a>03156 <span class="comment"> * Get arc&#39;s circle and clipping boundary and </span> <a name="l03157"></a>03157 <span class="comment"> * test if bounding box of circle is visible </span> <a name="l03158"></a>03158 <span class="comment"> */</span> <a name="l03159"></a>03159 x2 = x + rad; <a name="l03160"></a>03160 left = dst-&gt;clip_rect.x; <a name="l03161"></a>03161 <span class="keywordflow">if</span> (x2&lt;left) { <a name="l03162"></a>03162 <span class="keywordflow">return</span>(0); <a name="l03163"></a>03163 } <a name="l03164"></a>03164 x1 = x - rad; <a name="l03165"></a>03165 right = dst-&gt;clip_rect.x + dst-&gt;clip_rect.w - 1; <a name="l03166"></a>03166 <span class="keywordflow">if</span> (x1&gt;right) { <a name="l03167"></a>03167 <span class="keywordflow">return</span>(0); <a name="l03168"></a>03168 } <a name="l03169"></a>03169 y2 = y + rad; <a name="l03170"></a>03170 top = dst-&gt;clip_rect.y; <a name="l03171"></a>03171 <span class="keywordflow">if</span> (y2&lt;top) { <a name="l03172"></a>03172 <span class="keywordflow">return</span>(0); <a name="l03173"></a>03173 } <a name="l03174"></a>03174 y1 = y - rad; <a name="l03175"></a>03175 bottom = dst-&gt;clip_rect.y + dst-&gt;clip_rect.h - 1; <a name="l03176"></a>03176 <span class="keywordflow">if</span> (y1&gt;bottom) { <a name="l03177"></a>03177 <span class="keywordflow">return</span>(0); <a name="l03178"></a>03178 } <a name="l03179"></a>03179 <a name="l03180"></a>03180 <span class="comment">// Octant labelling</span> <a name="l03181"></a>03181 <span class="comment">// </span> <a name="l03182"></a>03182 <span class="comment">// \ 5 | 6 /</span> <a name="l03183"></a>03183 <span class="comment">// \ | /</span> <a name="l03184"></a>03184 <span class="comment">// 4 \ | / 7</span> <a name="l03185"></a>03185 <span class="comment">// \|/</span> <a name="l03186"></a>03186 <span class="comment">//------+------ +x</span> <a name="l03187"></a>03187 <span class="comment">// /|\</span> <a name="l03188"></a>03188 <span class="comment"> // 3 / | \ 0</span> <a name="l03189"></a>03189 <span class="comment">// / | \</span> <a name="l03190"></a>03190 <span class="comment"> // / 2 | 1 \</span> <a name="l03191"></a>03191 <span class="comment"> // +y</span> <a name="l03192"></a>03192 <a name="l03193"></a>03193 <span class="comment">// Initially reset bitmask to 0x00000000</span> <a name="l03194"></a>03194 <span class="comment">// the set whether or not to keep drawing a given octant.</span> <a name="l03195"></a>03195 <span class="comment">// For example: 0x00111100 means we&#39;re drawing in octants 2-5</span> <a name="l03196"></a>03196 drawoct = 0; <a name="l03197"></a>03197 <a name="l03198"></a>03198 <span class="comment">/*</span> <a name="l03199"></a>03199 <span class="comment"> * Fixup angles</span> <a name="l03200"></a>03200 <span class="comment"> */</span> <a name="l03201"></a>03201 start %= 360; <a name="l03202"></a>03202 end %= 360; <a name="l03203"></a>03203 <span class="comment">// 0 &lt;= start &amp; end &lt; 360; note that sometimes start &gt; end - if so, arc goes back through 0.</span> <a name="l03204"></a>03204 <span class="keywordflow">while</span> (start &lt; 0) start += 360; <a name="l03205"></a>03205 <span class="keywordflow">while</span> (end &lt; 0) end += 360; <a name="l03206"></a>03206 start %= 360; <a name="l03207"></a>03207 end %= 360; <a name="l03208"></a>03208 <a name="l03209"></a>03209 <span class="comment">// now, we find which octants we&#39;re drawing in.</span> <a name="l03210"></a>03210 startoct = start / 45; <a name="l03211"></a>03211 endoct = end / 45; <a name="l03212"></a>03212 oct = startoct - 1; <span class="comment">// we increment as first step in loop</span> <a name="l03213"></a>03213 <a name="l03214"></a>03214 <span class="comment">// stopval_start, stopval_end; </span> <a name="l03215"></a>03215 <span class="comment">// what values of cx to stop at.</span> <a name="l03216"></a>03216 <span class="keywordflow">do</span> { <a name="l03217"></a>03217 oct = (oct + 1) % 8; <a name="l03218"></a>03218 <a name="l03219"></a>03219 <span class="keywordflow">if</span> (oct == startoct) { <a name="l03220"></a>03220 <span class="comment">// need to compute stopval_start for this octant. Look at picture above if this is unclear</span> <a name="l03221"></a>03221 dstart = (double)start; <a name="l03222"></a>03222 <span class="keywordflow">switch</span> (oct) <a name="l03223"></a>03223 { <a name="l03224"></a>03224 <span class="keywordflow">case</span> 0: <a name="l03225"></a>03225 <span class="keywordflow">case</span> 3: <a name="l03226"></a>03226 temp = sin(dstart * <a class="code" href="_s_d_l__gfx_primitives_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">M_PI</a> / 180.); <a name="l03227"></a>03227 <span class="keywordflow">break</span>; <a name="l03228"></a>03228 <span class="keywordflow">case</span> 1: <a name="l03229"></a>03229 <span class="keywordflow">case</span> 6: <a name="l03230"></a>03230 temp = cos(dstart * <a class="code" href="_s_d_l__gfx_primitives_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">M_PI</a> / 180.); <a name="l03231"></a>03231 <span class="keywordflow">break</span>; <a name="l03232"></a>03232 <span class="keywordflow">case</span> 2: <a name="l03233"></a>03233 <span class="keywordflow">case</span> 5: <a name="l03234"></a>03234 temp = -cos(dstart * <a class="code" href="_s_d_l__gfx_primitives_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">M_PI</a> / 180.); <a name="l03235"></a>03235 <span class="keywordflow">break</span>; <a name="l03236"></a>03236 <span class="keywordflow">case</span> 4: <a name="l03237"></a>03237 <span class="keywordflow">case</span> 7: <a name="l03238"></a>03238 temp = -sin(dstart * <a class="code" href="_s_d_l__gfx_primitives_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">M_PI</a> / 180.); <a name="l03239"></a>03239 <span class="keywordflow">break</span>; <a name="l03240"></a>03240 } <a name="l03241"></a>03241 temp *= rad; <a name="l03242"></a>03242 stopval_start = (int)temp; <span class="comment">// always round down.</span> <a name="l03243"></a>03243 <span class="comment">// This isn&#39;t arbitrary, but requires graph paper to explain well.</span> <a name="l03244"></a>03244 <span class="comment">// The basic idea is that we&#39;re always changing drawoct after we draw, so we</span> <a name="l03245"></a>03245 <span class="comment">// stop immediately after we render the last sensible pixel at x = ((int)temp).</span> <a name="l03246"></a>03246 <a name="l03247"></a>03247 <span class="comment">// and whether to draw in this octant initially</span> <a name="l03248"></a>03248 <span class="keywordflow">if</span> (oct % 2) drawoct |= (1 &lt;&lt; oct); <span class="comment">// this is basically like saying drawoct[oct] = true, if drawoct were a bool array</span> <a name="l03249"></a>03249 <span class="keywordflow">else</span> drawoct &amp;= 255 - (1 &lt;&lt; oct); <span class="comment">// this is basically like saying drawoct[oct] = false</span> <a name="l03250"></a>03250 } <a name="l03251"></a>03251 <span class="keywordflow">if</span> (oct == endoct) { <a name="l03252"></a>03252 <span class="comment">// need to compute stopval_end for this octant</span> <a name="l03253"></a>03253 dend = (double)end; <a name="l03254"></a>03254 <span class="keywordflow">switch</span> (oct) <a name="l03255"></a>03255 { <a name="l03256"></a>03256 <span class="keywordflow">case</span> 0: <a name="l03257"></a>03257 <span class="keywordflow">case</span> 3: <a name="l03258"></a>03258 temp = sin(dend * <a class="code" href="_s_d_l__gfx_primitives_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">M_PI</a> / 180); <a name="l03259"></a>03259 <span class="keywordflow">break</span>; <a name="l03260"></a>03260 <span class="keywordflow">case</span> 1: <a name="l03261"></a>03261 <span class="keywordflow">case</span> 6: <a name="l03262"></a>03262 temp = cos(dend * <a class="code" href="_s_d_l__gfx_primitives_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">M_PI</a> / 180); <a name="l03263"></a>03263 <span class="keywordflow">break</span>; <a name="l03264"></a>03264 <span class="keywordflow">case</span> 2: <a name="l03265"></a>03265 <span class="keywordflow">case</span> 5: <a name="l03266"></a>03266 temp = -cos(dend * <a class="code" href="_s_d_l__gfx_primitives_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">M_PI</a> / 180); <a name="l03267"></a>03267 <span class="keywordflow">break</span>; <a name="l03268"></a>03268 <span class="keywordflow">case</span> 4: <a name="l03269"></a>03269 <span class="keywordflow">case</span> 7: <a name="l03270"></a>03270 temp = -sin(dend * <a class="code" href="_s_d_l__gfx_primitives_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">M_PI</a> / 180); <a name="l03271"></a>03271 <span class="keywordflow">break</span>; <a name="l03272"></a>03272 } <a name="l03273"></a>03273 temp *= rad; <a name="l03274"></a>03274 stopval_end = (int)temp; <a name="l03275"></a>03275 <a name="l03276"></a>03276 <span class="comment">// and whether to draw in this octant initially</span> <a name="l03277"></a>03277 <span class="keywordflow">if</span> (startoct == endoct) { <a name="l03278"></a>03278 <span class="comment">// note: we start drawing, stop, then start again in this case</span> <a name="l03279"></a>03279 <span class="comment">// otherwise: we only draw in this octant, so initialize it to false, it will get set back to true</span> <a name="l03280"></a>03280 <span class="keywordflow">if</span> (start &gt; end) { <a name="l03281"></a>03281 <span class="comment">// unfortunately, if we&#39;re in the same octant and need to draw over the whole circle, </span> <a name="l03282"></a>03282 <span class="comment">// we need to set the rest to true, because the while loop will end at the bottom.</span> <a name="l03283"></a>03283 drawoct = 255; <a name="l03284"></a>03284 } <span class="keywordflow">else</span> { <a name="l03285"></a>03285 drawoct &amp;= 255 - (1 &lt;&lt; oct); <a name="l03286"></a>03286 } <a name="l03287"></a>03287 } <a name="l03288"></a>03288 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (oct % 2) drawoct &amp;= 255 - (1 &lt;&lt; oct); <a name="l03289"></a>03289 <span class="keywordflow">else</span> drawoct |= (1 &lt;&lt; oct); <a name="l03290"></a>03290 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (oct != startoct) { <span class="comment">// already verified that it&#39;s != endoct</span> <a name="l03291"></a>03291 drawoct |= (1 &lt;&lt; oct); <span class="comment">// draw this entire segment</span> <a name="l03292"></a>03292 } <a name="l03293"></a>03293 } <span class="keywordflow">while</span> (oct != endoct); <a name="l03294"></a>03294 <a name="l03295"></a>03295 <span class="comment">// so now we have what octants to draw and when to draw them. all that&#39;s left is the actual raster code.</span> <a name="l03296"></a>03296 <a name="l03297"></a>03297 <span class="comment">/* Lock surface */</span> <a name="l03298"></a>03298 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l03299"></a>03299 <span class="keywordflow">if</span> (SDL_LockSurface(dst) &lt; 0) { <a name="l03300"></a>03300 <span class="keywordflow">return</span> (-1); <a name="l03301"></a>03301 } <a name="l03302"></a>03302 } <a name="l03303"></a>03303 <a name="l03304"></a>03304 <span class="comment">/*</span> <a name="l03305"></a>03305 <span class="comment"> * Draw arc </span> <a name="l03306"></a>03306 <span class="comment"> */</span> <a name="l03307"></a>03307 result = 0; <a name="l03308"></a>03308 <a name="l03309"></a>03309 <span class="comment">/*</span> <a name="l03310"></a>03310 <span class="comment"> * Alpha Check </span> <a name="l03311"></a>03311 <span class="comment"> */</span> <a name="l03312"></a>03312 <span class="keywordflow">if</span> ((color &amp; 255) == 255) { <a name="l03313"></a>03313 <a name="l03314"></a>03314 <span class="comment">/*</span> <a name="l03315"></a>03315 <span class="comment"> * No Alpha - direct memory writes </span> <a name="l03316"></a>03316 <span class="comment"> */</span> <a name="l03317"></a>03317 <a name="l03318"></a>03318 <span class="comment">/*</span> <a name="l03319"></a>03319 <span class="comment"> * Setup color </span> <a name="l03320"></a>03320 <span class="comment"> */</span> <a name="l03321"></a>03321 colorptr = (Uint8 *) &amp; color; <a name="l03322"></a>03322 <span class="keywordflow">if</span> (SDL_BYTEORDER == SDL_BIG_ENDIAN) { <a name="l03323"></a>03323 color = SDL_MapRGBA(dst-&gt;format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]); <a name="l03324"></a>03324 } <span class="keywordflow">else</span> { <a name="l03325"></a>03325 color = SDL_MapRGBA(dst-&gt;format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]); <a name="l03326"></a>03326 } <a name="l03327"></a>03327 <a name="l03328"></a>03328 <span class="comment">/*</span> <a name="l03329"></a>03329 <span class="comment"> * Draw </span> <a name="l03330"></a>03330 <span class="comment"> */</span> <a name="l03331"></a>03331 <span class="keywordflow">do</span> { <a name="l03332"></a>03332 ypcy = y + cy; <a name="l03333"></a>03333 ymcy = y - cy; <a name="l03334"></a>03334 <span class="keywordflow">if</span> (cx &gt; 0) { <a name="l03335"></a>03335 xpcx = x + cx; <a name="l03336"></a>03336 xmcx = x - cx; <a name="l03337"></a>03337 <span class="comment">// always check if we&#39;re drawing a certain octant before adding a pixel to that octant.</span> <a name="l03338"></a>03338 <span class="keywordflow">if</span> (drawoct &amp; 4) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmcx, ypcy, color); <span class="comment">// drawoct &amp; 4 = 22; drawoct[2]</span> <a name="l03339"></a>03339 <span class="keywordflow">if</span> (drawoct &amp; 2) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xpcx, ypcy, color); <a name="l03340"></a>03340 <span class="keywordflow">if</span> (drawoct &amp; 32) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmcx, ymcy, color); <a name="l03341"></a>03341 <span class="keywordflow">if</span> (drawoct &amp; 64) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xpcx, ymcy, color); <a name="l03342"></a>03342 } <span class="keywordflow">else</span> { <a name="l03343"></a>03343 <span class="keywordflow">if</span> (drawoct &amp; 6) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, x, ypcy, color); <span class="comment">// 4 + 2; drawoct[2] || drawoct[1]</span> <a name="l03344"></a>03344 <span class="keywordflow">if</span> (drawoct &amp; 96) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, x, ymcy, color); <span class="comment">// 32 + 64</span> <a name="l03345"></a>03345 } <a name="l03346"></a>03346 <a name="l03347"></a>03347 xpcy = x + cy; <a name="l03348"></a>03348 xmcy = x - cy; <a name="l03349"></a>03349 <span class="keywordflow">if</span> (cx &gt; 0 &amp;&amp; cx != cy) { <a name="l03350"></a>03350 ypcx = y + cx; <a name="l03351"></a>03351 ymcx = y - cx; <a name="l03352"></a>03352 <span class="keywordflow">if</span> (drawoct &amp; 8) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmcy, ypcx, color); <a name="l03353"></a>03353 <span class="keywordflow">if</span> (drawoct &amp; 1) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xpcy, ypcx, color); <a name="l03354"></a>03354 <span class="keywordflow">if</span> (drawoct &amp; 16) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmcy, ymcx, color); <a name="l03355"></a>03355 <span class="keywordflow">if</span> (drawoct &amp; 128) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xpcy, ymcx, color); <a name="l03356"></a>03356 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cx == 0) { <a name="l03357"></a>03357 <span class="keywordflow">if</span> (drawoct &amp; 24) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmcy, y, color); <span class="comment">// 8 + 16</span> <a name="l03358"></a>03358 <span class="keywordflow">if</span> (drawoct &amp; 129) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xpcy, y, color); <span class="comment">// 1 + 128</span> <a name="l03359"></a>03359 } <a name="l03360"></a>03360 <a name="l03361"></a>03361 <span class="comment">/*</span> <a name="l03362"></a>03362 <span class="comment"> * Update whether we&#39;re drawing an octant</span> <a name="l03363"></a>03363 <span class="comment"> */</span> <a name="l03364"></a>03364 <span class="keywordflow">if</span> (stopval_start == cx) { <a name="l03365"></a>03365 <span class="comment">// works like an on-off switch because start &amp; end may be in the same octant.</span> <a name="l03366"></a>03366 <span class="keywordflow">if</span> (drawoct &amp; (1 &lt;&lt; startoct)) drawoct &amp;= 255 - (1 &lt;&lt; startoct); <a name="l03367"></a>03367 <span class="keywordflow">else</span> drawoct |= (1 &lt;&lt; startoct); <a name="l03368"></a>03368 } <a name="l03369"></a>03369 <span class="keywordflow">if</span> (stopval_end == cx) { <a name="l03370"></a>03370 <span class="keywordflow">if</span> (drawoct &amp; (1 &lt;&lt; endoct)) drawoct &amp;= 255 - (1 &lt;&lt; endoct); <a name="l03371"></a>03371 <span class="keywordflow">else</span> drawoct |= (1 &lt;&lt; endoct); <a name="l03372"></a>03372 } <a name="l03373"></a>03373 <a name="l03374"></a>03374 <span class="comment">/*</span> <a name="l03375"></a>03375 <span class="comment"> * Update pixels</span> <a name="l03376"></a>03376 <span class="comment"> */</span> <a name="l03377"></a>03377 <span class="keywordflow">if</span> (df &lt; 0) { <a name="l03378"></a>03378 df += d_e; <a name="l03379"></a>03379 d_e += 2; <a name="l03380"></a>03380 d_se += 2; <a name="l03381"></a>03381 } <span class="keywordflow">else</span> { <a name="l03382"></a>03382 df += d_se; <a name="l03383"></a>03383 d_e += 2; <a name="l03384"></a>03384 d_se += 4; <a name="l03385"></a>03385 cy--; <a name="l03386"></a>03386 } <a name="l03387"></a>03387 cx++; <a name="l03388"></a>03388 } <span class="keywordflow">while</span> (cx &lt;= cy); <a name="l03389"></a>03389 <a name="l03390"></a>03390 <span class="comment">/*</span> <a name="l03391"></a>03391 <span class="comment"> * Unlock surface </span> <a name="l03392"></a>03392 <span class="comment"> */</span> <a name="l03393"></a>03393 SDL_UnlockSurface(dst); <a name="l03394"></a>03394 <a name="l03395"></a>03395 } <span class="keywordflow">else</span> { <a name="l03396"></a>03396 <a name="l03397"></a>03397 <span class="comment">/*</span> <a name="l03398"></a>03398 <span class="comment"> * Using Alpha - blended pixel blits </span> <a name="l03399"></a>03399 <span class="comment"> */</span> <a name="l03400"></a>03400 <a name="l03401"></a>03401 <span class="keywordflow">do</span> { <a name="l03402"></a>03402 ypcy = y + cy; <a name="l03403"></a>03403 ymcy = y - cy; <a name="l03404"></a>03404 <span class="keywordflow">if</span> (cx &gt; 0) { <a name="l03405"></a>03405 xpcx = x + cx; <a name="l03406"></a>03406 xmcx = x - cx; <a name="l03407"></a>03407 <a name="l03408"></a>03408 <span class="comment">// always check if we&#39;re drawing a certain octant before adding a pixel to that octant.</span> <a name="l03409"></a>03409 <span class="keywordflow">if</span> (drawoct &amp; 4) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(dst, xmcx, ypcy, color); <a name="l03410"></a>03410 <span class="keywordflow">if</span> (drawoct &amp; 2) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(dst, xpcx, ypcy, color); <a name="l03411"></a>03411 <span class="keywordflow">if</span> (drawoct &amp; 32) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(dst, xmcx, ymcy, color); <a name="l03412"></a>03412 <span class="keywordflow">if</span> (drawoct &amp; 64) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(dst, xpcx, ymcy, color); <a name="l03413"></a>03413 } <span class="keywordflow">else</span> { <a name="l03414"></a>03414 <span class="keywordflow">if</span> (drawoct &amp; 96) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(dst, x, ymcy, color); <a name="l03415"></a>03415 <span class="keywordflow">if</span> (drawoct &amp; 6) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(dst, x, ypcy, color); <a name="l03416"></a>03416 } <a name="l03417"></a>03417 <a name="l03418"></a>03418 xpcy = x + cy; <a name="l03419"></a>03419 xmcy = x - cy; <a name="l03420"></a>03420 <span class="keywordflow">if</span> (cx &gt; 0 &amp;&amp; cx != cy) { <a name="l03421"></a>03421 ypcx = y + cx; <a name="l03422"></a>03422 ymcx = y - cx; <a name="l03423"></a>03423 <span class="keywordflow">if</span> (drawoct &amp; 8) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(dst, xmcy, ypcx, color); <a name="l03424"></a>03424 <span class="keywordflow">if</span> (drawoct &amp; 1) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(dst, xpcy, ypcx, color); <a name="l03425"></a>03425 <span class="keywordflow">if</span> (drawoct &amp; 16) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(dst, xmcy, ymcx, color); <a name="l03426"></a>03426 <span class="keywordflow">if</span> (drawoct &amp; 128) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(dst, xpcy, ymcx, color); <a name="l03427"></a>03427 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cx == 0) { <a name="l03428"></a>03428 <span class="keywordflow">if</span> (drawoct &amp; 24) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(dst, xmcy, y, color); <a name="l03429"></a>03429 <span class="keywordflow">if</span> (drawoct &amp; 129) result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(dst, xpcy, y, color); <a name="l03430"></a>03430 } <a name="l03431"></a>03431 <a name="l03432"></a>03432 <span class="comment">/*</span> <a name="l03433"></a>03433 <span class="comment"> * Update whether we&#39;re drawing an octant</span> <a name="l03434"></a>03434 <span class="comment"> */</span> <a name="l03435"></a>03435 <span class="keywordflow">if</span> (stopval_start == cx) { <a name="l03436"></a>03436 <span class="comment">// works like an on-off switch. </span> <a name="l03437"></a>03437 <span class="comment">// This is just in case start &amp; end are in the same octant.</span> <a name="l03438"></a>03438 <span class="keywordflow">if</span> (drawoct &amp; (1 &lt;&lt; startoct)) drawoct &amp;= 255 - (1 &lt;&lt; startoct); <a name="l03439"></a>03439 <span class="keywordflow">else</span> drawoct |= (1 &lt;&lt; startoct); <a name="l03440"></a>03440 } <a name="l03441"></a>03441 <span class="keywordflow">if</span> (stopval_end == cx) { <a name="l03442"></a>03442 <span class="keywordflow">if</span> (drawoct &amp; (1 &lt;&lt; endoct)) drawoct &amp;= 255 - (1 &lt;&lt; endoct); <a name="l03443"></a>03443 <span class="keywordflow">else</span> drawoct |= (1 &lt;&lt; endoct); <a name="l03444"></a>03444 } <a name="l03445"></a>03445 <a name="l03446"></a>03446 <span class="comment">/*</span> <a name="l03447"></a>03447 <span class="comment"> * Update pixels</span> <a name="l03448"></a>03448 <span class="comment"> */</span> <a name="l03449"></a>03449 <span class="keywordflow">if</span> (df &lt; 0) { <a name="l03450"></a>03450 df += d_e; <a name="l03451"></a>03451 d_e += 2; <a name="l03452"></a>03452 d_se += 2; <a name="l03453"></a>03453 } <span class="keywordflow">else</span> { <a name="l03454"></a>03454 df += d_se; <a name="l03455"></a>03455 d_e += 2; <a name="l03456"></a>03456 d_se += 4; <a name="l03457"></a>03457 cy--; <a name="l03458"></a>03458 } <a name="l03459"></a>03459 cx++; <a name="l03460"></a>03460 } <span class="keywordflow">while</span> (cx &lt;= cy); <a name="l03461"></a>03461 <a name="l03462"></a>03462 } <span class="comment">/* Alpha check */</span> <a name="l03463"></a>03463 <a name="l03464"></a>03464 <span class="comment">/* Unlock surface */</span> <a name="l03465"></a>03465 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l03466"></a>03466 SDL_UnlockSurface(dst); <a name="l03467"></a>03467 } <a name="l03468"></a>03468 <a name="l03469"></a>03469 <span class="keywordflow">return</span> (result); <a name="l03470"></a>03470 } <a name="l03471"></a>03471 <a name="l03488"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a5d8d25ecb69e9386289125eb21668a2f">03488</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a2aff993d0d8d64564e16145f401d3cf1" title="Arc with blending.">arcRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l03489"></a>03489 { <a name="l03490"></a>03490 <span class="comment">/*</span> <a name="l03491"></a>03491 <span class="comment"> * Draw </span> <a name="l03492"></a>03492 <span class="comment"> */</span> <a name="l03493"></a>03493 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a461b8ac31e00306aee5f8a4c242671d2" title="Arc with blending.">arcColor</a>(dst, x, y, rad, start, end, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l03494"></a>03494 } <a name="l03495"></a>03495 <a name="l03496"></a>03496 <span class="comment">/* ----- AA Circle */</span> <a name="l03497"></a>03497 <a name="l03498"></a>03498 <a name="l03512"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#aee66c744f9fbe58c9f93ad33375373c3">03512</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#aad64361b01181e6aff940add96d23c61" title="Draw anti-aliased circle with blending.">aacircleColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color) <a name="l03513"></a>03513 { <a name="l03514"></a>03514 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a1c7d20dcba8e0d7ce483f4c854c438be" title="Draw anti-aliased ellipse with blending.">aaellipseColor</a>(dst, x, y, rad, rad, color)); <a name="l03515"></a>03515 } <a name="l03516"></a>03516 <a name="l03531"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a613099498679e6280959cdfdcd59a143">03531</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a332780885aa2cfdc2de34dcff8d67e8b" title="Draw anti-aliased circle with blending.">aacircleRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l03532"></a>03532 { <a name="l03533"></a>03533 <span class="comment">/*</span> <a name="l03534"></a>03534 <span class="comment"> * Draw </span> <a name="l03535"></a>03535 <span class="comment"> */</span> <a name="l03536"></a>03536 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a1c7d20dcba8e0d7ce483f4c854c438be" title="Draw anti-aliased ellipse with blending.">aaellipseColor</a> <a name="l03537"></a>03537 (dst, x, y, rad, rad, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l03538"></a>03538 } <a name="l03539"></a>03539 <a name="l03540"></a>03540 <span class="comment">/* ----- Filled Circle */</span> <a name="l03541"></a>03541 <a name="l03556"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a4f7b717b958ef39bfc8c958476dd0de1">03556</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a39147d1282ec814a1b9e31243aad0359" title="Draw filled circle with blending.">filledCircleColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color) <a name="l03557"></a>03557 { <a name="l03558"></a>03558 Sint16 left, right, top, bottom; <a name="l03559"></a>03559 <span class="keywordtype">int</span> result; <a name="l03560"></a>03560 Sint16 x1, y1, x2, y2; <a name="l03561"></a>03561 Sint16 cx = 0; <a name="l03562"></a>03562 Sint16 cy = rad; <a name="l03563"></a>03563 Sint16 ocx = (Sint16) 0xffff; <a name="l03564"></a>03564 Sint16 ocy = (Sint16) 0xffff; <a name="l03565"></a>03565 Sint16 df = 1 - rad; <a name="l03566"></a>03566 Sint16 d_e = 3; <a name="l03567"></a>03567 Sint16 d_se = -2 * rad + 5; <a name="l03568"></a>03568 Sint16 xpcx, xmcx, xpcy, xmcy; <a name="l03569"></a>03569 Sint16 ypcy, ymcy, ypcx, ymcx; <a name="l03570"></a>03570 <a name="l03571"></a>03571 <span class="comment">/*</span> <a name="l03572"></a>03572 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l03573"></a>03573 <span class="comment"> */</span> <a name="l03574"></a>03574 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l03575"></a>03575 <span class="keywordflow">return</span>(0); <a name="l03576"></a>03576 } <a name="l03577"></a>03577 <a name="l03578"></a>03578 <span class="comment">/*</span> <a name="l03579"></a>03579 <span class="comment"> * Sanity check radius </span> <a name="l03580"></a>03580 <span class="comment"> */</span> <a name="l03581"></a>03581 <span class="keywordflow">if</span> (rad &lt; 0) { <a name="l03582"></a>03582 <span class="keywordflow">return</span> (-1); <a name="l03583"></a>03583 } <a name="l03584"></a>03584 <a name="l03585"></a>03585 <span class="comment">/*</span> <a name="l03586"></a>03586 <span class="comment"> * Special case for rad=0 - draw a point </span> <a name="l03587"></a>03587 <span class="comment"> */</span> <a name="l03588"></a>03588 <span class="keywordflow">if</span> (rad == 0) { <a name="l03589"></a>03589 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ae6f8690e5c5a85d3263c8e16727b34ef" title="Pixel draw with blending enabled if a&lt;255.">pixelColor</a>(dst, x, y, color)); <a name="l03590"></a>03590 } <a name="l03591"></a>03591 <a name="l03592"></a>03592 <span class="comment">/*</span> <a name="l03593"></a>03593 <span class="comment"> * Get circle and clipping boundary and </span> <a name="l03594"></a>03594 <span class="comment"> * test if bounding box of circle is visible </span> <a name="l03595"></a>03595 <span class="comment"> */</span> <a name="l03596"></a>03596 x2 = x + rad; <a name="l03597"></a>03597 left = dst-&gt;clip_rect.x; <a name="l03598"></a>03598 <span class="keywordflow">if</span> (x2&lt;left) { <a name="l03599"></a>03599 <span class="keywordflow">return</span>(0); <a name="l03600"></a>03600 } <a name="l03601"></a>03601 x1 = x - rad; <a name="l03602"></a>03602 right = dst-&gt;clip_rect.x + dst-&gt;clip_rect.w - 1; <a name="l03603"></a>03603 <span class="keywordflow">if</span> (x1&gt;right) { <a name="l03604"></a>03604 <span class="keywordflow">return</span>(0); <a name="l03605"></a>03605 } <a name="l03606"></a>03606 y2 = y + rad; <a name="l03607"></a>03607 top = dst-&gt;clip_rect.y; <a name="l03608"></a>03608 <span class="keywordflow">if</span> (y2&lt;top) { <a name="l03609"></a>03609 <span class="keywordflow">return</span>(0); <a name="l03610"></a>03610 } <a name="l03611"></a>03611 y1 = y - rad; <a name="l03612"></a>03612 bottom = dst-&gt;clip_rect.y + dst-&gt;clip_rect.h - 1; <a name="l03613"></a>03613 <span class="keywordflow">if</span> (y1&gt;bottom) { <a name="l03614"></a>03614 <span class="keywordflow">return</span>(0); <a name="l03615"></a>03615 } <a name="l03616"></a>03616 <a name="l03617"></a>03617 <span class="comment">/*</span> <a name="l03618"></a>03618 <span class="comment"> * Draw </span> <a name="l03619"></a>03619 <span class="comment"> */</span> <a name="l03620"></a>03620 result = 0; <a name="l03621"></a>03621 <span class="keywordflow">do</span> { <a name="l03622"></a>03622 xpcx = x + cx; <a name="l03623"></a>03623 xmcx = x - cx; <a name="l03624"></a>03624 xpcy = x + cy; <a name="l03625"></a>03625 xmcy = x - cy; <a name="l03626"></a>03626 <span class="keywordflow">if</span> (ocy != cy) { <a name="l03627"></a>03627 <span class="keywordflow">if</span> (cy &gt; 0) { <a name="l03628"></a>03628 ypcy = y + cy; <a name="l03629"></a>03629 ymcy = y - cy; <a name="l03630"></a>03630 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xmcx, xpcx, ypcy, color); <a name="l03631"></a>03631 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xmcx, xpcx, ymcy, color); <a name="l03632"></a>03632 } <span class="keywordflow">else</span> { <a name="l03633"></a>03633 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xmcx, xpcx, y, color); <a name="l03634"></a>03634 } <a name="l03635"></a>03635 ocy = cy; <a name="l03636"></a>03636 } <a name="l03637"></a>03637 <span class="keywordflow">if</span> (ocx != cx) { <a name="l03638"></a>03638 <span class="keywordflow">if</span> (cx != cy) { <a name="l03639"></a>03639 <span class="keywordflow">if</span> (cx &gt; 0) { <a name="l03640"></a>03640 ypcx = y + cx; <a name="l03641"></a>03641 ymcx = y - cx; <a name="l03642"></a>03642 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xmcy, xpcy, ymcx, color); <a name="l03643"></a>03643 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xmcy, xpcy, ypcx, color); <a name="l03644"></a>03644 } <span class="keywordflow">else</span> { <a name="l03645"></a>03645 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xmcy, xpcy, y, color); <a name="l03646"></a>03646 } <a name="l03647"></a>03647 } <a name="l03648"></a>03648 ocx = cx; <a name="l03649"></a>03649 } <a name="l03650"></a>03650 <span class="comment">/*</span> <a name="l03651"></a>03651 <span class="comment"> * Update </span> <a name="l03652"></a>03652 <span class="comment"> */</span> <a name="l03653"></a>03653 <span class="keywordflow">if</span> (df &lt; 0) { <a name="l03654"></a>03654 df += d_e; <a name="l03655"></a>03655 d_e += 2; <a name="l03656"></a>03656 d_se += 2; <a name="l03657"></a>03657 } <span class="keywordflow">else</span> { <a name="l03658"></a>03658 df += d_se; <a name="l03659"></a>03659 d_e += 2; <a name="l03660"></a>03660 d_se += 4; <a name="l03661"></a>03661 cy--; <a name="l03662"></a>03662 } <a name="l03663"></a>03663 cx++; <a name="l03664"></a>03664 } <span class="keywordflow">while</span> (cx &lt;= cy); <a name="l03665"></a>03665 <a name="l03666"></a>03666 <span class="keywordflow">return</span> (result); <a name="l03667"></a>03667 } <a name="l03668"></a>03668 <a name="l03683"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a01af970ce0be38cea9884bc6f816c984">03683</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a562ba6b18fb70547cd50cb3bb0f70272" title="Draw filled circle with blending.">filledCircleRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l03684"></a>03684 { <a name="l03685"></a>03685 <span class="comment">/*</span> <a name="l03686"></a>03686 <span class="comment"> * Draw </span> <a name="l03687"></a>03687 <span class="comment"> */</span> <a name="l03688"></a>03688 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a39147d1282ec814a1b9e31243aad0359" title="Draw filled circle with blending.">filledCircleColor</a> <a name="l03689"></a>03689 (dst, x, y, rad, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l03690"></a>03690 } <a name="l03691"></a>03691 <a name="l03692"></a>03692 <span class="comment">/* ----- Ellipse */</span> <a name="l03693"></a>03693 <a name="l03709"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a8b46f389c626806e7a1ec148f0980737">03709</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a476cff7702f4be9090871e35859782f0" title="Draw ellipse with blending.">ellipseColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color) <a name="l03710"></a>03710 { <a name="l03711"></a>03711 Sint16 left, right, top, bottom; <a name="l03712"></a>03712 <span class="keywordtype">int</span> result; <a name="l03713"></a>03713 Sint16 x1, y1, x2, y2; <a name="l03714"></a>03714 <span class="keywordtype">int</span> ix, iy; <a name="l03715"></a>03715 <span class="keywordtype">int</span> h, i, j, k; <a name="l03716"></a>03716 <span class="keywordtype">int</span> oh, oi, oj, ok; <a name="l03717"></a>03717 <span class="keywordtype">int</span> xmh, xph, ypk, ymk; <a name="l03718"></a>03718 <span class="keywordtype">int</span> xmi, xpi, ymj, ypj; <a name="l03719"></a>03719 <span class="keywordtype">int</span> xmj, xpj, ymi, ypi; <a name="l03720"></a>03720 <span class="keywordtype">int</span> xmk, xpk, ymh, yph; <a name="l03721"></a>03721 Uint8 *colorptr; <a name="l03722"></a>03722 <a name="l03723"></a>03723 <span class="comment">/*</span> <a name="l03724"></a>03724 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l03725"></a>03725 <span class="comment"> */</span> <a name="l03726"></a>03726 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l03727"></a>03727 <span class="keywordflow">return</span>(0); <a name="l03728"></a>03728 } <a name="l03729"></a>03729 <a name="l03730"></a>03730 <span class="comment">/*</span> <a name="l03731"></a>03731 <span class="comment"> * Sanity check radii </span> <a name="l03732"></a>03732 <span class="comment"> */</span> <a name="l03733"></a>03733 <span class="keywordflow">if</span> ((rx &lt; 0) || (ry &lt; 0)) { <a name="l03734"></a>03734 <span class="keywordflow">return</span> (-1); <a name="l03735"></a>03735 } <a name="l03736"></a>03736 <a name="l03737"></a>03737 <span class="comment">/*</span> <a name="l03738"></a>03738 <span class="comment"> * Special case for rx=0 - draw a vline </span> <a name="l03739"></a>03739 <span class="comment"> */</span> <a name="l03740"></a>03740 <span class="keywordflow">if</span> (rx == 0) { <a name="l03741"></a>03741 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67" title="Draw vertical line with blending.">vlineColor</a>(dst, x, y - ry, y + ry, color)); <a name="l03742"></a>03742 } <a name="l03743"></a>03743 <span class="comment">/*</span> <a name="l03744"></a>03744 <span class="comment"> * Special case for ry=0 - draw a hline </span> <a name="l03745"></a>03745 <span class="comment"> */</span> <a name="l03746"></a>03746 <span class="keywordflow">if</span> (ry == 0) { <a name="l03747"></a>03747 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, x - rx, x + rx, y, color)); <a name="l03748"></a>03748 } <a name="l03749"></a>03749 <a name="l03750"></a>03750 <span class="comment">/*</span> <a name="l03751"></a>03751 <span class="comment"> * Get circle and clipping boundary and </span> <a name="l03752"></a>03752 <span class="comment"> * test if bounding box of circle is visible </span> <a name="l03753"></a>03753 <span class="comment"> */</span> <a name="l03754"></a>03754 x2 = x + rx; <a name="l03755"></a>03755 left = dst-&gt;clip_rect.x; <a name="l03756"></a>03756 <span class="keywordflow">if</span> (x2&lt;left) { <a name="l03757"></a>03757 <span class="keywordflow">return</span>(0); <a name="l03758"></a>03758 } <a name="l03759"></a>03759 x1 = x - rx; <a name="l03760"></a>03760 right = dst-&gt;clip_rect.x + dst-&gt;clip_rect.w - 1; <a name="l03761"></a>03761 <span class="keywordflow">if</span> (x1&gt;right) { <a name="l03762"></a>03762 <span class="keywordflow">return</span>(0); <a name="l03763"></a>03763 } <a name="l03764"></a>03764 y2 = y + ry; <a name="l03765"></a>03765 top = dst-&gt;clip_rect.y; <a name="l03766"></a>03766 <span class="keywordflow">if</span> (y2&lt;top) { <a name="l03767"></a>03767 <span class="keywordflow">return</span>(0); <a name="l03768"></a>03768 } <a name="l03769"></a>03769 y1 = y - ry; <a name="l03770"></a>03770 bottom = dst-&gt;clip_rect.y + dst-&gt;clip_rect.h - 1; <a name="l03771"></a>03771 <span class="keywordflow">if</span> (y1&gt;bottom) { <a name="l03772"></a>03772 <span class="keywordflow">return</span>(0); <a name="l03773"></a>03773 } <a name="l03774"></a>03774 <a name="l03775"></a>03775 <span class="comment">/*</span> <a name="l03776"></a>03776 <span class="comment"> * Init vars </span> <a name="l03777"></a>03777 <span class="comment"> */</span> <a name="l03778"></a>03778 oh = oi = oj = ok = 0xFFFF; <a name="l03779"></a>03779 <a name="l03780"></a>03780 <span class="comment">/*</span> <a name="l03781"></a>03781 <span class="comment"> * Draw </span> <a name="l03782"></a>03782 <span class="comment"> */</span> <a name="l03783"></a>03783 result = 0; <a name="l03784"></a>03784 <a name="l03785"></a>03785 <span class="comment">/* Lock surface */</span> <a name="l03786"></a>03786 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l03787"></a>03787 <span class="keywordflow">if</span> (SDL_LockSurface(dst) &lt; 0) { <a name="l03788"></a>03788 <span class="keywordflow">return</span> (-1); <a name="l03789"></a>03789 } <a name="l03790"></a>03790 } <a name="l03791"></a>03791 <a name="l03792"></a>03792 <span class="comment">/*</span> <a name="l03793"></a>03793 <span class="comment"> * Check alpha </span> <a name="l03794"></a>03794 <span class="comment"> */</span> <a name="l03795"></a>03795 <span class="keywordflow">if</span> ((color &amp; 255) == 255) { <a name="l03796"></a>03796 <a name="l03797"></a>03797 <span class="comment">/*</span> <a name="l03798"></a>03798 <span class="comment"> * No Alpha - direct memory writes </span> <a name="l03799"></a>03799 <span class="comment"> */</span> <a name="l03800"></a>03800 <a name="l03801"></a>03801 <span class="comment">/*</span> <a name="l03802"></a>03802 <span class="comment"> * Setup color </span> <a name="l03803"></a>03803 <span class="comment"> */</span> <a name="l03804"></a>03804 colorptr = (Uint8 *) &amp; color; <a name="l03805"></a>03805 <span class="keywordflow">if</span> (SDL_BYTEORDER == SDL_BIG_ENDIAN) { <a name="l03806"></a>03806 color = SDL_MapRGBA(dst-&gt;format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]); <a name="l03807"></a>03807 } <span class="keywordflow">else</span> { <a name="l03808"></a>03808 color = SDL_MapRGBA(dst-&gt;format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]); <a name="l03809"></a>03809 } <a name="l03810"></a>03810 <a name="l03811"></a>03811 <a name="l03812"></a>03812 <span class="keywordflow">if</span> (rx &gt; ry) { <a name="l03813"></a>03813 ix = 0; <a name="l03814"></a>03814 iy = rx * 64; <a name="l03815"></a>03815 <a name="l03816"></a>03816 <span class="keywordflow">do</span> { <a name="l03817"></a>03817 h = (ix + 32) &gt;&gt; 6; <a name="l03818"></a>03818 i = (iy + 32) &gt;&gt; 6; <a name="l03819"></a>03819 j = (h * ry) / rx; <a name="l03820"></a>03820 k = (i * ry) / rx; <a name="l03821"></a>03821 <a name="l03822"></a>03822 <span class="keywordflow">if</span> (((ok != k) &amp;&amp; (oj != k)) || ((oj != j) &amp;&amp; (ok != j)) || (k != j)) { <a name="l03823"></a>03823 xph = x + h; <a name="l03824"></a>03824 xmh = x - h; <a name="l03825"></a>03825 <span class="keywordflow">if</span> (k &gt; 0) { <a name="l03826"></a>03826 ypk = y + k; <a name="l03827"></a>03827 ymk = y - k; <a name="l03828"></a>03828 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmh, ypk, color); <a name="l03829"></a>03829 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xph, ypk, color); <a name="l03830"></a>03830 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmh, ymk, color); <a name="l03831"></a>03831 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xph, ymk, color); <a name="l03832"></a>03832 } <span class="keywordflow">else</span> { <a name="l03833"></a>03833 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmh, y, color); <a name="l03834"></a>03834 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xph, y, color); <a name="l03835"></a>03835 } <a name="l03836"></a>03836 ok = k; <a name="l03837"></a>03837 xpi = x + i; <a name="l03838"></a>03838 xmi = x - i; <a name="l03839"></a>03839 <span class="keywordflow">if</span> (j &gt; 0) { <a name="l03840"></a>03840 ypj = y + j; <a name="l03841"></a>03841 ymj = y - j; <a name="l03842"></a>03842 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmi, ypj, color); <a name="l03843"></a>03843 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xpi, ypj, color); <a name="l03844"></a>03844 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmi, ymj, color); <a name="l03845"></a>03845 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xpi, ymj, color); <a name="l03846"></a>03846 } <span class="keywordflow">else</span> { <a name="l03847"></a>03847 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmi, y, color); <a name="l03848"></a>03848 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xpi, y, color); <a name="l03849"></a>03849 } <a name="l03850"></a>03850 oj = j; <a name="l03851"></a>03851 } <a name="l03852"></a>03852 <a name="l03853"></a>03853 ix = ix + iy / rx; <a name="l03854"></a>03854 iy = iy - ix / rx; <a name="l03855"></a>03855 <a name="l03856"></a>03856 } <span class="keywordflow">while</span> (i &gt; h); <a name="l03857"></a>03857 } <span class="keywordflow">else</span> { <a name="l03858"></a>03858 ix = 0; <a name="l03859"></a>03859 iy = ry * 64; <a name="l03860"></a>03860 <a name="l03861"></a>03861 <span class="keywordflow">do</span> { <a name="l03862"></a>03862 h = (ix + 32) &gt;&gt; 6; <a name="l03863"></a>03863 i = (iy + 32) &gt;&gt; 6; <a name="l03864"></a>03864 j = (h * rx) / ry; <a name="l03865"></a>03865 k = (i * rx) / ry; <a name="l03866"></a>03866 <a name="l03867"></a>03867 <span class="keywordflow">if</span> (((oi != i) &amp;&amp; (oh != i)) || ((oh != h) &amp;&amp; (oi != h) &amp;&amp; (i != h))) { <a name="l03868"></a>03868 xmj = x - j; <a name="l03869"></a>03869 xpj = x + j; <a name="l03870"></a>03870 <span class="keywordflow">if</span> (i &gt; 0) { <a name="l03871"></a>03871 ypi = y + i; <a name="l03872"></a>03872 ymi = y - i; <a name="l03873"></a>03873 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmj, ypi, color); <a name="l03874"></a>03874 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xpj, ypi, color); <a name="l03875"></a>03875 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmj, ymi, color); <a name="l03876"></a>03876 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xpj, ymi, color); <a name="l03877"></a>03877 } <span class="keywordflow">else</span> { <a name="l03878"></a>03878 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmj, y, color); <a name="l03879"></a>03879 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xpj, y, color); <a name="l03880"></a>03880 } <a name="l03881"></a>03881 oi = i; <a name="l03882"></a>03882 xmk = x - k; <a name="l03883"></a>03883 xpk = x + k; <a name="l03884"></a>03884 <span class="keywordflow">if</span> (h &gt; 0) { <a name="l03885"></a>03885 yph = y + h; <a name="l03886"></a>03886 ymh = y - h; <a name="l03887"></a>03887 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmk, yph, color); <a name="l03888"></a>03888 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xpk, yph, color); <a name="l03889"></a>03889 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmk, ymh, color); <a name="l03890"></a>03890 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xpk, ymh, color); <a name="l03891"></a>03891 } <span class="keywordflow">else</span> { <a name="l03892"></a>03892 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xmk, y, color); <a name="l03893"></a>03893 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742" title="Internal pixel drawing - fast, no blending, no locking, clipping.">fastPixelColorNolock</a>(dst, xpk, y, color); <a name="l03894"></a>03894 } <a name="l03895"></a>03895 oh = h; <a name="l03896"></a>03896 } <a name="l03897"></a>03897 <a name="l03898"></a>03898 ix = ix + iy / ry; <a name="l03899"></a>03899 iy = iy - ix / ry; <a name="l03900"></a>03900 <a name="l03901"></a>03901 } <span class="keywordflow">while</span> (i &gt; h); <a name="l03902"></a>03902 } <a name="l03903"></a>03903 <a name="l03904"></a>03904 } <span class="keywordflow">else</span> { <a name="l03905"></a>03905 <a name="l03906"></a>03906 <span class="keywordflow">if</span> (rx &gt; ry) { <a name="l03907"></a>03907 ix = 0; <a name="l03908"></a>03908 iy = rx * 64; <a name="l03909"></a>03909 <a name="l03910"></a>03910 <span class="keywordflow">do</span> { <a name="l03911"></a>03911 h = (ix + 32) &gt;&gt; 6; <a name="l03912"></a>03912 i = (iy + 32) &gt;&gt; 6; <a name="l03913"></a>03913 j = (h * ry) / rx; <a name="l03914"></a>03914 k = (i * ry) / rx; <a name="l03915"></a>03915 <a name="l03916"></a>03916 <span class="keywordflow">if</span> (((ok != k) &amp;&amp; (oj != k)) || ((oj != j) &amp;&amp; (ok != j)) || (k != j)) { <a name="l03917"></a>03917 xph = x + h; <a name="l03918"></a>03918 xmh = x - h; <a name="l03919"></a>03919 <span class="keywordflow">if</span> (k &gt; 0) { <a name="l03920"></a>03920 ypk = y + k; <a name="l03921"></a>03921 ymk = y - k; <a name="l03922"></a>03922 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xmh, ypk, color); <a name="l03923"></a>03923 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xph, ypk, color); <a name="l03924"></a>03924 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xmh, ymk, color); <a name="l03925"></a>03925 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xph, ymk, color); <a name="l03926"></a>03926 } <span class="keywordflow">else</span> { <a name="l03927"></a>03927 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xmh, y, color); <a name="l03928"></a>03928 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xph, y, color); <a name="l03929"></a>03929 } <a name="l03930"></a>03930 ok = k; <a name="l03931"></a>03931 xpi = x + i; <a name="l03932"></a>03932 xmi = x - i; <a name="l03933"></a>03933 <span class="keywordflow">if</span> (j &gt; 0) { <a name="l03934"></a>03934 ypj = y + j; <a name="l03935"></a>03935 ymj = y - j; <a name="l03936"></a>03936 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xmi, ypj, color); <a name="l03937"></a>03937 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xpi, ypj, color); <a name="l03938"></a>03938 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xmi, ymj, color); <a name="l03939"></a>03939 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae6f8690e5c5a85d3263c8e16727b34ef" title="Pixel draw with blending enabled if a&lt;255.">pixelColor</a>(dst, xpi, ymj, color); <a name="l03940"></a>03940 } <span class="keywordflow">else</span> { <a name="l03941"></a>03941 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xmi, y, color); <a name="l03942"></a>03942 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xpi, y, color); <a name="l03943"></a>03943 } <a name="l03944"></a>03944 oj = j; <a name="l03945"></a>03945 } <a name="l03946"></a>03946 <a name="l03947"></a>03947 ix = ix + iy / rx; <a name="l03948"></a>03948 iy = iy - ix / rx; <a name="l03949"></a>03949 <a name="l03950"></a>03950 } <span class="keywordflow">while</span> (i &gt; h); <a name="l03951"></a>03951 } <span class="keywordflow">else</span> { <a name="l03952"></a>03952 ix = 0; <a name="l03953"></a>03953 iy = ry * 64; <a name="l03954"></a>03954 <a name="l03955"></a>03955 <span class="keywordflow">do</span> { <a name="l03956"></a>03956 h = (ix + 32) &gt;&gt; 6; <a name="l03957"></a>03957 i = (iy + 32) &gt;&gt; 6; <a name="l03958"></a>03958 j = (h * rx) / ry; <a name="l03959"></a>03959 k = (i * rx) / ry; <a name="l03960"></a>03960 <a name="l03961"></a>03961 <span class="keywordflow">if</span> (((oi != i) &amp;&amp; (oh != i)) || ((oh != h) &amp;&amp; (oi != h) &amp;&amp; (i != h))) { <a name="l03962"></a>03962 xmj = x - j; <a name="l03963"></a>03963 xpj = x + j; <a name="l03964"></a>03964 <span class="keywordflow">if</span> (i &gt; 0) { <a name="l03965"></a>03965 ypi = y + i; <a name="l03966"></a>03966 ymi = y - i; <a name="l03967"></a>03967 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xmj, ypi, color); <a name="l03968"></a>03968 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xpj, ypi, color); <a name="l03969"></a>03969 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xmj, ymi, color); <a name="l03970"></a>03970 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xpj, ymi, color); <a name="l03971"></a>03971 } <span class="keywordflow">else</span> { <a name="l03972"></a>03972 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xmj, y, color); <a name="l03973"></a>03973 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xpj, y, color); <a name="l03974"></a>03974 } <a name="l03975"></a>03975 oi = i; <a name="l03976"></a>03976 xmk = x - k; <a name="l03977"></a>03977 xpk = x + k; <a name="l03978"></a>03978 <span class="keywordflow">if</span> (h &gt; 0) { <a name="l03979"></a>03979 yph = y + h; <a name="l03980"></a>03980 ymh = y - h; <a name="l03981"></a>03981 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xmk, yph, color); <a name="l03982"></a>03982 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xpk, yph, color); <a name="l03983"></a>03983 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xmk, ymh, color); <a name="l03984"></a>03984 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xpk, ymh, color); <a name="l03985"></a>03985 } <span class="keywordflow">else</span> { <a name="l03986"></a>03986 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xmk, y, color); <a name="l03987"></a>03987 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a> (dst, xpk, y, color); <a name="l03988"></a>03988 } <a name="l03989"></a>03989 oh = h; <a name="l03990"></a>03990 } <a name="l03991"></a>03991 <a name="l03992"></a>03992 ix = ix + iy / ry; <a name="l03993"></a>03993 iy = iy - ix / ry; <a name="l03994"></a>03994 <a name="l03995"></a>03995 } <span class="keywordflow">while</span> (i &gt; h); <a name="l03996"></a>03996 } <a name="l03997"></a>03997 <a name="l03998"></a>03998 } <span class="comment">/* Alpha check */</span> <a name="l03999"></a>03999 <a name="l04000"></a>04000 <span class="comment">/* Unlock surface */</span> <a name="l04001"></a>04001 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l04002"></a>04002 SDL_UnlockSurface(dst); <a name="l04003"></a>04003 } <a name="l04004"></a>04004 <a name="l04005"></a>04005 <span class="keywordflow">return</span> (result); <a name="l04006"></a>04006 } <a name="l04007"></a>04007 <a name="l04023"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a523156891302420d2296b1a302c1fc2b">04023</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a18c8a26c9009482eec40f9f4a6945fd1" title="Draw ellipse with blending.">ellipseRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l04024"></a>04024 { <a name="l04025"></a>04025 <span class="comment">/*</span> <a name="l04026"></a>04026 <span class="comment"> * Draw </span> <a name="l04027"></a>04027 <span class="comment"> */</span> <a name="l04028"></a>04028 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a476cff7702f4be9090871e35859782f0" title="Draw ellipse with blending.">ellipseColor</a>(dst, x, y, rx, ry, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l04029"></a>04029 } <a name="l04030"></a>04030 <a name="l04031"></a>04031 <span class="comment">/* ----- AA Ellipse */</span> <a name="l04032"></a>04032 <a name="l04033"></a>04033 <span class="comment">/* Windows targets do not have lrint, so provide a local inline version */</span> <a name="l04034"></a>04034 <span class="preprocessor">#if defined(_MSC_VER)</span> <a name="l04035"></a>04035 <span class="preprocessor"></span><span class="comment">/* Detect 64bit and use intrinsic version */</span> <a name="l04036"></a>04036 <span class="preprocessor">#ifdef _M_X64</span> <a name="l04037"></a>04037 <span class="preprocessor"></span><span class="preprocessor">#include &lt;emmintrin.h&gt;</span> <a name="l04038"></a>04038 <span class="keyword">static</span> __inline <span class="keywordtype">long</span> <a name="l04039"></a>04039 lrint(<span class="keywordtype">float</span> f) <a name="l04040"></a>04040 { <a name="l04041"></a>04041 <span class="keywordflow">return</span> _mm_cvtss_si32(_mm_load_ss(&amp;f)); <a name="l04042"></a>04042 } <a name="l04043"></a>04043 <span class="preprocessor">#elif defined(_M_IX86)</span> <a name="l04044"></a>04044 <span class="preprocessor"></span>__inline <span class="keywordtype">long</span> <span class="keywordtype">int</span> <a name="l04045"></a>04045 lrint (<span class="keywordtype">double</span> flt) <a name="l04046"></a>04046 { <a name="l04047"></a>04047 <span class="keywordtype">int</span> intgr; <a name="l04048"></a>04048 _asm <a name="l04049"></a>04049 { <a name="l04050"></a>04050 fld flt <a name="l04051"></a>04051 fistp intgr <a name="l04052"></a>04052 }; <a name="l04053"></a>04053 <span class="keywordflow">return</span> intgr; <a name="l04054"></a>04054 } <a name="l04055"></a>04055 <span class="preprocessor">#elif defined(_M_ARM)</span> <a name="l04056"></a>04056 <span class="preprocessor"></span><span class="preprocessor">#include &lt;armintr.h&gt;</span> <a name="l04057"></a>04057 <span class="preprocessor">#pragma warning(push)</span> <a name="l04058"></a>04058 <span class="preprocessor"></span><span class="preprocessor">#pragma warning(disable: 4716)</span> <a name="l04059"></a>04059 <span class="preprocessor"></span>__declspec(naked) long <span class="keywordtype">int</span> <a name="l04060"></a>04060 lrint (<span class="keywordtype">double</span> flt) <a name="l04061"></a>04061 { <a name="l04062"></a>04062 __emit(0xEC410B10); <span class="comment">// fmdrr d0, r0, r1</span> <a name="l04063"></a>04063 __emit(0xEEBD0B40); <span class="comment">// ftosid s0, d0</span> <a name="l04064"></a>04064 __emit(0xEE100A10); <span class="comment">// fmrs r0, s0</span> <a name="l04065"></a>04065 __emit(0xE12FFF1E); <span class="comment">// bx lr</span> <a name="l04066"></a>04066 } <a name="l04067"></a>04067 <span class="preprocessor">#pragma warning(pop)</span> <a name="l04068"></a>04068 <span class="preprocessor"></span><span class="preprocessor">#else</span> <a name="l04069"></a>04069 <span class="preprocessor"></span><span class="preprocessor">#error lrint needed for MSVC on non X86/AMD64/ARM targets.</span> <a name="l04070"></a>04070 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l04071"></a>04071 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l04072"></a>04072 <span class="preprocessor"></span> <a name="l04088"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a6edf60c54acc964cbb47ddefc6c0d450">04088</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a1c7d20dcba8e0d7ce483f4c854c438be" title="Draw anti-aliased ellipse with blending.">aaellipseColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color) <a name="l04089"></a>04089 { <a name="l04090"></a>04090 Sint16 left, right, top, bottom; <a name="l04091"></a>04091 Sint16 x1,y1,x2,y2; <a name="l04092"></a>04092 <span class="keywordtype">int</span> i; <a name="l04093"></a>04093 <span class="keywordtype">int</span> a2, b2, ds, dt, dxt, t, s, d; <a name="l04094"></a>04094 Sint16 xp, yp, xs, ys, dyt, od, xx, yy, xc2, yc2; <a name="l04095"></a>04095 <span class="keywordtype">float</span> cp; <a name="l04096"></a>04096 <span class="keywordtype">double</span> sab; <a name="l04097"></a>04097 Uint8 weight, iweight; <a name="l04098"></a>04098 <span class="keywordtype">int</span> result; <a name="l04099"></a>04099 <a name="l04100"></a>04100 <span class="comment">/*</span> <a name="l04101"></a>04101 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l04102"></a>04102 <span class="comment"> */</span> <a name="l04103"></a>04103 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l04104"></a>04104 <span class="keywordflow">return</span>(0); <a name="l04105"></a>04105 } <a name="l04106"></a>04106 <a name="l04107"></a>04107 <span class="comment">/*</span> <a name="l04108"></a>04108 <span class="comment"> * Sanity check radii </span> <a name="l04109"></a>04109 <span class="comment"> */</span> <a name="l04110"></a>04110 <span class="keywordflow">if</span> ((rx &lt; 0) || (ry &lt; 0)) { <a name="l04111"></a>04111 <span class="keywordflow">return</span> (-1); <a name="l04112"></a>04112 } <a name="l04113"></a>04113 <a name="l04114"></a>04114 <span class="comment">/*</span> <a name="l04115"></a>04115 <span class="comment"> * Special case for rx=0 - draw a vline </span> <a name="l04116"></a>04116 <span class="comment"> */</span> <a name="l04117"></a>04117 <span class="keywordflow">if</span> (rx == 0) { <a name="l04118"></a>04118 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67" title="Draw vertical line with blending.">vlineColor</a>(dst, x, y - ry, y + ry, color)); <a name="l04119"></a>04119 } <a name="l04120"></a>04120 <span class="comment">/*</span> <a name="l04121"></a>04121 <span class="comment"> * Special case for ry=0 - draw an hline </span> <a name="l04122"></a>04122 <span class="comment"> */</span> <a name="l04123"></a>04123 <span class="keywordflow">if</span> (ry == 0) { <a name="l04124"></a>04124 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, x - rx, x + rx, y, color)); <a name="l04125"></a>04125 } <a name="l04126"></a>04126 <a name="l04127"></a>04127 <span class="comment">/*</span> <a name="l04128"></a>04128 <span class="comment"> * Get circle and clipping boundary and </span> <a name="l04129"></a>04129 <span class="comment"> * test if bounding box of circle is visible </span> <a name="l04130"></a>04130 <span class="comment"> */</span> <a name="l04131"></a>04131 x2 = x + rx; <a name="l04132"></a>04132 left = dst-&gt;clip_rect.x; <a name="l04133"></a>04133 <span class="keywordflow">if</span> (x2&lt;left) { <a name="l04134"></a>04134 <span class="keywordflow">return</span>(0); <a name="l04135"></a>04135 } <a name="l04136"></a>04136 x1 = x - rx; <a name="l04137"></a>04137 right = dst-&gt;clip_rect.x + dst-&gt;clip_rect.w - 1; <a name="l04138"></a>04138 <span class="keywordflow">if</span> (x1&gt;right) { <a name="l04139"></a>04139 <span class="keywordflow">return</span>(0); <a name="l04140"></a>04140 } <a name="l04141"></a>04141 y2 = y + ry; <a name="l04142"></a>04142 top = dst-&gt;clip_rect.y; <a name="l04143"></a>04143 <span class="keywordflow">if</span> (y2&lt;top) { <a name="l04144"></a>04144 <span class="keywordflow">return</span>(0); <a name="l04145"></a>04145 } <a name="l04146"></a>04146 y1 = y - ry; <a name="l04147"></a>04147 bottom = dst-&gt;clip_rect.y + dst-&gt;clip_rect.h - 1; <a name="l04148"></a>04148 <span class="keywordflow">if</span> (y1&gt;bottom) { <a name="l04149"></a>04149 <span class="keywordflow">return</span>(0); <a name="l04150"></a>04150 } <a name="l04151"></a>04151 <a name="l04152"></a>04152 <span class="comment">/* Variable setup */</span> <a name="l04153"></a>04153 a2 = rx * rx; <a name="l04154"></a>04154 b2 = ry * ry; <a name="l04155"></a>04155 <a name="l04156"></a>04156 ds = 2 * a2; <a name="l04157"></a>04157 dt = 2 * b2; <a name="l04158"></a>04158 <a name="l04159"></a>04159 xc2 = 2 * x; <a name="l04160"></a>04160 yc2 = 2 * y; <a name="l04161"></a>04161 <a name="l04162"></a>04162 sab = sqrt((<span class="keywordtype">double</span>)(a2 + b2)); <a name="l04163"></a>04163 od = (Sint16)lrint(sab*0.01) + 1; <span class="comment">/* introduce some overdraw */</span> <a name="l04164"></a>04164 dxt = (Sint16)lrint((<span class="keywordtype">double</span>)a2 / sab) + od; <a name="l04165"></a>04165 <a name="l04166"></a>04166 t = 0; <a name="l04167"></a>04167 s = -2 * a2 * ry; <a name="l04168"></a>04168 d = 0; <a name="l04169"></a>04169 <a name="l04170"></a>04170 xp = x; <a name="l04171"></a>04171 yp = y - ry; <a name="l04172"></a>04172 <a name="l04173"></a>04173 <span class="comment">/* Lock surface */</span> <a name="l04174"></a>04174 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l04175"></a>04175 <span class="keywordflow">if</span> (SDL_LockSurface(dst) &lt; 0) { <a name="l04176"></a>04176 <span class="keywordflow">return</span> (-1); <a name="l04177"></a>04177 } <a name="l04178"></a>04178 } <a name="l04179"></a>04179 <a name="l04180"></a>04180 <span class="comment">/* Draw */</span> <a name="l04181"></a>04181 result = 0; <a name="l04182"></a>04182 <a name="l04183"></a>04183 <span class="comment">/* &quot;End points&quot; */</span> <a name="l04184"></a>04184 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(dst, xp, yp, color); <a name="l04185"></a>04185 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(dst, xc2 - xp, yp, color); <a name="l04186"></a>04186 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(dst, xp, yc2 - yp, color); <a name="l04187"></a>04187 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(dst, xc2 - xp, yc2 - yp, color); <a name="l04188"></a>04188 <a name="l04189"></a>04189 <span class="keywordflow">for</span> (i = 1; i &lt;= dxt; i++) { <a name="l04190"></a>04190 xp--; <a name="l04191"></a>04191 d += t - b2; <a name="l04192"></a>04192 <a name="l04193"></a>04193 <span class="keywordflow">if</span> (d &gt;= 0) <a name="l04194"></a>04194 ys = yp - 1; <a name="l04195"></a>04195 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((d - s - a2) &gt; 0) { <a name="l04196"></a>04196 <span class="keywordflow">if</span> ((2 * d - s - a2) &gt;= 0) <a name="l04197"></a>04197 ys = yp + 1; <a name="l04198"></a>04198 <span class="keywordflow">else</span> { <a name="l04199"></a>04199 ys = yp; <a name="l04200"></a>04200 yp++; <a name="l04201"></a>04201 d -= s + a2; <a name="l04202"></a>04202 s += ds; <a name="l04203"></a>04203 } <a name="l04204"></a>04204 } <span class="keywordflow">else</span> { <a name="l04205"></a>04205 yp++; <a name="l04206"></a>04206 ys = yp + 1; <a name="l04207"></a>04207 d -= s + a2; <a name="l04208"></a>04208 s += ds; <a name="l04209"></a>04209 } <a name="l04210"></a>04210 <a name="l04211"></a>04211 t -= dt; <a name="l04212"></a>04212 <a name="l04213"></a>04213 <span class="comment">/* Calculate alpha */</span> <a name="l04214"></a>04214 <span class="keywordflow">if</span> (s != 0) { <a name="l04215"></a>04215 cp = (float) abs(d) / (float) abs(s); <a name="l04216"></a>04216 <span class="keywordflow">if</span> (cp &gt; 1.0) { <a name="l04217"></a>04217 cp = 1.0; <a name="l04218"></a>04218 } <a name="l04219"></a>04219 } <span class="keywordflow">else</span> { <a name="l04220"></a>04220 cp = 1.0; <a name="l04221"></a>04221 } <a name="l04222"></a>04222 <a name="l04223"></a>04223 <span class="comment">/* Calculate weights */</span> <a name="l04224"></a>04224 weight = (Uint8) (cp * 255); <a name="l04225"></a>04225 iweight = 255 - weight; <a name="l04226"></a>04226 <a name="l04227"></a>04227 <span class="comment">/* Upper half */</span> <a name="l04228"></a>04228 xx = xc2 - xp; <a name="l04229"></a>04229 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a>(dst, xp, yp, color, iweight); <a name="l04230"></a>04230 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a>(dst, xx, yp, color, iweight); <a name="l04231"></a>04231 <a name="l04232"></a>04232 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a>(dst, xp, ys, color, weight); <a name="l04233"></a>04233 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a>(dst, xx, ys, color, weight); <a name="l04234"></a>04234 <a name="l04235"></a>04235 <span class="comment">/* Lower half */</span> <a name="l04236"></a>04236 yy = yc2 - yp; <a name="l04237"></a>04237 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a>(dst, xp, yy, color, iweight); <a name="l04238"></a>04238 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a>(dst, xx, yy, color, iweight); <a name="l04239"></a>04239 <a name="l04240"></a>04240 yy = yc2 - ys; <a name="l04241"></a>04241 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a>(dst, xp, yy, color, weight); <a name="l04242"></a>04242 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a>(dst, xx, yy, color, weight); <a name="l04243"></a>04243 } <a name="l04244"></a>04244 <a name="l04245"></a>04245 <span class="comment">/* Replaces original approximation code dyt = abs(yp - yc); */</span> <a name="l04246"></a>04246 dyt = (Sint16)lrint((<span class="keywordtype">double</span>)b2 / sab ) + od; <a name="l04247"></a>04247 <a name="l04248"></a>04248 <span class="keywordflow">for</span> (i = 1; i &lt;= dyt; i++) { <a name="l04249"></a>04249 yp++; <a name="l04250"></a>04250 d -= s + a2; <a name="l04251"></a>04251 <a name="l04252"></a>04252 <span class="keywordflow">if</span> (d &lt;= 0) <a name="l04253"></a>04253 xs = xp + 1; <a name="l04254"></a>04254 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((d + t - b2) &lt; 0) { <a name="l04255"></a>04255 <span class="keywordflow">if</span> ((2 * d + t - b2) &lt;= 0) <a name="l04256"></a>04256 xs = xp - 1; <a name="l04257"></a>04257 <span class="keywordflow">else</span> { <a name="l04258"></a>04258 xs = xp; <a name="l04259"></a>04259 xp--; <a name="l04260"></a>04260 d += t - b2; <a name="l04261"></a>04261 t -= dt; <a name="l04262"></a>04262 } <a name="l04263"></a>04263 } <span class="keywordflow">else</span> { <a name="l04264"></a>04264 xp--; <a name="l04265"></a>04265 xs = xp - 1; <a name="l04266"></a>04266 d += t - b2; <a name="l04267"></a>04267 t -= dt; <a name="l04268"></a>04268 } <a name="l04269"></a>04269 <a name="l04270"></a>04270 s += ds; <a name="l04271"></a>04271 <a name="l04272"></a>04272 <span class="comment">/* Calculate alpha */</span> <a name="l04273"></a>04273 <span class="keywordflow">if</span> (t != 0) { <a name="l04274"></a>04274 cp = (float) abs(d) / (float) abs(t); <a name="l04275"></a>04275 <span class="keywordflow">if</span> (cp &gt; 1.0) { <a name="l04276"></a>04276 cp = 1.0; <a name="l04277"></a>04277 } <a name="l04278"></a>04278 } <span class="keywordflow">else</span> { <a name="l04279"></a>04279 cp = 1.0; <a name="l04280"></a>04280 } <a name="l04281"></a>04281 <a name="l04282"></a>04282 <span class="comment">/* Calculate weight */</span> <a name="l04283"></a>04283 weight = (Uint8) (cp * 255); <a name="l04284"></a>04284 iweight = 255 - weight; <a name="l04285"></a>04285 <a name="l04286"></a>04286 <span class="comment">/* Left half */</span> <a name="l04287"></a>04287 xx = xc2 - xp; <a name="l04288"></a>04288 yy = yc2 - yp; <a name="l04289"></a>04289 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a>(dst, xp, yp, color, iweight); <a name="l04290"></a>04290 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a>(dst, xx, yp, color, iweight); <a name="l04291"></a>04291 <a name="l04292"></a>04292 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a>(dst, xp, yy, color, iweight); <a name="l04293"></a>04293 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a>(dst, xx, yy, color, iweight); <a name="l04294"></a>04294 <a name="l04295"></a>04295 <span class="comment">/* Right half */</span> <a name="l04296"></a>04296 xx = xc2 - xs; <a name="l04297"></a>04297 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a>(dst, xs, yp, color, weight); <a name="l04298"></a>04298 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a>(dst, xx, yp, color, weight); <a name="l04299"></a>04299 <a name="l04300"></a>04300 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a>(dst, xs, yy, color, weight); <a name="l04301"></a>04301 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1" title="Pixel draw with blending enabled and using alpha weight on color - no locking.">pixelColorWeightNolock</a>(dst, xx, yy, color, weight); <a name="l04302"></a>04302 <a name="l04303"></a>04303 } <a name="l04304"></a>04304 <a name="l04305"></a>04305 <span class="comment">/* Unlock surface */</span> <a name="l04306"></a>04306 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) { <a name="l04307"></a>04307 SDL_UnlockSurface(dst); <a name="l04308"></a>04308 } <a name="l04309"></a>04309 <a name="l04310"></a>04310 <span class="keywordflow">return</span> (result); <a name="l04311"></a>04311 } <a name="l04312"></a>04312 <a name="l04328"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#ab6db169d39ea972469e761f338153e21">04328</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#ab9f0f00d7fb2f04aa9ba1630e31a27bf" title="Draw anti-aliased ellipse with blending.">aaellipseRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l04329"></a>04329 { <a name="l04330"></a>04330 <span class="comment">/*</span> <a name="l04331"></a>04331 <span class="comment"> * Draw </span> <a name="l04332"></a>04332 <span class="comment"> */</span> <a name="l04333"></a>04333 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a1c7d20dcba8e0d7ce483f4c854c438be" title="Draw anti-aliased ellipse with blending.">aaellipseColor</a> <a name="l04334"></a>04334 (dst, x, y, rx, ry, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l04335"></a>04335 } <a name="l04336"></a>04336 <a name="l04337"></a>04337 <span class="comment">/* ---- Filled Ellipse */</span> <a name="l04338"></a>04338 <a name="l04339"></a>04339 <span class="comment">/* Note: */</span> <a name="l04340"></a>04340 <span class="comment">/* Based on algorithm from sge library with multiple-hline draw removal */</span> <a name="l04341"></a>04341 <span class="comment">/* and other speedup changes. */</span> <a name="l04342"></a>04342 <a name="l04358"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a36e83e5648b95d38d1efe98dcf840fab">04358</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a8fed50800f2f1bdfaa048698f5052f25" title="Draw filled ellipse with blending.">filledEllipseColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color) <a name="l04359"></a>04359 { <a name="l04360"></a>04360 Sint16 left, right, top, bottom; <a name="l04361"></a>04361 <span class="keywordtype">int</span> result; <a name="l04362"></a>04362 Sint16 x1, y1, x2, y2; <a name="l04363"></a>04363 <span class="keywordtype">int</span> ix, iy; <a name="l04364"></a>04364 <span class="keywordtype">int</span> h, i, j, k; <a name="l04365"></a>04365 <span class="keywordtype">int</span> oh, oi, oj, ok; <a name="l04366"></a>04366 <span class="keywordtype">int</span> xmh, xph; <a name="l04367"></a>04367 <span class="keywordtype">int</span> xmi, xpi; <a name="l04368"></a>04368 <span class="keywordtype">int</span> xmj, xpj; <a name="l04369"></a>04369 <span class="keywordtype">int</span> xmk, xpk; <a name="l04370"></a>04370 <a name="l04371"></a>04371 <span class="comment">/*</span> <a name="l04372"></a>04372 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l04373"></a>04373 <span class="comment"> */</span> <a name="l04374"></a>04374 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l04375"></a>04375 <span class="keywordflow">return</span>(0); <a name="l04376"></a>04376 } <a name="l04377"></a>04377 <a name="l04378"></a>04378 <span class="comment">/*</span> <a name="l04379"></a>04379 <span class="comment"> * Sanity check radii </span> <a name="l04380"></a>04380 <span class="comment"> */</span> <a name="l04381"></a>04381 <span class="keywordflow">if</span> ((rx &lt; 0) || (ry &lt; 0)) { <a name="l04382"></a>04382 <span class="keywordflow">return</span> (-1); <a name="l04383"></a>04383 } <a name="l04384"></a>04384 <a name="l04385"></a>04385 <span class="comment">/*</span> <a name="l04386"></a>04386 <span class="comment"> * Special case for rx=0 - draw a vline </span> <a name="l04387"></a>04387 <span class="comment"> */</span> <a name="l04388"></a>04388 <span class="keywordflow">if</span> (rx == 0) { <a name="l04389"></a>04389 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67" title="Draw vertical line with blending.">vlineColor</a>(dst, x, y - ry, y + ry, color)); <a name="l04390"></a>04390 } <a name="l04391"></a>04391 <span class="comment">/*</span> <a name="l04392"></a>04392 <span class="comment"> * Special case for ry=0 - draw a hline </span> <a name="l04393"></a>04393 <span class="comment"> */</span> <a name="l04394"></a>04394 <span class="keywordflow">if</span> (ry == 0) { <a name="l04395"></a>04395 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, x - rx, x + rx, y, color)); <a name="l04396"></a>04396 } <a name="l04397"></a>04397 <a name="l04398"></a>04398 <span class="comment">/*</span> <a name="l04399"></a>04399 <span class="comment"> * Get circle and clipping boundary and </span> <a name="l04400"></a>04400 <span class="comment"> * test if bounding box of circle is visible </span> <a name="l04401"></a>04401 <span class="comment"> */</span> <a name="l04402"></a>04402 x2 = x + rx; <a name="l04403"></a>04403 left = dst-&gt;clip_rect.x; <a name="l04404"></a>04404 <span class="keywordflow">if</span> (x2&lt;left) { <a name="l04405"></a>04405 <span class="keywordflow">return</span>(0); <a name="l04406"></a>04406 } <a name="l04407"></a>04407 x1 = x - rx; <a name="l04408"></a>04408 right = dst-&gt;clip_rect.x + dst-&gt;clip_rect.w - 1; <a name="l04409"></a>04409 <span class="keywordflow">if</span> (x1&gt;right) { <a name="l04410"></a>04410 <span class="keywordflow">return</span>(0); <a name="l04411"></a>04411 } <a name="l04412"></a>04412 y2 = y + ry; <a name="l04413"></a>04413 top = dst-&gt;clip_rect.y; <a name="l04414"></a>04414 <span class="keywordflow">if</span> (y2&lt;top) { <a name="l04415"></a>04415 <span class="keywordflow">return</span>(0); <a name="l04416"></a>04416 } <a name="l04417"></a>04417 y1 = y - ry; <a name="l04418"></a>04418 bottom = dst-&gt;clip_rect.y + dst-&gt;clip_rect.h - 1; <a name="l04419"></a>04419 <span class="keywordflow">if</span> (y1&gt;bottom) { <a name="l04420"></a>04420 <span class="keywordflow">return</span>(0); <a name="l04421"></a>04421 } <a name="l04422"></a>04422 <a name="l04423"></a>04423 <span class="comment">/*</span> <a name="l04424"></a>04424 <span class="comment"> * Init vars </span> <a name="l04425"></a>04425 <span class="comment"> */</span> <a name="l04426"></a>04426 oh = oi = oj = ok = 0xFFFF; <a name="l04427"></a>04427 <a name="l04428"></a>04428 <span class="comment">/*</span> <a name="l04429"></a>04429 <span class="comment"> * Draw </span> <a name="l04430"></a>04430 <span class="comment"> */</span> <a name="l04431"></a>04431 result = 0; <a name="l04432"></a>04432 <span class="keywordflow">if</span> (rx &gt; ry) { <a name="l04433"></a>04433 ix = 0; <a name="l04434"></a>04434 iy = rx * 64; <a name="l04435"></a>04435 <a name="l04436"></a>04436 <span class="keywordflow">do</span> { <a name="l04437"></a>04437 h = (ix + 32) &gt;&gt; 6; <a name="l04438"></a>04438 i = (iy + 32) &gt;&gt; 6; <a name="l04439"></a>04439 j = (h * ry) / rx; <a name="l04440"></a>04440 k = (i * ry) / rx; <a name="l04441"></a>04441 <a name="l04442"></a>04442 <span class="keywordflow">if</span> ((ok != k) &amp;&amp; (oj != k)) { <a name="l04443"></a>04443 xph = x + h; <a name="l04444"></a>04444 xmh = x - h; <a name="l04445"></a>04445 <span class="keywordflow">if</span> (k &gt; 0) { <a name="l04446"></a>04446 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xmh, xph, y + k, color); <a name="l04447"></a>04447 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xmh, xph, y - k, color); <a name="l04448"></a>04448 } <span class="keywordflow">else</span> { <a name="l04449"></a>04449 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xmh, xph, y, color); <a name="l04450"></a>04450 } <a name="l04451"></a>04451 ok = k; <a name="l04452"></a>04452 } <a name="l04453"></a>04453 <span class="keywordflow">if</span> ((oj != j) &amp;&amp; (ok != j) &amp;&amp; (k != j)) { <a name="l04454"></a>04454 xmi = x - i; <a name="l04455"></a>04455 xpi = x + i; <a name="l04456"></a>04456 <span class="keywordflow">if</span> (j &gt; 0) { <a name="l04457"></a>04457 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xmi, xpi, y + j, color); <a name="l04458"></a>04458 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xmi, xpi, y - j, color); <a name="l04459"></a>04459 } <span class="keywordflow">else</span> { <a name="l04460"></a>04460 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xmi, xpi, y, color); <a name="l04461"></a>04461 } <a name="l04462"></a>04462 oj = j; <a name="l04463"></a>04463 } <a name="l04464"></a>04464 <a name="l04465"></a>04465 ix = ix + iy / rx; <a name="l04466"></a>04466 iy = iy - ix / rx; <a name="l04467"></a>04467 <a name="l04468"></a>04468 } <span class="keywordflow">while</span> (i &gt; h); <a name="l04469"></a>04469 } <span class="keywordflow">else</span> { <a name="l04470"></a>04470 ix = 0; <a name="l04471"></a>04471 iy = ry * 64; <a name="l04472"></a>04472 <a name="l04473"></a>04473 <span class="keywordflow">do</span> { <a name="l04474"></a>04474 h = (ix + 32) &gt;&gt; 6; <a name="l04475"></a>04475 i = (iy + 32) &gt;&gt; 6; <a name="l04476"></a>04476 j = (h * rx) / ry; <a name="l04477"></a>04477 k = (i * rx) / ry; <a name="l04478"></a>04478 <a name="l04479"></a>04479 <span class="keywordflow">if</span> ((oi != i) &amp;&amp; (oh != i)) { <a name="l04480"></a>04480 xmj = x - j; <a name="l04481"></a>04481 xpj = x + j; <a name="l04482"></a>04482 <span class="keywordflow">if</span> (i &gt; 0) { <a name="l04483"></a>04483 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xmj, xpj, y + i, color); <a name="l04484"></a>04484 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xmj, xpj, y - i, color); <a name="l04485"></a>04485 } <span class="keywordflow">else</span> { <a name="l04486"></a>04486 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xmj, xpj, y, color); <a name="l04487"></a>04487 } <a name="l04488"></a>04488 oi = i; <a name="l04489"></a>04489 } <a name="l04490"></a>04490 <span class="keywordflow">if</span> ((oh != h) &amp;&amp; (oi != h) &amp;&amp; (i != h)) { <a name="l04491"></a>04491 xmk = x - k; <a name="l04492"></a>04492 xpk = x + k; <a name="l04493"></a>04493 <span class="keywordflow">if</span> (h &gt; 0) { <a name="l04494"></a>04494 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xmk, xpk, y + h, color); <a name="l04495"></a>04495 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xmk, xpk, y - h, color); <a name="l04496"></a>04496 } <span class="keywordflow">else</span> { <a name="l04497"></a>04497 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xmk, xpk, y, color); <a name="l04498"></a>04498 } <a name="l04499"></a>04499 oh = h; <a name="l04500"></a>04500 } <a name="l04501"></a>04501 <a name="l04502"></a>04502 ix = ix + iy / ry; <a name="l04503"></a>04503 iy = iy - ix / ry; <a name="l04504"></a>04504 <a name="l04505"></a>04505 } <span class="keywordflow">while</span> (i &gt; h); <a name="l04506"></a>04506 } <a name="l04507"></a>04507 <a name="l04508"></a>04508 <span class="keywordflow">return</span> (result); <a name="l04509"></a>04509 } <a name="l04510"></a>04510 <a name="l04526"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a26f01b9c0cf7a533023869dff439254f">04526</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a33595ad996dd0dcccde3abbcef540eec" title="Draw filled ellipse with blending.">filledEllipseRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l04527"></a>04527 { <a name="l04528"></a>04528 <span class="comment">/*</span> <a name="l04529"></a>04529 <span class="comment"> * Draw </span> <a name="l04530"></a>04530 <span class="comment"> */</span> <a name="l04531"></a>04531 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a8fed50800f2f1bdfaa048698f5052f25" title="Draw filled ellipse with blending.">filledEllipseColor</a> <a name="l04532"></a>04532 (dst, x, y, rx, ry, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l04533"></a>04533 } <a name="l04534"></a>04534 <a name="l04535"></a>04535 <span class="comment">/* ----- pie */</span> <a name="l04536"></a>04536 <a name="l04553"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#ac2e0cefca34b74c900cfa68e3915487b">04553</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac2e0cefca34b74c900cfa68e3915487b" title="Internal float (low-speed) pie-calc implementation by drawing polygons.">_pieColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color, Uint8 filled) <a name="l04554"></a>04554 { <a name="l04555"></a>04555 Sint16 left, right, top, bottom; <a name="l04556"></a>04556 Sint16 x1, y1, x2, y2; <a name="l04557"></a>04557 <span class="keywordtype">int</span> result; <a name="l04558"></a>04558 <span class="keywordtype">double</span> angle, start_angle, end_angle; <a name="l04559"></a>04559 <span class="keywordtype">double</span> deltaAngle; <a name="l04560"></a>04560 <span class="keywordtype">double</span> dr; <a name="l04561"></a>04561 <span class="keywordtype">int</span> numpoints, i; <a name="l04562"></a>04562 Sint16 *vx, *vy; <a name="l04563"></a>04563 <a name="l04564"></a>04564 <span class="comment">/*</span> <a name="l04565"></a>04565 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l04566"></a>04566 <span class="comment"> */</span> <a name="l04567"></a>04567 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l04568"></a>04568 <span class="keywordflow">return</span>(0); <a name="l04569"></a>04569 } <a name="l04570"></a>04570 <a name="l04571"></a>04571 <span class="comment">/*</span> <a name="l04572"></a>04572 <span class="comment"> * Sanity check radii </span> <a name="l04573"></a>04573 <span class="comment"> */</span> <a name="l04574"></a>04574 <span class="keywordflow">if</span> (rad &lt; 0) { <a name="l04575"></a>04575 <span class="keywordflow">return</span> (-1); <a name="l04576"></a>04576 } <a name="l04577"></a>04577 <a name="l04578"></a>04578 <span class="comment">/*</span> <a name="l04579"></a>04579 <span class="comment"> * Fixup angles</span> <a name="l04580"></a>04580 <span class="comment"> */</span> <a name="l04581"></a>04581 start = start % 360; <a name="l04582"></a>04582 end = end % 360; <a name="l04583"></a>04583 <a name="l04584"></a>04584 <span class="comment">/*</span> <a name="l04585"></a>04585 <span class="comment"> * Special case for rad=0 - draw a point </span> <a name="l04586"></a>04586 <span class="comment"> */</span> <a name="l04587"></a>04587 <span class="keywordflow">if</span> (rad == 0) { <a name="l04588"></a>04588 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ae6f8690e5c5a85d3263c8e16727b34ef" title="Pixel draw with blending enabled if a&lt;255.">pixelColor</a>(dst, x, y, color)); <a name="l04589"></a>04589 } <a name="l04590"></a>04590 <a name="l04591"></a>04591 <span class="comment">/*</span> <a name="l04592"></a>04592 <span class="comment"> * Clip against circle, not pie (not 100% optimal).</span> <a name="l04593"></a>04593 <span class="comment"> * Get pie&#39;s circle and clipping boundary and </span> <a name="l04594"></a>04594 <span class="comment"> * test if bounding box of circle is visible</span> <a name="l04595"></a>04595 <span class="comment"> */</span> <a name="l04596"></a>04596 x2 = x + rad; <a name="l04597"></a>04597 left = dst-&gt;clip_rect.x; <a name="l04598"></a>04598 <span class="keywordflow">if</span> (x2&lt;left) { <a name="l04599"></a>04599 <span class="keywordflow">return</span>(0); <a name="l04600"></a>04600 } <a name="l04601"></a>04601 x1 = x - rad; <a name="l04602"></a>04602 right = dst-&gt;clip_rect.x + dst-&gt;clip_rect.w - 1; <a name="l04603"></a>04603 <span class="keywordflow">if</span> (x1&gt;right) { <a name="l04604"></a>04604 <span class="keywordflow">return</span>(0); <a name="l04605"></a>04605 } <a name="l04606"></a>04606 y2 = y + rad; <a name="l04607"></a>04607 top = dst-&gt;clip_rect.y; <a name="l04608"></a>04608 <span class="keywordflow">if</span> (y2&lt;top) { <a name="l04609"></a>04609 <span class="keywordflow">return</span>(0); <a name="l04610"></a>04610 } <a name="l04611"></a>04611 y1 = y - rad; <a name="l04612"></a>04612 bottom = dst-&gt;clip_rect.y + dst-&gt;clip_rect.h - 1; <a name="l04613"></a>04613 <span class="keywordflow">if</span> (y1&gt;bottom) { <a name="l04614"></a>04614 <span class="keywordflow">return</span>(0); <a name="l04615"></a>04615 } <a name="l04616"></a>04616 <a name="l04617"></a>04617 <span class="comment">/*</span> <a name="l04618"></a>04618 <span class="comment"> * Variable setup </span> <a name="l04619"></a>04619 <span class="comment"> */</span> <a name="l04620"></a>04620 dr = (double) rad; <a name="l04621"></a>04621 deltaAngle = 3.0 / dr; <a name="l04622"></a>04622 start_angle = (double) start *(2.0 * <a class="code" href="_s_d_l__gfx_primitives_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">M_PI</a> / 360.0); <a name="l04623"></a>04623 end_angle = (double) end *(2.0 * <a class="code" href="_s_d_l__gfx_primitives_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">M_PI</a> / 360.0); <a name="l04624"></a>04624 <span class="keywordflow">if</span> (start &gt; end) { <a name="l04625"></a>04625 end_angle += (2.0 * <a class="code" href="_s_d_l__gfx_primitives_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">M_PI</a>); <a name="l04626"></a>04626 } <a name="l04627"></a>04627 <a name="l04628"></a>04628 <span class="comment">/* We will always have at least 2 points */</span> <a name="l04629"></a>04629 numpoints = 2; <a name="l04630"></a>04630 <a name="l04631"></a>04631 <span class="comment">/* Count points (rather than calculating it) */</span> <a name="l04632"></a>04632 angle = start_angle; <a name="l04633"></a>04633 <span class="keywordflow">while</span> (angle &lt; end_angle) { <a name="l04634"></a>04634 angle += deltaAngle; <a name="l04635"></a>04635 numpoints++; <a name="l04636"></a>04636 } <a name="l04637"></a>04637 <a name="l04638"></a>04638 <span class="comment">/* Allocate combined vertex array */</span> <a name="l04639"></a>04639 vx = vy = (Sint16 *) malloc(2 * <span class="keyword">sizeof</span>(Uint16) * numpoints); <a name="l04640"></a>04640 <span class="keywordflow">if</span> (vx == NULL) { <a name="l04641"></a>04641 <span class="keywordflow">return</span> (-1); <a name="l04642"></a>04642 } <a name="l04643"></a>04643 <a name="l04644"></a>04644 <span class="comment">/* Update point to start of vy */</span> <a name="l04645"></a>04645 vy += numpoints; <a name="l04646"></a>04646 <a name="l04647"></a>04647 <span class="comment">/* Center */</span> <a name="l04648"></a>04648 vx[0] = x; <a name="l04649"></a>04649 vy[0] = y; <a name="l04650"></a>04650 <a name="l04651"></a>04651 <span class="comment">/* First vertex */</span> <a name="l04652"></a>04652 angle = start_angle; <a name="l04653"></a>04653 vx[1] = x + (int) (dr * cos(angle)); <a name="l04654"></a>04654 vy[1] = y + (int) (dr * sin(angle)); <a name="l04655"></a>04655 <a name="l04656"></a>04656 <span class="keywordflow">if</span> (numpoints&lt;3) <a name="l04657"></a>04657 { <a name="l04658"></a>04658 result = <a class="code" href="_s_d_l__gfx_primitives_8c.html#ad44c550fab3cb736eb049713ede94052" title="Draw line with alpha blending.">lineColor</a>(dst, vx[0], vy[0], vx[1], vy[1], color); <a name="l04659"></a>04659 } <a name="l04660"></a>04660 <span class="keywordflow">else</span> <a name="l04661"></a>04661 { <a name="l04662"></a>04662 <span class="comment">/* Calculate other vertices */</span> <a name="l04663"></a>04663 i = 2; <a name="l04664"></a>04664 angle = start_angle; <a name="l04665"></a>04665 <span class="keywordflow">while</span> (angle &lt; end_angle) { <a name="l04666"></a>04666 angle += deltaAngle; <a name="l04667"></a>04667 <span class="keywordflow">if</span> (angle&gt;end_angle) <a name="l04668"></a>04668 { <a name="l04669"></a>04669 angle = end_angle; <a name="l04670"></a>04670 } <a name="l04671"></a>04671 vx[i] = x + (int) (dr * cos(angle)); <a name="l04672"></a>04672 vy[i] = y + (int) (dr * sin(angle)); <a name="l04673"></a>04673 i++; <a name="l04674"></a>04674 } <a name="l04675"></a>04675 <a name="l04676"></a>04676 <span class="comment">/* Draw */</span> <a name="l04677"></a>04677 <span class="keywordflow">if</span> (filled) { <a name="l04678"></a>04678 result = <a class="code" href="_s_d_l__gfx_primitives_8c.html#af22692175cb73329410cbcc7d7491c4d" title="Draw filled polygon with alpha blending.">filledPolygonColor</a>(dst, vx, vy, numpoints, color); <a name="l04679"></a>04679 } <span class="keywordflow">else</span> { <a name="l04680"></a>04680 result = <a class="code" href="_s_d_l__gfx_primitives_8c.html#a2d692dc25f3b579b386dff8dcd9cbc00" title="Draw polygon with alpha blending.">polygonColor</a>(dst, vx, vy, numpoints, color); <a name="l04681"></a>04681 } <a name="l04682"></a>04682 } <a name="l04683"></a>04683 <a name="l04684"></a>04684 <span class="comment">/* Free combined vertex array */</span> <a name="l04685"></a>04685 free(vx); <a name="l04686"></a>04686 <a name="l04687"></a>04687 <span class="keywordflow">return</span> (result); <a name="l04688"></a>04688 } <a name="l04689"></a>04689 <a name="l04703"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a6476d5dad22631d10c1dc95b0e88fc65">04703</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a3c2bc64deabda74933f31daba6bed7be" title="Draw pie (outline) with alpha blending.">pieColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, <a name="l04704"></a>04704 Sint16 start, Sint16 end, Uint32 color) <a name="l04705"></a>04705 { <a name="l04706"></a>04706 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ac2e0cefca34b74c900cfa68e3915487b" title="Internal float (low-speed) pie-calc implementation by drawing polygons.">_pieColor</a>(dst, x, y, rad, start, end, color, 0)); <a name="l04707"></a>04707 <a name="l04708"></a>04708 } <a name="l04709"></a>04709 <a name="l04726"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a4a5e4344913667e714560dd204473663">04726</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a8442f2c2bedbe27c96d8d44319981992" title="Draw pie (outline) with alpha blending.">pieRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, <a name="l04727"></a>04727 Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l04728"></a>04728 { <a name="l04729"></a>04729 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ac2e0cefca34b74c900cfa68e3915487b" title="Internal float (low-speed) pie-calc implementation by drawing polygons.">_pieColor</a>(dst, x, y, rad, start, end, <a name="l04730"></a>04730 ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a, 0)); <a name="l04731"></a>04731 <a name="l04732"></a>04732 } <a name="l04733"></a>04733 <a name="l04747"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a8f18679aa7161f885613ec08e7f41692">04747</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a2c30ee985b2513dc58d9b19d4e71562b" title="Draw filled pie with alpha blending.">filledPieColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color) <a name="l04748"></a>04748 { <a name="l04749"></a>04749 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ac2e0cefca34b74c900cfa68e3915487b" title="Internal float (low-speed) pie-calc implementation by drawing polygons.">_pieColor</a>(dst, x, y, rad, start, end, color, 1)); <a name="l04750"></a>04750 } <a name="l04751"></a>04751 <a name="l04768"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a1944c066d27fa9847a5fdecd1d3b9116">04768</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a4ffdfd2834f3ef0fd0ee622b5f1d16b8" title="Draw filled pie with alpha blending.">filledPieRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, <a name="l04769"></a>04769 Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l04770"></a>04770 { <a name="l04771"></a>04771 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#ac2e0cefca34b74c900cfa68e3915487b" title="Internal float (low-speed) pie-calc implementation by drawing polygons.">_pieColor</a>(dst, x, y, rad, start, end, <a name="l04772"></a>04772 ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a, 1)); <a name="l04773"></a>04773 } <a name="l04774"></a>04774 <a name="l04775"></a>04775 <span class="comment">/* ------ Trigon */</span> <a name="l04776"></a>04776 <a name="l04793"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#aec2a0c435b879a29167be6b1c49f1e49">04793</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a7465d08ef930ebb5442c7dd246fed4b5" title="Draw trigon (triangle outline) with alpha blending.">trigonColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color) <a name="l04794"></a>04794 { <a name="l04795"></a>04795 Sint16 vx[3]; <a name="l04796"></a>04796 Sint16 vy[3]; <a name="l04797"></a>04797 <a name="l04798"></a>04798 vx[0]=x1; <a name="l04799"></a>04799 vx[1]=x2; <a name="l04800"></a>04800 vx[2]=x3; <a name="l04801"></a>04801 vy[0]=y1; <a name="l04802"></a>04802 vy[1]=y2; <a name="l04803"></a>04803 vy[2]=y3; <a name="l04804"></a>04804 <a name="l04805"></a>04805 <span class="keywordflow">return</span>(<a class="code" href="_s_d_l__gfx_primitives_8c.html#a2d692dc25f3b579b386dff8dcd9cbc00" title="Draw polygon with alpha blending.">polygonColor</a>(dst,vx,vy,3,color)); <a name="l04806"></a>04806 } <a name="l04807"></a>04807 <a name="l04825"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a090024f5f3e38b02b0bca704259b9d11">04825</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a45d6a7edcd8b25e1a60e39b7f60bda3f" title="Draw trigon (triangle outline) with alpha blending.">trigonRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, <a name="l04826"></a>04826 Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l04827"></a>04827 { <a name="l04828"></a>04828 Sint16 vx[3]; <a name="l04829"></a>04829 Sint16 vy[3]; <a name="l04830"></a>04830 <a name="l04831"></a>04831 vx[0]=x1; <a name="l04832"></a>04832 vx[1]=x2; <a name="l04833"></a>04833 vx[2]=x3; <a name="l04834"></a>04834 vy[0]=y1; <a name="l04835"></a>04835 vy[1]=y2; <a name="l04836"></a>04836 vy[2]=y3; <a name="l04837"></a>04837 <a name="l04838"></a>04838 <span class="keywordflow">return</span>(<a class="code" href="_s_d_l__gfx_primitives_8c.html#ae55541ec58990420dc6dc6b9d61f33d6" title="Draw polygon with alpha blending.">polygonRGBA</a>(dst,vx,vy,3,r,g,b,a)); <a name="l04839"></a>04839 } <a name="l04840"></a>04840 <a name="l04841"></a>04841 <span class="comment">/* ------ AA-Trigon */</span> <a name="l04842"></a>04842 <a name="l04859"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a330917705809bb5f7d74ef232dde5f12">04859</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a4f928dfaef530c83e304a452d2e55190" title="Draw anti-aliased trigon (triangle outline) with alpha blending.">aatrigonColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color) <a name="l04860"></a>04860 { <a name="l04861"></a>04861 Sint16 vx[3]; <a name="l04862"></a>04862 Sint16 vy[3]; <a name="l04863"></a>04863 <a name="l04864"></a>04864 vx[0]=x1; <a name="l04865"></a>04865 vx[1]=x2; <a name="l04866"></a>04866 vx[2]=x3; <a name="l04867"></a>04867 vy[0]=y1; <a name="l04868"></a>04868 vy[1]=y2; <a name="l04869"></a>04869 vy[2]=y3; <a name="l04870"></a>04870 <a name="l04871"></a>04871 <span class="keywordflow">return</span>(<a class="code" href="_s_d_l__gfx_primitives_8c.html#a09950a50e8806e88bb20c543c58cc6a8" title="Draw anti-aliased polygon with alpha blending.">aapolygonColor</a>(dst,vx,vy,3,color)); <a name="l04872"></a>04872 } <a name="l04873"></a>04873 <a name="l04891"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a5e88106c90fc2e0e25d0f7617459d4f9">04891</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#ab53a84faa65b68e40cb68b8cacbb4b7d" title="Draw anti-aliased trigon (triangle outline) with alpha blending.">aatrigonRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, <a name="l04892"></a>04892 Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l04893"></a>04893 { <a name="l04894"></a>04894 Sint16 vx[3]; <a name="l04895"></a>04895 Sint16 vy[3]; <a name="l04896"></a>04896 <a name="l04897"></a>04897 vx[0]=x1; <a name="l04898"></a>04898 vx[1]=x2; <a name="l04899"></a>04899 vx[2]=x3; <a name="l04900"></a>04900 vy[0]=y1; <a name="l04901"></a>04901 vy[1]=y2; <a name="l04902"></a>04902 vy[2]=y3; <a name="l04903"></a>04903 <a name="l04904"></a>04904 <span class="keywordflow">return</span>(<a class="code" href="_s_d_l__gfx_primitives_8c.html#a7d08522e52d8290c5c498ce435fa51f0" title="Draw anti-aliased polygon with alpha blending.">aapolygonRGBA</a>(dst,vx,vy,3,r,g,b,a)); <a name="l04905"></a>04905 } <a name="l04906"></a>04906 <a name="l04907"></a>04907 <span class="comment">/* ------ Filled Trigon */</span> <a name="l04908"></a>04908 <a name="l04925"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a6adaf54b33bf067e4fe2cc5a7ae17ef6">04925</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a78d4ed2372527f3b78f5893928b0f519" title="Draw filled trigon (triangle) with alpha blending.">filledTrigonColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color) <a name="l04926"></a>04926 { <a name="l04927"></a>04927 Sint16 vx[3]; <a name="l04928"></a>04928 Sint16 vy[3]; <a name="l04929"></a>04929 <a name="l04930"></a>04930 vx[0]=x1; <a name="l04931"></a>04931 vx[1]=x2; <a name="l04932"></a>04932 vx[2]=x3; <a name="l04933"></a>04933 vy[0]=y1; <a name="l04934"></a>04934 vy[1]=y2; <a name="l04935"></a>04935 vy[2]=y3; <a name="l04936"></a>04936 <a name="l04937"></a>04937 <span class="keywordflow">return</span>(<a class="code" href="_s_d_l__gfx_primitives_8c.html#af22692175cb73329410cbcc7d7491c4d" title="Draw filled polygon with alpha blending.">filledPolygonColor</a>(dst,vx,vy,3,color)); <a name="l04938"></a>04938 } <a name="l04939"></a>04939 <a name="l04959"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a4a3318a183659aab7c12c0334e261837">04959</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a8f318d776ff1e3c6790405e0e59e5356" title="Draw filled trigon (triangle) with alpha blending.">filledTrigonRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, <a name="l04960"></a>04960 Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l04961"></a>04961 { <a name="l04962"></a>04962 Sint16 vx[3]; <a name="l04963"></a>04963 Sint16 vy[3]; <a name="l04964"></a>04964 <a name="l04965"></a>04965 vx[0]=x1; <a name="l04966"></a>04966 vx[1]=x2; <a name="l04967"></a>04967 vx[2]=x3; <a name="l04968"></a>04968 vy[0]=y1; <a name="l04969"></a>04969 vy[1]=y2; <a name="l04970"></a>04970 vy[2]=y3; <a name="l04971"></a>04971 <a name="l04972"></a>04972 <span class="keywordflow">return</span>(<a class="code" href="_s_d_l__gfx_primitives_8c.html#a40ef0b898905c190c193f0f55deb5a6c" title="Draw filled polygon with alpha blending.">filledPolygonRGBA</a>(dst,vx,vy,3,r,g,b,a)); <a name="l04973"></a>04973 } <a name="l04974"></a>04974 <a name="l04975"></a>04975 <span class="comment">/* ---- Polygon */</span> <a name="l04976"></a>04976 <a name="l04988"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#abe5d0b2f6193558798eaff3e85e7a1af">04988</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a2d692dc25f3b579b386dff8dcd9cbc00" title="Draw polygon with alpha blending.">polygonColor</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, Uint32 color) <a name="l04989"></a>04989 { <a name="l04990"></a>04990 <span class="keywordtype">int</span> result; <a name="l04991"></a>04991 <span class="keywordtype">int</span> i; <a name="l04992"></a>04992 <span class="keyword">const</span> Sint16 *x1, *y1, *x2, *y2; <a name="l04993"></a>04993 <a name="l04994"></a>04994 <span class="comment">/*</span> <a name="l04995"></a>04995 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l04996"></a>04996 <span class="comment"> */</span> <a name="l04997"></a>04997 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l04998"></a>04998 <span class="keywordflow">return</span>(0); <a name="l04999"></a>04999 } <a name="l05000"></a>05000 <a name="l05001"></a>05001 <span class="comment">/*</span> <a name="l05002"></a>05002 <span class="comment"> * Vertex array NULL check </span> <a name="l05003"></a>05003 <span class="comment"> */</span> <a name="l05004"></a>05004 <span class="keywordflow">if</span> (vx == NULL) { <a name="l05005"></a>05005 <span class="keywordflow">return</span> (-1); <a name="l05006"></a>05006 } <a name="l05007"></a>05007 <span class="keywordflow">if</span> (vy == NULL) { <a name="l05008"></a>05008 <span class="keywordflow">return</span> (-1); <a name="l05009"></a>05009 } <a name="l05010"></a>05010 <a name="l05011"></a>05011 <span class="comment">/*</span> <a name="l05012"></a>05012 <span class="comment"> * Sanity check </span> <a name="l05013"></a>05013 <span class="comment"> */</span> <a name="l05014"></a>05014 <span class="keywordflow">if</span> (n &lt; 3) { <a name="l05015"></a>05015 <span class="keywordflow">return</span> (-1); <a name="l05016"></a>05016 } <a name="l05017"></a>05017 <a name="l05018"></a>05018 <span class="comment">/*</span> <a name="l05019"></a>05019 <span class="comment"> * Pointer setup </span> <a name="l05020"></a>05020 <span class="comment"> */</span> <a name="l05021"></a>05021 x1 = x2 = vx; <a name="l05022"></a>05022 y1 = y2 = vy; <a name="l05023"></a>05023 x2++; <a name="l05024"></a>05024 y2++; <a name="l05025"></a>05025 <a name="l05026"></a>05026 <span class="comment">/*</span> <a name="l05027"></a>05027 <span class="comment"> * Draw </span> <a name="l05028"></a>05028 <span class="comment"> */</span> <a name="l05029"></a>05029 result = 0; <a name="l05030"></a>05030 <span class="keywordflow">for</span> (i = 1; i &lt; n; i++) { <a name="l05031"></a>05031 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ad44c550fab3cb736eb049713ede94052" title="Draw line with alpha blending.">lineColor</a>(dst, *x1, *y1, *x2, *y2, color); <a name="l05032"></a>05032 x1 = x2; <a name="l05033"></a>05033 y1 = y2; <a name="l05034"></a>05034 x2++; <a name="l05035"></a>05035 y2++; <a name="l05036"></a>05036 } <a name="l05037"></a>05037 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ad44c550fab3cb736eb049713ede94052" title="Draw line with alpha blending.">lineColor</a>(dst, *x1, *y1, *vx, *vy, color); <a name="l05038"></a>05038 <a name="l05039"></a>05039 <span class="keywordflow">return</span> (result); <a name="l05040"></a>05040 } <a name="l05041"></a>05041 <a name="l05056"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a46b327da5cba5d401cf400bdef7560d0">05056</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae55541ec58990420dc6dc6b9d61f33d6" title="Draw polygon with alpha blending.">polygonRGBA</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l05057"></a>05057 { <a name="l05058"></a>05058 <span class="comment">/*</span> <a name="l05059"></a>05059 <span class="comment"> * Draw </span> <a name="l05060"></a>05060 <span class="comment"> */</span> <a name="l05061"></a>05061 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a2d692dc25f3b579b386dff8dcd9cbc00" title="Draw polygon with alpha blending.">polygonColor</a>(dst, vx, vy, n, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l05062"></a>05062 } <a name="l05063"></a>05063 <a name="l05064"></a>05064 <span class="comment">/* ---- AA-Polygon */</span> <a name="l05065"></a>05065 <a name="l05077"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#acee2be5e220639d3e5c5bc643e091c1c">05077</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a09950a50e8806e88bb20c543c58cc6a8" title="Draw anti-aliased polygon with alpha blending.">aapolygonColor</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, Uint32 color) <a name="l05078"></a>05078 { <a name="l05079"></a>05079 <span class="keywordtype">int</span> result; <a name="l05080"></a>05080 <span class="keywordtype">int</span> i; <a name="l05081"></a>05081 <span class="keyword">const</span> Sint16 *x1, *y1, *x2, *y2; <a name="l05082"></a>05082 <a name="l05083"></a>05083 <span class="comment">/*</span> <a name="l05084"></a>05084 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l05085"></a>05085 <span class="comment"> */</span> <a name="l05086"></a>05086 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l05087"></a>05087 <span class="keywordflow">return</span>(0); <a name="l05088"></a>05088 } <a name="l05089"></a>05089 <a name="l05090"></a>05090 <span class="comment">/*</span> <a name="l05091"></a>05091 <span class="comment"> * Vertex array NULL check </span> <a name="l05092"></a>05092 <span class="comment"> */</span> <a name="l05093"></a>05093 <span class="keywordflow">if</span> (vx == NULL) { <a name="l05094"></a>05094 <span class="keywordflow">return</span> (-1); <a name="l05095"></a>05095 } <a name="l05096"></a>05096 <span class="keywordflow">if</span> (vy == NULL) { <a name="l05097"></a>05097 <span class="keywordflow">return</span> (-1); <a name="l05098"></a>05098 } <a name="l05099"></a>05099 <a name="l05100"></a>05100 <span class="comment">/*</span> <a name="l05101"></a>05101 <span class="comment"> * Sanity check </span> <a name="l05102"></a>05102 <span class="comment"> */</span> <a name="l05103"></a>05103 <span class="keywordflow">if</span> (n &lt; 3) { <a name="l05104"></a>05104 <span class="keywordflow">return</span> (-1); <a name="l05105"></a>05105 } <a name="l05106"></a>05106 <a name="l05107"></a>05107 <span class="comment">/*</span> <a name="l05108"></a>05108 <span class="comment"> * Pointer setup </span> <a name="l05109"></a>05109 <span class="comment"> */</span> <a name="l05110"></a>05110 x1 = x2 = vx; <a name="l05111"></a>05111 y1 = y2 = vy; <a name="l05112"></a>05112 x2++; <a name="l05113"></a>05113 y2++; <a name="l05114"></a>05114 <a name="l05115"></a>05115 <span class="comment">/*</span> <a name="l05116"></a>05116 <span class="comment"> * Draw </span> <a name="l05117"></a>05117 <span class="comment"> */</span> <a name="l05118"></a>05118 result = 0; <a name="l05119"></a>05119 <span class="keywordflow">for</span> (i = 1; i &lt; n; i++) { <a name="l05120"></a>05120 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a41cb32b84aee2742fabd5bbaced8e016" title="Internal function to draw anti-aliased line with alpha blending and endpoint control.">_aalineColor</a>(dst, *x1, *y1, *x2, *y2, color, 0); <a name="l05121"></a>05121 x1 = x2; <a name="l05122"></a>05122 y1 = y2; <a name="l05123"></a>05123 x2++; <a name="l05124"></a>05124 y2++; <a name="l05125"></a>05125 } <a name="l05126"></a>05126 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#a41cb32b84aee2742fabd5bbaced8e016" title="Internal function to draw anti-aliased line with alpha blending and endpoint control.">_aalineColor</a>(dst, *x1, *y1, *vx, *vy, color, 0); <a name="l05127"></a>05127 <a name="l05128"></a>05128 <span class="keywordflow">return</span> (result); <a name="l05129"></a>05129 } <a name="l05130"></a>05130 <a name="l05145"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#aad73d6fc11bb01946d0ffe1c9d657cb1">05145</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a7d08522e52d8290c5c498ce435fa51f0" title="Draw anti-aliased polygon with alpha blending.">aapolygonRGBA</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l05146"></a>05146 { <a name="l05147"></a>05147 <span class="comment">/*</span> <a name="l05148"></a>05148 <span class="comment"> * Draw </span> <a name="l05149"></a>05149 <span class="comment"> */</span> <a name="l05150"></a>05150 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a09950a50e8806e88bb20c543c58cc6a8" title="Draw anti-aliased polygon with alpha blending.">aapolygonColor</a>(dst, vx, vy, n, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l05151"></a>05151 } <a name="l05152"></a>05152 <a name="l05153"></a>05153 <span class="comment">/* ---- Filled Polygon */</span> <a name="l05154"></a>05154 <a name="l05163"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#aeba347cfe2561fdb7f86d995a941ff1a">05163</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#aeba347cfe2561fdb7f86d995a941ff1a" title="Internal helper qsort callback functions used in filled polygon drawing.">_gfxPrimitivesCompareInt</a>(<span class="keyword">const</span> <span class="keywordtype">void</span> *a, <span class="keyword">const</span> <span class="keywordtype">void</span> *b) <a name="l05164"></a>05164 { <a name="l05165"></a>05165 <span class="keywordflow">return</span> (*(<span class="keyword">const</span> <span class="keywordtype">int</span> *) a) - (*(<span class="keyword">const</span> <span class="keywordtype">int</span> *) b); <a name="l05166"></a>05166 } <a name="l05167"></a>05167 <a name="l05173"></a>05173 <span class="keyword">static</span> <span class="keywordtype">int</span> *gfxPrimitivesPolyIntsGlobal = NULL; <a name="l05174"></a>05174 <a name="l05180"></a>05180 <span class="keyword">static</span> <span class="keywordtype">int</span> gfxPrimitivesPolyAllocatedGlobal = 0; <a name="l05181"></a>05181 <a name="l05197"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a0f5583d5b055f3e59a9692ca8a9dfbcf">05197</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a1f3a2dcda741a2c29b5dacce4ffe0271" title="Draw filled polygon with alpha blending (multi-threaded capable).">filledPolygonColorMT</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, Uint32 color, <span class="keywordtype">int</span> **polyInts, <span class="keywordtype">int</span> *polyAllocated) <a name="l05198"></a>05198 { <a name="l05199"></a>05199 <span class="keywordtype">int</span> result; <a name="l05200"></a>05200 <span class="keywordtype">int</span> i; <a name="l05201"></a>05201 <span class="keywordtype">int</span> y, xa, xb; <a name="l05202"></a>05202 <span class="keywordtype">int</span> miny, maxy; <a name="l05203"></a>05203 <span class="keywordtype">int</span> x1, y1; <a name="l05204"></a>05204 <span class="keywordtype">int</span> x2, y2; <a name="l05205"></a>05205 <span class="keywordtype">int</span> ind1, ind2; <a name="l05206"></a>05206 <span class="keywordtype">int</span> ints; <a name="l05207"></a>05207 <span class="keywordtype">int</span> *gfxPrimitivesPolyInts = NULL; <a name="l05208"></a>05208 <span class="keywordtype">int</span> *gfxPrimitivesPolyIntsNew = NULL; <a name="l05209"></a>05209 <span class="keywordtype">int</span> gfxPrimitivesPolyAllocated = 0; <a name="l05210"></a>05210 <a name="l05211"></a>05211 <span class="comment">/*</span> <a name="l05212"></a>05212 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l05213"></a>05213 <span class="comment"> */</span> <a name="l05214"></a>05214 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l05215"></a>05215 <span class="keywordflow">return</span>(0); <a name="l05216"></a>05216 } <a name="l05217"></a>05217 <a name="l05218"></a>05218 <span class="comment">/*</span> <a name="l05219"></a>05219 <span class="comment"> * Vertex array NULL check </span> <a name="l05220"></a>05220 <span class="comment"> */</span> <a name="l05221"></a>05221 <span class="keywordflow">if</span> (vx == NULL) { <a name="l05222"></a>05222 <span class="keywordflow">return</span> (-1); <a name="l05223"></a>05223 } <a name="l05224"></a>05224 <span class="keywordflow">if</span> (vy == NULL) { <a name="l05225"></a>05225 <span class="keywordflow">return</span> (-1); <a name="l05226"></a>05226 } <a name="l05227"></a>05227 <a name="l05228"></a>05228 <span class="comment">/*</span> <a name="l05229"></a>05229 <span class="comment"> * Sanity check number of edges</span> <a name="l05230"></a>05230 <span class="comment"> */</span> <a name="l05231"></a>05231 <span class="keywordflow">if</span> (n &lt; 3) { <a name="l05232"></a>05232 <span class="keywordflow">return</span> -1; <a name="l05233"></a>05233 } <a name="l05234"></a>05234 <a name="l05235"></a>05235 <span class="comment">/*</span> <a name="l05236"></a>05236 <span class="comment"> * Map polygon cache </span> <a name="l05237"></a>05237 <span class="comment"> */</span> <a name="l05238"></a>05238 <span class="keywordflow">if</span> ((polyInts==NULL) || (polyAllocated==NULL)) { <a name="l05239"></a>05239 <span class="comment">/* Use global cache */</span> <a name="l05240"></a>05240 gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsGlobal; <a name="l05241"></a>05241 gfxPrimitivesPolyAllocated = gfxPrimitivesPolyAllocatedGlobal; <a name="l05242"></a>05242 } <span class="keywordflow">else</span> { <a name="l05243"></a>05243 <span class="comment">/* Use local cache */</span> <a name="l05244"></a>05244 gfxPrimitivesPolyInts = *polyInts; <a name="l05245"></a>05245 gfxPrimitivesPolyAllocated = *polyAllocated; <a name="l05246"></a>05246 } <a name="l05247"></a>05247 <a name="l05248"></a>05248 <span class="comment">/*</span> <a name="l05249"></a>05249 <span class="comment"> * Allocate temp array, only grow array </span> <a name="l05250"></a>05250 <span class="comment"> */</span> <a name="l05251"></a>05251 <span class="keywordflow">if</span> (!gfxPrimitivesPolyAllocated) { <a name="l05252"></a>05252 gfxPrimitivesPolyInts = (<span class="keywordtype">int</span> *) malloc(<span class="keyword">sizeof</span>(<span class="keywordtype">int</span>) * n); <a name="l05253"></a>05253 gfxPrimitivesPolyAllocated = n; <a name="l05254"></a>05254 } <span class="keywordflow">else</span> { <a name="l05255"></a>05255 <span class="keywordflow">if</span> (gfxPrimitivesPolyAllocated &lt; n) { <a name="l05256"></a>05256 gfxPrimitivesPolyIntsNew = (<span class="keywordtype">int</span> *) realloc(gfxPrimitivesPolyInts, <span class="keyword">sizeof</span>(<span class="keywordtype">int</span>) * n); <a name="l05257"></a>05257 <span class="keywordflow">if</span> (!gfxPrimitivesPolyIntsNew) { <a name="l05258"></a>05258 <span class="keywordflow">if</span> (!gfxPrimitivesPolyInts) { <a name="l05259"></a>05259 free(gfxPrimitivesPolyInts); <a name="l05260"></a>05260 gfxPrimitivesPolyInts = NULL; <a name="l05261"></a>05261 } <a name="l05262"></a>05262 gfxPrimitivesPolyAllocated = 0; <a name="l05263"></a>05263 } <span class="keywordflow">else</span> { <a name="l05264"></a>05264 gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsNew; <a name="l05265"></a>05265 gfxPrimitivesPolyAllocated = n; <a name="l05266"></a>05266 } <a name="l05267"></a>05267 } <a name="l05268"></a>05268 } <a name="l05269"></a>05269 <a name="l05270"></a>05270 <span class="comment">/*</span> <a name="l05271"></a>05271 <span class="comment"> * Check temp array</span> <a name="l05272"></a>05272 <span class="comment"> */</span> <a name="l05273"></a>05273 <span class="keywordflow">if</span> (gfxPrimitivesPolyInts==NULL) { <a name="l05274"></a>05274 gfxPrimitivesPolyAllocated = 0; <a name="l05275"></a>05275 } <a name="l05276"></a>05276 <a name="l05277"></a>05277 <span class="comment">/*</span> <a name="l05278"></a>05278 <span class="comment"> * Update cache variables</span> <a name="l05279"></a>05279 <span class="comment"> */</span> <a name="l05280"></a>05280 <span class="keywordflow">if</span> ((polyInts==NULL) || (polyAllocated==NULL)) { <a name="l05281"></a>05281 gfxPrimitivesPolyIntsGlobal = gfxPrimitivesPolyInts; <a name="l05282"></a>05282 gfxPrimitivesPolyAllocatedGlobal = gfxPrimitivesPolyAllocated; <a name="l05283"></a>05283 } <span class="keywordflow">else</span> { <a name="l05284"></a>05284 *polyInts = gfxPrimitivesPolyInts; <a name="l05285"></a>05285 *polyAllocated = gfxPrimitivesPolyAllocated; <a name="l05286"></a>05286 } <a name="l05287"></a>05287 <a name="l05288"></a>05288 <span class="comment">/*</span> <a name="l05289"></a>05289 <span class="comment"> * Check temp array again</span> <a name="l05290"></a>05290 <span class="comment"> */</span> <a name="l05291"></a>05291 <span class="keywordflow">if</span> (gfxPrimitivesPolyInts==NULL) { <a name="l05292"></a>05292 <span class="keywordflow">return</span>(-1); <a name="l05293"></a>05293 } <a name="l05294"></a>05294 <a name="l05295"></a>05295 <span class="comment">/*</span> <a name="l05296"></a>05296 <span class="comment"> * Determine Y maxima </span> <a name="l05297"></a>05297 <span class="comment"> */</span> <a name="l05298"></a>05298 miny = vy[0]; <a name="l05299"></a>05299 maxy = vy[0]; <a name="l05300"></a>05300 <span class="keywordflow">for</span> (i = 1; (i &lt; n); i++) { <a name="l05301"></a>05301 <span class="keywordflow">if</span> (vy[i] &lt; miny) { <a name="l05302"></a>05302 miny = vy[i]; <a name="l05303"></a>05303 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (vy[i] &gt; maxy) { <a name="l05304"></a>05304 maxy = vy[i]; <a name="l05305"></a>05305 } <a name="l05306"></a>05306 } <a name="l05307"></a>05307 <a name="l05308"></a>05308 <span class="comment">/*</span> <a name="l05309"></a>05309 <span class="comment"> * Draw, scanning y </span> <a name="l05310"></a>05310 <span class="comment"> */</span> <a name="l05311"></a>05311 result = 0; <a name="l05312"></a>05312 <span class="keywordflow">for</span> (y = miny; (y &lt;= maxy); y++) { <a name="l05313"></a>05313 ints = 0; <a name="l05314"></a>05314 <span class="keywordflow">for</span> (i = 0; (i &lt; n); i++) { <a name="l05315"></a>05315 <span class="keywordflow">if</span> (!i) { <a name="l05316"></a>05316 ind1 = n - 1; <a name="l05317"></a>05317 ind2 = 0; <a name="l05318"></a>05318 } <span class="keywordflow">else</span> { <a name="l05319"></a>05319 ind1 = i - 1; <a name="l05320"></a>05320 ind2 = i; <a name="l05321"></a>05321 } <a name="l05322"></a>05322 y1 = vy[ind1]; <a name="l05323"></a>05323 y2 = vy[ind2]; <a name="l05324"></a>05324 <span class="keywordflow">if</span> (y1 &lt; y2) { <a name="l05325"></a>05325 x1 = vx[ind1]; <a name="l05326"></a>05326 x2 = vx[ind2]; <a name="l05327"></a>05327 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (y1 &gt; y2) { <a name="l05328"></a>05328 y2 = vy[ind1]; <a name="l05329"></a>05329 y1 = vy[ind2]; <a name="l05330"></a>05330 x2 = vx[ind1]; <a name="l05331"></a>05331 x1 = vx[ind2]; <a name="l05332"></a>05332 } <span class="keywordflow">else</span> { <a name="l05333"></a>05333 <span class="keywordflow">continue</span>; <a name="l05334"></a>05334 } <a name="l05335"></a>05335 <span class="keywordflow">if</span> ( ((y &gt;= y1) &amp;&amp; (y &lt; y2)) || ((y == maxy) &amp;&amp; (y &gt; y1) &amp;&amp; (y &lt;= y2)) ) { <a name="l05336"></a>05336 gfxPrimitivesPolyInts[ints++] = ((65536 * (y - y1)) / (y2 - y1)) * (x2 - x1) + (65536 * x1); <a name="l05337"></a>05337 } <a name="l05338"></a>05338 } <a name="l05339"></a>05339 <a name="l05340"></a>05340 qsort(gfxPrimitivesPolyInts, ints, <span class="keyword">sizeof</span>(<span class="keywordtype">int</span>), <a class="code" href="_s_d_l__gfx_primitives_8c.html#aeba347cfe2561fdb7f86d995a941ff1a" title="Internal helper qsort callback functions used in filled polygon drawing.">_gfxPrimitivesCompareInt</a>); <a name="l05341"></a>05341 <a name="l05342"></a>05342 <span class="keywordflow">for</span> (i = 0; (i &lt; ints); i += 2) { <a name="l05343"></a>05343 xa = gfxPrimitivesPolyInts[i] + 1; <a name="l05344"></a>05344 xa = (xa &gt;&gt; 16) + ((xa &amp; 32768) &gt;&gt; 15); <a name="l05345"></a>05345 xb = gfxPrimitivesPolyInts[i+1] - 1; <a name="l05346"></a>05346 xb = (xb &gt;&gt; 16) + ((xb &amp; 32768) &gt;&gt; 15); <a name="l05347"></a>05347 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(dst, xa, xb, y, color); <a name="l05348"></a>05348 } <a name="l05349"></a>05349 } <a name="l05350"></a>05350 <a name="l05351"></a>05351 <span class="keywordflow">return</span> (result); <a name="l05352"></a>05352 } <a name="l05353"></a>05353 <a name="l05372"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a412cddc17a592c167c060ec2d1d2fd1d">05372</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a586d64a80ac67de184e33609509d45a9" title="Draw filled polygon with alpha blending (multi-threaded capable).">filledPolygonRGBAMT</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, Uint8 r, Uint8 g, Uint8 b, Uint8 a, <span class="keywordtype">int</span> **polyInts, <span class="keywordtype">int</span> *polyAllocated) <a name="l05373"></a>05373 { <a name="l05374"></a>05374 <span class="comment">/*</span> <a name="l05375"></a>05375 <span class="comment"> * Draw </span> <a name="l05376"></a>05376 <span class="comment"> */</span> <a name="l05377"></a>05377 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a1f3a2dcda741a2c29b5dacce4ffe0271" title="Draw filled polygon with alpha blending (multi-threaded capable).">filledPolygonColorMT</a>(dst, vx, vy, n, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a, polyInts, polyAllocated)); <a name="l05378"></a>05378 } <a name="l05379"></a>05379 <a name="l05394"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a5e1fe45b835b623f6939ff0f08277531">05394</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#af22692175cb73329410cbcc7d7491c4d" title="Draw filled polygon with alpha blending.">filledPolygonColor</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, Uint32 color) <a name="l05395"></a>05395 { <a name="l05396"></a>05396 <span class="comment">/*</span> <a name="l05397"></a>05397 <span class="comment"> * Draw </span> <a name="l05398"></a>05398 <span class="comment"> */</span> <a name="l05399"></a>05399 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a1f3a2dcda741a2c29b5dacce4ffe0271" title="Draw filled polygon with alpha blending (multi-threaded capable).">filledPolygonColorMT</a>(dst, vx, vy, n, color, NULL, NULL)); <a name="l05400"></a>05400 } <a name="l05401"></a>05401 <a name="l05416"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a2b1023ddbbb25d57bd51676b49234af4">05416</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a40ef0b898905c190c193f0f55deb5a6c" title="Draw filled polygon with alpha blending.">filledPolygonRGBA</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l05417"></a>05417 { <a name="l05418"></a>05418 <span class="comment">/*</span> <a name="l05419"></a>05419 <span class="comment"> * Draw </span> <a name="l05420"></a>05420 <span class="comment"> */</span> <a name="l05421"></a>05421 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a1f3a2dcda741a2c29b5dacce4ffe0271" title="Draw filled polygon with alpha blending (multi-threaded capable).">filledPolygonColorMT</a>(dst, vx, vy, n, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a, NULL, NULL)); <a name="l05422"></a>05422 } <a name="l05423"></a>05423 <a name="l05437"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#aba318c28a9d4dfcf6a2e413814979a5a">05437</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#aba318c28a9d4dfcf6a2e413814979a5a" title="Internal function to draw a textured horizontal line.">_HLineTextured</a>(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, SDL_Surface *texture, <span class="keywordtype">int</span> texture_dx, <span class="keywordtype">int</span> texture_dy) <a name="l05438"></a>05438 { <a name="l05439"></a>05439 Sint16 left, right, top, bottom; <a name="l05440"></a>05440 Sint16 w; <a name="l05441"></a>05441 Sint16 xtmp; <a name="l05442"></a>05442 <span class="keywordtype">int</span> result = 0; <a name="l05443"></a>05443 <span class="keywordtype">int</span> texture_x_walker; <a name="l05444"></a>05444 <span class="keywordtype">int</span> texture_y_start; <a name="l05445"></a>05445 SDL_Rect source_rect,dst_rect; <a name="l05446"></a>05446 <span class="keywordtype">int</span> pixels_written,write_width; <a name="l05447"></a>05447 <a name="l05448"></a>05448 <span class="comment">/*</span> <a name="l05449"></a>05449 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l05450"></a>05450 <span class="comment"> */</span> <a name="l05451"></a>05451 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l05452"></a>05452 <span class="keywordflow">return</span>(0); <a name="l05453"></a>05453 } <a name="l05454"></a>05454 <a name="l05455"></a>05455 <span class="comment">/*</span> <a name="l05456"></a>05456 <span class="comment"> * Swap x1, x2 if required to ensure x1&lt;=x2</span> <a name="l05457"></a>05457 <span class="comment"> */</span> <a name="l05458"></a>05458 <span class="keywordflow">if</span> (x1 &gt; x2) { <a name="l05459"></a>05459 xtmp = x1; <a name="l05460"></a>05460 x1 = x2; <a name="l05461"></a>05461 x2 = xtmp; <a name="l05462"></a>05462 } <a name="l05463"></a>05463 <a name="l05464"></a>05464 <span class="comment">/*</span> <a name="l05465"></a>05465 <span class="comment"> * Get clipping boundary and</span> <a name="l05466"></a>05466 <span class="comment"> * check visibility of hline </span> <a name="l05467"></a>05467 <span class="comment"> */</span> <a name="l05468"></a>05468 left = dst-&gt;clip_rect.x; <a name="l05469"></a>05469 <span class="keywordflow">if</span> (x2&lt;left) { <a name="l05470"></a>05470 <span class="keywordflow">return</span>(0); <a name="l05471"></a>05471 } <a name="l05472"></a>05472 right = dst-&gt;clip_rect.x + dst-&gt;clip_rect.w - 1; <a name="l05473"></a>05473 <span class="keywordflow">if</span> (x1&gt;right) { <a name="l05474"></a>05474 <span class="keywordflow">return</span>(0); <a name="l05475"></a>05475 } <a name="l05476"></a>05476 top = dst-&gt;clip_rect.y; <a name="l05477"></a>05477 bottom = dst-&gt;clip_rect.y + dst-&gt;clip_rect.h - 1; <a name="l05478"></a>05478 <span class="keywordflow">if</span> ((y&lt;top) || (y&gt;bottom)) { <a name="l05479"></a>05479 <span class="keywordflow">return</span> (0); <a name="l05480"></a>05480 } <a name="l05481"></a>05481 <a name="l05482"></a>05482 <span class="comment">/*</span> <a name="l05483"></a>05483 <span class="comment"> * Clip x </span> <a name="l05484"></a>05484 <span class="comment"> */</span> <a name="l05485"></a>05485 <span class="keywordflow">if</span> (x1 &lt; left) { <a name="l05486"></a>05486 x1 = left; <a name="l05487"></a>05487 } <a name="l05488"></a>05488 <span class="keywordflow">if</span> (x2 &gt; right) { <a name="l05489"></a>05489 x2 = right; <a name="l05490"></a>05490 } <a name="l05491"></a>05491 <a name="l05492"></a>05492 <span class="comment">/*</span> <a name="l05493"></a>05493 <span class="comment"> * Calculate width to draw</span> <a name="l05494"></a>05494 <span class="comment"> */</span> <a name="l05495"></a>05495 w = x2 - x1 + 1; <a name="l05496"></a>05496 <a name="l05497"></a>05497 <span class="comment">/*</span> <a name="l05498"></a>05498 <span class="comment"> * Determine where in the texture we start drawing</span> <a name="l05499"></a>05499 <span class="comment"> */</span> <a name="l05500"></a>05500 texture_x_walker = (x1 - texture_dx) % texture-&gt;w; <a name="l05501"></a>05501 if (texture_x_walker &lt; 0){ <a name="l05502"></a>05502 texture_x_walker = texture-&gt;w + texture_x_walker ; <a name="l05503"></a>05503 } <a name="l05504"></a>05504 <a name="l05505"></a>05505 texture_y_start = (y + texture_dy) % texture-&gt;h; <a name="l05506"></a>05506 if (texture_y_start &lt; 0){ <a name="l05507"></a>05507 texture_y_start = texture-&gt;h + texture_y_start; <a name="l05508"></a>05508 } <a name="l05509"></a>05509 <a name="l05510"></a>05510 <span class="comment">// setup the source rectangle; we are only drawing one horizontal line</span> <a name="l05511"></a>05511 source_rect.y = texture_y_start; <a name="l05512"></a>05512 source_rect.x = texture_x_walker; <a name="l05513"></a>05513 source_rect.h = 1; <a name="l05514"></a>05514 <a name="l05515"></a>05515 <span class="comment">// we will draw to the current y</span> <a name="l05516"></a>05516 dst_rect.y = y; <a name="l05517"></a>05517 <a name="l05518"></a>05518 <span class="comment">// if there are enough pixels left in the current row of the texture</span> <a name="l05519"></a>05519 <span class="comment">// draw it all at once</span> <a name="l05520"></a>05520 <span class="keywordflow">if</span> (w &lt;= texture-&gt;w -texture_x_walker){ <a name="l05521"></a>05521 source_rect.w = w; <a name="l05522"></a>05522 source_rect.x = texture_x_walker; <a name="l05523"></a>05523 dst_rect.x= x1; <a name="l05524"></a>05524 result = (SDL_BlitSurface (texture, &amp;source_rect , dst, &amp;dst_rect) == 0); <a name="l05525"></a>05525 } <span class="keywordflow">else</span> { <span class="comment">// we need to draw multiple times</span> <a name="l05526"></a>05526 <span class="comment">// draw the first segment</span> <a name="l05527"></a>05527 pixels_written = texture-&gt;w - texture_x_walker; <a name="l05528"></a>05528 source_rect.w = pixels_written; <a name="l05529"></a>05529 source_rect.x = texture_x_walker; <a name="l05530"></a>05530 dst_rect.x= x1; <a name="l05531"></a>05531 result |= (SDL_BlitSurface (texture, &amp;source_rect , dst, &amp;dst_rect) == 0); <a name="l05532"></a>05532 write_width = texture-&gt;w; <a name="l05533"></a>05533 <a name="l05534"></a>05534 <span class="comment">// now draw the rest</span> <a name="l05535"></a>05535 <span class="comment">// set the source x to 0</span> <a name="l05536"></a>05536 source_rect.x = 0; <a name="l05537"></a>05537 <span class="keywordflow">while</span> (pixels_written &lt; w){ <a name="l05538"></a>05538 <span class="keywordflow">if</span> (write_width &gt;= w - pixels_written) { <a name="l05539"></a>05539 write_width = w - pixels_written; <a name="l05540"></a>05540 } <a name="l05541"></a>05541 source_rect.w = write_width; <a name="l05542"></a>05542 dst_rect.x = x1 + pixels_written; <a name="l05543"></a>05543 result |= (SDL_BlitSurface (texture,&amp;source_rect , dst, &amp;dst_rect) == 0); <a name="l05544"></a>05544 pixels_written += write_width; <a name="l05545"></a>05545 } <a name="l05546"></a>05546 } <a name="l05547"></a>05547 <a name="l05548"></a>05548 <span class="keywordflow">return</span> result; <a name="l05549"></a>05549 } <a name="l05550"></a>05550 <a name="l05574"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a326937a19cfbebea09aa0a7c908d89aa">05574</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a28ae354c6272da21b5753ae4ab9e1e84" title="Draws a polygon filled with the given texture (Multi-Threading Capable).">texturedPolygonMT</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, <a name="l05575"></a>05575 SDL_Surface * texture, <span class="keywordtype">int</span> texture_dx, <span class="keywordtype">int</span> texture_dy, <span class="keywordtype">int</span> **polyInts, <span class="keywordtype">int</span> *polyAllocated) <a name="l05576"></a>05576 { <a name="l05577"></a>05577 <span class="keywordtype">int</span> result; <a name="l05578"></a>05578 <span class="keywordtype">int</span> i; <a name="l05579"></a>05579 <span class="keywordtype">int</span> y, xa, xb; <a name="l05580"></a>05580 <span class="keywordtype">int</span> minx,maxx,miny, maxy; <a name="l05581"></a>05581 <span class="keywordtype">int</span> x1, y1; <a name="l05582"></a>05582 <span class="keywordtype">int</span> x2, y2; <a name="l05583"></a>05583 <span class="keywordtype">int</span> ind1, ind2; <a name="l05584"></a>05584 <span class="keywordtype">int</span> ints; <a name="l05585"></a>05585 <span class="keywordtype">int</span> *gfxPrimitivesPolyInts = NULL; <a name="l05586"></a>05586 <span class="keywordtype">int</span> gfxPrimitivesPolyAllocated = 0; <a name="l05587"></a>05587 <a name="l05588"></a>05588 <span class="comment">/*</span> <a name="l05589"></a>05589 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l05590"></a>05590 <span class="comment"> */</span> <a name="l05591"></a>05591 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l05592"></a>05592 <span class="keywordflow">return</span>(0); <a name="l05593"></a>05593 } <a name="l05594"></a>05594 <a name="l05595"></a>05595 <span class="comment">/*</span> <a name="l05596"></a>05596 <span class="comment"> * Sanity check number of edges</span> <a name="l05597"></a>05597 <span class="comment"> */</span> <a name="l05598"></a>05598 <span class="keywordflow">if</span> (n &lt; 3) { <a name="l05599"></a>05599 <span class="keywordflow">return</span> -1; <a name="l05600"></a>05600 } <a name="l05601"></a>05601 <a name="l05602"></a>05602 <span class="comment">/*</span> <a name="l05603"></a>05603 <span class="comment"> * Map polygon cache </span> <a name="l05604"></a>05604 <span class="comment"> */</span> <a name="l05605"></a>05605 <span class="keywordflow">if</span> ((polyInts==NULL) || (polyAllocated==NULL)) { <a name="l05606"></a>05606 <span class="comment">/* Use global cache */</span> <a name="l05607"></a>05607 gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsGlobal; <a name="l05608"></a>05608 gfxPrimitivesPolyAllocated = gfxPrimitivesPolyAllocatedGlobal; <a name="l05609"></a>05609 } <span class="keywordflow">else</span> { <a name="l05610"></a>05610 <span class="comment">/* Use local cache */</span> <a name="l05611"></a>05611 gfxPrimitivesPolyInts = *polyInts; <a name="l05612"></a>05612 gfxPrimitivesPolyAllocated = *polyAllocated; <a name="l05613"></a>05613 } <a name="l05614"></a>05614 <a name="l05615"></a>05615 <span class="comment">/*</span> <a name="l05616"></a>05616 <span class="comment"> * Allocate temp array, only grow array </span> <a name="l05617"></a>05617 <span class="comment"> */</span> <a name="l05618"></a>05618 <span class="keywordflow">if</span> (!gfxPrimitivesPolyAllocated) { <a name="l05619"></a>05619 gfxPrimitivesPolyInts = (<span class="keywordtype">int</span> *) malloc(<span class="keyword">sizeof</span>(<span class="keywordtype">int</span>) * n); <a name="l05620"></a>05620 gfxPrimitivesPolyAllocated = n; <a name="l05621"></a>05621 } <span class="keywordflow">else</span> { <a name="l05622"></a>05622 <span class="keywordflow">if</span> (gfxPrimitivesPolyAllocated &lt; n) { <a name="l05623"></a>05623 gfxPrimitivesPolyInts = (<span class="keywordtype">int</span> *) realloc(gfxPrimitivesPolyInts, <span class="keyword">sizeof</span>(<span class="keywordtype">int</span>) * n); <a name="l05624"></a>05624 gfxPrimitivesPolyAllocated = n; <a name="l05625"></a>05625 } <a name="l05626"></a>05626 } <a name="l05627"></a>05627 <a name="l05628"></a>05628 <span class="comment">/*</span> <a name="l05629"></a>05629 <span class="comment"> * Check temp array</span> <a name="l05630"></a>05630 <span class="comment"> */</span> <a name="l05631"></a>05631 <span class="keywordflow">if</span> (gfxPrimitivesPolyInts==NULL) { <a name="l05632"></a>05632 gfxPrimitivesPolyAllocated = 0; <a name="l05633"></a>05633 } <a name="l05634"></a>05634 <a name="l05635"></a>05635 <span class="comment">/*</span> <a name="l05636"></a>05636 <span class="comment"> * Update cache variables</span> <a name="l05637"></a>05637 <span class="comment"> */</span> <a name="l05638"></a>05638 <span class="keywordflow">if</span> ((polyInts==NULL) || (polyAllocated==NULL)) { <a name="l05639"></a>05639 gfxPrimitivesPolyIntsGlobal = gfxPrimitivesPolyInts; <a name="l05640"></a>05640 gfxPrimitivesPolyAllocatedGlobal = gfxPrimitivesPolyAllocated; <a name="l05641"></a>05641 } <span class="keywordflow">else</span> { <a name="l05642"></a>05642 *polyInts = gfxPrimitivesPolyInts; <a name="l05643"></a>05643 *polyAllocated = gfxPrimitivesPolyAllocated; <a name="l05644"></a>05644 } <a name="l05645"></a>05645 <a name="l05646"></a>05646 <span class="comment">/*</span> <a name="l05647"></a>05647 <span class="comment"> * Check temp array again</span> <a name="l05648"></a>05648 <span class="comment"> */</span> <a name="l05649"></a>05649 <span class="keywordflow">if</span> (gfxPrimitivesPolyInts==NULL) { <a name="l05650"></a>05650 <span class="keywordflow">return</span>(-1); <a name="l05651"></a>05651 } <a name="l05652"></a>05652 <a name="l05653"></a>05653 <span class="comment">/*</span> <a name="l05654"></a>05654 <span class="comment"> * Determine X,Y minima,maxima </span> <a name="l05655"></a>05655 <span class="comment"> */</span> <a name="l05656"></a>05656 miny = vy[0]; <a name="l05657"></a>05657 maxy = vy[0]; <a name="l05658"></a>05658 minx = vx[0]; <a name="l05659"></a>05659 maxx = vx[0]; <a name="l05660"></a>05660 <span class="keywordflow">for</span> (i = 1; (i &lt; n); i++) { <a name="l05661"></a>05661 <span class="keywordflow">if</span> (vy[i] &lt; miny) { <a name="l05662"></a>05662 miny = vy[i]; <a name="l05663"></a>05663 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (vy[i] &gt; maxy) { <a name="l05664"></a>05664 maxy = vy[i]; <a name="l05665"></a>05665 } <a name="l05666"></a>05666 <span class="keywordflow">if</span> (vx[i] &lt; minx) { <a name="l05667"></a>05667 minx = vx[i]; <a name="l05668"></a>05668 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (vx[i] &gt; maxx) { <a name="l05669"></a>05669 maxx = vx[i]; <a name="l05670"></a>05670 } <a name="l05671"></a>05671 } <a name="l05672"></a>05672 <span class="keywordflow">if</span> (maxx &lt;0 || minx &gt; dst-&gt;w){ <a name="l05673"></a>05673 <span class="keywordflow">return</span> -1; <a name="l05674"></a>05674 } <a name="l05675"></a>05675 <span class="keywordflow">if</span> (maxy &lt;0 || miny &gt; dst-&gt;h){ <a name="l05676"></a>05676 <span class="keywordflow">return</span> -1; <a name="l05677"></a>05677 } <a name="l05678"></a>05678 <a name="l05679"></a>05679 <span class="comment">/*</span> <a name="l05680"></a>05680 <span class="comment"> * Draw, scanning y </span> <a name="l05681"></a>05681 <span class="comment"> */</span> <a name="l05682"></a>05682 result = 0; <a name="l05683"></a>05683 <span class="keywordflow">for</span> (y = miny; (y &lt;= maxy); y++) { <a name="l05684"></a>05684 ints = 0; <a name="l05685"></a>05685 <span class="keywordflow">for</span> (i = 0; (i &lt; n); i++) { <a name="l05686"></a>05686 <span class="keywordflow">if</span> (!i) { <a name="l05687"></a>05687 ind1 = n - 1; <a name="l05688"></a>05688 ind2 = 0; <a name="l05689"></a>05689 } <span class="keywordflow">else</span> { <a name="l05690"></a>05690 ind1 = i - 1; <a name="l05691"></a>05691 ind2 = i; <a name="l05692"></a>05692 } <a name="l05693"></a>05693 y1 = vy[ind1]; <a name="l05694"></a>05694 y2 = vy[ind2]; <a name="l05695"></a>05695 <span class="keywordflow">if</span> (y1 &lt; y2) { <a name="l05696"></a>05696 x1 = vx[ind1]; <a name="l05697"></a>05697 x2 = vx[ind2]; <a name="l05698"></a>05698 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (y1 &gt; y2) { <a name="l05699"></a>05699 y2 = vy[ind1]; <a name="l05700"></a>05700 y1 = vy[ind2]; <a name="l05701"></a>05701 x2 = vx[ind1]; <a name="l05702"></a>05702 x1 = vx[ind2]; <a name="l05703"></a>05703 } <span class="keywordflow">else</span> { <a name="l05704"></a>05704 <span class="keywordflow">continue</span>; <a name="l05705"></a>05705 } <a name="l05706"></a>05706 <span class="keywordflow">if</span> ( ((y &gt;= y1) &amp;&amp; (y &lt; y2)) || ((y == maxy) &amp;&amp; (y &gt; y1) &amp;&amp; (y &lt;= y2)) ) { <a name="l05707"></a>05707 gfxPrimitivesPolyInts[ints++] = ((65536 * (y - y1)) / (y2 - y1)) * (x2 - x1) + (65536 * x1); <a name="l05708"></a>05708 } <a name="l05709"></a>05709 } <a name="l05710"></a>05710 <a name="l05711"></a>05711 qsort(gfxPrimitivesPolyInts, ints, <span class="keyword">sizeof</span>(<span class="keywordtype">int</span>), <a class="code" href="_s_d_l__gfx_primitives_8c.html#aeba347cfe2561fdb7f86d995a941ff1a" title="Internal helper qsort callback functions used in filled polygon drawing.">_gfxPrimitivesCompareInt</a>); <a name="l05712"></a>05712 <a name="l05713"></a>05713 <span class="keywordflow">for</span> (i = 0; (i &lt; ints); i += 2) { <a name="l05714"></a>05714 xa = gfxPrimitivesPolyInts[i] + 1; <a name="l05715"></a>05715 xa = (xa &gt;&gt; 16) + ((xa &amp; 32768) &gt;&gt; 15); <a name="l05716"></a>05716 xb = gfxPrimitivesPolyInts[i+1] - 1; <a name="l05717"></a>05717 xb = (xb &gt;&gt; 16) + ((xb &amp; 32768) &gt;&gt; 15); <a name="l05718"></a>05718 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#aba318c28a9d4dfcf6a2e413814979a5a" title="Internal function to draw a textured horizontal line.">_HLineTextured</a>(dst, xa, xb, y, texture, texture_dx, texture_dy); <a name="l05719"></a>05719 } <a name="l05720"></a>05720 } <a name="l05721"></a>05721 <a name="l05722"></a>05722 <span class="keywordflow">return</span> (result); <a name="l05723"></a>05723 } <a name="l05724"></a>05724 <a name="l05741"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a5ca5a9bcfeba5b1a1577202e79b494d8">05741</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a65137af308ea878f28abc95419e8aef5" title="Draws a polygon filled with the given texture.">texturedPolygon</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, SDL_Surface *texture, <span class="keywordtype">int</span> texture_dx, <span class="keywordtype">int</span> texture_dy) <a name="l05742"></a>05742 { <a name="l05743"></a>05743 <span class="comment">/*</span> <a name="l05744"></a>05744 <span class="comment"> * Draw</span> <a name="l05745"></a>05745 <span class="comment"> */</span> <a name="l05746"></a>05746 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a28ae354c6272da21b5753ae4ab9e1e84" title="Draws a polygon filled with the given texture (Multi-Threading Capable).">texturedPolygonMT</a>(dst, vx, vy, n, texture, texture_dx, texture_dy, NULL, NULL)); <a name="l05747"></a>05747 } <a name="l05748"></a>05748 <a name="l05749"></a>05749 <a name="l05750"></a>05750 <span class="comment">/* ---- Character */</span> <a name="l05751"></a>05751 <a name="l05755"></a>05755 <span class="keyword">static</span> SDL_Surface *gfxPrimitivesFont[256]; <a name="l05756"></a>05756 <a name="l05760"></a>05760 <span class="keyword">static</span> Uint32 gfxPrimitivesFontColor[256]; <a name="l05761"></a>05761 <a name="l05765"></a>05765 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *currentFontdata = gfxPrimitivesFontdata; <a name="l05766"></a>05766 <a name="l05770"></a>05770 <span class="keyword">static</span> Uint32 charWidth = 8; <a name="l05771"></a>05771 <a name="l05775"></a>05775 <span class="keyword">static</span> Uint32 charHeight = 8; <a name="l05776"></a>05776 <a name="l05780"></a>05780 <span class="keyword">static</span> Uint32 charWidthLocal = 8; <a name="l05781"></a>05781 <a name="l05785"></a>05785 <span class="keyword">static</span> Uint32 charHeightLocal = 8; <a name="l05786"></a>05786 <a name="l05790"></a>05790 <span class="keyword">static</span> Uint32 charPitch = 1; <a name="l05791"></a>05791 <a name="l05795"></a>05795 <span class="keyword">static</span> Uint32 charRotation = 0; <a name="l05796"></a>05796 <a name="l05800"></a>05800 <span class="keyword">static</span> Uint32 charSize = 8; <a name="l05801"></a>05801 <a name="l05815"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a7cabe806643c19159948639faaf26a38">05815</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#afacd57651ec0e0ccab60753636862cd0" title="Sets or resets the current global font data.">gfxPrimitivesSetFont</a>(<span class="keyword">const</span> <span class="keywordtype">void</span> *fontdata, Uint32 cw, Uint32 ch) <a name="l05816"></a>05816 { <a name="l05817"></a>05817 <span class="keywordtype">int</span> i; <a name="l05818"></a>05818 <a name="l05819"></a>05819 <span class="keywordflow">if</span> ((fontdata) &amp;&amp; (cw) &amp;&amp; (ch)) { <a name="l05820"></a>05820 currentFontdata = fontdata; <a name="l05821"></a>05821 charWidth = cw; <a name="l05822"></a>05822 charHeight = ch; <a name="l05823"></a>05823 } <span class="keywordflow">else</span> { <a name="l05824"></a>05824 currentFontdata = gfxPrimitivesFontdata; <a name="l05825"></a>05825 charWidth = 8; <a name="l05826"></a>05826 charHeight = 8; <a name="l05827"></a>05827 } <a name="l05828"></a>05828 <a name="l05829"></a>05829 charPitch = (charWidth+7)/8; <a name="l05830"></a>05830 charSize = charPitch * charHeight; <a name="l05831"></a>05831 <a name="l05832"></a>05832 <span class="comment">/* Maybe flip width/height for rendering */</span> <a name="l05833"></a>05833 <span class="keywordflow">if</span> ((charRotation==1) || (charRotation==3)) <a name="l05834"></a>05834 { <a name="l05835"></a>05835 charWidthLocal = charHeight; <a name="l05836"></a>05836 charHeightLocal = charWidth; <a name="l05837"></a>05837 } <a name="l05838"></a>05838 <span class="keywordflow">else</span> <a name="l05839"></a>05839 { <a name="l05840"></a>05840 charWidthLocal = charWidth; <a name="l05841"></a>05841 charHeightLocal = charHeight; <a name="l05842"></a>05842 } <a name="l05843"></a>05843 <a name="l05844"></a>05844 <span class="comment">/* Clear character cache */</span> <a name="l05845"></a>05845 <span class="keywordflow">for</span> (i = 0; i &lt; 256; i++) { <a name="l05846"></a>05846 <span class="keywordflow">if</span> (gfxPrimitivesFont[i]) { <a name="l05847"></a>05847 SDL_FreeSurface(gfxPrimitivesFont[i]); <a name="l05848"></a>05848 gfxPrimitivesFont[i] = NULL; <a name="l05849"></a>05849 } <a name="l05850"></a>05850 } <a name="l05851"></a>05851 } <a name="l05852"></a>05852 <a name="l05861"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a77cc480ba039c758d1cf0cd43db04bd6">05861</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#aef6796a883f07d31bbf7c7df6d1153d2" title="Sets current global font character rotation steps.">gfxPrimitivesSetFontRotation</a>(Uint32 rotation) <a name="l05862"></a>05862 { <a name="l05863"></a>05863 <span class="keywordtype">int</span> i; <a name="l05864"></a>05864 <a name="l05865"></a>05865 rotation = rotation &amp; 3; <a name="l05866"></a>05866 <span class="keywordflow">if</span> (charRotation != rotation) <a name="l05867"></a>05867 { <a name="l05868"></a>05868 <span class="comment">/* Store rotation */</span> <a name="l05869"></a>05869 charRotation = rotation; <a name="l05870"></a>05870 <a name="l05871"></a>05871 <span class="comment">/* Maybe flip width/height for rendering */</span> <a name="l05872"></a>05872 <span class="keywordflow">if</span> ((charRotation==1) || (charRotation==3)) <a name="l05873"></a>05873 { <a name="l05874"></a>05874 charWidthLocal = charHeight; <a name="l05875"></a>05875 charHeightLocal = charWidth; <a name="l05876"></a>05876 } <a name="l05877"></a>05877 <span class="keywordflow">else</span> <a name="l05878"></a>05878 { <a name="l05879"></a>05879 charWidthLocal = charWidth; <a name="l05880"></a>05880 charHeightLocal = charHeight; <a name="l05881"></a>05881 } <a name="l05882"></a>05882 <a name="l05883"></a>05883 <span class="comment">/* Clear character cache */</span> <a name="l05884"></a>05884 <span class="keywordflow">for</span> (i = 0; i &lt; 256; i++) { <a name="l05885"></a>05885 <span class="keywordflow">if</span> (gfxPrimitivesFont[i]) { <a name="l05886"></a>05886 SDL_FreeSurface(gfxPrimitivesFont[i]); <a name="l05887"></a>05887 gfxPrimitivesFont[i] = NULL; <a name="l05888"></a>05888 } <a name="l05889"></a>05889 } <a name="l05890"></a>05890 } <a name="l05891"></a>05891 } <a name="l05892"></a>05892 <a name="l05908"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#af1991f2031346131db4ae8fd40492b08">05908</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#aef5fdeb16c4578d8cd50e106299e993e" title="Draw a character of the currently set font.">characterColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, <span class="keywordtype">char</span> c, Uint32 color) <a name="l05909"></a>05909 { <a name="l05910"></a>05910 Sint16 left, right, top, bottom; <a name="l05911"></a>05911 Sint16 x1, y1, x2, y2; <a name="l05912"></a>05912 SDL_Rect srect; <a name="l05913"></a>05913 SDL_Rect drect; <a name="l05914"></a>05914 <span class="keywordtype">int</span> result; <a name="l05915"></a>05915 Uint32 ix, iy; <a name="l05916"></a>05916 <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *charpos; <a name="l05917"></a>05917 Uint8 *curpos; <a name="l05918"></a>05918 <span class="keywordtype">int</span> forced_redraw; <a name="l05919"></a>05919 Uint8 patt, mask; <a name="l05920"></a>05920 Uint8 *linepos; <a name="l05921"></a>05921 Uint32 pitch; <a name="l05922"></a>05922 SDL_Surface *rotatedCharacter; <a name="l05923"></a>05923 Uint32 ci; <a name="l05924"></a>05924 <a name="l05925"></a>05925 <span class="comment">/*</span> <a name="l05926"></a>05926 <span class="comment"> * Check visibility of clipping rectangle</span> <a name="l05927"></a>05927 <span class="comment"> */</span> <a name="l05928"></a>05928 <span class="keywordflow">if</span> ((dst-&gt;clip_rect.w==0) || (dst-&gt;clip_rect.h==0)) { <a name="l05929"></a>05929 <span class="keywordflow">return</span>(0); <a name="l05930"></a>05930 } <a name="l05931"></a>05931 <a name="l05932"></a>05932 <span class="comment">/*</span> <a name="l05933"></a>05933 <span class="comment"> * Get text and clipping boundary and</span> <a name="l05934"></a>05934 <span class="comment"> * test if bounding box of character is visible </span> <a name="l05935"></a>05935 <span class="comment"> */</span> <a name="l05936"></a>05936 <a name="l05937"></a>05937 left = dst-&gt;clip_rect.x; <a name="l05938"></a>05938 x2 = x + charWidthLocal; <a name="l05939"></a>05939 <span class="keywordflow">if</span> (x2&lt;left) { <a name="l05940"></a>05940 <span class="keywordflow">return</span>(0); <a name="l05941"></a>05941 } <a name="l05942"></a>05942 right = dst-&gt;clip_rect.x + dst-&gt;clip_rect.w - 1; <a name="l05943"></a>05943 x1 = x; <a name="l05944"></a>05944 <span class="keywordflow">if</span> (x1&gt;right) { <a name="l05945"></a>05945 <span class="keywordflow">return</span>(0); <a name="l05946"></a>05946 } <a name="l05947"></a>05947 top = dst-&gt;clip_rect.y; <a name="l05948"></a>05948 y2 = y + charHeightLocal; <a name="l05949"></a>05949 <span class="keywordflow">if</span> (y2&lt;top) { <a name="l05950"></a>05950 <span class="keywordflow">return</span>(0); <a name="l05951"></a>05951 } <a name="l05952"></a>05952 bottom = dst-&gt;clip_rect.y + dst-&gt;clip_rect.h - 1; <a name="l05953"></a>05953 y1 = y; <a name="l05954"></a>05954 <span class="keywordflow">if</span> (y1&gt;bottom) { <a name="l05955"></a>05955 <span class="keywordflow">return</span>(0); <a name="l05956"></a>05956 } <a name="l05957"></a>05957 <a name="l05958"></a>05958 <span class="comment">/*</span> <a name="l05959"></a>05959 <span class="comment"> * Setup source rectangle</span> <a name="l05960"></a>05960 <span class="comment"> */</span> <a name="l05961"></a>05961 srect.x = 0; <a name="l05962"></a>05962 srect.y = 0; <a name="l05963"></a>05963 srect.w = charWidthLocal; <a name="l05964"></a>05964 srect.h = charHeightLocal; <a name="l05965"></a>05965 <a name="l05966"></a>05966 <span class="comment">/*</span> <a name="l05967"></a>05967 <span class="comment"> * Setup destination rectangle</span> <a name="l05968"></a>05968 <span class="comment"> */</span> <a name="l05969"></a>05969 drect.x = x; <a name="l05970"></a>05970 drect.y = y; <a name="l05971"></a>05971 drect.w = charWidthLocal; <a name="l05972"></a>05972 drect.h = charHeightLocal; <a name="l05973"></a>05973 <a name="l05974"></a>05974 <span class="comment">/* Character index in cache */</span> <a name="l05975"></a>05975 ci = (<span class="keywordtype">unsigned</span> char) c; <a name="l05976"></a>05976 <a name="l05977"></a>05977 <span class="comment">/*</span> <a name="l05978"></a>05978 <span class="comment"> * Create new charWidth x charHeight bitmap surface if not already present.</span> <a name="l05979"></a>05979 <span class="comment"> * Might get rotated later.</span> <a name="l05980"></a>05980 <span class="comment"> */</span> <a name="l05981"></a>05981 <span class="keywordflow">if</span> (gfxPrimitivesFont[ci] == NULL) { <a name="l05982"></a>05982 gfxPrimitivesFont[ci] = <a name="l05983"></a>05983 SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_HWSURFACE | SDL_SRCALPHA, <a name="l05984"></a>05984 charWidth, charHeight, 32, <a name="l05985"></a>05985 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF); <a name="l05986"></a>05986 <span class="comment">/*</span> <a name="l05987"></a>05987 <span class="comment"> * Check pointer </span> <a name="l05988"></a>05988 <span class="comment"> */</span> <a name="l05989"></a>05989 <span class="keywordflow">if</span> (gfxPrimitivesFont[ci] == NULL) { <a name="l05990"></a>05990 <span class="keywordflow">return</span> (-1); <a name="l05991"></a>05991 } <a name="l05992"></a>05992 <span class="comment">/*</span> <a name="l05993"></a>05993 <span class="comment"> * Definitely redraw </span> <a name="l05994"></a>05994 <span class="comment"> */</span> <a name="l05995"></a>05995 forced_redraw = 1; <a name="l05996"></a>05996 } <span class="keywordflow">else</span> { <a name="l05997"></a>05997 forced_redraw = 0; <a name="l05998"></a>05998 } <a name="l05999"></a>05999 <a name="l06000"></a>06000 <span class="comment">/*</span> <a name="l06001"></a>06001 <span class="comment"> * Check if color has changed </span> <a name="l06002"></a>06002 <span class="comment"> */</span> <a name="l06003"></a>06003 <span class="keywordflow">if</span> ((gfxPrimitivesFontColor[ci] != color) || (forced_redraw)) { <a name="l06004"></a>06004 <span class="comment">/*</span> <a name="l06005"></a>06005 <span class="comment"> * Redraw character </span> <a name="l06006"></a>06006 <span class="comment"> */</span> <a name="l06007"></a>06007 SDL_SetAlpha(gfxPrimitivesFont[ci], SDL_SRCALPHA, 255); <a name="l06008"></a>06008 gfxPrimitivesFontColor[ci] = color; <a name="l06009"></a>06009 <a name="l06010"></a>06010 <span class="comment">/* Lock font-surface */</span> <a name="l06011"></a>06011 <span class="keywordflow">if</span> (SDL_LockSurface(gfxPrimitivesFont[ci]) != 0) <a name="l06012"></a>06012 <span class="keywordflow">return</span> (-1); <a name="l06013"></a>06013 <a name="l06014"></a>06014 <span class="comment">/*</span> <a name="l06015"></a>06015 <span class="comment"> * Variable setup </span> <a name="l06016"></a>06016 <span class="comment"> */</span> <a name="l06017"></a>06017 charpos = currentFontdata + ci * charSize; <a name="l06018"></a>06018 linepos = (Uint8 *) gfxPrimitivesFont[ci]-&gt;pixels; <a name="l06019"></a>06019 pitch = gfxPrimitivesFont[ci]-&gt;pitch; <a name="l06020"></a>06020 <a name="l06021"></a>06021 <span class="comment">/*</span> <a name="l06022"></a>06022 <span class="comment"> * Drawing loop </span> <a name="l06023"></a>06023 <span class="comment"> */</span> <a name="l06024"></a>06024 patt = 0; <a name="l06025"></a>06025 <span class="keywordflow">for</span> (iy = 0; iy &lt; charHeight; iy++) { <a name="l06026"></a>06026 mask = 0x00; <a name="l06027"></a>06027 curpos = linepos; <a name="l06028"></a>06028 <span class="keywordflow">for</span> (ix = 0; ix &lt; charWidth; ix++) { <a name="l06029"></a>06029 <span class="keywordflow">if</span> (!(mask &gt;&gt;= 1)) { <a name="l06030"></a>06030 patt = *charpos++; <a name="l06031"></a>06031 mask = 0x80; <a name="l06032"></a>06032 } <a name="l06033"></a>06033 <a name="l06034"></a>06034 <span class="keywordflow">if</span> (patt &amp; mask) <a name="l06035"></a>06035 *(Uint32 *)curpos = color; <a name="l06036"></a>06036 <span class="keywordflow">else</span> <a name="l06037"></a>06037 *(Uint32 *)curpos = 0; <a name="l06038"></a>06038 curpos += 4; <a name="l06039"></a>06039 } <a name="l06040"></a>06040 linepos += pitch; <a name="l06041"></a>06041 } <a name="l06042"></a>06042 <a name="l06043"></a>06043 <span class="comment">/* Unlock font-surface */</span> <a name="l06044"></a>06044 SDL_UnlockSurface(gfxPrimitivesFont[ci]); <a name="l06045"></a>06045 <a name="l06046"></a>06046 <span class="comment">/* Maybe rotate and replace cached image */</span> <a name="l06047"></a>06047 <span class="keywordflow">if</span> (charRotation&gt;0) <a name="l06048"></a>06048 { <a name="l06049"></a>06049 rotatedCharacter = <a class="code" href="_s_d_l__rotozoom_8c.html#a77563d68634cb2624d4f2f0bcdc19e73" title="Rotates a 32 bit surface in increments of 90 degrees.">rotateSurface90Degrees</a>(gfxPrimitivesFont[ci], charRotation); <a name="l06050"></a>06050 SDL_FreeSurface(gfxPrimitivesFont[ci]); <a name="l06051"></a>06051 gfxPrimitivesFont[ci] = rotatedCharacter; <a name="l06052"></a>06052 } <a name="l06053"></a>06053 } <a name="l06054"></a>06054 <a name="l06055"></a>06055 <span class="comment">/*</span> <a name="l06056"></a>06056 <span class="comment"> * Draw bitmap onto destination surface </span> <a name="l06057"></a>06057 <span class="comment"> */</span> <a name="l06058"></a>06058 result = SDL_BlitSurface(gfxPrimitivesFont[ci], &amp;srect, dst, &amp;drect); <a name="l06059"></a>06059 <a name="l06060"></a>06060 <span class="keywordflow">return</span> (result); <a name="l06061"></a>06061 } <a name="l06062"></a>06062 <a name="l06077"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a3f2f624c33ca753d22db52a8d9363fac">06077</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a96379d2ce808aa642afb57bced0c670e" title="Draw a character of the currently set font.">characterRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, <span class="keywordtype">char</span> c, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l06078"></a>06078 { <a name="l06079"></a>06079 <span class="comment">/*</span> <a name="l06080"></a>06080 <span class="comment"> * Draw </span> <a name="l06081"></a>06081 <span class="comment"> */</span> <a name="l06082"></a>06082 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#aef5fdeb16c4578d8cd50e106299e993e" title="Draw a character of the currently set font.">characterColor</a>(dst, x, y, c, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l06083"></a>06083 } <a name="l06084"></a>06084 <a name="l06099"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a96b6a43c6ef4753996e33bb7fea483bc">06099</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a62d2ba55abc7673f2dfa29e6bbffefdf" title="Draw a string in the currently set font.">stringColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, <span class="keyword">const</span> <span class="keywordtype">char</span> *s, Uint32 color) <a name="l06100"></a>06100 { <a name="l06101"></a>06101 <span class="keywordtype">int</span> result = 0; <a name="l06102"></a>06102 Sint16 curx = x; <a name="l06103"></a>06103 Sint16 cury = y; <a name="l06104"></a>06104 <span class="keyword">const</span> <span class="keywordtype">char</span> *curchar = s; <a name="l06105"></a>06105 <a name="l06106"></a>06106 <span class="keywordflow">while</span> (*curchar &amp;&amp; !result) { <a name="l06107"></a>06107 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#aef5fdeb16c4578d8cd50e106299e993e" title="Draw a character of the currently set font.">characterColor</a>(dst, curx, cury, *curchar, color); <a name="l06108"></a>06108 <span class="keywordflow">switch</span> (charRotation) <a name="l06109"></a>06109 { <a name="l06110"></a>06110 <span class="keywordflow">case</span> 0: <a name="l06111"></a>06111 curx += charWidthLocal; <a name="l06112"></a>06112 <span class="keywordflow">break</span>; <a name="l06113"></a>06113 <span class="keywordflow">case</span> 2: <a name="l06114"></a>06114 curx -= charWidthLocal; <a name="l06115"></a>06115 <span class="keywordflow">break</span>; <a name="l06116"></a>06116 <span class="keywordflow">case</span> 1: <a name="l06117"></a>06117 cury += charHeightLocal; <a name="l06118"></a>06118 <span class="keywordflow">break</span>; <a name="l06119"></a>06119 <span class="keywordflow">case</span> 3: <a name="l06120"></a>06120 cury -= charHeightLocal; <a name="l06121"></a>06121 <span class="keywordflow">break</span>; <a name="l06122"></a>06122 } <a name="l06123"></a>06123 curchar++; <a name="l06124"></a>06124 } <a name="l06125"></a>06125 <a name="l06126"></a>06126 <span class="keywordflow">return</span> (result); <a name="l06127"></a>06127 } <a name="l06128"></a>06128 <a name="l06143"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a769833ae414222099783a9b69bed4009">06143</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a6ca71826e311bdd9acf13b009256aa1c" title="Draw a string in the currently set font.">stringRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, <span class="keyword">const</span> <span class="keywordtype">char</span> *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l06144"></a>06144 { <a name="l06145"></a>06145 <span class="comment">/*</span> <a name="l06146"></a>06146 <span class="comment"> * Draw </span> <a name="l06147"></a>06147 <span class="comment"> */</span> <a name="l06148"></a>06148 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a62d2ba55abc7673f2dfa29e6bbffefdf" title="Draw a string in the currently set font.">stringColor</a>(dst, x, y, s, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l06149"></a>06149 } <a name="l06150"></a>06150 <a name="l06151"></a>06151 <span class="comment">/* ---- Bezier curve */</span> <a name="l06152"></a>06152 <a name="l06162"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#a888411ec724ddb9ff19cf9ba9fc067df">06162</a> <span class="keywordtype">double</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a888411ec724ddb9ff19cf9ba9fc067df" title="Internal function to calculate bezier interpolator of data array with ndata values at position &#39;t&#39;...">_evaluateBezier</a> (<span class="keywordtype">double</span> *data, <span class="keywordtype">int</span> ndata, <span class="keywordtype">double</span> t) <a name="l06163"></a>06163 { <a name="l06164"></a>06164 <span class="keywordtype">double</span> mu, result; <a name="l06165"></a>06165 <span class="keywordtype">int</span> n,k,kn,nn,nkn; <a name="l06166"></a>06166 <span class="keywordtype">double</span> blend,muk,munk; <a name="l06167"></a>06167 <a name="l06168"></a>06168 <span class="comment">/* Sanity check bounds */</span> <a name="l06169"></a>06169 <span class="keywordflow">if</span> (t&lt;0.0) { <a name="l06170"></a>06170 <span class="keywordflow">return</span>(data[0]); <a name="l06171"></a>06171 } <a name="l06172"></a>06172 <span class="keywordflow">if</span> (t&gt;=(<span class="keywordtype">double</span>)ndata) { <a name="l06173"></a>06173 <span class="keywordflow">return</span>(data[ndata-1]); <a name="l06174"></a>06174 } <a name="l06175"></a>06175 <a name="l06176"></a>06176 <span class="comment">/* Adjust t to the range 0.0 to 1.0 */</span> <a name="l06177"></a>06177 mu=t/(double)ndata; <a name="l06178"></a>06178 <a name="l06179"></a>06179 <span class="comment">/* Calculate interpolate */</span> <a name="l06180"></a>06180 n=ndata-1; <a name="l06181"></a>06181 result=0.0; <a name="l06182"></a>06182 muk = 1; <a name="l06183"></a>06183 munk = pow(1-mu,(<span class="keywordtype">double</span>)n); <a name="l06184"></a>06184 <span class="keywordflow">for</span> (k=0;k&lt;=n;k++) { <a name="l06185"></a>06185 nn = n; <a name="l06186"></a>06186 kn = k; <a name="l06187"></a>06187 nkn = n - k; <a name="l06188"></a>06188 blend = muk * munk; <a name="l06189"></a>06189 muk *= mu; <a name="l06190"></a>06190 munk /= (1-mu); <a name="l06191"></a>06191 <span class="keywordflow">while</span> (nn &gt;= 1) { <a name="l06192"></a>06192 blend *= nn; <a name="l06193"></a>06193 nn--; <a name="l06194"></a>06194 <span class="keywordflow">if</span> (kn &gt; 1) { <a name="l06195"></a>06195 blend /= (double)kn; <a name="l06196"></a>06196 kn--; <a name="l06197"></a>06197 } <a name="l06198"></a>06198 <span class="keywordflow">if</span> (nkn &gt; 1) { <a name="l06199"></a>06199 blend /= (double)nkn; <a name="l06200"></a>06200 nkn--; <a name="l06201"></a>06201 } <a name="l06202"></a>06202 } <a name="l06203"></a>06203 result += data[k] * blend; <a name="l06204"></a>06204 } <a name="l06205"></a>06205 <a name="l06206"></a>06206 <span class="keywordflow">return</span> (result); <a name="l06207"></a>06207 } <a name="l06208"></a>06208 <a name="l06221"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#ad82395ca72b749494ff89be78f168341">06221</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#adfe8f9c42d29a090aae15eeb19b80d51" title="Draw a bezier curve with alpha blending.">bezierColor</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, <span class="keywordtype">int</span> s, Uint32 color) <a name="l06222"></a>06222 { <a name="l06223"></a>06223 <span class="keywordtype">int</span> result; <a name="l06224"></a>06224 <span class="keywordtype">int</span> i; <a name="l06225"></a>06225 <span class="keywordtype">double</span> *x, *y, t, stepsize; <a name="l06226"></a>06226 Sint16 x1, y1, x2, y2; <a name="l06227"></a>06227 <a name="l06228"></a>06228 <span class="comment">/*</span> <a name="l06229"></a>06229 <span class="comment"> * Sanity check </span> <a name="l06230"></a>06230 <span class="comment"> */</span> <a name="l06231"></a>06231 <span class="keywordflow">if</span> (n &lt; 3) { <a name="l06232"></a>06232 <span class="keywordflow">return</span> (-1); <a name="l06233"></a>06233 } <a name="l06234"></a>06234 <span class="keywordflow">if</span> (s &lt; 2) { <a name="l06235"></a>06235 <span class="keywordflow">return</span> (-1); <a name="l06236"></a>06236 } <a name="l06237"></a>06237 <a name="l06238"></a>06238 <span class="comment">/*</span> <a name="l06239"></a>06239 <span class="comment"> * Variable setup </span> <a name="l06240"></a>06240 <span class="comment"> */</span> <a name="l06241"></a>06241 stepsize=(double)1.0/(<span class="keywordtype">double</span>)s; <a name="l06242"></a>06242 <a name="l06243"></a>06243 <span class="comment">/* Transfer vertices into float arrays */</span> <a name="l06244"></a>06244 <span class="keywordflow">if</span> ((x=(<span class="keywordtype">double</span> *)malloc(<span class="keyword">sizeof</span>(<span class="keywordtype">double</span>)*(n+1)))==NULL) { <a name="l06245"></a>06245 <span class="keywordflow">return</span>(-1); <a name="l06246"></a>06246 } <a name="l06247"></a>06247 <span class="keywordflow">if</span> ((y=(<span class="keywordtype">double</span> *)malloc(<span class="keyword">sizeof</span>(<span class="keywordtype">double</span>)*(n+1)))==NULL) { <a name="l06248"></a>06248 free(x); <a name="l06249"></a>06249 <span class="keywordflow">return</span>(-1); <a name="l06250"></a>06250 } <a name="l06251"></a>06251 <span class="keywordflow">for</span> (i=0; i&lt;n; i++) { <a name="l06252"></a>06252 x[i]=(double)vx[i]; <a name="l06253"></a>06253 y[i]=(double)vy[i]; <a name="l06254"></a>06254 } <a name="l06255"></a>06255 x[n]=(double)vx[0]; <a name="l06256"></a>06256 y[n]=(double)vy[0]; <a name="l06257"></a>06257 <a name="l06258"></a>06258 <span class="comment">/*</span> <a name="l06259"></a>06259 <span class="comment"> * Draw </span> <a name="l06260"></a>06260 <span class="comment"> */</span> <a name="l06261"></a>06261 result = 0; <a name="l06262"></a>06262 t=0.0; <a name="l06263"></a>06263 x1=(Sint16)lrint(<a class="code" href="_s_d_l__gfx_primitives_8c.html#a888411ec724ddb9ff19cf9ba9fc067df" title="Internal function to calculate bezier interpolator of data array with ndata values at position &#39;t&#39;...">_evaluateBezier</a>(x,n+1,t)); <a name="l06264"></a>06264 y1=(Sint16)lrint(<a class="code" href="_s_d_l__gfx_primitives_8c.html#a888411ec724ddb9ff19cf9ba9fc067df" title="Internal function to calculate bezier interpolator of data array with ndata values at position &#39;t&#39;...">_evaluateBezier</a>(y,n+1,t)); <a name="l06265"></a>06265 <span class="keywordflow">for</span> (i = 0; i &lt;= (n*s); i++) { <a name="l06266"></a>06266 t += stepsize; <a name="l06267"></a>06267 x2=(Sint16)<a class="code" href="_s_d_l__gfx_primitives_8c.html#a888411ec724ddb9ff19cf9ba9fc067df" title="Internal function to calculate bezier interpolator of data array with ndata values at position &#39;t&#39;...">_evaluateBezier</a>(x,n,t); <a name="l06268"></a>06268 y2=(Sint16)<a class="code" href="_s_d_l__gfx_primitives_8c.html#a888411ec724ddb9ff19cf9ba9fc067df" title="Internal function to calculate bezier interpolator of data array with ndata values at position &#39;t&#39;...">_evaluateBezier</a>(y,n,t); <a name="l06269"></a>06269 result |= <a class="code" href="_s_d_l__gfx_primitives_8c.html#ad44c550fab3cb736eb049713ede94052" title="Draw line with alpha blending.">lineColor</a>(dst, x1, y1, x2, y2, color); <a name="l06270"></a>06270 x1 = x2; <a name="l06271"></a>06271 y1 = y2; <a name="l06272"></a>06272 } <a name="l06273"></a>06273 <a name="l06274"></a>06274 <span class="comment">/* Clean up temporary array */</span> <a name="l06275"></a>06275 free(x); <a name="l06276"></a>06276 free(y); <a name="l06277"></a>06277 <a name="l06278"></a>06278 <span class="keywordflow">return</span> (result); <a name="l06279"></a>06279 } <a name="l06280"></a>06280 <a name="l06296"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a7203e3a463da499b5b0cadf211d19ff3">06296</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a4b7fbf6cc366abdf345a25308d53e125" title="Draw a bezier curve with alpha blending.">bezierRGBA</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, <span class="keywordtype">int</span> s, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l06297"></a>06297 { <a name="l06298"></a>06298 <span class="comment">/*</span> <a name="l06299"></a>06299 <span class="comment"> * Draw </span> <a name="l06300"></a>06300 <span class="comment"> */</span> <a name="l06301"></a>06301 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#adfe8f9c42d29a090aae15eeb19b80d51" title="Draw a bezier curve with alpha blending.">bezierColor</a>(dst, vx, vy, n, s, ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l06302"></a>06302 } <a name="l06303"></a>06303 <a name="l06304"></a>06304 <a name="l06323"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#af77127ff68a26c573dc5eb52723fb278">06323</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#af77127ff68a26c573dc5eb52723fb278" title="Internal function to initialize the Bresenham line iterator.">_bresenhamInitialize</a>(<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html" title="The structure passed to the internal Bresenham iterator.">SDL_gfxBresenhamIterator</a> *b, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2) <a name="l06324"></a>06324 { <a name="l06325"></a>06325 <span class="keywordtype">int</span> temp; <a name="l06326"></a>06326 <a name="l06327"></a>06327 <span class="keywordflow">if</span> (b==NULL) { <a name="l06328"></a>06328 <span class="keywordflow">return</span>(-1); <a name="l06329"></a>06329 } <a name="l06330"></a>06330 <a name="l06331"></a>06331 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#ae80d529920f12a3d3eda29b1a29e2e8a">x</a> = x1; <a name="l06332"></a>06332 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a48ddc054175e25d435c217ad4639c3a1">y</a> = y1; <a name="l06333"></a>06333 <a name="l06334"></a>06334 <span class="comment">/* dx = abs(x2-x1), s1 = sign(x2-x1) */</span> <a name="l06335"></a>06335 <span class="keywordflow">if</span> ((b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a6a0d40b2ed6d9e674f93396212f0028f">dx</a> = x2 - x1) != 0) { <a name="l06336"></a>06336 <span class="keywordflow">if</span> (b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a6a0d40b2ed6d9e674f93396212f0028f">dx</a> &lt; 0) { <a name="l06337"></a>06337 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a6a0d40b2ed6d9e674f93396212f0028f">dx</a> = -b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a6a0d40b2ed6d9e674f93396212f0028f">dx</a>; <a name="l06338"></a>06338 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#acfb6b9e2b00e34da4313b463c341e597">s1</a> = -1; <a name="l06339"></a>06339 } <span class="keywordflow">else</span> { <a name="l06340"></a>06340 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#acfb6b9e2b00e34da4313b463c341e597">s1</a> = 1; <a name="l06341"></a>06341 } <a name="l06342"></a>06342 } <span class="keywordflow">else</span> { <a name="l06343"></a>06343 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#acfb6b9e2b00e34da4313b463c341e597">s1</a> = 0; <a name="l06344"></a>06344 } <a name="l06345"></a>06345 <a name="l06346"></a>06346 <span class="comment">/* dy = abs(y2-y1), s2 = sign(y2-y1) */</span> <a name="l06347"></a>06347 <span class="keywordflow">if</span> ((b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a4817151aee120cc100c400d3076f4b93">dy</a> = y2 - y1) != 0) { <a name="l06348"></a>06348 <span class="keywordflow">if</span> (b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a4817151aee120cc100c400d3076f4b93">dy</a> &lt; 0) { <a name="l06349"></a>06349 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a4817151aee120cc100c400d3076f4b93">dy</a> = -b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a4817151aee120cc100c400d3076f4b93">dy</a>; <a name="l06350"></a>06350 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a4c68ffea7c3affb6a0ee6219aba89a69">s2</a> = -1; <a name="l06351"></a>06351 } <span class="keywordflow">else</span> { <a name="l06352"></a>06352 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a4c68ffea7c3affb6a0ee6219aba89a69">s2</a> = 1; <a name="l06353"></a>06353 } <a name="l06354"></a>06354 } <span class="keywordflow">else</span> { <a name="l06355"></a>06355 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a4c68ffea7c3affb6a0ee6219aba89a69">s2</a> = 0; <a name="l06356"></a>06356 } <a name="l06357"></a>06357 <a name="l06358"></a>06358 <span class="keywordflow">if</span> (b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a4817151aee120cc100c400d3076f4b93">dy</a> &gt; b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a6a0d40b2ed6d9e674f93396212f0028f">dx</a>) { <a name="l06359"></a>06359 temp = b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a6a0d40b2ed6d9e674f93396212f0028f">dx</a>; <a name="l06360"></a>06360 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a6a0d40b2ed6d9e674f93396212f0028f">dx</a> = b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a4817151aee120cc100c400d3076f4b93">dy</a>; <a name="l06361"></a>06361 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a4817151aee120cc100c400d3076f4b93">dy</a> = temp; <a name="l06362"></a>06362 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#ace147c79e29f2efd14e5744efcb976af">swapdir</a> = 1; <a name="l06363"></a>06363 } <span class="keywordflow">else</span> { <a name="l06364"></a>06364 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#ace147c79e29f2efd14e5744efcb976af">swapdir</a> = 0; <a name="l06365"></a>06365 } <a name="l06366"></a>06366 <a name="l06367"></a>06367 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a92fcd448f278df155fd5472527a6dc47">count</a> = (b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a6a0d40b2ed6d9e674f93396212f0028f">dx</a>&lt;0) ? 0 : (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a6a0d40b2ed6d9e674f93396212f0028f">dx</a>; <a name="l06368"></a>06368 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a4817151aee120cc100c400d3076f4b93">dy</a> &lt;&lt;= 1; <a name="l06369"></a>06369 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a11614f44ef4d939bdd984953346a7572">error</a> = b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a4817151aee120cc100c400d3076f4b93">dy</a> - b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a6a0d40b2ed6d9e674f93396212f0028f">dx</a>; <a name="l06370"></a>06370 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a6a0d40b2ed6d9e674f93396212f0028f">dx</a> &lt;&lt;= 1; <a name="l06371"></a>06371 <a name="l06372"></a>06372 <span class="keywordflow">return</span>(0); <a name="l06373"></a>06373 } <a name="l06374"></a>06374 <a name="l06375"></a>06375 <a name="l06385"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#a4e0deda326a4dddde7adb2b20f927125">06385</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a4e0deda326a4dddde7adb2b20f927125" title="Internal function to move Bresenham line iterator to the next position.">_bresenhamIterate</a>(<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html" title="The structure passed to the internal Bresenham iterator.">SDL_gfxBresenhamIterator</a> *b) <a name="l06386"></a>06386 { <a name="l06387"></a>06387 <span class="keywordflow">if</span> (b==NULL) { <a name="l06388"></a>06388 <span class="keywordflow">return</span> (-1); <a name="l06389"></a>06389 } <a name="l06390"></a>06390 <a name="l06391"></a>06391 <span class="comment">/* last point check */</span> <a name="l06392"></a>06392 <span class="keywordflow">if</span> (b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a92fcd448f278df155fd5472527a6dc47">count</a>==0) { <a name="l06393"></a>06393 <span class="keywordflow">return</span> (2); <a name="l06394"></a>06394 } <a name="l06395"></a>06395 <a name="l06396"></a>06396 <span class="keywordflow">while</span> (b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a11614f44ef4d939bdd984953346a7572">error</a> &gt;= 0) { <a name="l06397"></a>06397 <span class="keywordflow">if</span> (b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#ace147c79e29f2efd14e5744efcb976af">swapdir</a>) { <a name="l06398"></a>06398 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#ae80d529920f12a3d3eda29b1a29e2e8a">x</a> += b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#acfb6b9e2b00e34da4313b463c341e597">s1</a>; <a name="l06399"></a>06399 } <span class="keywordflow">else</span> { <a name="l06400"></a>06400 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a48ddc054175e25d435c217ad4639c3a1">y</a> += b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a4c68ffea7c3affb6a0ee6219aba89a69">s2</a>; <a name="l06401"></a>06401 } <a name="l06402"></a>06402 <a name="l06403"></a>06403 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a11614f44ef4d939bdd984953346a7572">error</a> -= b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a6a0d40b2ed6d9e674f93396212f0028f">dx</a>; <a name="l06404"></a>06404 } <a name="l06405"></a>06405 <a name="l06406"></a>06406 <span class="keywordflow">if</span> (b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#ace147c79e29f2efd14e5744efcb976af">swapdir</a>) { <a name="l06407"></a>06407 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a48ddc054175e25d435c217ad4639c3a1">y</a> += b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a4c68ffea7c3affb6a0ee6219aba89a69">s2</a>; <a name="l06408"></a>06408 } <span class="keywordflow">else</span> { <a name="l06409"></a>06409 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#ae80d529920f12a3d3eda29b1a29e2e8a">x</a> += b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#acfb6b9e2b00e34da4313b463c341e597">s1</a>; <a name="l06410"></a>06410 } <a name="l06411"></a>06411 <a name="l06412"></a>06412 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a11614f44ef4d939bdd984953346a7572">error</a> += b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a4817151aee120cc100c400d3076f4b93">dy</a>; <a name="l06413"></a>06413 b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a92fcd448f278df155fd5472527a6dc47">count</a>--; <a name="l06414"></a>06414 <a name="l06415"></a>06415 <span class="comment">/* count==0 indicates &quot;end-of-line&quot; */</span> <a name="l06416"></a>06416 <span class="keywordflow">return</span> ((b-&gt;<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a92fcd448f278df155fd5472527a6dc47">count</a>) ? 0 : 1); <a name="l06417"></a>06417 } <a name="l06418"></a>06418 <a name="l06419"></a>06419 <a name="l06428"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#ae11cad619c4fc85a7ff5d3c9d9686ccb">06428</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae11cad619c4fc85a7ff5d3c9d9686ccb" title="Internal function to to draw parallel lines with Murphy algorithm.">_murphyParaline</a>(<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html" title="The structure passed to the internal Murphy iterator.">SDL_gfxMurphyIterator</a> *m, Sint16 x, Sint16 y, <span class="keywordtype">int</span> d1) <a name="l06429"></a>06429 { <a name="l06430"></a>06430 <span class="keywordtype">int</span> p; <a name="l06431"></a>06431 d1 = -d1; <a name="l06432"></a>06432 <a name="l06433"></a>06433 <span class="comment">/*</span> <a name="l06434"></a>06434 <span class="comment"> * Lock the surface </span> <a name="l06435"></a>06435 <span class="comment"> */</span> <a name="l06436"></a>06436 <span class="keywordflow">if</span> (SDL_MUSTLOCK(m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">dst</a>)) { <a name="l06437"></a>06437 SDL_LockSurface(m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">dst</a>); <a name="l06438"></a>06438 } <a name="l06439"></a>06439 <a name="l06440"></a>06440 <span class="keywordflow">for</span> (p = 0; p &lt;= m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a5874b4c2ec2e28321eea4e4871d08222">u</a>; p++) { <a name="l06441"></a>06441 <a name="l06442"></a>06442 <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">dst</a>, x, y, m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#afd133e412238ed9f1e3ba52397115e8d">color</a>); <a name="l06443"></a>06443 <a name="l06444"></a>06444 <span class="keywordflow">if</span> (d1 &lt;= m-&gt;kt) { <a name="l06445"></a>06445 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ab9894ea9f5570af0e7fa86e61a3bb60b">oct2</a> == 0) { <a name="l06446"></a>06446 x++; <a name="l06447"></a>06447 } <span class="keywordflow">else</span> { <a name="l06448"></a>06448 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac65502ab7d0d8cbf739c6e06c35d8edb">quad4</a> == 0) { <a name="l06449"></a>06449 y++; <a name="l06450"></a>06450 } <span class="keywordflow">else</span> { <a name="l06451"></a>06451 y--; <a name="l06452"></a>06452 } <a name="l06453"></a>06453 } <a name="l06454"></a>06454 d1 += m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af59597daf52972ab61551495c3d7e6cd">kv</a>; <a name="l06455"></a>06455 } <span class="keywordflow">else</span> { <a name="l06456"></a>06456 x++; <a name="l06457"></a>06457 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac65502ab7d0d8cbf739c6e06c35d8edb">quad4</a> == 0) { <a name="l06458"></a>06458 y++; <a name="l06459"></a>06459 } <span class="keywordflow">else</span> { <a name="l06460"></a>06460 y--; <a name="l06461"></a>06461 } <a name="l06462"></a>06462 d1 += m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ade809c6ad2d8ae1dc2f665077951b81a">kd</a>; <a name="l06463"></a>06463 } <a name="l06464"></a>06464 } <a name="l06465"></a>06465 <a name="l06466"></a>06466 <span class="comment">/* Unlock surface */</span> <a name="l06467"></a>06467 <span class="keywordflow">if</span> (SDL_MUSTLOCK(m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">dst</a>)) { <a name="l06468"></a>06468 SDL_UnlockSurface(m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">dst</a>); <a name="l06469"></a>06469 } <a name="l06470"></a>06470 <a name="l06471"></a>06471 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af4320e1b2f9da1ee4155b6cfe35c8d7e">tempx</a> = x; <a name="l06472"></a>06472 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a4c3e88fc7abb5715d04e28d96a154e5f">tempy</a> = y; <a name="l06473"></a>06473 } <a name="l06474"></a>06474 <a name="l06490"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#a9611a25f40d9cd4a70b3424dfa568b8b">06490</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a9611a25f40d9cd4a70b3424dfa568b8b" title="Internal function to to draw one iteration of the Murphy algorithm.">_murphyIteration</a>(<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html" title="The structure passed to the internal Murphy iterator.">SDL_gfxMurphyIterator</a> *m, Uint8 miter, <a name="l06491"></a>06491 Uint16 ml1bx, Uint16 ml1by, Uint16 ml2bx, Uint16 ml2by, <a name="l06492"></a>06492 Uint16 ml1x, Uint16 ml1y, Uint16 ml2x, Uint16 ml2y) <a name="l06493"></a>06493 { <a name="l06494"></a>06494 <span class="keywordtype">int</span> atemp1, atemp2; <a name="l06495"></a>06495 <span class="keywordtype">int</span> ftmp1, ftmp2; <a name="l06496"></a>06496 Uint16 m1x, m1y, m2x, m2y; <a name="l06497"></a>06497 Uint16 fix, fiy, lax, lay, curx, cury; <a name="l06498"></a>06498 Uint16 px[4], py[4]; <a name="l06499"></a>06499 <a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html" title="The structure passed to the internal Bresenham iterator.">SDL_gfxBresenhamIterator</a> b; <a name="l06500"></a>06500 <a name="l06501"></a>06501 <span class="keywordflow">if</span> (miter &gt; 1) { <a name="l06502"></a>06502 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a20a0f29217c4df1896f0b5b2e0db8901">first1x</a> != -32768) { <a name="l06503"></a>06503 fix = (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a20a0f29217c4df1896f0b5b2e0db8901">first1x</a> + m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a0043c9be4575c0c75cda25d9cec09deb">first2x</a>) / 2; <a name="l06504"></a>06504 fiy = (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a1e6adb477c4b1db15853adf1b5340760">first1y</a> + m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac8c0bb60c5be224d8d7fd4d4fd74930c">first2y</a>) / 2; <a name="l06505"></a>06505 lax = (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#adc37a4a286331a97587fdf4f239fa5e6">last1x</a> + m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a1acb203975c193230a03cee26bbd3f97">last2x</a>) / 2; <a name="l06506"></a>06506 lay = (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a48dabb55f39ba73ecacc558eba6f5b15">last1y</a> + m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ab85d5d3386d741c19de5bc0a7767d185">last2y</a>) / 2; <a name="l06507"></a>06507 curx = (ml1x + ml2x) / 2; <a name="l06508"></a>06508 cury = (ml1y + ml2y) / 2; <a name="l06509"></a>06509 <a name="l06510"></a>06510 atemp1 = (fix - curx); <a name="l06511"></a>06511 atemp2 = (fiy - cury); <a name="l06512"></a>06512 ftmp1 = atemp1 * atemp1 + atemp2 * atemp2; <a name="l06513"></a>06513 atemp1 = (lax - curx); <a name="l06514"></a>06514 atemp2 = (lay - cury); <a name="l06515"></a>06515 ftmp2 = atemp1 * atemp1 + atemp2 * atemp2; <a name="l06516"></a>06516 <a name="l06517"></a>06517 <span class="keywordflow">if</span> (ftmp1 &lt;= ftmp2) { <a name="l06518"></a>06518 m1x = m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a20a0f29217c4df1896f0b5b2e0db8901">first1x</a>; <a name="l06519"></a>06519 m1y = m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a1e6adb477c4b1db15853adf1b5340760">first1y</a>; <a name="l06520"></a>06520 m2x = m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a0043c9be4575c0c75cda25d9cec09deb">first2x</a>; <a name="l06521"></a>06521 m2y = m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac8c0bb60c5be224d8d7fd4d4fd74930c">first2y</a>; <a name="l06522"></a>06522 } <span class="keywordflow">else</span> { <a name="l06523"></a>06523 m1x = m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#adc37a4a286331a97587fdf4f239fa5e6">last1x</a>; <a name="l06524"></a>06524 m1y = m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a48dabb55f39ba73ecacc558eba6f5b15">last1y</a>; <a name="l06525"></a>06525 m2x = m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a1acb203975c193230a03cee26bbd3f97">last2x</a>; <a name="l06526"></a>06526 m2y = m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ab85d5d3386d741c19de5bc0a7767d185">last2y</a>; <a name="l06527"></a>06527 } <a name="l06528"></a>06528 <a name="l06529"></a>06529 atemp1 = (m2x - ml2x); <a name="l06530"></a>06530 atemp2 = (m2y - ml2y); <a name="l06531"></a>06531 ftmp1 = atemp1 * atemp1 + atemp2 * atemp2; <a name="l06532"></a>06532 atemp1 = (m2x - ml2bx); <a name="l06533"></a>06533 atemp2 = (m2y - ml2by); <a name="l06534"></a>06534 ftmp2 = atemp1 * atemp1 + atemp2 * atemp2; <a name="l06535"></a>06535 <a name="l06536"></a>06536 <span class="keywordflow">if</span> (ftmp2 &gt;= ftmp1) { <a name="l06537"></a>06537 ftmp1 = ml2bx; <a name="l06538"></a>06538 ftmp2 = ml2by; <a name="l06539"></a>06539 ml2bx = ml2x; <a name="l06540"></a>06540 ml2by = ml2y; <a name="l06541"></a>06541 ml2x = ftmp1; <a name="l06542"></a>06542 ml2y = ftmp2; <a name="l06543"></a>06543 ftmp1 = ml1bx; <a name="l06544"></a>06544 ftmp2 = ml1by; <a name="l06545"></a>06545 ml1bx = ml1x; <a name="l06546"></a>06546 ml1by = ml1y; <a name="l06547"></a>06547 ml1x = ftmp1; <a name="l06548"></a>06548 ml1y = ftmp2; <a name="l06549"></a>06549 } <a name="l06550"></a>06550 <a name="l06551"></a>06551 <span class="comment">/*</span> <a name="l06552"></a>06552 <span class="comment"> * Lock the surface </span> <a name="l06553"></a>06553 <span class="comment"> */</span> <a name="l06554"></a>06554 <span class="keywordflow">if</span> (SDL_MUSTLOCK(m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">dst</a>)) { <a name="l06555"></a>06555 SDL_LockSurface(m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">dst</a>); <a name="l06556"></a>06556 } <a name="l06557"></a>06557 <a name="l06558"></a>06558 <a class="code" href="_s_d_l__gfx_primitives_8c.html#af77127ff68a26c573dc5eb52723fb278" title="Internal function to initialize the Bresenham line iterator.">_bresenhamInitialize</a>(&amp;b, m2x, m2y, m1x, m1y); <a name="l06559"></a>06559 <span class="keywordflow">do</span> { <a name="l06560"></a>06560 <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">dst</a>, b.<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#ae80d529920f12a3d3eda29b1a29e2e8a">x</a>, b.<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a48ddc054175e25d435c217ad4639c3a1">y</a>, m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#afd133e412238ed9f1e3ba52397115e8d">color</a>); <a name="l06561"></a>06561 } <span class="keywordflow">while</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a4e0deda326a4dddde7adb2b20f927125" title="Internal function to move Bresenham line iterator to the next position.">_bresenhamIterate</a>(&amp;b)==0); <a name="l06562"></a>06562 <a name="l06563"></a>06563 <a class="code" href="_s_d_l__gfx_primitives_8c.html#af77127ff68a26c573dc5eb52723fb278" title="Internal function to initialize the Bresenham line iterator.">_bresenhamInitialize</a>(&amp;b, m1x, m1y, ml1bx, ml1by); <a name="l06564"></a>06564 <span class="keywordflow">do</span> { <a name="l06565"></a>06565 <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">dst</a>, b.<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#ae80d529920f12a3d3eda29b1a29e2e8a">x</a>, b.<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a48ddc054175e25d435c217ad4639c3a1">y</a>, m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#afd133e412238ed9f1e3ba52397115e8d">color</a>); <a name="l06566"></a>06566 } <span class="keywordflow">while</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a4e0deda326a4dddde7adb2b20f927125" title="Internal function to move Bresenham line iterator to the next position.">_bresenhamIterate</a>(&amp;b)==0); <a name="l06567"></a>06567 <a name="l06568"></a>06568 <a class="code" href="_s_d_l__gfx_primitives_8c.html#af77127ff68a26c573dc5eb52723fb278" title="Internal function to initialize the Bresenham line iterator.">_bresenhamInitialize</a>(&amp;b, ml1bx, ml1by, ml2bx, ml2by); <a name="l06569"></a>06569 <span class="keywordflow">do</span> { <a name="l06570"></a>06570 <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">dst</a>, b.<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#ae80d529920f12a3d3eda29b1a29e2e8a">x</a>, b.<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a48ddc054175e25d435c217ad4639c3a1">y</a>, m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#afd133e412238ed9f1e3ba52397115e8d">color</a>); <a name="l06571"></a>06571 } <span class="keywordflow">while</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a4e0deda326a4dddde7adb2b20f927125" title="Internal function to move Bresenham line iterator to the next position.">_bresenhamIterate</a>(&amp;b)==0); <a name="l06572"></a>06572 <a name="l06573"></a>06573 <a class="code" href="_s_d_l__gfx_primitives_8c.html#af77127ff68a26c573dc5eb52723fb278" title="Internal function to initialize the Bresenham line iterator.">_bresenhamInitialize</a>(&amp;b, ml2bx, ml2by, m2x, m2y); <a name="l06574"></a>06574 <span class="keywordflow">do</span> { <a name="l06575"></a>06575 <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0" title="Pixel draw with blending enabled if a&lt;255 - no surface locking.">pixelColorNolock</a>(m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">dst</a>, b.<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#ae80d529920f12a3d3eda29b1a29e2e8a">x</a>, b.<a class="code" href="struct_s_d_l__gfx_bresenham_iterator.html#a48ddc054175e25d435c217ad4639c3a1">y</a>, m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#afd133e412238ed9f1e3ba52397115e8d">color</a>); <a name="l06576"></a>06576 } <span class="keywordflow">while</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a4e0deda326a4dddde7adb2b20f927125" title="Internal function to move Bresenham line iterator to the next position.">_bresenhamIterate</a>(&amp;b)==0); <a name="l06577"></a>06577 <a name="l06578"></a>06578 <span class="comment">/* Unlock surface */</span> <a name="l06579"></a>06579 <span class="keywordflow">if</span> (SDL_MUSTLOCK(m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">dst</a>)) { <a name="l06580"></a>06580 SDL_UnlockSurface(m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">dst</a>); <a name="l06581"></a>06581 } <a name="l06582"></a>06582 <a name="l06583"></a>06583 px[0] = m1x; <a name="l06584"></a>06584 px[1] = m2x; <a name="l06585"></a>06585 px[2] = ml1bx; <a name="l06586"></a>06586 px[3] = ml2bx; <a name="l06587"></a>06587 py[0] = m1y; <a name="l06588"></a>06588 py[1] = m2y; <a name="l06589"></a>06589 py[2] = ml1by; <a name="l06590"></a>06590 py[3] = ml2by; <a name="l06591"></a>06591 <a class="code" href="_s_d_l__gfx_primitives_8c.html#a2d692dc25f3b579b386dff8dcd9cbc00" title="Draw polygon with alpha blending.">polygonColor</a>(m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">dst</a>, px, py, 4, m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#afd133e412238ed9f1e3ba52397115e8d">color</a>); <a name="l06592"></a>06592 } <a name="l06593"></a>06593 } <a name="l06594"></a>06594 <a name="l06595"></a>06595 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#adc37a4a286331a97587fdf4f239fa5e6">last1x</a> = ml1x; <a name="l06596"></a>06596 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a48dabb55f39ba73ecacc558eba6f5b15">last1y</a> = ml1y; <a name="l06597"></a>06597 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a1acb203975c193230a03cee26bbd3f97">last2x</a> = ml2x; <a name="l06598"></a>06598 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ab85d5d3386d741c19de5bc0a7767d185">last2y</a> = ml2y; <a name="l06599"></a>06599 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a20a0f29217c4df1896f0b5b2e0db8901">first1x</a> = ml1bx; <a name="l06600"></a>06600 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a1e6adb477c4b1db15853adf1b5340760">first1y</a> = ml1by; <a name="l06601"></a>06601 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a0043c9be4575c0c75cda25d9cec09deb">first2x</a> = ml2bx; <a name="l06602"></a>06602 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac8c0bb60c5be224d8d7fd4d4fd74930c">first2y</a> = ml2by; <a name="l06603"></a>06603 } <a name="l06604"></a>06604 <a name="l06605"></a>06605 <a name="l06606"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#a764ddb925da0921f024fadb4c12d7382">06606</a> <span class="preprocessor">#define HYPOT(x,y) sqrt((double)(x)*(double)(x)+(double)(y)*(double)(y)) </span> <a name="l06607"></a>06607 <span class="preprocessor"></span> <a name="l06622"></a><a class="code" href="_s_d_l__gfx_primitives_8c.html#abaa64d3d707ae122c88f2a509cded121">06622</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#abaa64d3d707ae122c88f2a509cded121" title="Internal function to to draw wide lines with Murphy algorithm.">_murphyWideline</a>(<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html" title="The structure passed to the internal Murphy iterator.">SDL_gfxMurphyIterator</a> *m, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 miter) <a name="l06623"></a>06623 { <a name="l06624"></a>06624 <span class="keywordtype">float</span> offset = (float)width / 2.f; <a name="l06625"></a>06625 <a name="l06626"></a>06626 Sint16 temp; <a name="l06627"></a>06627 Sint16 ptx, pty, ptxx, ptxy, ml1x, ml1y, ml2x, ml2y, ml1bx, ml1by, ml2bx, ml2by; <a name="l06628"></a>06628 <a name="l06629"></a>06629 <span class="keywordtype">int</span> d0, d1; <span class="comment">/* difference terms d0=perpendicular to line, d1=along line */</span> <a name="l06630"></a>06630 <a name="l06631"></a>06631 <span class="keywordtype">int</span> q; <span class="comment">/* pel counter,q=perpendicular to line */</span> <a name="l06632"></a>06632 <span class="keywordtype">int</span> tmp; <a name="l06633"></a>06633 <a name="l06634"></a>06634 <span class="keywordtype">int</span> dd; <span class="comment">/* distance along line */</span> <a name="l06635"></a>06635 <span class="keywordtype">int</span> tk; <span class="comment">/* thickness threshold */</span> <a name="l06636"></a>06636 <span class="keywordtype">double</span> ang; <span class="comment">/* angle for initial point calculation */</span> <a name="l06637"></a>06637 <span class="keywordtype">double</span> sang, cang; <a name="l06638"></a>06638 <a name="l06639"></a>06639 <span class="comment">/* Initialisation */</span> <a name="l06640"></a>06640 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a5874b4c2ec2e28321eea4e4871d08222">u</a> = x2 - x1; <span class="comment">/* delta x */</span> <a name="l06641"></a>06641 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac8859e8c1ce357c4c8b37bbb1936ba1c">v</a> = y2 - y1; <span class="comment">/* delta y */</span> <a name="l06642"></a>06642 <a name="l06643"></a>06643 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a5874b4c2ec2e28321eea4e4871d08222">u</a> &lt; 0) { <span class="comment">/* swap to make sure we are in quadrants 1 or 4 */</span> <a name="l06644"></a>06644 temp = x1; <a name="l06645"></a>06645 x1 = x2; <a name="l06646"></a>06646 x2 = temp; <a name="l06647"></a>06647 temp = y1; <a name="l06648"></a>06648 y1 = y2; <a name="l06649"></a>06649 y2 = temp; <a name="l06650"></a>06650 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a5874b4c2ec2e28321eea4e4871d08222">u</a> *= -1; <a name="l06651"></a>06651 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac8859e8c1ce357c4c8b37bbb1936ba1c">v</a> *= -1; <a name="l06652"></a>06652 } <a name="l06653"></a>06653 <a name="l06654"></a>06654 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac8859e8c1ce357c4c8b37bbb1936ba1c">v</a> &lt; 0) { <span class="comment">/* swap to 1st quadrant and flag */</span> <a name="l06655"></a>06655 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac8859e8c1ce357c4c8b37bbb1936ba1c">v</a> *= -1; <a name="l06656"></a>06656 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac65502ab7d0d8cbf739c6e06c35d8edb">quad4</a> = 1; <a name="l06657"></a>06657 } <span class="keywordflow">else</span> { <a name="l06658"></a>06658 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac65502ab7d0d8cbf739c6e06c35d8edb">quad4</a> = 0; <a name="l06659"></a>06659 } <a name="l06660"></a>06660 <a name="l06661"></a>06661 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac8859e8c1ce357c4c8b37bbb1936ba1c">v</a> &gt; m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a5874b4c2ec2e28321eea4e4871d08222">u</a>) { <span class="comment">/* swap things if in 2 octant */</span> <a name="l06662"></a>06662 tmp = m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a5874b4c2ec2e28321eea4e4871d08222">u</a>; <a name="l06663"></a>06663 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a5874b4c2ec2e28321eea4e4871d08222">u</a> = m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac8859e8c1ce357c4c8b37bbb1936ba1c">v</a>; <a name="l06664"></a>06664 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac8859e8c1ce357c4c8b37bbb1936ba1c">v</a> = tmp; <a name="l06665"></a>06665 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ab9894ea9f5570af0e7fa86e61a3bb60b">oct2</a> = 1; <a name="l06666"></a>06666 } <span class="keywordflow">else</span> { <a name="l06667"></a>06667 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ab9894ea9f5570af0e7fa86e61a3bb60b">oct2</a> = 0; <a name="l06668"></a>06668 } <a name="l06669"></a>06669 <a name="l06670"></a>06670 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a2d8fc6210660a003e60ac96216cdd9d1">ku</a> = m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a5874b4c2ec2e28321eea4e4871d08222">u</a> + m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a5874b4c2ec2e28321eea4e4871d08222">u</a>; <span class="comment">/* change in l for square shift */</span> <a name="l06671"></a>06671 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af59597daf52972ab61551495c3d7e6cd">kv</a> = m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac8859e8c1ce357c4c8b37bbb1936ba1c">v</a> + m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac8859e8c1ce357c4c8b37bbb1936ba1c">v</a>; <span class="comment">/* change in d for square shift */</span> <a name="l06672"></a>06672 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ade809c6ad2d8ae1dc2f665077951b81a">kd</a> = m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af59597daf52972ab61551495c3d7e6cd">kv</a> - m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a2d8fc6210660a003e60ac96216cdd9d1">ku</a>; <span class="comment">/* change in d for diagonal shift */</span> <a name="l06673"></a>06673 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac77eef4f813ec344cf850b89cc68818d">kt</a> = m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a5874b4c2ec2e28321eea4e4871d08222">u</a> - m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af59597daf52972ab61551495c3d7e6cd">kv</a>; <span class="comment">/* diag/square decision threshold */</span> <a name="l06674"></a>06674 <a name="l06675"></a>06675 d0 = 0; <a name="l06676"></a>06676 d1 = 0; <a name="l06677"></a>06677 dd = 0; <a name="l06678"></a>06678 <a name="l06679"></a>06679 ang = atan((<span class="keywordtype">double</span>) m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac8859e8c1ce357c4c8b37bbb1936ba1c">v</a> / (<span class="keywordtype">double</span>) m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a5874b4c2ec2e28321eea4e4871d08222">u</a>); <span class="comment">/* calc new initial point - offset both sides of ideal */</span> <a name="l06680"></a>06680 sang = sin(ang); <a name="l06681"></a>06681 cang = cos(ang); <a name="l06682"></a>06682 <a name="l06683"></a>06683 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ab9894ea9f5570af0e7fa86e61a3bb60b">oct2</a> == 0) { <a name="l06684"></a>06684 ptx = x1 + (Sint16)lrint(offset * sang); <a name="l06685"></a>06685 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac65502ab7d0d8cbf739c6e06c35d8edb">quad4</a> == 0) { <a name="l06686"></a>06686 pty = y1 - (Sint16)lrint(offset * cang); <a name="l06687"></a>06687 } <span class="keywordflow">else</span> { <a name="l06688"></a>06688 pty = y1 + (Sint16)lrint(offset * cang); <a name="l06689"></a>06689 } <a name="l06690"></a>06690 } <span class="keywordflow">else</span> { <a name="l06691"></a>06691 ptx = x1 - (Sint16)lrint(offset * cang); <a name="l06692"></a>06692 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac65502ab7d0d8cbf739c6e06c35d8edb">quad4</a> == 0) { <a name="l06693"></a>06693 pty = y1 + (Sint16)lrint(offset * sang); <a name="l06694"></a>06694 } <span class="keywordflow">else</span> { <a name="l06695"></a>06695 pty = y1 - (Sint16)lrint(offset * sang); <a name="l06696"></a>06696 } <a name="l06697"></a>06697 } <a name="l06698"></a>06698 <a name="l06699"></a>06699 <span class="comment">/* used here for constant thickness line */</span> <a name="l06700"></a>06700 tk = (int) (4. * <a class="code" href="_s_d_l__gfx_primitives_8c.html#a764ddb925da0921f024fadb4c12d7382">HYPOT</a>(ptx - x1, pty - y1) * <a class="code" href="_s_d_l__gfx_primitives_8c.html#a764ddb925da0921f024fadb4c12d7382">HYPOT</a>(m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a5874b4c2ec2e28321eea4e4871d08222">u</a>, m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac8859e8c1ce357c4c8b37bbb1936ba1c">v</a>)); <a name="l06701"></a>06701 <a name="l06702"></a>06702 <span class="keywordflow">if</span> (miter == 0) { <a name="l06703"></a>06703 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a20a0f29217c4df1896f0b5b2e0db8901">first1x</a> = -32768; <a name="l06704"></a>06704 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a1e6adb477c4b1db15853adf1b5340760">first1y</a> = -32768; <a name="l06705"></a>06705 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a0043c9be4575c0c75cda25d9cec09deb">first2x</a> = -32768; <a name="l06706"></a>06706 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac8c0bb60c5be224d8d7fd4d4fd74930c">first2y</a> = -32768; <a name="l06707"></a>06707 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#adc37a4a286331a97587fdf4f239fa5e6">last1x</a> = -32768; <a name="l06708"></a>06708 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a48dabb55f39ba73ecacc558eba6f5b15">last1y</a> = -32768; <a name="l06709"></a>06709 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a1acb203975c193230a03cee26bbd3f97">last2x</a> = -32768; <a name="l06710"></a>06710 m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ab85d5d3386d741c19de5bc0a7767d185">last2y</a> = -32768; <a name="l06711"></a>06711 } <a name="l06712"></a>06712 ptxx = ptx; <a name="l06713"></a>06713 ptxy = pty; <a name="l06714"></a>06714 <a name="l06715"></a>06715 <span class="keywordflow">for</span> (q = 0; dd &lt;= tk; q++) { <span class="comment">/* outer loop, stepping perpendicular to line */</span> <a name="l06716"></a>06716 <a name="l06717"></a>06717 <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae11cad619c4fc85a7ff5d3c9d9686ccb" title="Internal function to to draw parallel lines with Murphy algorithm.">_murphyParaline</a>(m, ptx, pty, d1); <span class="comment">/* call to inner loop - right edge */</span> <a name="l06718"></a>06718 <span class="keywordflow">if</span> (q == 0) { <a name="l06719"></a>06719 ml1x = ptx; <a name="l06720"></a>06720 ml1y = pty; <a name="l06721"></a>06721 ml1bx = m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af4320e1b2f9da1ee4155b6cfe35c8d7e">tempx</a>; <a name="l06722"></a>06722 ml1by = m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a4c3e88fc7abb5715d04e28d96a154e5f">tempy</a>; <a name="l06723"></a>06723 } <span class="keywordflow">else</span> { <a name="l06724"></a>06724 ml2x = ptx; <a name="l06725"></a>06725 ml2y = pty; <a name="l06726"></a>06726 ml2bx = m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af4320e1b2f9da1ee4155b6cfe35c8d7e">tempx</a>; <a name="l06727"></a>06727 ml2by = m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a4c3e88fc7abb5715d04e28d96a154e5f">tempy</a>; <a name="l06728"></a>06728 } <a name="l06729"></a>06729 <span class="keywordflow">if</span> (d0 &lt; m-&gt;kt) { <span class="comment">/* square move */</span> <a name="l06730"></a>06730 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ab9894ea9f5570af0e7fa86e61a3bb60b">oct2</a> == 0) { <a name="l06731"></a>06731 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac65502ab7d0d8cbf739c6e06c35d8edb">quad4</a> == 0) { <a name="l06732"></a>06732 pty++; <a name="l06733"></a>06733 } <span class="keywordflow">else</span> { <a name="l06734"></a>06734 pty--; <a name="l06735"></a>06735 } <a name="l06736"></a>06736 } <span class="keywordflow">else</span> { <a name="l06737"></a>06737 ptx++; <a name="l06738"></a>06738 } <a name="l06739"></a>06739 } <span class="keywordflow">else</span> { <span class="comment">/* diagonal move */</span> <a name="l06740"></a>06740 dd += m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af59597daf52972ab61551495c3d7e6cd">kv</a>; <a name="l06741"></a>06741 d0 -= m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a2d8fc6210660a003e60ac96216cdd9d1">ku</a>; <a name="l06742"></a>06742 <span class="keywordflow">if</span> (d1 &lt; m-&gt;kt) { <span class="comment">/* normal diagonal */</span> <a name="l06743"></a>06743 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ab9894ea9f5570af0e7fa86e61a3bb60b">oct2</a> == 0) { <a name="l06744"></a>06744 ptx--; <a name="l06745"></a>06745 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac65502ab7d0d8cbf739c6e06c35d8edb">quad4</a> == 0) { <a name="l06746"></a>06746 pty++; <a name="l06747"></a>06747 } <span class="keywordflow">else</span> { <a name="l06748"></a>06748 pty--; <a name="l06749"></a>06749 } <a name="l06750"></a>06750 } <span class="keywordflow">else</span> { <a name="l06751"></a>06751 ptx++; <a name="l06752"></a>06752 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac65502ab7d0d8cbf739c6e06c35d8edb">quad4</a> == 0) { <a name="l06753"></a>06753 pty--; <a name="l06754"></a>06754 } <span class="keywordflow">else</span> { <a name="l06755"></a>06755 pty++; <a name="l06756"></a>06756 } <a name="l06757"></a>06757 } <a name="l06758"></a>06758 d1 += m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af59597daf52972ab61551495c3d7e6cd">kv</a>; <a name="l06759"></a>06759 } <span class="keywordflow">else</span> { <span class="comment">/* double square move, extra parallel line */</span> <a name="l06760"></a>06760 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ab9894ea9f5570af0e7fa86e61a3bb60b">oct2</a> == 0) { <a name="l06761"></a>06761 ptx--; <a name="l06762"></a>06762 } <span class="keywordflow">else</span> { <a name="l06763"></a>06763 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac65502ab7d0d8cbf739c6e06c35d8edb">quad4</a> == 0) { <a name="l06764"></a>06764 pty--; <a name="l06765"></a>06765 } <span class="keywordflow">else</span> { <a name="l06766"></a>06766 pty++; <a name="l06767"></a>06767 } <a name="l06768"></a>06768 } <a name="l06769"></a>06769 d1 += m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ade809c6ad2d8ae1dc2f665077951b81a">kd</a>; <a name="l06770"></a>06770 <span class="keywordflow">if</span> (dd &gt; tk) { <a name="l06771"></a>06771 <a class="code" href="_s_d_l__gfx_primitives_8c.html#a9611a25f40d9cd4a70b3424dfa568b8b" title="Internal function to to draw one iteration of the Murphy algorithm.">_murphyIteration</a>(m, miter, ml1bx, ml1by, ml2bx, ml2by, ml1x, ml1y, ml2x, ml2y); <a name="l06772"></a>06772 <span class="keywordflow">return</span>; <span class="comment">/* breakout on the extra line */</span> <a name="l06773"></a>06773 } <a name="l06774"></a>06774 <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae11cad619c4fc85a7ff5d3c9d9686ccb" title="Internal function to to draw parallel lines with Murphy algorithm.">_murphyParaline</a>(m, ptx, pty, d1); <a name="l06775"></a>06775 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ab9894ea9f5570af0e7fa86e61a3bb60b">oct2</a> == 0) { <a name="l06776"></a>06776 <span class="keywordflow">if</span> (m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#ac65502ab7d0d8cbf739c6e06c35d8edb">quad4</a> == 0) { <a name="l06777"></a>06777 pty++; <a name="l06778"></a>06778 } <span class="keywordflow">else</span> { <a name="l06779"></a>06779 <a name="l06780"></a>06780 pty--; <a name="l06781"></a>06781 } <a name="l06782"></a>06782 } <span class="keywordflow">else</span> { <a name="l06783"></a>06783 ptx++; <a name="l06784"></a>06784 } <a name="l06785"></a>06785 } <a name="l06786"></a>06786 } <a name="l06787"></a>06787 dd += m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#a2d8fc6210660a003e60ac96216cdd9d1">ku</a>; <a name="l06788"></a>06788 d0 += m-&gt;<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af59597daf52972ab61551495c3d7e6cd">kv</a>; <a name="l06789"></a>06789 } <a name="l06790"></a>06790 <a name="l06791"></a>06791 <a class="code" href="_s_d_l__gfx_primitives_8c.html#a9611a25f40d9cd4a70b3424dfa568b8b" title="Internal function to to draw one iteration of the Murphy algorithm.">_murphyIteration</a>(m, miter, ml1bx, ml1by, ml2bx, ml2by, ml1x, ml1y, ml2x, ml2y); <a name="l06792"></a>06792 } <a name="l06793"></a>06793 <a name="l06794"></a>06794 <a name="l06808"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a40c34464b6c99fd72c4bd7acfac5915d">06808</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a1494109358b4e4b7ec300d83e3f90300" title="Draw a thick line with alpha blending.">thickLineColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint32 color) <a name="l06809"></a>06809 { <a name="l06810"></a>06810 <span class="keywordtype">int</span> wh; <a name="l06811"></a>06811 <a class="code" href="struct_s_d_l__gfx_murphy_iterator.html" title="The structure passed to the internal Murphy iterator.">SDL_gfxMurphyIterator</a> m; <a name="l06812"></a>06812 <a name="l06813"></a>06813 <span class="keywordflow">if</span> (dst == NULL) <span class="keywordflow">return</span> -1; <a name="l06814"></a>06814 <span class="keywordflow">if</span> (width &lt; 1) <span class="keywordflow">return</span> -1; <a name="l06815"></a>06815 <a name="l06816"></a>06816 <span class="comment">/* Special case: thick &quot;point&quot; */</span> <a name="l06817"></a>06817 <span class="keywordflow">if</span> ((x1 == x2) &amp;&amp; (y1 == y2)) { <a name="l06818"></a>06818 wh = width / 2; <a name="l06819"></a>06819 <span class="keywordflow">return</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a6bb30dfc32d0aee20271a0356a2e2fd0" title="Draw box (filled rectangle) with blending.">boxColor</a>(dst, x1 - wh, y1 - wh, x2 + width, y2 + width, color); <a name="l06820"></a>06820 } <a name="l06821"></a>06821 <a name="l06822"></a>06822 m.<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">dst</a> = dst; <a name="l06823"></a>06823 m.<a class="code" href="struct_s_d_l__gfx_murphy_iterator.html#afd133e412238ed9f1e3ba52397115e8d">color</a> = color; <a name="l06824"></a>06824 <a name="l06825"></a>06825 <a class="code" href="_s_d_l__gfx_primitives_8c.html#abaa64d3d707ae122c88f2a509cded121" title="Internal function to to draw wide lines with Murphy algorithm.">_murphyWideline</a>(&amp;m, x1, y1, x2, y2, width, 0); <a name="l06826"></a>06826 <a class="code" href="_s_d_l__gfx_primitives_8c.html#abaa64d3d707ae122c88f2a509cded121" title="Internal function to to draw wide lines with Murphy algorithm.">_murphyWideline</a>(&amp;m, x1, y1, x2, y2, width, 1); <a name="l06827"></a>06827 <a name="l06828"></a>06828 <span class="keywordflow">return</span>(0); <a name="l06829"></a>06829 } <a name="l06830"></a>06830 <a name="l06847"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#aa740c1eff9163862704eb3bb3b5964db">06847</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a8b24d64b51e23592c93abc2aa50c818e" title="Draw a thick line with alpha blending.">thickLineRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 r, Uint8 g, Uint8 b, Uint8 a) <a name="l06848"></a>06848 { <a name="l06849"></a>06849 <span class="keywordflow">return</span> (<a class="code" href="_s_d_l__gfx_primitives_8c.html#a1494109358b4e4b7ec300d83e3f90300" title="Draw a thick line with alpha blending.">thickLineColor</a>(dst, x1, y1, x2, y2, width, <a name="l06850"></a>06850 ((Uint32) r &lt;&lt; 24) | ((Uint32) g &lt;&lt; 16) | ((Uint32) b &lt;&lt; 8) | (Uint32) a)); <a name="l06851"></a>06851 } </pre></div></div><!-- contents --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.0 </small></address> </body> </html>
YifuLiu/AliOS-Things
components/SDL2/src/gfx/Docs/html/_s_d_l__gfx_primitives_8c_source.html
HTML
apache-2.0
517,252
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>SDL_gfx: I:/Sources/sdlgfx/SDL_gfxPrimitives.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SDL_gfx &#160;<span id="projectnumber">2.0.25</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.8.0 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#define-members">Defines</a> &#124; <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">I:/Sources/sdlgfx/SDL_gfxPrimitives.h File Reference</div> </div> </div><!--header--> <div class="contents"> <div class="textblock"><code>#include &lt;math.h&gt;</code><br/> <code>#include &quot;SDL.h&quot;</code><br/> </div> <p><a href="_s_d_l__gfx_primitives_8h_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="define-members"></a> Defines</h2></td></tr> <tr class="memitem:ae71449b1cc6e6250b91f539153a7a0d3"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">M_PI</a>&#160;&#160;&#160;3.1415926535897932384626433832795</td></tr> <tr class="memitem:a2a585f5832061010155d87737ef5bf88"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a2a585f5832061010155d87737ef5bf88">SDL_GFXPRIMITIVES_MAJOR</a>&#160;&#160;&#160;2</td></tr> <tr class="memitem:abd0939b1856bbb822b37b68755dc9ee5"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#abd0939b1856bbb822b37b68755dc9ee5">SDL_GFXPRIMITIVES_MINOR</a>&#160;&#160;&#160;0</td></tr> <tr class="memitem:a06ea681a295987b8b8ec3fcdb04713df"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a06ea681a295987b8b8ec3fcdb04713df">SDL_GFXPRIMITIVES_MICRO</a>&#160;&#160;&#160;25</td></tr> <tr class="memitem:a9501419cbbd2b8739ec5dc4e890c165b"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a>&#160;&#160;&#160;extern</td></tr> <tr><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:a7fe611dbb029ae70be89d5314c7e023b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a7fe611dbb029ae70be89d5314c7e023b">pixelColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)</td></tr> <tr class="memdesc:a7fe611dbb029ae70be89d5314c7e023b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pixel draw with blending enabled if a&lt;255. <a href="#a7fe611dbb029ae70be89d5314c7e023b"></a><br/></td></tr> <tr class="memitem:a0046efc721e77b745fd5b621fbd48513"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a0046efc721e77b745fd5b621fbd48513">pixelRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a0046efc721e77b745fd5b621fbd48513"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pixel draw with blending enabled if a&lt;255. <a href="#a0046efc721e77b745fd5b621fbd48513"></a><br/></td></tr> <tr class="memitem:a31ac87bf32186325deedf5188b987ef6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a31ac87bf32186325deedf5188b987ef6">hlineColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)</td></tr> <tr class="memdesc:a31ac87bf32186325deedf5188b987ef6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw horizontal line with blending. <a href="#a31ac87bf32186325deedf5188b987ef6"></a><br/></td></tr> <tr class="memitem:ae48e69e0f5d13ea79ffac262b146ae9e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#ae48e69e0f5d13ea79ffac262b146ae9e">hlineRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:ae48e69e0f5d13ea79ffac262b146ae9e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw horizontal line with blending. <a href="#ae48e69e0f5d13ea79ffac262b146ae9e"></a><br/></td></tr> <tr class="memitem:ab68d565f00527a67c9d88121c753302c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#ab68d565f00527a67c9d88121c753302c">vlineColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)</td></tr> <tr class="memdesc:ab68d565f00527a67c9d88121c753302c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw vertical line with blending. <a href="#ab68d565f00527a67c9d88121c753302c"></a><br/></td></tr> <tr class="memitem:a68ed9a65e3e0de26136566b0cf0c859e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a68ed9a65e3e0de26136566b0cf0c859e">vlineRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a68ed9a65e3e0de26136566b0cf0c859e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw vertical line with blending. <a href="#a68ed9a65e3e0de26136566b0cf0c859e"></a><br/></td></tr> <tr class="memitem:a36453f52608a10f3d6b8edccae260b95"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a36453f52608a10f3d6b8edccae260b95">rectangleColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)</td></tr> <tr class="memdesc:a36453f52608a10f3d6b8edccae260b95"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw rectangle with blending. <a href="#a36453f52608a10f3d6b8edccae260b95"></a><br/></td></tr> <tr class="memitem:a6c41cbfd0618262de4d4d127ed1e67fe"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a6c41cbfd0618262de4d4d127ed1e67fe">rectangleRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a6c41cbfd0618262de4d4d127ed1e67fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw rectangle with blending. <a href="#a6c41cbfd0618262de4d4d127ed1e67fe"></a><br/></td></tr> <tr class="memitem:a4109d2d1efa021c021fc4a98a0e3691b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a4109d2d1efa021c021fc4a98a0e3691b">roundedRectangleColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)</td></tr> <tr class="memdesc:a4109d2d1efa021c021fc4a98a0e3691b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw rounded-corner rectangle with blending. <a href="#a4109d2d1efa021c021fc4a98a0e3691b"></a><br/></td></tr> <tr class="memitem:a475432abc4756e6f30ef097d5cac02c9"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a475432abc4756e6f30ef097d5cac02c9">roundedRectangleRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a475432abc4756e6f30ef097d5cac02c9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw rounded-corner rectangle with blending. <a href="#a475432abc4756e6f30ef097d5cac02c9"></a><br/></td></tr> <tr class="memitem:a16693489da67d6e65a28f9e5217b46f9"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a16693489da67d6e65a28f9e5217b46f9">boxColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)</td></tr> <tr class="memdesc:a16693489da67d6e65a28f9e5217b46f9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw box (filled rectangle) with blending. <a href="#a16693489da67d6e65a28f9e5217b46f9"></a><br/></td></tr> <tr class="memitem:a0ae084c90bd9b734356ad723d45973c8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a0ae084c90bd9b734356ad723d45973c8">boxRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a0ae084c90bd9b734356ad723d45973c8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw box (filled rectangle) with blending. <a href="#a0ae084c90bd9b734356ad723d45973c8"></a><br/></td></tr> <tr class="memitem:a9f9be6e605e764fd23dd154fb12b80e9"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9f9be6e605e764fd23dd154fb12b80e9">roundedBoxColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)</td></tr> <tr class="memdesc:a9f9be6e605e764fd23dd154fb12b80e9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw rounded-corner box (filled rectangle) with blending. <a href="#a9f9be6e605e764fd23dd154fb12b80e9"></a><br/></td></tr> <tr class="memitem:a7105b88e62fe42b26602d3b426547bc7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a7105b88e62fe42b26602d3b426547bc7">roundedBoxRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a7105b88e62fe42b26602d3b426547bc7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw rounded-corner box (filled rectangle) with blending. <a href="#a7105b88e62fe42b26602d3b426547bc7"></a><br/></td></tr> <tr class="memitem:a6f37058aed308619de8109ebe84b5fe9"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a6f37058aed308619de8109ebe84b5fe9">lineColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)</td></tr> <tr class="memdesc:a6f37058aed308619de8109ebe84b5fe9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw line with alpha blending. <a href="#a6f37058aed308619de8109ebe84b5fe9"></a><br/></td></tr> <tr class="memitem:a5e4bd13b12d34698fbcb2dc9d3a0e9f3"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a5e4bd13b12d34698fbcb2dc9d3a0e9f3">lineRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a5e4bd13b12d34698fbcb2dc9d3a0e9f3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw line with alpha blending. <a href="#a5e4bd13b12d34698fbcb2dc9d3a0e9f3"></a><br/></td></tr> <tr class="memitem:a4711ada424cb411e328fcedbf28ca5bd"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a4711ada424cb411e328fcedbf28ca5bd">aalineColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)</td></tr> <tr class="memdesc:a4711ada424cb411e328fcedbf28ca5bd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Ddraw anti-aliased line with alpha blending. <a href="#a4711ada424cb411e328fcedbf28ca5bd"></a><br/></td></tr> <tr class="memitem:aaf65728167a6aa7b37010560507fb4a2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#aaf65728167a6aa7b37010560507fb4a2">aalineRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:aaf65728167a6aa7b37010560507fb4a2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw anti-aliased line with alpha blending. <a href="#aaf65728167a6aa7b37010560507fb4a2"></a><br/></td></tr> <tr class="memitem:a40c34464b6c99fd72c4bd7acfac5915d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a40c34464b6c99fd72c4bd7acfac5915d">thickLineColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint32 color)</td></tr> <tr class="memdesc:a40c34464b6c99fd72c4bd7acfac5915d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw a thick line with alpha blending. <a href="#a40c34464b6c99fd72c4bd7acfac5915d"></a><br/></td></tr> <tr class="memitem:aa740c1eff9163862704eb3bb3b5964db"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#aa740c1eff9163862704eb3bb3b5964db">thickLineRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:aa740c1eff9163862704eb3bb3b5964db"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw a thick line with alpha blending. <a href="#aa740c1eff9163862704eb3bb3b5964db"></a><br/></td></tr> <tr class="memitem:a58d231ecaf113f53c2a28435e0632624"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a58d231ecaf113f53c2a28435e0632624">circleColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)</td></tr> <tr class="memdesc:a58d231ecaf113f53c2a28435e0632624"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw circle with blending. <a href="#a58d231ecaf113f53c2a28435e0632624"></a><br/></td></tr> <tr class="memitem:a8e0945b74c02cdb1441e1b2a29d2c87d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a8e0945b74c02cdb1441e1b2a29d2c87d">circleRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a8e0945b74c02cdb1441e1b2a29d2c87d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw circle with blending. <a href="#a8e0945b74c02cdb1441e1b2a29d2c87d"></a><br/></td></tr> <tr class="memitem:a6180558aff14d3c240d9e8bf919869ef"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a6180558aff14d3c240d9e8bf919869ef">arcColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)</td></tr> <tr class="memdesc:a6180558aff14d3c240d9e8bf919869ef"><td class="mdescLeft">&#160;</td><td class="mdescRight">Arc with blending. <a href="#a6180558aff14d3c240d9e8bf919869ef"></a><br/></td></tr> <tr class="memitem:a5d8d25ecb69e9386289125eb21668a2f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a5d8d25ecb69e9386289125eb21668a2f">arcRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a5d8d25ecb69e9386289125eb21668a2f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Arc with blending. <a href="#a5d8d25ecb69e9386289125eb21668a2f"></a><br/></td></tr> <tr class="memitem:aee66c744f9fbe58c9f93ad33375373c3"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#aee66c744f9fbe58c9f93ad33375373c3">aacircleColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)</td></tr> <tr class="memdesc:aee66c744f9fbe58c9f93ad33375373c3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw anti-aliased circle with blending. <a href="#aee66c744f9fbe58c9f93ad33375373c3"></a><br/></td></tr> <tr class="memitem:a613099498679e6280959cdfdcd59a143"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a613099498679e6280959cdfdcd59a143">aacircleRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a613099498679e6280959cdfdcd59a143"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw anti-aliased circle with blending. <a href="#a613099498679e6280959cdfdcd59a143"></a><br/></td></tr> <tr class="memitem:a4f7b717b958ef39bfc8c958476dd0de1"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a4f7b717b958ef39bfc8c958476dd0de1">filledCircleColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 r, Uint32 color)</td></tr> <tr class="memdesc:a4f7b717b958ef39bfc8c958476dd0de1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled circle with blending. <a href="#a4f7b717b958ef39bfc8c958476dd0de1"></a><br/></td></tr> <tr class="memitem:a01af970ce0be38cea9884bc6f816c984"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a01af970ce0be38cea9884bc6f816c984">filledCircleRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a01af970ce0be38cea9884bc6f816c984"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled circle with blending. <a href="#a01af970ce0be38cea9884bc6f816c984"></a><br/></td></tr> <tr class="memitem:a8b46f389c626806e7a1ec148f0980737"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a8b46f389c626806e7a1ec148f0980737">ellipseColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)</td></tr> <tr class="memdesc:a8b46f389c626806e7a1ec148f0980737"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw ellipse with blending. <a href="#a8b46f389c626806e7a1ec148f0980737"></a><br/></td></tr> <tr class="memitem:a523156891302420d2296b1a302c1fc2b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a523156891302420d2296b1a302c1fc2b">ellipseRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a523156891302420d2296b1a302c1fc2b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw ellipse with blending. <a href="#a523156891302420d2296b1a302c1fc2b"></a><br/></td></tr> <tr class="memitem:a6edf60c54acc964cbb47ddefc6c0d450"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a6edf60c54acc964cbb47ddefc6c0d450">aaellipseColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)</td></tr> <tr class="memdesc:a6edf60c54acc964cbb47ddefc6c0d450"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw anti-aliased ellipse with blending. <a href="#a6edf60c54acc964cbb47ddefc6c0d450"></a><br/></td></tr> <tr class="memitem:ab6db169d39ea972469e761f338153e21"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#ab6db169d39ea972469e761f338153e21">aaellipseRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:ab6db169d39ea972469e761f338153e21"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw anti-aliased ellipse with blending. <a href="#ab6db169d39ea972469e761f338153e21"></a><br/></td></tr> <tr class="memitem:a36e83e5648b95d38d1efe98dcf840fab"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a36e83e5648b95d38d1efe98dcf840fab">filledEllipseColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)</td></tr> <tr class="memdesc:a36e83e5648b95d38d1efe98dcf840fab"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled ellipse with blending. <a href="#a36e83e5648b95d38d1efe98dcf840fab"></a><br/></td></tr> <tr class="memitem:a26f01b9c0cf7a533023869dff439254f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a26f01b9c0cf7a533023869dff439254f">filledEllipseRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a26f01b9c0cf7a533023869dff439254f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled ellipse with blending. <a href="#a26f01b9c0cf7a533023869dff439254f"></a><br/></td></tr> <tr class="memitem:a6476d5dad22631d10c1dc95b0e88fc65"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a6476d5dad22631d10c1dc95b0e88fc65">pieColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)</td></tr> <tr class="memdesc:a6476d5dad22631d10c1dc95b0e88fc65"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw pie (outline) with alpha blending. <a href="#a6476d5dad22631d10c1dc95b0e88fc65"></a><br/></td></tr> <tr class="memitem:a4a5e4344913667e714560dd204473663"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a4a5e4344913667e714560dd204473663">pieRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a4a5e4344913667e714560dd204473663"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw pie (outline) with alpha blending. <a href="#a4a5e4344913667e714560dd204473663"></a><br/></td></tr> <tr class="memitem:a8f18679aa7161f885613ec08e7f41692"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a8f18679aa7161f885613ec08e7f41692">filledPieColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)</td></tr> <tr class="memdesc:a8f18679aa7161f885613ec08e7f41692"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled pie with alpha blending. <a href="#a8f18679aa7161f885613ec08e7f41692"></a><br/></td></tr> <tr class="memitem:a1944c066d27fa9847a5fdecd1d3b9116"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a1944c066d27fa9847a5fdecd1d3b9116">filledPieRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a1944c066d27fa9847a5fdecd1d3b9116"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled pie with alpha blending. <a href="#a1944c066d27fa9847a5fdecd1d3b9116"></a><br/></td></tr> <tr class="memitem:aec2a0c435b879a29167be6b1c49f1e49"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#aec2a0c435b879a29167be6b1c49f1e49">trigonColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)</td></tr> <tr class="memdesc:aec2a0c435b879a29167be6b1c49f1e49"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw trigon (triangle outline) with alpha blending. <a href="#aec2a0c435b879a29167be6b1c49f1e49"></a><br/></td></tr> <tr class="memitem:a090024f5f3e38b02b0bca704259b9d11"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a090024f5f3e38b02b0bca704259b9d11">trigonRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a090024f5f3e38b02b0bca704259b9d11"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw trigon (triangle outline) with alpha blending. <a href="#a090024f5f3e38b02b0bca704259b9d11"></a><br/></td></tr> <tr class="memitem:a330917705809bb5f7d74ef232dde5f12"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a330917705809bb5f7d74ef232dde5f12">aatrigonColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)</td></tr> <tr class="memdesc:a330917705809bb5f7d74ef232dde5f12"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw anti-aliased trigon (triangle outline) with alpha blending. <a href="#a330917705809bb5f7d74ef232dde5f12"></a><br/></td></tr> <tr class="memitem:a5e88106c90fc2e0e25d0f7617459d4f9"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a5e88106c90fc2e0e25d0f7617459d4f9">aatrigonRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a5e88106c90fc2e0e25d0f7617459d4f9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw anti-aliased trigon (triangle outline) with alpha blending. <a href="#a5e88106c90fc2e0e25d0f7617459d4f9"></a><br/></td></tr> <tr class="memitem:a6adaf54b33bf067e4fe2cc5a7ae17ef6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a6adaf54b33bf067e4fe2cc5a7ae17ef6">filledTrigonColor</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)</td></tr> <tr class="memdesc:a6adaf54b33bf067e4fe2cc5a7ae17ef6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled trigon (triangle) with alpha blending. <a href="#a6adaf54b33bf067e4fe2cc5a7ae17ef6"></a><br/></td></tr> <tr class="memitem:a4a3318a183659aab7c12c0334e261837"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a4a3318a183659aab7c12c0334e261837">filledTrigonRGBA</a> (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a4a3318a183659aab7c12c0334e261837"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled trigon (triangle) with alpha blending. <a href="#a4a3318a183659aab7c12c0334e261837"></a><br/></td></tr> <tr class="memitem:abe5d0b2f6193558798eaff3e85e7a1af"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#abe5d0b2f6193558798eaff3e85e7a1af">polygonColor</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)</td></tr> <tr class="memdesc:abe5d0b2f6193558798eaff3e85e7a1af"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw polygon with alpha blending. <a href="#abe5d0b2f6193558798eaff3e85e7a1af"></a><br/></td></tr> <tr class="memitem:a46b327da5cba5d401cf400bdef7560d0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a46b327da5cba5d401cf400bdef7560d0">polygonRGBA</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a46b327da5cba5d401cf400bdef7560d0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw polygon with alpha blending. <a href="#a46b327da5cba5d401cf400bdef7560d0"></a><br/></td></tr> <tr class="memitem:acee2be5e220639d3e5c5bc643e091c1c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#acee2be5e220639d3e5c5bc643e091c1c">aapolygonColor</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)</td></tr> <tr class="memdesc:acee2be5e220639d3e5c5bc643e091c1c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw anti-aliased polygon with alpha blending. <a href="#acee2be5e220639d3e5c5bc643e091c1c"></a><br/></td></tr> <tr class="memitem:aad73d6fc11bb01946d0ffe1c9d657cb1"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#aad73d6fc11bb01946d0ffe1c9d657cb1">aapolygonRGBA</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:aad73d6fc11bb01946d0ffe1c9d657cb1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw anti-aliased polygon with alpha blending. <a href="#aad73d6fc11bb01946d0ffe1c9d657cb1"></a><br/></td></tr> <tr class="memitem:a5e1fe45b835b623f6939ff0f08277531"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a5e1fe45b835b623f6939ff0f08277531">filledPolygonColor</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)</td></tr> <tr class="memdesc:a5e1fe45b835b623f6939ff0f08277531"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled polygon with alpha blending. <a href="#a5e1fe45b835b623f6939ff0f08277531"></a><br/></td></tr> <tr class="memitem:a2b1023ddbbb25d57bd51676b49234af4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a2b1023ddbbb25d57bd51676b49234af4">filledPolygonRGBA</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a2b1023ddbbb25d57bd51676b49234af4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled polygon with alpha blending. <a href="#a2b1023ddbbb25d57bd51676b49234af4"></a><br/></td></tr> <tr class="memitem:a5ca5a9bcfeba5b1a1577202e79b494d8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a5ca5a9bcfeba5b1a1577202e79b494d8">texturedPolygon</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, SDL_Surface *texture, int texture_dx, int texture_dy)</td></tr> <tr class="memdesc:a5ca5a9bcfeba5b1a1577202e79b494d8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draws a polygon filled with the given texture. <a href="#a5ca5a9bcfeba5b1a1577202e79b494d8"></a><br/></td></tr> <tr class="memitem:a0f5583d5b055f3e59a9692ca8a9dfbcf"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a0f5583d5b055f3e59a9692ca8a9dfbcf">filledPolygonColorMT</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color, int **polyInts, int *polyAllocated)</td></tr> <tr class="memdesc:a0f5583d5b055f3e59a9692ca8a9dfbcf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled polygon with alpha blending (multi-threaded capable). <a href="#a0f5583d5b055f3e59a9692ca8a9dfbcf"></a><br/></td></tr> <tr class="memitem:a412cddc17a592c167c060ec2d1d2fd1d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a412cddc17a592c167c060ec2d1d2fd1d">filledPolygonRGBAMT</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a, int **polyInts, int *polyAllocated)</td></tr> <tr class="memdesc:a412cddc17a592c167c060ec2d1d2fd1d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw filled polygon with alpha blending (multi-threaded capable). <a href="#a412cddc17a592c167c060ec2d1d2fd1d"></a><br/></td></tr> <tr class="memitem:a326937a19cfbebea09aa0a7c908d89aa"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a326937a19cfbebea09aa0a7c908d89aa">texturedPolygonMT</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, SDL_Surface *texture, int texture_dx, int texture_dy, int **polyInts, int *polyAllocated)</td></tr> <tr class="memdesc:a326937a19cfbebea09aa0a7c908d89aa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draws a polygon filled with the given texture (Multi-Threading Capable). <a href="#a326937a19cfbebea09aa0a7c908d89aa"></a><br/></td></tr> <tr class="memitem:ad82395ca72b749494ff89be78f168341"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#ad82395ca72b749494ff89be78f168341">bezierColor</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, int s, Uint32 color)</td></tr> <tr class="memdesc:ad82395ca72b749494ff89be78f168341"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw a bezier curve with alpha blending. <a href="#ad82395ca72b749494ff89be78f168341"></a><br/></td></tr> <tr class="memitem:a7203e3a463da499b5b0cadf211d19ff3"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a7203e3a463da499b5b0cadf211d19ff3">bezierRGBA</a> (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, int s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a7203e3a463da499b5b0cadf211d19ff3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw a bezier curve with alpha blending. <a href="#a7203e3a463da499b5b0cadf211d19ff3"></a><br/></td></tr> <tr class="memitem:a7cabe806643c19159948639faaf26a38"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a7cabe806643c19159948639faaf26a38">gfxPrimitivesSetFont</a> (const void *fontdata, Uint32 cw, Uint32 ch)</td></tr> <tr class="memdesc:a7cabe806643c19159948639faaf26a38"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets or resets the current global font data. <a href="#a7cabe806643c19159948639faaf26a38"></a><br/></td></tr> <tr class="memitem:a77cc480ba039c758d1cf0cd43db04bd6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a77cc480ba039c758d1cf0cd43db04bd6">gfxPrimitivesSetFontRotation</a> (Uint32 rotation)</td></tr> <tr class="memdesc:a77cc480ba039c758d1cf0cd43db04bd6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets current global font character rotation steps. <a href="#a77cc480ba039c758d1cf0cd43db04bd6"></a><br/></td></tr> <tr class="memitem:af1991f2031346131db4ae8fd40492b08"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#af1991f2031346131db4ae8fd40492b08">characterColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, char c, Uint32 color)</td></tr> <tr class="memdesc:af1991f2031346131db4ae8fd40492b08"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw a character of the currently set font. <a href="#af1991f2031346131db4ae8fd40492b08"></a><br/></td></tr> <tr class="memitem:a3f2f624c33ca753d22db52a8d9363fac"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a3f2f624c33ca753d22db52a8d9363fac">characterRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a3f2f624c33ca753d22db52a8d9363fac"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw a character of the currently set font. <a href="#a3f2f624c33ca753d22db52a8d9363fac"></a><br/></td></tr> <tr class="memitem:a96b6a43c6ef4753996e33bb7fea483bc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a96b6a43c6ef4753996e33bb7fea483bc">stringColor</a> (SDL_Surface *dst, Sint16 x, Sint16 y, const char *s, Uint32 color)</td></tr> <tr class="memdesc:a96b6a43c6ef4753996e33bb7fea483bc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw a string in the currently set font. <a href="#a96b6a43c6ef4753996e33bb7fea483bc"></a><br/></td></tr> <tr class="memitem:a769833ae414222099783a9b69bed4009"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a769833ae414222099783a9b69bed4009">stringRGBA</a> (SDL_Surface *dst, Sint16 x, Sint16 y, const char *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)</td></tr> <tr class="memdesc:a769833ae414222099783a9b69bed4009"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw a string in the currently set font. <a href="#a769833ae414222099783a9b69bed4009"></a><br/></td></tr> </table> <hr/><h2>Define Documentation</h2> <a class="anchor" id="ae71449b1cc6e6250b91f539153a7a0d3"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__rotozoom_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">M_PI</a>&#160;&#160;&#160;3.1415926535897932384626433832795</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8h_source.html#l00035">35</a> of file <a class="el" href="_s_d_l__gfx_primitives_8h_source.html">SDL_gfxPrimitives.h</a>.</p> </div> </div> <a class="anchor" id="a2a585f5832061010155d87737ef5bf88"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8h.html#a2a585f5832061010155d87737ef5bf88">SDL_GFXPRIMITIVES_MAJOR</a>&#160;&#160;&#160;2</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8h_source.html#l00047">47</a> of file <a class="el" href="_s_d_l__gfx_primitives_8h_source.html">SDL_gfxPrimitives.h</a>.</p> </div> </div> <a class="anchor" id="a06ea681a295987b8b8ec3fcdb04713df"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8h.html#a06ea681a295987b8b8ec3fcdb04713df">SDL_GFXPRIMITIVES_MICRO</a>&#160;&#160;&#160;25</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8h_source.html#l00049">49</a> of file <a class="el" href="_s_d_l__gfx_primitives_8h_source.html">SDL_gfxPrimitives.h</a>.</p> </div> </div> <a class="anchor" id="abd0939b1856bbb822b37b68755dc9ee5"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8h.html#abd0939b1856bbb822b37b68755dc9ee5">SDL_GFXPRIMITIVES_MINOR</a>&#160;&#160;&#160;0</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8h_source.html#l00048">48</a> of file <a class="el" href="_s_d_l__gfx_primitives_8h_source.html">SDL_gfxPrimitives.h</a>.</p> </div> </div> <a class="anchor" id="a9501419cbbd2b8739ec5dc4e890c165b"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a>&#160;&#160;&#160;extern</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8h_source.html#l00064">64</a> of file <a class="el" href="_s_d_l__gfx_primitives_8h_source.html">SDL_gfxPrimitives.h</a>.</p> </div> </div> <hr/><h2>Function Documentation</h2> <a class="anchor" id="aee66c744f9fbe58c9f93ad33375373c3"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#aee66c744f9fbe58c9f93ad33375373c3">aacircleColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw anti-aliased circle with blending. </p> <p>Note: The AA-circle routine is based on AA-ellipse with identical radii.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the aa-circle. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the aa-circle. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the aa-circle. </td></tr> <tr><td class="paramname">color</td><td>The color value of the aa-circle to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l03512">3512</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a613099498679e6280959cdfdcd59a143"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a613099498679e6280959cdfdcd59a143">aacircleRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw anti-aliased circle with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the aa-circle. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the aa-circle. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the aa-circle. </td></tr> <tr><td class="paramname">r</td><td>The red value of the aa-circle to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the aa-circle to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the aa-circle to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the aa-circle to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l03531">3531</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a6edf60c54acc964cbb47ddefc6c0d450"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6edf60c54acc964cbb47ddefc6c0d450">aaellipseColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>ry</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw anti-aliased ellipse with blending. </p> <p>Note: Based on code from Anders Lindstroem, which is based on code from sge library, which is based on code from TwinLib.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the aa-ellipse. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the aa-ellipse. </td></tr> <tr><td class="paramname">rx</td><td>Horizontal radius in pixels of the aa-ellipse. </td></tr> <tr><td class="paramname">ry</td><td>Vertical radius in pixels of the aa-ellipse. </td></tr> <tr><td class="paramname">color</td><td>The color value of the aa-ellipse to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04088">4088</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="ab6db169d39ea972469e761f338153e21"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#ab6db169d39ea972469e761f338153e21">aaellipseRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>ry</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw anti-aliased ellipse with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the aa-ellipse. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the aa-ellipse. </td></tr> <tr><td class="paramname">rx</td><td>Horizontal radius in pixels of the aa-ellipse. </td></tr> <tr><td class="paramname">ry</td><td>Vertical radius in pixels of the aa-ellipse. </td></tr> <tr><td class="paramname">r</td><td>The red value of the aa-ellipse to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the aa-ellipse to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the aa-ellipse to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the aa-ellipse to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04328">4328</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a4711ada424cb411e328fcedbf28ca5bd"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a4711ada424cb411e328fcedbf28ca5bd">aalineColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Ddraw anti-aliased line with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the aa-line. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the aa-line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the aa-line. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the aa-line. </td></tr> <tr><td class="paramname">color</td><td>The color value of the aa-line to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l02828">2828</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="aaf65728167a6aa7b37010560507fb4a2"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#aaf65728167a6aa7b37010560507fb4a2">aalineRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw anti-aliased line with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the aa-line. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the aa-line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the aa-line. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the aa-line. </td></tr> <tr><td class="paramname">r</td><td>The red value of the aa-line to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the aa-line to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the aa-line to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the aa-line to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l02848">2848</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="acee2be5e220639d3e5c5bc643e091c1c"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#acee2be5e220639d3e5c5bc643e091c1c">aapolygonColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw anti-aliased polygon with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">vx</td><td>Vertex array containing X coordinates of the points of the aa-polygon. </td></tr> <tr><td class="paramname">vy</td><td>Vertex array containing Y coordinates of the points of the aa-polygon. </td></tr> <tr><td class="paramname">n</td><td>Number of points in the vertex array. Minimum number is 3. </td></tr> <tr><td class="paramname">color</td><td>The color value of the aa-polygon to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05077">5077</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="aad73d6fc11bb01946d0ffe1c9d657cb1"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#aad73d6fc11bb01946d0ffe1c9d657cb1">aapolygonRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw anti-aliased polygon with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">vx</td><td>Vertex array containing X coordinates of the points of the aa-polygon. </td></tr> <tr><td class="paramname">vy</td><td>Vertex array containing Y coordinates of the points of the aa-polygon. </td></tr> <tr><td class="paramname">n</td><td>Number of points in the vertex array. Minimum number is 3. </td></tr> <tr><td class="paramname">r</td><td>The red value of the aa-polygon to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the aa-polygon to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the aa-polygon to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the aa-polygon to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05145">5145</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a330917705809bb5f7d74ef232dde5f12"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a330917705809bb5f7d74ef232dde5f12">aatrigonColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw anti-aliased trigon (triangle outline) with alpha blending. </p> <p>Note: Creates vertex array and uses aapolygon routine to render.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the aa-trigon. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the aa-trigon. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the aa-trigon. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the aa-trigon. </td></tr> <tr><td class="paramname">x3</td><td>X coordinate of the third point of the aa-trigon. </td></tr> <tr><td class="paramname">y3</td><td>Y coordinate of the third point of the aa-trigon. </td></tr> <tr><td class="paramname">color</td><td>The color value of the aa-trigon to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04859">4859</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a5e88106c90fc2e0e25d0f7617459d4f9"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a5e88106c90fc2e0e25d0f7617459d4f9">aatrigonRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw anti-aliased trigon (triangle outline) with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the aa-trigon. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the aa-trigon. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the aa-trigon. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the aa-trigon. </td></tr> <tr><td class="paramname">x3</td><td>X coordinate of the third point of the aa-trigon. </td></tr> <tr><td class="paramname">y3</td><td>Y coordinate of the third point of the aa-trigon. </td></tr> <tr><td class="paramname">r</td><td>The red value of the aa-trigon to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the aa-trigon to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the aa-trigon to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the aa-trigon to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04891">4891</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a6180558aff14d3c240d9e8bf919869ef"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6180558aff14d3c240d9e8bf919869ef">arcColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>start</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>end</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Arc with blending. </p> <p>Note Arc drawing is based on circle algorithm by A. Schiffler and written by D. Raber. Calculates which octants arc goes through and renders pixels accordingly.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the arc. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the arc. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the arc. </td></tr> <tr><td class="paramname">start</td><td>Starting radius in degrees of the arc. 0 degrees is down, increasing counterclockwise. </td></tr> <tr><td class="paramname">end</td><td>Ending radius in degrees of the arc. 0 degrees is down, increasing counterclockwise. </td></tr> <tr><td class="paramname">color</td><td>The color value of the arc to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l03117">3117</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a5d8d25ecb69e9386289125eb21668a2f"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a5d8d25ecb69e9386289125eb21668a2f">arcRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>start</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>end</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Arc with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the arc. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the arc. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the arc. </td></tr> <tr><td class="paramname">start</td><td>Starting radius in degrees of the arc. 0 degrees is down, increasing counterclockwise. </td></tr> <tr><td class="paramname">end</td><td>Ending radius in degrees of the arc. 0 degrees is down, increasing counterclockwise. </td></tr> <tr><td class="paramname">r</td><td>The red value of the arc to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the arc to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the arc to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the arc to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l03488">3488</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="ad82395ca72b749494ff89be78f168341"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#ad82395ca72b749494ff89be78f168341">bezierColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>s</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw a bezier curve with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">vx</td><td>Vertex array containing X coordinates of the points of the bezier curve. </td></tr> <tr><td class="paramname">vy</td><td>Vertex array containing Y coordinates of the points of the bezier curve. </td></tr> <tr><td class="paramname">n</td><td>Number of points in the vertex array. Minimum number is 3. </td></tr> <tr><td class="paramname">s</td><td>Number of steps for the interpolation. Minimum number is 2. </td></tr> <tr><td class="paramname">color</td><td>The color value of the bezier curve to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06221">6221</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a7203e3a463da499b5b0cadf211d19ff3"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a7203e3a463da499b5b0cadf211d19ff3">bezierRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>s</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw a bezier curve with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">vx</td><td>Vertex array containing X coordinates of the points of the bezier curve. </td></tr> <tr><td class="paramname">vy</td><td>Vertex array containing Y coordinates of the points of the bezier curve. </td></tr> <tr><td class="paramname">n</td><td>Number of points in the vertex array. Minimum number is 3. </td></tr> <tr><td class="paramname">s</td><td>Number of steps for the interpolation. Minimum number is 2. </td></tr> <tr><td class="paramname">r</td><td>The red value of the bezier curve to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the bezier curve to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the bezier curve to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the bezier curve to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06296">6296</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a16693489da67d6e65a28f9e5217b46f9"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a16693489da67d6e65a28f9e5217b46f9">boxColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw box (filled rectangle) with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. top right) of the box. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (i.e. top right) of the box. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. bottom left) of the box. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (i.e. bottom left) of the box. </td></tr> <tr><td class="paramname">color</td><td>The color value of the box to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l02107">2107</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a0ae084c90bd9b734356ad723d45973c8"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a0ae084c90bd9b734356ad723d45973c8">boxRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw box (filled rectangle) with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. top right) of the box. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (i.e. top right) of the box. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. bottom left) of the box. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (i.e. bottom left) of the box. </td></tr> <tr><td class="paramname">r</td><td>The red value of the box to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the box to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the box to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the box to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l02319">2319</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="af1991f2031346131db4ae8fd40492b08"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#af1991f2031346131db4ae8fd40492b08">characterColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">char&#160;</td> <td class="paramname"><em>c</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw a character of the currently set font. </p> <p>On first call for a particular character and color combination, the function needs to generate the character surface (slower. Subsequent calls blit a cached surface (fast). Uses alpha blending if A&lt;255 in color.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X (horizontal) coordinate of the upper left corner of the character. </td></tr> <tr><td class="paramname">y</td><td>Y (vertical) coordinate of the upper left corner of the character. </td></tr> <tr><td class="paramname">c</td><td>The character to draw. </td></tr> <tr><td class="paramname">color</td><td>The color value of the character to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05908">5908</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a3f2f624c33ca753d22db52a8d9363fac"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a3f2f624c33ca753d22db52a8d9363fac">characterRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">char&#160;</td> <td class="paramname"><em>c</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw a character of the currently set font. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X (horizontal) coordinate of the upper left corner of the character. </td></tr> <tr><td class="paramname">y</td><td>Y (vertical) coordinate of the upper left corner of the character. </td></tr> <tr><td class="paramname">c</td><td>The character to draw. </td></tr> <tr><td class="paramname">r</td><td>The red value of the character to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the character to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the character to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the character to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06077">6077</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a58d231ecaf113f53c2a28435e0632624"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a58d231ecaf113f53c2a28435e0632624">circleColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw circle with blending. </p> <p>Note: Circle drawing routine is based on an algorithms from the sge library, but modified by A. Schiffler for multiple pixel-draw removal and other minor speedup changes.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the circle. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the circle. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the circle. </td></tr> <tr><td class="paramname">color</td><td>The color value of the circle to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l02872">2872</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a8e0945b74c02cdb1441e1b2a29d2c87d"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a8e0945b74c02cdb1441e1b2a29d2c87d">circleRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw circle with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the circle. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the circle. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the circle. </td></tr> <tr><td class="paramname">r</td><td>The red value of the circle to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the circle to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the circle to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the circle to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l03090">3090</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a8b46f389c626806e7a1ec148f0980737"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a8b46f389c626806e7a1ec148f0980737">ellipseColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>ry</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw ellipse with blending. </p> <p>Note: Based on algorithms from sge library with modifications by A. Schiffler for multiple-pixel draw removal and other minor speedup changes.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the ellipse. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the ellipse. </td></tr> <tr><td class="paramname">rx</td><td>Horizontal radius in pixels of the ellipse. </td></tr> <tr><td class="paramname">ry</td><td>Vertical radius in pixels of the ellipse. </td></tr> <tr><td class="paramname">color</td><td>The color value of the ellipse to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l03709">3709</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a523156891302420d2296b1a302c1fc2b"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a523156891302420d2296b1a302c1fc2b">ellipseRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>ry</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw ellipse with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the ellipse. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the ellipse. </td></tr> <tr><td class="paramname">rx</td><td>Horizontal radius in pixels of the ellipse. </td></tr> <tr><td class="paramname">ry</td><td>Vertical radius in pixels of the ellipse. </td></tr> <tr><td class="paramname">r</td><td>The red value of the ellipse to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the ellipse to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the ellipse to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the ellipse to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04023">4023</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a4f7b717b958ef39bfc8c958476dd0de1"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a4f7b717b958ef39bfc8c958476dd0de1">filledCircleColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled circle with blending. </p> <p>Note: Based on algorithms from sge library with modifications by A. Schiffler for multiple-hline draw removal and other minor speedup changes.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the filled circle. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the filled circle. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the filled circle. </td></tr> <tr><td class="paramname">color</td><td>The color value of the filled circle to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l03556">3556</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a01af970ce0be38cea9884bc6f816c984"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a01af970ce0be38cea9884bc6f816c984">filledCircleRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled circle with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the filled circle. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the filled circle. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the filled circle. </td></tr> <tr><td class="paramname">r</td><td>The red value of the filled circle to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the filled circle to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the filled circle to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the filled circle to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l03683">3683</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a36e83e5648b95d38d1efe98dcf840fab"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a36e83e5648b95d38d1efe98dcf840fab">filledEllipseColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>ry</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled ellipse with blending. </p> <p>Note: Based on algorithm from sge library with multiple-hline draw removal and other speedup changes.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the filled ellipse. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the filled ellipse. </td></tr> <tr><td class="paramname">rx</td><td>Horizontal radius in pixels of the filled ellipse. </td></tr> <tr><td class="paramname">ry</td><td>Vertical radius in pixels of the filled ellipse. </td></tr> <tr><td class="paramname">color</td><td>The color value of the filled ellipse to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04358">4358</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a26f01b9c0cf7a533023869dff439254f"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a26f01b9c0cf7a533023869dff439254f">filledEllipseRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>ry</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled ellipse with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the filled ellipse. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the filled ellipse. </td></tr> <tr><td class="paramname">rx</td><td>Horizontal radius in pixels of the filled ellipse. </td></tr> <tr><td class="paramname">ry</td><td>Vertical radius in pixels of the filled ellipse. </td></tr> <tr><td class="paramname">r</td><td>The red value of the filled ellipse to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the filled ellipse to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the filled ellipse to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the filled ellipse to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04526">4526</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a8f18679aa7161f885613ec08e7f41692"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a8f18679aa7161f885613ec08e7f41692">filledPieColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>start</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>end</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled pie with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the filled pie. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the filled pie. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the filled pie. </td></tr> <tr><td class="paramname">start</td><td>Starting radius in degrees of the filled pie. </td></tr> <tr><td class="paramname">end</td><td>Ending radius in degrees of the filled pie. </td></tr> <tr><td class="paramname">color</td><td>The color value of the filled pie to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04747">4747</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a1944c066d27fa9847a5fdecd1d3b9116"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a1944c066d27fa9847a5fdecd1d3b9116">filledPieRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>start</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>end</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled pie with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the filled pie. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the filled pie. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the filled pie. </td></tr> <tr><td class="paramname">start</td><td>Starting radius in degrees of the filled pie. </td></tr> <tr><td class="paramname">end</td><td>Ending radius in degrees of the filled pie. </td></tr> <tr><td class="paramname">r</td><td>The red value of the filled pie to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the filled pie to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the filled pie to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the filled pie to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04768">4768</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a5e1fe45b835b623f6939ff0f08277531"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a5e1fe45b835b623f6939ff0f08277531">filledPolygonColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled polygon with alpha blending. </p> <p>Note: Standard filledPolygon function is calling multithreaded version with NULL parameters to use the global vertex cache.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">vx</td><td>Vertex array containing X coordinates of the points of the filled polygon. </td></tr> <tr><td class="paramname">vy</td><td>Vertex array containing Y coordinates of the points of the filled polygon. </td></tr> <tr><td class="paramname">n</td><td>Number of points in the vertex array. Minimum number is 3. </td></tr> <tr><td class="paramname">color</td><td>The color value of the filled polygon to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05394">5394</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a0f5583d5b055f3e59a9692ca8a9dfbcf"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a0f5583d5b055f3e59a9692ca8a9dfbcf">filledPolygonColorMT</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int **&#160;</td> <td class="paramname"><em>polyInts</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int *&#160;</td> <td class="paramname"><em>polyAllocated</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled polygon with alpha blending (multi-threaded capable). </p> <p>Note: The last two parameters are optional; but are required for multithreaded operation.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">vx</td><td>Vertex array containing X coordinates of the points of the filled polygon. </td></tr> <tr><td class="paramname">vy</td><td>Vertex array containing Y coordinates of the points of the filled polygon. </td></tr> <tr><td class="paramname">n</td><td>Number of points in the vertex array. Minimum number is 3. </td></tr> <tr><td class="paramname">color</td><td>The color value of the filled polygon to draw (0xRRGGBBAA). </td></tr> <tr><td class="paramname">polyInts</td><td>Preallocated, temporary vertex array used for sorting vertices. Required for multithreaded operation; set to NULL otherwise. </td></tr> <tr><td class="paramname">polyAllocated</td><td>Flag indicating if temporary vertex array was allocated. Required for multithreaded operation; set to NULL otherwise.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05197">5197</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a2b1023ddbbb25d57bd51676b49234af4"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a2b1023ddbbb25d57bd51676b49234af4">filledPolygonRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled polygon with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">vx</td><td>Vertex array containing X coordinates of the points of the filled polygon. </td></tr> <tr><td class="paramname">vy</td><td>Vertex array containing Y coordinates of the points of the filled polygon. </td></tr> <tr><td class="paramname">n</td><td>Number of points in the vertex array. Minimum number is 3. </td></tr> <tr><td class="paramname">r</td><td>The red value of the filled polygon to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the filled polygon to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the filed polygon to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the filled polygon to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05416">5416</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a412cddc17a592c167c060ec2d1d2fd1d"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a412cddc17a592c167c060ec2d1d2fd1d">filledPolygonRGBAMT</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int **&#160;</td> <td class="paramname"><em>polyInts</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int *&#160;</td> <td class="paramname"><em>polyAllocated</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled polygon with alpha blending (multi-threaded capable). </p> <p>Note: The last two parameters are optional; but are required for multithreaded operation.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">vx</td><td>Vertex array containing X coordinates of the points of the filled polygon. </td></tr> <tr><td class="paramname">vy</td><td>Vertex array containing Y coordinates of the points of the filled polygon. </td></tr> <tr><td class="paramname">n</td><td>Number of points in the vertex array. Minimum number is 3. </td></tr> <tr><td class="paramname">r</td><td>The red value of the filled polygon to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the filled polygon to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the filed polygon to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the filled polygon to draw. </td></tr> <tr><td class="paramname">polyInts</td><td>Preallocated, temporary vertex array used for sorting vertices. Required for multithreaded operation; set to NULL otherwise. </td></tr> <tr><td class="paramname">polyAllocated</td><td>Flag indicating if temporary vertex array was allocated. Required for multithreaded operation; set to NULL otherwise.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05372">5372</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a6adaf54b33bf067e4fe2cc5a7ae17ef6"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6adaf54b33bf067e4fe2cc5a7ae17ef6">filledTrigonColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled trigon (triangle) with alpha blending. </p> <p>Note: Creates vertex array and uses aapolygon routine to render.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the filled trigon. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the filled trigon. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the filled trigon. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the filled trigon. </td></tr> <tr><td class="paramname">x3</td><td>X coordinate of the third point of the filled trigon. </td></tr> <tr><td class="paramname">y3</td><td>Y coordinate of the third point of the filled trigon. </td></tr> <tr><td class="paramname">color</td><td>The color value of the filled trigon to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04925">4925</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a4a3318a183659aab7c12c0334e261837"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a4a3318a183659aab7c12c0334e261837">filledTrigonRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw filled trigon (triangle) with alpha blending. </p> <p>Note: Creates vertex array and uses aapolygon routine to render.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the filled trigon. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the filled trigon. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the filled trigon. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the filled trigon. </td></tr> <tr><td class="paramname">x3</td><td>X coordinate of the third point of the filled trigon. </td></tr> <tr><td class="paramname">y3</td><td>Y coordinate of the third point of the filled trigon. </td></tr> <tr><td class="paramname">r</td><td>The red value of the filled trigon to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the filled trigon to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the filled trigon to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the filled trigon to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04959">4959</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a7cabe806643c19159948639faaf26a38"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> void <a class="el" href="_s_d_l__gfx_primitives_8h.html#a7cabe806643c19159948639faaf26a38">gfxPrimitivesSetFont</a> </td> <td>(</td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>fontdata</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>cw</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>ch</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Sets or resets the current global font data. </p> <p>The font data array is organized in follows: [fontdata] = [character 0][character 1]...[character 255] where [character n] = [byte 1 row 1][byte 2 row 1]...[byte {pitch} row 1][byte 1 row 2] ...[byte {pitch} row height] where [byte n] = [bit 0]...[bit 7] where [bit n] = [0 for transparent pixel|1 for colored pixel]</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">fontdata</td><td>Pointer to array of font data. Set to NULL, to reset global font to the default 8x8 font. </td></tr> <tr><td class="paramname">cw</td><td>Width of character in bytes. Ignored if fontdata==NULL. </td></tr> <tr><td class="paramname">ch</td><td>Height of character in bytes. Ignored if fontdata==NULL. </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05815">5815</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a77cc480ba039c758d1cf0cd43db04bd6"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> void <a class="el" href="_s_d_l__gfx_primitives_8h.html#a77cc480ba039c758d1cf0cd43db04bd6">gfxPrimitivesSetFontRotation</a> </td> <td>(</td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>rotation</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Sets current global font character rotation steps. </p> <p>Default is 0 (no rotation). 1 = 90deg clockwise. 2 = 180deg clockwise. 3 = 270deg clockwise. Changing the rotation, will reset the character cache.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">rotation</td><td>Number of 90deg clockwise steps to rotate </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05861">5861</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a31ac87bf32186325deedf5188b987ef6"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a31ac87bf32186325deedf5188b987ef6">hlineColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw horizontal line with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. left) of the line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. right) of the line. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the points of the line. </td></tr> <tr><td class="paramname">color</td><td>The color value of the line to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01204">1204</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="ae48e69e0f5d13ea79ffac262b146ae9e"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#ae48e69e0f5d13ea79ffac262b146ae9e">hlineRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw horizontal line with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. left) of the line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. right) of the line. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the points of the line. </td></tr> <tr><td class="paramname">r</td><td>The red value of the line to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the line to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the line to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the line to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01373">1373</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a6f37058aed308619de8109ebe84b5fe9"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6f37058aed308619de8109ebe84b5fe9">lineColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw line with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the line. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the line. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the line. </td></tr> <tr><td class="paramname">color</td><td>The color value of the line to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l02347">2347</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a5e4bd13b12d34698fbcb2dc9d3a0e9f3"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a5e4bd13b12d34698fbcb2dc9d3a0e9f3">lineRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw line with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the line. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the line. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the line. </td></tr> <tr><td class="paramname">r</td><td>The red value of the line to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the line to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the line to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the line to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l02556">2556</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a6476d5dad22631d10c1dc95b0e88fc65"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6476d5dad22631d10c1dc95b0e88fc65">pieColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>start</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>end</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw pie (outline) with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the pie. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the pie. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the pie. </td></tr> <tr><td class="paramname">start</td><td>Starting radius in degrees of the pie. </td></tr> <tr><td class="paramname">end</td><td>Ending radius in degrees of the pie. </td></tr> <tr><td class="paramname">color</td><td>The color value of the pie to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04703">4703</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a4a5e4344913667e714560dd204473663"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a4a5e4344913667e714560dd204473663">pieRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>start</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>end</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw pie (outline) with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the center of the pie. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate of the center of the pie. </td></tr> <tr><td class="paramname">rad</td><td>Radius in pixels of the pie. </td></tr> <tr><td class="paramname">start</td><td>Starting radius in degrees of the pie. </td></tr> <tr><td class="paramname">end</td><td>Ending radius in degrees of the pie. </td></tr> <tr><td class="paramname">r</td><td>The red value of the pie to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the pie to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the pie to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the pie to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04726">4726</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a7fe611dbb029ae70be89d5314c7e023b"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a7fe611dbb029ae70be89d5314c7e023b">pixelColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Pixel draw with blending enabled if a&lt;255. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X (horizontal) coordinate of the pixel. </td></tr> <tr><td class="paramname">y</td><td>Y (vertical) coordinate of the pixel. </td></tr> <tr><td class="paramname">color</td><td>The color value of the pixel to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00509">509</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a0046efc721e77b745fd5b621fbd48513"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a0046efc721e77b745fd5b621fbd48513">pixelRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Pixel draw with blending enabled if a&lt;255. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X (horizontal) coordinate of the pixel. </td></tr> <tr><td class="paramname">y</td><td>Y (vertical) coordinate of the pixel. </td></tr> <tr><td class="paramname">r</td><td>The red color value of the pixel to draw. </td></tr> <tr><td class="paramname">g</td><td>The green color value of the pixel to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue color value of the pixel to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the pixel to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00995">995</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="abe5d0b2f6193558798eaff3e85e7a1af"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#abe5d0b2f6193558798eaff3e85e7a1af">polygonColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw polygon with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">vx</td><td>Vertex array containing X coordinates of the points of the polygon. </td></tr> <tr><td class="paramname">vy</td><td>Vertex array containing Y coordinates of the points of the polygon. </td></tr> <tr><td class="paramname">n</td><td>Number of points in the vertex array. Minimum number is 3. </td></tr> <tr><td class="paramname">color</td><td>The color value of the polygon to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04988">4988</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a46b327da5cba5d401cf400bdef7560d0"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a46b327da5cba5d401cf400bdef7560d0">polygonRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw polygon with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">vx</td><td>Vertex array containing X coordinates of the points of the polygon. </td></tr> <tr><td class="paramname">vy</td><td>Vertex array containing Y coordinates of the points of the polygon. </td></tr> <tr><td class="paramname">n</td><td>Number of points in the vertex array. Minimum number is 3. </td></tr> <tr><td class="paramname">r</td><td>The red value of the polygon to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the polygon to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the polygon to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the polygon to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05056">5056</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a36453f52608a10f3d6b8edccae260b95"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a36453f52608a10f3d6b8edccae260b95">rectangleColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw rectangle with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. top right) of the rectangle. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (i.e. top right) of the rectangle. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. bottom left) of the rectangle. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (i.e. bottom left) of the rectangle. </td></tr> <tr><td class="paramname">color</td><td>The color value of the rectangle to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01580">1580</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a6c41cbfd0618262de4d4d127ed1e67fe"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6c41cbfd0618262de4d4d127ed1e67fe">rectangleRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw rectangle with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. top right) of the rectangle. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (i.e. top right) of the rectangle. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. bottom left) of the rectangle. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (i.e. bottom left) of the rectangle. </td></tr> <tr><td class="paramname">r</td><td>The red value of the rectangle to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the rectangle to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the rectangle to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the rectangle to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01663">1663</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a9f9be6e605e764fd23dd154fb12b80e9"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a9f9be6e605e764fd23dd154fb12b80e9">roundedBoxColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw rounded-corner box (filled rectangle) with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. top right) of the box. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (i.e. top right) of the box. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. bottom left) of the box. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (i.e. bottom left) of the box. </td></tr> <tr><td class="paramname">rad</td><td>The radius of the corner arcs of the box. </td></tr> <tr><td class="paramname">color</td><td>The color value of the box to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01837">1837</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a7105b88e62fe42b26602d3b426547bc7"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a7105b88e62fe42b26602d3b426547bc7">roundedBoxRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw rounded-corner box (filled rectangle) with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. top right) of the box. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (i.e. top right) of the box. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. bottom left) of the box. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (i.e. bottom left) of the box. </td></tr> <tr><td class="paramname">rad</td><td>The radius of the corner arcs of the box. </td></tr> <tr><td class="paramname">r</td><td>The red value of the box to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the box to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the box to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the box to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01970">1970</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a4109d2d1efa021c021fc4a98a0e3691b"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a4109d2d1efa021c021fc4a98a0e3691b">roundedRectangleColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw rounded-corner rectangle with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. top right) of the rectangle. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (i.e. top right) of the rectangle. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. bottom left) of the rectangle. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (i.e. bottom left) of the rectangle. </td></tr> <tr><td class="paramname">rad</td><td>The radius of the corner arc. </td></tr> <tr><td class="paramname">color</td><td>The color value of the rectangle to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01685">1685</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a475432abc4756e6f30ef097d5cac02c9"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a475432abc4756e6f30ef097d5cac02c9">roundedRectangleRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>rad</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw rounded-corner rectangle with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point (i.e. top right) of the rectangle. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (i.e. top right) of the rectangle. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point (i.e. bottom left) of the rectangle. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (i.e. bottom left) of the rectangle. </td></tr> <tr><td class="paramname">rad</td><td>The radius of the corner arc. </td></tr> <tr><td class="paramname">r</td><td>The red value of the rectangle to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the rectangle to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the rectangle to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the rectangle to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01815">1815</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a96b6a43c6ef4753996e33bb7fea483bc"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a96b6a43c6ef4753996e33bb7fea483bc">stringColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>s</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw a string in the currently set font. </p> <p>The spacing between consequtive characters in the string is the fixed number of pixels of the character width of the current global font.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X (horizontal) coordinate of the upper left corner of the string. </td></tr> <tr><td class="paramname">y</td><td>Y (vertical) coordinate of the upper left corner of the string. </td></tr> <tr><td class="paramname">s</td><td>The string to draw. </td></tr> <tr><td class="paramname">color</td><td>The color value of the string to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06099">6099</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a769833ae414222099783a9b69bed4009"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a769833ae414222099783a9b69bed4009">stringRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>s</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw a string in the currently set font. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X (horizontal) coordinate of the upper left corner of the string. </td></tr> <tr><td class="paramname">y</td><td>Y (vertical) coordinate of the upper left corner of the string. </td></tr> <tr><td class="paramname">s</td><td>The string to draw. </td></tr> <tr><td class="paramname">r</td><td>The red value of the string to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the string to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the string to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the string to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06143">6143</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a5ca5a9bcfeba5b1a1577202e79b494d8"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a5ca5a9bcfeba5b1a1577202e79b494d8">texturedPolygon</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>texture</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>texture_dx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>texture_dy</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draws a polygon filled with the given texture. </p> <p>This standard version is calling multithreaded versions with NULL cache parameters.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>the destination surface, </td></tr> <tr><td class="paramname">vx</td><td>array of x vector components </td></tr> <tr><td class="paramname">vy</td><td>array of x vector components </td></tr> <tr><td class="paramname">n</td><td>the amount of vectors in the vx and vy array </td></tr> <tr><td class="paramname">texture</td><td>the sdl surface to use to fill the polygon </td></tr> <tr><td class="paramname">texture_dx</td><td>the offset of the texture relative to the screeen. if you move the polygon 10 pixels to the left and want the texture to apear the same you need to increase the texture_dx value </td></tr> <tr><td class="paramname">texture_dy</td><td>see texture_dx</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05741">5741</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a326937a19cfbebea09aa0a7c908d89aa"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a326937a19cfbebea09aa0a7c908d89aa">texturedPolygonMT</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const Sint16 *&#160;</td> <td class="paramname"><em>vy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>texture</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>texture_dx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>texture_dy</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int **&#160;</td> <td class="paramname"><em>polyInts</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int *&#160;</td> <td class="paramname"><em>polyAllocated</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draws a polygon filled with the given texture (Multi-Threading Capable). </p> <p>This operation use internally SDL_BlitSurface for lines of the source texture. It supports alpha drawing.</p> <p>To get the best performance of this operation you need to make sure the texture and the dst surface have the same format (see <a href="http://docs.mandragor.org/files/Common_libs_documentation/SDL/SDL_Documentation_project_en/sdlblitsurface.html">http://docs.mandragor.org/files/Common_libs_documentation/SDL/SDL_Documentation_project_en/sdlblitsurface.html</a>). The last two parameters are optional, but required for multithreaded operation. When set to NULL, uses global static temp array.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>the destination surface, </td></tr> <tr><td class="paramname">vx</td><td>array of x vector components </td></tr> <tr><td class="paramname">vy</td><td>array of x vector components </td></tr> <tr><td class="paramname">n</td><td>the amount of vectors in the vx and vy array </td></tr> <tr><td class="paramname">texture</td><td>the sdl surface to use to fill the polygon </td></tr> <tr><td class="paramname">texture_dx</td><td>the offset of the texture relative to the screeen. if you move the polygon 10 pixels to the left and want the texture to apear the same you need to increase the texture_dx value </td></tr> <tr><td class="paramname">texture_dy</td><td>see texture_dx </td></tr> <tr><td class="paramname">polyInts</td><td>preallocated temp array storage for vertex sorting (used for multi-threaded operation) </td></tr> <tr><td class="paramname">polyAllocated</td><td>flag indicating oif the temp array was allocated (used for multi-threaded operation)</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l05574">5574</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a40c34464b6c99fd72c4bd7acfac5915d"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a40c34464b6c99fd72c4bd7acfac5915d">thickLineColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>width</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw a thick line with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the line. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the line. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the line. </td></tr> <tr><td class="paramname">width</td><td>Width of the line in pixels. Must be &gt;0. </td></tr> <tr><td class="paramname">color</td><td>The color value of the line to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06808">6808</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="aa740c1eff9163862704eb3bb3b5964db"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#aa740c1eff9163862704eb3bb3b5964db">thickLineRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>width</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw a thick line with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the line. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the line. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the line. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the line. </td></tr> <tr><td class="paramname">width</td><td>Width of the line in pixels. Must be &gt;0. </td></tr> <tr><td class="paramname">r</td><td>The red value of the character to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the character to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the character to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the character to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l06847">6847</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="aec2a0c435b879a29167be6b1c49f1e49"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#aec2a0c435b879a29167be6b1c49f1e49">trigonColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw trigon (triangle outline) with alpha blending. </p> <p>Note: Creates vertex array and uses polygon routine to render.</p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the trigon. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the trigon. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the trigon. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the trigon. </td></tr> <tr><td class="paramname">x3</td><td>X coordinate of the third point of the trigon. </td></tr> <tr><td class="paramname">y3</td><td>Y coordinate of the third point of the trigon. </td></tr> <tr><td class="paramname">color</td><td>The color value of the trigon to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04793">4793</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a090024f5f3e38b02b0bca704259b9d11"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a090024f5f3e38b02b0bca704259b9d11">trigonRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y3</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw trigon (triangle outline) with alpha blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x1</td><td>X coordinate of the first point of the trigon. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point of the trigon. </td></tr> <tr><td class="paramname">x2</td><td>X coordinate of the second point of the trigon. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point of the trigon. </td></tr> <tr><td class="paramname">x3</td><td>X coordinate of the third point of the trigon. </td></tr> <tr><td class="paramname">y3</td><td>Y coordinate of the third point of the trigon. </td></tr> <tr><td class="paramname">r</td><td>The red value of the trigon to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the trigon to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the trigon to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the trigon to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l04825">4825</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="ab68d565f00527a67c9d88121c753302c"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#ab68d565f00527a67c9d88121c753302c">vlineColor</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint32&#160;</td> <td class="paramname"><em>color</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw vertical line with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the points of the line. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (i.e. top) of the line. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (i.e. bottom) of the line. </td></tr> <tr><td class="paramname">color</td><td>The color value of the line to draw (0xRRGGBBAA).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01392">1392</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> <a class="anchor" id="a68ed9a65e3e0de26136566b0cf0c859e"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> int <a class="el" href="_s_d_l__gfx_primitives_8h.html#a68ed9a65e3e0de26136566b0cf0c859e">vlineRGBA</a> </td> <td>(</td> <td class="paramtype">SDL_Surface *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Sint16&#160;</td> <td class="paramname"><em>y2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>r</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>g</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>b</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">Uint8&#160;</td> <td class="paramname"><em>a</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draw vertical line with blending. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>The surface to draw on. </td></tr> <tr><td class="paramname">x</td><td>X coordinate of the points of the line. </td></tr> <tr><td class="paramname">y1</td><td>Y coordinate of the first point (i.e. top) of the line. </td></tr> <tr><td class="paramname">y2</td><td>Y coordinate of the second point (i.e. bottom) of the line. </td></tr> <tr><td class="paramname">r</td><td>The red value of the line to draw. </td></tr> <tr><td class="paramname">g</td><td>The green value of the line to draw. </td></tr> <tr><td class="paramname">b</td><td>The blue value of the line to draw. </td></tr> <tr><td class="paramname">a</td><td>The alpha value of the line to draw.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 on success, -1 on failure. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l01560">1560</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p> </div> </div> </div><!-- contents --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.0 </small></address> </body> </html>
YifuLiu/AliOS-Things
components/SDL2/src/gfx/Docs/html/_s_d_l__gfx_primitives_8h.html
HTML
apache-2.0
242,689
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>SDL_gfx: I:/Sources/sdlgfx/SDL_gfxPrimitives.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SDL_gfx &#160;<span id="projectnumber">2.0.25</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.8.0 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="headertitle"> <div class="title">I:/Sources/sdlgfx/SDL_gfxPrimitives.h</div> </div> </div><!--header--> <div class="contents"> <a href="_s_d_l__gfx_primitives_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* </span> <a name="l00002"></a>00002 <span class="comment"></span> <a name="l00003"></a>00003 <span class="comment">SDL_gfxPrimitives.h: graphics primitives for SDL</span> <a name="l00004"></a>00004 <span class="comment"></span> <a name="l00005"></a>00005 <span class="comment">Copyright (C) 2001-2012 Andreas Schiffler</span> <a name="l00006"></a>00006 <span class="comment"></span> <a name="l00007"></a>00007 <span class="comment">This software is provided &#39;as-is&#39;, without any express or implied</span> <a name="l00008"></a>00008 <span class="comment">warranty. In no event will the authors be held liable for any damages</span> <a name="l00009"></a>00009 <span class="comment">arising from the use of this software.</span> <a name="l00010"></a>00010 <span class="comment"></span> <a name="l00011"></a>00011 <span class="comment">Permission is granted to anyone to use this software for any purpose,</span> <a name="l00012"></a>00012 <span class="comment">including commercial applications, and to alter it and redistribute it</span> <a name="l00013"></a>00013 <span class="comment">freely, subject to the following restrictions:</span> <a name="l00014"></a>00014 <span class="comment"></span> <a name="l00015"></a>00015 <span class="comment">1. The origin of this software must not be misrepresented; you must not</span> <a name="l00016"></a>00016 <span class="comment">claim that you wrote the original software. If you use this software</span> <a name="l00017"></a>00017 <span class="comment">in a product, an acknowledgment in the product documentation would be</span> <a name="l00018"></a>00018 <span class="comment">appreciated but is not required.</span> <a name="l00019"></a>00019 <span class="comment"></span> <a name="l00020"></a>00020 <span class="comment">2. Altered source versions must be plainly marked as such, and must not be</span> <a name="l00021"></a>00021 <span class="comment">misrepresented as being the original software.</span> <a name="l00022"></a>00022 <span class="comment"></span> <a name="l00023"></a>00023 <span class="comment">3. This notice may not be removed or altered from any source</span> <a name="l00024"></a>00024 <span class="comment">distribution.</span> <a name="l00025"></a>00025 <span class="comment"></span> <a name="l00026"></a>00026 <span class="comment">Andreas Schiffler -- aschiffler at ferzkopp dot net</span> <a name="l00027"></a>00027 <span class="comment"></span> <a name="l00028"></a>00028 <span class="comment">*/</span> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="preprocessor">#ifndef _SDL_gfxPrimitives_h</span> <a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#define _SDL_gfxPrimitives_h</span> <a name="l00032"></a>00032 <span class="preprocessor"></span> <a name="l00033"></a>00033 <span class="preprocessor">#include &lt;math.h&gt;</span> <a name="l00034"></a>00034 <span class="preprocessor">#ifndef M_PI</span> <a name="l00035"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">00035</a> <span class="preprocessor"></span><span class="preprocessor">#define M_PI 3.1415926535897932384626433832795</span> <a name="l00036"></a>00036 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00037"></a>00037 <span class="preprocessor"></span> <a name="l00038"></a>00038 <span class="preprocessor">#include &quot;SDL.h&quot;</span> <a name="l00039"></a>00039 <a name="l00040"></a>00040 <span class="comment">/* Set up for C function definitions, even when using C++ */</span> <a name="l00041"></a>00041 <span class="preprocessor">#ifdef __cplusplus</span> <a name="l00042"></a>00042 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> { <a name="l00043"></a>00043 <span class="preprocessor">#endif</span> <a name="l00044"></a>00044 <span class="preprocessor"></span> <a name="l00045"></a>00045 <span class="comment">/* ----- Versioning */</span> <a name="l00046"></a>00046 <a name="l00047"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a2a585f5832061010155d87737ef5bf88">00047</a> <span class="preprocessor">#define SDL_GFXPRIMITIVES_MAJOR 2</span> <a name="l00048"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#abd0939b1856bbb822b37b68755dc9ee5">00048</a> <span class="preprocessor"></span><span class="preprocessor">#define SDL_GFXPRIMITIVES_MINOR 0</span> <a name="l00049"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a06ea681a295987b8b8ec3fcdb04713df">00049</a> <span class="preprocessor"></span><span class="preprocessor">#define SDL_GFXPRIMITIVES_MICRO 25</span> <a name="l00050"></a>00050 <span class="preprocessor"></span> <a name="l00051"></a>00051 <a name="l00052"></a>00052 <span class="comment">/* ---- Function Prototypes */</span> <a name="l00053"></a>00053 <a name="l00054"></a>00054 <span class="preprocessor">#ifdef _MSC_VER</span> <a name="l00055"></a>00055 <span class="preprocessor"></span><span class="preprocessor"># if defined(DLL_EXPORT) &amp;&amp; !defined(LIBSDL_GFX_DLL_IMPORT)</span> <a name="l00056"></a>00056 <span class="preprocessor"></span><span class="preprocessor"># define SDL_GFXPRIMITIVES_SCOPE __declspec(dllexport)</span> <a name="l00057"></a>00057 <span class="preprocessor"></span><span class="preprocessor"># else</span> <a name="l00058"></a>00058 <span class="preprocessor"></span><span class="preprocessor"># ifdef LIBSDL_GFX_DLL_IMPORT</span> <a name="l00059"></a>00059 <span class="preprocessor"></span><span class="preprocessor"># define SDL_GFXPRIMITIVES_SCOPE __declspec(dllimport)</span> <a name="l00060"></a>00060 <span class="preprocessor"></span><span class="preprocessor"># endif</span> <a name="l00061"></a>00061 <span class="preprocessor"></span><span class="preprocessor"># endif</span> <a name="l00062"></a>00062 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00063"></a>00063 <span class="preprocessor"></span><span class="preprocessor">#ifndef SDL_GFXPRIMITIVES_SCOPE</span> <a name="l00064"></a><a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">00064</a> <span class="preprocessor"></span><span class="preprocessor"># define SDL_GFXPRIMITIVES_SCOPE extern</span> <a name="l00065"></a>00065 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00066"></a>00066 <span class="preprocessor"></span> <a name="l00067"></a>00067 <span class="comment">/* Note: all ___Color routines expect the color to be in format 0xRRGGBBAA */</span> <a name="l00068"></a>00068 <a name="l00069"></a>00069 <span class="comment">/* Pixel */</span> <a name="l00070"></a>00070 <a name="l00071"></a>00071 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae6f8690e5c5a85d3263c8e16727b34ef" title="Pixel draw with blending enabled if a&lt;255.">pixelColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color); <a name="l00072"></a>00072 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a7b6f83bdef72f6b356664a93841381c0" title="Pixel draw with blending enabled if a&lt;255.">pixelRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00073"></a>00073 <a name="l00074"></a>00074 <span class="comment">/* Horizontal line */</span> <a name="l00075"></a>00075 <a name="l00076"></a>00076 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac" title="Draw horizontal line with blending.">hlineColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color); <a name="l00077"></a>00077 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a6608a0d1d4c7e16fa1afcbd3eb5c3850" title="Draw horizontal line with blending.">hlineRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00078"></a>00078 <a name="l00079"></a>00079 <span class="comment">/* Vertical line */</span> <a name="l00080"></a>00080 <a name="l00081"></a>00081 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67" title="Draw vertical line with blending.">vlineColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color); <a name="l00082"></a>00082 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a8b79ac1e779755aee92b04f3a6cfc5d7" title="Draw vertical line with blending.">vlineRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00083"></a>00083 <a name="l00084"></a>00084 <span class="comment">/* Rectangle */</span> <a name="l00085"></a>00085 <a name="l00086"></a>00086 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a6ab25c393f6e5f8d68ea3365f6ea98d2" title="Draw rectangle with blending.">rectangleColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color); <a name="l00087"></a>00087 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a40991c6eeb936d35d0a8e8aa95268f72" title="Draw rectangle with blending.">rectangleRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, <a name="l00088"></a>00088 Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00089"></a>00089 <a name="l00090"></a>00090 <span class="comment">/* Rounded-Corner Rectangle */</span> <a name="l00091"></a>00091 <a name="l00092"></a>00092 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a830dd9dcfa39f4718aa2c269060326d0" title="Draw rounded-corner rectangle with blending.">roundedRectangleColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color); <a name="l00093"></a>00093 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a300272b3b799f09ca6cd5c541b19f07a" title="Draw rounded-corner rectangle with blending.">roundedRectangleRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, <a name="l00094"></a>00094 Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00095"></a>00095 <a name="l00096"></a>00096 <span class="comment">/* Filled rectangle (Box) */</span> <a name="l00097"></a>00097 <a name="l00098"></a>00098 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a6bb30dfc32d0aee20271a0356a2e2fd0" title="Draw box (filled rectangle) with blending.">boxColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color); <a name="l00099"></a>00099 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a1864b3062793a7f7dd81aaf8c8abd6b0" title="Draw box (filled rectangle) with blending.">boxRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, <a name="l00100"></a>00100 Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00101"></a>00101 <a name="l00102"></a>00102 <span class="comment">/* Rounded-Corner Filled rectangle (Box) */</span> <a name="l00103"></a>00103 <a name="l00104"></a>00104 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a718c4f31d1e145106959c2a77d5fee9d" title="Draw rounded-corner box (filled rectangle) with blending.">roundedBoxColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color); <a name="l00105"></a>00105 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#aad706348fec18631d7bc48a2d91f5b4d" title="Draw rounded-corner box (filled rectangle) with blending.">roundedBoxRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, <a name="l00106"></a>00106 Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00107"></a>00107 <a name="l00108"></a>00108 <span class="comment">/* Line */</span> <a name="l00109"></a>00109 <a name="l00110"></a>00110 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#ad44c550fab3cb736eb049713ede94052" title="Draw line with alpha blending.">lineColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color); <a name="l00111"></a>00111 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a760139e11a9ae5defeb755ca0c794f5f" title="Draw line with alpha blending.">lineRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, <a name="l00112"></a>00112 Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00113"></a>00113 <a name="l00114"></a>00114 <span class="comment">/* AA Line */</span> <a name="l00115"></a>00115 <a name="l00116"></a>00116 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a25c56f2def855db01dcf7ff7f7356182" title="Ddraw anti-aliased line with alpha blending.">aalineColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color); <a name="l00117"></a>00117 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a716b29af8cfc638fad0cfa0f1af15f23" title="Draw anti-aliased line with alpha blending.">aalineRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, <a name="l00118"></a>00118 Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00119"></a>00119 <a name="l00120"></a>00120 <span class="comment">/* Thick Line */</span> <a name="l00121"></a>00121 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a1494109358b4e4b7ec300d83e3f90300" title="Draw a thick line with alpha blending.">thickLineColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, <a name="l00122"></a>00122 Uint8 width, Uint32 color); <a name="l00123"></a>00123 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a8b24d64b51e23592c93abc2aa50c818e" title="Draw a thick line with alpha blending.">thickLineRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, <a name="l00124"></a>00124 Uint8 width, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00125"></a>00125 <a name="l00126"></a>00126 <span class="comment">/* Circle */</span> <a name="l00127"></a>00127 <a name="l00128"></a>00128 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#aa99bd361cc947b448142720f2ca3320e" title="Draw circle with blending.">circleColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color); <a name="l00129"></a>00129 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a7fe51d4c9426c8795e58c7ddd313b0a4" title="Draw circle with blending.">circleRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00130"></a>00130 <a name="l00131"></a>00131 <span class="comment">/* Arc */</span> <a name="l00132"></a>00132 <a name="l00133"></a>00133 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a461b8ac31e00306aee5f8a4c242671d2" title="Arc with blending.">arcColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color); <a name="l00134"></a>00134 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a2aff993d0d8d64564e16145f401d3cf1" title="Arc with blending.">arcRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, <a name="l00135"></a>00135 Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00136"></a>00136 <a name="l00137"></a>00137 <span class="comment">/* AA Circle */</span> <a name="l00138"></a>00138 <a name="l00139"></a>00139 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#aad64361b01181e6aff940add96d23c61" title="Draw anti-aliased circle with blending.">aacircleColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color); <a name="l00140"></a>00140 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a332780885aa2cfdc2de34dcff8d67e8b" title="Draw anti-aliased circle with blending.">aacircleRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, <a name="l00141"></a>00141 Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00142"></a>00142 <a name="l00143"></a>00143 <span class="comment">/* Filled Circle */</span> <a name="l00144"></a>00144 <a name="l00145"></a>00145 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a39147d1282ec814a1b9e31243aad0359" title="Draw filled circle with blending.">filledCircleColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 r, Uint32 color); <a name="l00146"></a>00146 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a562ba6b18fb70547cd50cb3bb0f70272" title="Draw filled circle with blending.">filledCircleRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, <a name="l00147"></a>00147 Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00148"></a>00148 <a name="l00149"></a>00149 <span class="comment">/* Ellipse */</span> <a name="l00150"></a>00150 <a name="l00151"></a>00151 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a476cff7702f4be9090871e35859782f0" title="Draw ellipse with blending.">ellipseColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color); <a name="l00152"></a>00152 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a18c8a26c9009482eec40f9f4a6945fd1" title="Draw ellipse with blending.">ellipseRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, <a name="l00153"></a>00153 Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00154"></a>00154 <a name="l00155"></a>00155 <span class="comment">/* AA Ellipse */</span> <a name="l00156"></a>00156 <a name="l00157"></a>00157 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a1c7d20dcba8e0d7ce483f4c854c438be" title="Draw anti-aliased ellipse with blending.">aaellipseColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color); <a name="l00158"></a>00158 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#ab9f0f00d7fb2f04aa9ba1630e31a27bf" title="Draw anti-aliased ellipse with blending.">aaellipseRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, <a name="l00159"></a>00159 Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00160"></a>00160 <a name="l00161"></a>00161 <span class="comment">/* Filled Ellipse */</span> <a name="l00162"></a>00162 <a name="l00163"></a>00163 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a8fed50800f2f1bdfaa048698f5052f25" title="Draw filled ellipse with blending.">filledEllipseColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color); <a name="l00164"></a>00164 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a33595ad996dd0dcccde3abbcef540eec" title="Draw filled ellipse with blending.">filledEllipseRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, <a name="l00165"></a>00165 Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00166"></a>00166 <a name="l00167"></a>00167 <span class="comment">/* Pie */</span> <a name="l00168"></a>00168 <a name="l00169"></a>00169 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a3c2bc64deabda74933f31daba6bed7be" title="Draw pie (outline) with alpha blending.">pieColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, <a name="l00170"></a>00170 Sint16 start, Sint16 end, Uint32 color); <a name="l00171"></a>00171 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a8442f2c2bedbe27c96d8d44319981992" title="Draw pie (outline) with alpha blending.">pieRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, <a name="l00172"></a>00172 Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00173"></a>00173 <a name="l00174"></a>00174 <span class="comment">/* Filled Pie */</span> <a name="l00175"></a>00175 <a name="l00176"></a>00176 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a2c30ee985b2513dc58d9b19d4e71562b" title="Draw filled pie with alpha blending.">filledPieColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, <a name="l00177"></a>00177 Sint16 start, Sint16 end, Uint32 color); <a name="l00178"></a>00178 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a4ffdfd2834f3ef0fd0ee622b5f1d16b8" title="Draw filled pie with alpha blending.">filledPieRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, <a name="l00179"></a>00179 Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00180"></a>00180 <a name="l00181"></a>00181 <span class="comment">/* Trigon */</span> <a name="l00182"></a>00182 <a name="l00183"></a>00183 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a7465d08ef930ebb5442c7dd246fed4b5" title="Draw trigon (triangle outline) with alpha blending.">trigonColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color); <a name="l00184"></a>00184 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a45d6a7edcd8b25e1a60e39b7f60bda3f" title="Draw trigon (triangle outline) with alpha blending.">trigonRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, <a name="l00185"></a>00185 Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00186"></a>00186 <a name="l00187"></a>00187 <span class="comment">/* AA-Trigon */</span> <a name="l00188"></a>00188 <a name="l00189"></a>00189 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a4f928dfaef530c83e304a452d2e55190" title="Draw anti-aliased trigon (triangle outline) with alpha blending.">aatrigonColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color); <a name="l00190"></a>00190 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#ab53a84faa65b68e40cb68b8cacbb4b7d" title="Draw anti-aliased trigon (triangle outline) with alpha blending.">aatrigonRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, <a name="l00191"></a>00191 Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00192"></a>00192 <a name="l00193"></a>00193 <span class="comment">/* Filled Trigon */</span> <a name="l00194"></a>00194 <a name="l00195"></a>00195 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a78d4ed2372527f3b78f5893928b0f519" title="Draw filled trigon (triangle) with alpha blending.">filledTrigonColor</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color); <a name="l00196"></a>00196 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a8f318d776ff1e3c6790405e0e59e5356" title="Draw filled trigon (triangle) with alpha blending.">filledTrigonRGBA</a>(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, <a name="l00197"></a>00197 Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00198"></a>00198 <a name="l00199"></a>00199 <span class="comment">/* Polygon */</span> <a name="l00200"></a>00200 <a name="l00201"></a>00201 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a2d692dc25f3b579b386dff8dcd9cbc00" title="Draw polygon with alpha blending.">polygonColor</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, Uint32 color); <a name="l00202"></a>00202 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#ae55541ec58990420dc6dc6b9d61f33d6" title="Draw polygon with alpha blending.">polygonRGBA</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <a name="l00203"></a>00203 <span class="keywordtype">int</span> n, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00204"></a>00204 <a name="l00205"></a>00205 <span class="comment">/* AA-Polygon */</span> <a name="l00206"></a>00206 <a name="l00207"></a>00207 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a09950a50e8806e88bb20c543c58cc6a8" title="Draw anti-aliased polygon with alpha blending.">aapolygonColor</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, Uint32 color); <a name="l00208"></a>00208 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a7d08522e52d8290c5c498ce435fa51f0" title="Draw anti-aliased polygon with alpha blending.">aapolygonRGBA</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <a name="l00209"></a>00209 <span class="keywordtype">int</span> n, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00210"></a>00210 <a name="l00211"></a>00211 <span class="comment">/* Filled Polygon */</span> <a name="l00212"></a>00212 <a name="l00213"></a>00213 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#af22692175cb73329410cbcc7d7491c4d" title="Draw filled polygon with alpha blending.">filledPolygonColor</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, Uint32 color); <a name="l00214"></a>00214 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a40ef0b898905c190c193f0f55deb5a6c" title="Draw filled polygon with alpha blending.">filledPolygonRGBA</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <a name="l00215"></a>00215 <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00216"></a>00216 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a65137af308ea878f28abc95419e8aef5" title="Draws a polygon filled with the given texture.">texturedPolygon</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, SDL_Surface * texture,<span class="keywordtype">int</span> texture_dx,<span class="keywordtype">int</span> texture_dy); <a name="l00217"></a>00217 <a name="l00218"></a>00218 <span class="comment">/* (Note: These MT versions are required for multi-threaded operation.) */</span> <a name="l00219"></a>00219 <a name="l00220"></a>00220 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a1f3a2dcda741a2c29b5dacce4ffe0271" title="Draw filled polygon with alpha blending (multi-threaded capable).">filledPolygonColorMT</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, Uint32 color, <span class="keywordtype">int</span> **polyInts, <span class="keywordtype">int</span> *polyAllocated); <a name="l00221"></a>00221 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a586d64a80ac67de184e33609509d45a9" title="Draw filled polygon with alpha blending (multi-threaded capable).">filledPolygonRGBAMT</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <a name="l00222"></a>00222 <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, Uint8 r, Uint8 g, Uint8 b, Uint8 a, <a name="l00223"></a>00223 <span class="keywordtype">int</span> **polyInts, <span class="keywordtype">int</span> *polyAllocated); <a name="l00224"></a>00224 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a28ae354c6272da21b5753ae4ab9e1e84" title="Draws a polygon filled with the given texture (Multi-Threading Capable).">texturedPolygonMT</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, SDL_Surface * texture,<span class="keywordtype">int</span> texture_dx,<span class="keywordtype">int</span> texture_dy, <span class="keywordtype">int</span> **polyInts, <span class="keywordtype">int</span> *polyAllocated); <a name="l00225"></a>00225 <a name="l00226"></a>00226 <span class="comment">/* Bezier */</span> <a name="l00227"></a>00227 <a name="l00228"></a>00228 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#adfe8f9c42d29a090aae15eeb19b80d51" title="Draw a bezier curve with alpha blending.">bezierColor</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <span class="keywordtype">int</span> n, <span class="keywordtype">int</span> s, Uint32 color); <a name="l00229"></a>00229 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a4b7fbf6cc366abdf345a25308d53e125" title="Draw a bezier curve with alpha blending.">bezierRGBA</a>(SDL_Surface * dst, <span class="keyword">const</span> Sint16 * vx, <span class="keyword">const</span> Sint16 * vy, <a name="l00230"></a>00230 <span class="keywordtype">int</span> n, <span class="keywordtype">int</span> s, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00231"></a>00231 <a name="l00232"></a>00232 <span class="comment">/* Characters/Strings */</span> <a name="l00233"></a>00233 <a name="l00234"></a>00234 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#afacd57651ec0e0ccab60753636862cd0" title="Sets or resets the current global font data.">gfxPrimitivesSetFont</a>(<span class="keyword">const</span> <span class="keywordtype">void</span> *fontdata, Uint32 cw, Uint32 ch); <a name="l00235"></a>00235 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#aef6796a883f07d31bbf7c7df6d1153d2" title="Sets current global font character rotation steps.">gfxPrimitivesSetFontRotation</a>(Uint32 rotation); <a name="l00236"></a>00236 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#aef5fdeb16c4578d8cd50e106299e993e" title="Draw a character of the currently set font.">characterColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, <span class="keywordtype">char</span> c, Uint32 color); <a name="l00237"></a>00237 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a96379d2ce808aa642afb57bced0c670e" title="Draw a character of the currently set font.">characterRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, <span class="keywordtype">char</span> c, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00238"></a>00238 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a62d2ba55abc7673f2dfa29e6bbffefdf" title="Draw a string in the currently set font.">stringColor</a>(SDL_Surface * dst, Sint16 x, Sint16 y, <span class="keyword">const</span> <span class="keywordtype">char</span> *s, Uint32 color); <a name="l00239"></a>00239 <a class="code" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_GFXPRIMITIVES_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_primitives_8c.html#a6ca71826e311bdd9acf13b009256aa1c" title="Draw a string in the currently set font.">stringRGBA</a>(SDL_Surface * dst, Sint16 x, Sint16 y, <span class="keyword">const</span> <span class="keywordtype">char</span> *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a); <a name="l00240"></a>00240 <a name="l00241"></a>00241 <span class="comment">/* Ends C function definitions when using C++ */</span> <a name="l00242"></a>00242 <span class="preprocessor">#ifdef __cplusplus</span> <a name="l00243"></a>00243 <span class="preprocessor"></span>} <a name="l00244"></a>00244 <span class="preprocessor">#endif</span> <a name="l00245"></a>00245 <span class="preprocessor"></span> <a name="l00246"></a>00246 <span class="preprocessor">#endif </span><span class="comment">/* _SDL_gfxPrimitives_h */</span> </pre></div></div><!-- contents --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.0 </small></address> </body> </html>
YifuLiu/AliOS-Things
components/SDL2/src/gfx/Docs/html/_s_d_l__gfx_primitives_8h_source.html
HTML
apache-2.0
42,983
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>SDL_gfx: I:/Sources/sdlgfx/SDL_gfxPrimitives_font.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SDL_gfx &#160;<span id="projectnumber">2.0.25</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.8.0 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#define-members">Defines</a> </div> <div class="headertitle"> <div class="title">I:/Sources/sdlgfx/SDL_gfxPrimitives_font.h File Reference</div> </div> </div><!--header--> <div class="contents"> <p><a href="_s_d_l__gfx_primitives__font_8h_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="define-members"></a> Defines</h2></td></tr> <tr class="memitem:a510f902dcf7aa55fc4305b6f8e203927"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__gfx_primitives__font_8h.html#a510f902dcf7aa55fc4305b6f8e203927">GFX_FONTDATAMAX</a>&#160;&#160;&#160;(8*256)</td></tr> </table> <hr/><h2>Define Documentation</h2> <a class="anchor" id="a510f902dcf7aa55fc4305b6f8e203927"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__gfx_primitives__font_8h.html#a510f902dcf7aa55fc4305b6f8e203927">GFX_FONTDATAMAX</a>&#160;&#160;&#160;(8*256)</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__gfx_primitives__font_8h_source.html#l00006">6</a> of file <a class="el" href="_s_d_l__gfx_primitives__font_8h_source.html">SDL_gfxPrimitives_font.h</a>.</p> </div> </div> </div><!-- contents --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.0 </small></address> </body> </html>
YifuLiu/AliOS-Things
components/SDL2/src/gfx/Docs/html/_s_d_l__gfx_primitives__font_8h.html
HTML
apache-2.0
3,068
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>SDL_gfx: I:/Sources/sdlgfx/SDL_imageFilter.c File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SDL_gfx &#160;<span id="projectnumber">2.0.25</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.8.0 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#define-members">Defines</a> &#124; <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">I:/Sources/sdlgfx/SDL_imageFilter.c File Reference</div> </div> </div><!--header--> <div class="contents"> <div class="textblock"><code>#include &lt;stdio.h&gt;</code><br/> <code>#include &lt;stdlib.h&gt;</code><br/> <code>#include &lt;string.h&gt;</code><br/> <code>#include &lt;SDL_cpuinfo.h&gt;</code><br/> <code>#include &quot;<a class="el" href="_s_d_l__image_filter_8h_source.html">SDL_imageFilter.h</a>&quot;</code><br/> </div> <p><a href="_s_d_l__image_filter_8c_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="define-members"></a> Defines</h2></td></tr> <tr class="memitem:a700fb30611761c46a674a45cc28ff561"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a700fb30611761c46a674a45cc28ff561">SWAP_32</a>(x)&#160;&#160;&#160;(((x) &gt;&gt; 24) | (((x) &amp; 0x00ff0000) &gt;&gt; 8) | (((x) &amp; 0x0000ff00) &lt;&lt; 8) | ((x) &lt;&lt; 24))</td></tr> <tr class="memdesc:a700fb30611761c46a674a45cc28ff561"><td class="mdescLeft">&#160;</td><td class="mdescRight">Swaps the byte order in a 32bit integer (LSB becomes MSB, etc.). <a href="#a700fb30611761c46a674a45cc28ff561"></a><br/></td></tr> <tr><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:a798ce71024ee1a1d1b174fd60fe79917"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917">SDL_imageFilterMMXdetect</a> (void)</td></tr> <tr class="memdesc:a798ce71024ee1a1d1b174fd60fe79917"><td class="mdescLeft">&#160;</td><td class="mdescRight">MMX detection routine (with override flag). <a href="#a798ce71024ee1a1d1b174fd60fe79917"></a><br/></td></tr> <tr class="memitem:a5dff661660755161bb4aaf6199cd1384"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a5dff661660755161bb4aaf6199cd1384">SDL_imageFilterMMXoff</a> ()</td></tr> <tr class="memdesc:a5dff661660755161bb4aaf6199cd1384"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disable MMX check for filter functions and and force to use non-MMX C based code. <a href="#a5dff661660755161bb4aaf6199cd1384"></a><br/></td></tr> <tr class="memitem:a353ee234c3b51b33c4c5c4b30db5832d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a353ee234c3b51b33c4c5c4b30db5832d">SDL_imageFilterMMXon</a> ()</td></tr> <tr class="memdesc:a353ee234c3b51b33c4c5c4b30db5832d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable MMX check for filter functions and use MMX code if available. <a href="#a353ee234c3b51b33c4c5c4b30db5832d"></a><br/></td></tr> <tr class="memitem:a9f06507eb0b63198dbd67495d61c9b20"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a9f06507eb0b63198dbd67495d61c9b20">SDL_imageFilterAdd</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:a9f06507eb0b63198dbd67495d61c9b20"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using Add: D = saturation255(S1 + S2) <a href="#a9f06507eb0b63198dbd67495d61c9b20"></a><br/></td></tr> <tr class="memitem:ace072118fef77973210eb04fb4bfc779"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#ace072118fef77973210eb04fb4bfc779">SDL_imageFilterMean</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:ace072118fef77973210eb04fb4bfc779"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using Mean: D = S1/2 + S2/2. <a href="#ace072118fef77973210eb04fb4bfc779"></a><br/></td></tr> <tr class="memitem:a3c01cf8576ea7a0dfc09dbaa953c9287"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a3c01cf8576ea7a0dfc09dbaa953c9287">SDL_imageFilterSub</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:a3c01cf8576ea7a0dfc09dbaa953c9287"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using Sub: D = saturation0(S1 - S2) <a href="#a3c01cf8576ea7a0dfc09dbaa953c9287"></a><br/></td></tr> <tr class="memitem:a472909f904274255cd6793c520172e48"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a472909f904274255cd6793c520172e48">SDL_imageFilterAbsDiff</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:a472909f904274255cd6793c520172e48"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using AbsDiff: D = | S1 - S2 |. <a href="#a472909f904274255cd6793c520172e48"></a><br/></td></tr> <tr class="memitem:af4633031d40a9ea0956a2f3c6c87a384"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#af4633031d40a9ea0956a2f3c6c87a384">SDL_imageFilterMult</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:af4633031d40a9ea0956a2f3c6c87a384"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using Mult: D = saturation255(S1 * S2) <a href="#af4633031d40a9ea0956a2f3c6c87a384"></a><br/></td></tr> <tr class="memitem:a346db972dff9c56e3c45c904eaa3c39a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a346db972dff9c56e3c45c904eaa3c39a">SDL_imageFilterMultNorASM</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)</td></tr> <tr class="memdesc:a346db972dff9c56e3c45c904eaa3c39a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal ASM Filter using MultNor: D = S1 * S2. <a href="#a346db972dff9c56e3c45c904eaa3c39a"></a><br/></td></tr> <tr class="memitem:a5f3c9fd40426bb46eba5ac167505dcc5"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a5f3c9fd40426bb46eba5ac167505dcc5">SDL_imageFilterMultNor</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:a5f3c9fd40426bb46eba5ac167505dcc5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using MultNor: D = S1 * S2. <a href="#a5f3c9fd40426bb46eba5ac167505dcc5"></a><br/></td></tr> <tr class="memitem:a80737f6427c7bdb30d39a92f6524fc14"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a80737f6427c7bdb30d39a92f6524fc14">SDL_imageFilterMultDivby2</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:a80737f6427c7bdb30d39a92f6524fc14"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using MultDivby2: D = saturation255(S1/2 * S2) <a href="#a80737f6427c7bdb30d39a92f6524fc14"></a><br/></td></tr> <tr class="memitem:a30e685653eb1050c7d48feaeb8f801a1"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a30e685653eb1050c7d48feaeb8f801a1">SDL_imageFilterMultDivby4</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:a30e685653eb1050c7d48feaeb8f801a1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using MultDivby4: D = saturation255(S1/2 * S2/2) <a href="#a30e685653eb1050c7d48feaeb8f801a1"></a><br/></td></tr> <tr class="memitem:a85837ce1b5de1f907b6b9053922b5cbc"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a85837ce1b5de1f907b6b9053922b5cbc">SDL_imageFilterBitAnd</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:a85837ce1b5de1f907b6b9053922b5cbc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using BitAnd: D = S1 &amp; S2. <a href="#a85837ce1b5de1f907b6b9053922b5cbc"></a><br/></td></tr> <tr class="memitem:a5cf1c477f4e32d02f74ee95d9f7b0021"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a5cf1c477f4e32d02f74ee95d9f7b0021">SDL_imageFilterBitOr</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:a5cf1c477f4e32d02f74ee95d9f7b0021"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using BitOr: D = S1 | S2. <a href="#a5cf1c477f4e32d02f74ee95d9f7b0021"></a><br/></td></tr> <tr class="memitem:a0ea22f01c6a4724bac307da3e5355f58"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a0ea22f01c6a4724bac307da3e5355f58">SDL_imageFilterDiv</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:a0ea22f01c6a4724bac307da3e5355f58"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using Div: D = S1 / S2. <a href="#a0ea22f01c6a4724bac307da3e5355f58"></a><br/></td></tr> <tr class="memitem:ac3abfaa8ec2e88c3c4893588c5555856"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#ac3abfaa8ec2e88c3c4893588c5555856">SDL_imageFilterBitNegation</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:ac3abfaa8ec2e88c3c4893588c5555856"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using BitNegation: D = !S. <a href="#ac3abfaa8ec2e88c3c4893588c5555856"></a><br/></td></tr> <tr class="memitem:a812cb307cb60ef31f1ffe81a9eee6bb1"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a812cb307cb60ef31f1ffe81a9eee6bb1">SDL_imageFilterAddByte</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)</td></tr> <tr class="memdesc:a812cb307cb60ef31f1ffe81a9eee6bb1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using AddByte: D = saturation255(S + C) <a href="#a812cb307cb60ef31f1ffe81a9eee6bb1"></a><br/></td></tr> <tr class="memitem:a660543426c47dfec39a349eb3b8f905b"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a660543426c47dfec39a349eb3b8f905b">SDL_imageFilterAddUint</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C)</td></tr> <tr class="memdesc:a660543426c47dfec39a349eb3b8f905b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using AddUint: D = saturation255((S[i] + Cs[i % 4]), Cs=Swap32((uint)C) <a href="#a660543426c47dfec39a349eb3b8f905b"></a><br/></td></tr> <tr class="memitem:ab82db97d129c8cfc36780bcdc6286fcc"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#ab82db97d129c8cfc36780bcdc6286fcc">SDL_imageFilterAddByteToHalf</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)</td></tr> <tr class="memdesc:ab82db97d129c8cfc36780bcdc6286fcc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using AddByteToHalf: D = saturation255(S/2 + C) <a href="#ab82db97d129c8cfc36780bcdc6286fcc"></a><br/></td></tr> <tr class="memitem:a657e128016cc448778007d8b6475dd65"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a657e128016cc448778007d8b6475dd65">SDL_imageFilterSubByteMMX</a> (unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char C)</td></tr> <tr class="memdesc:a657e128016cc448778007d8b6475dd65"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal MMX Filter using SubByte: D = saturation0(S - C) <a href="#a657e128016cc448778007d8b6475dd65"></a><br/></td></tr> <tr class="memitem:a387fb6f0d48cc5d08f37f7f9b92d14b2"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a387fb6f0d48cc5d08f37f7f9b92d14b2">SDL_imageFilterSubByte</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)</td></tr> <tr class="memdesc:a387fb6f0d48cc5d08f37f7f9b92d14b2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using SubByte: D = saturation0(S - C) <a href="#a387fb6f0d48cc5d08f37f7f9b92d14b2"></a><br/></td></tr> <tr class="memitem:abb343ef95e22945e1d4d648b2e176e64"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#abb343ef95e22945e1d4d648b2e176e64">SDL_imageFilterSubUint</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C)</td></tr> <tr class="memdesc:abb343ef95e22945e1d4d648b2e176e64"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using SubUint: D = saturation0(S[i] - Cs[i % 4]), Cs=Swap32((uint)C) <a href="#abb343ef95e22945e1d4d648b2e176e64"></a><br/></td></tr> <tr class="memitem:a68851aed2dcc5dfd2f3b258236f3b88c"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a68851aed2dcc5dfd2f3b258236f3b88c">SDL_imageFilterShiftRight</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)</td></tr> <tr class="memdesc:a68851aed2dcc5dfd2f3b258236f3b88c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ShiftRight: D = saturation0(S &gt;&gt; N) <a href="#a68851aed2dcc5dfd2f3b258236f3b88c"></a><br/></td></tr> <tr class="memitem:a540d4625d76bcd03318c2a59ce650fdb"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a540d4625d76bcd03318c2a59ce650fdb">SDL_imageFilterShiftRightUint</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)</td></tr> <tr class="memdesc:a540d4625d76bcd03318c2a59ce650fdb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ShiftRightUint: D = saturation0((uint)S[i] &gt;&gt; N) <a href="#a540d4625d76bcd03318c2a59ce650fdb"></a><br/></td></tr> <tr class="memitem:a06f7a19d6e2fc89d7b48cc45d715806d"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a06f7a19d6e2fc89d7b48cc45d715806d">SDL_imageFilterMultByByte</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)</td></tr> <tr class="memdesc:a06f7a19d6e2fc89d7b48cc45d715806d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using MultByByte: D = saturation255(S * C) <a href="#a06f7a19d6e2fc89d7b48cc45d715806d"></a><br/></td></tr> <tr class="memitem:a0713d6c267fba9756d6beae81e89f9e4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a0713d6c267fba9756d6beae81e89f9e4">SDL_imageFilterShiftRightAndMultByByte</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N, unsigned char C)</td></tr> <tr class="memdesc:a0713d6c267fba9756d6beae81e89f9e4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ShiftRightAndMultByByte: D = saturation255((S &gt;&gt; N) * C) <a href="#a0713d6c267fba9756d6beae81e89f9e4"></a><br/></td></tr> <tr class="memitem:a4561a73b249a26babc4c469ffbdae604"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a4561a73b249a26babc4c469ffbdae604">SDL_imageFilterShiftLeftByte</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)</td></tr> <tr class="memdesc:a4561a73b249a26babc4c469ffbdae604"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ShiftLeftByte: D = (S &lt;&lt; N) <a href="#a4561a73b249a26babc4c469ffbdae604"></a><br/></td></tr> <tr class="memitem:a250e796fb2db470da0a78b74b78114e8"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a250e796fb2db470da0a78b74b78114e8">SDL_imageFilterShiftLeftUint</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)</td></tr> <tr class="memdesc:a250e796fb2db470da0a78b74b78114e8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ShiftLeftUint: D = ((uint)S &lt;&lt; N) <a href="#a250e796fb2db470da0a78b74b78114e8"></a><br/></td></tr> <tr class="memitem:a98372fea76310903abef7808db10d226"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a98372fea76310903abef7808db10d226">SDL_imageFilterShiftLeft</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)</td></tr> <tr class="memdesc:a98372fea76310903abef7808db10d226"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter ShiftLeft: D = saturation255(S &lt;&lt; N) <a href="#a98372fea76310903abef7808db10d226"></a><br/></td></tr> <tr class="memitem:a951a062e15df290a137428e1e0f4d5ce"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a951a062e15df290a137428e1e0f4d5ce">SDL_imageFilterBinarizeUsingThreshold</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char T)</td></tr> <tr class="memdesc:a951a062e15df290a137428e1e0f4d5ce"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using BinarizeUsingThreshold: D = (S &gt;= T) ? 255:0. <a href="#a951a062e15df290a137428e1e0f4d5ce"></a><br/></td></tr> <tr class="memitem:ab7224abc4ecc1b8a6f4441ef8379515f"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#ab7224abc4ecc1b8a6f4441ef8379515f">SDL_imageFilterClipToRange</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char Tmin, unsigned char Tmax)</td></tr> <tr class="memdesc:ab7224abc4ecc1b8a6f4441ef8379515f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ClipToRange: D = (S &gt;= Tmin) &amp; (S &lt;= Tmax) S:Tmin | Tmax. <a href="#ab7224abc4ecc1b8a6f4441ef8379515f"></a><br/></td></tr> <tr class="memitem:ab018ace4db884cac953b06b09c00828b"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#ab018ace4db884cac953b06b09c00828b">SDL_imageFilterNormalizeLinear</a> (unsigned char *Src, unsigned char *Dest, unsigned int length, int Cmin, int Cmax, int Nmin, int Nmax)</td></tr> <tr class="memdesc:ab018ace4db884cac953b06b09c00828b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using NormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin) <a href="#ab018ace4db884cac953b06b09c00828b"></a><br/></td></tr> <tr class="memitem:a8e7e4138a93e26f1912763189d407770"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a8e7e4138a93e26f1912763189d407770">SDL_imageFilterConvolveKernel3x3Divide</a> (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor)</td></tr> <tr class="memdesc:a8e7e4138a93e26f1912763189d407770"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ConvolveKernel3x3Divide: Dij = saturation0and255( ... ) <a href="#a8e7e4138a93e26f1912763189d407770"></a><br/></td></tr> <tr class="memitem:ac9a556492480ce71f54d456a0ff7e6cb"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#ac9a556492480ce71f54d456a0ff7e6cb">SDL_imageFilterConvolveKernel5x5Divide</a> (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor)</td></tr> <tr class="memdesc:ac9a556492480ce71f54d456a0ff7e6cb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ConvolveKernel5x5Divide: Dij = saturation0and255( ... ) <a href="#ac9a556492480ce71f54d456a0ff7e6cb"></a><br/></td></tr> <tr class="memitem:a363f48e6843fd3f48da53688b89bca48"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a363f48e6843fd3f48da53688b89bca48">SDL_imageFilterConvolveKernel7x7Divide</a> (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor)</td></tr> <tr class="memdesc:a363f48e6843fd3f48da53688b89bca48"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ConvolveKernel7x7Divide: Dij = saturation0and255( ... ) <a href="#a363f48e6843fd3f48da53688b89bca48"></a><br/></td></tr> <tr class="memitem:ae1e91ff193beed110a71119ec901f09d"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#ae1e91ff193beed110a71119ec901f09d">SDL_imageFilterConvolveKernel9x9Divide</a> (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor)</td></tr> <tr class="memdesc:ae1e91ff193beed110a71119ec901f09d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ConvolveKernel9x9Divide: Dij = saturation0and255( ... ) <a href="#ae1e91ff193beed110a71119ec901f09d"></a><br/></td></tr> <tr class="memitem:ac329e5a3b60351768c96c94db9f9cf97"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#ac329e5a3b60351768c96c94db9f9cf97">SDL_imageFilterConvolveKernel3x3ShiftRight</a> (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift)</td></tr> <tr class="memdesc:ac329e5a3b60351768c96c94db9f9cf97"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... ) <a href="#ac329e5a3b60351768c96c94db9f9cf97"></a><br/></td></tr> <tr class="memitem:a5253738dc4c892352b078d9a7dec2b20"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a5253738dc4c892352b078d9a7dec2b20">SDL_imageFilterConvolveKernel5x5ShiftRight</a> (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift)</td></tr> <tr class="memdesc:a5253738dc4c892352b078d9a7dec2b20"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... ) <a href="#a5253738dc4c892352b078d9a7dec2b20"></a><br/></td></tr> <tr class="memitem:a48b40065652dda699875f1425b9227a6"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a48b40065652dda699875f1425b9227a6">SDL_imageFilterConvolveKernel7x7ShiftRight</a> (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift)</td></tr> <tr class="memdesc:a48b40065652dda699875f1425b9227a6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... ) <a href="#a48b40065652dda699875f1425b9227a6"></a><br/></td></tr> <tr class="memitem:a6aaa30dc51d1e51585d02d123b0f1a7a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a6aaa30dc51d1e51585d02d123b0f1a7a">SDL_imageFilterConvolveKernel9x9ShiftRight</a> (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift)</td></tr> <tr class="memdesc:a6aaa30dc51d1e51585d02d123b0f1a7a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ConvolveKernel9x9ShiftRight: Dij = saturation255( ... ) <a href="#a6aaa30dc51d1e51585d02d123b0f1a7a"></a><br/></td></tr> <tr class="memitem:a015fe05161b701162d9ecffb01413f1e"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a015fe05161b701162d9ecffb01413f1e">SDL_imageFilterSobelX</a> (unsigned char *Src, unsigned char *Dest, int rows, int columns)</td></tr> <tr class="memdesc:a015fe05161b701162d9ecffb01413f1e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using SobelX: Dij = saturation255( ... ) <a href="#a015fe05161b701162d9ecffb01413f1e"></a><br/></td></tr> <tr class="memitem:a0d21af83f0183fcd697324cffe3ab3d7"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a0d21af83f0183fcd697324cffe3ab3d7">SDL_imageFilterSobelXShiftRight</a> (unsigned char *Src, unsigned char *Dest, int rows, int columns, unsigned char NRightShift)</td></tr> <tr class="memdesc:a0d21af83f0183fcd697324cffe3ab3d7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using SobelXShiftRight: Dij = saturation255( ... ) <a href="#a0d21af83f0183fcd697324cffe3ab3d7"></a><br/></td></tr> <tr class="memitem:afbfcc8c03e3d791ac74c955d14a135e4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#afbfcc8c03e3d791ac74c955d14a135e4">SDL_imageFilterAlignStack</a> (void)</td></tr> <tr class="memdesc:afbfcc8c03e3d791ac74c955d14a135e4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Align stack to 32 byte boundary,. <a href="#afbfcc8c03e3d791ac74c955d14a135e4"></a><br/></td></tr> <tr class="memitem:a3147eb5ddd4965d65702f0e533b42974"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8c.html#a3147eb5ddd4965d65702f0e533b42974">SDL_imageFilterRestoreStack</a> (void)</td></tr> <tr class="memdesc:a3147eb5ddd4965d65702f0e533b42974"><td class="mdescLeft">&#160;</td><td class="mdescRight">Restore previously aligned stack. <a href="#a3147eb5ddd4965d65702f0e533b42974"></a><br/></td></tr> </table> <hr/><h2>Define Documentation</h2> <a class="anchor" id="a700fb30611761c46a674a45cc28ff561"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__image_filter_8c.html#a700fb30611761c46a674a45cc28ff561">SWAP_32</a></td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">x</td><td>)</td> <td>&#160;&#160;&#160;(((x) &gt;&gt; 24) | (((x) &amp; 0x00ff0000) &gt;&gt; 8) | (((x) &amp; 0x0000ff00) &lt;&lt; 8) | ((x) &lt;&lt; 24))</td> </tr> </table> </div> <div class="memdoc"> <p>Swaps the byte order in a 32bit integer (LSB becomes MSB, etc.). </p> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00058">58</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <hr/><h2>Function Documentation</h2> <a class="anchor" id="a472909f904274255cd6793c520172e48"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a789ce070edcc478ad97a0d7ff90e6aa2">SDL_imageFilterAbsDiff</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using AbsDiff: D = | S1 - S2 |. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00539">539</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a9f06507eb0b63198dbd67495d61c9b20"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a9034268e2f51550d8f1d6084bda45194">SDL_imageFilterAdd</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using Add: D = saturation255(S1 + S2) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00170">170</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a812cb307cb60ef31f1ffe81a9eee6bb1"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a6be6dccd000eff4baadd33297e5cc419">SDL_imageFilterAddByte</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>C</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using AddByte: D = saturation255(S + C) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">C</td><td>Constant value to add (C).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l01788">1788</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="ab82db97d129c8cfc36780bcdc6286fcc"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a8cbdffd5dbcab3b5dc9207d57af616b3">SDL_imageFilterAddByteToHalf</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>C</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using AddByteToHalf: D = saturation255(S/2 + C) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">C</td><td>Constant to add (C).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l02065">2065</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a660543426c47dfec39a349eb3b8f905b"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#af1a17645dea69e52c7bd560521286765">SDL_imageFilterAddUint</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>C</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using AddUint: D = saturation255((S[i] + Cs[i % 4]), Cs=Swap32((uint)C) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">C</td><td>Constant to add (C).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l01916">1916</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="afbfcc8c03e3d791ac74c955d14a135e4"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void <a class="el" href="_s_d_l__image_filter_8h.html#a08a45265e9e84bf8beedebba26da947c">SDL_imageFilterAlignStack</a> </td> <td>(</td> <td class="paramtype">void&#160;</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Align stack to 32 byte boundary,. </p> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l07323">7323</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a951a062e15df290a137428e1e0f4d5ce"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#ad5bf97d7e39d018d2eeb570e97edf8c0">SDL_imageFilterBinarizeUsingThreshold</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>T</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using BinarizeUsingThreshold: D = (S &gt;= T) ? 255:0. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">T</td><td>The threshold boundary (inclusive).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l03531">3531</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a85837ce1b5de1f907b6b9053922b5cbc"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a5f67460c0b89dadd49d04832608a345b">SDL_imageFilterBitAnd</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using BitAnd: D = S1 &amp; S2. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l01275">1275</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="ac3abfaa8ec2e88c3c4893588c5555856"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#abc3c3fc5f018e271f6393921f3964d31">SDL_imageFilterBitNegation</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using BitNegation: D = !S. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l01668">1668</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a5cf1c477f4e32d02f74ee95d9f7b0021"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a0acf0eabba33f8fa7acbc08dc3015cd3">SDL_imageFilterBitOr</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using BitOr: D = S1 | S2. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l01389">1389</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="ab7224abc4ecc1b8a6f4441ef8379515f"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#ae9d552de9cf5a4a1716d91ee905eafd7">SDL_imageFilterClipToRange</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>Tmin</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>Tmax</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ClipToRange: D = (S &gt;= Tmin) &amp; (S &lt;= Tmax) S:Tmin | Tmax. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">Tmin</td><td>Lower (inclusive) boundary of the clipping range. </td></tr> <tr><td class="paramname">Tmax</td><td>Upper (inclusive) boundary of the clipping range.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l03688">3688</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a8e7e4138a93e26f1912763189d407770"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a7286cd21fa0a0cfb0606806dacfbe121">SDL_imageFilterConvolveKernel3x3Divide</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>rows</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>columns</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">signed short *&#160;</td> <td class="paramname"><em>Kernel</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>Divisor</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ConvolveKernel3x3Divide: Dij = saturation0and255( ... ) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>The source 2D byte array to convolve. Should be different from destination. </td></tr> <tr><td class="paramname">Dest</td><td>The destination 2D byte array to store the result in. Should be different from source. </td></tr> <tr><td class="paramname">rows</td><td>Number of rows in source/destination array. Must be &gt;2. </td></tr> <tr><td class="paramname">columns</td><td>Number of columns in source/destination array. Must be &gt;2. </td></tr> <tr><td class="paramname">Kernel</td><td>The 2D convolution kernel of size 3x3. </td></tr> <tr><td class="paramname">Divisor</td><td>The divisor of the convolution sum. Must be &gt;0.</td></tr> </table> </dd> </dl> <p>Note: Non-MMX implementation not available for this function.</p> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if filter was applied, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l03977">3977</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="ac329e5a3b60351768c96c94db9f9cf97"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a67929babce179e1e333c5cd2e5fc4091">SDL_imageFilterConvolveKernel3x3ShiftRight</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>rows</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>columns</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">signed short *&#160;</td> <td class="paramname"><em>Kernel</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>NRightShift</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... ) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>The source 2D byte array to convolve. Should be different from destination. </td></tr> <tr><td class="paramname">Dest</td><td>The destination 2D byte array to store the result in. Should be different from source. </td></tr> <tr><td class="paramname">rows</td><td>Number of rows in source/destination array. Must be &gt;2. </td></tr> <tr><td class="paramname">columns</td><td>Number of columns in source/destination array. Must be &gt;2. </td></tr> <tr><td class="paramname">Kernel</td><td>The 2D convolution kernel of size 3x3. </td></tr> <tr><td class="paramname">NRightShift</td><td>The number of right bit shifts to apply to the convolution sum. Must be &lt;7.</td></tr> </table> </dd> </dl> <p>Note: Non-MMX implementation not available for this function.</p> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if filter was applied, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l05375">5375</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="ac9a556492480ce71f54d456a0ff7e6cb"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a432d7bcc34b6bea42d1a07b4db795e1f">SDL_imageFilterConvolveKernel5x5Divide</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>rows</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>columns</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">signed short *&#160;</td> <td class="paramname"><em>Kernel</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>Divisor</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ConvolveKernel5x5Divide: Dij = saturation0and255( ... ) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>The source 2D byte array to convolve. Should be different from destination. </td></tr> <tr><td class="paramname">Dest</td><td>The destination 2D byte array to store the result in. Should be different from source. </td></tr> <tr><td class="paramname">rows</td><td>Number of rows in source/destination array. Must be &gt;4. </td></tr> <tr><td class="paramname">columns</td><td>Number of columns in source/destination array. Must be &gt;4. </td></tr> <tr><td class="paramname">Kernel</td><td>The 2D convolution kernel of size 5x5. </td></tr> <tr><td class="paramname">Divisor</td><td>The divisor of the convolution sum. Must be &gt;0.</td></tr> </table> </dd> </dl> <p>Note: Non-MMX implementation not available for this function.</p> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if filter was applied, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l04167">4167</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a5253738dc4c892352b078d9a7dec2b20"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a9aaa45452b04f51f52826c2104ea3b85">SDL_imageFilterConvolveKernel5x5ShiftRight</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>rows</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>columns</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">signed short *&#160;</td> <td class="paramname"><em>Kernel</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>NRightShift</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... ) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>The source 2D byte array to convolve. Should be different from destination. </td></tr> <tr><td class="paramname">Dest</td><td>The destination 2D byte array to store the result in. Should be different from source. </td></tr> <tr><td class="paramname">rows</td><td>Number of rows in source/destination array. Must be &gt;4. </td></tr> <tr><td class="paramname">columns</td><td>Number of columns in source/destination array. Must be &gt;4. </td></tr> <tr><td class="paramname">Kernel</td><td>The 2D convolution kernel of size 5x5. </td></tr> <tr><td class="paramname">NRightShift</td><td>The number of right bit shifts to apply to the convolution sum. Must be &lt;7.</td></tr> </table> </dd> </dl> <p>Note: Non-MMX implementation not available for this function.</p> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if filter was applied, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l05552">5552</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a363f48e6843fd3f48da53688b89bca48"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#acc177cf891758fdc4bf7533fb266e339">SDL_imageFilterConvolveKernel7x7Divide</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>rows</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>columns</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">signed short *&#160;</td> <td class="paramname"><em>Kernel</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>Divisor</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ConvolveKernel7x7Divide: Dij = saturation0and255( ... ) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>The source 2D byte array to convolve. Should be different from destination. </td></tr> <tr><td class="paramname">Dest</td><td>The destination 2D byte array to store the result in. Should be different from source. </td></tr> <tr><td class="paramname">rows</td><td>Number of rows in source/destination array. Must be &gt;6. </td></tr> <tr><td class="paramname">columns</td><td>Number of columns in source/destination array. Must be &gt;6. </td></tr> <tr><td class="paramname">Kernel</td><td>The 2D convolution kernel of size 7x7. </td></tr> <tr><td class="paramname">Divisor</td><td>The divisor of the convolution sum. Must be &gt;0.</td></tr> </table> </dd> </dl> <p>Note: Non-MMX implementation not available for this function.</p> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if filter was applied, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l04470">4470</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a48b40065652dda699875f1425b9227a6"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a6dbe52e917c0858bd311e9ce75219587">SDL_imageFilterConvolveKernel7x7ShiftRight</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>rows</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>columns</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">signed short *&#160;</td> <td class="paramname"><em>Kernel</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>NRightShift</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... ) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>The source 2D byte array to convolve. Should be different from destination. </td></tr> <tr><td class="paramname">Dest</td><td>The destination 2D byte array to store the result in. Should be different from source. </td></tr> <tr><td class="paramname">rows</td><td>Number of rows in source/destination array. Must be &gt;6. </td></tr> <tr><td class="paramname">columns</td><td>Number of columns in source/destination array. Must be &gt;6. </td></tr> <tr><td class="paramname">Kernel</td><td>The 2D convolution kernel of size 7x7. </td></tr> <tr><td class="paramname">NRightShift</td><td>The number of right bit shifts to apply to the convolution sum. Must be &lt;7.</td></tr> </table> </dd> </dl> <p>Note: Non-MMX implementation not available for this function.</p> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if filter was applied, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l05853">5853</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="ae1e91ff193beed110a71119ec901f09d"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#af8a8114acd0509787ae5265990049720">SDL_imageFilterConvolveKernel9x9Divide</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>rows</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>columns</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">signed short *&#160;</td> <td class="paramname"><em>Kernel</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>Divisor</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ConvolveKernel9x9Divide: Dij = saturation0and255( ... ) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>The source 2D byte array to convolve. Should be different from destination. </td></tr> <tr><td class="paramname">Dest</td><td>The destination 2D byte array to store the result in. Should be different from source. </td></tr> <tr><td class="paramname">rows</td><td>Number of rows in source/destination array. Must be &gt;8. </td></tr> <tr><td class="paramname">columns</td><td>Number of columns in source/destination array. Must be &gt;8. </td></tr> <tr><td class="paramname">Kernel</td><td>The 2D convolution kernel of size 9x9. </td></tr> <tr><td class="paramname">Divisor</td><td>The divisor of the convolution sum. Must be &gt;0.</td></tr> </table> </dd> </dl> <p>Note: Non-MMX implementation not available for this function.</p> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if filter was applied, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l04827">4827</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a6aaa30dc51d1e51585d02d123b0f1a7a"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#ad2702d0524a16032118fdf67e3e0f44a">SDL_imageFilterConvolveKernel9x9ShiftRight</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>rows</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>columns</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">signed short *&#160;</td> <td class="paramname"><em>Kernel</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>NRightShift</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ConvolveKernel9x9ShiftRight: Dij = saturation255( ... ) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>The source 2D byte array to convolve. Should be different from destination. </td></tr> <tr><td class="paramname">Dest</td><td>The destination 2D byte array to store the result in. Should be different from source. </td></tr> <tr><td class="paramname">rows</td><td>Number of rows in source/destination array. Must be &gt;8. </td></tr> <tr><td class="paramname">columns</td><td>Number of columns in source/destination array. Must be &gt;8. </td></tr> <tr><td class="paramname">Kernel</td><td>The 2D convolution kernel of size 9x9. </td></tr> <tr><td class="paramname">NRightShift</td><td>The number of right bit shifts to apply to the convolution sum. Must be &lt;7.</td></tr> </table> </dd> </dl> <p>Note: Non-MMX implementation not available for this function.</p> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if filter was applied, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l06216">6216</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a0ea22f01c6a4724bac307da3e5355f58"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#aeb8ed56aa7de3c8b0d0b2aa9163c3e37">SDL_imageFilterDiv</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using Div: D = S1 / S2. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l01546">1546</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="ace072118fef77973210eb04fb4bfc779"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a69cfa83c5d198c8ae4be4ab86e8d3b8f">SDL_imageFilterMean</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using Mean: D = S1/2 + S2/2. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00305">305</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a798ce71024ee1a1d1b174fd60fe79917"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a5823f6eb23fe8e74764a94f3d78204ef">SDL_imageFilterMMXdetect</a> </td> <td>(</td> <td class="paramtype">void&#160;</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>MMX detection routine (with override flag). </p> <dl class="section return"><dt>Returns:</dt><dd>1 of MMX was detected, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00077">77</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a5dff661660755161bb4aaf6199cd1384"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void <a class="el" href="_s_d_l__image_filter_8h.html#a403adc470cb1dd34520f18d55804d4ea">SDL_imageFilterMMXoff</a> </td> <td>(</td> <td class="paramtype">void&#160;</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Disable MMX check for filter functions and and force to use non-MMX C based code. </p> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00090">90</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a353ee234c3b51b33c4c5c4b30db5832d"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void <a class="el" href="_s_d_l__image_filter_8h.html#a848ce7e9551b25fea19fe1fb739f74fb">SDL_imageFilterMMXon</a> </td> <td>(</td> <td class="paramtype">void&#160;</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Enable MMX check for filter functions and use MMX code if available. </p> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00098">98</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="af4633031d40a9ea0956a2f3c6c87a384"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a4657c2a1e1bf55d3241dc737cd618409">SDL_imageFilterMult</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using Mult: D = saturation255(S1 * S2) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00726">726</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a06f7a19d6e2fc89d7b48cc45d715806d"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#add06bb6ea7847fc13a3041ddceb4ac3c">SDL_imageFilterMultByByte</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>C</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using MultByByte: D = saturation255(S * C) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays. </td></tr> <tr><td class="paramname">C</td><td>Constant to multiply with (C).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l02787">2787</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a80737f6427c7bdb30d39a92f6524fc14"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#aa19248767b1fd9ffdea4ba69b9f00175">SDL_imageFilterMultDivby2</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using MultDivby2: D = saturation255(S1/2 * S2) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00997">997</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a30e685653eb1050c7d48feaeb8f801a1"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#aa92bea3946c8081c9656304a7d944fae">SDL_imageFilterMultDivby4</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using MultDivby4: D = saturation255(S1/2 * S2/2) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l01138">1138</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a5f3c9fd40426bb46eba5ac167505dcc5"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#ac4f3446d0da18746b48606fe37c26385">SDL_imageFilterMultNor</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using MultNor: D = S1 * S2. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00859">859</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a346db972dff9c56e3c45c904eaa3c39a"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8c.html#a346db972dff9c56e3c45c904eaa3c39a">SDL_imageFilterMultNorASM</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>SrcLength</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal ASM Filter using MultNor: D = S1 * S2. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">SrcLength</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00789">789</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="ab018ace4db884cac953b06b09c00828b"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#aacb316a18d8cb7999d5d53ee5e7b9750">SDL_imageFilterNormalizeLinear</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>Cmin</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>Cmax</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>Nmin</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>Nmax</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using NormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">Cmin</td><td>Normalization constant. </td></tr> <tr><td class="paramname">Cmax</td><td>Normalization constant. </td></tr> <tr><td class="paramname">Nmin</td><td>Normalization constant. </td></tr> <tr><td class="paramname">Nmax</td><td>Normalization constant.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l03906">3906</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a3147eb5ddd4965d65702f0e533b42974"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void <a class="el" href="_s_d_l__image_filter_8h.html#a84f360601d5e6e017f0e74a2cf83be6c">SDL_imageFilterRestoreStack</a> </td> <td>(</td> <td class="paramtype">void&#160;</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Restore previously aligned stack. </p> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l07351">7351</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a98372fea76310903abef7808db10d226"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a084f9544f049cc01e7b2f1090534abbf">SDL_imageFilterShiftLeft</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>N</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter ShiftLeft: D = saturation255(S &lt;&lt; N) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S1). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">N</td><td>Number of bit-positions to shift (N). Valid range is 0 to 8.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l03390">3390</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a4561a73b249a26babc4c469ffbdae604"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#ac32f1ea9acbee51c2db94224ef6f7fd2">SDL_imageFilterShiftLeftByte</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>N</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ShiftLeftByte: D = (S &lt;&lt; N) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays. </td></tr> <tr><td class="paramname">N</td><td>Number of bit-positions to shift (N). Valid range is 0 to 8.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l03090">3090</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a250e796fb2db470da0a78b74b78114e8"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a4fd6d4a9711c13163496587454d9f1a2">SDL_imageFilterShiftLeftUint</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>N</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ShiftLeftUint: D = ((uint)S &lt;&lt; N) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">N</td><td>Number of bit-positions to shift (N). Valid range is 0 to 32.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l03207">3207</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a68851aed2dcc5dfd2f3b258236f3b88c"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a931f1232cd03acd2ba90af222625f4ca">SDL_imageFilterShiftRight</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>N</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ShiftRight: D = saturation0(S &gt;&gt; N) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">N</td><td>Number of bit-positions to shift (N). Valid range is 0 to 8.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l02473">2473</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a0713d6c267fba9756d6beae81e89f9e4"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a40e1e21ede9a7ed1eddac2cdbfd0b079">SDL_imageFilterShiftRightAndMultByByte</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>N</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>C</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ShiftRightAndMultByByte: D = saturation255((S &gt;&gt; N) * C) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">N</td><td>Number of bit-positions to shift (N). Valid range is 0 to 8. </td></tr> <tr><td class="paramname">C</td><td>Constant to multiply with (C).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l02940">2940</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a540d4625d76bcd03318c2a59ce650fdb"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a4ccddf5c575cc4d6074c9a54789240a6">SDL_imageFilterShiftRightUint</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>N</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ShiftRightUint: D = saturation0((uint)S[i] &gt;&gt; N) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S1). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">N</td><td>Number of bit-positions to shift (N). Valid range is 0 to 32.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l02591">2591</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a015fe05161b701162d9ecffb01413f1e"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a2a0e4e259150abbe33bcddb046c367ba">SDL_imageFilterSobelX</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>rows</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>columns</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using SobelX: Dij = saturation255( ... ) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>The source 2D byte array to sobel-filter. Should be different from destination. </td></tr> <tr><td class="paramname">Dest</td><td>The destination 2D byte array to store the result in. Should be different from source. </td></tr> <tr><td class="paramname">rows</td><td>Number of rows in source/destination array. Must be &gt;2. </td></tr> <tr><td class="paramname">columns</td><td>Number of columns in source/destination array. Must be &gt;7.</td></tr> </table> </dd> </dl> <p>Note: Non-MMX implementation not available for this function.</p> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if filter was applied, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l06796">6796</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a0d21af83f0183fcd697324cffe3ab3d7"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#ab9cc925cd9b135e245936d718b459032">SDL_imageFilterSobelXShiftRight</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>rows</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>columns</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>NRightShift</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using SobelXShiftRight: Dij = saturation255( ... ) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>The source 2D byte array to sobel-filter. Should be different from destination. </td></tr> <tr><td class="paramname">Dest</td><td>The destination 2D byte array to store the result in. Should be different from source. </td></tr> <tr><td class="paramname">rows</td><td>Number of rows in source/destination array. Must be &gt;2. </td></tr> <tr><td class="paramname">columns</td><td>Number of columns in source/destination array. Must be &gt;8. </td></tr> <tr><td class="paramname">NRightShift</td><td>The number of right bit shifts to apply to the filter sum. Must be &lt;7.</td></tr> </table> </dd> </dl> <p>Note: Non-MMX implementation not available for this function.</p> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if filter was applied, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l07049">7049</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a3c01cf8576ea7a0dfc09dbaa953c9287"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#a0e0fb80a3dad33d61a8147c7fb9f529d">SDL_imageFilterSub</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using Sub: D = saturation0(S1 - S2) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00419">419</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a387fb6f0d48cc5d08f37f7f9b92d14b2"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#af8f4ab4050a0661c7696783ba1a1b12b">SDL_imageFilterSubByte</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>C</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using SubByte: D = saturation0(S - C) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays. </td></tr> <tr><td class="paramname">C</td><td>Constant to subtract (C).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l02193">2193</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a657e128016cc448778007d8b6475dd65"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8c.html#a657e128016cc448778007d8b6475dd65">SDL_imageFilterSubByteMMX</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>SrcLength</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>C</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Internal MMX Filter using SubByte: D = saturation0(S - C) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">SrcLength</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">C</td><td>Constant to subtract (C).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l02127">2127</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="abb343ef95e22945e1d4d648b2e176e64"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int <a class="el" href="_s_d_l__image_filter_8h.html#ae2f3c5992701bded7c2d256bbbfb403f">SDL_imageFilterSubUint</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>C</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using SubUint: D = saturation0(S[i] - Cs[i % 4]), Cs=Swap32((uint)C) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S1). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">C</td><td>Constant to subtract (C).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l02322">2322</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> </div><!-- contents --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.0 </small></address> </body> </html>
YifuLiu/AliOS-Things
components/SDL2/src/gfx/Docs/html/_s_d_l__image_filter_8c.html
HTML
apache-2.0
122,678
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>SDL_gfx: I:/Sources/sdlgfx/SDL_imageFilter.c Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SDL_gfx &#160;<span id="projectnumber">2.0.25</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.8.0 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="headertitle"> <div class="title">I:/Sources/sdlgfx/SDL_imageFilter.c</div> </div> </div><!--header--> <div class="contents"> <a href="_s_d_l__image_filter_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"></span> <a name="l00003"></a>00003 <span class="comment">SDL_imageFilter.c: byte-image &quot;filter&quot; routines</span> <a name="l00004"></a>00004 <span class="comment"></span> <a name="l00005"></a>00005 <span class="comment">Copyright (C) 2001-2012 Andreas Schiffler</span> <a name="l00006"></a>00006 <span class="comment">Copyright (C) 2013 Sylvain Beucler</span> <a name="l00007"></a>00007 <span class="comment"></span> <a name="l00008"></a>00008 <span class="comment">This software is provided &#39;as-is&#39;, without any express or implied</span> <a name="l00009"></a>00009 <span class="comment">warranty. In no event will the authors be held liable for any damages</span> <a name="l00010"></a>00010 <span class="comment">arising from the use of this software.</span> <a name="l00011"></a>00011 <span class="comment"></span> <a name="l00012"></a>00012 <span class="comment">Permission is granted to anyone to use this software for any purpose,</span> <a name="l00013"></a>00013 <span class="comment">including commercial applications, and to alter it and redistribute it</span> <a name="l00014"></a>00014 <span class="comment">freely, subject to the following restrictions:</span> <a name="l00015"></a>00015 <span class="comment"></span> <a name="l00016"></a>00016 <span class="comment"> 1. The origin of this software must not be misrepresented; you must not</span> <a name="l00017"></a>00017 <span class="comment"> claim that you wrote the original software. If you use this software</span> <a name="l00018"></a>00018 <span class="comment"> in a product, an acknowledgment in the product documentation would be</span> <a name="l00019"></a>00019 <span class="comment"> appreciated but is not required.</span> <a name="l00020"></a>00020 <span class="comment"></span> <a name="l00021"></a>00021 <span class="comment"> 2. Altered source versions must be plainly marked as such, and must not be</span> <a name="l00022"></a>00022 <span class="comment"> misrepresented as being the original software.</span> <a name="l00023"></a>00023 <span class="comment"></span> <a name="l00024"></a>00024 <span class="comment"> 3. This notice may not be removed or altered from any source</span> <a name="l00025"></a>00025 <span class="comment"> distribution.</span> <a name="l00026"></a>00026 <span class="comment"></span> <a name="l00027"></a>00027 <span class="comment">Andreas Schiffler -- aschiffler at ferzkopp dot net</span> <a name="l00028"></a>00028 <span class="comment"></span> <a name="l00029"></a>00029 <span class="comment">*/</span> <a name="l00030"></a>00030 <a name="l00031"></a>00031 <span class="comment">/*</span> <a name="l00032"></a>00032 <span class="comment"></span> <a name="l00033"></a>00033 <span class="comment">Note: Uses inline x86 MMX or ASM optimizations if available and enabled.</span> <a name="l00034"></a>00034 <span class="comment"></span> <a name="l00035"></a>00035 <span class="comment">Note: Most of the MMX code is based on published routines </span> <a name="l00036"></a>00036 <span class="comment">by Vladimir Kravtchenko at vk@cs.ubc.ca - credits go to </span> <a name="l00037"></a>00037 <span class="comment">him for his work.</span> <a name="l00038"></a>00038 <span class="comment"></span> <a name="l00039"></a>00039 <span class="comment">*/</span> <a name="l00040"></a>00040 <a name="l00041"></a>00041 <span class="preprocessor">#include &lt;stdio.h&gt;</span> <a name="l00042"></a>00042 <span class="preprocessor">#include &lt;stdlib.h&gt;</span> <a name="l00043"></a>00043 <span class="preprocessor">#include &lt;string.h&gt;</span> <a name="l00044"></a>00044 <a name="l00045"></a>00045 <span class="comment">/* Use GCC intrinsics if available: they support both i386 and x86_64,</span> <a name="l00046"></a>00046 <span class="comment"> provide ASM-grade performances, and lift the PUSHA/POPA issues. */</span> <a name="l00047"></a>00047 <span class="preprocessor">#ifdef __GNUC__</span> <a name="l00048"></a>00048 <span class="preprocessor"></span><span class="preprocessor"># ifdef USE_MMX</span> <a name="l00049"></a>00049 <span class="preprocessor"></span><span class="preprocessor"># include &lt;mmintrin.h&gt;</span> <a name="l00050"></a>00050 <span class="preprocessor"># endif</span> <a name="l00051"></a>00051 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00052"></a>00052 <span class="preprocessor"></span><span class="preprocessor">#include &lt;SDL_cpuinfo.h&gt;</span> <a name="l00053"></a>00053 <span class="preprocessor">#include &quot;<a class="code" href="_s_d_l__image_filter_8h.html">SDL_imageFilter.h</a>&quot;</span> <a name="l00054"></a>00054 <a name="l00058"></a><a class="code" href="_s_d_l__image_filter_8c.html#a700fb30611761c46a674a45cc28ff561">00058</a> <span class="preprocessor">#define SWAP_32(x) (((x) &gt;&gt; 24) | (((x) &amp; 0x00ff0000) &gt;&gt; 8) | (((x) &amp; 0x0000ff00) &lt;&lt; 8) | ((x) &lt;&lt; 24))</span> <a name="l00059"></a>00059 <span class="preprocessor"></span> <a name="l00060"></a>00060 <span class="comment">/* ------ Static variables ----- */</span> <a name="l00061"></a>00061 <a name="l00065"></a>00065 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterUseMMX = 1; <a name="l00066"></a>00066 <a name="l00067"></a>00067 <span class="comment">/* Detect GCC */</span> <a name="l00068"></a>00068 <span class="preprocessor">#if defined(__GNUC__)</span> <a name="l00069"></a>00069 <span class="preprocessor"></span><span class="preprocessor">#define GCC__</span> <a name="l00070"></a>00070 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00071"></a>00071 <span class="preprocessor"></span> <a name="l00077"></a><a class="code" href="_s_d_l__image_filter_8h.html#a5823f6eb23fe8e74764a94f3d78204ef">00077</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>(<span class="keywordtype">void</span>) <a name="l00078"></a>00078 { <a name="l00079"></a>00079 <span class="comment">/* Check override flag */</span> <a name="l00080"></a>00080 <span class="keywordflow">if</span> (SDL_imageFilterUseMMX == 0) { <a name="l00081"></a>00081 <span class="keywordflow">return</span> (0); <a name="l00082"></a>00082 } <a name="l00083"></a>00083 <a name="l00084"></a>00084 <span class="keywordflow">return</span> SDL_HasMMX(); <a name="l00085"></a>00085 } <a name="l00086"></a>00086 <a name="l00090"></a><a class="code" href="_s_d_l__image_filter_8h.html#a403adc470cb1dd34520f18d55804d4ea">00090</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__image_filter_8c.html#a5dff661660755161bb4aaf6199cd1384" title="Disable MMX check for filter functions and and force to use non-MMX C based code.">SDL_imageFilterMMXoff</a>() <a name="l00091"></a>00091 { <a name="l00092"></a>00092 SDL_imageFilterUseMMX = 0; <a name="l00093"></a>00093 } <a name="l00094"></a>00094 <a name="l00098"></a><a class="code" href="_s_d_l__image_filter_8h.html#a848ce7e9551b25fea19fe1fb739f74fb">00098</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__image_filter_8c.html#a353ee234c3b51b33c4c5c4b30db5832d" title="Enable MMX check for filter functions and use MMX code if available.">SDL_imageFilterMMXon</a>() <a name="l00099"></a>00099 { <a name="l00100"></a>00100 SDL_imageFilterUseMMX = 1; <a name="l00101"></a>00101 } <a name="l00102"></a>00102 <a name="l00103"></a>00103 <span class="comment">/* ------------------------------------------------------------------------------------ */</span> <a name="l00104"></a>00104 <a name="l00115"></a>00115 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterAddMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength) <a name="l00116"></a>00116 { <a name="l00117"></a>00117 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l00118"></a>00118 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l00119"></a>00119 <span class="preprocessor"></span> __asm <a name="l00120"></a>00120 { <a name="l00121"></a>00121 pusha <a name="l00122"></a>00122 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l00123"></a>00123 mov ebx, Src2 <span class="comment">/* load Src2 address into ebx */</span> <a name="l00124"></a>00124 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l00125"></a>00125 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l00126"></a>00126 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l00127"></a>00127 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l00128"></a>00128 L1010: <a name="l00129"></a>00129 movq mm1, [eax] <span class="comment">/* load 8 bytes from Src1 into mm1 */</span> <a name="l00130"></a>00130 paddusb mm1, [ebx] <span class="comment">/* mm1=Src1+Src2 (add 8 bytes with saturation) */</span> <a name="l00131"></a>00131 movq [edi], mm1 <span class="comment">/* store result in Dest */</span> <a name="l00132"></a>00132 add eax, 8 <span class="comment">/* increase Src1, Src2 and Dest */</span> <a name="l00133"></a>00133 add ebx, 8 <span class="comment">/* register pointers by 8 */</span> <a name="l00134"></a>00134 add edi, 8 <a name="l00135"></a>00135 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l00136"></a>00136 jnz L1010 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l00137"></a>00137 emms <span class="comment">/* exit MMX state */</span> <a name="l00138"></a>00138 popa <a name="l00139"></a>00139 } <a name="l00140"></a>00140 <span class="preprocessor">#else</span> <a name="l00141"></a>00141 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l00142"></a>00142 __m64 *mSrc1 = (__m64*)Src1; <a name="l00143"></a>00143 __m64 *mSrc2 = (__m64*)Src2; <a name="l00144"></a>00144 __m64 *mDest = (__m64*)Dest; <a name="l00145"></a>00145 <span class="keywordtype">int</span> i; <a name="l00146"></a>00146 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l00147"></a>00147 *mDest = _m_paddusb(*mSrc1, *mSrc2); <span class="comment">/* Src1+Src2 (add 8 bytes with saturation) */</span> <a name="l00148"></a>00148 mSrc1++; <a name="l00149"></a>00149 mSrc2++; <a name="l00150"></a>00150 mDest++; <a name="l00151"></a>00151 } <a name="l00152"></a>00152 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l00153"></a>00153 <span class="preprocessor">#endif</span> <a name="l00154"></a>00154 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l00155"></a>00155 <span class="preprocessor">#else</span> <a name="l00156"></a>00156 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l00157"></a>00157 <span class="preprocessor">#endif</span> <a name="l00158"></a>00158 <span class="preprocessor"></span>} <a name="l00159"></a>00159 <a name="l00170"></a><a class="code" href="_s_d_l__image_filter_8h.html#a9034268e2f51550d8f1d6084bda45194">00170</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a9f06507eb0b63198dbd67495d61c9b20" title="Filter using Add: D = saturation255(S1 + S2)">SDL_imageFilterAdd</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length) <a name="l00171"></a>00171 { <a name="l00172"></a>00172 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l00173"></a>00173 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1, *cursrc2, *curdst; <a name="l00174"></a>00174 <span class="keywordtype">int</span> result; <a name="l00175"></a>00175 <a name="l00176"></a>00176 <span class="comment">/* Validate input parameters */</span> <a name="l00177"></a>00177 <span class="keywordflow">if</span> ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) <a name="l00178"></a>00178 <span class="keywordflow">return</span>(-1); <a name="l00179"></a>00179 <span class="keywordflow">if</span> (length == 0) <a name="l00180"></a>00180 <span class="keywordflow">return</span>(0); <a name="l00181"></a>00181 <a name="l00182"></a>00182 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l00183"></a>00183 <a name="l00184"></a>00184 <span class="comment">/* Use MMX assembly routine */</span> <a name="l00185"></a>00185 SDL_imageFilterAddMMX(Src1, Src2, Dest, length); <a name="l00186"></a>00186 <a name="l00187"></a>00187 <span class="comment">/* Check for unaligned bytes */</span> <a name="l00188"></a>00188 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l00189"></a>00189 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l00190"></a>00190 istart = length &amp; 0xfffffff8; <a name="l00191"></a>00191 cursrc1 = &amp;Src1[istart]; <a name="l00192"></a>00192 cursrc2 = &amp;Src2[istart]; <a name="l00193"></a>00193 curdst = &amp;Dest[istart]; <a name="l00194"></a>00194 } <span class="keywordflow">else</span> { <a name="l00195"></a>00195 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l00196"></a>00196 <span class="keywordflow">return</span> (0); <a name="l00197"></a>00197 } <a name="l00198"></a>00198 } <span class="keywordflow">else</span> { <a name="l00199"></a>00199 <span class="comment">/* Setup to process whole image */</span> <a name="l00200"></a>00200 istart = 0; <a name="l00201"></a>00201 cursrc1 = Src1; <a name="l00202"></a>00202 cursrc2 = Src2; <a name="l00203"></a>00203 curdst = Dest; <a name="l00204"></a>00204 } <a name="l00205"></a>00205 <a name="l00206"></a>00206 <span class="comment">/* C routine to process image */</span> <a name="l00207"></a>00207 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l00208"></a>00208 result = (int) *cursrc1 + (<span class="keywordtype">int</span>) *cursrc2; <a name="l00209"></a>00209 <span class="keywordflow">if</span> (result &gt; 255) <a name="l00210"></a>00210 result = 255; <a name="l00211"></a>00211 *curdst = (<span class="keywordtype">unsigned</span> char) result; <a name="l00212"></a>00212 <span class="comment">/* Advance pointers */</span> <a name="l00213"></a>00213 cursrc1++; <a name="l00214"></a>00214 cursrc2++; <a name="l00215"></a>00215 curdst++; <a name="l00216"></a>00216 } <a name="l00217"></a>00217 <a name="l00218"></a>00218 <span class="keywordflow">return</span> (0); <a name="l00219"></a>00219 } <a name="l00220"></a>00220 <a name="l00232"></a>00232 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterMeanMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength, <a name="l00233"></a>00233 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Mask) <a name="l00234"></a>00234 { <a name="l00235"></a>00235 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l00236"></a>00236 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l00237"></a>00237 <span class="preprocessor"></span> __asm <a name="l00238"></a>00238 { <a name="l00239"></a>00239 pusha <a name="l00240"></a>00240 mov edx, Mask <span class="comment">/* load Mask address into edx */</span> <a name="l00241"></a>00241 movq mm0, [edx] <span class="comment">/* load Mask into mm0 */</span> <a name="l00242"></a>00242 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l00243"></a>00243 mov ebx, Src2 <span class="comment">/* load Src2 address into ebx */</span> <a name="l00244"></a>00244 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l00245"></a>00245 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l00246"></a>00246 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l00247"></a>00247 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l00248"></a>00248 L21011: <a name="l00249"></a>00249 movq mm1, [eax] <span class="comment">/* load 8 bytes from Src1 into mm1 */</span> <a name="l00250"></a>00250 movq mm2, [ebx] <span class="comment">/* load 8 bytes from Src2 into mm2 */</span> <a name="l00251"></a>00251 <span class="comment">/* --- Byte shift via Word shift --- */</span> <a name="l00252"></a>00252 psrlw mm1, 1 <span class="comment">/* shift 4 WORDS of mm1 1 bit to the right */</span> <a name="l00253"></a>00253 psrlw mm2, 1 <span class="comment">/* shift 4 WORDS of mm2 1 bit to the right */</span> <a name="l00254"></a>00254 pand mm1, mm0 <span class="comment">// apply Mask to 8 BYTES of mm1 */</span> <a name="l00255"></a>00255 <span class="comment">/* byte 0x0f, 0xdb, 0xc8 */</span> <a name="l00256"></a>00256 pand mm2, mm0 <span class="comment">// apply Mask to 8 BYTES of mm2 */</span> <a name="l00257"></a>00257 <span class="comment">/* byte 0x0f, 0xdb, 0xd0 */</span> <a name="l00258"></a>00258 paddusb mm1, mm2 <span class="comment">/* mm1=mm1+mm2 (add 8 bytes with saturation) */</span> <a name="l00259"></a>00259 movq [edi], mm1 <span class="comment">/* store result in Dest */</span> <a name="l00260"></a>00260 add eax, 8 <span class="comment">/* increase Src1, Src2 and Dest */</span> <a name="l00261"></a>00261 add ebx, 8 <span class="comment">/* register pointers by 8 */</span> <a name="l00262"></a>00262 add edi, 8 <a name="l00263"></a>00263 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l00264"></a>00264 jnz L21011 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l00265"></a>00265 emms <span class="comment">/* exit MMX state */</span> <a name="l00266"></a>00266 popa <a name="l00267"></a>00267 } <a name="l00268"></a>00268 <span class="preprocessor">#else</span> <a name="l00269"></a>00269 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l00270"></a>00270 __m64 *mSrc1 = (__m64*)Src1; <a name="l00271"></a>00271 __m64 *mSrc2 = (__m64*)Src2; <a name="l00272"></a>00272 __m64 *mDest = (__m64*)Dest; <a name="l00273"></a>00273 __m64 *mMask = (__m64*)Mask; <a name="l00274"></a>00274 <span class="keywordtype">int</span> i; <a name="l00275"></a>00275 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l00276"></a>00276 __m64 mm1 = *mSrc1, <a name="l00277"></a>00277 mm2 = *mSrc2; <a name="l00278"></a>00278 mm1 = _m_psrlwi(mm1, 1); <span class="comment">/* shift 4 WORDS of mm1 1 bit to the right */</span> <a name="l00279"></a>00279 mm2 = _m_psrlwi(mm2, 1); <span class="comment">/* shift 4 WORDS of mm2 1 bit to the right */</span> <a name="l00280"></a>00280 mm1 = _m_pand(mm1, *mMask); <span class="comment">/* apply Mask to 8 BYTES of mm1 */</span> <a name="l00281"></a>00281 mm2 = _m_pand(mm2, *mMask); <span class="comment">/* apply Mask to 8 BYTES of mm2 */</span> <a name="l00282"></a>00282 *mDest = _m_paddusb(mm1, mm2); <span class="comment">/* mm1+mm2 (add 8 bytes with saturation) */</span> <a name="l00283"></a>00283 mSrc1++; <a name="l00284"></a>00284 mSrc2++; <a name="l00285"></a>00285 mDest++; <a name="l00286"></a>00286 } <a name="l00287"></a>00287 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l00288"></a>00288 <span class="preprocessor">#endif</span> <a name="l00289"></a>00289 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l00290"></a>00290 <span class="preprocessor">#else</span> <a name="l00291"></a>00291 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l00292"></a>00292 <span class="preprocessor">#endif</span> <a name="l00293"></a>00293 <span class="preprocessor"></span>} <a name="l00294"></a>00294 <a name="l00305"></a><a class="code" href="_s_d_l__image_filter_8h.html#a69cfa83c5d198c8ae4be4ab86e8d3b8f">00305</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#ace072118fef77973210eb04fb4bfc779" title="Filter using Mean: D = S1/2 + S2/2.">SDL_imageFilterMean</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length) <a name="l00306"></a>00306 { <a name="l00307"></a>00307 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Mask[8] = { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F }; <a name="l00308"></a>00308 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l00309"></a>00309 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1, *cursrc2, *curdst; <a name="l00310"></a>00310 <span class="keywordtype">int</span> result; <a name="l00311"></a>00311 <a name="l00312"></a>00312 <span class="comment">/* Validate input parameters */</span> <a name="l00313"></a>00313 <span class="keywordflow">if</span> ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) <a name="l00314"></a>00314 <span class="keywordflow">return</span>(-1); <a name="l00315"></a>00315 <span class="keywordflow">if</span> (length == 0) <a name="l00316"></a>00316 <span class="keywordflow">return</span>(0); <a name="l00317"></a>00317 <a name="l00318"></a>00318 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l00319"></a>00319 <span class="comment">/* MMX routine */</span> <a name="l00320"></a>00320 SDL_imageFilterMeanMMX(Src1, Src2, Dest, length, Mask); <a name="l00321"></a>00321 <a name="l00322"></a>00322 <span class="comment">/* Check for unaligned bytes */</span> <a name="l00323"></a>00323 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l00324"></a>00324 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l00325"></a>00325 istart = length &amp; 0xfffffff8; <a name="l00326"></a>00326 cursrc1 = &amp;Src1[istart]; <a name="l00327"></a>00327 cursrc2 = &amp;Src2[istart]; <a name="l00328"></a>00328 curdst = &amp;Dest[istart]; <a name="l00329"></a>00329 } <span class="keywordflow">else</span> { <a name="l00330"></a>00330 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l00331"></a>00331 <span class="keywordflow">return</span> (0); <a name="l00332"></a>00332 } <a name="l00333"></a>00333 } <span class="keywordflow">else</span> { <a name="l00334"></a>00334 <span class="comment">/* Setup to process whole image */</span> <a name="l00335"></a>00335 istart = 0; <a name="l00336"></a>00336 cursrc1 = Src1; <a name="l00337"></a>00337 cursrc2 = Src2; <a name="l00338"></a>00338 curdst = Dest; <a name="l00339"></a>00339 } <a name="l00340"></a>00340 <a name="l00341"></a>00341 <span class="comment">/* C routine to process image */</span> <a name="l00342"></a>00342 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l00343"></a>00343 result = (int) *cursrc1 / 2 + (<span class="keywordtype">int</span>) *cursrc2 / 2; <a name="l00344"></a>00344 *curdst = (<span class="keywordtype">unsigned</span> char) result; <a name="l00345"></a>00345 <span class="comment">/* Advance pointers */</span> <a name="l00346"></a>00346 cursrc1++; <a name="l00347"></a>00347 cursrc2++; <a name="l00348"></a>00348 curdst++; <a name="l00349"></a>00349 } <a name="l00350"></a>00350 <a name="l00351"></a>00351 <span class="keywordflow">return</span> (0); <a name="l00352"></a>00352 } <a name="l00353"></a>00353 <a name="l00364"></a>00364 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterSubMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength) <a name="l00365"></a>00365 { <a name="l00366"></a>00366 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l00367"></a>00367 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l00368"></a>00368 <span class="preprocessor"></span> __asm <a name="l00369"></a>00369 { <a name="l00370"></a>00370 pusha <a name="l00371"></a>00371 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l00372"></a>00372 mov ebx, Src2 <span class="comment">/* load Src2 address into ebx */</span> <a name="l00373"></a>00373 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l00374"></a>00374 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l00375"></a>00375 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l00376"></a>00376 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l00377"></a>00377 L1012: <a name="l00378"></a>00378 movq mm1, [eax] <span class="comment">/* load 8 bytes from Src1 into mm1 */</span> <a name="l00379"></a>00379 psubusb mm1, [ebx] <span class="comment">/* mm1=Src1-Src2 (sub 8 bytes with saturation) */</span> <a name="l00380"></a>00380 movq [edi], mm1 <span class="comment">/* store result in Dest */</span> <a name="l00381"></a>00381 add eax, 8 <span class="comment">/* increase Src1, Src2 and Dest */</span> <a name="l00382"></a>00382 add ebx, 8 <span class="comment">/* register pointers by 8 */</span> <a name="l00383"></a>00383 add edi, 8 <a name="l00384"></a>00384 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l00385"></a>00385 jnz L1012 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l00386"></a>00386 emms <span class="comment">/* exit MMX state */</span> <a name="l00387"></a>00387 popa <a name="l00388"></a>00388 } <a name="l00389"></a>00389 <span class="preprocessor">#else</span> <a name="l00390"></a>00390 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l00391"></a>00391 __m64 *mSrc1 = (__m64*)Src1; <a name="l00392"></a>00392 __m64 *mSrc2 = (__m64*)Src2; <a name="l00393"></a>00393 __m64 *mDest = (__m64*)Dest; <a name="l00394"></a>00394 <span class="keywordtype">int</span> i; <a name="l00395"></a>00395 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l00396"></a>00396 *mDest = _m_psubusb(*mSrc1, *mSrc2); <span class="comment">/* Src1-Src2 (sub 8 bytes with saturation) */</span> <a name="l00397"></a>00397 mSrc1++; <a name="l00398"></a>00398 mSrc2++; <a name="l00399"></a>00399 mDest++; <a name="l00400"></a>00400 } <a name="l00401"></a>00401 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l00402"></a>00402 <span class="preprocessor">#endif</span> <a name="l00403"></a>00403 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l00404"></a>00404 <span class="preprocessor">#else</span> <a name="l00405"></a>00405 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l00406"></a>00406 <span class="preprocessor">#endif</span> <a name="l00407"></a>00407 <span class="preprocessor"></span>} <a name="l00408"></a>00408 <a name="l00419"></a><a class="code" href="_s_d_l__image_filter_8h.html#a0e0fb80a3dad33d61a8147c7fb9f529d">00419</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a3c01cf8576ea7a0dfc09dbaa953c9287" title="Filter using Sub: D = saturation0(S1 - S2)">SDL_imageFilterSub</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length) <a name="l00420"></a>00420 { <a name="l00421"></a>00421 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l00422"></a>00422 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1, *cursrc2, *curdst; <a name="l00423"></a>00423 <span class="keywordtype">int</span> result; <a name="l00424"></a>00424 <a name="l00425"></a>00425 <span class="comment">/* Validate input parameters */</span> <a name="l00426"></a>00426 <span class="keywordflow">if</span> ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) <a name="l00427"></a>00427 <span class="keywordflow">return</span>(-1); <a name="l00428"></a>00428 <span class="keywordflow">if</span> (length == 0) <a name="l00429"></a>00429 <span class="keywordflow">return</span>(0); <a name="l00430"></a>00430 <a name="l00431"></a>00431 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l00432"></a>00432 <span class="comment">/* MMX routine */</span> <a name="l00433"></a>00433 SDL_imageFilterSubMMX(Src1, Src2, Dest, length); <a name="l00434"></a>00434 <a name="l00435"></a>00435 <span class="comment">/* Check for unaligned bytes */</span> <a name="l00436"></a>00436 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l00437"></a>00437 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l00438"></a>00438 istart = length &amp; 0xfffffff8; <a name="l00439"></a>00439 cursrc1 = &amp;Src1[istart]; <a name="l00440"></a>00440 cursrc2 = &amp;Src2[istart]; <a name="l00441"></a>00441 curdst = &amp;Dest[istart]; <a name="l00442"></a>00442 } <span class="keywordflow">else</span> { <a name="l00443"></a>00443 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l00444"></a>00444 <span class="keywordflow">return</span> (0); <a name="l00445"></a>00445 } <a name="l00446"></a>00446 } <span class="keywordflow">else</span> { <a name="l00447"></a>00447 <span class="comment">/* Setup to process whole image */</span> <a name="l00448"></a>00448 istart = 0; <a name="l00449"></a>00449 cursrc1 = Src1; <a name="l00450"></a>00450 cursrc2 = Src2; <a name="l00451"></a>00451 curdst = Dest; <a name="l00452"></a>00452 } <a name="l00453"></a>00453 <a name="l00454"></a>00454 <span class="comment">/* C routine to process image */</span> <a name="l00455"></a>00455 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l00456"></a>00456 result = (int) *cursrc1 - (<span class="keywordtype">int</span>) *cursrc2; <a name="l00457"></a>00457 <span class="keywordflow">if</span> (result &lt; 0) <a name="l00458"></a>00458 result = 0; <a name="l00459"></a>00459 *curdst = (<span class="keywordtype">unsigned</span> char) result; <a name="l00460"></a>00460 <span class="comment">/* Advance pointers */</span> <a name="l00461"></a>00461 cursrc1++; <a name="l00462"></a>00462 cursrc2++; <a name="l00463"></a>00463 curdst++; <a name="l00464"></a>00464 } <a name="l00465"></a>00465 <a name="l00466"></a>00466 <span class="keywordflow">return</span> (0); <a name="l00467"></a>00467 } <a name="l00468"></a>00468 <a name="l00479"></a>00479 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterAbsDiffMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength) <a name="l00480"></a>00480 { <a name="l00481"></a>00481 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l00482"></a>00482 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l00483"></a>00483 <span class="preprocessor"></span> __asm <a name="l00484"></a>00484 { <a name="l00485"></a>00485 pusha <a name="l00486"></a>00486 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l00487"></a>00487 mov ebx, Src2 <span class="comment">/* load Src2 address into ebx */</span> <a name="l00488"></a>00488 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l00489"></a>00489 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l00490"></a>00490 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l00491"></a>00491 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l00492"></a>00492 L1013: <a name="l00493"></a>00493 movq mm1, [eax] <span class="comment">/* load 8 bytes from Src1 into mm1 */</span> <a name="l00494"></a>00494 movq mm2, [ebx] <span class="comment">/* load 8 bytes from Src2 into mm2 */</span> <a name="l00495"></a>00495 psubusb mm1, [ebx] <span class="comment">/* mm1=Src1-Src2 (sub 8 bytes with saturation) */</span> <a name="l00496"></a>00496 psubusb mm2, [eax] <span class="comment">/* mm2=Src2-Src1 (sub 8 bytes with saturation) */</span> <a name="l00497"></a>00497 por mm1, mm2 <span class="comment">/* combine both mm2 and mm1 results */</span> <a name="l00498"></a>00498 movq [edi], mm1 <span class="comment">/* store result in Dest */</span> <a name="l00499"></a>00499 add eax, 8 <span class="comment">/* increase Src1, Src2 and Dest */</span> <a name="l00500"></a>00500 add ebx, 8 <span class="comment">/* register pointers by 8 */</span> <a name="l00501"></a>00501 add edi, 8 <a name="l00502"></a>00502 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l00503"></a>00503 jnz L1013 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l00504"></a>00504 emms <span class="comment">/* exit MMX state */</span> <a name="l00505"></a>00505 popa <a name="l00506"></a>00506 } <a name="l00507"></a>00507 <span class="preprocessor">#else</span> <a name="l00508"></a>00508 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l00509"></a>00509 __m64 *mSrc1 = (__m64*)Src1; <a name="l00510"></a>00510 __m64 *mSrc2 = (__m64*)Src2; <a name="l00511"></a>00511 __m64 *mDest = (__m64*)Dest; <a name="l00512"></a>00512 <span class="keywordtype">int</span> i; <a name="l00513"></a>00513 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l00514"></a>00514 __m64 mm1 = _m_psubusb(*mSrc2, *mSrc1); <span class="comment">/* Src1-Src2 (sub 8 bytes with saturation) */</span> <a name="l00515"></a>00515 __m64 mm2 = _m_psubusb(*mSrc1, *mSrc2); <span class="comment">/* Src2-Src1 (sub 8 bytes with saturation) */</span> <a name="l00516"></a>00516 *mDest = _m_por(mm1, mm2); <span class="comment">/* combine both mm2 and mm1 results */</span> <a name="l00517"></a>00517 mSrc1++; <a name="l00518"></a>00518 mSrc2++; <a name="l00519"></a>00519 mDest++; <a name="l00520"></a>00520 } <a name="l00521"></a>00521 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l00522"></a>00522 <span class="preprocessor">#endif</span> <a name="l00523"></a>00523 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l00524"></a>00524 <span class="preprocessor">#else</span> <a name="l00525"></a>00525 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l00526"></a>00526 <span class="preprocessor">#endif</span> <a name="l00527"></a>00527 <span class="preprocessor"></span>} <a name="l00528"></a>00528 <a name="l00539"></a><a class="code" href="_s_d_l__image_filter_8h.html#a789ce070edcc478ad97a0d7ff90e6aa2">00539</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a472909f904274255cd6793c520172e48" title="Filter using AbsDiff: D = | S1 - S2 |.">SDL_imageFilterAbsDiff</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length) <a name="l00540"></a>00540 { <a name="l00541"></a>00541 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l00542"></a>00542 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1, *cursrc2, *curdst; <a name="l00543"></a>00543 <span class="keywordtype">int</span> result; <a name="l00544"></a>00544 <a name="l00545"></a>00545 <span class="comment">/* Validate input parameters */</span> <a name="l00546"></a>00546 <span class="keywordflow">if</span> ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) <a name="l00547"></a>00547 <span class="keywordflow">return</span>(-1); <a name="l00548"></a>00548 <span class="keywordflow">if</span> (length == 0) <a name="l00549"></a>00549 <span class="keywordflow">return</span>(0); <a name="l00550"></a>00550 <a name="l00551"></a>00551 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l00552"></a>00552 <span class="comment">/* MMX routine */</span> <a name="l00553"></a>00553 SDL_imageFilterAbsDiffMMX(Src1, Src2, Dest, length); <a name="l00554"></a>00554 <a name="l00555"></a>00555 <span class="comment">/* Check for unaligned bytes */</span> <a name="l00556"></a>00556 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l00557"></a>00557 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l00558"></a>00558 istart = length &amp; 0xfffffff8; <a name="l00559"></a>00559 cursrc1 = &amp;Src1[istart]; <a name="l00560"></a>00560 cursrc2 = &amp;Src2[istart]; <a name="l00561"></a>00561 curdst = &amp;Dest[istart]; <a name="l00562"></a>00562 } <span class="keywordflow">else</span> { <a name="l00563"></a>00563 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l00564"></a>00564 <span class="keywordflow">return</span> (0); <a name="l00565"></a>00565 } <a name="l00566"></a>00566 } <span class="keywordflow">else</span> { <a name="l00567"></a>00567 <span class="comment">/* Setup to process whole image */</span> <a name="l00568"></a>00568 istart = 0; <a name="l00569"></a>00569 cursrc1 = Src1; <a name="l00570"></a>00570 cursrc2 = Src2; <a name="l00571"></a>00571 curdst = Dest; <a name="l00572"></a>00572 } <a name="l00573"></a>00573 <a name="l00574"></a>00574 <span class="comment">/* C routine to process image */</span> <a name="l00575"></a>00575 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l00576"></a>00576 result = abs((<span class="keywordtype">int</span>) *cursrc1 - (<span class="keywordtype">int</span>) *cursrc2); <a name="l00577"></a>00577 *curdst = (<span class="keywordtype">unsigned</span> char) result; <a name="l00578"></a>00578 <span class="comment">/* Advance pointers */</span> <a name="l00579"></a>00579 cursrc1++; <a name="l00580"></a>00580 cursrc2++; <a name="l00581"></a>00581 curdst++; <a name="l00582"></a>00582 } <a name="l00583"></a>00583 <a name="l00584"></a>00584 <span class="keywordflow">return</span> (0); <a name="l00585"></a>00585 } <a name="l00586"></a>00586 <a name="l00597"></a>00597 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterMultMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength) <a name="l00598"></a>00598 { <a name="l00599"></a>00599 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l00600"></a>00600 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l00601"></a>00601 <span class="preprocessor"></span> __asm <a name="l00602"></a>00602 { <a name="l00603"></a>00603 pusha <a name="l00604"></a>00604 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l00605"></a>00605 mov ebx, Src2 <span class="comment">/* load Src2 address into ebx */</span> <a name="l00606"></a>00606 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l00607"></a>00607 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l00608"></a>00608 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l00609"></a>00609 pxor mm0, mm0 <span class="comment">/* zero mm0 register */</span> <a name="l00610"></a>00610 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l00611"></a>00611 L1014: <a name="l00612"></a>00612 movq mm1, [eax] <span class="comment">/* load 8 bytes from Src1 into mm1 */</span> <a name="l00613"></a>00613 movq mm3, [ebx] <span class="comment">/* load 8 bytes from Src2 into mm3 */</span> <a name="l00614"></a>00614 movq mm2, mm1 <span class="comment">/* copy mm1 into mm2 */</span> <a name="l00615"></a>00615 movq mm4, mm3 <span class="comment">/* copy mm3 into mm4 */</span> <a name="l00616"></a>00616 punpcklbw mm1, mm0 <span class="comment">/* unpack low bytes of Src1 into words */</span> <a name="l00617"></a>00617 punpckhbw mm2, mm0 <span class="comment">/* unpack high bytes of Src1 into words */</span> <a name="l00618"></a>00618 punpcklbw mm3, mm0 <span class="comment">/* unpack low bytes of Src2 into words */</span> <a name="l00619"></a>00619 punpckhbw mm4, mm0 <span class="comment">/* unpack high bytes of Src2 into words */</span> <a name="l00620"></a>00620 pmullw mm1, mm3 <span class="comment">/* mul low bytes of Src1 and Src2 */</span> <a name="l00621"></a>00621 pmullw mm2, mm4 <span class="comment">/* mul high bytes of Src1 and Src2 */</span> <a name="l00622"></a>00622 <span class="comment">/* Take abs value of the results (signed words) */</span> <a name="l00623"></a>00623 movq mm5, mm1 <span class="comment">/* copy mm1 into mm5 */</span> <a name="l00624"></a>00624 movq mm6, mm2 <span class="comment">/* copy mm2 into mm6 */</span> <a name="l00625"></a>00625 psraw mm5, 15 <span class="comment">/* fill mm5 words with word sign bit */</span> <a name="l00626"></a>00626 psraw mm6, 15 <span class="comment">/* fill mm6 words with word sign bit */</span> <a name="l00627"></a>00627 pxor mm1, mm5 <span class="comment">/* take 1&#39;s compliment of only neg. words */</span> <a name="l00628"></a>00628 pxor mm2, mm6 <span class="comment">/* take 1&#39;s compliment of only neg. words */</span> <a name="l00629"></a>00629 psubsw mm1, mm5 <span class="comment">/* add 1 to only neg. words, W-(-1) or W-0 */</span> <a name="l00630"></a>00630 psubsw mm2, mm6 <span class="comment">/* add 1 to only neg. words, W-(-1) or W-0 */</span> <a name="l00631"></a>00631 packuswb mm1, mm2 <span class="comment">/* pack words back into bytes with saturation */</span> <a name="l00632"></a>00632 movq [edi], mm1 <span class="comment">/* store result in Dest */</span> <a name="l00633"></a>00633 add eax, 8 <span class="comment">/* increase Src1, Src2 and Dest */</span> <a name="l00634"></a>00634 add ebx, 8 <span class="comment">/* register pointers by 8 */</span> <a name="l00635"></a>00635 add edi, 8 <a name="l00636"></a>00636 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l00637"></a>00637 jnz L1014 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l00638"></a>00638 emms <span class="comment">/* exit MMX state */</span> <a name="l00639"></a>00639 popa <a name="l00640"></a>00640 } <a name="l00641"></a>00641 <span class="preprocessor">#else</span> <a name="l00642"></a>00642 <span class="preprocessor"></span> <span class="comment">/* i386 ASM with constraints: */</span> <a name="l00643"></a>00643 <span class="comment">/* asm volatile ( */</span> <a name="l00644"></a>00644 <span class="comment">/* &quot;shr $3, %%ecx \n\t&quot; /\* counter/8 (MMX loads 8 bytes at a time) *\/ */</span> <a name="l00645"></a>00645 <span class="comment">/* &quot;pxor %%mm0, %%mm0 \n\t&quot; /\* zero mm0 register *\/ */</span> <a name="l00646"></a>00646 <span class="comment">/* &quot;.align 16 \n\t&quot; /\* 16 byte alignment of the loop entry *\/ */</span> <a name="l00647"></a>00647 <span class="comment">/* &quot;1: movq (%%eax), %%mm1 \n\t&quot; /\* load 8 bytes from Src1 into mm1 *\/ */</span> <a name="l00648"></a>00648 <span class="comment">/* &quot;movq (%%ebx), %%mm3 \n\t&quot; /\* load 8 bytes from Src2 into mm3 *\/ */</span> <a name="l00649"></a>00649 <span class="comment">/* &quot;movq %%mm1, %%mm2 \n\t&quot; /\* copy mm1 into mm2 *\/ */</span> <a name="l00650"></a>00650 <span class="comment">/* &quot;movq %%mm3, %%mm4 \n\t&quot; /\* copy mm3 into mm4 *\/ */</span> <a name="l00651"></a>00651 <span class="comment">/* &quot;punpcklbw %%mm0, %%mm1 \n\t&quot; /\* unpack low bytes of Src1 into words *\/ */</span> <a name="l00652"></a>00652 <span class="comment">/* &quot;punpckhbw %%mm0, %%mm2 \n\t&quot; /\* unpack high bytes of Src1 into words *\/ */</span> <a name="l00653"></a>00653 <span class="comment">/* &quot;punpcklbw %%mm0, %%mm3 \n\t&quot; /\* unpack low bytes of Src2 into words *\/ */</span> <a name="l00654"></a>00654 <span class="comment">/* &quot;punpckhbw %%mm0, %%mm4 \n\t&quot; /\* unpack high bytes of Src2 into words *\/ */</span> <a name="l00655"></a>00655 <span class="comment">/* &quot;pmullw %%mm3, %%mm1 \n\t&quot; /\* mul low bytes of Src1 and Src2 *\/ */</span> <a name="l00656"></a>00656 <span class="comment">/* &quot;pmullw %%mm4, %%mm2 \n\t&quot; /\* mul high bytes of Src1 and Src2 *\/ */</span> <a name="l00657"></a>00657 <span class="comment">/* /\* Take abs value of the results (signed words) *\/ */</span> <a name="l00658"></a>00658 <span class="comment">/* &quot;movq %%mm1, %%mm5 \n\t&quot; /\* copy mm1 into mm5 *\/ */</span> <a name="l00659"></a>00659 <span class="comment">/* &quot;movq %%mm2, %%mm6 \n\t&quot; /\* copy mm2 into mm6 *\/ */</span> <a name="l00660"></a>00660 <span class="comment">/* &quot;psraw $15, %%mm5 \n\t&quot; /\* fill mm5 words with word sign bit *\/ */</span> <a name="l00661"></a>00661 <span class="comment">/* &quot;psraw $15, %%mm6 \n\t&quot; /\* fill mm6 words with word sign bit *\/ */</span> <a name="l00662"></a>00662 <span class="comment">/* &quot;pxor %%mm5, %%mm1 \n\t&quot; /\* take 1&#39;s compliment of only neg. words *\/ */</span> <a name="l00663"></a>00663 <span class="comment">/* &quot;pxor %%mm6, %%mm2 \n\t&quot; /\* take 1&#39;s compliment of only neg. words *\/ */</span> <a name="l00664"></a>00664 <span class="comment">/* &quot;psubsw %%mm5, %%mm1 \n\t&quot; /\* add 1 to only neg. words, W-(-1) or W-0 *\/ */</span> <a name="l00665"></a>00665 <span class="comment">/* &quot;psubsw %%mm6, %%mm2 \n\t&quot; /\* add 1 to only neg. words, W-(-1) or W-0 *\/ */</span> <a name="l00666"></a>00666 <span class="comment">/* &quot;packuswb %%mm2, %%mm1 \n\t&quot; /\* pack words back into bytes with saturation *\/ */</span> <a name="l00667"></a>00667 <span class="comment">/* &quot;movq %%mm1, (%%edi) \n\t&quot; /\* store result in Dest *\/ */</span> <a name="l00668"></a>00668 <span class="comment">/* &quot;add $8, %%eax \n\t&quot; /\* increase Src1, Src2 and Dest *\/ */</span> <a name="l00669"></a>00669 <span class="comment">/* &quot;add $8, %%ebx \n\t&quot; /\* register pointers by 8 *\/ */</span> <a name="l00670"></a>00670 <span class="comment">/* &quot;add $8, %%edi \n\t&quot; */</span> <a name="l00671"></a>00671 <span class="comment">/* &quot;dec %%ecx \n\t&quot; /\* decrease loop counter *\/ */</span> <a name="l00672"></a>00672 <span class="comment">/* &quot;jnz 1b \n\t&quot; /\* check loop termination, proceed if required *\/ */</span> <a name="l00673"></a>00673 <span class="comment">/* &quot;emms \n\t&quot; /\* exit MMX state *\/ */</span> <a name="l00674"></a>00674 <span class="comment">/* : &quot;+a&quot; (Src1), /\* load Src1 address into rax, modified by the loop *\/ */</span> <a name="l00675"></a>00675 <span class="comment">/* &quot;+b&quot; (Src2), /\* load Src2 address into rbx, modified by the loop *\/ */</span> <a name="l00676"></a>00676 <span class="comment">/* &quot;+c&quot; (SrcLength), /\* load loop counter (SIZE) into rcx, modified by the loop *\/ */</span> <a name="l00677"></a>00677 <span class="comment">/* &quot;+D&quot; (Dest) /\* load Dest address into rdi, modified by the loop *\/ */</span> <a name="l00678"></a>00678 <span class="comment">/* : */</span> <a name="l00679"></a>00679 <span class="comment">/* : &quot;memory&quot;, /\* *Dest is modified *\/ */</span> <a name="l00680"></a>00680 <span class="comment">/* &quot;mm0&quot;,&quot;mm1&quot;,&quot;mm2&quot;,&quot;mm3&quot;,&quot;mm4&quot;,&quot;mm5&quot;,&quot;mm6&quot; /\* registers modified *\/ */</span> <a name="l00681"></a>00681 <span class="comment">/* ); */</span> <a name="l00682"></a>00682 <a name="l00683"></a>00683 <span class="comment">/* i386 and x86_64 */</span> <a name="l00684"></a>00684 __m64 *mSrc1 = (__m64*)Src1; <a name="l00685"></a>00685 __m64 *mSrc2 = (__m64*)Src2; <a name="l00686"></a>00686 __m64 *mDest = (__m64*)Dest; <a name="l00687"></a>00687 __m64 mm0 = _m_from_int(0); <span class="comment">/* zero mm0 register */</span> <a name="l00688"></a>00688 <span class="keywordtype">int</span> i; <a name="l00689"></a>00689 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l00690"></a>00690 __m64 mm1, mm2, mm3, mm4, mm5, mm6; <a name="l00691"></a>00691 mm1 = _m_punpcklbw(*mSrc1, mm0); <span class="comment">/* unpack low bytes of Src1 into words */</span> <a name="l00692"></a>00692 mm2 = _m_punpckhbw(*mSrc1, mm0); <span class="comment">/* unpack high bytes of Src1 into words */</span> <a name="l00693"></a>00693 mm3 = _m_punpcklbw(*mSrc2, mm0); <span class="comment">/* unpack low bytes of Src2 into words */</span> <a name="l00694"></a>00694 mm4 = _m_punpckhbw(*mSrc2, mm0); <span class="comment">/* unpack high bytes of Src2 into words */</span> <a name="l00695"></a>00695 mm1 = _m_pmullw(mm1, mm3); <span class="comment">/* mul low bytes of Src1 and Src2 */</span> <a name="l00696"></a>00696 mm2 = _m_pmullw(mm2, mm4); <span class="comment">/* mul high bytes of Src1 and Src2 */</span> <a name="l00697"></a>00697 mm5 = _m_psrawi(mm1, 15); <span class="comment">/* fill mm5 words with word sign bit */</span> <a name="l00698"></a>00698 mm6 = _m_psrawi(mm2, 15); <span class="comment">/* fill mm6 words with word sign bit */</span> <a name="l00699"></a>00699 mm1 = _m_pxor(mm1, mm5); <span class="comment">/* take 1&#39;s compliment of only neg. words */</span> <a name="l00700"></a>00700 mm2 = _m_pxor(mm2, mm6); <span class="comment">/* take 1&#39;s compliment of only neg. words */</span> <a name="l00701"></a>00701 mm1 = _m_psubsw(mm1, mm5); <span class="comment">/* add 1 to only neg. words, W-(-1) or W-0 */</span> <a name="l00702"></a>00702 mm2 = _m_psubsw(mm2, mm6); <span class="comment">/* add 1 to only neg. words, W-(-1) or W-0 */</span> <a name="l00703"></a>00703 *mDest = _m_packuswb(mm1, mm2); <span class="comment">/* pack words back into bytes with saturation */</span> <a name="l00704"></a>00704 mSrc1++; <a name="l00705"></a>00705 mSrc2++; <a name="l00706"></a>00706 mDest++; <a name="l00707"></a>00707 } <a name="l00708"></a>00708 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l00709"></a>00709 <span class="preprocessor">#endif</span> <a name="l00710"></a>00710 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l00711"></a>00711 <span class="preprocessor">#else</span> <a name="l00712"></a>00712 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l00713"></a>00713 <span class="preprocessor">#endif</span> <a name="l00714"></a>00714 <span class="preprocessor"></span>} <a name="l00715"></a>00715 <a name="l00726"></a><a class="code" href="_s_d_l__image_filter_8h.html#a4657c2a1e1bf55d3241dc737cd618409">00726</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#af4633031d40a9ea0956a2f3c6c87a384" title="Filter using Mult: D = saturation255(S1 * S2)">SDL_imageFilterMult</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length) <a name="l00727"></a>00727 { <a name="l00728"></a>00728 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l00729"></a>00729 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1, *cursrc2, *curdst; <a name="l00730"></a>00730 <span class="keywordtype">int</span> result; <a name="l00731"></a>00731 <a name="l00732"></a>00732 <span class="comment">/* Validate input parameters */</span> <a name="l00733"></a>00733 <span class="keywordflow">if</span> ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) <a name="l00734"></a>00734 <span class="keywordflow">return</span>(-1); <a name="l00735"></a>00735 <span class="keywordflow">if</span> (length == 0) <a name="l00736"></a>00736 <span class="keywordflow">return</span>(0); <a name="l00737"></a>00737 <a name="l00738"></a>00738 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l00739"></a>00739 <span class="comment">/* MMX routine */</span> <a name="l00740"></a>00740 SDL_imageFilterMultMMX(Src1, Src2, Dest, length); <a name="l00741"></a>00741 <a name="l00742"></a>00742 <span class="comment">/* Check for unaligned bytes */</span> <a name="l00743"></a>00743 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l00744"></a>00744 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l00745"></a>00745 istart = length &amp; 0xfffffff8; <a name="l00746"></a>00746 cursrc1 = &amp;Src1[istart]; <a name="l00747"></a>00747 cursrc2 = &amp;Src2[istart]; <a name="l00748"></a>00748 curdst = &amp;Dest[istart]; <a name="l00749"></a>00749 } <span class="keywordflow">else</span> { <a name="l00750"></a>00750 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l00751"></a>00751 <span class="keywordflow">return</span> (0); <a name="l00752"></a>00752 } <a name="l00753"></a>00753 } <span class="keywordflow">else</span> { <a name="l00754"></a>00754 <span class="comment">/* Setup to process whole image */</span> <a name="l00755"></a>00755 istart = 0; <a name="l00756"></a>00756 cursrc1 = Src1; <a name="l00757"></a>00757 cursrc2 = Src2; <a name="l00758"></a>00758 curdst = Dest; <a name="l00759"></a>00759 } <a name="l00760"></a>00760 <a name="l00761"></a>00761 <span class="comment">/* C routine to process image */</span> <a name="l00762"></a>00762 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l00763"></a>00763 <a name="l00764"></a>00764 <span class="comment">/* NOTE: this is probably wrong - dunno what the MMX code does */</span> <a name="l00765"></a>00765 <a name="l00766"></a>00766 result = (int) *cursrc1 * (<span class="keywordtype">int</span>) *cursrc2; <a name="l00767"></a>00767 <span class="keywordflow">if</span> (result &gt; 255) <a name="l00768"></a>00768 result = 255; <a name="l00769"></a>00769 *curdst = (<span class="keywordtype">unsigned</span> char) result; <a name="l00770"></a>00770 <span class="comment">/* Advance pointers */</span> <a name="l00771"></a>00771 cursrc1++; <a name="l00772"></a>00772 cursrc2++; <a name="l00773"></a>00773 curdst++; <a name="l00774"></a>00774 } <a name="l00775"></a>00775 <a name="l00776"></a>00776 <span class="keywordflow">return</span> (0); <a name="l00777"></a>00777 } <a name="l00778"></a>00778 <a name="l00789"></a><a class="code" href="_s_d_l__image_filter_8c.html#a346db972dff9c56e3c45c904eaa3c39a">00789</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a346db972dff9c56e3c45c904eaa3c39a" title="Internal ASM Filter using MultNor: D = S1 * S2.">SDL_imageFilterMultNorASM</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength) <a name="l00790"></a>00790 { <a name="l00791"></a>00791 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l00792"></a>00792 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l00793"></a>00793 <span class="preprocessor"></span> __asm <a name="l00794"></a>00794 { <a name="l00795"></a>00795 pusha <a name="l00796"></a>00796 mov edx, Src1 <span class="comment">/* load Src1 address into edx */</span> <a name="l00797"></a>00797 mov esi, Src2 <span class="comment">/* load Src2 address into esi */</span> <a name="l00798"></a>00798 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l00799"></a>00799 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l00800"></a>00800 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l00801"></a>00801 L10141: <a name="l00802"></a>00802 mov al, [edx] <span class="comment">/* load a byte from Src1 */</span> <a name="l00803"></a>00803 mul [esi] <span class="comment">/* mul with a byte from Src2 */</span> <a name="l00804"></a>00804 mov [edi], al <span class="comment">/* move a byte result to Dest */</span> <a name="l00805"></a>00805 inc edx <span class="comment">/* increment Src1, Src2, Dest */</span> <a name="l00806"></a>00806 inc esi <span class="comment">/* pointer registers by one */</span> <a name="l00807"></a>00807 inc edi <a name="l00808"></a>00808 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l00809"></a>00809 jnz L10141 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l00810"></a>00810 popa <a name="l00811"></a>00811 } <a name="l00812"></a>00812 <span class="preprocessor">#else</span> <a name="l00813"></a>00813 <span class="preprocessor"></span> <span class="comment">/* Note: ~5% gain on i386, less efficient than C on x86_64 */</span> <a name="l00814"></a>00814 <span class="comment">/* Also depends on whether this function is static (?!) */</span> <a name="l00815"></a>00815 <span class="keyword">asm</span> <span class="keyword">volatile</span> ( <a name="l00816"></a>00816 <span class="stringliteral">&quot;.align 16 \n\t&quot;</span> <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l00817"></a>00817 <span class="preprocessor"># if defined(i386)</span> <a name="l00818"></a>00818 <span class="preprocessor"></span> <span class="stringliteral">&quot;1:mov (%%edx), %%al \n\t&quot;</span> <span class="comment">/* load a byte from Src1 */</span> <a name="l00819"></a>00819 <span class="stringliteral">&quot;mulb (%%esi) \n\t&quot;</span> <span class="comment">/* mul with a byte from Src2 */</span> <a name="l00820"></a>00820 <span class="stringliteral">&quot;mov %%al, (%%edi) \n\t&quot;</span> <span class="comment">/* move a byte result to Dest */</span> <a name="l00821"></a>00821 <span class="stringliteral">&quot;inc %%edx \n\t&quot;</span> <span class="comment">/* increment Src1, Src2, Dest */</span> <a name="l00822"></a>00822 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* pointer registers by one */</span> <a name="l00823"></a>00823 <span class="stringliteral">&quot;inc %%edi \n\t&quot;</span> <a name="l00824"></a>00824 <span class="stringliteral">&quot;dec %%ecx \n\t&quot;</span> <span class="comment">/* decrease loop counter */</span> <a name="l00825"></a>00825 <span class="preprocessor"># elif defined(__x86_64__)</span> <a name="l00826"></a>00826 <span class="preprocessor"></span> <span class="stringliteral">&quot;1:mov (%%rdx), %%al \n\t&quot;</span> <span class="comment">/* load a byte from Src1 */</span> <a name="l00827"></a>00827 <span class="stringliteral">&quot;mulb (%%rsi) \n\t&quot;</span> <span class="comment">/* mul with a byte from Src2 */</span> <a name="l00828"></a>00828 <span class="stringliteral">&quot;mov %%al, (%%rdi) \n\t&quot;</span> <span class="comment">/* move a byte result to Dest */</span> <a name="l00829"></a>00829 <span class="stringliteral">&quot;inc %%rdx \n\t&quot;</span> <span class="comment">/* increment Src1, Src2, Dest */</span> <a name="l00830"></a>00830 <span class="stringliteral">&quot;inc %%rsi \n\t&quot;</span> <span class="comment">/* pointer registers by one */</span> <a name="l00831"></a>00831 <span class="stringliteral">&quot;inc %%rdi \n\t&quot;</span> <a name="l00832"></a>00832 <span class="stringliteral">&quot;dec %%rcx \n\t&quot;</span> <span class="comment">/* decrease loop counter */</span> <a name="l00833"></a>00833 <span class="preprocessor"># endif</span> <a name="l00834"></a>00834 <span class="preprocessor"></span> <span class="stringliteral">&quot;jnz 1b \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l00835"></a>00835 : <span class="stringliteral">&quot;+d&quot;</span> (Src1), <span class="comment">/* load Src1 address into edx */</span> <a name="l00836"></a>00836 <span class="stringliteral">&quot;+S&quot;</span> (Src2), <span class="comment">/* load Src2 address into esi */</span> <a name="l00837"></a>00837 <span class="stringliteral">&quot;+c&quot;</span> (SrcLength), <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l00838"></a>00838 <span class="stringliteral">&quot;+D&quot;</span> (Dest) <span class="comment">/* load Dest address into edi */</span> <a name="l00839"></a>00839 : <a name="l00840"></a>00840 : <span class="stringliteral">&quot;memory&quot;</span>, <span class="stringliteral">&quot;rax&quot;</span> <a name="l00841"></a>00841 ); <a name="l00842"></a>00842 <span class="preprocessor">#endif</span> <a name="l00843"></a>00843 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l00844"></a>00844 <span class="preprocessor">#else</span> <a name="l00845"></a>00845 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l00846"></a>00846 <span class="preprocessor">#endif</span> <a name="l00847"></a>00847 <span class="preprocessor"></span>} <a name="l00848"></a>00848 <a name="l00859"></a><a class="code" href="_s_d_l__image_filter_8h.html#ac4f3446d0da18746b48606fe37c26385">00859</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a5f3c9fd40426bb46eba5ac167505dcc5" title="Filter using MultNor: D = S1 * S2.">SDL_imageFilterMultNor</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length) <a name="l00860"></a>00860 { <a name="l00861"></a>00861 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l00862"></a>00862 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1, *cursrc2, *curdst; <a name="l00863"></a>00863 <a name="l00864"></a>00864 <span class="comment">/* Validate input parameters */</span> <a name="l00865"></a>00865 <span class="keywordflow">if</span> ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) <a name="l00866"></a>00866 <span class="keywordflow">return</span>(-1); <a name="l00867"></a>00867 <span class="keywordflow">if</span> (length == 0) <a name="l00868"></a>00868 <span class="keywordflow">return</span>(0); <a name="l00869"></a>00869 <a name="l00870"></a>00870 <span class="keywordflow">if</span> (<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) { <a name="l00871"></a>00871 <span class="keywordflow">if</span> (length &gt; 0) { <a name="l00872"></a>00872 <span class="comment">/* ASM routine */</span> <a name="l00873"></a>00873 <a class="code" href="_s_d_l__image_filter_8c.html#a346db972dff9c56e3c45c904eaa3c39a" title="Internal ASM Filter using MultNor: D = S1 * S2.">SDL_imageFilterMultNorASM</a>(Src1, Src2, Dest, length); <a name="l00874"></a>00874 <a name="l00875"></a>00875 <span class="comment">/* Check for unaligned bytes */</span> <a name="l00876"></a>00876 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l00877"></a>00877 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l00878"></a>00878 istart = length &amp; 0xfffffff8; <a name="l00879"></a>00879 cursrc1 = &amp;Src1[istart]; <a name="l00880"></a>00880 cursrc2 = &amp;Src2[istart]; <a name="l00881"></a>00881 curdst = &amp;Dest[istart]; <a name="l00882"></a>00882 } <span class="keywordflow">else</span> { <a name="l00883"></a>00883 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l00884"></a>00884 <span class="keywordflow">return</span> (0); <a name="l00885"></a>00885 } <a name="l00886"></a>00886 } <span class="keywordflow">else</span> { <a name="l00887"></a>00887 <span class="comment">/* No bytes - we are done */</span> <a name="l00888"></a>00888 <span class="keywordflow">return</span> (0); <a name="l00889"></a>00889 } <a name="l00890"></a>00890 } <span class="keywordflow">else</span> { <a name="l00891"></a>00891 <span class="comment">/* Setup to process whole image */</span> <a name="l00892"></a>00892 istart = 0; <a name="l00893"></a>00893 cursrc1 = Src1; <a name="l00894"></a>00894 cursrc2 = Src2; <a name="l00895"></a>00895 curdst = Dest; <a name="l00896"></a>00896 } <a name="l00897"></a>00897 <a name="l00898"></a>00898 <span class="comment">/* C routine to process image */</span> <a name="l00899"></a>00899 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l00900"></a>00900 *curdst = (int)*cursrc1 * (<span class="keywordtype">int</span>)*cursrc2; <span class="comment">// (int) for efficiency</span> <a name="l00901"></a>00901 <span class="comment">/* Advance pointers */</span> <a name="l00902"></a>00902 cursrc1++; <a name="l00903"></a>00903 cursrc2++; <a name="l00904"></a>00904 curdst++; <a name="l00905"></a>00905 } <a name="l00906"></a>00906 <a name="l00907"></a>00907 <span class="keywordflow">return</span> (0); <a name="l00908"></a>00908 } <a name="l00909"></a>00909 <a name="l00920"></a>00920 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterMultDivby2MMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength) <a name="l00921"></a>00921 { <a name="l00922"></a>00922 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l00923"></a>00923 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l00924"></a>00924 <span class="preprocessor"></span> __asm <a name="l00925"></a>00925 { <a name="l00926"></a>00926 pusha <a name="l00927"></a>00927 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l00928"></a>00928 mov ebx, Src2 <span class="comment">/* load Src2 address into ebx */</span> <a name="l00929"></a>00929 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l00930"></a>00930 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l00931"></a>00931 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l00932"></a>00932 pxor mm0, mm0 <span class="comment">/* zero mm0 register */</span> <a name="l00933"></a>00933 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l00934"></a>00934 L1015: <a name="l00935"></a>00935 movq mm1, [eax] <span class="comment">/* load 8 bytes from Src1 into mm1 */</span> <a name="l00936"></a>00936 movq mm3, [ebx] <span class="comment">/* load 8 bytes from Src2 into mm3 */</span> <a name="l00937"></a>00937 movq mm2, mm1 <span class="comment">/* copy mm1 into mm2 */</span> <a name="l00938"></a>00938 movq mm4, mm3 <span class="comment">/* copy mm3 into mm4 */</span> <a name="l00939"></a>00939 punpcklbw mm1, mm0 <span class="comment">/* unpack low bytes of Src1 into words */</span> <a name="l00940"></a>00940 punpckhbw mm2, mm0 <span class="comment">/* unpack high bytes of Src1 into words */</span> <a name="l00941"></a>00941 punpcklbw mm3, mm0 <span class="comment">/* unpack low bytes of Src2 into words */</span> <a name="l00942"></a>00942 punpckhbw mm4, mm0 <span class="comment">/* unpack high bytes of Src2 into words */</span> <a name="l00943"></a>00943 psrlw mm1, 1 <span class="comment">/* divide mm1 words by 2, Src1 low bytes */</span> <a name="l00944"></a>00944 psrlw mm2, 1 <span class="comment">/* divide mm2 words by 2, Src1 high bytes */</span> <a name="l00945"></a>00945 pmullw mm1, mm3 <span class="comment">/* mul low bytes of Src1 and Src2 */</span> <a name="l00946"></a>00946 pmullw mm2, mm4 <span class="comment">/* mul high bytes of Src1 and Src2 */</span> <a name="l00947"></a>00947 packuswb mm1, mm2 <span class="comment">/* pack words back into bytes with saturation */</span> <a name="l00948"></a>00948 movq [edi], mm1 <span class="comment">/* store result in Dest */</span> <a name="l00949"></a>00949 add eax, 8 <span class="comment">/* increase Src1, Src2 and Dest */</span> <a name="l00950"></a>00950 add ebx, 8 <span class="comment">/* register pointers by 8 */</span> <a name="l00951"></a>00951 add edi, 8 <a name="l00952"></a>00952 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l00953"></a>00953 jnz L1015 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l00954"></a>00954 emms <span class="comment">/* exit MMX state */</span> <a name="l00955"></a>00955 popa <a name="l00956"></a>00956 } <a name="l00957"></a>00957 <span class="preprocessor">#else</span> <a name="l00958"></a>00958 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l00959"></a>00959 __m64 *mSrc1 = (__m64*)Src1; <a name="l00960"></a>00960 __m64 *mSrc2 = (__m64*)Src2; <a name="l00961"></a>00961 __m64 *mDest = (__m64*)Dest; <a name="l00962"></a>00962 __m64 mm0 = _m_from_int(0); <span class="comment">/* zero mm0 register */</span> <a name="l00963"></a>00963 <span class="keywordtype">int</span> i; <a name="l00964"></a>00964 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l00965"></a>00965 __m64 mm1, mm2, mm3, mm4, mm5, mm6; <a name="l00966"></a>00966 mm1 = _m_punpcklbw(*mSrc1, mm0); <span class="comment">/* unpack low bytes of Src1 into words */</span> <a name="l00967"></a>00967 mm2 = _m_punpckhbw(*mSrc1, mm0); <span class="comment">/* unpack high bytes of Src1 into words */</span> <a name="l00968"></a>00968 mm3 = _m_punpcklbw(*mSrc2, mm0); <span class="comment">/* unpack low bytes of Src2 into words */</span> <a name="l00969"></a>00969 mm4 = _m_punpckhbw(*mSrc2, mm0); <span class="comment">/* unpack high bytes of Src2 into words */</span> <a name="l00970"></a>00970 mm1 = _m_psrlwi(mm1, 1); <span class="comment">/* divide mm1 words by 2, Src1 low bytes */</span> <a name="l00971"></a>00971 mm2 = _m_psrlwi(mm2, 1); <span class="comment">/* divide mm2 words by 2, Src1 high bytes */</span> <a name="l00972"></a>00972 mm1 = _m_pmullw(mm1, mm3); <span class="comment">/* mul low bytes of Src1 and Src2 */</span> <a name="l00973"></a>00973 mm2 = _m_pmullw(mm2, mm4); <span class="comment">/* mul high bytes of Src1 and Src2 */</span> <a name="l00974"></a>00974 *mDest = _m_packuswb(mm1, mm2); <span class="comment">/* pack words back into bytes with saturation */</span> <a name="l00975"></a>00975 mSrc1++; <a name="l00976"></a>00976 mSrc2++; <a name="l00977"></a>00977 mDest++; <a name="l00978"></a>00978 } <a name="l00979"></a>00979 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l00980"></a>00980 <span class="preprocessor">#endif</span> <a name="l00981"></a>00981 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l00982"></a>00982 <span class="preprocessor">#else</span> <a name="l00983"></a>00983 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l00984"></a>00984 <span class="preprocessor">#endif</span> <a name="l00985"></a>00985 <span class="preprocessor"></span>} <a name="l00986"></a>00986 <a name="l00997"></a><a class="code" href="_s_d_l__image_filter_8h.html#aa19248767b1fd9ffdea4ba69b9f00175">00997</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a80737f6427c7bdb30d39a92f6524fc14" title="Filter using MultDivby2: D = saturation255(S1/2 * S2)">SDL_imageFilterMultDivby2</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length) <a name="l00998"></a>00998 { <a name="l00999"></a>00999 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l01000"></a>01000 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1, *cursrc2, *curdst; <a name="l01001"></a>01001 <span class="keywordtype">int</span> result; <a name="l01002"></a>01002 <a name="l01003"></a>01003 <span class="comment">/* Validate input parameters */</span> <a name="l01004"></a>01004 <span class="keywordflow">if</span> ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) <a name="l01005"></a>01005 <span class="keywordflow">return</span>(-1); <a name="l01006"></a>01006 <span class="keywordflow">if</span> (length == 0) <a name="l01007"></a>01007 <span class="keywordflow">return</span>(0); <a name="l01008"></a>01008 <a name="l01009"></a>01009 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l01010"></a>01010 <span class="comment">/* MMX routine */</span> <a name="l01011"></a>01011 SDL_imageFilterMultDivby2MMX(Src1, Src2, Dest, length); <a name="l01012"></a>01012 <a name="l01013"></a>01013 <span class="comment">/* Check for unaligned bytes */</span> <a name="l01014"></a>01014 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l01015"></a>01015 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l01016"></a>01016 istart = length &amp; 0xfffffff8; <a name="l01017"></a>01017 cursrc1 = &amp;Src1[istart]; <a name="l01018"></a>01018 cursrc2 = &amp;Src2[istart]; <a name="l01019"></a>01019 curdst = &amp;Dest[istart]; <a name="l01020"></a>01020 } <span class="keywordflow">else</span> { <a name="l01021"></a>01021 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l01022"></a>01022 <span class="keywordflow">return</span> (0); <a name="l01023"></a>01023 } <a name="l01024"></a>01024 } <span class="keywordflow">else</span> { <a name="l01025"></a>01025 <span class="comment">/* Setup to process whole image */</span> <a name="l01026"></a>01026 istart = 0; <a name="l01027"></a>01027 cursrc1 = Src1; <a name="l01028"></a>01028 cursrc2 = Src2; <a name="l01029"></a>01029 curdst = Dest; <a name="l01030"></a>01030 } <a name="l01031"></a>01031 <a name="l01032"></a>01032 <span class="comment">/* C routine to process image */</span> <a name="l01033"></a>01033 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l01034"></a>01034 result = ((int) *cursrc1 / 2) * (int) *cursrc2; <a name="l01035"></a>01035 <span class="keywordflow">if</span> (result &gt; 255) <a name="l01036"></a>01036 result = 255; <a name="l01037"></a>01037 *curdst = (<span class="keywordtype">unsigned</span> char) result; <a name="l01038"></a>01038 <span class="comment">/* Advance pointers */</span> <a name="l01039"></a>01039 cursrc1++; <a name="l01040"></a>01040 cursrc2++; <a name="l01041"></a>01041 curdst++; <a name="l01042"></a>01042 } <a name="l01043"></a>01043 <a name="l01044"></a>01044 <span class="keywordflow">return</span> (0); <a name="l01045"></a>01045 } <a name="l01046"></a>01046 <a name="l01057"></a>01057 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterMultDivby4MMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength) <a name="l01058"></a>01058 { <a name="l01059"></a>01059 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l01060"></a>01060 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l01061"></a>01061 <span class="preprocessor"></span> __asm <a name="l01062"></a>01062 { <a name="l01063"></a>01063 pusha <a name="l01064"></a>01064 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l01065"></a>01065 mov ebx, Src2 <span class="comment">/* load Src2 address into ebx */</span> <a name="l01066"></a>01066 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l01067"></a>01067 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l01068"></a>01068 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l01069"></a>01069 pxor mm0, mm0 <span class="comment">/* zero mm0 register */</span> <a name="l01070"></a>01070 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l01071"></a>01071 L1016: <a name="l01072"></a>01072 movq mm1, [eax] <span class="comment">/* load 8 bytes from Src1 into mm1 */</span> <a name="l01073"></a>01073 movq mm3, [ebx] <span class="comment">/* load 8 bytes from Src2 into mm3 */</span> <a name="l01074"></a>01074 movq mm2, mm1 <span class="comment">/* copy mm1 into mm2 */</span> <a name="l01075"></a>01075 movq mm4, mm3 <span class="comment">/* copy mm3 into mm4 */</span> <a name="l01076"></a>01076 punpcklbw mm1, mm0 <span class="comment">/* unpack low bytes of Src1 into words */</span> <a name="l01077"></a>01077 punpckhbw mm2, mm0 <span class="comment">/* unpack high bytes of Src1 into words */</span> <a name="l01078"></a>01078 punpcklbw mm3, mm0 <span class="comment">/* unpack low bytes of Src2 into words */</span> <a name="l01079"></a>01079 punpckhbw mm4, mm0 <span class="comment">/* unpack high bytes of Src2 into words */</span> <a name="l01080"></a>01080 psrlw mm1, 1 <span class="comment">/* divide mm1 words by 2, Src1 low bytes */</span> <a name="l01081"></a>01081 psrlw mm2, 1 <span class="comment">/* divide mm2 words by 2, Src1 high bytes */</span> <a name="l01082"></a>01082 psrlw mm3, 1 <span class="comment">/* divide mm3 words by 2, Src2 low bytes */</span> <a name="l01083"></a>01083 psrlw mm4, 1 <span class="comment">/* divide mm4 words by 2, Src2 high bytes */</span> <a name="l01084"></a>01084 pmullw mm1, mm3 <span class="comment">/* mul low bytes of Src1 and Src2 */</span> <a name="l01085"></a>01085 pmullw mm2, mm4 <span class="comment">/* mul high bytes of Src1 and Src2 */</span> <a name="l01086"></a>01086 packuswb mm1, mm2 <span class="comment">/* pack words back into bytes with saturation */</span> <a name="l01087"></a>01087 movq [edi], mm1 <span class="comment">/* store result in Dest */</span> <a name="l01088"></a>01088 add eax, 8 <span class="comment">/* increase Src1, Src2 and Dest */</span> <a name="l01089"></a>01089 add ebx, 8 <span class="comment">/* register pointers by 8 */</span> <a name="l01090"></a>01090 add edi, 8 <a name="l01091"></a>01091 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l01092"></a>01092 jnz L1016 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l01093"></a>01093 emms <span class="comment">/* exit MMX state */</span> <a name="l01094"></a>01094 popa <a name="l01095"></a>01095 } <a name="l01096"></a>01096 <span class="preprocessor">#else</span> <a name="l01097"></a>01097 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l01098"></a>01098 __m64 *mSrc1 = (__m64*)Src1; <a name="l01099"></a>01099 __m64 *mSrc2 = (__m64*)Src2; <a name="l01100"></a>01100 __m64 *mDest = (__m64*)Dest; <a name="l01101"></a>01101 __m64 mm0 = _m_from_int(0); <span class="comment">/* zero mm0 register */</span> <a name="l01102"></a>01102 <span class="keywordtype">int</span> i; <a name="l01103"></a>01103 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l01104"></a>01104 __m64 mm1, mm2, mm3, mm4, mm5, mm6; <a name="l01105"></a>01105 mm1 = _m_punpcklbw(*mSrc1, mm0); <span class="comment">/* unpack low bytes of Src1 into words */</span> <a name="l01106"></a>01106 mm2 = _m_punpckhbw(*mSrc1, mm0); <span class="comment">/* unpack high bytes of Src1 into words */</span> <a name="l01107"></a>01107 mm3 = _m_punpcklbw(*mSrc2, mm0); <span class="comment">/* unpack low bytes of Src2 into words */</span> <a name="l01108"></a>01108 mm4 = _m_punpckhbw(*mSrc2, mm0); <span class="comment">/* unpack high bytes of Src2 into words */</span> <a name="l01109"></a>01109 mm1 = _m_psrlwi(mm1, 1); <span class="comment">/* divide mm1 words by 2, Src1 low bytes */</span> <a name="l01110"></a>01110 mm2 = _m_psrlwi(mm2, 1); <span class="comment">/* divide mm2 words by 2, Src1 high bytes */</span> <a name="l01111"></a>01111 mm3 = _m_psrlwi(mm3, 1); <span class="comment">/* divide mm3 words by 2, Src2 low bytes */</span> <a name="l01112"></a>01112 mm4 = _m_psrlwi(mm4, 1); <span class="comment">/* divide mm4 words by 2, Src2 high bytes */</span> <a name="l01113"></a>01113 mm1 = _m_pmullw(mm1, mm3); <span class="comment">/* mul low bytes of Src1 and Src2 */</span> <a name="l01114"></a>01114 mm2 = _m_pmullw(mm2, mm4); <span class="comment">/* mul high bytes of Src1 and Src2 */</span> <a name="l01115"></a>01115 *mDest = _m_packuswb(mm1, mm2); <span class="comment">/* pack words back into bytes with saturation */</span> <a name="l01116"></a>01116 mSrc1++; <a name="l01117"></a>01117 mSrc2++; <a name="l01118"></a>01118 mDest++; <a name="l01119"></a>01119 } <a name="l01120"></a>01120 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l01121"></a>01121 <span class="preprocessor">#endif</span> <a name="l01122"></a>01122 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l01123"></a>01123 <span class="preprocessor">#else</span> <a name="l01124"></a>01124 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l01125"></a>01125 <span class="preprocessor">#endif</span> <a name="l01126"></a>01126 <span class="preprocessor"></span>} <a name="l01127"></a>01127 <a name="l01138"></a><a class="code" href="_s_d_l__image_filter_8h.html#aa92bea3946c8081c9656304a7d944fae">01138</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a30e685653eb1050c7d48feaeb8f801a1" title="Filter using MultDivby4: D = saturation255(S1/2 * S2/2)">SDL_imageFilterMultDivby4</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length) <a name="l01139"></a>01139 { <a name="l01140"></a>01140 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l01141"></a>01141 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1, *cursrc2, *curdst; <a name="l01142"></a>01142 <span class="keywordtype">int</span> result; <a name="l01143"></a>01143 <a name="l01144"></a>01144 <span class="comment">/* Validate input parameters */</span> <a name="l01145"></a>01145 <span class="keywordflow">if</span> ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) <a name="l01146"></a>01146 <span class="keywordflow">return</span>(-1); <a name="l01147"></a>01147 <span class="keywordflow">if</span> (length == 0) <a name="l01148"></a>01148 <span class="keywordflow">return</span>(0); <a name="l01149"></a>01149 <a name="l01150"></a>01150 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l01151"></a>01151 <span class="comment">/* MMX routine */</span> <a name="l01152"></a>01152 SDL_imageFilterMultDivby4MMX(Src1, Src2, Dest, length); <a name="l01153"></a>01153 <a name="l01154"></a>01154 <span class="comment">/* Check for unaligned bytes */</span> <a name="l01155"></a>01155 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l01156"></a>01156 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l01157"></a>01157 istart = length &amp; 0xfffffff8; <a name="l01158"></a>01158 cursrc1 = &amp;Src1[istart]; <a name="l01159"></a>01159 cursrc2 = &amp;Src2[istart]; <a name="l01160"></a>01160 curdst = &amp;Dest[istart]; <a name="l01161"></a>01161 } <span class="keywordflow">else</span> { <a name="l01162"></a>01162 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l01163"></a>01163 <span class="keywordflow">return</span> (0); <a name="l01164"></a>01164 } <a name="l01165"></a>01165 } <span class="keywordflow">else</span> { <a name="l01166"></a>01166 <span class="comment">/* Setup to process whole image */</span> <a name="l01167"></a>01167 istart = 0; <a name="l01168"></a>01168 cursrc1 = Src1; <a name="l01169"></a>01169 cursrc2 = Src2; <a name="l01170"></a>01170 curdst = Dest; <a name="l01171"></a>01171 } <a name="l01172"></a>01172 <a name="l01173"></a>01173 <span class="comment">/* C routine to process image */</span> <a name="l01174"></a>01174 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l01175"></a>01175 result = ((int) *cursrc1 / 2) * ((int) *cursrc2 / 2); <a name="l01176"></a>01176 <span class="keywordflow">if</span> (result &gt; 255) <a name="l01177"></a>01177 result = 255; <a name="l01178"></a>01178 *curdst = (<span class="keywordtype">unsigned</span> char) result; <a name="l01179"></a>01179 <span class="comment">/* Advance pointers */</span> <a name="l01180"></a>01180 cursrc1++; <a name="l01181"></a>01181 cursrc2++; <a name="l01182"></a>01182 curdst++; <a name="l01183"></a>01183 } <a name="l01184"></a>01184 <a name="l01185"></a>01185 <span class="keywordflow">return</span> (0); <a name="l01186"></a>01186 } <a name="l01187"></a>01187 <a name="l01198"></a>01198 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterBitAndMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength) <a name="l01199"></a>01199 { <a name="l01200"></a>01200 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l01201"></a>01201 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l01202"></a>01202 <span class="preprocessor"></span> __asm <a name="l01203"></a>01203 { <a name="l01204"></a>01204 pusha <a name="l01205"></a>01205 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l01206"></a>01206 mov ebx, Src2 <span class="comment">/* load Src2 address into ebx */</span> <a name="l01207"></a>01207 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l01208"></a>01208 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l01209"></a>01209 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l01210"></a>01210 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l01211"></a>01211 L1017: <a name="l01212"></a>01212 movq mm1, [eax] <span class="comment">/* load 8 bytes from Src1 into mm1 */</span> <a name="l01213"></a>01213 pand mm1, [ebx] <span class="comment">/* mm1=Src1&amp;Src2 */</span> <a name="l01214"></a>01214 movq [edi], mm1 <span class="comment">/* store result in Dest */</span> <a name="l01215"></a>01215 add eax, 8 <span class="comment">/* increase Src1, Src2 and Dest */</span> <a name="l01216"></a>01216 add ebx, 8 <span class="comment">/* register pointers by 8 */</span> <a name="l01217"></a>01217 add edi, 8 <a name="l01218"></a>01218 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l01219"></a>01219 jnz L1017 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l01220"></a>01220 emms <span class="comment">/* exit MMX state */</span> <a name="l01221"></a>01221 popa <a name="l01222"></a>01222 } <a name="l01223"></a>01223 <span class="preprocessor">#else</span> <a name="l01224"></a>01224 <span class="preprocessor"></span> <span class="comment">/* x86_64 ASM with constraints: */</span> <a name="l01225"></a>01225 <span class="comment">/* asm volatile ( */</span> <a name="l01226"></a>01226 <span class="comment">/* &quot;shr $3, %%rcx \n\t&quot; /\* counter/8 (MMX loads 8 bytes at a time) *\/ */</span> <a name="l01227"></a>01227 <span class="comment">/* &quot;.align 16 \n\t&quot; /\* 16 byte alignment of the loop entry *\/ */</span> <a name="l01228"></a>01228 <span class="comment">/* &quot;1: movq (%%rax), %%mm1 \n\t&quot; /\* load 8 bytes from Src1 into mm1 *\/ */</span> <a name="l01229"></a>01229 <span class="comment">/* &quot;pand (%%rbx), %%mm1 \n\t&quot; /\* mm1=Src1&amp;Src2 *\/ */</span> <a name="l01230"></a>01230 <span class="comment">/* &quot;movq %%mm1, (%%rdi) \n\t&quot; /\* store result in Dest *\/ */</span> <a name="l01231"></a>01231 <span class="comment">/* &quot;add $8, %%rax \n\t&quot; /\* increase Src1, Src2 and Dest *\/ */</span> <a name="l01232"></a>01232 <span class="comment">/* &quot;add $8, %%rbx \n\t&quot; /\* register pointers by 8 *\/ */</span> <a name="l01233"></a>01233 <span class="comment">/* &quot;add $8, %%rdi \n\t&quot; */</span> <a name="l01234"></a>01234 <span class="comment">/* &quot;dec %%rcx \n\t&quot; /\* decrease loop counter *\/ */</span> <a name="l01235"></a>01235 <span class="comment">/* &quot;jnz 1b \n\t&quot; /\* check loop termination, proceed if required *\/ */</span> <a name="l01236"></a>01236 <span class="comment">/* &quot;emms \n\t&quot; /\* exit MMX state *\/ */</span> <a name="l01237"></a>01237 <span class="comment">/* : &quot;+a&quot; (Src1), /\* load Src1 address into rax, modified by the loop *\/ */</span> <a name="l01238"></a>01238 <span class="comment">/* &quot;+b&quot; (Src2), /\* load Src2 address into rbx, modified by the loop *\/ */</span> <a name="l01239"></a>01239 <span class="comment">/* &quot;+c&quot; (SrcLength), /\* load loop counter (SIZE) into rcx, modified by the loop *\/ */</span> <a name="l01240"></a>01240 <span class="comment">/* &quot;+D&quot; (Dest) /\* load Dest address into rdi, modified by the loop *\/ */</span> <a name="l01241"></a>01241 <span class="comment">/* : */</span> <a name="l01242"></a>01242 <span class="comment">/* : &quot;memory&quot;, /\* *Dest is modified *\/ */</span> <a name="l01243"></a>01243 <span class="comment">/* &quot;mm1&quot; /\* register mm1 modified *\/ */</span> <a name="l01244"></a>01244 <span class="comment">/* ); */</span> <a name="l01245"></a>01245 <a name="l01246"></a>01246 <span class="comment">/* i386 and x86_64 */</span> <a name="l01247"></a>01247 __m64 *mSrc1 = (__m64*)Src1; <a name="l01248"></a>01248 __m64 *mSrc2 = (__m64*)Src2; <a name="l01249"></a>01249 __m64 *mDest = (__m64*)Dest; <a name="l01250"></a>01250 <span class="keywordtype">int</span> i; <a name="l01251"></a>01251 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l01252"></a>01252 *mDest = _m_pand(*mSrc1, *mSrc2); <span class="comment">/* Src1&amp;Src2 */</span> <a name="l01253"></a>01253 mSrc1++; <a name="l01254"></a>01254 mSrc2++; <a name="l01255"></a>01255 mDest++; <a name="l01256"></a>01256 } <a name="l01257"></a>01257 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l01258"></a>01258 <span class="preprocessor">#endif</span> <a name="l01259"></a>01259 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l01260"></a>01260 <span class="preprocessor">#else</span> <a name="l01261"></a>01261 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l01262"></a>01262 <span class="preprocessor">#endif</span> <a name="l01263"></a>01263 <span class="preprocessor"></span>} <a name="l01264"></a>01264 <a name="l01275"></a><a class="code" href="_s_d_l__image_filter_8h.html#a5f67460c0b89dadd49d04832608a345b">01275</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a85837ce1b5de1f907b6b9053922b5cbc" title="Filter using BitAnd: D = S1 &amp; S2.">SDL_imageFilterBitAnd</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length) <a name="l01276"></a>01276 { <a name="l01277"></a>01277 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l01278"></a>01278 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1, *cursrc2, *curdst; <a name="l01279"></a>01279 <a name="l01280"></a>01280 <span class="comment">/* Validate input parameters */</span> <a name="l01281"></a>01281 <span class="keywordflow">if</span> ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) <a name="l01282"></a>01282 <span class="keywordflow">return</span>(-1); <a name="l01283"></a>01283 <span class="keywordflow">if</span> (length == 0) <a name="l01284"></a>01284 <span class="keywordflow">return</span>(0); <a name="l01285"></a>01285 <a name="l01286"></a>01286 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()&gt;0) &amp;&amp; (length&gt;7)) { <a name="l01287"></a>01287 <span class="comment">/* if (length &gt; 7) { */</span> <a name="l01288"></a>01288 <span class="comment">/* Call MMX routine */</span> <a name="l01289"></a>01289 <a name="l01290"></a>01290 SDL_imageFilterBitAndMMX(Src1, Src2, Dest, length); <a name="l01291"></a>01291 <a name="l01292"></a>01292 <span class="comment">/* Check for unaligned bytes */</span> <a name="l01293"></a>01293 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l01294"></a>01294 <a name="l01295"></a>01295 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l01296"></a>01296 istart = length &amp; 0xfffffff8; <a name="l01297"></a>01297 cursrc1 = &amp;Src1[istart]; <a name="l01298"></a>01298 cursrc2 = &amp;Src2[istart]; <a name="l01299"></a>01299 curdst = &amp;Dest[istart]; <a name="l01300"></a>01300 } <span class="keywordflow">else</span> { <a name="l01301"></a>01301 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l01302"></a>01302 <span class="keywordflow">return</span> (0); <a name="l01303"></a>01303 } <a name="l01304"></a>01304 } <span class="keywordflow">else</span> { <a name="l01305"></a>01305 <span class="comment">/* Setup to process whole image */</span> <a name="l01306"></a>01306 istart = 0; <a name="l01307"></a>01307 cursrc1 = Src1; <a name="l01308"></a>01308 cursrc2 = Src2; <a name="l01309"></a>01309 curdst = Dest; <a name="l01310"></a>01310 } <a name="l01311"></a>01311 <a name="l01312"></a>01312 <span class="comment">/* C routine to process image */</span> <a name="l01313"></a>01313 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l01314"></a>01314 *curdst = (*cursrc1) &amp; (*cursrc2); <a name="l01315"></a>01315 <span class="comment">/* Advance pointers */</span> <a name="l01316"></a>01316 cursrc1++; <a name="l01317"></a>01317 cursrc2++; <a name="l01318"></a>01318 curdst++; <a name="l01319"></a>01319 } <a name="l01320"></a>01320 <a name="l01321"></a>01321 <span class="keywordflow">return</span> (0); <a name="l01322"></a>01322 } <a name="l01323"></a>01323 <a name="l01334"></a>01334 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterBitOrMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength) <a name="l01335"></a>01335 { <a name="l01336"></a>01336 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l01337"></a>01337 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l01338"></a>01338 <span class="preprocessor"></span> __asm <a name="l01339"></a>01339 { <a name="l01340"></a>01340 pusha <a name="l01341"></a>01341 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l01342"></a>01342 mov ebx, Src2 <span class="comment">/* load Src2 address into ebx */</span> <a name="l01343"></a>01343 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l01344"></a>01344 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l01345"></a>01345 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l01346"></a>01346 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l01347"></a>01347 L91017: <a name="l01348"></a>01348 movq mm1, [eax] <span class="comment">/* load 8 bytes from Src1 into mm1 */</span> <a name="l01349"></a>01349 por mm1, [ebx] <span class="comment">/* mm1=Src1|Src2 */</span> <a name="l01350"></a>01350 movq [edi], mm1 <span class="comment">/* store result in Dest */</span> <a name="l01351"></a>01351 add eax, 8 <span class="comment">/* increase Src1, Src2 and Dest */</span> <a name="l01352"></a>01352 add ebx, 8 <span class="comment">/* register pointers by 8 */</span> <a name="l01353"></a>01353 add edi, 8 <a name="l01354"></a>01354 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l01355"></a>01355 jnz L91017 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l01356"></a>01356 emms <span class="comment">/* exit MMX state */</span> <a name="l01357"></a>01357 popa <a name="l01358"></a>01358 } <a name="l01359"></a>01359 <span class="preprocessor">#else</span> <a name="l01360"></a>01360 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l01361"></a>01361 __m64 *mSrc1 = (__m64*)Src1; <a name="l01362"></a>01362 __m64 *mSrc2 = (__m64*)Src2; <a name="l01363"></a>01363 __m64 *mDest = (__m64*)Dest; <a name="l01364"></a>01364 <span class="keywordtype">int</span> i; <a name="l01365"></a>01365 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l01366"></a>01366 *mDest = _m_por(*mSrc1, *mSrc2); <span class="comment">/* Src1|Src2 */</span> <a name="l01367"></a>01367 mSrc1++; <a name="l01368"></a>01368 mSrc2++; <a name="l01369"></a>01369 mDest++; <a name="l01370"></a>01370 } <a name="l01371"></a>01371 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l01372"></a>01372 <span class="preprocessor">#endif</span> <a name="l01373"></a>01373 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l01374"></a>01374 <span class="preprocessor">#else</span> <a name="l01375"></a>01375 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l01376"></a>01376 <span class="preprocessor">#endif</span> <a name="l01377"></a>01377 <span class="preprocessor"></span>} <a name="l01378"></a>01378 <a name="l01389"></a><a class="code" href="_s_d_l__image_filter_8h.html#a0acf0eabba33f8fa7acbc08dc3015cd3">01389</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a5cf1c477f4e32d02f74ee95d9f7b0021" title="Filter using BitOr: D = S1 | S2.">SDL_imageFilterBitOr</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length) <a name="l01390"></a>01390 { <a name="l01391"></a>01391 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l01392"></a>01392 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1, *cursrc2, *curdst; <a name="l01393"></a>01393 <a name="l01394"></a>01394 <span class="comment">/* Validate input parameters */</span> <a name="l01395"></a>01395 <span class="keywordflow">if</span> ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) <a name="l01396"></a>01396 <span class="keywordflow">return</span>(-1); <a name="l01397"></a>01397 <span class="keywordflow">if</span> (length == 0) <a name="l01398"></a>01398 <span class="keywordflow">return</span>(0); <a name="l01399"></a>01399 <a name="l01400"></a>01400 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l01401"></a>01401 <a name="l01402"></a>01402 <span class="comment">/* MMX routine */</span> <a name="l01403"></a>01403 SDL_imageFilterBitOrMMX(Src1, Src2, Dest, length); <a name="l01404"></a>01404 <a name="l01405"></a>01405 <span class="comment">/* Check for unaligned bytes */</span> <a name="l01406"></a>01406 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l01407"></a>01407 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l01408"></a>01408 istart = length &amp; 0xfffffff8; <a name="l01409"></a>01409 cursrc1 = &amp;Src1[istart]; <a name="l01410"></a>01410 cursrc2 = &amp;Src2[istart]; <a name="l01411"></a>01411 curdst = &amp;Dest[istart]; <a name="l01412"></a>01412 } <span class="keywordflow">else</span> { <a name="l01413"></a>01413 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l01414"></a>01414 <span class="keywordflow">return</span> (0); <a name="l01415"></a>01415 } <a name="l01416"></a>01416 } <span class="keywordflow">else</span> { <a name="l01417"></a>01417 <span class="comment">/* Setup to process whole image */</span> <a name="l01418"></a>01418 istart = 0; <a name="l01419"></a>01419 cursrc1 = Src1; <a name="l01420"></a>01420 cursrc2 = Src2; <a name="l01421"></a>01421 curdst = Dest; <a name="l01422"></a>01422 } <a name="l01423"></a>01423 <a name="l01424"></a>01424 <span class="comment">/* C routine to process image */</span> <a name="l01425"></a>01425 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l01426"></a>01426 *curdst = *cursrc1 | *cursrc2; <a name="l01427"></a>01427 <span class="comment">/* Advance pointers */</span> <a name="l01428"></a>01428 cursrc1++; <a name="l01429"></a>01429 cursrc2++; <a name="l01430"></a>01430 curdst++; <a name="l01431"></a>01431 } <a name="l01432"></a>01432 <span class="keywordflow">return</span> (0); <a name="l01433"></a>01433 } <a name="l01434"></a>01434 <a name="l01445"></a>01445 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterDivASM(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength) <a name="l01446"></a>01446 { <a name="l01447"></a>01447 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l01448"></a>01448 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l01449"></a>01449 <span class="preprocessor"></span> __asm <a name="l01450"></a>01450 { <a name="l01451"></a>01451 pusha <a name="l01452"></a>01452 mov edx, Src1 <span class="comment">/* load Src1 address into edx */</span> <a name="l01453"></a>01453 mov esi, Src2 <span class="comment">/* load Src2 address into esi */</span> <a name="l01454"></a>01454 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l01455"></a>01455 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l01456"></a>01456 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l01457"></a>01457 L10191: <a name="l01458"></a>01458 mov bl, [esi] <span class="comment">/* load a byte from Src2 */</span> <a name="l01459"></a>01459 cmp bl, 0 <span class="comment">/* check if it zero */</span> <a name="l01460"></a>01460 jnz L10192 <a name="l01461"></a>01461 mov [edi], 255 <span class="comment">/* division by zero = 255 !!! */</span> <a name="l01462"></a>01462 jmp L10193 <a name="l01463"></a>01463 L10192: <a name="l01464"></a>01464 xor ah, ah <span class="comment">/* prepare AX, zero AH register */</span> <a name="l01465"></a>01465 mov al, [edx] <span class="comment">/* load a byte from Src1 into AL */</span> <a name="l01466"></a>01466 div bl <span class="comment">/* divide AL by BL */</span> <a name="l01467"></a>01467 mov [edi], al <span class="comment">/* move a byte result to Dest */</span> <a name="l01468"></a>01468 L10193: <a name="l01469"></a>01469 inc edx <span class="comment">/* increment Src1, Src2, Dest */</span> <a name="l01470"></a>01470 inc esi <span class="comment">/* pointer registers by one */</span> <a name="l01471"></a>01471 inc edi <a name="l01472"></a>01472 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l01473"></a>01473 jnz L10191 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l01474"></a>01474 popa <a name="l01475"></a>01475 } <a name="l01476"></a>01476 <span class="preprocessor">#else</span> <a name="l01477"></a>01477 <span class="preprocessor"></span> <span class="comment">/* Note: ~15% gain on i386, less efficient than C on x86_64 */</span> <a name="l01478"></a>01478 <span class="comment">/* Also depends on whether the function is static (?!) */</span> <a name="l01479"></a>01479 <span class="comment">/* Also depends on whether we work on malloc() or static char[] */</span> <a name="l01480"></a>01480 <span class="keyword">asm</span> <span class="keyword">volatile</span> ( <a name="l01481"></a>01481 <span class="preprocessor"># if defined(i386)</span> <a name="l01482"></a>01482 <span class="preprocessor"></span> <span class="stringliteral">&quot;pushl %%ebx \n\t&quot;</span> <span class="comment">/* %ebx may be the PIC register. */</span> <a name="l01483"></a>01483 <span class="stringliteral">&quot;.align 16 \n\t&quot;</span> <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l01484"></a>01484 <span class="stringliteral">&quot;1: mov (%%esi), %%bl \n\t&quot;</span> <span class="comment">/* load a byte from Src2 */</span> <a name="l01485"></a>01485 <span class="stringliteral">&quot;cmp $0, %%bl \n\t&quot;</span> <span class="comment">/* check if it zero */</span> <a name="l01486"></a>01486 <span class="stringliteral">&quot;jnz 2f \n\t&quot;</span> <a name="l01487"></a>01487 <span class="stringliteral">&quot;movb $255, (%%edi) \n\t&quot;</span> <span class="comment">/* division by zero = 255 !!! */</span> <a name="l01488"></a>01488 <span class="stringliteral">&quot;jmp 3f \n\t&quot;</span> <a name="l01489"></a>01489 <span class="stringliteral">&quot;2: xor %%ah, %%ah \n\t&quot;</span> <span class="comment">/* prepare AX, zero AH register */</span> <a name="l01490"></a>01490 <span class="stringliteral">&quot;mov (%%edx), %%al \n\t&quot;</span> <span class="comment">/* load a byte from Src1 into AL */</span> <a name="l01491"></a>01491 <span class="stringliteral">&quot;div %%bl \n\t&quot;</span> <span class="comment">/* divide AL by BL */</span> <a name="l01492"></a>01492 <span class="stringliteral">&quot;mov %%al, (%%edi) \n\t&quot;</span> <span class="comment">/* move a byte result to Dest */</span> <a name="l01493"></a>01493 <span class="stringliteral">&quot;3: inc %%edx \n\t&quot;</span> <span class="comment">/* increment Src1, Src2, Dest */</span> <a name="l01494"></a>01494 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* pointer registers by one */</span> <a name="l01495"></a>01495 <span class="stringliteral">&quot;inc %%edi \n\t&quot;</span> <a name="l01496"></a>01496 <span class="stringliteral">&quot;dec %%ecx \n\t&quot;</span> <span class="comment">/* decrease loop counter */</span> <a name="l01497"></a>01497 <span class="stringliteral">&quot;jnz 1b \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l01498"></a>01498 <span class="stringliteral">&quot;popl %%ebx \n\t&quot;</span> <span class="comment">/* restore %ebx */</span> <a name="l01499"></a>01499 : <span class="stringliteral">&quot;+d&quot;</span> (Src1), <span class="comment">/* load Src1 address into edx */</span> <a name="l01500"></a>01500 <span class="stringliteral">&quot;+S&quot;</span> (Src2), <span class="comment">/* load Src2 address into esi */</span> <a name="l01501"></a>01501 <span class="stringliteral">&quot;+c&quot;</span> (SrcLength), <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l01502"></a>01502 <span class="stringliteral">&quot;+D&quot;</span> (Dest) <span class="comment">/* load Dest address into edi */</span> <a name="l01503"></a>01503 : <a name="l01504"></a>01504 : <span class="stringliteral">&quot;memory&quot;</span>, <span class="stringliteral">&quot;rax&quot;</span> <a name="l01505"></a>01505 <span class="preprocessor"># elif defined(__x86_64__)</span> <a name="l01506"></a>01506 <span class="preprocessor"></span> <span class="stringliteral">&quot;.align 16 \n\t&quot;</span> <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l01507"></a>01507 <span class="stringliteral">&quot;1: mov (%%rsi), %%bl \n\t&quot;</span> <span class="comment">/* load a byte from Src2 */</span> <a name="l01508"></a>01508 <span class="stringliteral">&quot;cmp $0, %%bl \n\t&quot;</span> <span class="comment">/* check if it zero */</span> <a name="l01509"></a>01509 <span class="stringliteral">&quot;jnz 2f \n\t&quot;</span> <a name="l01510"></a>01510 <span class="stringliteral">&quot;movb $255, (%%rdi) \n\t&quot;</span> <span class="comment">/* division by zero = 255 !!! */</span> <a name="l01511"></a>01511 <span class="stringliteral">&quot;jmp 3f \n\t&quot;</span> <a name="l01512"></a>01512 <span class="stringliteral">&quot;2: xor %%ah, %%ah \n\t&quot;</span> <span class="comment">/* prepare AX, zero AH register */</span> <a name="l01513"></a>01513 <span class="stringliteral">&quot;mov (%%rdx), %%al \n\t&quot;</span> <span class="comment">/* load a byte from Src1 into AL */</span> <a name="l01514"></a>01514 <span class="stringliteral">&quot;div %%bl \n\t&quot;</span> <span class="comment">/* divide AL by BL */</span> <a name="l01515"></a>01515 <span class="stringliteral">&quot;mov %%al, (%%rdi) \n\t&quot;</span> <span class="comment">/* move a byte result to Dest */</span> <a name="l01516"></a>01516 <span class="stringliteral">&quot;3: inc %%rdx \n\t&quot;</span> <span class="comment">/* increment Src1, Src2, Dest */</span> <a name="l01517"></a>01517 <span class="stringliteral">&quot;inc %%rsi \n\t&quot;</span> <span class="comment">/* pointer registers by one */</span> <a name="l01518"></a>01518 <span class="stringliteral">&quot;inc %%rdi \n\t&quot;</span> <a name="l01519"></a>01519 <span class="stringliteral">&quot;dec %%rcx \n\t&quot;</span> <span class="comment">/* decrease loop counter */</span> <a name="l01520"></a>01520 <span class="stringliteral">&quot;jnz 1b \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l01521"></a>01521 : <span class="stringliteral">&quot;+d&quot;</span> (Src1), <span class="comment">/* load Src1 address into edx */</span> <a name="l01522"></a>01522 <span class="stringliteral">&quot;+S&quot;</span> (Src2), <span class="comment">/* load Src2 address into esi */</span> <a name="l01523"></a>01523 <span class="stringliteral">&quot;+c&quot;</span> (SrcLength), <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l01524"></a>01524 <span class="stringliteral">&quot;+D&quot;</span> (Dest) <span class="comment">/* load Dest address into edi */</span> <a name="l01525"></a>01525 : <a name="l01526"></a>01526 : <span class="stringliteral">&quot;memory&quot;</span>, <span class="stringliteral">&quot;rax&quot;</span>, <span class="stringliteral">&quot;rbx&quot;</span> <a name="l01527"></a>01527 <span class="preprocessor"># endif</span> <a name="l01528"></a>01528 <span class="preprocessor"></span> ); <a name="l01529"></a>01529 <span class="preprocessor">#endif</span> <a name="l01530"></a>01530 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l01531"></a>01531 <span class="preprocessor">#else</span> <a name="l01532"></a>01532 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l01533"></a>01533 <span class="preprocessor">#endif</span> <a name="l01534"></a>01534 <span class="preprocessor"></span>} <a name="l01535"></a>01535 <a name="l01546"></a><a class="code" href="_s_d_l__image_filter_8h.html#aeb8ed56aa7de3c8b0d0b2aa9163c3e37">01546</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a0ea22f01c6a4724bac307da3e5355f58" title="Filter using Div: D = S1 / S2.">SDL_imageFilterDiv</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length) <a name="l01547"></a>01547 { <a name="l01548"></a>01548 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l01549"></a>01549 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1, *cursrc2, *curdst; <a name="l01550"></a>01550 <a name="l01551"></a>01551 <span class="comment">/* Validate input parameters */</span> <a name="l01552"></a>01552 <span class="keywordflow">if</span> ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) <a name="l01553"></a>01553 <span class="keywordflow">return</span>(-1); <a name="l01554"></a>01554 <span class="keywordflow">if</span> (length == 0) <a name="l01555"></a>01555 <span class="keywordflow">return</span>(0); <a name="l01556"></a>01556 <a name="l01557"></a>01557 <span class="keywordflow">if</span> (<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) { <a name="l01558"></a>01558 <span class="keywordflow">if</span> (length &gt; 0) { <a name="l01559"></a>01559 <span class="comment">/* Call ASM routine */</span> <a name="l01560"></a>01560 SDL_imageFilterDivASM(Src1, Src2, Dest, length); <a name="l01561"></a>01561 <a name="l01562"></a>01562 <span class="comment">/* Never unaligned bytes - we are done */</span> <a name="l01563"></a>01563 <span class="keywordflow">return</span> (0); <a name="l01564"></a>01564 } <span class="keywordflow">else</span> { <a name="l01565"></a>01565 <span class="keywordflow">return</span> (-1); <a name="l01566"></a>01566 } <a name="l01567"></a>01567 } <a name="l01568"></a>01568 <a name="l01569"></a>01569 <span class="comment">/* Setup to process whole image */</span> <a name="l01570"></a>01570 istart = 0; <a name="l01571"></a>01571 cursrc1 = Src1; <a name="l01572"></a>01572 cursrc2 = Src2; <a name="l01573"></a>01573 curdst = Dest; <a name="l01574"></a>01574 <a name="l01575"></a>01575 <span class="comment">/* C routine to process image */</span> <a name="l01576"></a>01576 <span class="comment">/* for (i = istart; i &lt; length; i++) { */</span> <a name="l01577"></a>01577 <span class="comment">/* if (*cursrc2 == 0) { */</span> <a name="l01578"></a>01578 <span class="comment">/* *curdst = 255; */</span> <a name="l01579"></a>01579 <span class="comment">/* } else { */</span> <a name="l01580"></a>01580 <span class="comment">/* result = (int) *cursrc1 / (int) *cursrc2; */</span> <a name="l01581"></a>01581 <span class="comment">/* *curdst = (unsigned char) result; */</span> <a name="l01582"></a>01582 <span class="comment">/* } */</span> <a name="l01583"></a>01583 <span class="comment">/* /\* Advance pointers *\/ */</span> <a name="l01584"></a>01584 <span class="comment">/* cursrc1++; */</span> <a name="l01585"></a>01585 <span class="comment">/* cursrc2++; */</span> <a name="l01586"></a>01586 <span class="comment">/* curdst++; */</span> <a name="l01587"></a>01587 <span class="comment">/* } */</span> <a name="l01588"></a>01588 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l01589"></a>01589 <span class="keywordflow">if</span> (*cursrc2 == 0) { <a name="l01590"></a>01590 *curdst = 255; <a name="l01591"></a>01591 } <span class="keywordflow">else</span> { <a name="l01592"></a>01592 *curdst = (int)*cursrc1 / (<span class="keywordtype">int</span>)*cursrc2; <span class="comment">// (int) for efficiency</span> <a name="l01593"></a>01593 } <a name="l01594"></a>01594 <span class="comment">/* Advance pointers */</span> <a name="l01595"></a>01595 cursrc1++; <a name="l01596"></a>01596 cursrc2++; <a name="l01597"></a>01597 curdst++; <a name="l01598"></a>01598 } <a name="l01599"></a>01599 <a name="l01600"></a>01600 <span class="keywordflow">return</span> (0); <a name="l01601"></a>01601 } <a name="l01602"></a>01602 <a name="l01603"></a>01603 <span class="comment">/* ------------------------------------------------------------------------------------ */</span> <a name="l01604"></a>01604 <a name="l01614"></a>01614 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterBitNegationMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength) <a name="l01615"></a>01615 { <a name="l01616"></a>01616 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l01617"></a>01617 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l01618"></a>01618 <span class="preprocessor"></span> __asm <a name="l01619"></a>01619 { <a name="l01620"></a>01620 pusha <a name="l01621"></a>01621 pcmpeqb mm1, mm1 <span class="comment">/* generate all 1&#39;s in mm1 */</span> <a name="l01622"></a>01622 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l01623"></a>01623 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l01624"></a>01624 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l01625"></a>01625 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l01626"></a>01626 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l01627"></a>01627 L91117: <a name="l01628"></a>01628 movq mm0, [eax] <span class="comment">/* load 8 bytes from Src1 into mm1 */</span> <a name="l01629"></a>01629 pxor mm0, mm1 <span class="comment">/* negate mm0 by xoring with mm1 */</span> <a name="l01630"></a>01630 movq [edi], mm0 <span class="comment">/* store result in Dest */</span> <a name="l01631"></a>01631 add eax, 8 <span class="comment">/* increase Src1, Src2 and Dest */</span> <a name="l01632"></a>01632 add edi, 8 <a name="l01633"></a>01633 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l01634"></a>01634 jnz L91117 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l01635"></a>01635 emms <span class="comment">/* exit MMX state */</span> <a name="l01636"></a>01636 popa <a name="l01637"></a>01637 } <a name="l01638"></a>01638 <span class="preprocessor">#else</span> <a name="l01639"></a>01639 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l01640"></a>01640 __m64 *mSrc1 = (__m64*)Src1; <a name="l01641"></a>01641 __m64 *mDest = (__m64*)Dest; <a name="l01642"></a>01642 __m64 mm1; <a name="l01643"></a>01643 mm1 = _m_pcmpeqb(mm1, mm1); <span class="comment">/* generate all 1&#39;s in mm1 */</span> <a name="l01644"></a>01644 <span class="keywordtype">int</span> i; <a name="l01645"></a>01645 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l01646"></a>01646 *mDest = _m_pxor(*mSrc1, mm1); <span class="comment">/* negate mm0 by xoring with mm1 */</span> <a name="l01647"></a>01647 mSrc1++; <a name="l01648"></a>01648 mDest++; <a name="l01649"></a>01649 } <a name="l01650"></a>01650 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l01651"></a>01651 <a name="l01652"></a>01652 <span class="preprocessor">#endif</span> <a name="l01653"></a>01653 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l01654"></a>01654 <span class="preprocessor">#else</span> <a name="l01655"></a>01655 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l01656"></a>01656 <span class="preprocessor">#endif</span> <a name="l01657"></a>01657 <span class="preprocessor"></span>} <a name="l01658"></a>01658 <a name="l01668"></a><a class="code" href="_s_d_l__image_filter_8h.html#abc3c3fc5f018e271f6393921f3964d31">01668</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#ac3abfaa8ec2e88c3c4893588c5555856" title="Filter using BitNegation: D = !S.">SDL_imageFilterBitNegation</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length) <a name="l01669"></a>01669 { <a name="l01670"></a>01670 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l01671"></a>01671 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1, *curdst; <a name="l01672"></a>01672 <a name="l01673"></a>01673 <span class="comment">/* Validate input parameters */</span> <a name="l01674"></a>01674 <span class="keywordflow">if</span> ((Src1 == NULL) || (Dest == NULL)) <a name="l01675"></a>01675 <span class="keywordflow">return</span>(-1); <a name="l01676"></a>01676 <span class="keywordflow">if</span> (length == 0) <a name="l01677"></a>01677 <span class="keywordflow">return</span>(0); <a name="l01678"></a>01678 <a name="l01679"></a>01679 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l01680"></a>01680 <span class="comment">/* MMX routine */</span> <a name="l01681"></a>01681 SDL_imageFilterBitNegationMMX(Src1, Dest, length); <a name="l01682"></a>01682 <a name="l01683"></a>01683 <span class="comment">/* Check for unaligned bytes */</span> <a name="l01684"></a>01684 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l01685"></a>01685 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l01686"></a>01686 istart = length &amp; 0xfffffff8; <a name="l01687"></a>01687 cursrc1 = &amp;Src1[istart]; <a name="l01688"></a>01688 curdst = &amp;Dest[istart]; <a name="l01689"></a>01689 } <span class="keywordflow">else</span> { <a name="l01690"></a>01690 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l01691"></a>01691 <span class="keywordflow">return</span> (0); <a name="l01692"></a>01692 } <a name="l01693"></a>01693 } <span class="keywordflow">else</span> { <a name="l01694"></a>01694 <span class="comment">/* Setup to process whole image */</span> <a name="l01695"></a>01695 istart = 0; <a name="l01696"></a>01696 cursrc1 = Src1; <a name="l01697"></a>01697 curdst = Dest; <a name="l01698"></a>01698 } <a name="l01699"></a>01699 <a name="l01700"></a>01700 <span class="comment">/* C routine to process image */</span> <a name="l01701"></a>01701 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l01702"></a>01702 *curdst = ~(*cursrc1); <a name="l01703"></a>01703 <span class="comment">/* Advance pointers */</span> <a name="l01704"></a>01704 cursrc1++; <a name="l01705"></a>01705 curdst++; <a name="l01706"></a>01706 } <a name="l01707"></a>01707 <a name="l01708"></a>01708 <span class="keywordflow">return</span> (0); <a name="l01709"></a>01709 } <a name="l01710"></a>01710 <a name="l01721"></a>01721 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterAddByteMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> C) <a name="l01722"></a>01722 { <a name="l01723"></a>01723 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l01724"></a>01724 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l01725"></a>01725 <span class="preprocessor"></span> __asm <a name="l01726"></a>01726 { <a name="l01727"></a>01727 pusha <a name="l01728"></a>01728 <span class="comment">/* ** Duplicate C in 8 bytes of MM1 ** */</span> <a name="l01729"></a>01729 mov al, C <span class="comment">/* load C into AL */</span> <a name="l01730"></a>01730 mov ah, al <span class="comment">/* copy AL into AH */</span> <a name="l01731"></a>01731 mov bx, ax <span class="comment">/* copy AX into BX */</span> <a name="l01732"></a>01732 shl eax, 16 <span class="comment">/* shift 2 bytes of EAX left */</span> <a name="l01733"></a>01733 mov ax, bx <span class="comment">/* copy BX into AX */</span> <a name="l01734"></a>01734 movd mm1, eax <span class="comment">/* copy EAX into MM1 */</span> <a name="l01735"></a>01735 movd mm2, eax <span class="comment">/* copy EAX into MM2 */</span> <a name="l01736"></a>01736 punpckldq mm1, mm2 <span class="comment">/* fill higher bytes of MM1 with C */</span> <a name="l01737"></a>01737 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l01738"></a>01738 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l01739"></a>01739 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l01740"></a>01740 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l01741"></a>01741 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l01742"></a>01742 L1021: <a name="l01743"></a>01743 movq mm0, [eax] <span class="comment">/* load 8 bytes from Src1 into MM0 */</span> <a name="l01744"></a>01744 paddusb mm0, mm1 <span class="comment">/* MM0=SrcDest+C (add 8 bytes with saturation) */</span> <a name="l01745"></a>01745 movq [edi], mm0 <span class="comment">/* store result in Dest */</span> <a name="l01746"></a>01746 add eax, 8 <span class="comment">/* increase Dest register pointer by 8 */</span> <a name="l01747"></a>01747 add edi, 8 <span class="comment">/* increase Dest register pointer by 8 */</span> <a name="l01748"></a>01748 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l01749"></a>01749 jnz L1021 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l01750"></a>01750 emms <span class="comment">/* exit MMX state */</span> <a name="l01751"></a>01751 popa <a name="l01752"></a>01752 } <a name="l01753"></a>01753 <span class="preprocessor">#else</span> <a name="l01754"></a>01754 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l01755"></a>01755 __m64 *mSrc1 = (__m64*)Src1; <a name="l01756"></a>01756 __m64 *mDest = (__m64*)Dest; <a name="l01757"></a>01757 <span class="comment">/* Duplicate C in 8 bytes of MM1 */</span> <a name="l01758"></a>01758 <span class="keywordtype">int</span> i; <a name="l01759"></a>01759 memset(&amp;i, C, 4); <a name="l01760"></a>01760 __m64 mm1 = _m_from_int(i); <a name="l01761"></a>01761 __m64 mm2 = _m_from_int(i); <a name="l01762"></a>01762 mm1 = _m_punpckldq(mm1, mm2); <span class="comment">/* fill higher bytes of MM1 with C */</span> <a name="l01763"></a>01763 <span class="comment">//__m64 mm1 = _m_from_int64(lli); // x86_64 only</span> <a name="l01764"></a>01764 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l01765"></a>01765 *mDest = _m_paddusb(*mSrc1, mm1); <span class="comment">/* Src1+C (add 8 bytes with saturation) */</span> <a name="l01766"></a>01766 mSrc1++; <a name="l01767"></a>01767 mDest++; <a name="l01768"></a>01768 } <a name="l01769"></a>01769 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l01770"></a>01770 <span class="preprocessor">#endif</span> <a name="l01771"></a>01771 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l01772"></a>01772 <span class="preprocessor">#else</span> <a name="l01773"></a>01773 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l01774"></a>01774 <span class="preprocessor">#endif</span> <a name="l01775"></a>01775 <span class="preprocessor"></span>} <a name="l01776"></a>01776 <a name="l01788"></a><a class="code" href="_s_d_l__image_filter_8h.html#a6be6dccd000eff4baadd33297e5cc419">01788</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a812cb307cb60ef31f1ffe81a9eee6bb1" title="Filter using AddByte: D = saturation255(S + C)">SDL_imageFilterAddByte</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> C) <a name="l01789"></a>01789 { <a name="l01790"></a>01790 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l01791"></a>01791 <span class="keywordtype">int</span> iC; <a name="l01792"></a>01792 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1, *curdest; <a name="l01793"></a>01793 <span class="keywordtype">int</span> result; <a name="l01794"></a>01794 <a name="l01795"></a>01795 <span class="comment">/* Validate input parameters */</span> <a name="l01796"></a>01796 <span class="keywordflow">if</span> ((Src1 == NULL) || (Dest == NULL)) <a name="l01797"></a>01797 <span class="keywordflow">return</span>(-1); <a name="l01798"></a>01798 <span class="keywordflow">if</span> (length == 0) <a name="l01799"></a>01799 <span class="keywordflow">return</span>(0); <a name="l01800"></a>01800 <a name="l01801"></a>01801 <span class="comment">/* Special case: C==0 */</span> <a name="l01802"></a>01802 <span class="keywordflow">if</span> (C == 0) { <a name="l01803"></a>01803 memcpy(Src1, Dest, length); <a name="l01804"></a>01804 <span class="keywordflow">return</span> (0); <a name="l01805"></a>01805 } <a name="l01806"></a>01806 <a name="l01807"></a>01807 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l01808"></a>01808 <a name="l01809"></a>01809 <span class="comment">/* MMX routine */</span> <a name="l01810"></a>01810 SDL_imageFilterAddByteMMX(Src1, Dest, length, C); <a name="l01811"></a>01811 <a name="l01812"></a>01812 <span class="comment">/* Check for unaligned bytes */</span> <a name="l01813"></a>01813 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l01814"></a>01814 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l01815"></a>01815 istart = length &amp; 0xfffffff8; <a name="l01816"></a>01816 cursrc1 = &amp;Src1[istart]; <a name="l01817"></a>01817 curdest = &amp;Dest[istart]; <a name="l01818"></a>01818 } <span class="keywordflow">else</span> { <a name="l01819"></a>01819 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l01820"></a>01820 <span class="keywordflow">return</span> (0); <a name="l01821"></a>01821 } <a name="l01822"></a>01822 } <span class="keywordflow">else</span> { <a name="l01823"></a>01823 <span class="comment">/* Setup to process whole image */</span> <a name="l01824"></a>01824 istart = 0; <a name="l01825"></a>01825 cursrc1 = Src1; <a name="l01826"></a>01826 curdest = Dest; <a name="l01827"></a>01827 } <a name="l01828"></a>01828 <a name="l01829"></a>01829 <span class="comment">/* C routine to process image */</span> <a name="l01830"></a>01830 iC = (int) C; <a name="l01831"></a>01831 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l01832"></a>01832 result = (int) *cursrc1 + iC; <a name="l01833"></a>01833 <span class="keywordflow">if</span> (result &gt; 255) <a name="l01834"></a>01834 result = 255; <a name="l01835"></a>01835 *curdest = (<span class="keywordtype">unsigned</span> char) result; <a name="l01836"></a>01836 <span class="comment">/* Advance pointers */</span> <a name="l01837"></a>01837 cursrc1++; <a name="l01838"></a>01838 curdest++; <a name="l01839"></a>01839 } <a name="l01840"></a>01840 <span class="keywordflow">return</span> (0); <a name="l01841"></a>01841 } <a name="l01842"></a>01842 <a name="l01854"></a>01854 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterAddUintMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> C, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> D) <a name="l01855"></a>01855 { <a name="l01856"></a>01856 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l01857"></a>01857 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l01858"></a>01858 <span class="preprocessor"></span> __asm <a name="l01859"></a>01859 { <a name="l01860"></a>01860 pusha <a name="l01861"></a>01861 <span class="comment">/* ** Duplicate (int)C in 8 bytes of MM1 ** */</span> <a name="l01862"></a>01862 mov eax, C <span class="comment">/* load C into EAX */</span> <a name="l01863"></a>01863 movd mm1, eax <span class="comment">/* copy EAX into MM1 */</span> <a name="l01864"></a>01864 mov eax, D <span class="comment">/* load D into EAX */</span> <a name="l01865"></a>01865 movd mm2, eax <span class="comment">/* copy EAX into MM2 */</span> <a name="l01866"></a>01866 punpckldq mm1, mm2 <span class="comment">/* fill higher bytes of MM1 with C */</span> <a name="l01867"></a>01867 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l01868"></a>01868 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l01869"></a>01869 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l01870"></a>01870 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l01871"></a>01871 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l01872"></a>01872 L11023: <a name="l01873"></a>01873 movq mm0, [eax] <span class="comment">/* load 8 bytes from SrcDest into MM0 */</span> <a name="l01874"></a>01874 paddusb mm0, mm1 <span class="comment">/* MM0=SrcDest+C (add 8 bytes with saturation) */</span> <a name="l01875"></a>01875 movq [edi], mm0 <span class="comment">/* store result in SrcDest */</span> <a name="l01876"></a>01876 add eax, 8 <span class="comment">/* increase Src1 register pointer by 8 */</span> <a name="l01877"></a>01877 add edi, 8 <span class="comment">/* increase Dest register pointer by 8 */</span> <a name="l01878"></a>01878 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l01879"></a>01879 jnz L11023 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l01880"></a>01880 emms <span class="comment">/* exit MMX state */</span> <a name="l01881"></a>01881 popa <a name="l01882"></a>01882 } <a name="l01883"></a>01883 <span class="preprocessor">#else</span> <a name="l01884"></a>01884 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l01885"></a>01885 __m64 *mSrc1 = (__m64*)Src1; <a name="l01886"></a>01886 __m64 *mDest = (__m64*)Dest; <a name="l01887"></a>01887 <span class="comment">/* Duplicate (int)C in 8 bytes of MM1 */</span> <a name="l01888"></a>01888 __m64 mm1 = _m_from_int(C); <a name="l01889"></a>01889 __m64 mm2 = _m_from_int(C); <a name="l01890"></a>01890 mm1 = _m_punpckldq(mm1, mm2); <span class="comment">/* fill higher bytes of MM1 with C */</span> <a name="l01891"></a>01891 <span class="comment">//__m64 mm1 = _m_from_int64(lli); // x86_64 only</span> <a name="l01892"></a>01892 <span class="keywordtype">int</span> i; <a name="l01893"></a>01893 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l01894"></a>01894 *mDest = _m_paddusb(*mSrc1, mm1); <span class="comment">/* Src1+C (add 8 bytes with saturation) */</span> <a name="l01895"></a>01895 mSrc1++; <a name="l01896"></a>01896 mDest++; <a name="l01897"></a>01897 } <a name="l01898"></a>01898 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l01899"></a>01899 <span class="preprocessor">#endif</span> <a name="l01900"></a>01900 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l01901"></a>01901 <span class="preprocessor">#else</span> <a name="l01902"></a>01902 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l01903"></a>01903 <span class="preprocessor">#endif</span> <a name="l01904"></a>01904 <span class="preprocessor"></span>} <a name="l01905"></a>01905 <a name="l01916"></a><a class="code" href="_s_d_l__image_filter_8h.html#af1a17645dea69e52c7bd560521286765">01916</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a660543426c47dfec39a349eb3b8f905b" title="Filter using AddUint: D = saturation255((S[i] + Cs[i % 4]), Cs=Swap32((uint)C)">SDL_imageFilterAddUint</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> C) <a name="l01917"></a>01917 { <a name="l01918"></a>01918 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, j, istart, D; <a name="l01919"></a>01919 <span class="keywordtype">int</span> iC[4]; <a name="l01920"></a>01920 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1; <a name="l01921"></a>01921 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *curdest; <a name="l01922"></a>01922 <span class="keywordtype">int</span> result; <a name="l01923"></a>01923 <a name="l01924"></a>01924 <span class="comment">/* Validate input parameters */</span> <a name="l01925"></a>01925 <span class="keywordflow">if</span> ((Src1 == NULL) || (Dest == NULL)) <a name="l01926"></a>01926 <span class="keywordflow">return</span>(-1); <a name="l01927"></a>01927 <span class="keywordflow">if</span> (length == 0) <a name="l01928"></a>01928 <span class="keywordflow">return</span>(0); <a name="l01929"></a>01929 <a name="l01930"></a>01930 <span class="comment">/* Special case: C==0 */</span> <a name="l01931"></a>01931 <span class="keywordflow">if</span> (C == 0) { <a name="l01932"></a>01932 memcpy(Src1, Dest, length); <a name="l01933"></a>01933 <span class="keywordflow">return</span> (0); <a name="l01934"></a>01934 } <a name="l01935"></a>01935 <a name="l01936"></a>01936 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l01937"></a>01937 <a name="l01938"></a>01938 <span class="comment">/* MMX routine */</span> <a name="l01939"></a>01939 D=<a class="code" href="_s_d_l__image_filter_8c.html#a700fb30611761c46a674a45cc28ff561" title="Swaps the byte order in a 32bit integer (LSB becomes MSB, etc.).">SWAP_32</a>(C); <a name="l01940"></a>01940 SDL_imageFilterAddUintMMX(Src1, Dest, length, C, D); <a name="l01941"></a>01941 <a name="l01942"></a>01942 <span class="comment">/* Check for unaligned bytes */</span> <a name="l01943"></a>01943 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l01944"></a>01944 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l01945"></a>01945 istart = length &amp; 0xfffffff8; <a name="l01946"></a>01946 cursrc1 = &amp;Src1[istart]; <a name="l01947"></a>01947 curdest = &amp;Dest[istart]; <a name="l01948"></a>01948 } <span class="keywordflow">else</span> { <a name="l01949"></a>01949 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l01950"></a>01950 <span class="keywordflow">return</span> (0); <a name="l01951"></a>01951 } <a name="l01952"></a>01952 } <span class="keywordflow">else</span> { <a name="l01953"></a>01953 <span class="comment">/* Setup to process whole image */</span> <a name="l01954"></a>01954 istart = 0; <a name="l01955"></a>01955 cursrc1 = Src1; <a name="l01956"></a>01956 curdest = Dest; <a name="l01957"></a>01957 } <a name="l01958"></a>01958 <a name="l01959"></a>01959 <span class="comment">/* C routine to process bytes */</span> <a name="l01960"></a>01960 iC[3] = (int) ((C &gt;&gt; 24) &amp; 0xff); <a name="l01961"></a>01961 iC[2] = (int) ((C &gt;&gt; 16) &amp; 0xff); <a name="l01962"></a>01962 iC[1] = (int) ((C &gt;&gt; 8) &amp; 0xff); <a name="l01963"></a>01963 iC[0] = (int) ((C &gt;&gt; 0) &amp; 0xff); <a name="l01964"></a>01964 <span class="keywordflow">for</span> (i = istart; i &lt; length; i += 4) { <a name="l01965"></a>01965 <span class="keywordflow">for</span> (j = 0; j &lt; 4; j++) { <a name="l01966"></a>01966 <span class="keywordflow">if</span> ((i+j)&lt;length) { <a name="l01967"></a>01967 result = (int) *cursrc1 + iC[j]; <a name="l01968"></a>01968 <span class="keywordflow">if</span> (result &gt; 255) result = 255; <a name="l01969"></a>01969 *curdest = (<span class="keywordtype">unsigned</span> char) result; <a name="l01970"></a>01970 <span class="comment">/* Advance pointers */</span> <a name="l01971"></a>01971 cursrc1++; <a name="l01972"></a>01972 curdest++; <a name="l01973"></a>01973 } <a name="l01974"></a>01974 } <a name="l01975"></a>01975 } <a name="l01976"></a>01976 <span class="keywordflow">return</span> (0); <a name="l01977"></a>01977 } <a name="l01978"></a>01978 <a name="l01990"></a>01990 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterAddByteToHalfMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> C, <a name="l01991"></a>01991 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Mask) <a name="l01992"></a>01992 { <a name="l01993"></a>01993 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l01994"></a>01994 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l01995"></a>01995 <span class="preprocessor"></span> __asm <a name="l01996"></a>01996 { <a name="l01997"></a>01997 pusha <a name="l01998"></a>01998 <span class="comment">/* ** Duplicate C in 8 bytes of MM1 ** */</span> <a name="l01999"></a>01999 mov al, C <span class="comment">/* load C into AL */</span> <a name="l02000"></a>02000 mov ah, al <span class="comment">/* copy AL into AH */</span> <a name="l02001"></a>02001 mov bx, ax <span class="comment">/* copy AX into BX */</span> <a name="l02002"></a>02002 shl eax, 16 <span class="comment">/* shift 2 bytes of EAX left */</span> <a name="l02003"></a>02003 mov ax, bx <span class="comment">/* copy BX into AX */</span> <a name="l02004"></a>02004 movd mm1, eax <span class="comment">/* copy EAX into MM1 */</span> <a name="l02005"></a>02005 movd mm2, eax <span class="comment">/* copy EAX into MM2 */</span> <a name="l02006"></a>02006 punpckldq mm1, mm2 <span class="comment">/* fill higher bytes of MM1 with C */</span> <a name="l02007"></a>02007 mov edx, Mask <span class="comment">/* load Mask address into edx */</span> <a name="l02008"></a>02008 movq mm0, [edx] <span class="comment">/* load Mask into mm0 */</span> <a name="l02009"></a>02009 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l02010"></a>02010 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l02011"></a>02011 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l02012"></a>02012 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l02013"></a>02013 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l02014"></a>02014 L1022: <a name="l02015"></a>02015 movq mm2, [eax] <span class="comment">/* load 8 bytes from Src1 into MM2 */</span> <a name="l02016"></a>02016 psrlw mm2, 1 <span class="comment">/* shift 4 WORDS of MM2 1 bit to the right */</span> <a name="l02017"></a>02017 pand mm2, mm0 <span class="comment">// apply Mask to 8 BYTES of MM2 */</span> <a name="l02018"></a>02018 paddusb mm2, mm1 <span class="comment">/* MM2=SrcDest+C (add 8 bytes with saturation) */</span> <a name="l02019"></a>02019 movq [edi], mm2 <span class="comment">/* store result in Dest */</span> <a name="l02020"></a>02020 add eax, 8 <span class="comment">/* increase Src1 register pointer by 8 */</span> <a name="l02021"></a>02021 add edi, 8 <span class="comment">/* increase Dest register pointer by 8 */</span> <a name="l02022"></a>02022 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l02023"></a>02023 jnz L1022 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l02024"></a>02024 emms <span class="comment">/* exit MMX state */</span> <a name="l02025"></a>02025 popa <a name="l02026"></a>02026 } <a name="l02027"></a>02027 <span class="preprocessor">#else</span> <a name="l02028"></a>02028 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l02029"></a>02029 __m64 *mSrc1 = (__m64*)Src1; <a name="l02030"></a>02030 __m64 *mDest = (__m64*)Dest; <a name="l02031"></a>02031 __m64 *mMask = (__m64*)Mask; <a name="l02032"></a>02032 <span class="comment">/* Duplicate C in 8 bytes of MM1 */</span> <a name="l02033"></a>02033 <span class="keywordtype">int</span> i; <a name="l02034"></a>02034 memset(&amp;i, C, 4); <a name="l02035"></a>02035 __m64 mm1 = _m_from_int(i); <a name="l02036"></a>02036 __m64 mm2 = _m_from_int(i); <a name="l02037"></a>02037 mm1 = _m_punpckldq(mm1, mm2); <span class="comment">/* fill higher bytes of MM1 with C */</span> <a name="l02038"></a>02038 <span class="comment">//__m64 mm1 = _m_from_int64(lli); // x86_64 only</span> <a name="l02039"></a>02039 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l02040"></a>02040 __m64 mm2 = _m_psrlwi(*mSrc1, 1); <span class="comment">/* shift 4 WORDS of MM2 1 bit to the right */</span> <a name="l02041"></a>02041 mm2 = _m_pand(mm2, *mMask); <span class="comment">/* apply Mask to 8 BYTES of MM2 */</span> <a name="l02042"></a>02042 <span class="comment">/* byte 0x0f, 0xdb, 0xd0 */</span> <a name="l02043"></a>02043 *mDest = _m_paddusb(mm1, mm2); <span class="comment">/* Src1+C (add 8 bytes with saturation) */</span> <a name="l02044"></a>02044 mSrc1++; <a name="l02045"></a>02045 mDest++; <a name="l02046"></a>02046 } <a name="l02047"></a>02047 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l02048"></a>02048 <span class="preprocessor">#endif</span> <a name="l02049"></a>02049 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l02050"></a>02050 <span class="preprocessor">#else</span> <a name="l02051"></a>02051 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l02052"></a>02052 <span class="preprocessor">#endif</span> <a name="l02053"></a>02053 <span class="preprocessor"></span>} <a name="l02054"></a>02054 <a name="l02065"></a><a class="code" href="_s_d_l__image_filter_8h.html#a8cbdffd5dbcab3b5dc9207d57af616b3">02065</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#ab82db97d129c8cfc36780bcdc6286fcc" title="Filter using AddByteToHalf: D = saturation255(S/2 + C)">SDL_imageFilterAddByteToHalf</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> C) <a name="l02066"></a>02066 { <a name="l02067"></a>02067 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Mask[8] = { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F }; <a name="l02068"></a>02068 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l02069"></a>02069 <span class="keywordtype">int</span> iC; <a name="l02070"></a>02070 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1; <a name="l02071"></a>02071 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *curdest; <a name="l02072"></a>02072 <span class="keywordtype">int</span> result; <a name="l02073"></a>02073 <a name="l02074"></a>02074 <span class="comment">/* Validate input parameters */</span> <a name="l02075"></a>02075 <span class="keywordflow">if</span> ((Src1 == NULL) || (Dest == NULL)) <a name="l02076"></a>02076 <span class="keywordflow">return</span>(-1); <a name="l02077"></a>02077 <span class="keywordflow">if</span> (length == 0) <a name="l02078"></a>02078 <span class="keywordflow">return</span>(0); <a name="l02079"></a>02079 <a name="l02080"></a>02080 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l02081"></a>02081 <a name="l02082"></a>02082 <span class="comment">/* MMX routine */</span> <a name="l02083"></a>02083 SDL_imageFilterAddByteToHalfMMX(Src1, Dest, length, C, Mask); <a name="l02084"></a>02084 <a name="l02085"></a>02085 <span class="comment">/* Check for unaligned bytes */</span> <a name="l02086"></a>02086 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l02087"></a>02087 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l02088"></a>02088 istart = length &amp; 0xfffffff8; <a name="l02089"></a>02089 cursrc1 = &amp;Src1[istart]; <a name="l02090"></a>02090 curdest = &amp;Dest[istart]; <a name="l02091"></a>02091 } <span class="keywordflow">else</span> { <a name="l02092"></a>02092 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l02093"></a>02093 <span class="keywordflow">return</span> (0); <a name="l02094"></a>02094 } <a name="l02095"></a>02095 } <span class="keywordflow">else</span> { <a name="l02096"></a>02096 <span class="comment">/* Setup to process whole image */</span> <a name="l02097"></a>02097 istart = 0; <a name="l02098"></a>02098 cursrc1 = Src1; <a name="l02099"></a>02099 curdest = Dest; <a name="l02100"></a>02100 } <a name="l02101"></a>02101 <a name="l02102"></a>02102 <span class="comment">/* C routine to process image */</span> <a name="l02103"></a>02103 iC = (int) C; <a name="l02104"></a>02104 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l02105"></a>02105 result = (int) (*cursrc1 / 2) + iC; <a name="l02106"></a>02106 <span class="keywordflow">if</span> (result &gt; 255) <a name="l02107"></a>02107 result = 255; <a name="l02108"></a>02108 *curdest = (<span class="keywordtype">unsigned</span> char) result; <a name="l02109"></a>02109 <span class="comment">/* Advance pointers */</span> <a name="l02110"></a>02110 cursrc1++; <a name="l02111"></a>02111 curdest++; <a name="l02112"></a>02112 } <a name="l02113"></a>02113 <a name="l02114"></a>02114 <span class="keywordflow">return</span> (0); <a name="l02115"></a>02115 } <a name="l02116"></a>02116 <a name="l02127"></a><a class="code" href="_s_d_l__image_filter_8c.html#a657e128016cc448778007d8b6475dd65">02127</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a657e128016cc448778007d8b6475dd65" title="Internal MMX Filter using SubByte: D = saturation0(S - C)">SDL_imageFilterSubByteMMX</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> C) <a name="l02128"></a>02128 { <a name="l02129"></a>02129 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l02130"></a>02130 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l02131"></a>02131 <span class="preprocessor"></span> __asm <a name="l02132"></a>02132 { <a name="l02133"></a>02133 pusha <a name="l02134"></a>02134 <span class="comment">/* ** Duplicate C in 8 bytes of MM1 ** */</span> <a name="l02135"></a>02135 mov al, C <span class="comment">/* load C into AL */</span> <a name="l02136"></a>02136 mov ah, al <span class="comment">/* copy AL into AH */</span> <a name="l02137"></a>02137 mov bx, ax <span class="comment">/* copy AX into BX */</span> <a name="l02138"></a>02138 shl eax, 16 <span class="comment">/* shift 2 bytes of EAX left */</span> <a name="l02139"></a>02139 mov ax, bx <span class="comment">/* copy BX into AX */</span> <a name="l02140"></a>02140 movd mm1, eax <span class="comment">/* copy EAX into MM1 */</span> <a name="l02141"></a>02141 movd mm2, eax <span class="comment">/* copy EAX into MM2 */</span> <a name="l02142"></a>02142 punpckldq mm1, mm2 <span class="comment">/* fill higher bytes of MM1 with C */</span> <a name="l02143"></a>02143 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l02144"></a>02144 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l02145"></a>02145 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l02146"></a>02146 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l02147"></a>02147 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l02148"></a>02148 L1023: <a name="l02149"></a>02149 movq mm0, [eax] <span class="comment">/* load 8 bytes from SrcDest into MM0 */</span> <a name="l02150"></a>02150 psubusb mm0, mm1 <span class="comment">/* MM0=SrcDest-C (sub 8 bytes with saturation) */</span> <a name="l02151"></a>02151 movq [edi], mm0 <span class="comment">/* store result in SrcDest */</span> <a name="l02152"></a>02152 add eax, 8 <span class="comment">/* increase Src1 register pointer by 8 */</span> <a name="l02153"></a>02153 add edi, 8 <span class="comment">/* increase Dest register pointer by 8 */</span> <a name="l02154"></a>02154 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l02155"></a>02155 jnz L1023 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l02156"></a>02156 emms <span class="comment">/* exit MMX state */</span> <a name="l02157"></a>02157 popa <a name="l02158"></a>02158 } <a name="l02159"></a>02159 <span class="preprocessor">#else</span> <a name="l02160"></a>02160 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l02161"></a>02161 __m64 *mSrc1 = (__m64*)Src1; <a name="l02162"></a>02162 __m64 *mDest = (__m64*)Dest; <a name="l02163"></a>02163 <span class="comment">/* Duplicate C in 8 bytes of MM1 */</span> <a name="l02164"></a>02164 <span class="keywordtype">int</span> i; <a name="l02165"></a>02165 memset(&amp;i, C, 4); <a name="l02166"></a>02166 __m64 mm1 = _m_from_int(i); <a name="l02167"></a>02167 __m64 mm2 = _m_from_int(i); <a name="l02168"></a>02168 mm1 = _m_punpckldq(mm1, mm2); <span class="comment">/* fill higher bytes of MM1 with C */</span> <a name="l02169"></a>02169 <span class="comment">//__m64 mm1 = _m_from_int64(lli); // x86_64 only</span> <a name="l02170"></a>02170 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l02171"></a>02171 *mDest = _m_psubusb(*mSrc1, mm1); <span class="comment">/* Src1-C (sub 8 bytes with saturation) */</span> <a name="l02172"></a>02172 mSrc1++; <a name="l02173"></a>02173 mDest++; <a name="l02174"></a>02174 } <a name="l02175"></a>02175 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l02176"></a>02176 <span class="preprocessor">#endif</span> <a name="l02177"></a>02177 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l02178"></a>02178 <span class="preprocessor">#else</span> <a name="l02179"></a>02179 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l02180"></a>02180 <span class="preprocessor">#endif</span> <a name="l02181"></a>02181 <span class="preprocessor"></span>} <a name="l02182"></a>02182 <a name="l02193"></a><a class="code" href="_s_d_l__image_filter_8h.html#af8f4ab4050a0661c7696783ba1a1b12b">02193</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a387fb6f0d48cc5d08f37f7f9b92d14b2" title="Filter using SubByte: D = saturation0(S - C)">SDL_imageFilterSubByte</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> C) <a name="l02194"></a>02194 { <a name="l02195"></a>02195 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l02196"></a>02196 <span class="keywordtype">int</span> iC; <a name="l02197"></a>02197 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1; <a name="l02198"></a>02198 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *curdest; <a name="l02199"></a>02199 <span class="keywordtype">int</span> result; <a name="l02200"></a>02200 <a name="l02201"></a>02201 <span class="comment">/* Validate input parameters */</span> <a name="l02202"></a>02202 <span class="keywordflow">if</span> ((Src1 == NULL) || (Dest == NULL)) <a name="l02203"></a>02203 <span class="keywordflow">return</span>(-1); <a name="l02204"></a>02204 <span class="keywordflow">if</span> (length == 0) <a name="l02205"></a>02205 <span class="keywordflow">return</span>(0); <a name="l02206"></a>02206 <a name="l02207"></a>02207 <span class="comment">/* Special case: C==0 */</span> <a name="l02208"></a>02208 <span class="keywordflow">if</span> (C == 0) { <a name="l02209"></a>02209 memcpy(Src1, Dest, length); <a name="l02210"></a>02210 <span class="keywordflow">return</span> (0); <a name="l02211"></a>02211 } <a name="l02212"></a>02212 <a name="l02213"></a>02213 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l02214"></a>02214 <a name="l02215"></a>02215 <span class="comment">/* MMX routine */</span> <a name="l02216"></a>02216 <a class="code" href="_s_d_l__image_filter_8c.html#a657e128016cc448778007d8b6475dd65" title="Internal MMX Filter using SubByte: D = saturation0(S - C)">SDL_imageFilterSubByteMMX</a>(Src1, Dest, length, C); <a name="l02217"></a>02217 <a name="l02218"></a>02218 <span class="comment">/* Check for unaligned bytes */</span> <a name="l02219"></a>02219 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l02220"></a>02220 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l02221"></a>02221 istart = length &amp; 0xfffffff8; <a name="l02222"></a>02222 cursrc1 = &amp;Src1[istart]; <a name="l02223"></a>02223 curdest = &amp;Dest[istart]; <a name="l02224"></a>02224 } <span class="keywordflow">else</span> { <a name="l02225"></a>02225 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l02226"></a>02226 <span class="keywordflow">return</span> (0); <a name="l02227"></a>02227 } <a name="l02228"></a>02228 } <span class="keywordflow">else</span> { <a name="l02229"></a>02229 <span class="comment">/* Setup to process whole image */</span> <a name="l02230"></a>02230 istart = 0; <a name="l02231"></a>02231 cursrc1 = Src1; <a name="l02232"></a>02232 curdest = Dest; <a name="l02233"></a>02233 } <a name="l02234"></a>02234 <a name="l02235"></a>02235 <span class="comment">/* C routine to process image */</span> <a name="l02236"></a>02236 iC = (int) C; <a name="l02237"></a>02237 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l02238"></a>02238 result = (int) *cursrc1 - iC; <a name="l02239"></a>02239 <span class="keywordflow">if</span> (result &lt; 0) <a name="l02240"></a>02240 result = 0; <a name="l02241"></a>02241 *curdest = (<span class="keywordtype">unsigned</span> char) result; <a name="l02242"></a>02242 <span class="comment">/* Advance pointers */</span> <a name="l02243"></a>02243 cursrc1++; <a name="l02244"></a>02244 curdest++; <a name="l02245"></a>02245 } <a name="l02246"></a>02246 <span class="keywordflow">return</span> (0); <a name="l02247"></a>02247 } <a name="l02248"></a>02248 <a name="l02260"></a>02260 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterSubUintMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> C, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> D) <a name="l02261"></a>02261 { <a name="l02262"></a>02262 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l02263"></a>02263 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l02264"></a>02264 <span class="preprocessor"></span> __asm <a name="l02265"></a>02265 { <a name="l02266"></a>02266 pusha <a name="l02267"></a>02267 <span class="comment">/* ** Duplicate (int)C in 8 bytes of MM1 ** */</span> <a name="l02268"></a>02268 mov eax, C <span class="comment">/* load C into EAX */</span> <a name="l02269"></a>02269 movd mm1, eax <span class="comment">/* copy EAX into MM1 */</span> <a name="l02270"></a>02270 mov eax, D <span class="comment">/* load D into EAX */</span> <a name="l02271"></a>02271 movd mm2, eax <span class="comment">/* copy EAX into MM2 */</span> <a name="l02272"></a>02272 punpckldq mm1, mm2 <span class="comment">/* fill higher bytes of MM1 with C */</span> <a name="l02273"></a>02273 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l02274"></a>02274 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l02275"></a>02275 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l02276"></a>02276 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l02277"></a>02277 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l02278"></a>02278 L11024: <a name="l02279"></a>02279 movq mm0, [eax] <span class="comment">/* load 8 bytes from SrcDest into MM0 */</span> <a name="l02280"></a>02280 psubusb mm0, mm1 <span class="comment">/* MM0=SrcDest-C (sub 8 bytes with saturation) */</span> <a name="l02281"></a>02281 movq [edi], mm0 <span class="comment">/* store result in SrcDest */</span> <a name="l02282"></a>02282 add eax, 8 <span class="comment">/* increase Src1 register pointer by 8 */</span> <a name="l02283"></a>02283 add edi, 8 <span class="comment">/* increase Dest register pointer by 8 */</span> <a name="l02284"></a>02284 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l02285"></a>02285 jnz L11024 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l02286"></a>02286 emms <span class="comment">/* exit MMX state */</span> <a name="l02287"></a>02287 popa <a name="l02288"></a>02288 } <a name="l02289"></a>02289 <span class="preprocessor">#else</span> <a name="l02290"></a>02290 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l02291"></a>02291 __m64 *mSrc1 = (__m64*)Src1; <a name="l02292"></a>02292 __m64 *mDest = (__m64*)Dest; <a name="l02293"></a>02293 <span class="comment">/* Duplicate (int)C in 8 bytes of MM1 */</span> <a name="l02294"></a>02294 __m64 mm1 = _m_from_int(C); <a name="l02295"></a>02295 __m64 mm2 = _m_from_int(C); <a name="l02296"></a>02296 mm1 = _m_punpckldq(mm1, mm2); <span class="comment">/* fill higher bytes of MM1 with C */</span> <a name="l02297"></a>02297 <span class="comment">//__m64 mm1 = _m_from_int64(lli); // x86_64 only</span> <a name="l02298"></a>02298 <span class="keywordtype">int</span> i; <a name="l02299"></a>02299 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l02300"></a>02300 *mDest = _m_psubusb(*mSrc1, mm1); <span class="comment">/* Src1-C (sub 8 bytes with saturation) */</span> <a name="l02301"></a>02301 mSrc1++; <a name="l02302"></a>02302 mDest++; <a name="l02303"></a>02303 } <a name="l02304"></a>02304 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l02305"></a>02305 <span class="preprocessor">#endif</span> <a name="l02306"></a>02306 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l02307"></a>02307 <span class="preprocessor">#else</span> <a name="l02308"></a>02308 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l02309"></a>02309 <span class="preprocessor">#endif</span> <a name="l02310"></a>02310 <span class="preprocessor"></span>} <a name="l02311"></a>02311 <a name="l02322"></a><a class="code" href="_s_d_l__image_filter_8h.html#ae2f3c5992701bded7c2d256bbbfb403f">02322</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#abb343ef95e22945e1d4d648b2e176e64" title="Filter using SubUint: D = saturation0(S[i] - Cs[i % 4]), Cs=Swap32((uint)C)">SDL_imageFilterSubUint</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> C) <a name="l02323"></a>02323 { <a name="l02324"></a>02324 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, j, istart, D; <a name="l02325"></a>02325 <span class="keywordtype">int</span> iC[4]; <a name="l02326"></a>02326 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1; <a name="l02327"></a>02327 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *curdest; <a name="l02328"></a>02328 <span class="keywordtype">int</span> result; <a name="l02329"></a>02329 <a name="l02330"></a>02330 <span class="comment">/* Validate input parameters */</span> <a name="l02331"></a>02331 <span class="keywordflow">if</span> ((Src1 == NULL) || (Dest == NULL)) <a name="l02332"></a>02332 <span class="keywordflow">return</span>(-1); <a name="l02333"></a>02333 <span class="keywordflow">if</span> (length == 0) <a name="l02334"></a>02334 <span class="keywordflow">return</span>(0); <a name="l02335"></a>02335 <a name="l02336"></a>02336 <span class="comment">/* Special case: C==0 */</span> <a name="l02337"></a>02337 <span class="keywordflow">if</span> (C == 0) { <a name="l02338"></a>02338 memcpy(Src1, Dest, length); <a name="l02339"></a>02339 <span class="keywordflow">return</span> (0); <a name="l02340"></a>02340 } <a name="l02341"></a>02341 <a name="l02342"></a>02342 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l02343"></a>02343 <a name="l02344"></a>02344 <span class="comment">/* MMX routine */</span> <a name="l02345"></a>02345 D=<a class="code" href="_s_d_l__image_filter_8c.html#a700fb30611761c46a674a45cc28ff561" title="Swaps the byte order in a 32bit integer (LSB becomes MSB, etc.).">SWAP_32</a>(C); <a name="l02346"></a>02346 SDL_imageFilterSubUintMMX(Src1, Dest, length, C, D); <a name="l02347"></a>02347 <a name="l02348"></a>02348 <span class="comment">/* Check for unaligned bytes */</span> <a name="l02349"></a>02349 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l02350"></a>02350 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l02351"></a>02351 istart = length &amp; 0xfffffff8; <a name="l02352"></a>02352 cursrc1 = &amp;Src1[istart]; <a name="l02353"></a>02353 curdest = &amp;Dest[istart]; <a name="l02354"></a>02354 } <span class="keywordflow">else</span> { <a name="l02355"></a>02355 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l02356"></a>02356 <span class="keywordflow">return</span> (0); <a name="l02357"></a>02357 } <a name="l02358"></a>02358 } <span class="keywordflow">else</span> { <a name="l02359"></a>02359 <span class="comment">/* Setup to process whole image */</span> <a name="l02360"></a>02360 istart = 0; <a name="l02361"></a>02361 cursrc1 = Src1; <a name="l02362"></a>02362 curdest = Dest; <a name="l02363"></a>02363 } <a name="l02364"></a>02364 <a name="l02365"></a>02365 <span class="comment">/* C routine to process image */</span> <a name="l02366"></a>02366 iC[3] = (int) ((C &gt;&gt; 24) &amp; 0xff); <a name="l02367"></a>02367 iC[2] = (int) ((C &gt;&gt; 16) &amp; 0xff); <a name="l02368"></a>02368 iC[1] = (int) ((C &gt;&gt; 8) &amp; 0xff); <a name="l02369"></a>02369 iC[0] = (int) ((C &gt;&gt; 0) &amp; 0xff); <a name="l02370"></a>02370 <span class="keywordflow">for</span> (i = istart; i &lt; length; i += 4) { <a name="l02371"></a>02371 <span class="keywordflow">for</span> (j = 0; j &lt; 4; j++) { <a name="l02372"></a>02372 <span class="keywordflow">if</span> ((i+j)&lt;length) { <a name="l02373"></a>02373 result = (int) *cursrc1 - iC[j]; <a name="l02374"></a>02374 <span class="keywordflow">if</span> (result &lt; 0) result = 0; <a name="l02375"></a>02375 *curdest = (<span class="keywordtype">unsigned</span> char) result; <a name="l02376"></a>02376 <span class="comment">/* Advance pointers */</span> <a name="l02377"></a>02377 cursrc1++; <a name="l02378"></a>02378 curdest++; <a name="l02379"></a>02379 } <a name="l02380"></a>02380 } <a name="l02381"></a>02381 } <a name="l02382"></a>02382 <span class="keywordflow">return</span> (0); <a name="l02383"></a>02383 } <a name="l02384"></a>02384 <a name="l02396"></a>02396 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterShiftRightMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> N, <a name="l02397"></a>02397 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Mask) <a name="l02398"></a>02398 { <a name="l02399"></a>02399 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l02400"></a>02400 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l02401"></a>02401 <span class="preprocessor"></span> __asm <a name="l02402"></a>02402 { <a name="l02403"></a>02403 pusha <a name="l02404"></a>02404 mov edx, Mask <span class="comment">/* load Mask address into edx */</span> <a name="l02405"></a>02405 movq mm0, [edx] <span class="comment">/* load Mask into mm0 */</span> <a name="l02406"></a>02406 xor ecx, ecx <span class="comment">/* zero ECX */</span> <a name="l02407"></a>02407 mov cl, N <span class="comment">/* load loop counter (N) into CL */</span> <a name="l02408"></a>02408 movd mm3, ecx <span class="comment">/* copy (N) into MM3 */</span> <a name="l02409"></a>02409 pcmpeqb mm1, mm1 <span class="comment">/* generate all 1&#39;s in mm1 */</span> <a name="l02410"></a>02410 L10240: <span class="comment">/* ** Prepare proper bit-Mask in MM1 ** */</span> <a name="l02411"></a>02411 psrlw mm1, 1 <span class="comment">/* shift 4 WORDS of MM1 1 bit to the right */</span> <a name="l02412"></a>02412 pand mm1, mm0 <span class="comment">// apply Mask to 8 BYTES of MM1 */</span> <a name="l02413"></a>02413 <span class="comment">/* byte 0x0f, 0xdb, 0xc8 */</span> <a name="l02414"></a>02414 dec cl <span class="comment">/* decrease loop counter */</span> <a name="l02415"></a>02415 jnz L10240 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l02416"></a>02416 <span class="comment">/* ** Shift all bytes of the image ** */</span> <a name="l02417"></a>02417 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l02418"></a>02418 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l02419"></a>02419 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l02420"></a>02420 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l02421"></a>02421 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l02422"></a>02422 L10241: <a name="l02423"></a>02423 movq mm0, [eax] <span class="comment">/* load 8 bytes from SrcDest into MM0 */</span> <a name="l02424"></a>02424 psrlw mm0, mm3 <span class="comment">/* shift 4 WORDS of MM0 (N) bits to the right */</span> <a name="l02425"></a>02425 pand mm0, mm1 <span class="comment">// apply proper bit-Mask to 8 BYTES of MM0 */</span> <a name="l02426"></a>02426 <span class="comment">/* byte 0x0f, 0xdb, 0xc1 */</span> <a name="l02427"></a>02427 movq [edi], mm0 <span class="comment">/* store result in SrcDest */</span> <a name="l02428"></a>02428 add eax, 8 <span class="comment">/* increase Src1 register pointer by 8 */</span> <a name="l02429"></a>02429 add edi, 8 <span class="comment">/* increase Dest register pointer by 8 */</span> <a name="l02430"></a>02430 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l02431"></a>02431 jnz L10241 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l02432"></a>02432 emms <span class="comment">/* exit MMX state */</span> <a name="l02433"></a>02433 popa <a name="l02434"></a>02434 } <a name="l02435"></a>02435 <span class="preprocessor">#else</span> <a name="l02436"></a>02436 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l02437"></a>02437 __m64 *mSrc1 = (__m64*)Src1; <a name="l02438"></a>02438 __m64 *mDest = (__m64*)Dest; <a name="l02439"></a>02439 __m64 *mMask = (__m64*)Mask; <a name="l02440"></a>02440 __m64 mm1; <a name="l02441"></a>02441 <span class="keywordtype">int</span> i; <a name="l02442"></a>02442 mm1 = _m_pcmpeqb(mm1, mm1); <span class="comment">/* generate all 1&#39;s in mm1 */</span> <a name="l02443"></a>02443 <span class="comment">/* Prepare proper bit-Mask in MM1 */</span> <a name="l02444"></a>02444 <span class="keywordflow">for</span> (i = 0; i &lt; N; i++) { <a name="l02445"></a>02445 mm1 = _m_psrlwi(mm1, 1); <span class="comment">/* shift 4 WORDS of MM1 1 bit to the right */</span> <a name="l02446"></a>02446 mm1 = _m_pand(mm1, *mMask); <span class="comment">/* apply Mask to 8 BYTES of MM1 */</span> <a name="l02447"></a>02447 } <a name="l02448"></a>02448 <span class="comment">/* Shift all bytes of the image */</span> <a name="l02449"></a>02449 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l02450"></a>02450 __m64 mm0 = _m_psrlwi(*mSrc1, N); <span class="comment">/* shift 4 WORDS of MM0 (N) bits to the right */</span> <a name="l02451"></a>02451 *mDest = _m_pand(mm0, mm1); <span class="comment">/* apply proper bit-Mask to 8 BYTES of MM0 */</span> <a name="l02452"></a>02452 mSrc1++; <a name="l02453"></a>02453 mDest++; <a name="l02454"></a>02454 } <a name="l02455"></a>02455 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l02456"></a>02456 <span class="preprocessor">#endif</span> <a name="l02457"></a>02457 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l02458"></a>02458 <span class="preprocessor">#else</span> <a name="l02459"></a>02459 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l02460"></a>02460 <span class="preprocessor">#endif</span> <a name="l02461"></a>02461 <span class="preprocessor"></span>} <a name="l02462"></a>02462 <a name="l02473"></a><a class="code" href="_s_d_l__image_filter_8h.html#a931f1232cd03acd2ba90af222625f4ca">02473</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a68851aed2dcc5dfd2f3b258236f3b88c" title="Filter using ShiftRight: D = saturation0(S &gt;&gt; N)">SDL_imageFilterShiftRight</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> N) <a name="l02474"></a>02474 { <a name="l02475"></a>02475 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Mask[8] = { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F }; <a name="l02476"></a>02476 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l02477"></a>02477 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1; <a name="l02478"></a>02478 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *curdest; <a name="l02479"></a>02479 <a name="l02480"></a>02480 <span class="comment">/* Validate input parameters */</span> <a name="l02481"></a>02481 <span class="keywordflow">if</span> ((Src1 == NULL) || (Dest == NULL)) <a name="l02482"></a>02482 <span class="keywordflow">return</span>(-1); <a name="l02483"></a>02483 <span class="keywordflow">if</span> (length == 0) <a name="l02484"></a>02484 <span class="keywordflow">return</span>(0); <a name="l02485"></a>02485 <a name="l02486"></a>02486 <span class="comment">/* Check shift */</span> <a name="l02487"></a>02487 <span class="keywordflow">if</span> (N &gt; 8) { <a name="l02488"></a>02488 <span class="keywordflow">return</span> (-1); <a name="l02489"></a>02489 } <a name="l02490"></a>02490 <a name="l02491"></a>02491 <span class="comment">/* Special case: N==0 */</span> <a name="l02492"></a>02492 <span class="keywordflow">if</span> (N == 0) { <a name="l02493"></a>02493 memcpy(Src1, Dest, length); <a name="l02494"></a>02494 <span class="keywordflow">return</span> (0); <a name="l02495"></a>02495 } <a name="l02496"></a>02496 <a name="l02497"></a>02497 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l02498"></a>02498 <a name="l02499"></a>02499 <span class="comment">/* MMX routine */</span> <a name="l02500"></a>02500 SDL_imageFilterShiftRightMMX(Src1, Dest, length, N, Mask); <a name="l02501"></a>02501 <a name="l02502"></a>02502 <span class="comment">/* Check for unaligned bytes */</span> <a name="l02503"></a>02503 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l02504"></a>02504 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l02505"></a>02505 istart = length &amp; 0xfffffff8; <a name="l02506"></a>02506 cursrc1 = &amp;Src1[istart]; <a name="l02507"></a>02507 curdest = &amp;Dest[istart]; <a name="l02508"></a>02508 } <span class="keywordflow">else</span> { <a name="l02509"></a>02509 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l02510"></a>02510 <span class="keywordflow">return</span> (0); <a name="l02511"></a>02511 } <a name="l02512"></a>02512 } <span class="keywordflow">else</span> { <a name="l02513"></a>02513 <span class="comment">/* Setup to process whole image */</span> <a name="l02514"></a>02514 istart = 0; <a name="l02515"></a>02515 cursrc1 = Src1; <a name="l02516"></a>02516 curdest = Dest; <a name="l02517"></a>02517 } <a name="l02518"></a>02518 <a name="l02519"></a>02519 <span class="comment">/* C routine to process image */</span> <a name="l02520"></a>02520 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l02521"></a>02521 *curdest = (<span class="keywordtype">unsigned</span> char) *cursrc1 &gt;&gt; N; <a name="l02522"></a>02522 <span class="comment">/* Advance pointers */</span> <a name="l02523"></a>02523 cursrc1++; <a name="l02524"></a>02524 curdest++; <a name="l02525"></a>02525 } <a name="l02526"></a>02526 <a name="l02527"></a>02527 <span class="keywordflow">return</span> (0); <a name="l02528"></a>02528 } <a name="l02529"></a>02529 <a name="l02540"></a>02540 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterShiftRightUintMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> N) <a name="l02541"></a>02541 { <a name="l02542"></a>02542 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l02543"></a>02543 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l02544"></a>02544 <span class="preprocessor"></span> __asm <a name="l02545"></a>02545 { <a name="l02546"></a>02546 pusha <a name="l02547"></a>02547 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l02548"></a>02548 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l02549"></a>02549 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l02550"></a>02550 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l02551"></a>02551 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l02552"></a>02552 L13023: <a name="l02553"></a>02553 movq mm0, [eax] <span class="comment">/* load 8 bytes from SrcDest into MM0 */</span> <a name="l02554"></a>02554 psrld mm0, N <a name="l02555"></a>02555 movq [edi], mm0 <span class="comment">/* store result in SrcDest */</span> <a name="l02556"></a>02556 add eax, 8 <span class="comment">/* increase Src1 register pointer by 8 */</span> <a name="l02557"></a>02557 add edi, 8 <span class="comment">/* increase Dest register pointer by 8 */</span> <a name="l02558"></a>02558 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l02559"></a>02559 jnz L13023 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l02560"></a>02560 emms <span class="comment">/* exit MMX state */</span> <a name="l02561"></a>02561 popa <a name="l02562"></a>02562 } <a name="l02563"></a>02563 <span class="preprocessor">#else</span> <a name="l02564"></a>02564 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l02565"></a>02565 __m64 *mSrc1 = (__m64*)Src1; <a name="l02566"></a>02566 __m64 *mDest = (__m64*)Dest; <a name="l02567"></a>02567 <span class="keywordtype">int</span> i; <a name="l02568"></a>02568 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l02569"></a>02569 *mDest = _m_psrldi(*mSrc1, N); <a name="l02570"></a>02570 mSrc1++; <a name="l02571"></a>02571 mDest++; <a name="l02572"></a>02572 } <a name="l02573"></a>02573 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l02574"></a>02574 <span class="preprocessor">#endif</span> <a name="l02575"></a>02575 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l02576"></a>02576 <span class="preprocessor">#else</span> <a name="l02577"></a>02577 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l02578"></a>02578 <span class="preprocessor">#endif</span> <a name="l02579"></a>02579 <span class="preprocessor"></span>} <a name="l02580"></a>02580 <a name="l02591"></a><a class="code" href="_s_d_l__image_filter_8h.html#a4ccddf5c575cc4d6074c9a54789240a6">02591</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a540d4625d76bcd03318c2a59ce650fdb" title="Filter using ShiftRightUint: D = saturation0((uint)S[i] &gt;&gt; N)">SDL_imageFilterShiftRightUint</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> N) <a name="l02592"></a>02592 { <a name="l02593"></a>02593 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l02594"></a>02594 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1, *curdest; <a name="l02595"></a>02595 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *icursrc1, *icurdest; <a name="l02596"></a>02596 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> result; <a name="l02597"></a>02597 <a name="l02598"></a>02598 <span class="comment">/* Validate input parameters */</span> <a name="l02599"></a>02599 <span class="keywordflow">if</span> ((Src1 == NULL) || (Dest == NULL)) <a name="l02600"></a>02600 <span class="keywordflow">return</span>(-1); <a name="l02601"></a>02601 <span class="keywordflow">if</span> (length == 0) <a name="l02602"></a>02602 <span class="keywordflow">return</span>(0); <a name="l02603"></a>02603 <a name="l02604"></a>02604 <span class="keywordflow">if</span> (N &gt; 32) { <a name="l02605"></a>02605 <span class="keywordflow">return</span> (-1); <a name="l02606"></a>02606 } <a name="l02607"></a>02607 <a name="l02608"></a>02608 <span class="comment">/* Special case: N==0 */</span> <a name="l02609"></a>02609 <span class="keywordflow">if</span> (N == 0) { <a name="l02610"></a>02610 memcpy(Src1, Dest, length); <a name="l02611"></a>02611 <span class="keywordflow">return</span> (0); <a name="l02612"></a>02612 } <a name="l02613"></a>02613 <a name="l02614"></a>02614 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l02615"></a>02615 <a name="l02616"></a>02616 SDL_imageFilterShiftRightUintMMX(Src1, Dest, length, N); <a name="l02617"></a>02617 <a name="l02618"></a>02618 <span class="comment">/* Check for unaligned bytes */</span> <a name="l02619"></a>02619 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l02620"></a>02620 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l02621"></a>02621 istart = length &amp; 0xfffffff8; <a name="l02622"></a>02622 cursrc1 = &amp;Src1[istart]; <a name="l02623"></a>02623 curdest = &amp;Dest[istart]; <a name="l02624"></a>02624 } <span class="keywordflow">else</span> { <a name="l02625"></a>02625 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l02626"></a>02626 <span class="keywordflow">return</span> (0); <a name="l02627"></a>02627 } <a name="l02628"></a>02628 } <span class="keywordflow">else</span> { <a name="l02629"></a>02629 <span class="comment">/* Setup to process whole image */</span> <a name="l02630"></a>02630 istart = 0; <a name="l02631"></a>02631 cursrc1 = Src1; <a name="l02632"></a>02632 curdest = Dest; <a name="l02633"></a>02633 } <a name="l02634"></a>02634 <a name="l02635"></a>02635 <span class="comment">/* C routine to process image */</span> <a name="l02636"></a>02636 icursrc1=(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *)cursrc1; <a name="l02637"></a>02637 icurdest=(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *)curdest; <a name="l02638"></a>02638 <span class="keywordflow">for</span> (i = istart; i &lt; length; i += 4) { <a name="l02639"></a>02639 <span class="keywordflow">if</span> ((i+4)&lt;length) { <a name="l02640"></a>02640 result = ((<span class="keywordtype">unsigned</span> int)*icursrc1 &gt;&gt; N); <a name="l02641"></a>02641 *icurdest = result; <a name="l02642"></a>02642 } <a name="l02643"></a>02643 <span class="comment">/* Advance pointers */</span> <a name="l02644"></a>02644 icursrc1++; <a name="l02645"></a>02645 icurdest++; <a name="l02646"></a>02646 } <a name="l02647"></a>02647 <a name="l02648"></a>02648 <span class="keywordflow">return</span> (0); <a name="l02649"></a>02649 } <a name="l02650"></a>02650 <a name="l02661"></a>02661 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterMultByByteMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> C) <a name="l02662"></a>02662 { <a name="l02663"></a>02663 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l02664"></a>02664 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l02665"></a>02665 <span class="preprocessor"></span> __asm <a name="l02666"></a>02666 { <a name="l02667"></a>02667 pusha <a name="l02668"></a>02668 <span class="comment">/* ** Duplicate C in 4 words of MM1 ** */</span> <a name="l02669"></a>02669 mov al, C <span class="comment">/* load C into AL */</span> <a name="l02670"></a>02670 xor ah, ah <span class="comment">/* zero AH */</span> <a name="l02671"></a>02671 mov bx, ax <span class="comment">/* copy AX into BX */</span> <a name="l02672"></a>02672 shl eax, 16 <span class="comment">/* shift 2 bytes of EAX left */</span> <a name="l02673"></a>02673 mov ax, bx <span class="comment">/* copy BX into AX */</span> <a name="l02674"></a>02674 movd mm1, eax <span class="comment">/* copy EAX into MM1 */</span> <a name="l02675"></a>02675 movd mm2, eax <span class="comment">/* copy EAX into MM2 */</span> <a name="l02676"></a>02676 punpckldq mm1, mm2 <span class="comment">/* fill higher words of MM1 with C */</span> <a name="l02677"></a>02677 pxor mm0, mm0 <span class="comment">/* zero MM0 register */</span> <a name="l02678"></a>02678 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l02679"></a>02679 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l02680"></a>02680 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l02681"></a>02681 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l02682"></a>02682 cmp al, 128 <span class="comment">/* if (C &lt;= 128) execute more efficient code */</span> <a name="l02683"></a>02683 jg L10251 <a name="l02684"></a>02684 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l02685"></a>02685 L10250: <a name="l02686"></a>02686 movq mm3, [eax] <span class="comment">/* load 8 bytes from Src1 into MM3 */</span> <a name="l02687"></a>02687 movq mm4, mm3 <span class="comment">/* copy MM3 into MM4 */</span> <a name="l02688"></a>02688 punpcklbw mm3, mm0 <span class="comment">/* unpack low bytes of SrcDest into words */</span> <a name="l02689"></a>02689 punpckhbw mm4, mm0 <span class="comment">/* unpack high bytes of SrcDest into words */</span> <a name="l02690"></a>02690 pmullw mm3, mm1 <span class="comment">/* mul low bytes of SrcDest and MM1 */</span> <a name="l02691"></a>02691 pmullw mm4, mm1 <span class="comment">/* mul high bytes of SrcDest and MM1 */</span> <a name="l02692"></a>02692 packuswb mm3, mm4 <span class="comment">/* pack words back into bytes with saturation */</span> <a name="l02693"></a>02693 movq [edi], mm3 <span class="comment">/* store result in Dest */</span> <a name="l02694"></a>02694 add eax, 8 <span class="comment">/* increase Src1 register pointer by 8 */</span> <a name="l02695"></a>02695 add edi, 8 <span class="comment">/* increase Dest register pointer by 8 */</span> <a name="l02696"></a>02696 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l02697"></a>02697 jnz L10250 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l02698"></a>02698 jmp L10252 <a name="l02699"></a>02699 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l02700"></a>02700 L10251: <a name="l02701"></a>02701 movq mm3, [eax] <span class="comment">/* load 8 bytes from Src1 into MM3 */</span> <a name="l02702"></a>02702 movq mm4, mm3 <span class="comment">/* copy MM3 into MM4 */</span> <a name="l02703"></a>02703 punpcklbw mm3, mm0 <span class="comment">/* unpack low bytes of SrcDest into words */</span> <a name="l02704"></a>02704 punpckhbw mm4, mm0 <span class="comment">/* unpack high bytes of SrcDest into words */</span> <a name="l02705"></a>02705 pmullw mm3, mm1 <span class="comment">/* mul low bytes of SrcDest and MM1 */</span> <a name="l02706"></a>02706 pmullw mm4, mm1 <span class="comment">/* mul high bytes of SrcDest and MM1 */</span> <a name="l02707"></a>02707 <span class="comment">/* ** Take abs value of the results (signed words) ** */</span> <a name="l02708"></a>02708 movq mm5, mm3 <span class="comment">/* copy mm3 into mm5 */</span> <a name="l02709"></a>02709 movq mm6, mm4 <span class="comment">/* copy mm4 into mm6 */</span> <a name="l02710"></a>02710 psraw mm5, 15 <span class="comment">/* fill mm5 words with word sign bit */</span> <a name="l02711"></a>02711 psraw mm6, 15 <span class="comment">/* fill mm6 words with word sign bit */</span> <a name="l02712"></a>02712 pxor mm3, mm5 <span class="comment">/* take 1&#39;s compliment of only neg words */</span> <a name="l02713"></a>02713 pxor mm4, mm6 <span class="comment">/* take 1&#39;s compliment of only neg words */</span> <a name="l02714"></a>02714 psubsw mm3, mm5 <span class="comment">/* add 1 to only neg words, W-(-1) or W-0 */</span> <a name="l02715"></a>02715 psubsw mm4, mm6 <span class="comment">/* add 1 to only neg words, W-(-1) or W-0 */</span> <a name="l02716"></a>02716 packuswb mm3, mm4 <span class="comment">/* pack words back into bytes with saturation */</span> <a name="l02717"></a>02717 movq [edi], mm3 <span class="comment">/* store result in Dest */</span> <a name="l02718"></a>02718 add eax, 8 <span class="comment">/* increase Src1 register pointer by 8 */</span> <a name="l02719"></a>02719 add edi, 8 <span class="comment">/* increase Dest register pointer by 8 */</span> <a name="l02720"></a>02720 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l02721"></a>02721 jnz L10251 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l02722"></a>02722 L10252: <a name="l02723"></a>02723 emms <span class="comment">/* exit MMX state */</span> <a name="l02724"></a>02724 popa <a name="l02725"></a>02725 } <a name="l02726"></a>02726 <span class="preprocessor">#else</span> <a name="l02727"></a>02727 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l02728"></a>02728 __m64 *mSrc1 = (__m64*)Src1; <a name="l02729"></a>02729 __m64 *mDest = (__m64*)Dest; <a name="l02730"></a>02730 __m64 mm0 = _m_from_int(0); <span class="comment">/* zero mm0 register */</span> <a name="l02731"></a>02731 <span class="comment">/* Duplicate C in 4 words of MM1 */</span> <a name="l02732"></a>02732 <span class="keywordtype">int</span> i; <a name="l02733"></a>02733 i = C | C&lt;&lt;16; <a name="l02734"></a>02734 __m64 mm1 = _m_from_int(i); <a name="l02735"></a>02735 __m64 mm2 = _m_from_int(i); <a name="l02736"></a>02736 mm1 = _m_punpckldq(mm1, mm2); <span class="comment">/* fill higher words of MM1 with C */</span> <a name="l02737"></a>02737 <span class="comment">// long long lli = C | C&lt;&lt;16 | (long long)C&lt;&lt;32 | (long long)C&lt;&lt;48;</span> <a name="l02738"></a>02738 <span class="comment">//__m64 mm1 = _m_from_int64(lli); // x86_64 only</span> <a name="l02739"></a>02739 <span class="keywordflow">if</span> (C &lt;= 128) { <span class="comment">/* if (C &lt;= 128) execute more efficient code */</span> <a name="l02740"></a>02740 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l02741"></a>02741 __m64 mm3, mm4; <a name="l02742"></a>02742 mm3 = _m_punpcklbw(*mSrc1, mm0); <span class="comment">/* unpack low bytes of Src1 into words */</span> <a name="l02743"></a>02743 mm4 = _m_punpckhbw(*mSrc1, mm0); <span class="comment">/* unpack high bytes of Src1 into words */</span> <a name="l02744"></a>02744 mm3 = _m_pmullw(mm3, mm1); <span class="comment">/* mul low bytes of Src1 and MM1 */</span> <a name="l02745"></a>02745 mm4 = _m_pmullw(mm4, mm1); <span class="comment">/* mul high bytes of Src1 and MM1 */</span> <a name="l02746"></a>02746 *mDest = _m_packuswb(mm3, mm4); <span class="comment">/* pack words back into bytes with saturation */</span> <a name="l02747"></a>02747 mSrc1++; <a name="l02748"></a>02748 mDest++; <a name="l02749"></a>02749 } <a name="l02750"></a>02750 } <span class="keywordflow">else</span> { <a name="l02751"></a>02751 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l02752"></a>02752 __m64 mm3, mm4, mm5, mm6; <a name="l02753"></a>02753 mm3 = _m_punpcklbw(*mSrc1, mm0); <span class="comment">/* unpack low bytes of Src1 into words */</span> <a name="l02754"></a>02754 mm4 = _m_punpckhbw(*mSrc1, mm0); <span class="comment">/* unpack high bytes of Src1 into words */</span> <a name="l02755"></a>02755 mm3 = _m_pmullw(mm3, mm1); <span class="comment">/* mul low bytes of Src1 and MM1 */</span> <a name="l02756"></a>02756 mm4 = _m_pmullw(mm4, mm1); <span class="comment">/* mul high bytes of Src1 and MM1 */</span> <a name="l02757"></a>02757 <span class="comment">/* Take abs value of the results (signed words) */</span> <a name="l02758"></a>02758 mm5 = _m_psrawi(mm3, 15); <span class="comment">/* fill mm5 words with word sign bit */</span> <a name="l02759"></a>02759 mm6 = _m_psrawi(mm4, 15); <span class="comment">/* fill mm6 words with word sign bit */</span> <a name="l02760"></a>02760 mm3 = _m_pxor(mm3, mm5); <span class="comment">/* take 1&#39;s compliment of only neg. words */</span> <a name="l02761"></a>02761 mm4 = _m_pxor(mm4, mm6); <span class="comment">/* take 1&#39;s compliment of only neg. words */</span> <a name="l02762"></a>02762 mm3 = _m_psubsw(mm3, mm5); <span class="comment">/* add 1 to only neg. words, W-(-1) or W-0 */</span> <a name="l02763"></a>02763 mm4 = _m_psubsw(mm4, mm6); <span class="comment">/* add 1 to only neg. words, W-(-1) or W-0 */</span> <a name="l02764"></a>02764 *mDest = _m_packuswb(mm3, mm4); <span class="comment">/* pack words back into bytes with saturation */</span> <a name="l02765"></a>02765 mSrc1++; <a name="l02766"></a>02766 mDest++; <a name="l02767"></a>02767 } <a name="l02768"></a>02768 } <a name="l02769"></a>02769 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l02770"></a>02770 <span class="preprocessor">#endif</span> <a name="l02771"></a>02771 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l02772"></a>02772 <span class="preprocessor">#else</span> <a name="l02773"></a>02773 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l02774"></a>02774 <span class="preprocessor">#endif</span> <a name="l02775"></a>02775 <span class="preprocessor"></span>} <a name="l02776"></a>02776 <a name="l02787"></a><a class="code" href="_s_d_l__image_filter_8h.html#add06bb6ea7847fc13a3041ddceb4ac3c">02787</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a06f7a19d6e2fc89d7b48cc45d715806d" title="Filter using MultByByte: D = saturation255(S * C)">SDL_imageFilterMultByByte</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> C) <a name="l02788"></a>02788 { <a name="l02789"></a>02789 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l02790"></a>02790 <span class="keywordtype">int</span> iC; <a name="l02791"></a>02791 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1; <a name="l02792"></a>02792 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *curdest; <a name="l02793"></a>02793 <span class="keywordtype">int</span> result; <a name="l02794"></a>02794 <a name="l02795"></a>02795 <span class="comment">/* Validate input parameters */</span> <a name="l02796"></a>02796 <span class="keywordflow">if</span> ((Src1 == NULL) || (Dest == NULL)) <a name="l02797"></a>02797 <span class="keywordflow">return</span>(-1); <a name="l02798"></a>02798 <span class="keywordflow">if</span> (length == 0) <a name="l02799"></a>02799 <span class="keywordflow">return</span>(0); <a name="l02800"></a>02800 <a name="l02801"></a>02801 <span class="comment">/* Special case: C==1 */</span> <a name="l02802"></a>02802 <span class="keywordflow">if</span> (C == 1) { <a name="l02803"></a>02803 memcpy(Src1, Dest, length); <a name="l02804"></a>02804 <span class="keywordflow">return</span> (0); <a name="l02805"></a>02805 } <a name="l02806"></a>02806 <a name="l02807"></a>02807 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l02808"></a>02808 <a name="l02809"></a>02809 SDL_imageFilterMultByByteMMX(Src1, Dest, length, C); <a name="l02810"></a>02810 <a name="l02811"></a>02811 <span class="comment">/* Check for unaligned bytes */</span> <a name="l02812"></a>02812 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l02813"></a>02813 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l02814"></a>02814 istart = length &amp; 0xfffffff8; <a name="l02815"></a>02815 cursrc1 = &amp;Src1[istart]; <a name="l02816"></a>02816 curdest = &amp;Dest[istart]; <a name="l02817"></a>02817 } <span class="keywordflow">else</span> { <a name="l02818"></a>02818 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l02819"></a>02819 <span class="keywordflow">return</span> (0); <a name="l02820"></a>02820 } <a name="l02821"></a>02821 } <span class="keywordflow">else</span> { <a name="l02822"></a>02822 <span class="comment">/* Setup to process whole image */</span> <a name="l02823"></a>02823 istart = 0; <a name="l02824"></a>02824 cursrc1 = Src1; <a name="l02825"></a>02825 curdest = Dest; <a name="l02826"></a>02826 } <a name="l02827"></a>02827 <a name="l02828"></a>02828 <span class="comment">/* C routine to process image */</span> <a name="l02829"></a>02829 iC = (int) C; <a name="l02830"></a>02830 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l02831"></a>02831 result = (int) *cursrc1 * iC; <a name="l02832"></a>02832 <span class="keywordflow">if</span> (result &gt; 255) <a name="l02833"></a>02833 result = 255; <a name="l02834"></a>02834 *curdest = (<span class="keywordtype">unsigned</span> char) result; <a name="l02835"></a>02835 <span class="comment">/* Advance pointers */</span> <a name="l02836"></a>02836 cursrc1++; <a name="l02837"></a>02837 curdest++; <a name="l02838"></a>02838 } <a name="l02839"></a>02839 <a name="l02840"></a>02840 <span class="keywordflow">return</span> (0); <a name="l02841"></a>02841 } <a name="l02842"></a>02842 <a name="l02854"></a>02854 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterShiftRightAndMultByByteMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> N, <a name="l02855"></a>02855 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> C) <a name="l02856"></a>02856 { <a name="l02857"></a>02857 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l02858"></a>02858 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l02859"></a>02859 <span class="preprocessor"></span> __asm <a name="l02860"></a>02860 { <a name="l02861"></a>02861 pusha <a name="l02862"></a>02862 <span class="comment">/* ** Duplicate C in 4 words of MM1 ** */</span> <a name="l02863"></a>02863 mov al, C <span class="comment">/* load C into AL */</span> <a name="l02864"></a>02864 xor ah, ah <span class="comment">/* zero AH */</span> <a name="l02865"></a>02865 mov bx, ax <span class="comment">/* copy AX into BX */</span> <a name="l02866"></a>02866 shl eax, 16 <span class="comment">/* shift 2 bytes of EAX left */</span> <a name="l02867"></a>02867 mov ax, bx <span class="comment">/* copy BX into AX */</span> <a name="l02868"></a>02868 movd mm1, eax <span class="comment">/* copy EAX into MM1 */</span> <a name="l02869"></a>02869 movd mm2, eax <span class="comment">/* copy EAX into MM2 */</span> <a name="l02870"></a>02870 punpckldq mm1, mm2 <span class="comment">/* fill higher words of MM1 with C */</span> <a name="l02871"></a>02871 xor ecx, ecx <span class="comment">/* zero ECX */</span> <a name="l02872"></a>02872 mov cl, N <span class="comment">/* load N into CL */</span> <a name="l02873"></a>02873 movd mm7, ecx <span class="comment">/* copy N into MM7 */</span> <a name="l02874"></a>02874 pxor mm0, mm0 <span class="comment">/* zero MM0 register */</span> <a name="l02875"></a>02875 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l02876"></a>02876 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l02877"></a>02877 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l02878"></a>02878 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l02879"></a>02879 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l02880"></a>02880 L1026: <a name="l02881"></a>02881 movq mm3, [eax] <span class="comment">/* load 8 bytes from Src1 into MM3 */</span> <a name="l02882"></a>02882 movq mm4, mm3 <span class="comment">/* copy MM3 into MM4 */</span> <a name="l02883"></a>02883 punpcklbw mm3, mm0 <span class="comment">/* unpack low bytes of SrcDest into words */</span> <a name="l02884"></a>02884 punpckhbw mm4, mm0 <span class="comment">/* unpack high bytes of SrcDest into words */</span> <a name="l02885"></a>02885 psrlw mm3, mm7 <span class="comment">/* shift 4 WORDS of MM3 (N) bits to the right */</span> <a name="l02886"></a>02886 psrlw mm4, mm7 <span class="comment">/* shift 4 WORDS of MM4 (N) bits to the right */</span> <a name="l02887"></a>02887 pmullw mm3, mm1 <span class="comment">/* mul low bytes of SrcDest by MM1 */</span> <a name="l02888"></a>02888 pmullw mm4, mm1 <span class="comment">/* mul high bytes of SrcDest by MM1 */</span> <a name="l02889"></a>02889 packuswb mm3, mm4 <span class="comment">/* pack words back into bytes with saturation */</span> <a name="l02890"></a>02890 movq [edi], mm3 <span class="comment">/* store result in Dest */</span> <a name="l02891"></a>02891 add eax, 8 <span class="comment">/* increase Src1 register pointer by 8 */</span> <a name="l02892"></a>02892 add edi, 8 <span class="comment">/* increase Dest register pointer by 8 */</span> <a name="l02893"></a>02893 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l02894"></a>02894 jnz L1026 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l02895"></a>02895 emms <span class="comment">/* exit MMX state */</span> <a name="l02896"></a>02896 popa <a name="l02897"></a>02897 } <a name="l02898"></a>02898 <span class="preprocessor">#else</span> <a name="l02899"></a>02899 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l02900"></a>02900 __m64 *mSrc1 = (__m64*)Src1; <a name="l02901"></a>02901 __m64 *mDest = (__m64*)Dest; <a name="l02902"></a>02902 __m64 mm0 = _m_from_int(0); <span class="comment">/* zero mm0 register */</span> <a name="l02903"></a>02903 <span class="comment">/* Duplicate C in 4 words of MM1 */</span> <a name="l02904"></a>02904 <span class="keywordtype">int</span> i; <a name="l02905"></a>02905 i = (C&lt;&lt;16)|C; <a name="l02906"></a>02906 __m64 mm1 = _m_from_int(i); <a name="l02907"></a>02907 __m64 mm2 = _m_from_int(i); <a name="l02908"></a>02908 mm1 = _m_punpckldq(mm1, mm2); <span class="comment">/* fill higher words of MM1 with C */</span> <a name="l02909"></a>02909 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l02910"></a>02910 __m64 mm3, mm4, mm5, mm6; <a name="l02911"></a>02911 mm3 = _m_punpcklbw(*mSrc1, mm0); <span class="comment">/* unpack low bytes of Src1 into words */</span> <a name="l02912"></a>02912 mm4 = _m_punpckhbw(*mSrc1, mm0); <span class="comment">/* unpack high bytes of Src1 into words */</span> <a name="l02913"></a>02913 mm3 = _m_psrlwi(mm3, N); <span class="comment">/* shift 4 WORDS of MM3 (N) bits to the right */</span> <a name="l02914"></a>02914 mm4 = _m_psrlwi(mm4, N); <span class="comment">/* shift 4 WORDS of MM4 (N) bits to the right */</span> <a name="l02915"></a>02915 mm3 = _m_pmullw(mm3, mm1); <span class="comment">/* mul low bytes of Src1 and MM1 */</span> <a name="l02916"></a>02916 mm4 = _m_pmullw(mm4, mm1); <span class="comment">/* mul high bytes of Src1 and MM1 */</span> <a name="l02917"></a>02917 *mDest = _m_packuswb(mm3, mm4); <span class="comment">/* pack words back into bytes with saturation */</span> <a name="l02918"></a>02918 mSrc1++; <a name="l02919"></a>02919 mDest++; <a name="l02920"></a>02920 } <a name="l02921"></a>02921 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l02922"></a>02922 <span class="preprocessor">#endif</span> <a name="l02923"></a>02923 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l02924"></a>02924 <span class="preprocessor">#else</span> <a name="l02925"></a>02925 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l02926"></a>02926 <span class="preprocessor">#endif</span> <a name="l02927"></a>02927 <span class="preprocessor"></span>} <a name="l02928"></a>02928 <a name="l02940"></a><a class="code" href="_s_d_l__image_filter_8h.html#a40e1e21ede9a7ed1eddac2cdbfd0b079">02940</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a0713d6c267fba9756d6beae81e89f9e4" title="Filter using ShiftRightAndMultByByte: D = saturation255((S &gt;&gt; N) * C)">SDL_imageFilterShiftRightAndMultByByte</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> N, <a name="l02941"></a>02941 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> C) <a name="l02942"></a>02942 { <a name="l02943"></a>02943 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l02944"></a>02944 <span class="keywordtype">int</span> iC; <a name="l02945"></a>02945 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1; <a name="l02946"></a>02946 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *curdest; <a name="l02947"></a>02947 <span class="keywordtype">int</span> result; <a name="l02948"></a>02948 <a name="l02949"></a>02949 <span class="comment">/* Validate input parameters */</span> <a name="l02950"></a>02950 <span class="keywordflow">if</span> ((Src1 == NULL) || (Dest == NULL)) <a name="l02951"></a>02951 <span class="keywordflow">return</span>(-1); <a name="l02952"></a>02952 <span class="keywordflow">if</span> (length == 0) <a name="l02953"></a>02953 <span class="keywordflow">return</span>(0); <a name="l02954"></a>02954 <a name="l02955"></a>02955 <span class="comment">/* Check shift */</span> <a name="l02956"></a>02956 <span class="keywordflow">if</span> (N &gt; 8) { <a name="l02957"></a>02957 <span class="keywordflow">return</span> (-1); <a name="l02958"></a>02958 } <a name="l02959"></a>02959 <a name="l02960"></a>02960 <span class="comment">/* Special case: N==0 &amp;&amp; C==1 */</span> <a name="l02961"></a>02961 <span class="keywordflow">if</span> ((N == 0) &amp;&amp; (C == 1)) { <a name="l02962"></a>02962 memcpy(Src1, Dest, length); <a name="l02963"></a>02963 <span class="keywordflow">return</span> (0); <a name="l02964"></a>02964 } <a name="l02965"></a>02965 <a name="l02966"></a>02966 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l02967"></a>02967 <a name="l02968"></a>02968 SDL_imageFilterShiftRightAndMultByByteMMX(Src1, Dest, length, N, C); <a name="l02969"></a>02969 <a name="l02970"></a>02970 <span class="comment">/* Check for unaligned bytes */</span> <a name="l02971"></a>02971 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l02972"></a>02972 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l02973"></a>02973 istart = length &amp; 0xfffffff8; <a name="l02974"></a>02974 cursrc1 = &amp;Src1[istart]; <a name="l02975"></a>02975 curdest = &amp;Dest[istart]; <a name="l02976"></a>02976 } <span class="keywordflow">else</span> { <a name="l02977"></a>02977 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l02978"></a>02978 <span class="keywordflow">return</span> (0); <a name="l02979"></a>02979 } <a name="l02980"></a>02980 } <span class="keywordflow">else</span> { <a name="l02981"></a>02981 <span class="comment">/* Setup to process whole image */</span> <a name="l02982"></a>02982 istart = 0; <a name="l02983"></a>02983 cursrc1 = Src1; <a name="l02984"></a>02984 curdest = Dest; <a name="l02985"></a>02985 } <a name="l02986"></a>02986 <a name="l02987"></a>02987 <span class="comment">/* C routine to process image */</span> <a name="l02988"></a>02988 iC = (int) C; <a name="l02989"></a>02989 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l02990"></a>02990 result = (int) (*cursrc1 &gt;&gt; N) * iC; <a name="l02991"></a>02991 <span class="keywordflow">if</span> (result &gt; 255) <a name="l02992"></a>02992 result = 255; <a name="l02993"></a>02993 *curdest = (<span class="keywordtype">unsigned</span> char) result; <a name="l02994"></a>02994 <span class="comment">/* Advance pointers */</span> <a name="l02995"></a>02995 cursrc1++; <a name="l02996"></a>02996 curdest++; <a name="l02997"></a>02997 } <a name="l02998"></a>02998 <a name="l02999"></a>02999 <span class="keywordflow">return</span> (0); <a name="l03000"></a>03000 } <a name="l03001"></a>03001 <a name="l03013"></a>03013 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterShiftLeftByteMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> N, <a name="l03014"></a>03014 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Mask) <a name="l03015"></a>03015 { <a name="l03016"></a>03016 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l03017"></a>03017 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l03018"></a>03018 <span class="preprocessor"></span> __asm <a name="l03019"></a>03019 { <a name="l03020"></a>03020 pusha <a name="l03021"></a>03021 mov edx, Mask <span class="comment">/* load Mask address into edx */</span> <a name="l03022"></a>03022 movq mm0, [edx] <span class="comment">/* load Mask into mm0 */</span> <a name="l03023"></a>03023 xor ecx, ecx <span class="comment">/* zero ECX */</span> <a name="l03024"></a>03024 mov cl, N <span class="comment">/* load loop counter (N) into CL */</span> <a name="l03025"></a>03025 movd mm3, ecx <span class="comment">/* copy (N) into MM3 */</span> <a name="l03026"></a>03026 pcmpeqb mm1, mm1 <span class="comment">/* generate all 1&#39;s in mm1 */</span> <a name="l03027"></a>03027 L10270: <span class="comment">/* ** Prepare proper bit-Mask in MM1 ** */</span> <a name="l03028"></a>03028 psllw mm1, 1 <span class="comment">/* shift 4 WORDS of MM1 1 bit to the left */</span> <a name="l03029"></a>03029 pand mm1, mm0 <span class="comment">// apply Mask to 8 BYTES of MM1 */</span> <a name="l03030"></a>03030 <span class="comment">/* byte 0x0f, 0xdb, 0xc8 */</span> <a name="l03031"></a>03031 dec cl <span class="comment">/* decrease loop counter */</span> <a name="l03032"></a>03032 jnz L10270 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l03033"></a>03033 <span class="comment">/* ** Shift all bytes of the image ** */</span> <a name="l03034"></a>03034 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l03035"></a>03035 mov edi, Dest <span class="comment">/* load SrcDest address into edi */</span> <a name="l03036"></a>03036 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l03037"></a>03037 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l03038"></a>03038 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l03039"></a>03039 L10271: <a name="l03040"></a>03040 movq mm0, [eax] <span class="comment">/* load 8 bytes from Src1 into MM0 */</span> <a name="l03041"></a>03041 psllw mm0, mm3 <span class="comment">/* shift 4 WORDS of MM0 (N) bits to the left */</span> <a name="l03042"></a>03042 pand mm0, mm1 <span class="comment">// apply proper bit-Mask to 8 BYTES of MM0 */</span> <a name="l03043"></a>03043 <span class="comment">/* byte 0x0f, 0xdb, 0xc1 */</span> <a name="l03044"></a>03044 movq [edi], mm0 <span class="comment">/* store result in Dest */</span> <a name="l03045"></a>03045 add eax, 8 <span class="comment">/* increase Src1 register pointer by 8 */</span> <a name="l03046"></a>03046 add edi, 8 <span class="comment">/* increase Dest register pointer by 8 */</span> <a name="l03047"></a>03047 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l03048"></a>03048 jnz L10271 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l03049"></a>03049 emms <span class="comment">/* exit MMX state */</span> <a name="l03050"></a>03050 popa <a name="l03051"></a>03051 } <a name="l03052"></a>03052 <span class="preprocessor">#else</span> <a name="l03053"></a>03053 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l03054"></a>03054 __m64 *mSrc1 = (__m64*)Src1; <a name="l03055"></a>03055 __m64 *mDest = (__m64*)Dest; <a name="l03056"></a>03056 __m64 *mMask = (__m64*)Mask; <a name="l03057"></a>03057 __m64 mm1; <a name="l03058"></a>03058 <span class="keywordtype">int</span> i; <a name="l03059"></a>03059 mm1 = _m_pcmpeqb(mm1, mm1); <span class="comment">/* generate all 1&#39;s in mm1 */</span> <a name="l03060"></a>03060 <span class="comment">/* Prepare proper bit-Mask in MM1 */</span> <a name="l03061"></a>03061 <span class="keywordflow">for</span> (i = 0; i &lt; N; i++) { <a name="l03062"></a>03062 mm1 = _m_psllwi(mm1, 1); <span class="comment">/* shift 4 WORDS of MM1 1 bit to the left */</span> <a name="l03063"></a>03063 mm1 = _m_pand(mm1, *mMask); <span class="comment">/* apply Mask to 8 BYTES of MM1 */</span> <a name="l03064"></a>03064 } <a name="l03065"></a>03065 <span class="comment">/* ** Shift all bytes of the image ** */</span> <a name="l03066"></a>03066 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l03067"></a>03067 __m64 mm0 = _m_psllwi(*mSrc1, N); <span class="comment">/* shift 4 WORDS of MM0 (N) bits to the left */</span> <a name="l03068"></a>03068 *mDest = _m_pand(mm0, mm1); <span class="comment">/* apply proper bit-Mask to 8 BYTES of MM0 */</span> <a name="l03069"></a>03069 mSrc1++; <a name="l03070"></a>03070 mDest++; <a name="l03071"></a>03071 } <a name="l03072"></a>03072 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l03073"></a>03073 <span class="preprocessor">#endif</span> <a name="l03074"></a>03074 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l03075"></a>03075 <span class="preprocessor">#else</span> <a name="l03076"></a>03076 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l03077"></a>03077 <span class="preprocessor">#endif</span> <a name="l03078"></a>03078 <span class="preprocessor"></span>} <a name="l03079"></a>03079 <a name="l03090"></a><a class="code" href="_s_d_l__image_filter_8h.html#ac32f1ea9acbee51c2db94224ef6f7fd2">03090</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a4561a73b249a26babc4c469ffbdae604" title="Filter using ShiftLeftByte: D = (S &lt;&lt; N)">SDL_imageFilterShiftLeftByte</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> N) <a name="l03091"></a>03091 { <a name="l03092"></a>03092 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Mask[8] = { 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE }; <a name="l03093"></a>03093 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l03094"></a>03094 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1, *curdest; <a name="l03095"></a>03095 <span class="keywordtype">int</span> result; <a name="l03096"></a>03096 <a name="l03097"></a>03097 <span class="comment">/* Validate input parameters */</span> <a name="l03098"></a>03098 <span class="keywordflow">if</span> ((Src1 == NULL) || (Dest == NULL)) <a name="l03099"></a>03099 <span class="keywordflow">return</span>(-1); <a name="l03100"></a>03100 <span class="keywordflow">if</span> (length == 0) <a name="l03101"></a>03101 <span class="keywordflow">return</span>(0); <a name="l03102"></a>03102 <a name="l03103"></a>03103 <span class="keywordflow">if</span> (N &gt; 8) { <a name="l03104"></a>03104 <span class="keywordflow">return</span> (-1); <a name="l03105"></a>03105 } <a name="l03106"></a>03106 <a name="l03107"></a>03107 <span class="comment">/* Special case: N==0 */</span> <a name="l03108"></a>03108 <span class="keywordflow">if</span> (N == 0) { <a name="l03109"></a>03109 memcpy(Src1, Dest, length); <a name="l03110"></a>03110 <span class="keywordflow">return</span> (0); <a name="l03111"></a>03111 } <a name="l03112"></a>03112 <a name="l03113"></a>03113 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l03114"></a>03114 <a name="l03115"></a>03115 SDL_imageFilterShiftLeftByteMMX(Src1, Dest, length, N, Mask); <a name="l03116"></a>03116 <a name="l03117"></a>03117 <span class="comment">/* Check for unaligned bytes */</span> <a name="l03118"></a>03118 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l03119"></a>03119 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l03120"></a>03120 istart = length &amp; 0xfffffff8; <a name="l03121"></a>03121 cursrc1 = &amp;Src1[istart]; <a name="l03122"></a>03122 curdest = &amp;Dest[istart]; <a name="l03123"></a>03123 } <span class="keywordflow">else</span> { <a name="l03124"></a>03124 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l03125"></a>03125 <span class="keywordflow">return</span> (0); <a name="l03126"></a>03126 } <a name="l03127"></a>03127 } <span class="keywordflow">else</span> { <a name="l03128"></a>03128 <span class="comment">/* Setup to process whole image */</span> <a name="l03129"></a>03129 istart = 0; <a name="l03130"></a>03130 cursrc1 = Src1; <a name="l03131"></a>03131 curdest = Dest; <a name="l03132"></a>03132 } <a name="l03133"></a>03133 <a name="l03134"></a>03134 <span class="comment">/* C routine to process image */</span> <a name="l03135"></a>03135 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l03136"></a>03136 result = ((int) *cursrc1 &lt;&lt; N) &amp; 0xff; <a name="l03137"></a>03137 *curdest = (<span class="keywordtype">unsigned</span> char) result; <a name="l03138"></a>03138 <span class="comment">/* Advance pointers */</span> <a name="l03139"></a>03139 cursrc1++; <a name="l03140"></a>03140 curdest++; <a name="l03141"></a>03141 } <a name="l03142"></a>03142 <a name="l03143"></a>03143 <span class="keywordflow">return</span> (0); <a name="l03144"></a>03144 } <a name="l03145"></a>03145 <a name="l03156"></a>03156 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterShiftLeftUintMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> N) <a name="l03157"></a>03157 { <a name="l03158"></a>03158 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l03159"></a>03159 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l03160"></a>03160 <span class="preprocessor"></span> __asm <a name="l03161"></a>03161 { <a name="l03162"></a>03162 pusha <a name="l03163"></a>03163 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l03164"></a>03164 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l03165"></a>03165 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l03166"></a>03166 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l03167"></a>03167 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l03168"></a>03168 L12023: <a name="l03169"></a>03169 movq mm0, [eax] <span class="comment">/* load 8 bytes from SrcDest into MM0 */</span> <a name="l03170"></a>03170 pslld mm0, N <span class="comment">/* MM0=SrcDest+C (add 8 bytes with saturation) */</span> <a name="l03171"></a>03171 movq [edi], mm0 <span class="comment">/* store result in SrcDest */</span> <a name="l03172"></a>03172 add eax, 8 <span class="comment">/* increase Src1 register pointer by 8 */</span> <a name="l03173"></a>03173 add edi, 8 <span class="comment">/* increase Dest register pointer by 8 */</span> <a name="l03174"></a>03174 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l03175"></a>03175 jnz L12023 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l03176"></a>03176 emms <span class="comment">/* exit MMX state */</span> <a name="l03177"></a>03177 popa <a name="l03178"></a>03178 } <a name="l03179"></a>03179 <span class="preprocessor">#else</span> <a name="l03180"></a>03180 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l03181"></a>03181 __m64 *mSrc1 = (__m64*)Src1; <a name="l03182"></a>03182 __m64 *mDest = (__m64*)Dest; <a name="l03183"></a>03183 <span class="keywordtype">int</span> i; <a name="l03184"></a>03184 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l03185"></a>03185 *mDest = _m_pslldi(*mSrc1, N); <span class="comment">/* Src1+C (add 8 bytes with saturation) */</span> <a name="l03186"></a>03186 mSrc1++; <a name="l03187"></a>03187 mDest++; <a name="l03188"></a>03188 } <a name="l03189"></a>03189 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l03190"></a>03190 <span class="preprocessor">#endif</span> <a name="l03191"></a>03191 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l03192"></a>03192 <span class="preprocessor">#else</span> <a name="l03193"></a>03193 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l03194"></a>03194 <span class="preprocessor">#endif</span> <a name="l03195"></a>03195 <span class="preprocessor"></span>} <a name="l03196"></a>03196 <a name="l03207"></a><a class="code" href="_s_d_l__image_filter_8h.html#a4fd6d4a9711c13163496587454d9f1a2">03207</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a250e796fb2db470da0a78b74b78114e8" title="Filter using ShiftLeftUint: D = ((uint)S &lt;&lt; N)">SDL_imageFilterShiftLeftUint</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> N) <a name="l03208"></a>03208 { <a name="l03209"></a>03209 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l03210"></a>03210 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1, *curdest; <a name="l03211"></a>03211 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *icursrc1, *icurdest; <a name="l03212"></a>03212 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> result; <a name="l03213"></a>03213 <a name="l03214"></a>03214 <span class="comment">/* Validate input parameters */</span> <a name="l03215"></a>03215 <span class="keywordflow">if</span> ((Src1 == NULL) || (Dest == NULL)) <a name="l03216"></a>03216 <span class="keywordflow">return</span>(-1); <a name="l03217"></a>03217 <span class="keywordflow">if</span> (length == 0) <a name="l03218"></a>03218 <span class="keywordflow">return</span>(0); <a name="l03219"></a>03219 <a name="l03220"></a>03220 <span class="keywordflow">if</span> (N &gt; 32) { <a name="l03221"></a>03221 <span class="keywordflow">return</span> (-1); <a name="l03222"></a>03222 } <a name="l03223"></a>03223 <a name="l03224"></a>03224 <span class="comment">/* Special case: N==0 */</span> <a name="l03225"></a>03225 <span class="keywordflow">if</span> (N == 0) { <a name="l03226"></a>03226 memcpy(Src1, Dest, length); <a name="l03227"></a>03227 <span class="keywordflow">return</span> (0); <a name="l03228"></a>03228 } <a name="l03229"></a>03229 <a name="l03230"></a>03230 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l03231"></a>03231 <a name="l03232"></a>03232 SDL_imageFilterShiftLeftUintMMX(Src1, Dest, length, N); <a name="l03233"></a>03233 <a name="l03234"></a>03234 <span class="comment">/* Check for unaligned bytes */</span> <a name="l03235"></a>03235 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l03236"></a>03236 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l03237"></a>03237 istart = length &amp; 0xfffffff8; <a name="l03238"></a>03238 cursrc1 = &amp;Src1[istart]; <a name="l03239"></a>03239 curdest = &amp;Dest[istart]; <a name="l03240"></a>03240 } <span class="keywordflow">else</span> { <a name="l03241"></a>03241 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l03242"></a>03242 <span class="keywordflow">return</span> (0); <a name="l03243"></a>03243 } <a name="l03244"></a>03244 } <span class="keywordflow">else</span> { <a name="l03245"></a>03245 <span class="comment">/* Setup to process whole image */</span> <a name="l03246"></a>03246 istart = 0; <a name="l03247"></a>03247 cursrc1 = Src1; <a name="l03248"></a>03248 curdest = Dest; <a name="l03249"></a>03249 } <a name="l03250"></a>03250 <a name="l03251"></a>03251 <span class="comment">/* C routine to process image */</span> <a name="l03252"></a>03252 icursrc1=(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *)cursrc1; <a name="l03253"></a>03253 icurdest=(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *)curdest; <a name="l03254"></a>03254 <span class="keywordflow">for</span> (i = istart; i &lt; length; i += 4) { <a name="l03255"></a>03255 <span class="keywordflow">if</span> ((i+4)&lt;length) { <a name="l03256"></a>03256 result = ((<span class="keywordtype">unsigned</span> int)*icursrc1 &lt;&lt; N); <a name="l03257"></a>03257 *icurdest = result; <a name="l03258"></a>03258 } <a name="l03259"></a>03259 <span class="comment">/* Advance pointers */</span> <a name="l03260"></a>03260 icursrc1++; <a name="l03261"></a>03261 icurdest++; <a name="l03262"></a>03262 } <a name="l03263"></a>03263 <a name="l03264"></a>03264 <span class="keywordflow">return</span> (0); <a name="l03265"></a>03265 } <a name="l03266"></a>03266 <a name="l03277"></a>03277 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterShiftLeftMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> N) <a name="l03278"></a>03278 { <a name="l03279"></a>03279 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l03280"></a>03280 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l03281"></a>03281 <span class="preprocessor"></span> __asm <a name="l03282"></a>03282 { <a name="l03283"></a>03283 pusha <a name="l03284"></a>03284 xor eax, eax <span class="comment">/* zero EAX */</span> <a name="l03285"></a>03285 mov al, N <span class="comment">/* load N into AL */</span> <a name="l03286"></a>03286 movd mm7, eax <span class="comment">/* copy N into MM7 */</span> <a name="l03287"></a>03287 pxor mm0, mm0 <span class="comment">/* zero MM0 register */</span> <a name="l03288"></a>03288 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l03289"></a>03289 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l03290"></a>03290 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l03291"></a>03291 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l03292"></a>03292 cmp al, 7 <span class="comment">/* if (N &lt;= 7) execute more efficient code */</span> <a name="l03293"></a>03293 jg L10281 <a name="l03294"></a>03294 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l03295"></a>03295 L10280: <a name="l03296"></a>03296 movq mm3, [eax] <span class="comment">/* load 8 bytes from Src1 into MM3 */</span> <a name="l03297"></a>03297 movq mm4, mm3 <span class="comment">/* copy MM3 into MM4 */</span> <a name="l03298"></a>03298 punpcklbw mm3, mm0 <span class="comment">/* unpack low bytes of SrcDest into words */</span> <a name="l03299"></a>03299 punpckhbw mm4, mm0 <span class="comment">/* unpack high bytes of SrcDest into words */</span> <a name="l03300"></a>03300 psllw mm3, mm7 <span class="comment">/* shift 4 WORDS of MM3 (N) bits to the left */</span> <a name="l03301"></a>03301 psllw mm4, mm7 <span class="comment">/* shift 4 WORDS of MM4 (N) bits to the left */</span> <a name="l03302"></a>03302 packuswb mm3, mm4 <span class="comment">/* pack words back into bytes with saturation */</span> <a name="l03303"></a>03303 movq [edi], mm3 <span class="comment">/* store result in Dest */</span> <a name="l03304"></a>03304 add eax, 8 <span class="comment">/* increase Src1 register pointer by 8 */</span> <a name="l03305"></a>03305 add edi, 8 <span class="comment">/* increase Dest register pointer by 8 */</span> <a name="l03306"></a>03306 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l03307"></a>03307 jnz L10280 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l03308"></a>03308 jmp L10282 <a name="l03309"></a>03309 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l03310"></a>03310 L10281: <a name="l03311"></a>03311 movq mm3, [eax] <span class="comment">/* load 8 bytes from Src1 into MM3 */</span> <a name="l03312"></a>03312 movq mm4, mm3 <span class="comment">/* copy MM3 into MM4 */</span> <a name="l03313"></a>03313 punpcklbw mm3, mm0 <span class="comment">/* unpack low bytes of SrcDest into words */</span> <a name="l03314"></a>03314 punpckhbw mm4, mm0 <span class="comment">/* unpack high bytes of SrcDest into words */</span> <a name="l03315"></a>03315 psllw mm3, mm7 <span class="comment">/* shift 4 WORDS of MM3 (N) bits to the left */</span> <a name="l03316"></a>03316 psllw mm4, mm7 <span class="comment">/* shift 4 WORDS of MM4 (N) bits to the left */</span> <a name="l03317"></a>03317 <span class="comment">/* ** Take abs value of the signed words ** */</span> <a name="l03318"></a>03318 movq mm5, mm3 <span class="comment">/* copy mm3 into mm5 */</span> <a name="l03319"></a>03319 movq mm6, mm4 <span class="comment">/* copy mm4 into mm6 */</span> <a name="l03320"></a>03320 psraw mm5, 15 <span class="comment">/* fill mm5 words with word sign bit */</span> <a name="l03321"></a>03321 psraw mm6, 15 <span class="comment">/* fill mm6 words with word sign bit */</span> <a name="l03322"></a>03322 pxor mm3, mm5 <span class="comment">/* take 1&#39;s compliment of only neg words */</span> <a name="l03323"></a>03323 pxor mm4, mm6 <span class="comment">/* take 1&#39;s compliment of only neg words */</span> <a name="l03324"></a>03324 psubsw mm3, mm5 <span class="comment">/* add 1 to only neg words, W-(-1) or W-0 */</span> <a name="l03325"></a>03325 psubsw mm4, mm6 <span class="comment">/* add 1 to only neg words, W-(-1) or W-0 */</span> <a name="l03326"></a>03326 packuswb mm3, mm4 <span class="comment">/* pack words back into bytes with saturation */</span> <a name="l03327"></a>03327 movq [edi], mm3 <span class="comment">/* store result in Dest */</span> <a name="l03328"></a>03328 add eax, 8 <span class="comment">/* increase Src1 register pointer by 8 */</span> <a name="l03329"></a>03329 add edi, 8 <span class="comment">/* increase Dest register pointer by 8 */</span> <a name="l03330"></a>03330 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l03331"></a>03331 jnz L10281 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l03332"></a>03332 L10282: <a name="l03333"></a>03333 emms <span class="comment">/* exit MMX state */</span> <a name="l03334"></a>03334 popa <a name="l03335"></a>03335 } <a name="l03336"></a>03336 <span class="preprocessor">#else</span> <a name="l03337"></a>03337 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l03338"></a>03338 __m64 *mSrc1 = (__m64*)Src1; <a name="l03339"></a>03339 __m64 *mDest = (__m64*)Dest; <a name="l03340"></a>03340 __m64 mm0 = _m_from_int(0); <span class="comment">/* zero mm0 register */</span> <a name="l03341"></a>03341 <span class="keywordtype">int</span> i; <a name="l03342"></a>03342 <span class="keywordflow">if</span> (N &lt;= 7) { <span class="comment">/* if (N &lt;= 7) execute more efficient code */</span> <a name="l03343"></a>03343 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l03344"></a>03344 __m64 mm3, mm4; <a name="l03345"></a>03345 mm3 = _m_punpcklbw(*mSrc1, mm0); <span class="comment">/* unpack low bytes of Src1 into words */</span> <a name="l03346"></a>03346 mm4 = _m_punpckhbw(*mSrc1, mm0); <span class="comment">/* unpack high bytes of Src1 into words */</span> <a name="l03347"></a>03347 mm3 = _m_psllwi(mm3, N); <span class="comment">/* shift 4 WORDS of MM3 (N) bits to the left */</span> <a name="l03348"></a>03348 mm4 = _m_psllwi(mm4, N); <span class="comment">/* shift 4 WORDS of MM4 (N) bits to the left */</span> <a name="l03349"></a>03349 *mDest = _m_packuswb(mm3, mm4); <span class="comment">/* pack words back into bytes with saturation */</span> <a name="l03350"></a>03350 mSrc1++; <a name="l03351"></a>03351 mDest++; <a name="l03352"></a>03352 } <a name="l03353"></a>03353 } <span class="keywordflow">else</span> { <a name="l03354"></a>03354 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l03355"></a>03355 __m64 mm3, mm4, mm5, mm6; <a name="l03356"></a>03356 mm3 = _m_punpcklbw(*mSrc1, mm0); <span class="comment">/* unpack low bytes of Src1 into words */</span> <a name="l03357"></a>03357 mm4 = _m_punpckhbw(*mSrc1, mm0); <span class="comment">/* unpack high bytes of Src1 into words */</span> <a name="l03358"></a>03358 mm3 = _m_psllwi(mm3, N); <span class="comment">/* shift 4 WORDS of MM3 (N) bits to the left */</span> <a name="l03359"></a>03359 mm4 = _m_psllwi(mm4, N); <span class="comment">/* shift 4 WORDS of MM4 (N) bits to the left */</span> <a name="l03360"></a>03360 <span class="comment">/* Take abs value of the signed words */</span> <a name="l03361"></a>03361 mm5 = _m_psrawi(mm3, 15); <span class="comment">/* fill mm5 words with word sign bit */</span> <a name="l03362"></a>03362 mm6 = _m_psrawi(mm4, 15); <span class="comment">/* fill mm6 words with word sign bit */</span> <a name="l03363"></a>03363 mm3 = _m_pxor(mm3, mm5); <span class="comment">/* take 1&#39;s compliment of only neg. words */</span> <a name="l03364"></a>03364 mm4 = _m_pxor(mm4, mm6); <span class="comment">/* take 1&#39;s compliment of only neg. words */</span> <a name="l03365"></a>03365 mm3 = _m_psubsw(mm3, mm5); <span class="comment">/* add 1 to only neg. words, W-(-1) or W-0 */</span> <a name="l03366"></a>03366 mm4 = _m_psubsw(mm4, mm6); <span class="comment">/* add 1 to only neg. words, W-(-1) or W-0 */</span> <a name="l03367"></a>03367 *mDest = _m_packuswb(mm3, mm4); <span class="comment">/* pack words back into bytes with saturation */</span> <a name="l03368"></a>03368 mSrc1++; <a name="l03369"></a>03369 mDest++; <a name="l03370"></a>03370 } <a name="l03371"></a>03371 } <a name="l03372"></a>03372 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l03373"></a>03373 <span class="preprocessor">#endif</span> <a name="l03374"></a>03374 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l03375"></a>03375 <span class="preprocessor">#else</span> <a name="l03376"></a>03376 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l03377"></a>03377 <span class="preprocessor">#endif</span> <a name="l03378"></a>03378 <span class="preprocessor"></span>} <a name="l03379"></a>03379 <a name="l03390"></a><a class="code" href="_s_d_l__image_filter_8h.html#a084f9544f049cc01e7b2f1090534abbf">03390</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a98372fea76310903abef7808db10d226" title="Filter ShiftLeft: D = saturation255(S &lt;&lt; N)">SDL_imageFilterShiftLeft</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> N) <a name="l03391"></a>03391 { <a name="l03392"></a>03392 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l03393"></a>03393 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1, *curdest; <a name="l03394"></a>03394 <span class="keywordtype">int</span> result; <a name="l03395"></a>03395 <a name="l03396"></a>03396 <span class="comment">/* Validate input parameters */</span> <a name="l03397"></a>03397 <span class="keywordflow">if</span> ((Src1 == NULL) || (Dest == NULL)) <a name="l03398"></a>03398 <span class="keywordflow">return</span>(-1); <a name="l03399"></a>03399 <span class="keywordflow">if</span> (length == 0) <a name="l03400"></a>03400 <span class="keywordflow">return</span>(0); <a name="l03401"></a>03401 <a name="l03402"></a>03402 <span class="keywordflow">if</span> (N &gt; 8) { <a name="l03403"></a>03403 <span class="keywordflow">return</span> (-1); <a name="l03404"></a>03404 } <a name="l03405"></a>03405 <a name="l03406"></a>03406 <span class="comment">/* Special case: N==0 */</span> <a name="l03407"></a>03407 <span class="keywordflow">if</span> (N == 0) { <a name="l03408"></a>03408 memcpy(Src1, Dest, length); <a name="l03409"></a>03409 <span class="keywordflow">return</span> (0); <a name="l03410"></a>03410 } <a name="l03411"></a>03411 <a name="l03412"></a>03412 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l03413"></a>03413 <a name="l03414"></a>03414 SDL_imageFilterShiftLeftMMX(Src1, Dest, length, N); <a name="l03415"></a>03415 <a name="l03416"></a>03416 <span class="comment">/* Check for unaligned bytes */</span> <a name="l03417"></a>03417 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l03418"></a>03418 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l03419"></a>03419 istart = length &amp; 0xfffffff8; <a name="l03420"></a>03420 cursrc1 = &amp;Src1[istart]; <a name="l03421"></a>03421 curdest = &amp;Dest[istart]; <a name="l03422"></a>03422 } <span class="keywordflow">else</span> { <a name="l03423"></a>03423 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l03424"></a>03424 <span class="keywordflow">return</span> (0); <a name="l03425"></a>03425 } <a name="l03426"></a>03426 } <span class="keywordflow">else</span> { <a name="l03427"></a>03427 <span class="comment">/* Setup to process whole image */</span> <a name="l03428"></a>03428 istart = 0; <a name="l03429"></a>03429 cursrc1 = Src1; <a name="l03430"></a>03430 curdest = Dest; <a name="l03431"></a>03431 } <a name="l03432"></a>03432 <a name="l03433"></a>03433 <span class="comment">/* C routine to process image */</span> <a name="l03434"></a>03434 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l03435"></a>03435 result = (int) *cursrc1 &lt;&lt; N; <a name="l03436"></a>03436 <span class="keywordflow">if</span> (result &gt; 255) <a name="l03437"></a>03437 result = 255; <a name="l03438"></a>03438 *curdest = (<span class="keywordtype">unsigned</span> char) result; <a name="l03439"></a>03439 <span class="comment">/* Advance pointers */</span> <a name="l03440"></a>03440 cursrc1++; <a name="l03441"></a>03441 curdest++; <a name="l03442"></a>03442 } <a name="l03443"></a>03443 <a name="l03444"></a>03444 <span class="keywordflow">return</span> (0); <a name="l03445"></a>03445 } <a name="l03446"></a>03446 <a name="l03457"></a>03457 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterBinarizeUsingThresholdMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> T) <a name="l03458"></a>03458 { <a name="l03459"></a>03459 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l03460"></a>03460 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l03461"></a>03461 <span class="preprocessor"></span> __asm <a name="l03462"></a>03462 { <a name="l03463"></a>03463 pusha <a name="l03464"></a>03464 <span class="comment">/* ** Duplicate T in 8 bytes of MM3 ** */</span> <a name="l03465"></a>03465 pcmpeqb mm1, mm1 <span class="comment">/* generate all 1&#39;s in mm1 */</span> <a name="l03466"></a>03466 pcmpeqb mm2, mm2 <span class="comment">/* generate all 1&#39;s in mm2 */</span> <a name="l03467"></a>03467 mov al, T <span class="comment">/* load T into AL */</span> <a name="l03468"></a>03468 mov ah, al <span class="comment">/* copy AL into AH */</span> <a name="l03469"></a>03469 mov bx, ax <span class="comment">/* copy AX into BX */</span> <a name="l03470"></a>03470 shl eax, 16 <span class="comment">/* shift 2 bytes of EAX left */</span> <a name="l03471"></a>03471 mov ax, bx <span class="comment">/* copy BX into AX */</span> <a name="l03472"></a>03472 movd mm3, eax <span class="comment">/* copy EAX into MM3 */</span> <a name="l03473"></a>03473 movd mm4, eax <span class="comment">/* copy EAX into MM4 */</span> <a name="l03474"></a>03474 punpckldq mm3, mm4 <span class="comment">/* fill higher bytes of MM3 with T */</span> <a name="l03475"></a>03475 psubusb mm2, mm3 <span class="comment">/* store 0xFF - T in MM2 */</span> <a name="l03476"></a>03476 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l03477"></a>03477 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l03478"></a>03478 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l03479"></a>03479 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l03480"></a>03480 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l03481"></a>03481 L1029: <a name="l03482"></a>03482 movq mm0, [eax] <span class="comment">/* load 8 bytes from SrcDest into MM0 */</span> <a name="l03483"></a>03483 paddusb mm0, mm2 <span class="comment">/* MM0=SrcDest+(0xFF-T) (add 8 bytes with saturation) */</span> <a name="l03484"></a>03484 pcmpeqb mm0, mm1 <span class="comment">/* binarize 255:0, comparing to 255 */</span> <a name="l03485"></a>03485 movq [edi], mm0 <span class="comment">/* store result in SrcDest */</span> <a name="l03486"></a>03486 add eax, 8 <span class="comment">/* increase Src1 register pointer by 8 */</span> <a name="l03487"></a>03487 add edi, 8 <span class="comment">/* increase Dest register pointer by 8 */</span> <a name="l03488"></a>03488 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l03489"></a>03489 jnz L1029 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l03490"></a>03490 emms <span class="comment">/* exit MMX state */</span> <a name="l03491"></a>03491 popa <a name="l03492"></a>03492 } <a name="l03493"></a>03493 <span class="preprocessor">#else</span> <a name="l03494"></a>03494 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l03495"></a>03495 __m64 *mSrc1 = (__m64*)Src1; <a name="l03496"></a>03496 __m64 *mDest = (__m64*)Dest; <a name="l03497"></a>03497 <span class="comment">/* Duplicate T in 8 bytes of MM3 */</span> <a name="l03498"></a>03498 __m64 mm1 = _m_pcmpeqb(mm1, mm1); <span class="comment">/* generate all 1&#39;s in mm1 */</span> <a name="l03499"></a>03499 __m64 mm2 = _m_pcmpeqb(mm2, mm2); <span class="comment">/* generate all 1&#39;s in mm1 */</span> <a name="l03500"></a>03500 <span class="keywordtype">int</span> i; <a name="l03501"></a>03501 memset(&amp;i, T, 4); <a name="l03502"></a>03502 __m64 mm3 = _m_from_int(i); <a name="l03503"></a>03503 __m64 mm4 = _m_from_int(i); <a name="l03504"></a>03504 mm3 = _m_punpckldq(mm3, mm4); <span class="comment">/* fill higher bytes of MM3 with T */</span> <a name="l03505"></a>03505 mm2 = _m_psubusb(mm2, mm3); <span class="comment">/* store 0xFF - T in MM2 */</span> <a name="l03506"></a>03506 <span class="comment">//__m64 mm3 = _m_from_int64(lli); // x86_64 only</span> <a name="l03507"></a>03507 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l03508"></a>03508 __m64 mm0 = _m_paddusb(*mSrc1, mm2); <span class="comment">/* Src1+(0xFF-T) (add 8 bytes with saturation) */</span> <a name="l03509"></a>03509 *mDest = _m_pcmpeqb(mm0, mm1); <span class="comment">/* binarize 255:0, comparing to 255 */</span> <a name="l03510"></a>03510 mSrc1++; <a name="l03511"></a>03511 mDest++; <a name="l03512"></a>03512 } <a name="l03513"></a>03513 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l03514"></a>03514 <span class="preprocessor">#endif</span> <a name="l03515"></a>03515 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l03516"></a>03516 <span class="preprocessor">#else</span> <a name="l03517"></a>03517 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l03518"></a>03518 <span class="preprocessor">#endif</span> <a name="l03519"></a>03519 <span class="preprocessor"></span>} <a name="l03520"></a>03520 <a name="l03531"></a><a class="code" href="_s_d_l__image_filter_8h.html#ad5bf97d7e39d018d2eeb570e97edf8c0">03531</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a951a062e15df290a137428e1e0f4d5ce" title="Filter using BinarizeUsingThreshold: D = (S &gt;= T) ? 255:0.">SDL_imageFilterBinarizeUsingThreshold</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> T) <a name="l03532"></a>03532 { <a name="l03533"></a>03533 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l03534"></a>03534 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1; <a name="l03535"></a>03535 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *curdest; <a name="l03536"></a>03536 <a name="l03537"></a>03537 <span class="comment">/* Validate input parameters */</span> <a name="l03538"></a>03538 <span class="keywordflow">if</span> ((Src1 == NULL) || (Dest == NULL)) <a name="l03539"></a>03539 <span class="keywordflow">return</span>(-1); <a name="l03540"></a>03540 <span class="keywordflow">if</span> (length == 0) <a name="l03541"></a>03541 <span class="keywordflow">return</span>(0); <a name="l03542"></a>03542 <a name="l03543"></a>03543 <span class="comment">/* Special case: T==0 */</span> <a name="l03544"></a>03544 <span class="keywordflow">if</span> (T == 0) { <a name="l03545"></a>03545 memset(Dest, 255, length); <a name="l03546"></a>03546 <span class="keywordflow">return</span> (0); <a name="l03547"></a>03547 } <a name="l03548"></a>03548 <a name="l03549"></a>03549 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l03550"></a>03550 <a name="l03551"></a>03551 SDL_imageFilterBinarizeUsingThresholdMMX(Src1, Dest, length, T); <a name="l03552"></a>03552 <a name="l03553"></a>03553 <span class="comment">/* Check for unaligned bytes */</span> <a name="l03554"></a>03554 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l03555"></a>03555 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l03556"></a>03556 istart = length &amp; 0xfffffff8; <a name="l03557"></a>03557 cursrc1 = &amp;Src1[istart]; <a name="l03558"></a>03558 curdest = &amp;Dest[istart]; <a name="l03559"></a>03559 } <span class="keywordflow">else</span> { <a name="l03560"></a>03560 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l03561"></a>03561 <span class="keywordflow">return</span> (0); <a name="l03562"></a>03562 } <a name="l03563"></a>03563 } <span class="keywordflow">else</span> { <a name="l03564"></a>03564 <span class="comment">/* Setup to process whole image */</span> <a name="l03565"></a>03565 istart = 0; <a name="l03566"></a>03566 cursrc1 = Src1; <a name="l03567"></a>03567 curdest = Dest; <a name="l03568"></a>03568 } <a name="l03569"></a>03569 <a name="l03570"></a>03570 <span class="comment">/* C routine to process image */</span> <a name="l03571"></a>03571 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l03572"></a>03572 *curdest = (<span class="keywordtype">unsigned</span> char)(((<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>)*cursrc1 &gt;= T) ? 255 : 0); <a name="l03573"></a>03573 <span class="comment">/* Advance pointers */</span> <a name="l03574"></a>03574 cursrc1++; <a name="l03575"></a>03575 curdest++; <a name="l03576"></a>03576 } <a name="l03577"></a>03577 <a name="l03578"></a>03578 <span class="keywordflow">return</span> (0); <a name="l03579"></a>03579 } <a name="l03580"></a>03580 <a name="l03592"></a>03592 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterClipToRangeMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Tmin, <a name="l03593"></a>03593 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Tmax) <a name="l03594"></a>03594 { <a name="l03595"></a>03595 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l03596"></a>03596 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l03597"></a>03597 <span class="preprocessor"></span> __asm <a name="l03598"></a>03598 { <a name="l03599"></a>03599 pusha <a name="l03600"></a>03600 pcmpeqb mm1, mm1 <span class="comment">/* generate all 1&#39;s in mm1 */</span> <a name="l03601"></a>03601 <span class="comment">/* ** Duplicate Tmax in 8 bytes of MM3 ** */</span> <a name="l03602"></a>03602 mov al, Tmax <span class="comment">/* load Tmax into AL */</span> <a name="l03603"></a>03603 mov ah, al <span class="comment">/* copy AL into AH */</span> <a name="l03604"></a>03604 mov bx, ax <span class="comment">/* copy AX into BX */</span> <a name="l03605"></a>03605 shl eax, 16 <span class="comment">/* shift 2 bytes of EAX left */</span> <a name="l03606"></a>03606 mov ax, bx <span class="comment">/* copy BX into AX */</span> <a name="l03607"></a>03607 movd mm3, eax <span class="comment">/* copy EAX into MM3 */</span> <a name="l03608"></a>03608 movd mm4, eax <span class="comment">/* copy EAX into MM4 */</span> <a name="l03609"></a>03609 punpckldq mm3, mm4 <span class="comment">/* fill higher bytes of MM3 with Tmax */</span> <a name="l03610"></a>03610 psubusb mm1, mm3 <span class="comment">/* store 0xFF - Tmax in MM1 */</span> <a name="l03611"></a>03611 <span class="comment">/* ** Duplicate Tmin in 8 bytes of MM5 ** */</span> <a name="l03612"></a>03612 mov al, Tmin <span class="comment">/* load Tmin into AL */</span> <a name="l03613"></a>03613 mov ah, al <span class="comment">/* copy AL into AH */</span> <a name="l03614"></a>03614 mov bx, ax <span class="comment">/* copy AX into BX */</span> <a name="l03615"></a>03615 shl eax, 16 <span class="comment">/* shift 2 bytes of EAX left */</span> <a name="l03616"></a>03616 mov ax, bx <span class="comment">/* copy BX into AX */</span> <a name="l03617"></a>03617 movd mm5, eax <span class="comment">/* copy EAX into MM5 */</span> <a name="l03618"></a>03618 movd mm4, eax <span class="comment">/* copy EAX into MM4 */</span> <a name="l03619"></a>03619 punpckldq mm5, mm4 <span class="comment">/* fill higher bytes of MM5 with Tmin */</span> <a name="l03620"></a>03620 movq mm7, mm5 <span class="comment">/* copy MM5 into MM7 */</span> <a name="l03621"></a>03621 paddusb mm7, mm1 <span class="comment">/* store 0xFF - Tmax + Tmin in MM7 */</span> <a name="l03622"></a>03622 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l03623"></a>03623 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l03624"></a>03624 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l03625"></a>03625 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l03626"></a>03626 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l03627"></a>03627 L1030: <a name="l03628"></a>03628 movq mm0, [eax] <span class="comment">/* load 8 bytes from Src1 into MM0 */</span> <a name="l03629"></a>03629 paddusb mm0, mm1 <span class="comment">/* MM0=SrcDest+(0xFF-Tmax) */</span> <a name="l03630"></a>03630 psubusb mm0, mm7 <span class="comment">/* MM0=MM0-(0xFF-Tmax+Tmin) */</span> <a name="l03631"></a>03631 paddusb mm0, mm5 <span class="comment">/* MM0=MM0+Tmin */</span> <a name="l03632"></a>03632 movq [edi], mm0 <span class="comment">/* store result in Dest */</span> <a name="l03633"></a>03633 add eax, 8 <span class="comment">/* increase Src1 register pointer by 8 */</span> <a name="l03634"></a>03634 add edi, 8 <span class="comment">/* increase Dest register pointer by 8 */</span> <a name="l03635"></a>03635 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l03636"></a>03636 jnz L1030 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l03637"></a>03637 emms <span class="comment">/* exit MMX state */</span> <a name="l03638"></a>03638 popa <a name="l03639"></a>03639 } <a name="l03640"></a>03640 <span class="preprocessor">#else</span> <a name="l03641"></a>03641 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l03642"></a>03642 __m64 *mSrc1 = (__m64*)Src1; <a name="l03643"></a>03643 __m64 *mDest = (__m64*)Dest; <a name="l03644"></a>03644 __m64 mm1 = _m_pcmpeqb(mm1, mm1); <span class="comment">/* generate all 1&#39;s in mm1 */</span> <a name="l03645"></a>03645 <span class="keywordtype">int</span> i; <a name="l03646"></a>03646 <span class="comment">/* Duplicate Tmax in 8 bytes of MM3 */</span> <a name="l03647"></a>03647 __m64 mm3, mm4; <a name="l03648"></a>03648 memset(&amp;i, Tmax, 4); <a name="l03649"></a>03649 mm3 = _m_from_int(i); <a name="l03650"></a>03650 mm4 = _m_from_int(i); <a name="l03651"></a>03651 mm3 = _m_punpckldq(mm3, mm4); <span class="comment">/* fill higher bytes of MM3 with Tmax */</span> <a name="l03652"></a>03652 mm1 = _m_psubusb(mm1, mm3); <span class="comment">/* store 0xFF - Tmax in MM1 */</span> <a name="l03653"></a>03653 <span class="comment">//__m64 mm3 = _m_from_int64(lli); // x86_64 only</span> <a name="l03654"></a>03654 <span class="comment">/* Duplicate Tmax in 8 bytes of MM3 */</span> <a name="l03655"></a>03655 __m64 mm5, mm7; <a name="l03656"></a>03656 memset(&amp;i, Tmin, 4); <a name="l03657"></a>03657 mm5 = _m_from_int(i); <a name="l03658"></a>03658 mm4 = _m_from_int(i); <a name="l03659"></a>03659 mm5 = _m_punpckldq(mm5, mm4); <span class="comment">/* fill higher bytes of MM5 with Tmin */</span> <a name="l03660"></a>03660 mm7 = _m_paddusb(mm5, mm1); <span class="comment">/* store 0xFF - Tmax + Tmin in MM7 */</span> <a name="l03661"></a>03661 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l03662"></a>03662 __m64 mm0; <a name="l03663"></a>03663 mm0 = _m_paddusb(*mSrc1, mm1); <span class="comment">/* MM0=Src1+(0xFF-Tmax) */</span> <a name="l03664"></a>03664 mm0 = _m_psubusb(mm0, mm7); <span class="comment">/* MM0=MM0-(0xFF-Tmax+Tmin) */</span> <a name="l03665"></a>03665 *mDest = _m_paddusb(mm0, mm5); <span class="comment">/* MM0+Tmin */</span> <a name="l03666"></a>03666 mSrc1++; <a name="l03667"></a>03667 mDest++; <a name="l03668"></a>03668 } <a name="l03669"></a>03669 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l03670"></a>03670 <span class="preprocessor">#endif</span> <a name="l03671"></a>03671 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l03672"></a>03672 <span class="preprocessor">#else</span> <a name="l03673"></a>03673 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l03674"></a>03674 <span class="preprocessor">#endif</span> <a name="l03675"></a>03675 <span class="preprocessor"></span>} <a name="l03676"></a>03676 <a name="l03688"></a><a class="code" href="_s_d_l__image_filter_8h.html#ae9d552de9cf5a4a1716d91ee905eafd7">03688</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#ab7224abc4ecc1b8a6f4441ef8379515f" title="Filter using ClipToRange: D = (S &gt;= Tmin) &amp; (S &lt;= Tmax) S:Tmin | Tmax.">SDL_imageFilterClipToRange</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Tmin, <a name="l03689"></a>03689 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Tmax) <a name="l03690"></a>03690 { <a name="l03691"></a>03691 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l03692"></a>03692 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc1; <a name="l03693"></a>03693 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *curdest; <a name="l03694"></a>03694 <a name="l03695"></a>03695 <span class="comment">/* Validate input parameters */</span> <a name="l03696"></a>03696 <span class="keywordflow">if</span> ((Src1 == NULL) || (Dest == NULL)) <a name="l03697"></a>03697 <span class="keywordflow">return</span>(-1); <a name="l03698"></a>03698 <span class="keywordflow">if</span> (length == 0) <a name="l03699"></a>03699 <span class="keywordflow">return</span>(0); <a name="l03700"></a>03700 <a name="l03701"></a>03701 <span class="comment">/* Special case: Tmin==0 &amp;&amp; Tmax = 255 */</span> <a name="l03702"></a>03702 <span class="keywordflow">if</span> ((Tmin == 0) &amp;&amp; (Tmax == 25)) { <a name="l03703"></a>03703 memcpy(Src1, Dest, length); <a name="l03704"></a>03704 <span class="keywordflow">return</span> (0); <a name="l03705"></a>03705 } <a name="l03706"></a>03706 <a name="l03707"></a>03707 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l03708"></a>03708 <a name="l03709"></a>03709 SDL_imageFilterClipToRangeMMX(Src1, Dest, length, Tmin, Tmax); <a name="l03710"></a>03710 <a name="l03711"></a>03711 <span class="comment">/* Check for unaligned bytes */</span> <a name="l03712"></a>03712 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l03713"></a>03713 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l03714"></a>03714 istart = length &amp; 0xfffffff8; <a name="l03715"></a>03715 cursrc1 = &amp;Src1[istart]; <a name="l03716"></a>03716 curdest = &amp;Dest[istart]; <a name="l03717"></a>03717 } <span class="keywordflow">else</span> { <a name="l03718"></a>03718 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l03719"></a>03719 <span class="keywordflow">return</span> (0); <a name="l03720"></a>03720 } <a name="l03721"></a>03721 } <span class="keywordflow">else</span> { <a name="l03722"></a>03722 <span class="comment">/* Setup to process whole image */</span> <a name="l03723"></a>03723 istart = 0; <a name="l03724"></a>03724 cursrc1 = Src1; <a name="l03725"></a>03725 curdest = Dest; <a name="l03726"></a>03726 } <a name="l03727"></a>03727 <a name="l03728"></a>03728 <span class="comment">/* C routine to process image */</span> <a name="l03729"></a>03729 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l03730"></a>03730 <span class="keywordflow">if</span> (*cursrc1 &lt; Tmin) { <a name="l03731"></a>03731 *curdest = Tmin; <a name="l03732"></a>03732 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (*cursrc1 &gt; Tmax) { <a name="l03733"></a>03733 *curdest = Tmax; <a name="l03734"></a>03734 } <span class="keywordflow">else</span> { <a name="l03735"></a>03735 *curdest = *cursrc1; <a name="l03736"></a>03736 } <a name="l03737"></a>03737 <span class="comment">/* Advance pointers */</span> <a name="l03738"></a>03738 cursrc1++; <a name="l03739"></a>03739 curdest++; <a name="l03740"></a>03740 } <a name="l03741"></a>03741 <a name="l03742"></a>03742 <span class="keywordflow">return</span> (0); <a name="l03743"></a>03743 } <a name="l03744"></a>03744 <a name="l03758"></a>03758 <span class="keyword">static</span> <span class="keywordtype">int</span> SDL_imageFilterNormalizeLinearMMX(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SrcLength, <span class="keywordtype">int</span> Cmin, <span class="keywordtype">int</span> Cmax, <a name="l03759"></a>03759 <span class="keywordtype">int</span> Nmin, <span class="keywordtype">int</span> Nmax) <a name="l03760"></a>03760 { <a name="l03761"></a>03761 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l03762"></a>03762 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l03763"></a>03763 <span class="preprocessor"></span> __asm <a name="l03764"></a>03764 { <a name="l03765"></a>03765 pusha <a name="l03766"></a>03766 mov ax, WORD PTR Nmax <span class="comment">/* load Nmax in AX */</span> <a name="l03767"></a>03767 mov bx, WORD PTR Cmax <span class="comment">/* load Cmax in BX */</span> <a name="l03768"></a>03768 sub ax, WORD PTR Nmin <span class="comment">/* AX = Nmax - Nmin */</span> <a name="l03769"></a>03769 sub bx, WORD PTR Cmin <span class="comment">/* BX = Cmax - Cmin */</span> <a name="l03770"></a>03770 jz L10311 <span class="comment">/* check division by zero */</span> <a name="l03771"></a>03771 xor dx, dx <span class="comment">/* prepare for division, zero DX */</span> <a name="l03772"></a>03772 div bx <span class="comment">/* AX = AX/BX */</span> <a name="l03773"></a>03773 jmp L10312 <a name="l03774"></a>03774 L10311: <a name="l03775"></a>03775 mov ax, 255 <span class="comment">/* if div by zero, assume result max byte value */</span> <a name="l03776"></a>03776 L10312: <span class="comment">/* ** Duplicate AX in 4 words of MM0 ** */</span> <a name="l03777"></a>03777 mov bx, ax <span class="comment">/* copy AX into BX */</span> <a name="l03778"></a>03778 shl eax, 16 <span class="comment">/* shift 2 bytes of EAX left */</span> <a name="l03779"></a>03779 mov ax, bx <span class="comment">/* copy BX into AX */</span> <a name="l03780"></a>03780 movd mm0, eax <span class="comment">/* copy EAX into MM0 */</span> <a name="l03781"></a>03781 movd mm1, eax <span class="comment">/* copy EAX into MM1 */</span> <a name="l03782"></a>03782 punpckldq mm0, mm1 <span class="comment">/* fill higher words of MM0 with AX */</span> <a name="l03783"></a>03783 <span class="comment">/* ** Duplicate Cmin in 4 words of MM1 ** */</span> <a name="l03784"></a>03784 mov ax, WORD PTR Cmin <span class="comment">/* load Cmin into AX */</span> <a name="l03785"></a>03785 mov bx, ax <span class="comment">/* copy AX into BX */</span> <a name="l03786"></a>03786 shl eax, 16 <span class="comment">/* shift 2 bytes of EAX left */</span> <a name="l03787"></a>03787 mov ax, bx <span class="comment">/* copy BX into AX */</span> <a name="l03788"></a>03788 movd mm1, eax <span class="comment">/* copy EAX into MM1 */</span> <a name="l03789"></a>03789 movd mm2, eax <span class="comment">/* copy EAX into MM2 */</span> <a name="l03790"></a>03790 punpckldq mm1, mm2 <span class="comment">/* fill higher words of MM1 with Cmin */</span> <a name="l03791"></a>03791 <span class="comment">/* ** Duplicate Nmin in 4 words of MM2 ** */</span> <a name="l03792"></a>03792 mov ax, WORD PTR Nmin <span class="comment">/* load Nmin into AX */</span> <a name="l03793"></a>03793 mov bx, ax <span class="comment">/* copy AX into BX */</span> <a name="l03794"></a>03794 shl eax, 16 <span class="comment">/* shift 2 bytes of EAX left */</span> <a name="l03795"></a>03795 mov ax, bx <span class="comment">/* copy BX into AX */</span> <a name="l03796"></a>03796 movd mm2, eax <span class="comment">/* copy EAX into MM2 */</span> <a name="l03797"></a>03797 movd mm3, eax <span class="comment">/* copy EAX into MM3 */</span> <a name="l03798"></a>03798 punpckldq mm2, mm3 <span class="comment">/* fill higher words of MM2 with Nmin */</span> <a name="l03799"></a>03799 pxor mm7, mm7 <span class="comment">/* zero MM7 register */</span> <a name="l03800"></a>03800 mov eax, Src1 <span class="comment">/* load Src1 address into eax */</span> <a name="l03801"></a>03801 mov edi, Dest <span class="comment">/* load Dest address into edi */</span> <a name="l03802"></a>03802 mov ecx, SrcLength <span class="comment">/* load loop counter (SIZE) into ecx */</span> <a name="l03803"></a>03803 shr ecx, 3 <span class="comment">/* counter/8 (MMX loads 8 bytes at a time) */</span> <a name="l03804"></a>03804 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l03805"></a>03805 L1031: <a name="l03806"></a>03806 movq mm3, [eax] <span class="comment">/* load 8 bytes from Src1 into MM3 */</span> <a name="l03807"></a>03807 movq mm4, mm3 <span class="comment">/* copy MM3 into MM4 */</span> <a name="l03808"></a>03808 punpcklbw mm3, mm7 <span class="comment">/* unpack low bytes of SrcDest into words */</span> <a name="l03809"></a>03809 punpckhbw mm4, mm7 <span class="comment">/* unpack high bytes of SrcDest into words */</span> <a name="l03810"></a>03810 psubusb mm3, mm1 <span class="comment">/* S-Cmin, low bytes */</span> <a name="l03811"></a>03811 psubusb mm4, mm1 <span class="comment">/* S-Cmin, high bytes */</span> <a name="l03812"></a>03812 pmullw mm3, mm0 <span class="comment">/* MM0*(S-Cmin), low bytes */</span> <a name="l03813"></a>03813 pmullw mm4, mm0 <span class="comment">/* MM0*(S-Cmin), high bytes */</span> <a name="l03814"></a>03814 paddusb mm3, mm2 <span class="comment">/* MM0*(S-Cmin)+Nmin, low bytes */</span> <a name="l03815"></a>03815 paddusb mm4, mm2 <span class="comment">/* MM0*(S-Cmin)+Nmin, high bytes */</span> <a name="l03816"></a>03816 <span class="comment">/* ** Take abs value of the signed words ** */</span> <a name="l03817"></a>03817 movq mm5, mm3 <span class="comment">/* copy mm3 into mm5 */</span> <a name="l03818"></a>03818 movq mm6, mm4 <span class="comment">/* copy mm4 into mm6 */</span> <a name="l03819"></a>03819 psraw mm5, 15 <span class="comment">/* fill mm5 words with word sign bit */</span> <a name="l03820"></a>03820 psraw mm6, 15 <span class="comment">/* fill mm6 words with word sign bit */</span> <a name="l03821"></a>03821 pxor mm3, mm5 <span class="comment">/* take 1&#39;s compliment of only neg words */</span> <a name="l03822"></a>03822 pxor mm4, mm6 <span class="comment">/* take 1&#39;s compliment of only neg words */</span> <a name="l03823"></a>03823 psubsw mm3, mm5 <span class="comment">/* add 1 to only neg words, W-(-1) or W-0 */</span> <a name="l03824"></a>03824 psubsw mm4, mm6 <span class="comment">/* add 1 to only neg words, W-(-1) or W-0 */</span> <a name="l03825"></a>03825 packuswb mm3, mm4 <span class="comment">/* pack words back into bytes with saturation */</span> <a name="l03826"></a>03826 movq [edi], mm3 <span class="comment">/* store result in Dest */</span> <a name="l03827"></a>03827 add eax, 8 <span class="comment">/* increase Src1 register pointer by 8 */</span> <a name="l03828"></a>03828 add edi, 8 <span class="comment">/* increase Dest register pointer by 8 */</span> <a name="l03829"></a>03829 dec ecx <span class="comment">/* decrease loop counter */</span> <a name="l03830"></a>03830 jnz L1031 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l03831"></a>03831 emms <span class="comment">/* exit MMX state */</span> <a name="l03832"></a>03832 popa <a name="l03833"></a>03833 } <a name="l03834"></a>03834 <span class="preprocessor">#else</span> <a name="l03835"></a>03835 <span class="preprocessor"></span> <span class="comment">/* i386 and x86_64 */</span> <a name="l03836"></a>03836 __m64 *mSrc1 = (__m64*)Src1; <a name="l03837"></a>03837 __m64 *mDest = (__m64*)Dest; <a name="l03838"></a>03838 __m64 mm0, mm1, mm2, mm3; <a name="l03839"></a>03839 <a name="l03840"></a>03840 <span class="keywordtype">int</span> i; <a name="l03841"></a>03841 <span class="comment">/* Duplicate (Nmax-Nmin)/(Cmax-Cmin) in 4 words of MM0 */</span> <a name="l03842"></a>03842 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> a = Nmax - Nmin; <a name="l03843"></a>03843 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> b = Cmax - Cmin; <a name="l03844"></a>03844 <span class="keywordflow">if</span> (b == 0) { <a name="l03845"></a>03845 a = 255; <a name="l03846"></a>03846 } <span class="keywordflow">else</span> { <a name="l03847"></a>03847 a /= b; <a name="l03848"></a>03848 } <a name="l03849"></a>03849 i = (a&lt;&lt;16)|a; <a name="l03850"></a>03850 mm0 = _m_from_int(i); <a name="l03851"></a>03851 mm1 = _m_from_int(i); <a name="l03852"></a>03852 mm0 = _m_punpckldq(mm0, mm1); <span class="comment">/* fill higher words of MM0 with AX */</span> <a name="l03853"></a>03853 <span class="comment">/* Duplicate Cmin in 4 words of MM1 */</span> <a name="l03854"></a>03854 i = (Cmin&lt;&lt;16)|(<span class="keywordtype">short</span>)Cmin; <a name="l03855"></a>03855 mm1 = _m_from_int(i); <a name="l03856"></a>03856 mm2 = _m_from_int(i); <a name="l03857"></a>03857 mm1 = _m_punpckldq(mm1, mm2); <span class="comment">/* fill higher words of MM1 with Cmin */</span> <a name="l03858"></a>03858 <span class="comment">/* Duplicate Nmin in 4 words of MM2 */</span> <a name="l03859"></a>03859 i = (Nmin&lt;&lt;16)|(<span class="keywordtype">short</span>)Nmin; <a name="l03860"></a>03860 mm2 = _m_from_int(i); <a name="l03861"></a>03861 mm3 = _m_from_int(i); <a name="l03862"></a>03862 mm2 = _m_punpckldq(mm2, mm3); <span class="comment">/* fill higher words of MM2 with Nmin */</span> <a name="l03863"></a>03863 __m64 mm7 = _m_from_int(0); <span class="comment">/* zero mm0 register */</span> <a name="l03864"></a>03864 <span class="keywordflow">for</span> (i = 0; i &lt; SrcLength/8; i++) { <a name="l03865"></a>03865 __m64 mm3, mm4, mm5, mm6; <a name="l03866"></a>03866 mm3 = _m_punpcklbw(*mSrc1, mm7); <span class="comment">/* unpack low bytes of Src1 into words */</span> <a name="l03867"></a>03867 mm4 = _m_punpckhbw(*mSrc1, mm7); <span class="comment">/* unpack high bytes of Src1 into words */</span> <a name="l03868"></a>03868 mm3 = _m_psubusb(mm3, mm1); <span class="comment">/* S-Cmin, low bytes */</span> <a name="l03869"></a>03869 mm4 = _m_psubusb(mm4, mm1); <span class="comment">/* S-Cmin, high bytes */</span> <a name="l03870"></a>03870 mm3 = _m_pmullw(mm3, mm0); <span class="comment">/* MM0*(S-Cmin), low bytes */</span> <a name="l03871"></a>03871 mm4 = _m_pmullw(mm4, mm0); <span class="comment">/* MM0*(S-Cmin), high bytes */</span> <a name="l03872"></a>03872 mm3 = _m_paddusb(mm3, mm2); <span class="comment">/* MM0*(S-Cmin)+Nmin, low bytes */</span> <a name="l03873"></a>03873 mm4 = _m_paddusb(mm4, mm2); <span class="comment">/* MM0*(S-Cmin)+Nmin, high bytes */</span> <a name="l03874"></a>03874 <span class="comment">/* Take abs value of the signed words */</span> <a name="l03875"></a>03875 mm5 = _m_psrawi(mm3, 15); <span class="comment">/* fill mm5 words with word sign bit */</span> <a name="l03876"></a>03876 mm6 = _m_psrawi(mm4, 15); <span class="comment">/* fill mm6 words with word sign bit */</span> <a name="l03877"></a>03877 mm3 = _m_pxor(mm3, mm5); <span class="comment">/* take 1&#39;s compliment of only neg. words */</span> <a name="l03878"></a>03878 mm4 = _m_pxor(mm4, mm6); <span class="comment">/* take 1&#39;s compliment of only neg. words */</span> <a name="l03879"></a>03879 mm3 = _m_psubsw(mm3, mm5); <span class="comment">/* add 1 to only neg. words, W-(-1) or W-0 */</span> <a name="l03880"></a>03880 mm4 = _m_psubsw(mm4, mm6); <span class="comment">/* add 1 to only neg. words, W-(-1) or W-0 */</span> <a name="l03881"></a>03881 *mDest = _m_packuswb(mm3, mm4); <span class="comment">/* pack words back into bytes with saturation */</span> <a name="l03882"></a>03882 mSrc1++; <a name="l03883"></a>03883 mDest++; <a name="l03884"></a>03884 } <a name="l03885"></a>03885 _m_empty(); <span class="comment">/* clean MMX state */</span> <a name="l03886"></a>03886 <span class="preprocessor">#endif</span> <a name="l03887"></a>03887 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l03888"></a>03888 <span class="preprocessor">#else</span> <a name="l03889"></a>03889 <span class="preprocessor"></span> <span class="keywordflow">return</span> (-1); <a name="l03890"></a>03890 <span class="preprocessor">#endif</span> <a name="l03891"></a>03891 <span class="preprocessor"></span>} <a name="l03892"></a>03892 <a name="l03906"></a><a class="code" href="_s_d_l__image_filter_8h.html#aacb316a18d8cb7999d5d53ee5e7b9750">03906</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#ab018ace4db884cac953b06b09c00828b" title="Filter using NormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)...">SDL_imageFilterNormalizeLinear</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">int</span> Cmin, <span class="keywordtype">int</span> Cmax, <span class="keywordtype">int</span> Nmin, <a name="l03907"></a>03907 <span class="keywordtype">int</span> Nmax) <a name="l03908"></a>03908 { <a name="l03909"></a>03909 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, istart; <a name="l03910"></a>03910 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *cursrc; <a name="l03911"></a>03911 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *curdest; <a name="l03912"></a>03912 <span class="keywordtype">int</span> dN, dC, factor; <a name="l03913"></a>03913 <span class="keywordtype">int</span> result; <a name="l03914"></a>03914 <a name="l03915"></a>03915 <span class="comment">/* Validate input parameters */</span> <a name="l03916"></a>03916 <span class="keywordflow">if</span> ((Src == NULL) || (Dest == NULL)) <a name="l03917"></a>03917 <span class="keywordflow">return</span>(-1); <a name="l03918"></a>03918 <span class="keywordflow">if</span> (length == 0) <a name="l03919"></a>03919 <span class="keywordflow">return</span>(0); <a name="l03920"></a>03920 <a name="l03921"></a>03921 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>()) &amp;&amp; (length &gt; 7)) { <a name="l03922"></a>03922 <a name="l03923"></a>03923 SDL_imageFilterNormalizeLinearMMX(Src, Dest, length, Cmin, Cmax, Nmin, Nmax); <a name="l03924"></a>03924 <a name="l03925"></a>03925 <span class="comment">/* Check for unaligned bytes */</span> <a name="l03926"></a>03926 <span class="keywordflow">if</span> ((length &amp; 7) &gt; 0) { <a name="l03927"></a>03927 <span class="comment">/* Setup to process unaligned bytes */</span> <a name="l03928"></a>03928 istart = length &amp; 0xfffffff8; <a name="l03929"></a>03929 cursrc = &amp;Src[istart]; <a name="l03930"></a>03930 curdest = &amp;Dest[istart]; <a name="l03931"></a>03931 } <span class="keywordflow">else</span> { <a name="l03932"></a>03932 <span class="comment">/* No unaligned bytes - we are done */</span> <a name="l03933"></a>03933 <span class="keywordflow">return</span> (0); <a name="l03934"></a>03934 } <a name="l03935"></a>03935 } <span class="keywordflow">else</span> { <a name="l03936"></a>03936 <span class="comment">/* Setup to process whole image */</span> <a name="l03937"></a>03937 istart = 0; <a name="l03938"></a>03938 cursrc = Src; <a name="l03939"></a>03939 curdest = Dest; <a name="l03940"></a>03940 } <a name="l03941"></a>03941 <a name="l03942"></a>03942 <span class="comment">/* C routine to process image */</span> <a name="l03943"></a>03943 dC = Cmax - Cmin; <a name="l03944"></a>03944 <span class="keywordflow">if</span> (dC == 0) <a name="l03945"></a>03945 <span class="keywordflow">return</span> (0); <a name="l03946"></a>03946 dN = Nmax - Nmin; <a name="l03947"></a>03947 factor = dN / dC; <a name="l03948"></a>03948 <span class="keywordflow">for</span> (i = istart; i &lt; length; i++) { <a name="l03949"></a>03949 result = factor * ((int) (*cursrc) - Cmin) + Nmin; <a name="l03950"></a>03950 <span class="keywordflow">if</span> (result &gt; 255) <a name="l03951"></a>03951 result = 255; <a name="l03952"></a>03952 *curdest = (<span class="keywordtype">unsigned</span> char) result; <a name="l03953"></a>03953 <span class="comment">/* Advance pointers */</span> <a name="l03954"></a>03954 cursrc++; <a name="l03955"></a>03955 curdest++; <a name="l03956"></a>03956 } <a name="l03957"></a>03957 <a name="l03958"></a>03958 <span class="keywordflow">return</span> (0); <a name="l03959"></a>03959 } <a name="l03960"></a>03960 <a name="l03961"></a>03961 <span class="comment">/* ------------------------------------------------------------------------------------ */</span> <a name="l03962"></a>03962 <a name="l03977"></a><a class="code" href="_s_d_l__image_filter_8h.html#a7286cd21fa0a0cfb0606806dacfbe121">03977</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a8e7e4138a93e26f1912763189d407770" title="Filter using ConvolveKernel3x3Divide: Dij = saturation0and255( ... )">SDL_imageFilterConvolveKernel3x3Divide</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">int</span> rows, <span class="keywordtype">int</span> columns, <a name="l03978"></a>03978 <span class="keywordtype">signed</span> <span class="keywordtype">short</span> *Kernel, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Divisor) <a name="l03979"></a>03979 { <a name="l03980"></a>03980 <span class="comment">/* Validate input parameters */</span> <a name="l03981"></a>03981 <span class="keywordflow">if</span> ((Src == NULL) || (Dest == NULL) || (Kernel == NULL)) <a name="l03982"></a>03982 <span class="keywordflow">return</span>(-1); <a name="l03983"></a>03983 <a name="l03984"></a>03984 <span class="keywordflow">if</span> ((columns &lt; 3) || (rows &lt; 3) || (Divisor == 0)) <a name="l03985"></a>03985 <span class="keywordflow">return</span> (-1); <a name="l03986"></a>03986 <a name="l03987"></a>03987 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>())) { <a name="l03988"></a>03988 <span class="comment">//#ifdef USE_MMX</span> <a name="l03989"></a>03989 <span class="preprocessor">#if defined(USE_MMX) &amp;&amp; defined(i386)</span> <a name="l03990"></a>03990 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l03991"></a>03991 <span class="preprocessor"></span> __asm <a name="l03992"></a>03992 { <a name="l03993"></a>03993 pusha <a name="l03994"></a>03994 pxor mm0, mm0 <span class="comment">/* zero MM0 */</span> <a name="l03995"></a>03995 xor ebx, ebx <span class="comment">/* zero EBX */</span> <a name="l03996"></a>03996 mov bl, Divisor <span class="comment">/* load Divisor into BL */</span> <a name="l03997"></a>03997 mov edx, Kernel <span class="comment">/* load Kernel address into EDX */</span> <a name="l03998"></a>03998 movq mm5, [edx] <span class="comment">/* MM5 = {0,K2,K1,K0} */</span> <a name="l03999"></a>03999 add edx, 8 <span class="comment">/* second row |K0 K1 K2 0| */</span> <a name="l04000"></a>04000 movq mm6, [edx] <span class="comment">/* MM6 = {0,K5,K4,K3} K = |K3 K4 K5 0| */</span> <a name="l04001"></a>04001 add edx, 8 <span class="comment">/* third row |K6 K7 K8 0| */</span> <a name="l04002"></a>04002 movq mm7, [edx] <span class="comment">/* MM7 = {0,K8,K7,K6} */</span> <a name="l04003"></a>04003 <span class="comment">/* ---, */</span> <a name="l04004"></a>04004 mov eax, columns <span class="comment">/* load columns into EAX */</span> <a name="l04005"></a>04005 mov esi, Src <span class="comment">/* ESI = Src row 0 address */</span> <a name="l04006"></a>04006 mov edi, Dest <span class="comment">/* load Dest address to EDI */</span> <a name="l04007"></a>04007 add edi, eax <span class="comment">/* EDI = EDI + columns */</span> <a name="l04008"></a>04008 inc edi <span class="comment">/* 1 byte offset from the left edge */</span> <a name="l04009"></a>04009 mov edx, rows <span class="comment">/* initialize ROWS counter */</span> <a name="l04010"></a>04010 sub edx, 2 <span class="comment">/* do not use first and last row */</span> <a name="l04011"></a>04011 <span class="comment">/* ---, */</span> <a name="l04012"></a>04012 L10320: <a name="l04013"></a>04013 mov ecx, eax <span class="comment">/* initialize COLUMS counter */</span> <a name="l04014"></a>04014 sub ecx, 2 <span class="comment">/* do not use first and last column */</span> <a name="l04015"></a>04015 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l04016"></a>04016 L10322: <a name="l04017"></a>04017 <span class="comment">/* ---, */</span> <a name="l04018"></a>04018 movq mm1, [esi] <span class="comment">/* load 8 bytes of the image first row */</span> <a name="l04019"></a>04019 add esi, eax <span class="comment">/* move one row below */</span> <a name="l04020"></a>04020 movq mm2, [esi] <span class="comment">/* load 8 bytes of the image second row */</span> <a name="l04021"></a>04021 add esi, eax <span class="comment">/* move one row below */</span> <a name="l04022"></a>04022 movq mm3, [esi] <span class="comment">/* load 8 bytes of the image third row */</span> <a name="l04023"></a>04023 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04024"></a>04024 punpcklbw mm2, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04025"></a>04025 punpcklbw mm3, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04026"></a>04026 pmullw mm1, mm5 <span class="comment">/* multiply words first row image*Kernel */</span> <a name="l04027"></a>04027 pmullw mm2, mm6 <span class="comment">/* multiply words second row image*Kernel */</span> <a name="l04028"></a>04028 pmullw mm3, mm7 <span class="comment">/* multiply words third row image*Kernel */</span> <a name="l04029"></a>04029 paddsw mm1, mm2 <span class="comment">/* add 4 words of the first and second rows */</span> <a name="l04030"></a>04030 paddsw mm1, mm3 <span class="comment">/* add 4 words of the third row and result */</span> <a name="l04031"></a>04031 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04032"></a>04032 psrlq mm1, 32 <span class="comment">/* shift 2 left words to the right */</span> <a name="l04033"></a>04033 paddsw mm1, mm2 <span class="comment">/* add 2 left and 2 right result words */</span> <a name="l04034"></a>04034 movq mm3, mm1 <span class="comment">/* copy MM1 into MM3 */</span> <a name="l04035"></a>04035 psrlq mm1, 16 <span class="comment">/* shift 1 left word to the right */</span> <a name="l04036"></a>04036 paddsw mm1, mm3 <span class="comment">/* add 1 left and 1 right result words */</span> <a name="l04037"></a>04037 <span class="comment">/* --, */</span> <a name="l04038"></a>04038 movd mm2, eax <span class="comment">/* save EAX in MM2 */</span> <a name="l04039"></a>04039 movd mm3, edx <span class="comment">/* save EDX in MM3 */</span> <a name="l04040"></a>04040 movd eax, mm1 <span class="comment">/* copy MM1 into EAX */</span> <a name="l04041"></a>04041 psraw mm1, 15 <span class="comment">/* spread sign bit of the result */</span> <a name="l04042"></a>04042 movd edx, mm1 <span class="comment">/* fill EDX with a sign bit */</span> <a name="l04043"></a>04043 idiv bx <span class="comment">/* IDIV - VERY EXPENSIVE */</span> <a name="l04044"></a>04044 movd mm1, eax <span class="comment">/* move result of division into MM1 */</span> <a name="l04045"></a>04045 packuswb mm1, mm0 <span class="comment">/* pack division result with saturation */</span> <a name="l04046"></a>04046 movd eax, mm1 <span class="comment">/* copy saturated result into EAX */</span> <a name="l04047"></a>04047 mov [edi], al <span class="comment">/* copy a byte result into Dest */</span> <a name="l04048"></a>04048 movd edx, mm3 <span class="comment">/* restore saved EDX */</span> <a name="l04049"></a>04049 movd eax, mm2 <span class="comment">/* restore saved EAX */</span> <a name="l04050"></a>04050 <span class="comment">/* --, */</span> <a name="l04051"></a>04051 sub esi, eax <span class="comment">/* move two rows up */</span> <a name="l04052"></a>04052 sub esi, eax <span class="comment">/* */</span> <a name="l04053"></a>04053 inc esi <span class="comment">/* move Src pointer to the next pixel */</span> <a name="l04054"></a>04054 inc edi <span class="comment">/* move Dest pointer to the next pixel */</span> <a name="l04055"></a>04055 <span class="comment">/* ---, */</span> <a name="l04056"></a>04056 dec ecx <span class="comment">/* decrease loop counter COLUMNS */</span> <a name="l04057"></a>04057 jnz L10322 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l04058"></a>04058 add esi, 2 <span class="comment">/* move to the next row in Src */</span> <a name="l04059"></a>04059 add edi, 2 <span class="comment">/* move to the next row in Dest */</span> <a name="l04060"></a>04060 dec edx <span class="comment">/* decrease loop counter ROWS */</span> <a name="l04061"></a>04061 jnz L10320 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l04062"></a>04062 <span class="comment">/* ---, */</span> <a name="l04063"></a>04063 emms <span class="comment">/* exit MMX state */</span> <a name="l04064"></a>04064 popa <a name="l04065"></a>04065 } <a name="l04066"></a>04066 <span class="preprocessor">#else</span> <a name="l04067"></a>04067 <span class="preprocessor"></span> <span class="keyword">asm</span> <span class="keyword">volatile</span> <a name="l04068"></a>04068 (<span class="stringliteral">&quot;pusha \n\t&quot;</span> <span class="stringliteral">&quot;pxor %%mm0, %%mm0 \n\t&quot;</span> <span class="comment">/* zero MM0 */</span> <a name="l04069"></a>04069 <span class="stringliteral">&quot;xor %%ebx, %%ebx \n\t&quot;</span> <span class="comment">/* zero EBX */</span> <a name="l04070"></a>04070 <span class="stringliteral">&quot;mov %5, %%bl \n\t&quot;</span> <span class="comment">/* load Divisor into BL */</span> <a name="l04071"></a>04071 <span class="stringliteral">&quot;mov %4, %%edx \n\t&quot;</span> <span class="comment">/* load Kernel address into EDX */</span> <a name="l04072"></a>04072 <span class="stringliteral">&quot;movq (%%edx), %%mm5 \n\t&quot;</span> <span class="comment">/* MM5 = {0,K2,K1,K0} */</span> <a name="l04073"></a>04073 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* second row |K0 K1 K2 0| */</span> <a name="l04074"></a>04074 <span class="stringliteral">&quot;movq (%%edx), %%mm6 \n\t&quot;</span> <span class="comment">/* MM6 = {0,K5,K4,K3} K = |K3 K4 K5 0| */</span> <a name="l04075"></a>04075 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* third row |K6 K7 K8 0| */</span> <a name="l04076"></a>04076 <span class="stringliteral">&quot;movq (%%edx), %%mm7 \n\t&quot;</span> <span class="comment">/* MM7 = {0,K8,K7,K6} */</span> <a name="l04077"></a>04077 <span class="comment">/* --- */</span> <a name="l04078"></a>04078 <span class="stringliteral">&quot;mov %3, %%eax \n\t&quot;</span> <span class="comment">/* load columns into EAX */</span> <a name="l04079"></a>04079 <span class="stringliteral">&quot;mov %1, %%esi \n\t&quot;</span> <span class="comment">/* ESI = Src row 0 address */</span> <a name="l04080"></a>04080 <span class="stringliteral">&quot;mov %0, %%edi \n\t&quot;</span> <span class="comment">/* load Dest address to EDI */</span> <a name="l04081"></a>04081 <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="comment">/* EDI = EDI + columns */</span> <a name="l04082"></a>04082 <span class="stringliteral">&quot;inc %%edi \n\t&quot;</span> <span class="comment">/* 1 byte offset from the left edge */</span> <a name="l04083"></a>04083 <span class="stringliteral">&quot;mov %2, %%edx \n\t&quot;</span> <span class="comment">/* initialize ROWS counter */</span> <a name="l04084"></a>04084 <span class="stringliteral">&quot;sub $2, %%edx \n\t&quot;</span> <span class="comment">/* do not use first and last row */</span> <a name="l04085"></a>04085 <span class="comment">/* --- */</span> <a name="l04086"></a>04086 <span class="stringliteral">&quot;.L10320: \n\t&quot;</span> <span class="stringliteral">&quot;mov %%eax, %%ecx \n\t&quot;</span> <span class="comment">/* initialize COLUMS counter */</span> <a name="l04087"></a>04087 <span class="stringliteral">&quot;sub $2, %%ecx \n\t&quot;</span> <span class="comment">/* do not use first and last column */</span> <a name="l04088"></a>04088 <span class="stringliteral">&quot;.align 16 \n\t&quot;</span> <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l04089"></a>04089 <span class="stringliteral">&quot;.L10322: \n\t&quot;</span> <a name="l04090"></a>04090 <span class="comment">/* --- */</span> <a name="l04091"></a>04091 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the image first row */</span> <a name="l04092"></a>04092 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move one row below */</span> <a name="l04093"></a>04093 <span class="stringliteral">&quot;movq (%%esi), %%mm2 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the image second row */</span> <a name="l04094"></a>04094 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move one row below */</span> <a name="l04095"></a>04095 <span class="stringliteral">&quot;movq (%%esi), %%mm3 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the image third row */</span> <a name="l04096"></a>04096 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04097"></a>04097 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04098"></a>04098 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm3 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04099"></a>04099 <span class="stringliteral">&quot;pmullw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* multiply words first row image*Kernel */</span> <a name="l04100"></a>04100 <span class="stringliteral">&quot;pmullw %%mm6, %%mm2 \n\t&quot;</span> <span class="comment">/* multiply words second row image*Kernel */</span> <a name="l04101"></a>04101 <span class="stringliteral">&quot;pmullw %%mm7, %%mm3 \n\t&quot;</span> <span class="comment">/* multiply words third row image*Kernel */</span> <a name="l04102"></a>04102 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the first and second rows */</span> <a name="l04103"></a>04103 <span class="stringliteral">&quot;paddsw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the third row and result */</span> <a name="l04104"></a>04104 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04105"></a>04105 <span class="stringliteral">&quot;psrlq $32, %%mm1 \n\t&quot;</span> <span class="comment">/* shift 2 left words to the right */</span> <a name="l04106"></a>04106 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 2 left and 2 right result words */</span> <a name="l04107"></a>04107 <span class="stringliteral">&quot;movq %%mm1, %%mm3 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM3 */</span> <a name="l04108"></a>04108 <span class="stringliteral">&quot;psrlq $16, %%mm1 \n\t&quot;</span> <span class="comment">/* shift 1 left word to the right */</span> <a name="l04109"></a>04109 <span class="stringliteral">&quot;paddsw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* add 1 left and 1 right result words */</span> <a name="l04110"></a>04110 <span class="comment">/* -- */</span> <a name="l04111"></a>04111 <span class="stringliteral">&quot;movd %%eax, %%mm2 \n\t&quot;</span> <span class="comment">/* save EAX in MM2 */</span> <a name="l04112"></a>04112 <span class="stringliteral">&quot;movd %%edx, %%mm3 \n\t&quot;</span> <span class="comment">/* save EDX in MM3 */</span> <a name="l04113"></a>04113 <span class="stringliteral">&quot;movd %%mm1, %%eax \n\t&quot;</span> <span class="comment">/* copy MM1 into EAX */</span> <a name="l04114"></a>04114 <span class="stringliteral">&quot;psraw $15, %%mm1 \n\t&quot;</span> <span class="comment">/* spread sign bit of the result */</span> <a name="l04115"></a>04115 <span class="stringliteral">&quot;movd %%mm1, %%edx \n\t&quot;</span> <span class="comment">/* fill EDX with a sign bit */</span> <a name="l04116"></a>04116 <span class="stringliteral">&quot;idivw %%bx \n\t&quot;</span> <span class="comment">/* IDIV - VERY EXPENSIVE */</span> <a name="l04117"></a>04117 <span class="stringliteral">&quot;movd %%eax, %%mm1 \n\t&quot;</span> <span class="comment">/* move result of division into MM1 */</span> <a name="l04118"></a>04118 <span class="stringliteral">&quot;packuswb %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* pack division result with saturation */</span> <a name="l04119"></a>04119 <span class="stringliteral">&quot;movd %%mm1, %%eax \n\t&quot;</span> <span class="comment">/* copy saturated result into EAX */</span> <a name="l04120"></a>04120 <span class="stringliteral">&quot;mov %%al, (%%edi) \n\t&quot;</span> <span class="comment">/* copy a byte result into Dest */</span> <a name="l04121"></a>04121 <span class="stringliteral">&quot;movd %%mm3, %%edx \n\t&quot;</span> <span class="comment">/* restore saved EDX */</span> <a name="l04122"></a>04122 <span class="stringliteral">&quot;movd %%mm2, %%eax \n\t&quot;</span> <span class="comment">/* restore saved EAX */</span> <a name="l04123"></a>04123 <span class="comment">/* -- */</span> <a name="l04124"></a>04124 <span class="stringliteral">&quot;sub %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move two rows up */</span> <a name="l04125"></a>04125 <span class="stringliteral">&quot;sub %%eax, %%esi \n\t&quot;</span> <span class="comment">/* */</span> <a name="l04126"></a>04126 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer to the next pixel */</span> <a name="l04127"></a>04127 <span class="stringliteral">&quot;inc %%edi \n\t&quot;</span> <span class="comment">/* move Dest pointer to the next pixel */</span> <a name="l04128"></a>04128 <span class="comment">/* --- */</span> <a name="l04129"></a>04129 <span class="stringliteral">&quot;dec %%ecx \n\t&quot;</span> <span class="comment">/* decrease loop counter COLUMNS */</span> <a name="l04130"></a>04130 <span class="stringliteral">&quot;jnz .L10322 \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l04131"></a>04131 <span class="stringliteral">&quot;add $2, %%esi \n\t&quot;</span> <span class="comment">/* move to the next row in Src */</span> <a name="l04132"></a>04132 <span class="stringliteral">&quot;add $2, %%edi \n\t&quot;</span> <span class="comment">/* move to the next row in Dest */</span> <a name="l04133"></a>04133 <span class="stringliteral">&quot;dec %%edx \n\t&quot;</span> <span class="comment">/* decrease loop counter ROWS */</span> <a name="l04134"></a>04134 <span class="stringliteral">&quot;jnz .L10320 \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l04135"></a>04135 <span class="comment">/* --- */</span> <a name="l04136"></a>04136 <span class="stringliteral">&quot;emms \n\t&quot;</span> <span class="comment">/* exit MMX state */</span> <a name="l04137"></a>04137 <span class="stringliteral">&quot;popa \n\t&quot;</span>:<span class="stringliteral">&quot;=m&quot;</span> (Dest) <span class="comment">/* %0 */</span> <a name="l04138"></a>04138 :<span class="stringliteral">&quot;m&quot;</span>(Src), <span class="comment">/* %1 */</span> <a name="l04139"></a>04139 <span class="stringliteral">&quot;m&quot;</span>(rows), <span class="comment">/* %2 */</span> <a name="l04140"></a>04140 <span class="stringliteral">&quot;m&quot;</span>(columns), <span class="comment">/* %3 */</span> <a name="l04141"></a>04141 <span class="stringliteral">&quot;m&quot;</span>(Kernel), <span class="comment">/* %4 */</span> <a name="l04142"></a>04142 <span class="stringliteral">&quot;m&quot;</span>(Divisor) <span class="comment">/* %5 */</span> <a name="l04143"></a>04143 ); <a name="l04144"></a>04144 <span class="preprocessor">#endif</span> <a name="l04145"></a>04145 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l04146"></a>04146 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l04147"></a>04147 } <span class="keywordflow">else</span> { <a name="l04148"></a>04148 <span class="comment">/* No non-MMX implementation yet */</span> <a name="l04149"></a>04149 <span class="keywordflow">return</span> (-1); <a name="l04150"></a>04150 } <a name="l04151"></a>04151 } <a name="l04152"></a>04152 <a name="l04167"></a><a class="code" href="_s_d_l__image_filter_8h.html#a432d7bcc34b6bea42d1a07b4db795e1f">04167</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#ac9a556492480ce71f54d456a0ff7e6cb" title="Filter using ConvolveKernel5x5Divide: Dij = saturation0and255( ... )">SDL_imageFilterConvolveKernel5x5Divide</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">int</span> rows, <span class="keywordtype">int</span> columns, <a name="l04168"></a>04168 <span class="keywordtype">signed</span> <span class="keywordtype">short</span> *Kernel, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Divisor) <a name="l04169"></a>04169 { <a name="l04170"></a>04170 <span class="comment">/* Validate input parameters */</span> <a name="l04171"></a>04171 <span class="keywordflow">if</span> ((Src == NULL) || (Dest == NULL) || (Kernel == NULL)) <a name="l04172"></a>04172 <span class="keywordflow">return</span>(-1); <a name="l04173"></a>04173 <a name="l04174"></a>04174 <span class="keywordflow">if</span> ((columns &lt; 5) || (rows &lt; 5) || (Divisor == 0)) <a name="l04175"></a>04175 <span class="keywordflow">return</span> (-1); <a name="l04176"></a>04176 <a name="l04177"></a>04177 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>())) { <a name="l04178"></a>04178 <span class="comment">//#ifdef USE_MMX</span> <a name="l04179"></a>04179 <span class="preprocessor">#if defined(USE_MMX) &amp;&amp; defined(i386)</span> <a name="l04180"></a>04180 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l04181"></a>04181 <span class="preprocessor"></span> __asm <a name="l04182"></a>04182 { <a name="l04183"></a>04183 pusha <a name="l04184"></a>04184 pxor mm0, mm0 <span class="comment">/* zero MM0 */</span> <a name="l04185"></a>04185 xor ebx, ebx <span class="comment">/* zero EBX */</span> <a name="l04186"></a>04186 mov bl, Divisor <span class="comment">/* load Divisor into BL */</span> <a name="l04187"></a>04187 movd mm5, ebx <span class="comment">/* copy Divisor into MM5 */</span> <a name="l04188"></a>04188 mov edx, Kernel <span class="comment">/* load Kernel address into EDX */</span> <a name="l04189"></a>04189 mov esi, Src <span class="comment">/* load Src address to ESI */</span> <a name="l04190"></a>04190 mov edi, Dest <span class="comment">/* load Dest address to EDI */</span> <a name="l04191"></a>04191 add edi, 2 <span class="comment">/* 2 column offset from the left edge */</span> <a name="l04192"></a>04192 mov eax, columns <span class="comment">/* load columns into EAX */</span> <a name="l04193"></a>04193 shl eax, 1 <span class="comment">/* EAX = columns * 2 */</span> <a name="l04194"></a>04194 add edi, eax <span class="comment">/* 2 row offset from the top edge */</span> <a name="l04195"></a>04195 shr eax, 1 <span class="comment">/* EAX = columns */</span> <a name="l04196"></a>04196 mov ebx, rows <span class="comment">/* initialize ROWS counter */</span> <a name="l04197"></a>04197 sub ebx, 4 <span class="comment">/* do not use first 2 and last 2 rows */</span> <a name="l04198"></a>04198 <span class="comment">/* ---, */</span> <a name="l04199"></a>04199 L10330: <a name="l04200"></a>04200 mov ecx, eax <span class="comment">/* initialize COLUMNS counter */</span> <a name="l04201"></a>04201 sub ecx, 4 <span class="comment">/* do not use first 2 and last 2 columns */</span> <a name="l04202"></a>04202 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l04203"></a>04203 L10332: <a name="l04204"></a>04204 pxor mm7, mm7 <span class="comment">/* zero MM7 (accumulator) */</span> <a name="l04205"></a>04205 movd mm6, esi <span class="comment">/* save ESI in MM6 */</span> <a name="l04206"></a>04206 <span class="comment">/* --- 1 */</span> <a name="l04207"></a>04207 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04208"></a>04208 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04209"></a>04209 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04210"></a>04210 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04211"></a>04211 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04212"></a>04212 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04213"></a>04213 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04214"></a>04214 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04215"></a>04215 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04216"></a>04216 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l04217"></a>04217 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l04218"></a>04218 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04219"></a>04219 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04220"></a>04220 <span class="comment">/* --- 2 */</span> <a name="l04221"></a>04221 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04222"></a>04222 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04223"></a>04223 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04224"></a>04224 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04225"></a>04225 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04226"></a>04226 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04227"></a>04227 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04228"></a>04228 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04229"></a>04229 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04230"></a>04230 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l04231"></a>04231 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l04232"></a>04232 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04233"></a>04233 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04234"></a>04234 <span class="comment">/* --- 3 */</span> <a name="l04235"></a>04235 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04236"></a>04236 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04237"></a>04237 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04238"></a>04238 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04239"></a>04239 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04240"></a>04240 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04241"></a>04241 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04242"></a>04242 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04243"></a>04243 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04244"></a>04244 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l04245"></a>04245 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l04246"></a>04246 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04247"></a>04247 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04248"></a>04248 <span class="comment">/* --- 4 */</span> <a name="l04249"></a>04249 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04250"></a>04250 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04251"></a>04251 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04252"></a>04252 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04253"></a>04253 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04254"></a>04254 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04255"></a>04255 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04256"></a>04256 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04257"></a>04257 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04258"></a>04258 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l04259"></a>04259 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l04260"></a>04260 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04261"></a>04261 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04262"></a>04262 <span class="comment">/* --- 5 */</span> <a name="l04263"></a>04263 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04264"></a>04264 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04265"></a>04265 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04266"></a>04266 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04267"></a>04267 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04268"></a>04268 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04269"></a>04269 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04270"></a>04270 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l04271"></a>04271 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l04272"></a>04272 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04273"></a>04273 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04274"></a>04274 <span class="comment">/* ---, */</span> <a name="l04275"></a>04275 movq mm3, mm7 <span class="comment">/* copy MM7 into MM3 */</span> <a name="l04276"></a>04276 psrlq mm7, 32 <span class="comment">/* shift 2 left words to the right */</span> <a name="l04277"></a>04277 paddsw mm7, mm3 <span class="comment">/* add 2 left and 2 right result words */</span> <a name="l04278"></a>04278 movq mm2, mm7 <span class="comment">/* copy MM7 into MM2 */</span> <a name="l04279"></a>04279 psrlq mm7, 16 <span class="comment">/* shift 1 left word to the right */</span> <a name="l04280"></a>04280 paddsw mm7, mm2 <span class="comment">/* add 1 left and 1 right result words */</span> <a name="l04281"></a>04281 <span class="comment">/* ---, */</span> <a name="l04282"></a>04282 movd mm1, eax <span class="comment">/* save EDX in MM1 */</span> <a name="l04283"></a>04283 movd mm2, ebx <span class="comment">/* save EDX in MM2 */</span> <a name="l04284"></a>04284 movd mm3, edx <span class="comment">/* save EDX in MM3 */</span> <a name="l04285"></a>04285 movd eax, mm7 <span class="comment">/* load summation result into EAX */</span> <a name="l04286"></a>04286 psraw mm7, 15 <span class="comment">/* spread sign bit of the result */</span> <a name="l04287"></a>04287 movd ebx, mm5 <span class="comment">/* load Divisor into EBX */</span> <a name="l04288"></a>04288 movd edx, mm7 <span class="comment">/* fill EDX with a sign bit */</span> <a name="l04289"></a>04289 idiv bx <span class="comment">/* IDIV - VERY EXPENSIVE */</span> <a name="l04290"></a>04290 movd mm7, eax <span class="comment">/* move result of division into MM7 */</span> <a name="l04291"></a>04291 packuswb mm7, mm0 <span class="comment">/* pack division result with saturation */</span> <a name="l04292"></a>04292 movd eax, mm7 <span class="comment">/* copy saturated result into EAX */</span> <a name="l04293"></a>04293 mov [edi], al <span class="comment">/* copy a byte result into Dest */</span> <a name="l04294"></a>04294 movd edx, mm3 <span class="comment">/* restore saved EDX */</span> <a name="l04295"></a>04295 movd ebx, mm2 <span class="comment">/* restore saved EBX */</span> <a name="l04296"></a>04296 movd eax, mm1 <span class="comment">/* restore saved EAX */</span> <a name="l04297"></a>04297 <span class="comment">/* --, */</span> <a name="l04298"></a>04298 movd esi, mm6 <span class="comment">/* move Src pointer to the top pixel */</span> <a name="l04299"></a>04299 sub edx, 72 <span class="comment">/* EDX = Kernel address */</span> <a name="l04300"></a>04300 inc esi <span class="comment">/* move Src pointer to the next pixel */</span> <a name="l04301"></a>04301 inc edi <span class="comment">/* move Dest pointer to the next pixel */</span> <a name="l04302"></a>04302 <span class="comment">/* ---, */</span> <a name="l04303"></a>04303 dec ecx <span class="comment">/* decrease loop counter COLUMNS */</span> <a name="l04304"></a>04304 jnz L10332 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l04305"></a>04305 add esi, 4 <span class="comment">/* move to the next row in Src */</span> <a name="l04306"></a>04306 add edi, 4 <span class="comment">/* move to the next row in Dest */</span> <a name="l04307"></a>04307 dec ebx <span class="comment">/* decrease loop counter ROWS */</span> <a name="l04308"></a>04308 jnz L10330 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l04309"></a>04309 <span class="comment">/* ---, */</span> <a name="l04310"></a>04310 emms <span class="comment">/* exit MMX state */</span> <a name="l04311"></a>04311 popa <a name="l04312"></a>04312 } <a name="l04313"></a>04313 <span class="preprocessor">#else</span> <a name="l04314"></a>04314 <span class="preprocessor"></span> <span class="keyword">asm</span> <span class="keyword">volatile</span> <a name="l04315"></a>04315 (<span class="stringliteral">&quot;pusha \n\t&quot;</span> <span class="stringliteral">&quot;pxor %%mm0, %%mm0 \n\t&quot;</span> <span class="comment">/* zero MM0 */</span> <a name="l04316"></a>04316 <span class="stringliteral">&quot;xor %%ebx, %%ebx \n\t&quot;</span> <span class="comment">/* zero EBX */</span> <a name="l04317"></a>04317 <span class="stringliteral">&quot;mov %5, %%bl \n\t&quot;</span> <span class="comment">/* load Divisor into BL */</span> <a name="l04318"></a>04318 <span class="stringliteral">&quot;movd %%ebx, %%mm5 \n\t&quot;</span> <span class="comment">/* copy Divisor into MM5 */</span> <a name="l04319"></a>04319 <span class="stringliteral">&quot;mov %4, %%edx \n\t&quot;</span> <span class="comment">/* load Kernel address into EDX */</span> <a name="l04320"></a>04320 <span class="stringliteral">&quot;mov %1, %%esi \n\t&quot;</span> <span class="comment">/* load Src address to ESI */</span> <a name="l04321"></a>04321 <span class="stringliteral">&quot;mov %0, %%edi \n\t&quot;</span> <span class="comment">/* load Dest address to EDI */</span> <a name="l04322"></a>04322 <span class="stringliteral">&quot;add $2, %%edi \n\t&quot;</span> <span class="comment">/* 2 column offset from the left edge */</span> <a name="l04323"></a>04323 <span class="stringliteral">&quot;mov %3, %%eax \n\t&quot;</span> <span class="comment">/* load columns into EAX */</span> <a name="l04324"></a>04324 <span class="stringliteral">&quot;shl $1, %%eax \n\t&quot;</span> <span class="comment">/* EAX = columns * 2 */</span> <a name="l04325"></a>04325 <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="comment">/* 2 row offset from the top edge */</span> <a name="l04326"></a>04326 <span class="stringliteral">&quot;shr $1, %%eax \n\t&quot;</span> <span class="comment">/* EAX = columns */</span> <a name="l04327"></a>04327 <span class="stringliteral">&quot;mov %2, %%ebx \n\t&quot;</span> <span class="comment">/* initialize ROWS counter */</span> <a name="l04328"></a>04328 <span class="stringliteral">&quot;sub $4, %%ebx \n\t&quot;</span> <span class="comment">/* do not use first 2 and last 2 rows */</span> <a name="l04329"></a>04329 <span class="comment">/* --- */</span> <a name="l04330"></a>04330 <span class="stringliteral">&quot;.L10330: \n\t&quot;</span> <span class="stringliteral">&quot;mov %%eax, %%ecx \n\t&quot;</span> <span class="comment">/* initialize COLUMNS counter */</span> <a name="l04331"></a>04331 <span class="stringliteral">&quot;sub $4, %%ecx \n\t&quot;</span> <span class="comment">/* do not use first 2 and last 2 columns */</span> <a name="l04332"></a>04332 <span class="stringliteral">&quot;.align 16 \n\t&quot;</span> <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l04333"></a>04333 <span class="stringliteral">&quot;.L10332: \n\t&quot;</span> <span class="stringliteral">&quot;pxor %%mm7, %%mm7 \n\t&quot;</span> <span class="comment">/* zero MM7 (accumulator) */</span> <a name="l04334"></a>04334 <span class="stringliteral">&quot;movd %%esi, %%mm6 \n\t&quot;</span> <span class="comment">/* save ESI in MM6 */</span> <a name="l04335"></a>04335 <span class="comment">/* --- 1 */</span> <a name="l04336"></a>04336 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04337"></a>04337 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04338"></a>04338 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04339"></a>04339 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04340"></a>04340 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04341"></a>04341 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04342"></a>04342 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04343"></a>04343 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04344"></a>04344 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04345"></a>04345 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04346"></a>04346 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l04347"></a>04347 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04348"></a>04348 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04349"></a>04349 <span class="comment">/* --- 2 */</span> <a name="l04350"></a>04350 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04351"></a>04351 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04352"></a>04352 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04353"></a>04353 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04354"></a>04354 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04355"></a>04355 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04356"></a>04356 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04357"></a>04357 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04358"></a>04358 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04359"></a>04359 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04360"></a>04360 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l04361"></a>04361 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04362"></a>04362 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04363"></a>04363 <span class="comment">/* --- 3 */</span> <a name="l04364"></a>04364 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04365"></a>04365 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04366"></a>04366 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04367"></a>04367 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04368"></a>04368 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04369"></a>04369 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04370"></a>04370 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04371"></a>04371 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04372"></a>04372 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04373"></a>04373 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04374"></a>04374 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l04375"></a>04375 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04376"></a>04376 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04377"></a>04377 <span class="comment">/* --- 4 */</span> <a name="l04378"></a>04378 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04379"></a>04379 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04380"></a>04380 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04381"></a>04381 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04382"></a>04382 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04383"></a>04383 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04384"></a>04384 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04385"></a>04385 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04386"></a>04386 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04387"></a>04387 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04388"></a>04388 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l04389"></a>04389 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04390"></a>04390 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04391"></a>04391 <span class="comment">/* --- 5 */</span> <a name="l04392"></a>04392 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04393"></a>04393 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04394"></a>04394 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04395"></a>04395 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04396"></a>04396 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04397"></a>04397 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04398"></a>04398 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04399"></a>04399 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04400"></a>04400 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l04401"></a>04401 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04402"></a>04402 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04403"></a>04403 <span class="comment">/* --- */</span> <a name="l04404"></a>04404 <span class="stringliteral">&quot;movq %%mm7, %%mm3 \n\t&quot;</span> <span class="comment">/* copy MM7 into MM3 */</span> <a name="l04405"></a>04405 <span class="stringliteral">&quot;psrlq $32, %%mm7 \n\t&quot;</span> <span class="comment">/* shift 2 left words to the right */</span> <a name="l04406"></a>04406 <span class="stringliteral">&quot;paddsw %%mm3, %%mm7 \n\t&quot;</span> <span class="comment">/* add 2 left and 2 right result words */</span> <a name="l04407"></a>04407 <span class="stringliteral">&quot;movq %%mm7, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM7 into MM2 */</span> <a name="l04408"></a>04408 <span class="stringliteral">&quot;psrlq $16, %%mm7 \n\t&quot;</span> <span class="comment">/* shift 1 left word to the right */</span> <a name="l04409"></a>04409 <span class="stringliteral">&quot;paddsw %%mm2, %%mm7 \n\t&quot;</span> <span class="comment">/* add 1 left and 1 right result words */</span> <a name="l04410"></a>04410 <span class="comment">/* --- */</span> <a name="l04411"></a>04411 <span class="stringliteral">&quot;movd %%eax, %%mm1 \n\t&quot;</span> <span class="comment">/* save EDX in MM1 */</span> <a name="l04412"></a>04412 <span class="stringliteral">&quot;movd %%ebx, %%mm2 \n\t&quot;</span> <span class="comment">/* save EDX in MM2 */</span> <a name="l04413"></a>04413 <span class="stringliteral">&quot;movd %%edx, %%mm3 \n\t&quot;</span> <span class="comment">/* save EDX in MM3 */</span> <a name="l04414"></a>04414 <span class="stringliteral">&quot;movd %%mm7, %%eax \n\t&quot;</span> <span class="comment">/* load summation result into EAX */</span> <a name="l04415"></a>04415 <span class="stringliteral">&quot;psraw $15, %%mm7 \n\t&quot;</span> <span class="comment">/* spread sign bit of the result */</span> <a name="l04416"></a>04416 <span class="stringliteral">&quot;movd %%mm5, %%ebx \n\t&quot;</span> <span class="comment">/* load Divisor into EBX */</span> <a name="l04417"></a>04417 <span class="stringliteral">&quot;movd %%mm7, %%edx \n\t&quot;</span> <span class="comment">/* fill EDX with a sign bit */</span> <a name="l04418"></a>04418 <span class="stringliteral">&quot;idivw %%bx \n\t&quot;</span> <span class="comment">/* IDIV - VERY EXPENSIVE */</span> <a name="l04419"></a>04419 <span class="stringliteral">&quot;movd %%eax, %%mm7 \n\t&quot;</span> <span class="comment">/* move result of division into MM7 */</span> <a name="l04420"></a>04420 <span class="stringliteral">&quot;packuswb %%mm0, %%mm7 \n\t&quot;</span> <span class="comment">/* pack division result with saturation */</span> <a name="l04421"></a>04421 <span class="stringliteral">&quot;movd %%mm7, %%eax \n\t&quot;</span> <span class="comment">/* copy saturated result into EAX */</span> <a name="l04422"></a>04422 <span class="stringliteral">&quot;mov %%al, (%%edi) \n\t&quot;</span> <span class="comment">/* copy a byte result into Dest */</span> <a name="l04423"></a>04423 <span class="stringliteral">&quot;movd %%mm3, %%edx \n\t&quot;</span> <span class="comment">/* restore saved EDX */</span> <a name="l04424"></a>04424 <span class="stringliteral">&quot;movd %%mm2, %%ebx \n\t&quot;</span> <span class="comment">/* restore saved EBX */</span> <a name="l04425"></a>04425 <span class="stringliteral">&quot;movd %%mm1, %%eax \n\t&quot;</span> <span class="comment">/* restore saved EAX */</span> <a name="l04426"></a>04426 <span class="comment">/* -- */</span> <a name="l04427"></a>04427 <span class="stringliteral">&quot;movd %%mm6, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer to the top pixel */</span> <a name="l04428"></a>04428 <span class="stringliteral">&quot;sub $72, %%edx \n\t&quot;</span> <span class="comment">/* EDX = Kernel address */</span> <a name="l04429"></a>04429 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer to the next pixel */</span> <a name="l04430"></a>04430 <span class="stringliteral">&quot;inc %%edi \n\t&quot;</span> <span class="comment">/* move Dest pointer to the next pixel */</span> <a name="l04431"></a>04431 <span class="comment">/* --- */</span> <a name="l04432"></a>04432 <span class="stringliteral">&quot;dec %%ecx \n\t&quot;</span> <span class="comment">/* decrease loop counter COLUMNS */</span> <a name="l04433"></a>04433 <span class="stringliteral">&quot;jnz .L10332 \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l04434"></a>04434 <span class="stringliteral">&quot;add $4, %%esi \n\t&quot;</span> <span class="comment">/* move to the next row in Src */</span> <a name="l04435"></a>04435 <span class="stringliteral">&quot;add $4, %%edi \n\t&quot;</span> <span class="comment">/* move to the next row in Dest */</span> <a name="l04436"></a>04436 <span class="stringliteral">&quot;dec %%ebx \n\t&quot;</span> <span class="comment">/* decrease loop counter ROWS */</span> <a name="l04437"></a>04437 <span class="stringliteral">&quot;jnz .L10330 \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l04438"></a>04438 <span class="comment">/* --- */</span> <a name="l04439"></a>04439 <span class="stringliteral">&quot;emms \n\t&quot;</span> <span class="comment">/* exit MMX state */</span> <a name="l04440"></a>04440 <span class="stringliteral">&quot;popa \n\t&quot;</span>:<span class="stringliteral">&quot;=m&quot;</span> (Dest) <span class="comment">/* %0 */</span> <a name="l04441"></a>04441 :<span class="stringliteral">&quot;m&quot;</span>(Src), <span class="comment">/* %1 */</span> <a name="l04442"></a>04442 <span class="stringliteral">&quot;m&quot;</span>(rows), <span class="comment">/* %2 */</span> <a name="l04443"></a>04443 <span class="stringliteral">&quot;m&quot;</span>(columns), <span class="comment">/* %3 */</span> <a name="l04444"></a>04444 <span class="stringliteral">&quot;m&quot;</span>(Kernel), <span class="comment">/* %4 */</span> <a name="l04445"></a>04445 <span class="stringliteral">&quot;m&quot;</span>(Divisor) <span class="comment">/* %5 */</span> <a name="l04446"></a>04446 ); <a name="l04447"></a>04447 <span class="preprocessor">#endif</span> <a name="l04448"></a>04448 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l04449"></a>04449 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l04450"></a>04450 } <span class="keywordflow">else</span> { <a name="l04451"></a>04451 <span class="comment">/* No non-MMX implementation yet */</span> <a name="l04452"></a>04452 <span class="keywordflow">return</span> (-1); <a name="l04453"></a>04453 } <a name="l04454"></a>04454 } <a name="l04455"></a>04455 <a name="l04470"></a><a class="code" href="_s_d_l__image_filter_8h.html#acc177cf891758fdc4bf7533fb266e339">04470</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a363f48e6843fd3f48da53688b89bca48" title="Filter using ConvolveKernel7x7Divide: Dij = saturation0and255( ... )">SDL_imageFilterConvolveKernel7x7Divide</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">int</span> rows, <span class="keywordtype">int</span> columns, <a name="l04471"></a>04471 <span class="keywordtype">signed</span> <span class="keywordtype">short</span> *Kernel, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Divisor) <a name="l04472"></a>04472 { <a name="l04473"></a>04473 <span class="comment">/* Validate input parameters */</span> <a name="l04474"></a>04474 <span class="keywordflow">if</span> ((Src == NULL) || (Dest == NULL) || (Kernel == NULL)) <a name="l04475"></a>04475 <span class="keywordflow">return</span>(-1); <a name="l04476"></a>04476 <a name="l04477"></a>04477 <span class="keywordflow">if</span> ((columns &lt; 7) || (rows &lt; 7) || (Divisor == 0)) <a name="l04478"></a>04478 <span class="keywordflow">return</span> (-1); <a name="l04479"></a>04479 <a name="l04480"></a>04480 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>())) { <a name="l04481"></a>04481 <span class="comment">//#ifdef USE_MMX</span> <a name="l04482"></a>04482 <span class="preprocessor">#if defined(USE_MMX) &amp;&amp; defined(i386)</span> <a name="l04483"></a>04483 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l04484"></a>04484 <span class="preprocessor"></span> __asm <a name="l04485"></a>04485 { <a name="l04486"></a>04486 pusha <a name="l04487"></a>04487 pxor mm0, mm0 <span class="comment">/* zero MM0 */</span> <a name="l04488"></a>04488 xor ebx, ebx <span class="comment">/* zero EBX */</span> <a name="l04489"></a>04489 mov bl, Divisor <span class="comment">/* load Divisor into BL */</span> <a name="l04490"></a>04490 movd mm5, ebx <span class="comment">/* copy Divisor into MM5 */</span> <a name="l04491"></a>04491 mov edx, Kernel <span class="comment">/* load Kernel address into EDX */</span> <a name="l04492"></a>04492 mov esi, Src <span class="comment">/* load Src address to ESI */</span> <a name="l04493"></a>04493 mov edi, Dest <span class="comment">/* load Dest address to EDI */</span> <a name="l04494"></a>04494 add edi, 3 <span class="comment">/* 3 column offset from the left edge */</span> <a name="l04495"></a>04495 mov eax, columns <span class="comment">/* load columns into EAX */</span> <a name="l04496"></a>04496 add edi, eax <span class="comment">/* 3 row offset from the top edge */</span> <a name="l04497"></a>04497 add edi, eax <a name="l04498"></a>04498 add edi, eax <a name="l04499"></a>04499 mov ebx, rows <span class="comment">/* initialize ROWS counter */</span> <a name="l04500"></a>04500 sub ebx, 6 <span class="comment">/* do not use first 3 and last 3 rows */</span> <a name="l04501"></a>04501 <span class="comment">/* ---, */</span> <a name="l04502"></a>04502 L10340: <a name="l04503"></a>04503 mov ecx, eax <span class="comment">/* initialize COLUMNS counter */</span> <a name="l04504"></a>04504 sub ecx, 6 <span class="comment">/* do not use first 3 and last 3 columns */</span> <a name="l04505"></a>04505 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l04506"></a>04506 L10342: <a name="l04507"></a>04507 pxor mm7, mm7 <span class="comment">/* zero MM7 (accumulator) */</span> <a name="l04508"></a>04508 movd mm6, esi <span class="comment">/* save ESI in MM6 */</span> <a name="l04509"></a>04509 <span class="comment">/* --- 1 */</span> <a name="l04510"></a>04510 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04511"></a>04511 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04512"></a>04512 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04513"></a>04513 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04514"></a>04514 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04515"></a>04515 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04516"></a>04516 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04517"></a>04517 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04518"></a>04518 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04519"></a>04519 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l04520"></a>04520 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l04521"></a>04521 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04522"></a>04522 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04523"></a>04523 <span class="comment">/* --- 2 */</span> <a name="l04524"></a>04524 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04525"></a>04525 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04526"></a>04526 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04527"></a>04527 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04528"></a>04528 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04529"></a>04529 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04530"></a>04530 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04531"></a>04531 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04532"></a>04532 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04533"></a>04533 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l04534"></a>04534 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l04535"></a>04535 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04536"></a>04536 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04537"></a>04537 <span class="comment">/* --- 3 */</span> <a name="l04538"></a>04538 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04539"></a>04539 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04540"></a>04540 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04541"></a>04541 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04542"></a>04542 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04543"></a>04543 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04544"></a>04544 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04545"></a>04545 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04546"></a>04546 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04547"></a>04547 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l04548"></a>04548 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l04549"></a>04549 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04550"></a>04550 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04551"></a>04551 <span class="comment">/* --- 4 */</span> <a name="l04552"></a>04552 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04553"></a>04553 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04554"></a>04554 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04555"></a>04555 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04556"></a>04556 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04557"></a>04557 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04558"></a>04558 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04559"></a>04559 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04560"></a>04560 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04561"></a>04561 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l04562"></a>04562 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l04563"></a>04563 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04564"></a>04564 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04565"></a>04565 <span class="comment">/* --- 5 */</span> <a name="l04566"></a>04566 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04567"></a>04567 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04568"></a>04568 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04569"></a>04569 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04570"></a>04570 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04571"></a>04571 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04572"></a>04572 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04573"></a>04573 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04574"></a>04574 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04575"></a>04575 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l04576"></a>04576 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l04577"></a>04577 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04578"></a>04578 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04579"></a>04579 <span class="comment">/* --- 6 */</span> <a name="l04580"></a>04580 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04581"></a>04581 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04582"></a>04582 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04583"></a>04583 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04584"></a>04584 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04585"></a>04585 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04586"></a>04586 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04587"></a>04587 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04588"></a>04588 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04589"></a>04589 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l04590"></a>04590 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l04591"></a>04591 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04592"></a>04592 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04593"></a>04593 <span class="comment">/* --- 7 */</span> <a name="l04594"></a>04594 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04595"></a>04595 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04596"></a>04596 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04597"></a>04597 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04598"></a>04598 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04599"></a>04599 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04600"></a>04600 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04601"></a>04601 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l04602"></a>04602 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l04603"></a>04603 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04604"></a>04604 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04605"></a>04605 <span class="comment">/* ---, */</span> <a name="l04606"></a>04606 movq mm3, mm7 <span class="comment">/* copy MM7 into MM3 */</span> <a name="l04607"></a>04607 psrlq mm7, 32 <span class="comment">/* shift 2 left words to the right */</span> <a name="l04608"></a>04608 paddsw mm7, mm3 <span class="comment">/* add 2 left and 2 right result words */</span> <a name="l04609"></a>04609 movq mm2, mm7 <span class="comment">/* copy MM7 into MM2 */</span> <a name="l04610"></a>04610 psrlq mm7, 16 <span class="comment">/* shift 1 left word to the right */</span> <a name="l04611"></a>04611 paddsw mm7, mm2 <span class="comment">/* add 1 left and 1 right result words */</span> <a name="l04612"></a>04612 <span class="comment">/* ---, */</span> <a name="l04613"></a>04613 movd mm1, eax <span class="comment">/* save EDX in MM1 */</span> <a name="l04614"></a>04614 movd mm2, ebx <span class="comment">/* save EDX in MM2 */</span> <a name="l04615"></a>04615 movd mm3, edx <span class="comment">/* save EDX in MM3 */</span> <a name="l04616"></a>04616 movd eax, mm7 <span class="comment">/* load summation result into EAX */</span> <a name="l04617"></a>04617 psraw mm7, 15 <span class="comment">/* spread sign bit of the result */</span> <a name="l04618"></a>04618 movd ebx, mm5 <span class="comment">/* load Divisor into EBX */</span> <a name="l04619"></a>04619 movd edx, mm7 <span class="comment">/* fill EDX with a sign bit */</span> <a name="l04620"></a>04620 idiv bx <span class="comment">/* IDIV - VERY EXPENSIVE */</span> <a name="l04621"></a>04621 movd mm7, eax <span class="comment">/* move result of division into MM7 */</span> <a name="l04622"></a>04622 packuswb mm7, mm0 <span class="comment">/* pack division result with saturation */</span> <a name="l04623"></a>04623 movd eax, mm7 <span class="comment">/* copy saturated result into EAX */</span> <a name="l04624"></a>04624 mov [edi], al <span class="comment">/* copy a byte result into Dest */</span> <a name="l04625"></a>04625 movd edx, mm3 <span class="comment">/* restore saved EDX */</span> <a name="l04626"></a>04626 movd ebx, mm2 <span class="comment">/* restore saved EBX */</span> <a name="l04627"></a>04627 movd eax, mm1 <span class="comment">/* restore saved EAX */</span> <a name="l04628"></a>04628 <span class="comment">/* --, */</span> <a name="l04629"></a>04629 movd esi, mm6 <span class="comment">/* move Src pointer to the top pixel */</span> <a name="l04630"></a>04630 sub edx, 104 <span class="comment">/* EDX = Kernel address */</span> <a name="l04631"></a>04631 inc esi <span class="comment">/* move Src pointer to the next pixel */</span> <a name="l04632"></a>04632 inc edi <span class="comment">/* move Dest pointer to the next pixel */</span> <a name="l04633"></a>04633 <span class="comment">/* ---, */</span> <a name="l04634"></a>04634 dec ecx <span class="comment">/* decrease loop counter COLUMNS */</span> <a name="l04635"></a>04635 jnz L10342 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l04636"></a>04636 add esi, 6 <span class="comment">/* move to the next row in Src */</span> <a name="l04637"></a>04637 add edi, 6 <span class="comment">/* move to the next row in Dest */</span> <a name="l04638"></a>04638 dec ebx <span class="comment">/* decrease loop counter ROWS */</span> <a name="l04639"></a>04639 jnz L10340 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l04640"></a>04640 <span class="comment">/* ---, */</span> <a name="l04641"></a>04641 emms <span class="comment">/* exit MMX state */</span> <a name="l04642"></a>04642 popa <a name="l04643"></a>04643 } <a name="l04644"></a>04644 <span class="preprocessor">#else</span> <a name="l04645"></a>04645 <span class="preprocessor"></span> <span class="keyword">asm</span> <span class="keyword">volatile</span> <a name="l04646"></a>04646 (<span class="stringliteral">&quot;pusha \n\t&quot;</span> <span class="stringliteral">&quot;pxor %%mm0, %%mm0 \n\t&quot;</span> <span class="comment">/* zero MM0 */</span> <a name="l04647"></a>04647 <span class="stringliteral">&quot;xor %%ebx, %%ebx \n\t&quot;</span> <span class="comment">/* zero EBX */</span> <a name="l04648"></a>04648 <span class="stringliteral">&quot;mov %5, %%bl \n\t&quot;</span> <span class="comment">/* load Divisor into BL */</span> <a name="l04649"></a>04649 <span class="stringliteral">&quot;movd %%ebx, %%mm5 \n\t&quot;</span> <span class="comment">/* copy Divisor into MM5 */</span> <a name="l04650"></a>04650 <span class="stringliteral">&quot;mov %4, %%edx \n\t&quot;</span> <span class="comment">/* load Kernel address into EDX */</span> <a name="l04651"></a>04651 <span class="stringliteral">&quot;mov %1, %%esi \n\t&quot;</span> <span class="comment">/* load Src address to ESI */</span> <a name="l04652"></a>04652 <span class="stringliteral">&quot;mov %0, %%edi \n\t&quot;</span> <span class="comment">/* load Dest address to EDI */</span> <a name="l04653"></a>04653 <span class="stringliteral">&quot;add $3, %%edi \n\t&quot;</span> <span class="comment">/* 3 column offset from the left edge */</span> <a name="l04654"></a>04654 <span class="stringliteral">&quot;mov %3, %%eax \n\t&quot;</span> <span class="comment">/* load columns into EAX */</span> <a name="l04655"></a>04655 <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="comment">/* 3 row offset from the top edge */</span> <a name="l04656"></a>04656 <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="stringliteral">&quot;mov %2, %%ebx \n\t&quot;</span> <span class="comment">/* initialize ROWS counter */</span> <a name="l04657"></a>04657 <span class="stringliteral">&quot;sub $6, %%ebx \n\t&quot;</span> <span class="comment">/* do not use first 3 and last 3 rows */</span> <a name="l04658"></a>04658 <span class="comment">/* --- */</span> <a name="l04659"></a>04659 <span class="stringliteral">&quot;.L10340: \n\t&quot;</span> <span class="stringliteral">&quot;mov %%eax, %%ecx \n\t&quot;</span> <span class="comment">/* initialize COLUMNS counter */</span> <a name="l04660"></a>04660 <span class="stringliteral">&quot;sub $6, %%ecx \n\t&quot;</span> <span class="comment">/* do not use first 3 and last 3 columns */</span> <a name="l04661"></a>04661 <span class="stringliteral">&quot;.align 16 \n\t&quot;</span> <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l04662"></a>04662 <span class="stringliteral">&quot;.L10342: \n\t&quot;</span> <span class="stringliteral">&quot;pxor %%mm7, %%mm7 \n\t&quot;</span> <span class="comment">/* zero MM7 (accumulator) */</span> <a name="l04663"></a>04663 <span class="stringliteral">&quot;movd %%esi, %%mm6 \n\t&quot;</span> <span class="comment">/* save ESI in MM6 */</span> <a name="l04664"></a>04664 <span class="comment">/* --- 1 */</span> <a name="l04665"></a>04665 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04666"></a>04666 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04667"></a>04667 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04668"></a>04668 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04669"></a>04669 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04670"></a>04670 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04671"></a>04671 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04672"></a>04672 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04673"></a>04673 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04674"></a>04674 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04675"></a>04675 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l04676"></a>04676 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04677"></a>04677 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04678"></a>04678 <span class="comment">/* --- 2 */</span> <a name="l04679"></a>04679 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04680"></a>04680 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04681"></a>04681 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04682"></a>04682 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04683"></a>04683 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04684"></a>04684 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04685"></a>04685 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04686"></a>04686 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04687"></a>04687 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04688"></a>04688 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04689"></a>04689 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l04690"></a>04690 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04691"></a>04691 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04692"></a>04692 <span class="comment">/* --- 3 */</span> <a name="l04693"></a>04693 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04694"></a>04694 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04695"></a>04695 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04696"></a>04696 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04697"></a>04697 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04698"></a>04698 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04699"></a>04699 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04700"></a>04700 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04701"></a>04701 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04702"></a>04702 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04703"></a>04703 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l04704"></a>04704 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04705"></a>04705 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04706"></a>04706 <span class="comment">/* --- 4 */</span> <a name="l04707"></a>04707 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04708"></a>04708 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04709"></a>04709 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04710"></a>04710 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04711"></a>04711 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04712"></a>04712 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04713"></a>04713 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04714"></a>04714 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04715"></a>04715 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04716"></a>04716 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04717"></a>04717 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l04718"></a>04718 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04719"></a>04719 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04720"></a>04720 <span class="comment">/* --- 5 */</span> <a name="l04721"></a>04721 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04722"></a>04722 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04723"></a>04723 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04724"></a>04724 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04725"></a>04725 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04726"></a>04726 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04727"></a>04727 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04728"></a>04728 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04729"></a>04729 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04730"></a>04730 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04731"></a>04731 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l04732"></a>04732 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04733"></a>04733 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04734"></a>04734 <span class="comment">/* --- 6 */</span> <a name="l04735"></a>04735 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04736"></a>04736 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04737"></a>04737 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04738"></a>04738 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04739"></a>04739 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04740"></a>04740 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04741"></a>04741 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04742"></a>04742 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04743"></a>04743 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04744"></a>04744 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04745"></a>04745 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l04746"></a>04746 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04747"></a>04747 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04748"></a>04748 <span class="comment">/* --- 7 */</span> <a name="l04749"></a>04749 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04750"></a>04750 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04751"></a>04751 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04752"></a>04752 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l04753"></a>04753 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l04754"></a>04754 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04755"></a>04755 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04756"></a>04756 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04757"></a>04757 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l04758"></a>04758 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04759"></a>04759 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04760"></a>04760 <span class="comment">/* --- */</span> <a name="l04761"></a>04761 <span class="stringliteral">&quot;movq %%mm7, %%mm3 \n\t&quot;</span> <span class="comment">/* copy MM7 into MM3 */</span> <a name="l04762"></a>04762 <span class="stringliteral">&quot;psrlq $32, %%mm7 \n\t&quot;</span> <span class="comment">/* shift 2 left words to the right */</span> <a name="l04763"></a>04763 <span class="stringliteral">&quot;paddsw %%mm3, %%mm7 \n\t&quot;</span> <span class="comment">/* add 2 left and 2 right result words */</span> <a name="l04764"></a>04764 <span class="stringliteral">&quot;movq %%mm7, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM7 into MM2 */</span> <a name="l04765"></a>04765 <span class="stringliteral">&quot;psrlq $16, %%mm7 \n\t&quot;</span> <span class="comment">/* shift 1 left word to the right */</span> <a name="l04766"></a>04766 <span class="stringliteral">&quot;paddsw %%mm2, %%mm7 \n\t&quot;</span> <span class="comment">/* add 1 left and 1 right result words */</span> <a name="l04767"></a>04767 <span class="comment">/* --- */</span> <a name="l04768"></a>04768 <span class="stringliteral">&quot;movd %%eax, %%mm1 \n\t&quot;</span> <span class="comment">/* save EDX in MM1 */</span> <a name="l04769"></a>04769 <span class="stringliteral">&quot;movd %%ebx, %%mm2 \n\t&quot;</span> <span class="comment">/* save EDX in MM2 */</span> <a name="l04770"></a>04770 <span class="stringliteral">&quot;movd %%edx, %%mm3 \n\t&quot;</span> <span class="comment">/* save EDX in MM3 */</span> <a name="l04771"></a>04771 <span class="stringliteral">&quot;movd %%mm7, %%eax \n\t&quot;</span> <span class="comment">/* load summation result into EAX */</span> <a name="l04772"></a>04772 <span class="stringliteral">&quot;psraw $15, %%mm7 \n\t&quot;</span> <span class="comment">/* spread sign bit of the result */</span> <a name="l04773"></a>04773 <span class="stringliteral">&quot;movd %%mm5, %%ebx \n\t&quot;</span> <span class="comment">/* load Divisor into EBX */</span> <a name="l04774"></a>04774 <span class="stringliteral">&quot;movd %%mm7, %%edx \n\t&quot;</span> <span class="comment">/* fill EDX with a sign bit */</span> <a name="l04775"></a>04775 <span class="stringliteral">&quot;idivw %%bx \n\t&quot;</span> <span class="comment">/* IDIV - VERY EXPENSIVE */</span> <a name="l04776"></a>04776 <span class="stringliteral">&quot;movd %%eax, %%mm7 \n\t&quot;</span> <span class="comment">/* move result of division into MM7 */</span> <a name="l04777"></a>04777 <span class="stringliteral">&quot;packuswb %%mm0, %%mm7 \n\t&quot;</span> <span class="comment">/* pack division result with saturation */</span> <a name="l04778"></a>04778 <span class="stringliteral">&quot;movd %%mm7, %%eax \n\t&quot;</span> <span class="comment">/* copy saturated result into EAX */</span> <a name="l04779"></a>04779 <span class="stringliteral">&quot;mov %%al, (%%edi) \n\t&quot;</span> <span class="comment">/* copy a byte result into Dest */</span> <a name="l04780"></a>04780 <span class="stringliteral">&quot;movd %%mm3, %%edx \n\t&quot;</span> <span class="comment">/* restore saved EDX */</span> <a name="l04781"></a>04781 <span class="stringliteral">&quot;movd %%mm2, %%ebx \n\t&quot;</span> <span class="comment">/* restore saved EBX */</span> <a name="l04782"></a>04782 <span class="stringliteral">&quot;movd %%mm1, %%eax \n\t&quot;</span> <span class="comment">/* restore saved EAX */</span> <a name="l04783"></a>04783 <span class="comment">/* -- */</span> <a name="l04784"></a>04784 <span class="stringliteral">&quot;movd %%mm6, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer to the top pixel */</span> <a name="l04785"></a>04785 <span class="stringliteral">&quot;sub $104, %%edx \n\t&quot;</span> <span class="comment">/* EDX = Kernel address */</span> <a name="l04786"></a>04786 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer to the next pixel */</span> <a name="l04787"></a>04787 <span class="stringliteral">&quot;inc %%edi \n\t&quot;</span> <span class="comment">/* move Dest pointer to the next pixel */</span> <a name="l04788"></a>04788 <span class="comment">/* --- */</span> <a name="l04789"></a>04789 <span class="stringliteral">&quot;dec %%ecx \n\t&quot;</span> <span class="comment">/* decrease loop counter COLUMNS */</span> <a name="l04790"></a>04790 <span class="stringliteral">&quot;jnz .L10342 \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l04791"></a>04791 <span class="stringliteral">&quot;add $6, %%esi \n\t&quot;</span> <span class="comment">/* move to the next row in Src */</span> <a name="l04792"></a>04792 <span class="stringliteral">&quot;add $6, %%edi \n\t&quot;</span> <span class="comment">/* move to the next row in Dest */</span> <a name="l04793"></a>04793 <span class="stringliteral">&quot;dec %%ebx \n\t&quot;</span> <span class="comment">/* decrease loop counter ROWS */</span> <a name="l04794"></a>04794 <span class="stringliteral">&quot;jnz .L10340 \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l04795"></a>04795 <span class="comment">/* --- */</span> <a name="l04796"></a>04796 <span class="stringliteral">&quot;emms \n\t&quot;</span> <span class="comment">/* exit MMX state */</span> <a name="l04797"></a>04797 <span class="stringliteral">&quot;popa \n\t&quot;</span>:<span class="stringliteral">&quot;=m&quot;</span> (Dest) <span class="comment">/* %0 */</span> <a name="l04798"></a>04798 :<span class="stringliteral">&quot;m&quot;</span>(Src), <span class="comment">/* %1 */</span> <a name="l04799"></a>04799 <span class="stringliteral">&quot;m&quot;</span>(rows), <span class="comment">/* %2 */</span> <a name="l04800"></a>04800 <span class="stringliteral">&quot;m&quot;</span>(columns), <span class="comment">/* %3 */</span> <a name="l04801"></a>04801 <span class="stringliteral">&quot;m&quot;</span>(Kernel), <span class="comment">/* %4 */</span> <a name="l04802"></a>04802 <span class="stringliteral">&quot;m&quot;</span>(Divisor) <span class="comment">/* %5 */</span> <a name="l04803"></a>04803 ); <a name="l04804"></a>04804 <span class="preprocessor">#endif</span> <a name="l04805"></a>04805 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l04806"></a>04806 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l04807"></a>04807 } <span class="keywordflow">else</span> { <a name="l04808"></a>04808 <span class="comment">/* No non-MMX implementation yet */</span> <a name="l04809"></a>04809 <span class="keywordflow">return</span> (-1); <a name="l04810"></a>04810 } <a name="l04811"></a>04811 } <a name="l04812"></a>04812 <a name="l04827"></a><a class="code" href="_s_d_l__image_filter_8h.html#af8a8114acd0509787ae5265990049720">04827</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#ae1e91ff193beed110a71119ec901f09d" title="Filter using ConvolveKernel9x9Divide: Dij = saturation0and255( ... )">SDL_imageFilterConvolveKernel9x9Divide</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">int</span> rows, <span class="keywordtype">int</span> columns, <a name="l04828"></a>04828 <span class="keywordtype">signed</span> <span class="keywordtype">short</span> *Kernel, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Divisor) <a name="l04829"></a>04829 { <a name="l04830"></a>04830 <span class="comment">/* Validate input parameters */</span> <a name="l04831"></a>04831 <span class="keywordflow">if</span> ((Src == NULL) || (Dest == NULL) || (Kernel == NULL)) <a name="l04832"></a>04832 <span class="keywordflow">return</span>(-1); <a name="l04833"></a>04833 <a name="l04834"></a>04834 <span class="keywordflow">if</span> ((columns &lt; 9) || (rows &lt; 9) || (Divisor == 0)) <a name="l04835"></a>04835 <span class="keywordflow">return</span> (-1); <a name="l04836"></a>04836 <a name="l04837"></a>04837 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>())) { <a name="l04838"></a>04838 <span class="comment">//#ifdef USE_MMX</span> <a name="l04839"></a>04839 <span class="preprocessor">#if defined(USE_MMX) &amp;&amp; defined(i386)</span> <a name="l04840"></a>04840 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l04841"></a>04841 <span class="preprocessor"></span> __asm <a name="l04842"></a>04842 { <a name="l04843"></a>04843 pusha <a name="l04844"></a>04844 pxor mm0, mm0 <span class="comment">/* zero MM0 */</span> <a name="l04845"></a>04845 xor ebx, ebx <span class="comment">/* zero EBX */</span> <a name="l04846"></a>04846 mov bl, Divisor <span class="comment">/* load Divisor into BL */</span> <a name="l04847"></a>04847 movd mm5, ebx <span class="comment">/* copy Divisor into MM5 */</span> <a name="l04848"></a>04848 mov edx, Kernel <span class="comment">/* load Kernel address into EDX */</span> <a name="l04849"></a>04849 mov esi, Src <span class="comment">/* load Src address to ESI */</span> <a name="l04850"></a>04850 mov edi, Dest <span class="comment">/* load Dest address to EDI */</span> <a name="l04851"></a>04851 add edi, 4 <span class="comment">/* 4 column offset from the left edge */</span> <a name="l04852"></a>04852 mov eax, columns <span class="comment">/* load columns into EAX */</span> <a name="l04853"></a>04853 add edi, eax <span class="comment">/* 4 row offset from the top edge */</span> <a name="l04854"></a>04854 add edi, eax <a name="l04855"></a>04855 add edi, eax <a name="l04856"></a>04856 add edi, eax <a name="l04857"></a>04857 mov ebx, rows <span class="comment">/* initialize ROWS counter */</span> <a name="l04858"></a>04858 sub ebx, 8 <span class="comment">/* do not use first 4 and last 4 rows */</span> <a name="l04859"></a>04859 <span class="comment">/* ---, */</span> <a name="l04860"></a>04860 L10350: <a name="l04861"></a>04861 mov ecx, eax <span class="comment">/* initialize COLUMNS counter */</span> <a name="l04862"></a>04862 sub ecx, 8 <span class="comment">/* do not use first 4 and last 4 columns */</span> <a name="l04863"></a>04863 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l04864"></a>04864 L10352: <a name="l04865"></a>04865 pxor mm7, mm7 <span class="comment">/* zero MM7 (accumulator) */</span> <a name="l04866"></a>04866 movd mm6, esi <span class="comment">/* save ESI in MM6 */</span> <a name="l04867"></a>04867 <span class="comment">/* --- 1 */</span> <a name="l04868"></a>04868 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04869"></a>04869 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04870"></a>04870 inc esi <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l04871"></a>04871 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04872"></a>04872 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04873"></a>04873 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04874"></a>04874 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04875"></a>04875 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04876"></a>04876 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04877"></a>04877 pmullw mm1, mm3 <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04878"></a>04878 pmullw mm2, mm4 <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l04879"></a>04879 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04880"></a>04880 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04881"></a>04881 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04882"></a>04882 dec esi <a name="l04883"></a>04883 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04884"></a>04884 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04885"></a>04885 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04886"></a>04886 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04887"></a>04887 pmullw mm1, mm3 <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04888"></a>04888 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04889"></a>04889 <span class="comment">/* --- 2 */</span> <a name="l04890"></a>04890 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04891"></a>04891 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04892"></a>04892 inc esi <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l04893"></a>04893 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04894"></a>04894 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04895"></a>04895 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04896"></a>04896 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04897"></a>04897 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04898"></a>04898 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04899"></a>04899 pmullw mm1, mm3 <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04900"></a>04900 pmullw mm2, mm4 <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l04901"></a>04901 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04902"></a>04902 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04903"></a>04903 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04904"></a>04904 dec esi <a name="l04905"></a>04905 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04906"></a>04906 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04907"></a>04907 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04908"></a>04908 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04909"></a>04909 pmullw mm1, mm3 <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04910"></a>04910 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04911"></a>04911 <span class="comment">/* --- 3 */</span> <a name="l04912"></a>04912 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04913"></a>04913 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04914"></a>04914 inc esi <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l04915"></a>04915 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04916"></a>04916 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04917"></a>04917 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04918"></a>04918 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04919"></a>04919 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04920"></a>04920 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04921"></a>04921 pmullw mm1, mm3 <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04922"></a>04922 pmullw mm2, mm4 <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l04923"></a>04923 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04924"></a>04924 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04925"></a>04925 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04926"></a>04926 dec esi <a name="l04927"></a>04927 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04928"></a>04928 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04929"></a>04929 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04930"></a>04930 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04931"></a>04931 pmullw mm1, mm3 <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04932"></a>04932 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04933"></a>04933 <span class="comment">/* --- 4 */</span> <a name="l04934"></a>04934 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04935"></a>04935 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04936"></a>04936 inc esi <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l04937"></a>04937 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04938"></a>04938 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04939"></a>04939 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04940"></a>04940 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04941"></a>04941 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04942"></a>04942 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04943"></a>04943 pmullw mm1, mm3 <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04944"></a>04944 pmullw mm2, mm4 <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l04945"></a>04945 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04946"></a>04946 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04947"></a>04947 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04948"></a>04948 dec esi <a name="l04949"></a>04949 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04950"></a>04950 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04951"></a>04951 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04952"></a>04952 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04953"></a>04953 pmullw mm1, mm3 <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04954"></a>04954 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04955"></a>04955 <span class="comment">/* --- 5 */</span> <a name="l04956"></a>04956 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04957"></a>04957 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04958"></a>04958 inc esi <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l04959"></a>04959 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04960"></a>04960 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04961"></a>04961 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04962"></a>04962 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04963"></a>04963 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04964"></a>04964 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04965"></a>04965 pmullw mm1, mm3 <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04966"></a>04966 pmullw mm2, mm4 <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l04967"></a>04967 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04968"></a>04968 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04969"></a>04969 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04970"></a>04970 dec esi <a name="l04971"></a>04971 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04972"></a>04972 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04973"></a>04973 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04974"></a>04974 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04975"></a>04975 pmullw mm1, mm3 <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04976"></a>04976 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04977"></a>04977 <span class="comment">/* --- 6 */</span> <a name="l04978"></a>04978 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04979"></a>04979 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l04980"></a>04980 inc esi <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l04981"></a>04981 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04982"></a>04982 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04983"></a>04983 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04984"></a>04984 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04985"></a>04985 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04986"></a>04986 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l04987"></a>04987 pmullw mm1, mm3 <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04988"></a>04988 pmullw mm2, mm4 <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l04989"></a>04989 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l04990"></a>04990 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04991"></a>04991 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l04992"></a>04992 dec esi <a name="l04993"></a>04993 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l04994"></a>04994 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l04995"></a>04995 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l04996"></a>04996 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l04997"></a>04997 pmullw mm1, mm3 <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l04998"></a>04998 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l04999"></a>04999 <span class="comment">/* --- 7 */</span> <a name="l05000"></a>05000 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05001"></a>05001 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05002"></a>05002 inc esi <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l05003"></a>05003 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05004"></a>05004 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05005"></a>05005 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05006"></a>05006 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05007"></a>05007 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05008"></a>05008 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05009"></a>05009 pmullw mm1, mm3 <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05010"></a>05010 pmullw mm2, mm4 <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l05011"></a>05011 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05012"></a>05012 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05013"></a>05013 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05014"></a>05014 dec esi <a name="l05015"></a>05015 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05016"></a>05016 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05017"></a>05017 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05018"></a>05018 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05019"></a>05019 pmullw mm1, mm3 <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05020"></a>05020 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05021"></a>05021 <span class="comment">/* --- 8 */</span> <a name="l05022"></a>05022 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05023"></a>05023 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05024"></a>05024 inc esi <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l05025"></a>05025 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05026"></a>05026 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05027"></a>05027 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05028"></a>05028 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05029"></a>05029 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05030"></a>05030 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05031"></a>05031 pmullw mm1, mm3 <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05032"></a>05032 pmullw mm2, mm4 <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l05033"></a>05033 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05034"></a>05034 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05035"></a>05035 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05036"></a>05036 dec esi <a name="l05037"></a>05037 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05038"></a>05038 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05039"></a>05039 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05040"></a>05040 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05041"></a>05041 pmullw mm1, mm3 <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05042"></a>05042 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05043"></a>05043 <span class="comment">/* --- 9 */</span> <a name="l05044"></a>05044 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05045"></a>05045 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05046"></a>05046 inc esi <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l05047"></a>05047 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05048"></a>05048 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05049"></a>05049 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05050"></a>05050 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05051"></a>05051 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05052"></a>05052 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05053"></a>05053 pmullw mm1, mm3 <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05054"></a>05054 pmullw mm2, mm4 <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l05055"></a>05055 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05056"></a>05056 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05057"></a>05057 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05058"></a>05058 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05059"></a>05059 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05060"></a>05060 pmullw mm1, mm3 <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05061"></a>05061 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05062"></a>05062 <span class="comment">/* ---, */</span> <a name="l05063"></a>05063 movq mm3, mm7 <span class="comment">/* copy MM7 into MM3 */</span> <a name="l05064"></a>05064 psrlq mm7, 32 <span class="comment">/* shift 2 left words to the right */</span> <a name="l05065"></a>05065 paddsw mm7, mm3 <span class="comment">/* add 2 left and 2 right result words */</span> <a name="l05066"></a>05066 movq mm2, mm7 <span class="comment">/* copy MM7 into MM2 */</span> <a name="l05067"></a>05067 psrlq mm7, 16 <span class="comment">/* shift 1 left word to the right */</span> <a name="l05068"></a>05068 paddsw mm7, mm2 <span class="comment">/* add 1 left and 1 right result words */</span> <a name="l05069"></a>05069 <span class="comment">/* ---, */</span> <a name="l05070"></a>05070 movd mm1, eax <span class="comment">/* save EDX in MM1 */</span> <a name="l05071"></a>05071 movd mm2, ebx <span class="comment">/* save EDX in MM2 */</span> <a name="l05072"></a>05072 movd mm3, edx <span class="comment">/* save EDX in MM3 */</span> <a name="l05073"></a>05073 movd eax, mm7 <span class="comment">/* load summation result into EAX */</span> <a name="l05074"></a>05074 psraw mm7, 15 <span class="comment">/* spread sign bit of the result */</span> <a name="l05075"></a>05075 movd ebx, mm5 <span class="comment">/* load Divisor into EBX */</span> <a name="l05076"></a>05076 movd edx, mm7 <span class="comment">/* fill EDX with a sign bit */</span> <a name="l05077"></a>05077 idiv bx <span class="comment">/* IDIV - VERY EXPENSIVE */</span> <a name="l05078"></a>05078 movd mm7, eax <span class="comment">/* move result of division into MM7 */</span> <a name="l05079"></a>05079 packuswb mm7, mm0 <span class="comment">/* pack division result with saturation */</span> <a name="l05080"></a>05080 movd eax, mm7 <span class="comment">/* copy saturated result into EAX */</span> <a name="l05081"></a>05081 mov [edi], al <span class="comment">/* copy a byte result into Dest */</span> <a name="l05082"></a>05082 movd edx, mm3 <span class="comment">/* restore saved EDX */</span> <a name="l05083"></a>05083 movd ebx, mm2 <span class="comment">/* restore saved EBX */</span> <a name="l05084"></a>05084 movd eax, mm1 <span class="comment">/* restore saved EAX */</span> <a name="l05085"></a>05085 <span class="comment">/* --, */</span> <a name="l05086"></a>05086 movd esi, mm6 <span class="comment">/* move Src pointer to the top pixel */</span> <a name="l05087"></a>05087 sub edx, 208 <span class="comment">/* EDX = Kernel address */</span> <a name="l05088"></a>05088 inc esi <span class="comment">/* move Src pointer to the next pixel */</span> <a name="l05089"></a>05089 inc edi <span class="comment">/* move Dest pointer to the next pixel */</span> <a name="l05090"></a>05090 <span class="comment">/* ---, */</span> <a name="l05091"></a>05091 dec ecx <span class="comment">/* decrease loop counter COLUMNS */</span> <a name="l05092"></a>05092 jnz L10352 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l05093"></a>05093 add esi, 8 <span class="comment">/* move to the next row in Src */</span> <a name="l05094"></a>05094 add edi, 8 <span class="comment">/* move to the next row in Dest */</span> <a name="l05095"></a>05095 dec ebx <span class="comment">/* decrease loop counter ROWS */</span> <a name="l05096"></a>05096 jnz L10350 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l05097"></a>05097 <span class="comment">/* ---, */</span> <a name="l05098"></a>05098 emms <span class="comment">/* exit MMX state */</span> <a name="l05099"></a>05099 popa <a name="l05100"></a>05100 } <a name="l05101"></a>05101 <span class="preprocessor">#else</span> <a name="l05102"></a>05102 <span class="preprocessor"></span> <span class="keyword">asm</span> <span class="keyword">volatile</span> <a name="l05103"></a>05103 (<span class="stringliteral">&quot;pusha \n\t&quot;</span> <span class="stringliteral">&quot;pxor %%mm0, %%mm0 \n\t&quot;</span> <span class="comment">/* zero MM0 */</span> <a name="l05104"></a>05104 <span class="stringliteral">&quot;xor %%ebx, %%ebx \n\t&quot;</span> <span class="comment">/* zero EBX */</span> <a name="l05105"></a>05105 <span class="stringliteral">&quot;mov %5, %%bl \n\t&quot;</span> <span class="comment">/* load Divisor into BL */</span> <a name="l05106"></a>05106 <span class="stringliteral">&quot;movd %%ebx, %%mm5 \n\t&quot;</span> <span class="comment">/* copy Divisor into MM5 */</span> <a name="l05107"></a>05107 <span class="stringliteral">&quot;mov %4, %%edx \n\t&quot;</span> <span class="comment">/* load Kernel address into EDX */</span> <a name="l05108"></a>05108 <span class="stringliteral">&quot;mov %1, %%esi \n\t&quot;</span> <span class="comment">/* load Src address to ESI */</span> <a name="l05109"></a>05109 <span class="stringliteral">&quot;mov %0, %%edi \n\t&quot;</span> <span class="comment">/* load Dest address to EDI */</span> <a name="l05110"></a>05110 <span class="stringliteral">&quot;add $4, %%edi \n\t&quot;</span> <span class="comment">/* 4 column offset from the left edge */</span> <a name="l05111"></a>05111 <span class="stringliteral">&quot;mov %3, %%eax \n\t&quot;</span> <span class="comment">/* load columns into EAX */</span> <a name="l05112"></a>05112 <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="comment">/* 4 row offset from the top edge */</span> <a name="l05113"></a>05113 <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="stringliteral">&quot;mov %2, %%ebx \n\t&quot;</span> <span class="comment">/* initialize ROWS counter */</span> <a name="l05114"></a>05114 <span class="stringliteral">&quot;sub $8, %%ebx \n\t&quot;</span> <span class="comment">/* do not use first 4 and last 4 rows */</span> <a name="l05115"></a>05115 <span class="comment">/* --- */</span> <a name="l05116"></a>05116 <span class="stringliteral">&quot;.L10350: \n\t&quot;</span> <span class="stringliteral">&quot;mov %%eax, %%ecx \n\t&quot;</span> <span class="comment">/* initialize COLUMNS counter */</span> <a name="l05117"></a>05117 <span class="stringliteral">&quot;sub $8, %%ecx \n\t&quot;</span> <span class="comment">/* do not use first 4 and last 4 columns */</span> <a name="l05118"></a>05118 <span class="stringliteral">&quot;.align 16 \n\t&quot;</span> <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l05119"></a>05119 <span class="stringliteral">&quot;.L10352: \n\t&quot;</span> <span class="stringliteral">&quot;pxor %%mm7, %%mm7 \n\t&quot;</span> <span class="comment">/* zero MM7 (accumulator) */</span> <a name="l05120"></a>05120 <span class="stringliteral">&quot;movd %%esi, %%mm6 \n\t&quot;</span> <span class="comment">/* save ESI in MM6 */</span> <a name="l05121"></a>05121 <span class="comment">/* --- 1 */</span> <a name="l05122"></a>05122 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05123"></a>05123 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05124"></a>05124 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l05125"></a>05125 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05126"></a>05126 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05127"></a>05127 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05128"></a>05128 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05129"></a>05129 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05130"></a>05130 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05131"></a>05131 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05132"></a>05132 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l05133"></a>05133 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05134"></a>05134 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05135"></a>05135 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05136"></a>05136 <span class="stringliteral">&quot;dec %%esi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05137"></a>05137 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05138"></a>05138 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05139"></a>05139 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05140"></a>05140 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05141"></a>05141 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05142"></a>05142 <span class="comment">/* --- 2 */</span> <a name="l05143"></a>05143 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05144"></a>05144 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05145"></a>05145 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l05146"></a>05146 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05147"></a>05147 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05148"></a>05148 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05149"></a>05149 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05150"></a>05150 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05151"></a>05151 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05152"></a>05152 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05153"></a>05153 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l05154"></a>05154 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05155"></a>05155 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05156"></a>05156 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05157"></a>05157 <span class="stringliteral">&quot;dec %%esi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05158"></a>05158 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05159"></a>05159 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05160"></a>05160 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05161"></a>05161 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05162"></a>05162 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05163"></a>05163 <span class="comment">/* --- 3 */</span> <a name="l05164"></a>05164 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05165"></a>05165 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05166"></a>05166 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l05167"></a>05167 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05168"></a>05168 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05169"></a>05169 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05170"></a>05170 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05171"></a>05171 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05172"></a>05172 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05173"></a>05173 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05174"></a>05174 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l05175"></a>05175 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05176"></a>05176 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05177"></a>05177 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05178"></a>05178 <span class="stringliteral">&quot;dec %%esi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05179"></a>05179 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05180"></a>05180 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05181"></a>05181 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05182"></a>05182 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05183"></a>05183 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05184"></a>05184 <span class="comment">/* --- 4 */</span> <a name="l05185"></a>05185 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05186"></a>05186 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05187"></a>05187 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l05188"></a>05188 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05189"></a>05189 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05190"></a>05190 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05191"></a>05191 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05192"></a>05192 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05193"></a>05193 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05194"></a>05194 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05195"></a>05195 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l05196"></a>05196 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05197"></a>05197 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05198"></a>05198 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05199"></a>05199 <span class="stringliteral">&quot;dec %%esi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05200"></a>05200 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05201"></a>05201 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05202"></a>05202 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05203"></a>05203 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05204"></a>05204 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05205"></a>05205 <span class="comment">/* --- 5 */</span> <a name="l05206"></a>05206 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05207"></a>05207 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05208"></a>05208 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l05209"></a>05209 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05210"></a>05210 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05211"></a>05211 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05212"></a>05212 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05213"></a>05213 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05214"></a>05214 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05215"></a>05215 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05216"></a>05216 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l05217"></a>05217 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05218"></a>05218 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05219"></a>05219 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05220"></a>05220 <span class="stringliteral">&quot;dec %%esi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05221"></a>05221 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05222"></a>05222 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05223"></a>05223 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05224"></a>05224 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05225"></a>05225 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05226"></a>05226 <span class="comment">/* --- 6 */</span> <a name="l05227"></a>05227 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05228"></a>05228 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05229"></a>05229 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l05230"></a>05230 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05231"></a>05231 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05232"></a>05232 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05233"></a>05233 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05234"></a>05234 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05235"></a>05235 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05236"></a>05236 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05237"></a>05237 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l05238"></a>05238 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05239"></a>05239 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05240"></a>05240 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05241"></a>05241 <span class="stringliteral">&quot;dec %%esi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05242"></a>05242 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05243"></a>05243 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05244"></a>05244 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05245"></a>05245 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05246"></a>05246 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05247"></a>05247 <span class="comment">/* --- 7 */</span> <a name="l05248"></a>05248 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05249"></a>05249 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05250"></a>05250 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l05251"></a>05251 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05252"></a>05252 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05253"></a>05253 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05254"></a>05254 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05255"></a>05255 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05256"></a>05256 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05257"></a>05257 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05258"></a>05258 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l05259"></a>05259 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05260"></a>05260 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05261"></a>05261 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05262"></a>05262 <span class="stringliteral">&quot;dec %%esi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05263"></a>05263 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05264"></a>05264 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05265"></a>05265 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05266"></a>05266 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05267"></a>05267 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05268"></a>05268 <span class="comment">/* --- 8 */</span> <a name="l05269"></a>05269 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05270"></a>05270 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05271"></a>05271 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l05272"></a>05272 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05273"></a>05273 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05274"></a>05274 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05275"></a>05275 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05276"></a>05276 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05277"></a>05277 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05278"></a>05278 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05279"></a>05279 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l05280"></a>05280 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05281"></a>05281 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05282"></a>05282 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05283"></a>05283 <span class="stringliteral">&quot;dec %%esi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05284"></a>05284 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05285"></a>05285 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05286"></a>05286 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05287"></a>05287 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05288"></a>05288 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05289"></a>05289 <span class="comment">/* --- 9 */</span> <a name="l05290"></a>05290 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05291"></a>05291 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05292"></a>05292 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l05293"></a>05293 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05294"></a>05294 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05295"></a>05295 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05296"></a>05296 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05297"></a>05297 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05298"></a>05298 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05299"></a>05299 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05300"></a>05300 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l05301"></a>05301 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05302"></a>05302 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05303"></a>05303 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05304"></a>05304 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05305"></a>05305 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05306"></a>05306 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05307"></a>05307 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05308"></a>05308 <span class="comment">/* --- */</span> <a name="l05309"></a>05309 <span class="stringliteral">&quot;movq %%mm7, %%mm3 \n\t&quot;</span> <span class="comment">/* copy MM7 into MM3 */</span> <a name="l05310"></a>05310 <span class="stringliteral">&quot;psrlq $32, %%mm7 \n\t&quot;</span> <span class="comment">/* shift 2 left words to the right */</span> <a name="l05311"></a>05311 <span class="stringliteral">&quot;paddsw %%mm3, %%mm7 \n\t&quot;</span> <span class="comment">/* add 2 left and 2 right result words */</span> <a name="l05312"></a>05312 <span class="stringliteral">&quot;movq %%mm7, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM7 into MM2 */</span> <a name="l05313"></a>05313 <span class="stringliteral">&quot;psrlq $16, %%mm7 \n\t&quot;</span> <span class="comment">/* shift 1 left word to the right */</span> <a name="l05314"></a>05314 <span class="stringliteral">&quot;paddsw %%mm2, %%mm7 \n\t&quot;</span> <span class="comment">/* add 1 left and 1 right result words */</span> <a name="l05315"></a>05315 <span class="comment">/* --- */</span> <a name="l05316"></a>05316 <span class="stringliteral">&quot;movd %%eax, %%mm1 \n\t&quot;</span> <span class="comment">/* save EDX in MM1 */</span> <a name="l05317"></a>05317 <span class="stringliteral">&quot;movd %%ebx, %%mm2 \n\t&quot;</span> <span class="comment">/* save EDX in MM2 */</span> <a name="l05318"></a>05318 <span class="stringliteral">&quot;movd %%edx, %%mm3 \n\t&quot;</span> <span class="comment">/* save EDX in MM3 */</span> <a name="l05319"></a>05319 <span class="stringliteral">&quot;movd %%mm7, %%eax \n\t&quot;</span> <span class="comment">/* load summation result into EAX */</span> <a name="l05320"></a>05320 <span class="stringliteral">&quot;psraw $15, %%mm7 \n\t&quot;</span> <span class="comment">/* spread sign bit of the result */</span> <a name="l05321"></a>05321 <span class="stringliteral">&quot;movd %%mm5, %%ebx \n\t&quot;</span> <span class="comment">/* load Divisor into EBX */</span> <a name="l05322"></a>05322 <span class="stringliteral">&quot;movd %%mm7, %%edx \n\t&quot;</span> <span class="comment">/* fill EDX with a sign bit */</span> <a name="l05323"></a>05323 <span class="stringliteral">&quot;idivw %%bx \n\t&quot;</span> <span class="comment">/* IDIV - VERY EXPENSIVE */</span> <a name="l05324"></a>05324 <span class="stringliteral">&quot;movd %%eax, %%mm7 \n\t&quot;</span> <span class="comment">/* move result of division into MM7 */</span> <a name="l05325"></a>05325 <span class="stringliteral">&quot;packuswb %%mm0, %%mm7 \n\t&quot;</span> <span class="comment">/* pack division result with saturation */</span> <a name="l05326"></a>05326 <span class="stringliteral">&quot;movd %%mm7, %%eax \n\t&quot;</span> <span class="comment">/* copy saturated result into EAX */</span> <a name="l05327"></a>05327 <span class="stringliteral">&quot;mov %%al, (%%edi) \n\t&quot;</span> <span class="comment">/* copy a byte result into Dest */</span> <a name="l05328"></a>05328 <span class="stringliteral">&quot;movd %%mm3, %%edx \n\t&quot;</span> <span class="comment">/* restore saved EDX */</span> <a name="l05329"></a>05329 <span class="stringliteral">&quot;movd %%mm2, %%ebx \n\t&quot;</span> <span class="comment">/* restore saved EBX */</span> <a name="l05330"></a>05330 <span class="stringliteral">&quot;movd %%mm1, %%eax \n\t&quot;</span> <span class="comment">/* restore saved EAX */</span> <a name="l05331"></a>05331 <span class="comment">/* -- */</span> <a name="l05332"></a>05332 <span class="stringliteral">&quot;movd %%mm6, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer to the top pixel */</span> <a name="l05333"></a>05333 <span class="stringliteral">&quot;sub $208, %%edx \n\t&quot;</span> <span class="comment">/* EDX = Kernel address */</span> <a name="l05334"></a>05334 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer to the next pixel */</span> <a name="l05335"></a>05335 <span class="stringliteral">&quot;inc %%edi \n\t&quot;</span> <span class="comment">/* move Dest pointer to the next pixel */</span> <a name="l05336"></a>05336 <span class="comment">/* --- */</span> <a name="l05337"></a>05337 <span class="stringliteral">&quot;dec %%ecx \n\t&quot;</span> <span class="comment">/* decrease loop counter COLUMNS */</span> <a name="l05338"></a>05338 <span class="stringliteral">&quot;jnz .L10352 \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l05339"></a>05339 <span class="stringliteral">&quot;add $8, %%esi \n\t&quot;</span> <span class="comment">/* move to the next row in Src */</span> <a name="l05340"></a>05340 <span class="stringliteral">&quot;add $8, %%edi \n\t&quot;</span> <span class="comment">/* move to the next row in Dest */</span> <a name="l05341"></a>05341 <span class="stringliteral">&quot;dec %%ebx \n\t&quot;</span> <span class="comment">/* decrease loop counter ROWS */</span> <a name="l05342"></a>05342 <span class="stringliteral">&quot;jnz .L10350 \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l05343"></a>05343 <span class="comment">/* --- */</span> <a name="l05344"></a>05344 <span class="stringliteral">&quot;emms \n\t&quot;</span> <span class="comment">/* exit MMX state */</span> <a name="l05345"></a>05345 <span class="stringliteral">&quot;popa \n\t&quot;</span>:<span class="stringliteral">&quot;=m&quot;</span> (Dest) <span class="comment">/* %0 */</span> <a name="l05346"></a>05346 :<span class="stringliteral">&quot;m&quot;</span>(Src), <span class="comment">/* %1 */</span> <a name="l05347"></a>05347 <span class="stringliteral">&quot;m&quot;</span>(rows), <span class="comment">/* %2 */</span> <a name="l05348"></a>05348 <span class="stringliteral">&quot;m&quot;</span>(columns), <span class="comment">/* %3 */</span> <a name="l05349"></a>05349 <span class="stringliteral">&quot;m&quot;</span>(Kernel), <span class="comment">/* %4 */</span> <a name="l05350"></a>05350 <span class="stringliteral">&quot;m&quot;</span>(Divisor) <span class="comment">/* %5 */</span> <a name="l05351"></a>05351 ); <a name="l05352"></a>05352 <span class="preprocessor">#endif</span> <a name="l05353"></a>05353 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l05354"></a>05354 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l05355"></a>05355 } <span class="keywordflow">else</span> { <a name="l05356"></a>05356 <span class="comment">/* No non-MMX implementation yet */</span> <a name="l05357"></a>05357 <span class="keywordflow">return</span> (-1); <a name="l05358"></a>05358 } <a name="l05359"></a>05359 } <a name="l05360"></a>05360 <a name="l05375"></a><a class="code" href="_s_d_l__image_filter_8h.html#a67929babce179e1e333c5cd2e5fc4091">05375</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#ac329e5a3b60351768c96c94db9f9cf97" title="Filter using ConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... )">SDL_imageFilterConvolveKernel3x3ShiftRight</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">int</span> rows, <span class="keywordtype">int</span> columns, <a name="l05376"></a>05376 <span class="keywordtype">signed</span> <span class="keywordtype">short</span> *Kernel, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> NRightShift) <a name="l05377"></a>05377 { <a name="l05378"></a>05378 <span class="comment">/* Validate input parameters */</span> <a name="l05379"></a>05379 <span class="keywordflow">if</span> ((Src == NULL) || (Dest == NULL) || (Kernel == NULL)) <a name="l05380"></a>05380 <span class="keywordflow">return</span>(-1); <a name="l05381"></a>05381 <a name="l05382"></a>05382 <span class="keywordflow">if</span> ((columns &lt; 3) || (rows &lt; 3) || (NRightShift &gt; 7)) <a name="l05383"></a>05383 <span class="keywordflow">return</span> (-1); <a name="l05384"></a>05384 <a name="l05385"></a>05385 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>())) { <a name="l05386"></a>05386 <span class="comment">//#ifdef USE_MMX</span> <a name="l05387"></a>05387 <span class="preprocessor">#if defined(USE_MMX) &amp;&amp; defined(i386)</span> <a name="l05388"></a>05388 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l05389"></a>05389 <span class="preprocessor"></span> __asm <a name="l05390"></a>05390 { <a name="l05391"></a>05391 pusha <a name="l05392"></a>05392 pxor mm0, mm0 <span class="comment">/* zero MM0 */</span> <a name="l05393"></a>05393 xor ebx, ebx <span class="comment">/* zero EBX */</span> <a name="l05394"></a>05394 mov bl, NRightShift <span class="comment">/* load NRightShift into BL */</span> <a name="l05395"></a>05395 movd mm4, ebx <span class="comment">/* copy NRightShift into MM4 */</span> <a name="l05396"></a>05396 mov edx, Kernel <span class="comment">/* load Kernel address into EDX */</span> <a name="l05397"></a>05397 movq mm5, [edx] <span class="comment">/* MM5 = {0,K2,K1,K0} */</span> <a name="l05398"></a>05398 add edx, 8 <span class="comment">/* second row |K0 K1 K2 0| */</span> <a name="l05399"></a>05399 movq mm6, [edx] <span class="comment">/* MM6 = {0,K5,K4,K3} K = |K3 K4 K5 0| */</span> <a name="l05400"></a>05400 add edx, 8 <span class="comment">/* third row |K6 K7 K8 0| */</span> <a name="l05401"></a>05401 movq mm7, [edx] <span class="comment">/* MM7 = {0,K8,K7,K6} */</span> <a name="l05402"></a>05402 <span class="comment">/* ---, */</span> <a name="l05403"></a>05403 mov eax, columns <span class="comment">/* load columns into EAX */</span> <a name="l05404"></a>05404 mov esi, Src <span class="comment">/* ESI = Src row 0 address */</span> <a name="l05405"></a>05405 mov edi, Dest <span class="comment">/* load Dest address to EDI */</span> <a name="l05406"></a>05406 add edi, eax <span class="comment">/* EDI = EDI + columns */</span> <a name="l05407"></a>05407 inc edi <span class="comment">/* 1 byte offset from the left edge */</span> <a name="l05408"></a>05408 mov edx, rows <span class="comment">/* initialize ROWS counter */</span> <a name="l05409"></a>05409 sub edx, 2 <span class="comment">/* do not use first and last row */</span> <a name="l05410"></a>05410 <span class="comment">/* ---, */</span> <a name="l05411"></a>05411 L10360: <a name="l05412"></a>05412 mov ecx, eax <span class="comment">/* initialize COLUMS counter */</span> <a name="l05413"></a>05413 sub ecx, 2 <span class="comment">/* do not use first and last column */</span> <a name="l05414"></a>05414 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l05415"></a>05415 L10362: <a name="l05416"></a>05416 <span class="comment">/* ---, */</span> <a name="l05417"></a>05417 movq mm1, [esi] <span class="comment">/* load 8 bytes of the image first row */</span> <a name="l05418"></a>05418 add esi, eax <span class="comment">/* move one row below */</span> <a name="l05419"></a>05419 movq mm2, [esi] <span class="comment">/* load 8 bytes of the image second row */</span> <a name="l05420"></a>05420 add esi, eax <span class="comment">/* move one row below */</span> <a name="l05421"></a>05421 movq mm3, [esi] <span class="comment">/* load 8 bytes of the image third row */</span> <a name="l05422"></a>05422 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05423"></a>05423 punpcklbw mm2, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05424"></a>05424 punpcklbw mm3, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05425"></a>05425 psrlw mm1, mm4 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05426"></a>05426 psrlw mm2, mm4 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05427"></a>05427 psrlw mm3, mm4 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05428"></a>05428 pmullw mm1, mm5 <span class="comment">/* multiply words first row image*Kernel */</span> <a name="l05429"></a>05429 pmullw mm2, mm6 <span class="comment">/* multiply words second row image*Kernel */</span> <a name="l05430"></a>05430 pmullw mm3, mm7 <span class="comment">/* multiply words third row image*Kernel */</span> <a name="l05431"></a>05431 paddsw mm1, mm2 <span class="comment">/* add 4 words of the first and second rows */</span> <a name="l05432"></a>05432 paddsw mm1, mm3 <span class="comment">/* add 4 words of the third row and result */</span> <a name="l05433"></a>05433 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05434"></a>05434 psrlq mm1, 32 <span class="comment">/* shift 2 left words to the right */</span> <a name="l05435"></a>05435 paddsw mm1, mm2 <span class="comment">/* add 2 left and 2 right result words */</span> <a name="l05436"></a>05436 movq mm3, mm1 <span class="comment">/* copy MM1 into MM3 */</span> <a name="l05437"></a>05437 psrlq mm1, 16 <span class="comment">/* shift 1 left word to the right */</span> <a name="l05438"></a>05438 paddsw mm1, mm3 <span class="comment">/* add 1 left and 1 right result words */</span> <a name="l05439"></a>05439 packuswb mm1, mm0 <span class="comment">/* pack shift result with saturation */</span> <a name="l05440"></a>05440 movd ebx, mm1 <span class="comment">/* copy saturated result into EBX */</span> <a name="l05441"></a>05441 mov [edi], bl <span class="comment">/* copy a byte result into Dest */</span> <a name="l05442"></a>05442 <span class="comment">/* --, */</span> <a name="l05443"></a>05443 sub esi, eax <span class="comment">/* move two rows up */</span> <a name="l05444"></a>05444 sub esi, eax <a name="l05445"></a>05445 inc esi <span class="comment">/* move Src pointer to the next pixel */</span> <a name="l05446"></a>05446 inc edi <span class="comment">/* move Dest pointer to the next pixel */</span> <a name="l05447"></a>05447 <span class="comment">/* ---, */</span> <a name="l05448"></a>05448 dec ecx <span class="comment">/* decrease loop counter COLUMNS */</span> <a name="l05449"></a>05449 jnz L10362 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l05450"></a>05450 add esi, 2 <span class="comment">/* move to the next row in Src */</span> <a name="l05451"></a>05451 add edi, 2 <span class="comment">/* move to the next row in Dest */</span> <a name="l05452"></a>05452 dec edx <span class="comment">/* decrease loop counter ROWS */</span> <a name="l05453"></a>05453 jnz L10360 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l05454"></a>05454 <span class="comment">/* ---, */</span> <a name="l05455"></a>05455 emms <span class="comment">/* exit MMX state */</span> <a name="l05456"></a>05456 popa <a name="l05457"></a>05457 } <a name="l05458"></a>05458 <span class="preprocessor">#else</span> <a name="l05459"></a>05459 <span class="preprocessor"></span> <span class="keyword">asm</span> <span class="keyword">volatile</span> <a name="l05460"></a>05460 (<span class="stringliteral">&quot;pusha \n\t&quot;</span> <span class="stringliteral">&quot;pxor %%mm0, %%mm0 \n\t&quot;</span> <span class="comment">/* zero MM0 */</span> <a name="l05461"></a>05461 <span class="stringliteral">&quot;xor %%ebx, %%ebx \n\t&quot;</span> <span class="comment">/* zero EBX */</span> <a name="l05462"></a>05462 <span class="stringliteral">&quot;mov %5, %%bl \n\t&quot;</span> <span class="comment">/* load NRightShift into BL */</span> <a name="l05463"></a>05463 <span class="stringliteral">&quot;movd %%ebx, %%mm4 \n\t&quot;</span> <span class="comment">/* copy NRightShift into MM4 */</span> <a name="l05464"></a>05464 <span class="stringliteral">&quot;mov %4, %%edx \n\t&quot;</span> <span class="comment">/* load Kernel address into EDX */</span> <a name="l05465"></a>05465 <span class="stringliteral">&quot;movq (%%edx), %%mm5 \n\t&quot;</span> <span class="comment">/* MM5 = {0,K2,K1,K0} */</span> <a name="l05466"></a>05466 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* second row |K0 K1 K2 0| */</span> <a name="l05467"></a>05467 <span class="stringliteral">&quot;movq (%%edx), %%mm6 \n\t&quot;</span> <span class="comment">/* MM6 = {0,K5,K4,K3} K = |K3 K4 K5 0| */</span> <a name="l05468"></a>05468 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* third row |K6 K7 K8 0| */</span> <a name="l05469"></a>05469 <span class="stringliteral">&quot;movq (%%edx), %%mm7 \n\t&quot;</span> <span class="comment">/* MM7 = {0,K8,K7,K6} */</span> <a name="l05470"></a>05470 <span class="comment">/* --- */</span> <a name="l05471"></a>05471 <span class="stringliteral">&quot;mov %3, %%eax \n\t&quot;</span> <span class="comment">/* load columns into EAX */</span> <a name="l05472"></a>05472 <span class="stringliteral">&quot;mov %1, %%esi \n\t&quot;</span> <span class="comment">/* ESI = Src row 0 address */</span> <a name="l05473"></a>05473 <span class="stringliteral">&quot;mov %0, %%edi \n\t&quot;</span> <span class="comment">/* load Dest address to EDI */</span> <a name="l05474"></a>05474 <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="comment">/* EDI = EDI + columns */</span> <a name="l05475"></a>05475 <span class="stringliteral">&quot;inc %%edi \n\t&quot;</span> <span class="comment">/* 1 byte offset from the left edge */</span> <a name="l05476"></a>05476 <span class="stringliteral">&quot;mov %2, %%edx \n\t&quot;</span> <span class="comment">/* initialize ROWS counter */</span> <a name="l05477"></a>05477 <span class="stringliteral">&quot;sub $2, %%edx \n\t&quot;</span> <span class="comment">/* do not use first and last row */</span> <a name="l05478"></a>05478 <span class="comment">/* --- */</span> <a name="l05479"></a>05479 <span class="stringliteral">&quot;.L10360: \n\t&quot;</span> <span class="stringliteral">&quot;mov %%eax, %%ecx \n\t&quot;</span> <span class="comment">/* initialize COLUMS counter */</span> <a name="l05480"></a>05480 <span class="stringliteral">&quot;sub $2, %%ecx \n\t&quot;</span> <span class="comment">/* do not use first and last column */</span> <a name="l05481"></a>05481 <span class="stringliteral">&quot;.align 16 \n\t&quot;</span> <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l05482"></a>05482 <span class="stringliteral">&quot;.L10362: \n\t&quot;</span> <a name="l05483"></a>05483 <span class="comment">/* --- */</span> <a name="l05484"></a>05484 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the image first row */</span> <a name="l05485"></a>05485 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move one row below */</span> <a name="l05486"></a>05486 <span class="stringliteral">&quot;movq (%%esi), %%mm2 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the image second row */</span> <a name="l05487"></a>05487 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move one row below */</span> <a name="l05488"></a>05488 <span class="stringliteral">&quot;movq (%%esi), %%mm3 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the image third row */</span> <a name="l05489"></a>05489 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05490"></a>05490 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05491"></a>05491 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm3 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05492"></a>05492 <span class="stringliteral">&quot;psrlw %%mm4, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05493"></a>05493 <span class="stringliteral">&quot;psrlw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05494"></a>05494 <span class="stringliteral">&quot;psrlw %%mm4, %%mm3 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05495"></a>05495 <span class="stringliteral">&quot;pmullw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* multiply words first row image*Kernel */</span> <a name="l05496"></a>05496 <span class="stringliteral">&quot;pmullw %%mm6, %%mm2 \n\t&quot;</span> <span class="comment">/* multiply words second row image*Kernel */</span> <a name="l05497"></a>05497 <span class="stringliteral">&quot;pmullw %%mm7, %%mm3 \n\t&quot;</span> <span class="comment">/* multiply words third row image*Kernel */</span> <a name="l05498"></a>05498 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the first and second rows */</span> <a name="l05499"></a>05499 <span class="stringliteral">&quot;paddsw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the third row and result */</span> <a name="l05500"></a>05500 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05501"></a>05501 <span class="stringliteral">&quot;psrlq $32, %%mm1 \n\t&quot;</span> <span class="comment">/* shift 2 left words to the right */</span> <a name="l05502"></a>05502 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 2 left and 2 right result words */</span> <a name="l05503"></a>05503 <span class="stringliteral">&quot;movq %%mm1, %%mm3 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM3 */</span> <a name="l05504"></a>05504 <span class="stringliteral">&quot;psrlq $16, %%mm1 \n\t&quot;</span> <span class="comment">/* shift 1 left word to the right */</span> <a name="l05505"></a>05505 <span class="stringliteral">&quot;paddsw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* add 1 left and 1 right result words */</span> <a name="l05506"></a>05506 <span class="stringliteral">&quot;packuswb %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* pack shift result with saturation */</span> <a name="l05507"></a>05507 <span class="stringliteral">&quot;movd %%mm1, %%ebx \n\t&quot;</span> <span class="comment">/* copy saturated result into EBX */</span> <a name="l05508"></a>05508 <span class="stringliteral">&quot;mov %%bl, (%%edi) \n\t&quot;</span> <span class="comment">/* copy a byte result into Dest */</span> <a name="l05509"></a>05509 <span class="comment">/* -- */</span> <a name="l05510"></a>05510 <span class="stringliteral">&quot;sub %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move two rows up */</span> <a name="l05511"></a>05511 <span class="stringliteral">&quot;sub %%eax, %%esi \n\t&quot;</span> <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer to the next pixel */</span> <a name="l05512"></a>05512 <span class="stringliteral">&quot;inc %%edi \n\t&quot;</span> <span class="comment">/* move Dest pointer to the next pixel */</span> <a name="l05513"></a>05513 <span class="comment">/* --- */</span> <a name="l05514"></a>05514 <span class="stringliteral">&quot;dec %%ecx \n\t&quot;</span> <span class="comment">/* decrease loop counter COLUMNS */</span> <a name="l05515"></a>05515 <span class="stringliteral">&quot;jnz .L10362 \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l05516"></a>05516 <span class="stringliteral">&quot;add $2, %%esi \n\t&quot;</span> <span class="comment">/* move to the next row in Src */</span> <a name="l05517"></a>05517 <span class="stringliteral">&quot;add $2, %%edi \n\t&quot;</span> <span class="comment">/* move to the next row in Dest */</span> <a name="l05518"></a>05518 <span class="stringliteral">&quot;dec %%edx \n\t&quot;</span> <span class="comment">/* decrease loop counter ROWS */</span> <a name="l05519"></a>05519 <span class="stringliteral">&quot;jnz .L10360 \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l05520"></a>05520 <span class="comment">/* --- */</span> <a name="l05521"></a>05521 <span class="stringliteral">&quot;emms \n\t&quot;</span> <span class="comment">/* exit MMX state */</span> <a name="l05522"></a>05522 <span class="stringliteral">&quot;popa \n\t&quot;</span>:<span class="stringliteral">&quot;=m&quot;</span> (Dest) <span class="comment">/* %0 */</span> <a name="l05523"></a>05523 :<span class="stringliteral">&quot;m&quot;</span>(Src), <span class="comment">/* %1 */</span> <a name="l05524"></a>05524 <span class="stringliteral">&quot;m&quot;</span>(rows), <span class="comment">/* %2 */</span> <a name="l05525"></a>05525 <span class="stringliteral">&quot;m&quot;</span>(columns), <span class="comment">/* %3 */</span> <a name="l05526"></a>05526 <span class="stringliteral">&quot;m&quot;</span>(Kernel), <span class="comment">/* %4 */</span> <a name="l05527"></a>05527 <span class="stringliteral">&quot;m&quot;</span>(NRightShift) <span class="comment">/* %5 */</span> <a name="l05528"></a>05528 ); <a name="l05529"></a>05529 <span class="preprocessor">#endif</span> <a name="l05530"></a>05530 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l05531"></a>05531 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l05532"></a>05532 } <span class="keywordflow">else</span> { <a name="l05533"></a>05533 <span class="comment">/* No non-MMX implementation yet */</span> <a name="l05534"></a>05534 <span class="keywordflow">return</span> (-1); <a name="l05535"></a>05535 } <a name="l05536"></a>05536 } <a name="l05537"></a>05537 <a name="l05552"></a><a class="code" href="_s_d_l__image_filter_8h.html#a9aaa45452b04f51f52826c2104ea3b85">05552</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a5253738dc4c892352b078d9a7dec2b20" title="Filter using ConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... )">SDL_imageFilterConvolveKernel5x5ShiftRight</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">int</span> rows, <span class="keywordtype">int</span> columns, <a name="l05553"></a>05553 <span class="keywordtype">signed</span> <span class="keywordtype">short</span> *Kernel, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> NRightShift) <a name="l05554"></a>05554 { <a name="l05555"></a>05555 <span class="comment">/* Validate input parameters */</span> <a name="l05556"></a>05556 <span class="keywordflow">if</span> ((Src == NULL) || (Dest == NULL) || (Kernel == NULL)) <a name="l05557"></a>05557 <span class="keywordflow">return</span>(-1); <a name="l05558"></a>05558 <a name="l05559"></a>05559 <span class="keywordflow">if</span> ((columns &lt; 5) || (rows &lt; 5) || (NRightShift &gt; 7)) <a name="l05560"></a>05560 <span class="keywordflow">return</span> (-1); <a name="l05561"></a>05561 <a name="l05562"></a>05562 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>())) { <a name="l05563"></a>05563 <span class="comment">//#ifdef USE_MMX</span> <a name="l05564"></a>05564 <span class="preprocessor">#if defined(USE_MMX) &amp;&amp; defined(i386)</span> <a name="l05565"></a>05565 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l05566"></a>05566 <span class="preprocessor"></span> __asm <a name="l05567"></a>05567 { <a name="l05568"></a>05568 pusha <a name="l05569"></a>05569 pxor mm0, mm0 <span class="comment">/* zero MM0 */</span> <a name="l05570"></a>05570 xor ebx, ebx <span class="comment">/* zero EBX */</span> <a name="l05571"></a>05571 mov bl, NRightShift <span class="comment">/* load NRightShift into BL */</span> <a name="l05572"></a>05572 movd mm5, ebx <span class="comment">/* copy NRightShift into MM5 */</span> <a name="l05573"></a>05573 mov edx, Kernel <span class="comment">/* load Kernel address into EDX */</span> <a name="l05574"></a>05574 mov esi, Src <span class="comment">/* load Src address to ESI */</span> <a name="l05575"></a>05575 mov edi, Dest <span class="comment">/* load Dest address to EDI */</span> <a name="l05576"></a>05576 add edi, 2 <span class="comment">/* 2 column offset from the left edge */</span> <a name="l05577"></a>05577 mov eax, columns <span class="comment">/* load columns into EAX */</span> <a name="l05578"></a>05578 shl eax, 1 <span class="comment">/* EAX = columns * 2 */</span> <a name="l05579"></a>05579 add edi, eax <span class="comment">/* 2 row offset from the top edge */</span> <a name="l05580"></a>05580 shr eax, 1 <span class="comment">/* EAX = columns */</span> <a name="l05581"></a>05581 mov ebx, rows <span class="comment">/* initialize ROWS counter */</span> <a name="l05582"></a>05582 sub ebx, 4 <span class="comment">/* do not use first 2 and last 2 rows */</span> <a name="l05583"></a>05583 <span class="comment">/* ---, */</span> <a name="l05584"></a>05584 L10370: <a name="l05585"></a>05585 mov ecx, eax <span class="comment">/* initialize COLUMNS counter */</span> <a name="l05586"></a>05586 sub ecx, 4 <span class="comment">/* do not use first 2 and last 2 columns */</span> <a name="l05587"></a>05587 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l05588"></a>05588 L10372: <a name="l05589"></a>05589 pxor mm7, mm7 <span class="comment">/* zero MM7 (accumulator) */</span> <a name="l05590"></a>05590 movd mm6, esi <span class="comment">/* save ESI in MM6 */</span> <a name="l05591"></a>05591 <span class="comment">/* --- 1 */</span> <a name="l05592"></a>05592 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05593"></a>05593 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05594"></a>05594 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05595"></a>05595 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05596"></a>05596 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05597"></a>05597 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05598"></a>05598 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05599"></a>05599 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05600"></a>05600 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05601"></a>05601 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05602"></a>05602 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05603"></a>05603 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l05604"></a>05604 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l05605"></a>05605 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05606"></a>05606 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05607"></a>05607 <span class="comment">/* --- 2 */</span> <a name="l05608"></a>05608 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05609"></a>05609 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05610"></a>05610 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05611"></a>05611 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05612"></a>05612 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05613"></a>05613 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05614"></a>05614 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05615"></a>05615 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05616"></a>05616 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05617"></a>05617 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05618"></a>05618 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05619"></a>05619 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l05620"></a>05620 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l05621"></a>05621 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05622"></a>05622 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05623"></a>05623 <span class="comment">/* --- 3 */</span> <a name="l05624"></a>05624 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05625"></a>05625 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05626"></a>05626 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05627"></a>05627 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05628"></a>05628 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05629"></a>05629 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05630"></a>05630 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05631"></a>05631 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05632"></a>05632 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05633"></a>05633 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05634"></a>05634 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05635"></a>05635 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l05636"></a>05636 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l05637"></a>05637 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05638"></a>05638 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05639"></a>05639 <span class="comment">/* --- 4 */</span> <a name="l05640"></a>05640 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05641"></a>05641 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05642"></a>05642 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05643"></a>05643 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05644"></a>05644 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05645"></a>05645 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05646"></a>05646 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05647"></a>05647 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05648"></a>05648 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05649"></a>05649 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05650"></a>05650 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05651"></a>05651 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l05652"></a>05652 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l05653"></a>05653 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05654"></a>05654 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05655"></a>05655 <span class="comment">/* --- 5 */</span> <a name="l05656"></a>05656 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05657"></a>05657 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05658"></a>05658 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05659"></a>05659 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05660"></a>05660 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05661"></a>05661 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05662"></a>05662 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05663"></a>05663 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05664"></a>05664 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05665"></a>05665 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l05666"></a>05666 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l05667"></a>05667 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05668"></a>05668 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05669"></a>05669 <span class="comment">/* ---, */</span> <a name="l05670"></a>05670 movq mm3, mm7 <span class="comment">/* copy MM7 into MM3 */</span> <a name="l05671"></a>05671 psrlq mm7, 32 <span class="comment">/* shift 2 left words to the right */</span> <a name="l05672"></a>05672 paddsw mm7, mm3 <span class="comment">/* add 2 left and 2 right result words */</span> <a name="l05673"></a>05673 movq mm2, mm7 <span class="comment">/* copy MM7 into MM2 */</span> <a name="l05674"></a>05674 psrlq mm7, 16 <span class="comment">/* shift 1 left word to the right */</span> <a name="l05675"></a>05675 paddsw mm7, mm2 <span class="comment">/* add 1 left and 1 right result words */</span> <a name="l05676"></a>05676 movd mm1, eax <span class="comment">/* save EAX in MM1 */</span> <a name="l05677"></a>05677 packuswb mm7, mm0 <span class="comment">/* pack division result with saturation */</span> <a name="l05678"></a>05678 movd eax, mm7 <span class="comment">/* copy saturated result into EAX */</span> <a name="l05679"></a>05679 mov [edi], al <span class="comment">/* copy a byte result into Dest */</span> <a name="l05680"></a>05680 movd eax, mm1 <span class="comment">/* restore saved EAX */</span> <a name="l05681"></a>05681 <span class="comment">/* --, */</span> <a name="l05682"></a>05682 movd esi, mm6 <span class="comment">/* move Src pointer to the top pixel */</span> <a name="l05683"></a>05683 sub edx, 72 <span class="comment">/* EDX = Kernel address */</span> <a name="l05684"></a>05684 inc esi <span class="comment">/* move Src pointer to the next pixel */</span> <a name="l05685"></a>05685 inc edi <span class="comment">/* move Dest pointer to the next pixel */</span> <a name="l05686"></a>05686 <span class="comment">/* ---, */</span> <a name="l05687"></a>05687 dec ecx <span class="comment">/* decrease loop counter COLUMNS */</span> <a name="l05688"></a>05688 jnz L10372 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l05689"></a>05689 add esi, 4 <span class="comment">/* move to the next row in Src */</span> <a name="l05690"></a>05690 add edi, 4 <span class="comment">/* move to the next row in Dest */</span> <a name="l05691"></a>05691 dec ebx <span class="comment">/* decrease loop counter ROWS */</span> <a name="l05692"></a>05692 jnz L10370 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l05693"></a>05693 <span class="comment">/* ---, */</span> <a name="l05694"></a>05694 emms <span class="comment">/* exit MMX state */</span> <a name="l05695"></a>05695 popa <a name="l05696"></a>05696 } <a name="l05697"></a>05697 <span class="preprocessor">#else</span> <a name="l05698"></a>05698 <span class="preprocessor"></span> <span class="keyword">asm</span> <span class="keyword">volatile</span> <a name="l05699"></a>05699 (<span class="stringliteral">&quot;pusha \n\t&quot;</span> <span class="stringliteral">&quot;pxor %%mm0, %%mm0 \n\t&quot;</span> <span class="comment">/* zero MM0 */</span> <a name="l05700"></a>05700 <span class="stringliteral">&quot;xor %%ebx, %%ebx \n\t&quot;</span> <span class="comment">/* zero EBX */</span> <a name="l05701"></a>05701 <span class="stringliteral">&quot;mov %5, %%bl \n\t&quot;</span> <span class="comment">/* load NRightShift into BL */</span> <a name="l05702"></a>05702 <span class="stringliteral">&quot;movd %%ebx, %%mm5 \n\t&quot;</span> <span class="comment">/* copy NRightShift into MM5 */</span> <a name="l05703"></a>05703 <span class="stringliteral">&quot;mov %4, %%edx \n\t&quot;</span> <span class="comment">/* load Kernel address into EDX */</span> <a name="l05704"></a>05704 <span class="stringliteral">&quot;mov %1, %%esi \n\t&quot;</span> <span class="comment">/* load Src address to ESI */</span> <a name="l05705"></a>05705 <span class="stringliteral">&quot;mov %0, %%edi \n\t&quot;</span> <span class="comment">/* load Dest address to EDI */</span> <a name="l05706"></a>05706 <span class="stringliteral">&quot;add $2, %%edi \n\t&quot;</span> <span class="comment">/* 2 column offset from the left edge */</span> <a name="l05707"></a>05707 <span class="stringliteral">&quot;mov %3, %%eax \n\t&quot;</span> <span class="comment">/* load columns into EAX */</span> <a name="l05708"></a>05708 <span class="stringliteral">&quot;shl $1, %%eax \n\t&quot;</span> <span class="comment">/* EAX = columns * 2 */</span> <a name="l05709"></a>05709 <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="comment">/* 2 row offset from the top edge */</span> <a name="l05710"></a>05710 <span class="stringliteral">&quot;shr $1, %%eax \n\t&quot;</span> <span class="comment">/* EAX = columns */</span> <a name="l05711"></a>05711 <span class="stringliteral">&quot;mov %2, %%ebx \n\t&quot;</span> <span class="comment">/* initialize ROWS counter */</span> <a name="l05712"></a>05712 <span class="stringliteral">&quot;sub $4, %%ebx \n\t&quot;</span> <span class="comment">/* do not use first 2 and last 2 rows */</span> <a name="l05713"></a>05713 <span class="comment">/* --- */</span> <a name="l05714"></a>05714 <span class="stringliteral">&quot;.L10370: \n\t&quot;</span> <span class="stringliteral">&quot;mov %%eax, %%ecx \n\t&quot;</span> <span class="comment">/* initialize COLUMNS counter */</span> <a name="l05715"></a>05715 <span class="stringliteral">&quot;sub $4, %%ecx \n\t&quot;</span> <span class="comment">/* do not use first 2 and last 2 columns */</span> <a name="l05716"></a>05716 <span class="stringliteral">&quot;.align 16 \n\t&quot;</span> <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l05717"></a>05717 <span class="stringliteral">&quot;.L10372: \n\t&quot;</span> <span class="stringliteral">&quot;pxor %%mm7, %%mm7 \n\t&quot;</span> <span class="comment">/* zero MM7 (accumulator) */</span> <a name="l05718"></a>05718 <span class="stringliteral">&quot;movd %%esi, %%mm6 \n\t&quot;</span> <span class="comment">/* save ESI in MM6 */</span> <a name="l05719"></a>05719 <span class="comment">/* --- 1 */</span> <a name="l05720"></a>05720 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05721"></a>05721 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05722"></a>05722 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05723"></a>05723 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05724"></a>05724 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05725"></a>05725 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05726"></a>05726 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05727"></a>05727 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05728"></a>05728 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05729"></a>05729 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05730"></a>05730 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05731"></a>05731 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05732"></a>05732 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l05733"></a>05733 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05734"></a>05734 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05735"></a>05735 <span class="comment">/* --- 2 */</span> <a name="l05736"></a>05736 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05737"></a>05737 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05738"></a>05738 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05739"></a>05739 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05740"></a>05740 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05741"></a>05741 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05742"></a>05742 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05743"></a>05743 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05744"></a>05744 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05745"></a>05745 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05746"></a>05746 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05747"></a>05747 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05748"></a>05748 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l05749"></a>05749 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05750"></a>05750 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05751"></a>05751 <span class="comment">/* --- 3 */</span> <a name="l05752"></a>05752 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05753"></a>05753 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05754"></a>05754 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05755"></a>05755 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05756"></a>05756 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05757"></a>05757 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05758"></a>05758 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05759"></a>05759 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05760"></a>05760 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05761"></a>05761 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05762"></a>05762 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05763"></a>05763 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05764"></a>05764 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l05765"></a>05765 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05766"></a>05766 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05767"></a>05767 <span class="comment">/* --- 4 */</span> <a name="l05768"></a>05768 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05769"></a>05769 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05770"></a>05770 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05771"></a>05771 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05772"></a>05772 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05773"></a>05773 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05774"></a>05774 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05775"></a>05775 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05776"></a>05776 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05777"></a>05777 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05778"></a>05778 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05779"></a>05779 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05780"></a>05780 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l05781"></a>05781 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05782"></a>05782 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05783"></a>05783 <span class="comment">/* --- 5 */</span> <a name="l05784"></a>05784 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05785"></a>05785 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05786"></a>05786 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05787"></a>05787 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l05788"></a>05788 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l05789"></a>05789 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05790"></a>05790 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05791"></a>05791 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05792"></a>05792 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05793"></a>05793 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l05794"></a>05794 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l05795"></a>05795 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05796"></a>05796 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05797"></a>05797 <span class="comment">/* --- */</span> <a name="l05798"></a>05798 <span class="stringliteral">&quot;movq %%mm7, %%mm3 \n\t&quot;</span> <span class="comment">/* copy MM7 into MM3 */</span> <a name="l05799"></a>05799 <span class="stringliteral">&quot;psrlq $32, %%mm7 \n\t&quot;</span> <span class="comment">/* shift 2 left words to the right */</span> <a name="l05800"></a>05800 <span class="stringliteral">&quot;paddsw %%mm3, %%mm7 \n\t&quot;</span> <span class="comment">/* add 2 left and 2 right result words */</span> <a name="l05801"></a>05801 <span class="stringliteral">&quot;movq %%mm7, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM7 into MM2 */</span> <a name="l05802"></a>05802 <span class="stringliteral">&quot;psrlq $16, %%mm7 \n\t&quot;</span> <span class="comment">/* shift 1 left word to the right */</span> <a name="l05803"></a>05803 <span class="stringliteral">&quot;paddsw %%mm2, %%mm7 \n\t&quot;</span> <span class="comment">/* add 1 left and 1 right result words */</span> <a name="l05804"></a>05804 <span class="stringliteral">&quot;movd %%eax, %%mm1 \n\t&quot;</span> <span class="comment">/* save EAX in MM1 */</span> <a name="l05805"></a>05805 <span class="stringliteral">&quot;packuswb %%mm0, %%mm7 \n\t&quot;</span> <span class="comment">/* pack division result with saturation */</span> <a name="l05806"></a>05806 <span class="stringliteral">&quot;movd %%mm7, %%eax \n\t&quot;</span> <span class="comment">/* copy saturated result into EAX */</span> <a name="l05807"></a>05807 <span class="stringliteral">&quot;mov %%al, (%%edi) \n\t&quot;</span> <span class="comment">/* copy a byte result into Dest */</span> <a name="l05808"></a>05808 <span class="stringliteral">&quot;movd %%mm1, %%eax \n\t&quot;</span> <span class="comment">/* restore saved EAX */</span> <a name="l05809"></a>05809 <span class="comment">/* -- */</span> <a name="l05810"></a>05810 <span class="stringliteral">&quot;movd %%mm6, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer to the top pixel */</span> <a name="l05811"></a>05811 <span class="stringliteral">&quot;sub $72, %%edx \n\t&quot;</span> <span class="comment">/* EDX = Kernel address */</span> <a name="l05812"></a>05812 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer to the next pixel */</span> <a name="l05813"></a>05813 <span class="stringliteral">&quot;inc %%edi \n\t&quot;</span> <span class="comment">/* move Dest pointer to the next pixel */</span> <a name="l05814"></a>05814 <span class="comment">/* --- */</span> <a name="l05815"></a>05815 <span class="stringliteral">&quot;dec %%ecx \n\t&quot;</span> <span class="comment">/* decrease loop counter COLUMNS */</span> <a name="l05816"></a>05816 <span class="stringliteral">&quot;jnz .L10372 \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l05817"></a>05817 <span class="stringliteral">&quot;add $4, %%esi \n\t&quot;</span> <span class="comment">/* move to the next row in Src */</span> <a name="l05818"></a>05818 <span class="stringliteral">&quot;add $4, %%edi \n\t&quot;</span> <span class="comment">/* move to the next row in Dest */</span> <a name="l05819"></a>05819 <span class="stringliteral">&quot;dec %%ebx \n\t&quot;</span> <span class="comment">/* decrease loop counter ROWS */</span> <a name="l05820"></a>05820 <span class="stringliteral">&quot;jnz .L10370 \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l05821"></a>05821 <span class="comment">/* --- */</span> <a name="l05822"></a>05822 <span class="stringliteral">&quot;emms \n\t&quot;</span> <span class="comment">/* exit MMX state */</span> <a name="l05823"></a>05823 <span class="stringliteral">&quot;popa \n\t&quot;</span>:<span class="stringliteral">&quot;=m&quot;</span> (Dest) <span class="comment">/* %0 */</span> <a name="l05824"></a>05824 :<span class="stringliteral">&quot;m&quot;</span>(Src), <span class="comment">/* %1 */</span> <a name="l05825"></a>05825 <span class="stringliteral">&quot;m&quot;</span>(rows), <span class="comment">/* %2 */</span> <a name="l05826"></a>05826 <span class="stringliteral">&quot;m&quot;</span>(columns), <span class="comment">/* %3 */</span> <a name="l05827"></a>05827 <span class="stringliteral">&quot;m&quot;</span>(Kernel), <span class="comment">/* %4 */</span> <a name="l05828"></a>05828 <span class="stringliteral">&quot;m&quot;</span>(NRightShift) <span class="comment">/* %5 */</span> <a name="l05829"></a>05829 ); <a name="l05830"></a>05830 <span class="preprocessor">#endif</span> <a name="l05831"></a>05831 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l05832"></a>05832 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l05833"></a>05833 } <span class="keywordflow">else</span> { <a name="l05834"></a>05834 <span class="comment">/* No non-MMX implementation yet */</span> <a name="l05835"></a>05835 <span class="keywordflow">return</span> (-1); <a name="l05836"></a>05836 } <a name="l05837"></a>05837 } <a name="l05838"></a>05838 <a name="l05853"></a><a class="code" href="_s_d_l__image_filter_8h.html#a6dbe52e917c0858bd311e9ce75219587">05853</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a48b40065652dda699875f1425b9227a6" title="Filter using ConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... )">SDL_imageFilterConvolveKernel7x7ShiftRight</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">int</span> rows, <span class="keywordtype">int</span> columns, <a name="l05854"></a>05854 <span class="keywordtype">signed</span> <span class="keywordtype">short</span> *Kernel, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> NRightShift) <a name="l05855"></a>05855 { <a name="l05856"></a>05856 <span class="comment">/* Validate input parameters */</span> <a name="l05857"></a>05857 <span class="keywordflow">if</span> ((Src == NULL) || (Dest == NULL) || (Kernel == NULL)) <a name="l05858"></a>05858 <span class="keywordflow">return</span>(-1); <a name="l05859"></a>05859 <a name="l05860"></a>05860 <span class="keywordflow">if</span> ((columns &lt; 7) || (rows &lt; 7) || (NRightShift &gt; 7)) <a name="l05861"></a>05861 <span class="keywordflow">return</span> (-1); <a name="l05862"></a>05862 <a name="l05863"></a>05863 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>())) { <a name="l05864"></a>05864 <span class="comment">//#ifdef USE_MMX</span> <a name="l05865"></a>05865 <span class="preprocessor">#if defined(USE_MMX) &amp;&amp; defined(i386)</span> <a name="l05866"></a>05866 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l05867"></a>05867 <span class="preprocessor"></span> __asm <a name="l05868"></a>05868 { <a name="l05869"></a>05869 pusha <a name="l05870"></a>05870 pxor mm0, mm0 <span class="comment">/* zero MM0 */</span> <a name="l05871"></a>05871 xor ebx, ebx <span class="comment">/* zero EBX */</span> <a name="l05872"></a>05872 mov bl, NRightShift <span class="comment">/* load NRightShift into BL */</span> <a name="l05873"></a>05873 movd mm5, ebx <span class="comment">/* copy NRightShift into MM5 */</span> <a name="l05874"></a>05874 mov edx, Kernel <span class="comment">/* load Kernel address into EDX */</span> <a name="l05875"></a>05875 mov esi, Src <span class="comment">/* load Src address to ESI */</span> <a name="l05876"></a>05876 mov edi, Dest <span class="comment">/* load Dest address to EDI */</span> <a name="l05877"></a>05877 add edi, 3 <span class="comment">/* 3 column offset from the left edge */</span> <a name="l05878"></a>05878 mov eax, columns <span class="comment">/* load columns into EAX */</span> <a name="l05879"></a>05879 add edi, eax <span class="comment">/* 3 row offset from the top edge */</span> <a name="l05880"></a>05880 add edi, eax <a name="l05881"></a>05881 add edi, eax <a name="l05882"></a>05882 mov ebx, rows <span class="comment">/* initialize ROWS counter */</span> <a name="l05883"></a>05883 sub ebx, 6 <span class="comment">/* do not use first 3 and last 3 rows */</span> <a name="l05884"></a>05884 <span class="comment">/* ---, */</span> <a name="l05885"></a>05885 L10380: <a name="l05886"></a>05886 mov ecx, eax <span class="comment">/* initialize COLUMNS counter */</span> <a name="l05887"></a>05887 sub ecx, 6 <span class="comment">/* do not use first 3 and last 3 columns */</span> <a name="l05888"></a>05888 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l05889"></a>05889 L10382: <a name="l05890"></a>05890 pxor mm7, mm7 <span class="comment">/* zero MM7 (accumulator) */</span> <a name="l05891"></a>05891 movd mm6, esi <span class="comment">/* save ESI in MM6 */</span> <a name="l05892"></a>05892 <span class="comment">/* --- 1 */</span> <a name="l05893"></a>05893 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05894"></a>05894 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05895"></a>05895 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05896"></a>05896 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05897"></a>05897 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05898"></a>05898 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05899"></a>05899 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05900"></a>05900 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05901"></a>05901 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05902"></a>05902 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05903"></a>05903 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05904"></a>05904 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l05905"></a>05905 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l05906"></a>05906 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05907"></a>05907 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05908"></a>05908 <span class="comment">/* --- 2 */</span> <a name="l05909"></a>05909 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05910"></a>05910 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05911"></a>05911 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05912"></a>05912 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05913"></a>05913 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05914"></a>05914 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05915"></a>05915 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05916"></a>05916 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05917"></a>05917 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05918"></a>05918 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05919"></a>05919 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05920"></a>05920 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l05921"></a>05921 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l05922"></a>05922 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05923"></a>05923 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05924"></a>05924 <span class="comment">/* --- 3 */</span> <a name="l05925"></a>05925 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05926"></a>05926 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05927"></a>05927 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05928"></a>05928 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05929"></a>05929 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05930"></a>05930 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05931"></a>05931 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05932"></a>05932 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05933"></a>05933 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05934"></a>05934 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05935"></a>05935 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05936"></a>05936 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l05937"></a>05937 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l05938"></a>05938 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05939"></a>05939 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05940"></a>05940 <span class="comment">/* --- 4 */</span> <a name="l05941"></a>05941 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05942"></a>05942 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05943"></a>05943 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05944"></a>05944 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05945"></a>05945 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05946"></a>05946 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05947"></a>05947 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05948"></a>05948 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05949"></a>05949 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05950"></a>05950 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05951"></a>05951 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05952"></a>05952 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l05953"></a>05953 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l05954"></a>05954 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05955"></a>05955 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05956"></a>05956 <span class="comment">/* --- 5 */</span> <a name="l05957"></a>05957 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05958"></a>05958 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05959"></a>05959 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05960"></a>05960 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05961"></a>05961 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05962"></a>05962 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05963"></a>05963 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05964"></a>05964 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05965"></a>05965 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05966"></a>05966 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05967"></a>05967 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05968"></a>05968 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l05969"></a>05969 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l05970"></a>05970 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05971"></a>05971 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05972"></a>05972 <span class="comment">/* --- 6 */</span> <a name="l05973"></a>05973 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05974"></a>05974 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05975"></a>05975 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l05976"></a>05976 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05977"></a>05977 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05978"></a>05978 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05979"></a>05979 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05980"></a>05980 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05981"></a>05981 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05982"></a>05982 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05983"></a>05983 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05984"></a>05984 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l05985"></a>05985 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l05986"></a>05986 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l05987"></a>05987 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l05988"></a>05988 <span class="comment">/* --- 7 */</span> <a name="l05989"></a>05989 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l05990"></a>05990 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l05991"></a>05991 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05992"></a>05992 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l05993"></a>05993 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l05994"></a>05994 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l05995"></a>05995 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l05996"></a>05996 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05997"></a>05997 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l05998"></a>05998 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l05999"></a>05999 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l06000"></a>06000 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06001"></a>06001 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06002"></a>06002 <span class="comment">/* ---, */</span> <a name="l06003"></a>06003 movq mm3, mm7 <span class="comment">/* copy MM7 into MM3 */</span> <a name="l06004"></a>06004 psrlq mm7, 32 <span class="comment">/* shift 2 left words to the right */</span> <a name="l06005"></a>06005 paddsw mm7, mm3 <span class="comment">/* add 2 left and 2 right result words */</span> <a name="l06006"></a>06006 movq mm2, mm7 <span class="comment">/* copy MM7 into MM2 */</span> <a name="l06007"></a>06007 psrlq mm7, 16 <span class="comment">/* shift 1 left word to the right */</span> <a name="l06008"></a>06008 paddsw mm7, mm2 <span class="comment">/* add 1 left and 1 right result words */</span> <a name="l06009"></a>06009 movd mm1, eax <span class="comment">/* save EAX in MM1 */</span> <a name="l06010"></a>06010 packuswb mm7, mm0 <span class="comment">/* pack division result with saturation */</span> <a name="l06011"></a>06011 movd eax, mm7 <span class="comment">/* copy saturated result into EAX */</span> <a name="l06012"></a>06012 mov [edi], al <span class="comment">/* copy a byte result into Dest */</span> <a name="l06013"></a>06013 movd eax, mm1 <span class="comment">/* restore saved EAX */</span> <a name="l06014"></a>06014 <span class="comment">/* --, */</span> <a name="l06015"></a>06015 movd esi, mm6 <span class="comment">/* move Src pointer to the top pixel */</span> <a name="l06016"></a>06016 sub edx, 104 <span class="comment">/* EDX = Kernel address */</span> <a name="l06017"></a>06017 inc esi <span class="comment">/* move Src pointer to the next pixel */</span> <a name="l06018"></a>06018 inc edi <span class="comment">/* move Dest pointer to the next pixel */</span> <a name="l06019"></a>06019 <span class="comment">/* ---, */</span> <a name="l06020"></a>06020 dec ecx <span class="comment">/* decrease loop counter COLUMNS */</span> <a name="l06021"></a>06021 jnz L10382 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l06022"></a>06022 add esi, 6 <span class="comment">/* move to the next row in Src */</span> <a name="l06023"></a>06023 add edi, 6 <span class="comment">/* move to the next row in Dest */</span> <a name="l06024"></a>06024 dec ebx <span class="comment">/* decrease loop counter ROWS */</span> <a name="l06025"></a>06025 jnz L10380 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l06026"></a>06026 <span class="comment">/* ---, */</span> <a name="l06027"></a>06027 emms <span class="comment">/* exit MMX state */</span> <a name="l06028"></a>06028 popa <a name="l06029"></a>06029 } <a name="l06030"></a>06030 <span class="preprocessor">#else</span> <a name="l06031"></a>06031 <span class="preprocessor"></span> <span class="keyword">asm</span> <span class="keyword">volatile</span> <a name="l06032"></a>06032 (<span class="stringliteral">&quot;pusha \n\t&quot;</span> <span class="stringliteral">&quot;pxor %%mm0, %%mm0 \n\t&quot;</span> <span class="comment">/* zero MM0 */</span> <a name="l06033"></a>06033 <span class="stringliteral">&quot;xor %%ebx, %%ebx \n\t&quot;</span> <span class="comment">/* zero EBX */</span> <a name="l06034"></a>06034 <span class="stringliteral">&quot;mov %5, %%bl \n\t&quot;</span> <span class="comment">/* load NRightShift into BL */</span> <a name="l06035"></a>06035 <span class="stringliteral">&quot;movd %%ebx, %%mm5 \n\t&quot;</span> <span class="comment">/* copy NRightShift into MM5 */</span> <a name="l06036"></a>06036 <span class="stringliteral">&quot;mov %4, %%edx \n\t&quot;</span> <span class="comment">/* load Kernel address into EDX */</span> <a name="l06037"></a>06037 <span class="stringliteral">&quot;mov %1, %%esi \n\t&quot;</span> <span class="comment">/* load Src address to ESI */</span> <a name="l06038"></a>06038 <span class="stringliteral">&quot;mov %0, %%edi \n\t&quot;</span> <span class="comment">/* load Dest address to EDI */</span> <a name="l06039"></a>06039 <span class="stringliteral">&quot;add $3, %%edi \n\t&quot;</span> <span class="comment">/* 3 column offset from the left edge */</span> <a name="l06040"></a>06040 <span class="stringliteral">&quot;mov %3, %%eax \n\t&quot;</span> <span class="comment">/* load columns into EAX */</span> <a name="l06041"></a>06041 <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="comment">/* 3 row offset from the top edge */</span> <a name="l06042"></a>06042 <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="stringliteral">&quot;mov %2, %%ebx \n\t&quot;</span> <span class="comment">/* initialize ROWS counter */</span> <a name="l06043"></a>06043 <span class="stringliteral">&quot;sub $6, %%ebx \n\t&quot;</span> <span class="comment">/* do not use first 3 and last 3 rows */</span> <a name="l06044"></a>06044 <span class="comment">/* --- */</span> <a name="l06045"></a>06045 <span class="stringliteral">&quot;.L10380: \n\t&quot;</span> <span class="stringliteral">&quot;mov %%eax, %%ecx \n\t&quot;</span> <span class="comment">/* initialize COLUMNS counter */</span> <a name="l06046"></a>06046 <span class="stringliteral">&quot;sub $6, %%ecx \n\t&quot;</span> <span class="comment">/* do not use first 3 and last 3 columns */</span> <a name="l06047"></a>06047 <span class="stringliteral">&quot;.align 16 \n\t&quot;</span> <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l06048"></a>06048 <span class="stringliteral">&quot;.L10382: \n\t&quot;</span> <span class="stringliteral">&quot;pxor %%mm7, %%mm7 \n\t&quot;</span> <span class="comment">/* zero MM7 (accumulator) */</span> <a name="l06049"></a>06049 <span class="stringliteral">&quot;movd %%esi, %%mm6 \n\t&quot;</span> <span class="comment">/* save ESI in MM6 */</span> <a name="l06050"></a>06050 <span class="comment">/* --- 1 */</span> <a name="l06051"></a>06051 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06052"></a>06052 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06053"></a>06053 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06054"></a>06054 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06055"></a>06055 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06056"></a>06056 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06057"></a>06057 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06058"></a>06058 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06059"></a>06059 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06060"></a>06060 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06061"></a>06061 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06062"></a>06062 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06063"></a>06063 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l06064"></a>06064 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06065"></a>06065 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06066"></a>06066 <span class="comment">/* --- 2 */</span> <a name="l06067"></a>06067 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06068"></a>06068 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06069"></a>06069 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06070"></a>06070 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06071"></a>06071 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06072"></a>06072 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06073"></a>06073 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06074"></a>06074 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06075"></a>06075 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06076"></a>06076 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06077"></a>06077 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06078"></a>06078 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06079"></a>06079 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l06080"></a>06080 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06081"></a>06081 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06082"></a>06082 <span class="comment">/* --- 3 */</span> <a name="l06083"></a>06083 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06084"></a>06084 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06085"></a>06085 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06086"></a>06086 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06087"></a>06087 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06088"></a>06088 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06089"></a>06089 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06090"></a>06090 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06091"></a>06091 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06092"></a>06092 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06093"></a>06093 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06094"></a>06094 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06095"></a>06095 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l06096"></a>06096 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06097"></a>06097 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06098"></a>06098 <span class="comment">/* --- 4 */</span> <a name="l06099"></a>06099 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06100"></a>06100 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06101"></a>06101 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06102"></a>06102 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06103"></a>06103 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06104"></a>06104 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06105"></a>06105 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06106"></a>06106 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06107"></a>06107 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06108"></a>06108 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06109"></a>06109 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06110"></a>06110 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06111"></a>06111 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l06112"></a>06112 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06113"></a>06113 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06114"></a>06114 <span class="comment">/* --- 5 */</span> <a name="l06115"></a>06115 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06116"></a>06116 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06117"></a>06117 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06118"></a>06118 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06119"></a>06119 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06120"></a>06120 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06121"></a>06121 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06122"></a>06122 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06123"></a>06123 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06124"></a>06124 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06125"></a>06125 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06126"></a>06126 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06127"></a>06127 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l06128"></a>06128 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06129"></a>06129 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06130"></a>06130 <span class="comment">/* --- 6 */</span> <a name="l06131"></a>06131 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06132"></a>06132 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06133"></a>06133 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06134"></a>06134 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06135"></a>06135 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06136"></a>06136 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06137"></a>06137 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06138"></a>06138 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06139"></a>06139 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06140"></a>06140 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06141"></a>06141 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06142"></a>06142 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06143"></a>06143 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l06144"></a>06144 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06145"></a>06145 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06146"></a>06146 <span class="comment">/* --- 7 */</span> <a name="l06147"></a>06147 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06148"></a>06148 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06149"></a>06149 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06150"></a>06150 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06151"></a>06151 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06152"></a>06152 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06153"></a>06153 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06154"></a>06154 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06155"></a>06155 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06156"></a>06156 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06157"></a>06157 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l06158"></a>06158 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06159"></a>06159 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06160"></a>06160 <span class="comment">/* --- */</span> <a name="l06161"></a>06161 <span class="stringliteral">&quot;movq %%mm7, %%mm3 \n\t&quot;</span> <span class="comment">/* copy MM7 into MM3 */</span> <a name="l06162"></a>06162 <span class="stringliteral">&quot;psrlq $32, %%mm7 \n\t&quot;</span> <span class="comment">/* shift 2 left words to the right */</span> <a name="l06163"></a>06163 <span class="stringliteral">&quot;paddsw %%mm3, %%mm7 \n\t&quot;</span> <span class="comment">/* add 2 left and 2 right result words */</span> <a name="l06164"></a>06164 <span class="stringliteral">&quot;movq %%mm7, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM7 into MM2 */</span> <a name="l06165"></a>06165 <span class="stringliteral">&quot;psrlq $16, %%mm7 \n\t&quot;</span> <span class="comment">/* shift 1 left word to the right */</span> <a name="l06166"></a>06166 <span class="stringliteral">&quot;paddsw %%mm2, %%mm7 \n\t&quot;</span> <span class="comment">/* add 1 left and 1 right result words */</span> <a name="l06167"></a>06167 <span class="stringliteral">&quot;movd %%eax, %%mm1 \n\t&quot;</span> <span class="comment">/* save EAX in MM1 */</span> <a name="l06168"></a>06168 <span class="stringliteral">&quot;packuswb %%mm0, %%mm7 \n\t&quot;</span> <span class="comment">/* pack division result with saturation */</span> <a name="l06169"></a>06169 <span class="stringliteral">&quot;movd %%mm7, %%eax \n\t&quot;</span> <span class="comment">/* copy saturated result into EAX */</span> <a name="l06170"></a>06170 <span class="stringliteral">&quot;mov %%al, (%%edi) \n\t&quot;</span> <span class="comment">/* copy a byte result into Dest */</span> <a name="l06171"></a>06171 <span class="stringliteral">&quot;movd %%mm1, %%eax \n\t&quot;</span> <span class="comment">/* restore saved EAX */</span> <a name="l06172"></a>06172 <span class="comment">/* -- */</span> <a name="l06173"></a>06173 <span class="stringliteral">&quot;movd %%mm6, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer to the top pixel */</span> <a name="l06174"></a>06174 <span class="stringliteral">&quot;sub $104, %%edx \n\t&quot;</span> <span class="comment">/* EDX = Kernel address */</span> <a name="l06175"></a>06175 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer to the next pixel */</span> <a name="l06176"></a>06176 <span class="stringliteral">&quot;inc %%edi \n\t&quot;</span> <span class="comment">/* move Dest pointer to the next pixel */</span> <a name="l06177"></a>06177 <span class="comment">/* --- */</span> <a name="l06178"></a>06178 <span class="stringliteral">&quot;dec %%ecx \n\t&quot;</span> <span class="comment">/* decrease loop counter COLUMNS */</span> <a name="l06179"></a>06179 <span class="stringliteral">&quot;jnz .L10382 \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l06180"></a>06180 <span class="stringliteral">&quot;add $6, %%esi \n\t&quot;</span> <span class="comment">/* move to the next row in Src */</span> <a name="l06181"></a>06181 <span class="stringliteral">&quot;add $6, %%edi \n\t&quot;</span> <span class="comment">/* move to the next row in Dest */</span> <a name="l06182"></a>06182 <span class="stringliteral">&quot;dec %%ebx \n\t&quot;</span> <span class="comment">/* decrease loop counter ROWS */</span> <a name="l06183"></a>06183 <span class="stringliteral">&quot;jnz .L10380 \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l06184"></a>06184 <span class="comment">/* --- */</span> <a name="l06185"></a>06185 <span class="stringliteral">&quot;emms \n\t&quot;</span> <span class="comment">/* exit MMX state */</span> <a name="l06186"></a>06186 <span class="stringliteral">&quot;popa \n\t&quot;</span>:<span class="stringliteral">&quot;=m&quot;</span> (Dest) <span class="comment">/* %0 */</span> <a name="l06187"></a>06187 :<span class="stringliteral">&quot;m&quot;</span>(Src), <span class="comment">/* %1 */</span> <a name="l06188"></a>06188 <span class="stringliteral">&quot;m&quot;</span>(rows), <span class="comment">/* %2 */</span> <a name="l06189"></a>06189 <span class="stringliteral">&quot;m&quot;</span>(columns), <span class="comment">/* %3 */</span> <a name="l06190"></a>06190 <span class="stringliteral">&quot;m&quot;</span>(Kernel), <span class="comment">/* %4 */</span> <a name="l06191"></a>06191 <span class="stringliteral">&quot;m&quot;</span>(NRightShift) <span class="comment">/* %5 */</span> <a name="l06192"></a>06192 ); <a name="l06193"></a>06193 <span class="preprocessor">#endif</span> <a name="l06194"></a>06194 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l06195"></a>06195 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l06196"></a>06196 } <span class="keywordflow">else</span> { <a name="l06197"></a>06197 <span class="comment">/* No non-MMX implementation yet */</span> <a name="l06198"></a>06198 <span class="keywordflow">return</span> (-1); <a name="l06199"></a>06199 } <a name="l06200"></a>06200 } <a name="l06201"></a>06201 <a name="l06216"></a><a class="code" href="_s_d_l__image_filter_8h.html#ad2702d0524a16032118fdf67e3e0f44a">06216</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a6aaa30dc51d1e51585d02d123b0f1a7a" title="Filter using ConvolveKernel9x9ShiftRight: Dij = saturation255( ... )">SDL_imageFilterConvolveKernel9x9ShiftRight</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">int</span> rows, <span class="keywordtype">int</span> columns, <a name="l06217"></a>06217 <span class="keywordtype">signed</span> <span class="keywordtype">short</span> *Kernel, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> NRightShift) <a name="l06218"></a>06218 { <a name="l06219"></a>06219 <span class="comment">/* Validate input parameters */</span> <a name="l06220"></a>06220 <span class="keywordflow">if</span> ((Src == NULL) || (Dest == NULL) || (Kernel == NULL)) <a name="l06221"></a>06221 <span class="keywordflow">return</span>(-1); <a name="l06222"></a>06222 <a name="l06223"></a>06223 <span class="keywordflow">if</span> ((columns &lt; 9) || (rows &lt; 9) || (NRightShift &gt; 7)) <a name="l06224"></a>06224 <span class="keywordflow">return</span> (-1); <a name="l06225"></a>06225 <a name="l06226"></a>06226 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>())) { <a name="l06227"></a>06227 <span class="comment">//#ifdef USE_MMX</span> <a name="l06228"></a>06228 <span class="preprocessor">#if defined(USE_MMX) &amp;&amp; defined(i386)</span> <a name="l06229"></a>06229 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l06230"></a>06230 <span class="preprocessor"></span> __asm <a name="l06231"></a>06231 { <a name="l06232"></a>06232 pusha <a name="l06233"></a>06233 pxor mm0, mm0 <span class="comment">/* zero MM0 */</span> <a name="l06234"></a>06234 xor ebx, ebx <span class="comment">/* zero EBX */</span> <a name="l06235"></a>06235 mov bl, NRightShift <span class="comment">/* load NRightShift into BL */</span> <a name="l06236"></a>06236 movd mm5, ebx <span class="comment">/* copy NRightShift into MM5 */</span> <a name="l06237"></a>06237 mov edx, Kernel <span class="comment">/* load Kernel address into EDX */</span> <a name="l06238"></a>06238 mov esi, Src <span class="comment">/* load Src address to ESI */</span> <a name="l06239"></a>06239 mov edi, Dest <span class="comment">/* load Dest address to EDI */</span> <a name="l06240"></a>06240 add edi, 4 <span class="comment">/* 4 column offset from the left edge */</span> <a name="l06241"></a>06241 mov eax, columns <span class="comment">/* load columns into EAX */</span> <a name="l06242"></a>06242 add edi, eax <span class="comment">/* 4 row offset from the top edge */</span> <a name="l06243"></a>06243 add edi, eax <a name="l06244"></a>06244 add edi, eax <a name="l06245"></a>06245 add edi, eax <a name="l06246"></a>06246 mov ebx, rows <span class="comment">/* initialize ROWS counter */</span> <a name="l06247"></a>06247 sub ebx, 8 <span class="comment">/* do not use first 4 and last 4 rows */</span> <a name="l06248"></a>06248 <span class="comment">/* ---, */</span> <a name="l06249"></a>06249 L10390: <a name="l06250"></a>06250 mov ecx, eax <span class="comment">/* initialize COLUMNS counter */</span> <a name="l06251"></a>06251 sub ecx, 8 <span class="comment">/* do not use first 4 and last 4 columns */</span> <a name="l06252"></a>06252 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l06253"></a>06253 L10392: <a name="l06254"></a>06254 pxor mm7, mm7 <span class="comment">/* zero MM7 (accumulator) */</span> <a name="l06255"></a>06255 movd mm6, esi <span class="comment">/* save ESI in MM6 */</span> <a name="l06256"></a>06256 <span class="comment">/* --- 1 */</span> <a name="l06257"></a>06257 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06258"></a>06258 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06259"></a>06259 inc esi <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l06260"></a>06260 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06261"></a>06261 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06262"></a>06262 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06263"></a>06263 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06264"></a>06264 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06265"></a>06265 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06266"></a>06266 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06267"></a>06267 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06268"></a>06268 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l06269"></a>06269 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l06270"></a>06270 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06271"></a>06271 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06272"></a>06272 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06273"></a>06273 dec esi <a name="l06274"></a>06274 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06275"></a>06275 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06276"></a>06276 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06277"></a>06277 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06278"></a>06278 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06279"></a>06279 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l06280"></a>06280 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06281"></a>06281 <span class="comment">/* --- 2 */</span> <a name="l06282"></a>06282 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06283"></a>06283 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06284"></a>06284 inc esi <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l06285"></a>06285 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06286"></a>06286 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06287"></a>06287 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06288"></a>06288 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06289"></a>06289 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06290"></a>06290 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06291"></a>06291 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06292"></a>06292 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06293"></a>06293 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l06294"></a>06294 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l06295"></a>06295 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06296"></a>06296 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06297"></a>06297 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06298"></a>06298 dec esi <a name="l06299"></a>06299 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06300"></a>06300 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06301"></a>06301 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06302"></a>06302 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06303"></a>06303 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06304"></a>06304 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l06305"></a>06305 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06306"></a>06306 <span class="comment">/* --- 3 */</span> <a name="l06307"></a>06307 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06308"></a>06308 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06309"></a>06309 inc esi <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l06310"></a>06310 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06311"></a>06311 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06312"></a>06312 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06313"></a>06313 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06314"></a>06314 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06315"></a>06315 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06316"></a>06316 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06317"></a>06317 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06318"></a>06318 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l06319"></a>06319 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l06320"></a>06320 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06321"></a>06321 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06322"></a>06322 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06323"></a>06323 dec esi <a name="l06324"></a>06324 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06325"></a>06325 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06326"></a>06326 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06327"></a>06327 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06328"></a>06328 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06329"></a>06329 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l06330"></a>06330 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06331"></a>06331 <span class="comment">/* --- 4 */</span> <a name="l06332"></a>06332 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06333"></a>06333 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06334"></a>06334 inc esi <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l06335"></a>06335 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06336"></a>06336 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06337"></a>06337 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06338"></a>06338 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06339"></a>06339 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06340"></a>06340 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06341"></a>06341 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06342"></a>06342 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06343"></a>06343 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l06344"></a>06344 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l06345"></a>06345 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06346"></a>06346 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06347"></a>06347 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06348"></a>06348 dec esi <a name="l06349"></a>06349 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06350"></a>06350 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06351"></a>06351 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06352"></a>06352 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06353"></a>06353 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06354"></a>06354 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l06355"></a>06355 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06356"></a>06356 <span class="comment">/* --- 5 */</span> <a name="l06357"></a>06357 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06358"></a>06358 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06359"></a>06359 inc esi <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l06360"></a>06360 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06361"></a>06361 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06362"></a>06362 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06363"></a>06363 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06364"></a>06364 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06365"></a>06365 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06366"></a>06366 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06367"></a>06367 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06368"></a>06368 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l06369"></a>06369 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l06370"></a>06370 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06371"></a>06371 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06372"></a>06372 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06373"></a>06373 dec esi <a name="l06374"></a>06374 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06375"></a>06375 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06376"></a>06376 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06377"></a>06377 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06378"></a>06378 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06379"></a>06379 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l06380"></a>06380 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06381"></a>06381 <span class="comment">/* --- 6 */</span> <a name="l06382"></a>06382 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06383"></a>06383 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06384"></a>06384 inc esi <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l06385"></a>06385 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06386"></a>06386 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06387"></a>06387 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06388"></a>06388 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06389"></a>06389 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06390"></a>06390 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06391"></a>06391 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06392"></a>06392 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06393"></a>06393 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l06394"></a>06394 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l06395"></a>06395 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06396"></a>06396 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06397"></a>06397 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06398"></a>06398 dec esi <a name="l06399"></a>06399 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06400"></a>06400 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06401"></a>06401 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06402"></a>06402 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06403"></a>06403 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06404"></a>06404 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l06405"></a>06405 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06406"></a>06406 <span class="comment">/* --- 7 */</span> <a name="l06407"></a>06407 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06408"></a>06408 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06409"></a>06409 inc esi <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l06410"></a>06410 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06411"></a>06411 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06412"></a>06412 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06413"></a>06413 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06414"></a>06414 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06415"></a>06415 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06416"></a>06416 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06417"></a>06417 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06418"></a>06418 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l06419"></a>06419 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l06420"></a>06420 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06421"></a>06421 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06422"></a>06422 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06423"></a>06423 dec esi <a name="l06424"></a>06424 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06425"></a>06425 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06426"></a>06426 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06427"></a>06427 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06428"></a>06428 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06429"></a>06429 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l06430"></a>06430 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06431"></a>06431 <span class="comment">/* --- 8 */</span> <a name="l06432"></a>06432 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06433"></a>06433 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06434"></a>06434 inc esi <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l06435"></a>06435 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06436"></a>06436 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06437"></a>06437 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06438"></a>06438 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06439"></a>06439 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06440"></a>06440 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06441"></a>06441 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06442"></a>06442 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06443"></a>06443 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l06444"></a>06444 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l06445"></a>06445 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06446"></a>06446 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06447"></a>06447 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06448"></a>06448 dec esi <a name="l06449"></a>06449 add esi, eax <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06450"></a>06450 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06451"></a>06451 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06452"></a>06452 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06453"></a>06453 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06454"></a>06454 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l06455"></a>06455 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06456"></a>06456 <span class="comment">/* --- 9 */</span> <a name="l06457"></a>06457 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06458"></a>06458 movq mm2, mm1 <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06459"></a>06459 inc esi <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l06460"></a>06460 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06461"></a>06461 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06462"></a>06462 movq mm4, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06463"></a>06463 add edx, 8 <span class="comment">/* move pointer to other 4 words */</span> <a name="l06464"></a>06464 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06465"></a>06465 punpckhbw mm2, mm0 <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06466"></a>06466 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06467"></a>06467 psrlw mm2, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06468"></a>06468 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l06469"></a>06469 pmullw mm2, mm4 <span class="comment">/* mult 4 high words of Src and Kernel */</span> <a name="l06470"></a>06470 paddsw mm1, mm2 <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06471"></a>06471 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06472"></a>06472 movq mm1, [esi] <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06473"></a>06473 movq mm3, [edx] <span class="comment">/* load 4 words of Kernel */</span> <a name="l06474"></a>06474 punpcklbw mm1, mm0 <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06475"></a>06475 psrlw mm1, mm5 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06476"></a>06476 pmullw mm1, mm3 <span class="comment">/* mult 4 low words of Src and Kernel */</span> <a name="l06477"></a>06477 paddsw mm7, mm1 <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06478"></a>06478 <span class="comment">/* ---, */</span> <a name="l06479"></a>06479 movq mm3, mm7 <span class="comment">/* copy MM7 into MM3 */</span> <a name="l06480"></a>06480 psrlq mm7, 32 <span class="comment">/* shift 2 left words to the right */</span> <a name="l06481"></a>06481 paddsw mm7, mm3 <span class="comment">/* add 2 left and 2 right result words */</span> <a name="l06482"></a>06482 movq mm2, mm7 <span class="comment">/* copy MM7 into MM2 */</span> <a name="l06483"></a>06483 psrlq mm7, 16 <span class="comment">/* shift 1 left word to the right */</span> <a name="l06484"></a>06484 paddsw mm7, mm2 <span class="comment">/* add 1 left and 1 right result words */</span> <a name="l06485"></a>06485 movd mm1, eax <span class="comment">/* save EAX in MM1 */</span> <a name="l06486"></a>06486 packuswb mm7, mm0 <span class="comment">/* pack division result with saturation */</span> <a name="l06487"></a>06487 movd eax, mm7 <span class="comment">/* copy saturated result into EAX */</span> <a name="l06488"></a>06488 mov [edi], al <span class="comment">/* copy a byte result into Dest */</span> <a name="l06489"></a>06489 movd eax, mm1 <span class="comment">/* restore saved EAX */</span> <a name="l06490"></a>06490 <span class="comment">/* --, */</span> <a name="l06491"></a>06491 movd esi, mm6 <span class="comment">/* move Src pointer to the top pixel */</span> <a name="l06492"></a>06492 sub edx, 208 <span class="comment">/* EDX = Kernel address */</span> <a name="l06493"></a>06493 inc esi <span class="comment">/* move Src pointer to the next pixel */</span> <a name="l06494"></a>06494 inc edi <span class="comment">/* move Dest pointer to the next pixel */</span> <a name="l06495"></a>06495 <span class="comment">/* ---, */</span> <a name="l06496"></a>06496 dec ecx <span class="comment">/* decrease loop counter COLUMNS */</span> <a name="l06497"></a>06497 jnz L10392 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l06498"></a>06498 add esi, 8 <span class="comment">/* move to the next row in Src */</span> <a name="l06499"></a>06499 add edi, 8 <span class="comment">/* move to the next row in Dest */</span> <a name="l06500"></a>06500 dec ebx <span class="comment">/* decrease loop counter ROWS */</span> <a name="l06501"></a>06501 jnz L10390 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l06502"></a>06502 <span class="comment">/* ---, */</span> <a name="l06503"></a>06503 emms <span class="comment">/* exit MMX state */</span> <a name="l06504"></a>06504 popa <a name="l06505"></a>06505 } <a name="l06506"></a>06506 <span class="preprocessor">#else</span> <a name="l06507"></a>06507 <span class="preprocessor"></span> <span class="keyword">asm</span> <span class="keyword">volatile</span> <a name="l06508"></a>06508 (<span class="stringliteral">&quot;pusha \n\t&quot;</span> <span class="stringliteral">&quot;pxor %%mm0, %%mm0 \n\t&quot;</span> <span class="comment">/* zero MM0 */</span> <a name="l06509"></a>06509 <span class="stringliteral">&quot;xor %%ebx, %%ebx \n\t&quot;</span> <span class="comment">/* zero EBX */</span> <a name="l06510"></a>06510 <span class="stringliteral">&quot;mov %5, %%bl \n\t&quot;</span> <span class="comment">/* load NRightShift into BL */</span> <a name="l06511"></a>06511 <span class="stringliteral">&quot;movd %%ebx, %%mm5 \n\t&quot;</span> <span class="comment">/* copy NRightShift into MM5 */</span> <a name="l06512"></a>06512 <span class="stringliteral">&quot;mov %4, %%edx \n\t&quot;</span> <span class="comment">/* load Kernel address into EDX */</span> <a name="l06513"></a>06513 <span class="stringliteral">&quot;mov %1, %%esi \n\t&quot;</span> <span class="comment">/* load Src address to ESI */</span> <a name="l06514"></a>06514 <span class="stringliteral">&quot;mov %0, %%edi \n\t&quot;</span> <span class="comment">/* load Dest address to EDI */</span> <a name="l06515"></a>06515 <span class="stringliteral">&quot;add $4, %%edi \n\t&quot;</span> <span class="comment">/* 4 column offset from the left edge */</span> <a name="l06516"></a>06516 <span class="stringliteral">&quot;mov %3, %%eax \n\t&quot;</span> <span class="comment">/* load columns into EAX */</span> <a name="l06517"></a>06517 <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="comment">/* 4 row offset from the top edge */</span> <a name="l06518"></a>06518 <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="stringliteral">&quot;mov %2, %%ebx \n\t&quot;</span> <span class="comment">/* initialize ROWS counter */</span> <a name="l06519"></a>06519 <span class="stringliteral">&quot;sub $8, %%ebx \n\t&quot;</span> <span class="comment">/* do not use first 4 and last 4 rows */</span> <a name="l06520"></a>06520 <span class="comment">/* --- */</span> <a name="l06521"></a>06521 <span class="stringliteral">&quot;.L10390: \n\t&quot;</span> <span class="stringliteral">&quot;mov %%eax, %%ecx \n\t&quot;</span> <span class="comment">/* initialize COLUMNS counter */</span> <a name="l06522"></a>06522 <span class="stringliteral">&quot;sub $8, %%ecx \n\t&quot;</span> <span class="comment">/* do not use first 4 and last 4 columns */</span> <a name="l06523"></a>06523 <span class="stringliteral">&quot;.align 16 \n\t&quot;</span> <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l06524"></a>06524 <span class="stringliteral">&quot;.L10392: \n\t&quot;</span> <span class="stringliteral">&quot;pxor %%mm7, %%mm7 \n\t&quot;</span> <span class="comment">/* zero MM7 (accumulator) */</span> <a name="l06525"></a>06525 <span class="stringliteral">&quot;movd %%esi, %%mm6 \n\t&quot;</span> <span class="comment">/* save ESI in MM6 */</span> <a name="l06526"></a>06526 <span class="comment">/* --- 1 */</span> <a name="l06527"></a>06527 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06528"></a>06528 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06529"></a>06529 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l06530"></a>06530 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06531"></a>06531 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06532"></a>06532 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06533"></a>06533 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06534"></a>06534 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06535"></a>06535 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06536"></a>06536 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06537"></a>06537 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06538"></a>06538 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06539"></a>06539 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l06540"></a>06540 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06541"></a>06541 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06542"></a>06542 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06543"></a>06543 <span class="stringliteral">&quot;dec %%esi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06544"></a>06544 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06545"></a>06545 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06546"></a>06546 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06547"></a>06547 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06548"></a>06548 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06549"></a>06549 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06550"></a>06550 <span class="comment">/* --- 2 */</span> <a name="l06551"></a>06551 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06552"></a>06552 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06553"></a>06553 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l06554"></a>06554 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06555"></a>06555 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06556"></a>06556 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06557"></a>06557 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06558"></a>06558 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06559"></a>06559 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06560"></a>06560 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06561"></a>06561 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06562"></a>06562 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06563"></a>06563 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l06564"></a>06564 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06565"></a>06565 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06566"></a>06566 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06567"></a>06567 <span class="stringliteral">&quot;dec %%esi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06568"></a>06568 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06569"></a>06569 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06570"></a>06570 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06571"></a>06571 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06572"></a>06572 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06573"></a>06573 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06574"></a>06574 <span class="comment">/* --- 3 */</span> <a name="l06575"></a>06575 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06576"></a>06576 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06577"></a>06577 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l06578"></a>06578 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06579"></a>06579 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06580"></a>06580 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06581"></a>06581 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06582"></a>06582 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06583"></a>06583 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06584"></a>06584 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06585"></a>06585 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06586"></a>06586 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06587"></a>06587 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l06588"></a>06588 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06589"></a>06589 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06590"></a>06590 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06591"></a>06591 <span class="stringliteral">&quot;dec %%esi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06592"></a>06592 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06593"></a>06593 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06594"></a>06594 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06595"></a>06595 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06596"></a>06596 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06597"></a>06597 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06598"></a>06598 <span class="comment">/* --- 4 */</span> <a name="l06599"></a>06599 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06600"></a>06600 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06601"></a>06601 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l06602"></a>06602 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06603"></a>06603 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06604"></a>06604 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06605"></a>06605 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06606"></a>06606 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06607"></a>06607 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06608"></a>06608 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06609"></a>06609 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06610"></a>06610 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06611"></a>06611 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l06612"></a>06612 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06613"></a>06613 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06614"></a>06614 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06615"></a>06615 <span class="stringliteral">&quot;dec %%esi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06616"></a>06616 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06617"></a>06617 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06618"></a>06618 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06619"></a>06619 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06620"></a>06620 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06621"></a>06621 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06622"></a>06622 <span class="comment">/* --- 5 */</span> <a name="l06623"></a>06623 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06624"></a>06624 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06625"></a>06625 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l06626"></a>06626 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06627"></a>06627 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06628"></a>06628 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06629"></a>06629 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06630"></a>06630 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06631"></a>06631 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06632"></a>06632 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06633"></a>06633 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06634"></a>06634 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06635"></a>06635 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l06636"></a>06636 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06637"></a>06637 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06638"></a>06638 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06639"></a>06639 <span class="stringliteral">&quot;dec %%esi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06640"></a>06640 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06641"></a>06641 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06642"></a>06642 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06643"></a>06643 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06644"></a>06644 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06645"></a>06645 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06646"></a>06646 <span class="comment">/* --- 6 */</span> <a name="l06647"></a>06647 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06648"></a>06648 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06649"></a>06649 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l06650"></a>06650 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06651"></a>06651 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06652"></a>06652 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06653"></a>06653 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06654"></a>06654 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06655"></a>06655 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06656"></a>06656 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06657"></a>06657 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06658"></a>06658 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06659"></a>06659 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l06660"></a>06660 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06661"></a>06661 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06662"></a>06662 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06663"></a>06663 <span class="stringliteral">&quot;dec %%esi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06664"></a>06664 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06665"></a>06665 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06666"></a>06666 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06667"></a>06667 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06668"></a>06668 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06669"></a>06669 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06670"></a>06670 <span class="comment">/* --- 7 */</span> <a name="l06671"></a>06671 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06672"></a>06672 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06673"></a>06673 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l06674"></a>06674 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06675"></a>06675 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06676"></a>06676 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06677"></a>06677 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06678"></a>06678 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06679"></a>06679 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06680"></a>06680 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06681"></a>06681 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06682"></a>06682 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06683"></a>06683 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l06684"></a>06684 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06685"></a>06685 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06686"></a>06686 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06687"></a>06687 <span class="stringliteral">&quot;dec %%esi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06688"></a>06688 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06689"></a>06689 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06690"></a>06690 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06691"></a>06691 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06692"></a>06692 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06693"></a>06693 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06694"></a>06694 <span class="comment">/* --- 8 */</span> <a name="l06695"></a>06695 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06696"></a>06696 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06697"></a>06697 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l06698"></a>06698 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06699"></a>06699 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06700"></a>06700 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06701"></a>06701 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06702"></a>06702 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06703"></a>06703 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06704"></a>06704 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06705"></a>06705 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06706"></a>06706 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06707"></a>06707 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l06708"></a>06708 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06709"></a>06709 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06710"></a>06710 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06711"></a>06711 <span class="stringliteral">&quot;dec %%esi \n\t&quot;</span> <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer 1 row below */</span> <a name="l06712"></a>06712 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06713"></a>06713 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06714"></a>06714 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06715"></a>06715 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06716"></a>06716 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06717"></a>06717 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06718"></a>06718 <span class="comment">/* --- 9 */</span> <a name="l06719"></a>06719 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06720"></a>06720 <span class="stringliteral">&quot;movq %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM1 into MM2 */</span> <a name="l06721"></a>06721 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move pointer to the next 8 bytes of Src */</span> <a name="l06722"></a>06722 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06723"></a>06723 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06724"></a>06724 <span class="stringliteral">&quot;movq (%%edx), %%mm4 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06725"></a>06725 <span class="stringliteral">&quot;add $8, %%edx \n\t&quot;</span> <span class="comment">/* move pointer to other 4 words */</span> <a name="l06726"></a>06726 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06727"></a>06727 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack second 4 bytes into words */</span> <a name="l06728"></a>06728 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06729"></a>06729 <span class="stringliteral">&quot;psrlw %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06730"></a>06730 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06731"></a>06731 <span class="stringliteral">&quot;pmullw %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* mult. 4 high words of Src and Kernel */</span> <a name="l06732"></a>06732 <span class="stringliteral">&quot;paddsw %%mm2, %%mm1 \n\t&quot;</span> <span class="comment">/* add 4 words of the high and low bytes */</span> <a name="l06733"></a>06733 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06734"></a>06734 <span class="stringliteral">&quot;movq (%%esi), %%mm1 \n\t&quot;</span> <span class="comment">/* load 8 bytes of the Src */</span> <a name="l06735"></a>06735 <span class="stringliteral">&quot;movq (%%edx), %%mm3 \n\t&quot;</span> <span class="comment">/* load 4 words of Kernel */</span> <a name="l06736"></a>06736 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm1 \n\t&quot;</span> <span class="comment">/* unpack first 4 bytes into words */</span> <a name="l06737"></a>06737 <span class="stringliteral">&quot;psrlw %%mm5, %%mm1 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l06738"></a>06738 <span class="stringliteral">&quot;pmullw %%mm3, %%mm1 \n\t&quot;</span> <span class="comment">/* mult. 4 low words of Src and Kernel */</span> <a name="l06739"></a>06739 <span class="stringliteral">&quot;paddsw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* add MM1 to accumulator MM7 */</span> <a name="l06740"></a>06740 <span class="comment">/* --- */</span> <a name="l06741"></a>06741 <span class="stringliteral">&quot;movq %%mm7, %%mm3 \n\t&quot;</span> <span class="comment">/* copy MM7 into MM3 */</span> <a name="l06742"></a>06742 <span class="stringliteral">&quot;psrlq $32, %%mm7 \n\t&quot;</span> <span class="comment">/* shift 2 left words to the right */</span> <a name="l06743"></a>06743 <span class="stringliteral">&quot;paddsw %%mm3, %%mm7 \n\t&quot;</span> <span class="comment">/* add 2 left and 2 right result words */</span> <a name="l06744"></a>06744 <span class="stringliteral">&quot;movq %%mm7, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM7 into MM2 */</span> <a name="l06745"></a>06745 <span class="stringliteral">&quot;psrlq $16, %%mm7 \n\t&quot;</span> <span class="comment">/* shift 1 left word to the right */</span> <a name="l06746"></a>06746 <span class="stringliteral">&quot;paddsw %%mm2, %%mm7 \n\t&quot;</span> <span class="comment">/* add 1 left and 1 right result words */</span> <a name="l06747"></a>06747 <span class="stringliteral">&quot;movd %%eax, %%mm1 \n\t&quot;</span> <span class="comment">/* save EAX in MM1 */</span> <a name="l06748"></a>06748 <span class="stringliteral">&quot;packuswb %%mm0, %%mm7 \n\t&quot;</span> <span class="comment">/* pack division result with saturation */</span> <a name="l06749"></a>06749 <span class="stringliteral">&quot;movd %%mm7, %%eax \n\t&quot;</span> <span class="comment">/* copy saturated result into EAX */</span> <a name="l06750"></a>06750 <span class="stringliteral">&quot;mov %%al, (%%edi) \n\t&quot;</span> <span class="comment">/* copy a byte result into Dest */</span> <a name="l06751"></a>06751 <span class="stringliteral">&quot;movd %%mm1, %%eax \n\t&quot;</span> <span class="comment">/* restore saved EAX */</span> <a name="l06752"></a>06752 <span class="comment">/* -- */</span> <a name="l06753"></a>06753 <span class="stringliteral">&quot;movd %%mm6, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer to the top pixel */</span> <a name="l06754"></a>06754 <span class="stringliteral">&quot;sub $208, %%edx \n\t&quot;</span> <span class="comment">/* EDX = Kernel address */</span> <a name="l06755"></a>06755 <span class="stringliteral">&quot;inc %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer to the next pixel */</span> <a name="l06756"></a>06756 <span class="stringliteral">&quot;inc %%edi \n\t&quot;</span> <span class="comment">/* move Dest pointer to the next pixel */</span> <a name="l06757"></a>06757 <span class="comment">/* --- */</span> <a name="l06758"></a>06758 <span class="stringliteral">&quot;dec %%ecx \n\t&quot;</span> <span class="comment">/* decrease loop counter COLUMNS */</span> <a name="l06759"></a>06759 <span class="stringliteral">&quot;jnz .L10392 \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l06760"></a>06760 <span class="stringliteral">&quot;add $8, %%esi \n\t&quot;</span> <span class="comment">/* move to the next row in Src */</span> <a name="l06761"></a>06761 <span class="stringliteral">&quot;add $8, %%edi \n\t&quot;</span> <span class="comment">/* move to the next row in Dest */</span> <a name="l06762"></a>06762 <span class="stringliteral">&quot;dec %%ebx \n\t&quot;</span> <span class="comment">/* decrease loop counter ROWS */</span> <a name="l06763"></a>06763 <span class="stringliteral">&quot;jnz .L10390 \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l06764"></a>06764 <span class="comment">/* --- */</span> <a name="l06765"></a>06765 <span class="stringliteral">&quot;emms \n\t&quot;</span> <span class="comment">/* exit MMX state */</span> <a name="l06766"></a>06766 <span class="stringliteral">&quot;popa \n\t&quot;</span>:<span class="stringliteral">&quot;=m&quot;</span> (Dest) <span class="comment">/* %0 */</span> <a name="l06767"></a>06767 :<span class="stringliteral">&quot;m&quot;</span>(Src), <span class="comment">/* %1 */</span> <a name="l06768"></a>06768 <span class="stringliteral">&quot;m&quot;</span>(rows), <span class="comment">/* %2 */</span> <a name="l06769"></a>06769 <span class="stringliteral">&quot;m&quot;</span>(columns), <span class="comment">/* %3 */</span> <a name="l06770"></a>06770 <span class="stringliteral">&quot;m&quot;</span>(Kernel), <span class="comment">/* %4 */</span> <a name="l06771"></a>06771 <span class="stringliteral">&quot;m&quot;</span>(NRightShift) <span class="comment">/* %5 */</span> <a name="l06772"></a>06772 ); <a name="l06773"></a>06773 <span class="preprocessor">#endif</span> <a name="l06774"></a>06774 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l06775"></a>06775 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l06776"></a>06776 } <span class="keywordflow">else</span> { <a name="l06777"></a>06777 <span class="comment">/* No non-MMX implementation yet */</span> <a name="l06778"></a>06778 <span class="keywordflow">return</span> (-1); <a name="l06779"></a>06779 } <a name="l06780"></a>06780 } <a name="l06781"></a>06781 <a name="l06782"></a>06782 <span class="comment">/* ------------------------------------------------------------------------------------ */</span> <a name="l06783"></a>06783 <a name="l06796"></a><a class="code" href="_s_d_l__image_filter_8h.html#a2a0e4e259150abbe33bcddb046c367ba">06796</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a015fe05161b701162d9ecffb01413f1e" title="Filter using SobelX: Dij = saturation255( ... )">SDL_imageFilterSobelX</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">int</span> rows, <span class="keywordtype">int</span> columns) <a name="l06797"></a>06797 { <a name="l06798"></a>06798 <span class="comment">/* Validate input parameters */</span> <a name="l06799"></a>06799 <span class="keywordflow">if</span> ((Src == NULL) || (Dest == NULL)) <a name="l06800"></a>06800 <span class="keywordflow">return</span>(-1); <a name="l06801"></a>06801 <a name="l06802"></a>06802 <span class="keywordflow">if</span> ((columns &lt; 8) || (rows &lt; 3)) <a name="l06803"></a>06803 <span class="keywordflow">return</span> (-1); <a name="l06804"></a>06804 <a name="l06805"></a>06805 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>())) { <a name="l06806"></a>06806 <span class="comment">//#ifdef USE_MMX</span> <a name="l06807"></a>06807 <span class="preprocessor">#if defined(USE_MMX) &amp;&amp; defined(i386)</span> <a name="l06808"></a>06808 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l06809"></a>06809 <span class="preprocessor"></span> __asm <a name="l06810"></a>06810 { <a name="l06811"></a>06811 pusha <a name="l06812"></a>06812 pxor mm0, mm0 <span class="comment">/* zero MM0 */</span> <a name="l06813"></a>06813 mov eax, columns <span class="comment">/* load columns into EAX */</span> <a name="l06814"></a>06814 <span class="comment">/* ---, */</span> <a name="l06815"></a>06815 mov esi, Src <span class="comment">/* ESI = Src row 0 address */</span> <a name="l06816"></a>06816 mov edi, Dest <span class="comment">/* load Dest address to EDI */</span> <a name="l06817"></a>06817 add edi, eax <span class="comment">/* EDI = EDI + columns */</span> <a name="l06818"></a>06818 inc edi <span class="comment">/* 1 byte offset from the left edge */</span> <a name="l06819"></a>06819 mov edx, rows <span class="comment">/* initialize ROWS counter */</span> <a name="l06820"></a>06820 sub edx, 2 <span class="comment">/* do not use first and last rows */</span> <a name="l06821"></a>06821 <span class="comment">/* ---, */</span> <a name="l06822"></a>06822 L10400: <a name="l06823"></a>06823 mov ecx, eax <span class="comment">/* initialize COLUMS counter */</span> <a name="l06824"></a>06824 shr ecx, 3 <span class="comment">/* EBX/8 (MMX loads 8 bytes at a time) */</span> <a name="l06825"></a>06825 mov ebx, esi <span class="comment">/* save ESI in EBX */</span> <a name="l06826"></a>06826 movd mm1, edi <span class="comment">/* save EDI in MM1 */</span> <a name="l06827"></a>06827 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l06828"></a>06828 L10402: <a name="l06829"></a>06829 <span class="comment">/* ---, */</span> <a name="l06830"></a>06830 movq mm4, [esi] <span class="comment">/* load 8 bytes from Src */</span> <a name="l06831"></a>06831 movq mm5, mm4 <span class="comment">/* save MM4 in MM5 */</span> <a name="l06832"></a>06832 add esi, 2 <span class="comment">/* move ESI pointer 2 bytes right */</span> <a name="l06833"></a>06833 punpcklbw mm4, mm0 <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l06834"></a>06834 punpckhbw mm5, mm0 <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l06835"></a>06835 movq mm6, [esi] <span class="comment">/* load 8 bytes from Src */</span> <a name="l06836"></a>06836 movq mm7, mm6 <span class="comment">/* save MM6 in MM7 */</span> <a name="l06837"></a>06837 sub esi, 2 <span class="comment">/* move ESI pointer back 2 bytes left */</span> <a name="l06838"></a>06838 punpcklbw mm6, mm0 <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l06839"></a>06839 punpckhbw mm7, mm0 <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l06840"></a>06840 add esi, eax <span class="comment">/* move to the next row of Src */</span> <a name="l06841"></a>06841 movq mm2, [esi] <span class="comment">/* load 8 bytes from Src */</span> <a name="l06842"></a>06842 movq mm3, mm2 <span class="comment">/* save MM2 in MM3 */</span> <a name="l06843"></a>06843 add esi, 2 <span class="comment">/* move ESI pointer 2 bytes right */</span> <a name="l06844"></a>06844 punpcklbw mm2, mm0 <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l06845"></a>06845 punpckhbw mm3, mm0 <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l06846"></a>06846 paddw mm4, mm2 <span class="comment">/* add 4 low bytes to accumolator MM4 */</span> <a name="l06847"></a>06847 paddw mm5, mm3 <span class="comment">/* add 4 high bytes to accumolator MM5 */</span> <a name="l06848"></a>06848 paddw mm4, mm2 <span class="comment">/* add 4 low bytes to accumolator MM4 */</span> <a name="l06849"></a>06849 paddw mm5, mm3 <span class="comment">/* add 4 high bytes to accumolator MM5 */</span> <a name="l06850"></a>06850 movq mm2, [esi] <span class="comment">/* load 8 bytes from Src */</span> <a name="l06851"></a>06851 movq mm3, mm2 <span class="comment">/* save MM2 in MM3 */</span> <a name="l06852"></a>06852 sub esi, 2 <span class="comment">/* move ESI pointer back 2 bytes left */</span> <a name="l06853"></a>06853 punpcklbw mm2, mm0 <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l06854"></a>06854 punpckhbw mm3, mm0 <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l06855"></a>06855 paddw mm6, mm2 <span class="comment">/* add 4 low bytes to accumolator MM6 */</span> <a name="l06856"></a>06856 paddw mm7, mm3 <span class="comment">/* add 4 high bytes to accumolator MM7 */</span> <a name="l06857"></a>06857 paddw mm6, mm2 <span class="comment">/* add 4 low bytes to accumolator MM6 */</span> <a name="l06858"></a>06858 paddw mm7, mm3 <span class="comment">/* add 4 high bytes to accumolator MM7 */</span> <a name="l06859"></a>06859 add esi, eax <span class="comment">/* move to the next row of Src */</span> <a name="l06860"></a>06860 movq mm2, [esi] <span class="comment">/* load 8 bytes from Src */</span> <a name="l06861"></a>06861 movq mm3, mm2 <span class="comment">/* save MM2 in MM3 */</span> <a name="l06862"></a>06862 add esi, 2 <span class="comment">/* move ESI pointer 2 bytes right */</span> <a name="l06863"></a>06863 punpcklbw mm2, mm0 <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l06864"></a>06864 punpckhbw mm3, mm0 <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l06865"></a>06865 paddw mm4, mm2 <span class="comment">/* add 4 low bytes to accumolator MM4 */</span> <a name="l06866"></a>06866 paddw mm5, mm3 <span class="comment">/* add 4 high bytes to accumolator MM5 */</span> <a name="l06867"></a>06867 movq mm2, [esi] <span class="comment">/* load 8 bytes from Src */</span> <a name="l06868"></a>06868 movq mm3, mm2 <span class="comment">/* save MM2 in MM3 */</span> <a name="l06869"></a>06869 sub esi, 2 <span class="comment">/* move ESI pointer back 2 bytes left */</span> <a name="l06870"></a>06870 punpcklbw mm2, mm0 <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l06871"></a>06871 punpckhbw mm3, mm0 <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l06872"></a>06872 paddw mm6, mm2 <span class="comment">/* add 4 low bytes to accumolator MM6 */</span> <a name="l06873"></a>06873 paddw mm7, mm3 <span class="comment">/* add 4 high bytes to accumolator MM7 */</span> <a name="l06874"></a>06874 <span class="comment">/* ---, */</span> <a name="l06875"></a>06875 movq mm2, mm4 <span class="comment">/* copy MM4 into MM2 */</span> <a name="l06876"></a>06876 psrlq mm4, 32 <span class="comment">/* shift 2 left words to the right */</span> <a name="l06877"></a>06877 psubw mm4, mm2 <span class="comment">/* MM4 = MM4 - MM2 */</span> <a name="l06878"></a>06878 movq mm3, mm6 <span class="comment">/* copy MM6 into MM3 */</span> <a name="l06879"></a>06879 psrlq mm6, 32 <span class="comment">/* shift 2 left words to the right */</span> <a name="l06880"></a>06880 psubw mm6, mm3 <span class="comment">/* MM6 = MM6 - MM3 */</span> <a name="l06881"></a>06881 punpckldq mm4, mm6 <span class="comment">/* combine 2 words of MM6 and 2 words of MM4 */</span> <a name="l06882"></a>06882 movq mm2, mm5 <span class="comment">/* copy MM6 into MM2 */</span> <a name="l06883"></a>06883 psrlq mm5, 32 <span class="comment">/* shift 2 left words to the right */</span> <a name="l06884"></a>06884 psubw mm5, mm2 <span class="comment">/* MM5 = MM5 - MM2 */</span> <a name="l06885"></a>06885 movq mm3, mm7 <span class="comment">/* copy MM7 into MM3 */</span> <a name="l06886"></a>06886 psrlq mm7, 32 <span class="comment">/* shift 2 left words to the right */</span> <a name="l06887"></a>06887 psubw mm7, mm3 <span class="comment">/* MM7 = MM7 - MM3 */</span> <a name="l06888"></a>06888 punpckldq mm5, mm7 <span class="comment">/* combine 2 words of MM7 and 2 words of MM5 */</span> <a name="l06889"></a>06889 <span class="comment">/* Take abs values of MM4 and MM5 */</span> <a name="l06890"></a>06890 movq mm6, mm4 <span class="comment">/* copy MM4 into MM6 */</span> <a name="l06891"></a>06891 movq mm7, mm5 <span class="comment">/* copy MM5 into MM7 */</span> <a name="l06892"></a>06892 psraw mm6, 15 <span class="comment">/* fill MM6 words with word sign bit */</span> <a name="l06893"></a>06893 psraw mm7, 15 <span class="comment">/* fill MM7 words with word sign bit */</span> <a name="l06894"></a>06894 pxor mm4, mm6 <span class="comment">/* take 1&#39;s compliment of only neg words */</span> <a name="l06895"></a>06895 pxor mm5, mm7 <span class="comment">/* take 1&#39;s compliment of only neg words */</span> <a name="l06896"></a>06896 psubsw mm4, mm6 <span class="comment">/* add 1 to only neg words, W-(-1) or W-0 */</span> <a name="l06897"></a>06897 psubsw mm5, mm7 <span class="comment">/* add 1 to only neg words, W-(-1) or W-0 */</span> <a name="l06898"></a>06898 packuswb mm4, mm5 <span class="comment">/* combine and pack/saturate MM5 and MM4 */</span> <a name="l06899"></a>06899 movq [edi], mm4 <span class="comment">/* store result in Dest */</span> <a name="l06900"></a>06900 <span class="comment">/* ---, */</span> <a name="l06901"></a>06901 sub esi, eax <span class="comment">/* move to the current top row in Src */</span> <a name="l06902"></a>06902 sub esi, eax <a name="l06903"></a>06903 add esi, 8 <span class="comment">/* move Src pointer to the next 8 pixels */</span> <a name="l06904"></a>06904 add edi, 8 <span class="comment">/* move Dest pointer to the next 8 pixels */</span> <a name="l06905"></a>06905 <span class="comment">/* ---, */</span> <a name="l06906"></a>06906 dec ecx <span class="comment">/* decrease loop counter COLUMNS */</span> <a name="l06907"></a>06907 jnz L10402 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l06908"></a>06908 mov esi, ebx <span class="comment">/* restore most left current row Src address */</span> <a name="l06909"></a>06909 movd edi, mm1 <span class="comment">/* restore most left current row Dest address */</span> <a name="l06910"></a>06910 add esi, eax <span class="comment">/* move to the next row in Src */</span> <a name="l06911"></a>06911 add edi, eax <span class="comment">/* move to the next row in Dest */</span> <a name="l06912"></a>06912 dec edx <span class="comment">/* decrease loop counter ROWS */</span> <a name="l06913"></a>06913 jnz L10400 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l06914"></a>06914 <span class="comment">/* ---, */</span> <a name="l06915"></a>06915 emms <span class="comment">/* exit MMX state */</span> <a name="l06916"></a>06916 popa <a name="l06917"></a>06917 } <a name="l06918"></a>06918 <span class="preprocessor">#else</span> <a name="l06919"></a>06919 <span class="preprocessor"></span> <span class="keyword">asm</span> <span class="keyword">volatile</span> <a name="l06920"></a>06920 (<span class="stringliteral">&quot;pusha \n\t&quot;</span> <span class="stringliteral">&quot;pxor %%mm0, %%mm0 \n\t&quot;</span> <span class="comment">/* zero MM0 */</span> <a name="l06921"></a>06921 <span class="stringliteral">&quot;mov %3, %%eax \n\t&quot;</span> <span class="comment">/* load columns into EAX */</span> <a name="l06922"></a>06922 <span class="comment">/* --- */</span> <a name="l06923"></a>06923 <span class="stringliteral">&quot;mov %1, %%esi \n\t&quot;</span> <span class="comment">/* ESI = Src row 0 address */</span> <a name="l06924"></a>06924 <span class="stringliteral">&quot;mov %0, %%edi \n\t&quot;</span> <span class="comment">/* load Dest address to EDI */</span> <a name="l06925"></a>06925 <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="comment">/* EDI = EDI + columns */</span> <a name="l06926"></a>06926 <span class="stringliteral">&quot;inc %%edi \n\t&quot;</span> <span class="comment">/* 1 byte offset from the left edge */</span> <a name="l06927"></a>06927 <span class="stringliteral">&quot;mov %2, %%edx \n\t&quot;</span> <span class="comment">/* initialize ROWS counter */</span> <a name="l06928"></a>06928 <span class="stringliteral">&quot;sub $2, %%edx \n\t&quot;</span> <span class="comment">/* do not use first and last rows */</span> <a name="l06929"></a>06929 <span class="comment">/* --- */</span> <a name="l06930"></a>06930 <span class="stringliteral">&quot;.L10400: \n\t&quot;</span> <span class="stringliteral">&quot;mov %%eax, %%ecx \n\t&quot;</span> <span class="comment">/* initialize COLUMS counter */</span> <a name="l06931"></a>06931 <span class="stringliteral">&quot;shr $3, %%ecx \n\t&quot;</span> <span class="comment">/* EBX/8 (MMX loads 8 bytes at a time) */</span> <a name="l06932"></a>06932 <span class="stringliteral">&quot;mov %%esi, %%ebx \n\t&quot;</span> <span class="comment">/* save ESI in EBX */</span> <a name="l06933"></a>06933 <span class="stringliteral">&quot;movd %%edi, %%mm1 \n\t&quot;</span> <span class="comment">/* save EDI in MM1 */</span> <a name="l06934"></a>06934 <span class="stringliteral">&quot;.align 16 \n\t&quot;</span> <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l06935"></a>06935 <span class="stringliteral">&quot;.L10402: \n\t&quot;</span> <a name="l06936"></a>06936 <span class="comment">/* --- */</span> <a name="l06937"></a>06937 <span class="stringliteral">&quot;movq (%%esi), %%mm4 \n\t&quot;</span> <span class="comment">/* load 8 bytes from Src */</span> <a name="l06938"></a>06938 <span class="stringliteral">&quot;movq %%mm4, %%mm5 \n\t&quot;</span> <span class="comment">/* save MM4 in MM5 */</span> <a name="l06939"></a>06939 <span class="stringliteral">&quot;add $2, %%esi \n\t&quot;</span> <span class="comment">/* move ESI pointer 2 bytes right */</span> <a name="l06940"></a>06940 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm4 \n\t&quot;</span> <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l06941"></a>06941 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm5 \n\t&quot;</span> <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l06942"></a>06942 <span class="stringliteral">&quot;movq (%%esi), %%mm6 \n\t&quot;</span> <span class="comment">/* load 8 bytes from Src */</span> <a name="l06943"></a>06943 <span class="stringliteral">&quot;movq %%mm6, %%mm7 \n\t&quot;</span> <span class="comment">/* save MM6 in MM7 */</span> <a name="l06944"></a>06944 <span class="stringliteral">&quot;sub $2, %%esi \n\t&quot;</span> <span class="comment">/* move ESI pointer back 2 bytes left */</span> <a name="l06945"></a>06945 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm6 \n\t&quot;</span> <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l06946"></a>06946 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm7 \n\t&quot;</span> <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l06947"></a>06947 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move to the next row of Src */</span> <a name="l06948"></a>06948 <span class="stringliteral">&quot;movq (%%esi), %%mm2 \n\t&quot;</span> <span class="comment">/* load 8 bytes from Src */</span> <a name="l06949"></a>06949 <span class="stringliteral">&quot;movq %%mm2, %%mm3 \n\t&quot;</span> <span class="comment">/* save MM2 in MM3 */</span> <a name="l06950"></a>06950 <span class="stringliteral">&quot;add $2, %%esi \n\t&quot;</span> <span class="comment">/* move ESI pointer 2 bytes right */</span> <a name="l06951"></a>06951 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l06952"></a>06952 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm3 \n\t&quot;</span> <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l06953"></a>06953 <span class="stringliteral">&quot;paddw %%mm2, %%mm4 \n\t&quot;</span> <span class="comment">/* add 4 low bytes to accumolator MM4 */</span> <a name="l06954"></a>06954 <span class="stringliteral">&quot;paddw %%mm3, %%mm5 \n\t&quot;</span> <span class="comment">/* add 4 high bytes to accumolator MM5 */</span> <a name="l06955"></a>06955 <span class="stringliteral">&quot;paddw %%mm2, %%mm4 \n\t&quot;</span> <span class="comment">/* add 4 low bytes to accumolator MM4 */</span> <a name="l06956"></a>06956 <span class="stringliteral">&quot;paddw %%mm3, %%mm5 \n\t&quot;</span> <span class="comment">/* add 4 high bytes to accumolator MM5 */</span> <a name="l06957"></a>06957 <span class="stringliteral">&quot;movq (%%esi), %%mm2 \n\t&quot;</span> <span class="comment">/* load 8 bytes from Src */</span> <a name="l06958"></a>06958 <span class="stringliteral">&quot;movq %%mm2, %%mm3 \n\t&quot;</span> <span class="comment">/* save MM2 in MM3 */</span> <a name="l06959"></a>06959 <span class="stringliteral">&quot;sub $2, %%esi \n\t&quot;</span> <span class="comment">/* move ESI pointer back 2 bytes left */</span> <a name="l06960"></a>06960 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l06961"></a>06961 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm3 \n\t&quot;</span> <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l06962"></a>06962 <span class="stringliteral">&quot;paddw %%mm2, %%mm6 \n\t&quot;</span> <span class="comment">/* add 4 low bytes to accumolator MM6 */</span> <a name="l06963"></a>06963 <span class="stringliteral">&quot;paddw %%mm3, %%mm7 \n\t&quot;</span> <span class="comment">/* add 4 high bytes to accumolator MM7 */</span> <a name="l06964"></a>06964 <span class="stringliteral">&quot;paddw %%mm2, %%mm6 \n\t&quot;</span> <span class="comment">/* add 4 low bytes to accumolator MM6 */</span> <a name="l06965"></a>06965 <span class="stringliteral">&quot;paddw %%mm3, %%mm7 \n\t&quot;</span> <span class="comment">/* add 4 high bytes to accumolator MM7 */</span> <a name="l06966"></a>06966 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move to the next row of Src */</span> <a name="l06967"></a>06967 <span class="stringliteral">&quot;movq (%%esi), %%mm2 \n\t&quot;</span> <span class="comment">/* load 8 bytes from Src */</span> <a name="l06968"></a>06968 <span class="stringliteral">&quot;movq %%mm2, %%mm3 \n\t&quot;</span> <span class="comment">/* save MM2 in MM3 */</span> <a name="l06969"></a>06969 <span class="stringliteral">&quot;add $2, %%esi \n\t&quot;</span> <span class="comment">/* move ESI pointer 2 bytes right */</span> <a name="l06970"></a>06970 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l06971"></a>06971 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm3 \n\t&quot;</span> <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l06972"></a>06972 <span class="stringliteral">&quot;paddw %%mm2, %%mm4 \n\t&quot;</span> <span class="comment">/* add 4 low bytes to accumolator MM4 */</span> <a name="l06973"></a>06973 <span class="stringliteral">&quot;paddw %%mm3, %%mm5 \n\t&quot;</span> <span class="comment">/* add 4 high bytes to accumolator MM5 */</span> <a name="l06974"></a>06974 <span class="stringliteral">&quot;movq (%%esi), %%mm2 \n\t&quot;</span> <span class="comment">/* load 8 bytes from Src */</span> <a name="l06975"></a>06975 <span class="stringliteral">&quot;movq %%mm2, %%mm3 \n\t&quot;</span> <span class="comment">/* save MM2 in MM3 */</span> <a name="l06976"></a>06976 <span class="stringliteral">&quot;sub $2, %%esi \n\t&quot;</span> <span class="comment">/* move ESI pointer back 2 bytes left */</span> <a name="l06977"></a>06977 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l06978"></a>06978 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm3 \n\t&quot;</span> <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l06979"></a>06979 <span class="stringliteral">&quot;paddw %%mm2, %%mm6 \n\t&quot;</span> <span class="comment">/* add 4 low bytes to accumolator MM6 */</span> <a name="l06980"></a>06980 <span class="stringliteral">&quot;paddw %%mm3, %%mm7 \n\t&quot;</span> <span class="comment">/* add 4 high bytes to accumolator MM7 */</span> <a name="l06981"></a>06981 <span class="comment">/* --- */</span> <a name="l06982"></a>06982 <span class="stringliteral">&quot;movq %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM4 into MM2 */</span> <a name="l06983"></a>06983 <span class="stringliteral">&quot;psrlq $32, %%mm4 \n\t&quot;</span> <span class="comment">/* shift 2 left words to the right */</span> <a name="l06984"></a>06984 <span class="stringliteral">&quot;psubw %%mm2, %%mm4 \n\t&quot;</span> <span class="comment">/* MM4 = MM4 - MM2 */</span> <a name="l06985"></a>06985 <span class="stringliteral">&quot;movq %%mm6, %%mm3 \n\t&quot;</span> <span class="comment">/* copy MM6 into MM3 */</span> <a name="l06986"></a>06986 <span class="stringliteral">&quot;psrlq $32, %%mm6 \n\t&quot;</span> <span class="comment">/* shift 2 left words to the right */</span> <a name="l06987"></a>06987 <span class="stringliteral">&quot;psubw %%mm3, %%mm6 \n\t&quot;</span> <span class="comment">/* MM6 = MM6 - MM3 */</span> <a name="l06988"></a>06988 <span class="stringliteral">&quot;punpckldq %%mm6, %%mm4 \n\t&quot;</span> <span class="comment">/* combine 2 words of MM6 and 2 words of MM4 */</span> <a name="l06989"></a>06989 <span class="stringliteral">&quot;movq %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM6 into MM2 */</span> <a name="l06990"></a>06990 <span class="stringliteral">&quot;psrlq $32, %%mm5 \n\t&quot;</span> <span class="comment">/* shift 2 left words to the right */</span> <a name="l06991"></a>06991 <span class="stringliteral">&quot;psubw %%mm2, %%mm5 \n\t&quot;</span> <span class="comment">/* MM5 = MM5 - MM2 */</span> <a name="l06992"></a>06992 <span class="stringliteral">&quot;movq %%mm7, %%mm3 \n\t&quot;</span> <span class="comment">/* copy MM7 into MM3 */</span> <a name="l06993"></a>06993 <span class="stringliteral">&quot;psrlq $32, %%mm7 \n\t&quot;</span> <span class="comment">/* shift 2 left words to the right */</span> <a name="l06994"></a>06994 <span class="stringliteral">&quot;psubw %%mm3, %%mm7 \n\t&quot;</span> <span class="comment">/* MM7 = MM7 - MM3 */</span> <a name="l06995"></a>06995 <span class="stringliteral">&quot;punpckldq %%mm7, %%mm5 \n\t&quot;</span> <span class="comment">/* combine 2 words of MM7 and 2 words of MM5 */</span> <a name="l06996"></a>06996 <span class="comment">/* Take abs values of MM4 and MM5 */</span> <a name="l06997"></a>06997 <span class="stringliteral">&quot;movq %%mm4, %%mm6 \n\t&quot;</span> <span class="comment">/* copy MM4 into MM6 */</span> <a name="l06998"></a>06998 <span class="stringliteral">&quot;movq %%mm5, %%mm7 \n\t&quot;</span> <span class="comment">/* copy MM5 into MM7 */</span> <a name="l06999"></a>06999 <span class="stringliteral">&quot;psraw $15, %%mm6 \n\t&quot;</span> <span class="comment">/* fill MM6 words with word sign bit */</span> <a name="l07000"></a>07000 <span class="stringliteral">&quot;psraw $15, %%mm7 \n\t&quot;</span> <span class="comment">/* fill MM7 words with word sign bit */</span> <a name="l07001"></a>07001 <span class="stringliteral">&quot;pxor %%mm6, %%mm4 \n\t&quot;</span> <span class="comment">/* take 1&#39;s compliment of only neg. words */</span> <a name="l07002"></a>07002 <span class="stringliteral">&quot;pxor %%mm7, %%mm5 \n\t&quot;</span> <span class="comment">/* take 1&#39;s compliment of only neg. words */</span> <a name="l07003"></a>07003 <span class="stringliteral">&quot;psubsw %%mm6, %%mm4 \n\t&quot;</span> <span class="comment">/* add 1 to only neg. words, W-(-1) or W-0 */</span> <a name="l07004"></a>07004 <span class="stringliteral">&quot;psubsw %%mm7, %%mm5 \n\t&quot;</span> <span class="comment">/* add 1 to only neg. words, W-(-1) or W-0 */</span> <a name="l07005"></a>07005 <span class="stringliteral">&quot;packuswb %%mm5, %%mm4 \n\t&quot;</span> <span class="comment">/* combine and pack/saturate MM5 and MM4 */</span> <a name="l07006"></a>07006 <span class="stringliteral">&quot;movq %%mm4, (%%edi) \n\t&quot;</span> <span class="comment">/* store result in Dest */</span> <a name="l07007"></a>07007 <span class="comment">/* --- */</span> <a name="l07008"></a>07008 <span class="stringliteral">&quot;sub %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move to the current top row in Src */</span> <a name="l07009"></a>07009 <span class="stringliteral">&quot;sub %%eax, %%esi \n\t&quot;</span> <span class="stringliteral">&quot;add $8, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer to the next 8 pixels */</span> <a name="l07010"></a>07010 <span class="stringliteral">&quot;add $8, %%edi \n\t&quot;</span> <span class="comment">/* move Dest pointer to the next 8 pixels */</span> <a name="l07011"></a>07011 <span class="comment">/* --- */</span> <a name="l07012"></a>07012 <span class="stringliteral">&quot;dec %%ecx \n\t&quot;</span> <span class="comment">/* decrease loop counter COLUMNS */</span> <a name="l07013"></a>07013 <span class="stringliteral">&quot;jnz .L10402 \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l07014"></a>07014 <span class="stringliteral">&quot;mov %%ebx, %%esi \n\t&quot;</span> <span class="comment">/* restore most left current row Src address */</span> <a name="l07015"></a>07015 <span class="stringliteral">&quot;movd %%mm1, %%edi \n\t&quot;</span> <span class="comment">/* restore most left current row Dest address */</span> <a name="l07016"></a>07016 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move to the next row in Src */</span> <a name="l07017"></a>07017 <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="comment">/* move to the next row in Dest */</span> <a name="l07018"></a>07018 <span class="stringliteral">&quot;dec %%edx \n\t&quot;</span> <span class="comment">/* decrease loop counter ROWS */</span> <a name="l07019"></a>07019 <span class="stringliteral">&quot;jnz .L10400 \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l07020"></a>07020 <span class="comment">/* --- */</span> <a name="l07021"></a>07021 <span class="stringliteral">&quot;emms \n\t&quot;</span> <span class="comment">/* exit MMX state */</span> <a name="l07022"></a>07022 <span class="stringliteral">&quot;popa \n\t&quot;</span>:<span class="stringliteral">&quot;=m&quot;</span> (Dest) <span class="comment">/* %0 */</span> <a name="l07023"></a>07023 :<span class="stringliteral">&quot;m&quot;</span>(Src), <span class="comment">/* %1 */</span> <a name="l07024"></a>07024 <span class="stringliteral">&quot;m&quot;</span>(rows), <span class="comment">/* %2 */</span> <a name="l07025"></a>07025 <span class="stringliteral">&quot;m&quot;</span>(columns) <span class="comment">/* %3 */</span> <a name="l07026"></a>07026 ); <a name="l07027"></a>07027 <span class="preprocessor">#endif</span> <a name="l07028"></a>07028 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l07029"></a>07029 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l07030"></a>07030 } <span class="keywordflow">else</span> { <a name="l07031"></a>07031 <span class="comment">/* No non-MMX implementation yet */</span> <a name="l07032"></a>07032 <span class="keywordflow">return</span> (-1); <a name="l07033"></a>07033 } <a name="l07034"></a>07034 } <a name="l07035"></a>07035 <a name="l07049"></a><a class="code" href="_s_d_l__image_filter_8h.html#ab9cc925cd9b135e245936d718b459032">07049</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a0d21af83f0183fcd697324cffe3ab3d7" title="Filter using SobelXShiftRight: Dij = saturation255( ... )">SDL_imageFilterSobelXShiftRight</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">int</span> rows, <span class="keywordtype">int</span> columns, <a name="l07050"></a>07050 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> NRightShift) <a name="l07051"></a>07051 { <a name="l07052"></a>07052 <span class="comment">/* Validate input parameters */</span> <a name="l07053"></a>07053 <span class="keywordflow">if</span> ((Src == NULL) || (Dest == NULL)) <a name="l07054"></a>07054 <span class="keywordflow">return</span>(-1); <a name="l07055"></a>07055 <span class="keywordflow">if</span> ((columns &lt; 8) || (rows &lt; 3) || (NRightShift &gt; 7)) <a name="l07056"></a>07056 <span class="keywordflow">return</span> (-1); <a name="l07057"></a>07057 <a name="l07058"></a>07058 <span class="keywordflow">if</span> ((<a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>())) { <a name="l07059"></a>07059 <span class="comment">//#ifdef USE_MMX</span> <a name="l07060"></a>07060 <span class="preprocessor">#if defined(USE_MMX) &amp;&amp; defined(i386)</span> <a name="l07061"></a>07061 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l07062"></a>07062 <span class="preprocessor"></span> __asm <a name="l07063"></a>07063 { <a name="l07064"></a>07064 pusha <a name="l07065"></a>07065 pxor mm0, mm0 <span class="comment">/* zero MM0 */</span> <a name="l07066"></a>07066 mov eax, columns <span class="comment">/* load columns into EAX */</span> <a name="l07067"></a>07067 xor ebx, ebx <span class="comment">/* zero EBX */</span> <a name="l07068"></a>07068 mov bl, NRightShift <span class="comment">/* load NRightShift into BL */</span> <a name="l07069"></a>07069 movd mm1, ebx <span class="comment">/* copy NRightShift into MM1 */</span> <a name="l07070"></a>07070 <span class="comment">/* ---, */</span> <a name="l07071"></a>07071 mov esi, Src <span class="comment">/* ESI = Src row 0 address */</span> <a name="l07072"></a>07072 mov edi, Dest <span class="comment">/* load Dest address to EDI */</span> <a name="l07073"></a>07073 add edi, eax <span class="comment">/* EDI = EDI + columns */</span> <a name="l07074"></a>07074 inc edi <span class="comment">/* 1 byte offset from the left edge */</span> <a name="l07075"></a>07075 <span class="comment">/* initialize ROWS counter */</span> <a name="l07076"></a>07076 sub rows, 2 <span class="comment">/* do not use first and last rows */</span> <a name="l07077"></a>07077 <span class="comment">/* ---, */</span> <a name="l07078"></a>07078 L10410: <a name="l07079"></a>07079 mov ecx, eax <span class="comment">/* initialize COLUMS counter */</span> <a name="l07080"></a>07080 shr ecx, 3 <span class="comment">/* EBX/8 (MMX loads 8 bytes at a time) */</span> <a name="l07081"></a>07081 mov ebx, esi <span class="comment">/* save ESI in EBX */</span> <a name="l07082"></a>07082 mov edx, edi <span class="comment">/* save EDI in EDX */</span> <a name="l07083"></a>07083 align 16 <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l07084"></a>07084 L10412: <a name="l07085"></a>07085 <span class="comment">/* ---, */</span> <a name="l07086"></a>07086 movq mm4, [esi] <span class="comment">/* load 8 bytes from Src */</span> <a name="l07087"></a>07087 movq mm5, mm4 <span class="comment">/* save MM4 in MM5 */</span> <a name="l07088"></a>07088 add esi, 2 <span class="comment">/* move ESI pointer 2 bytes right */</span> <a name="l07089"></a>07089 punpcklbw mm4, mm0 <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l07090"></a>07090 punpckhbw mm5, mm0 <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l07091"></a>07091 psrlw mm4, mm1 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07092"></a>07092 psrlw mm5, mm1 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07093"></a>07093 movq mm6, [esi] <span class="comment">/* load 8 bytes from Src */</span> <a name="l07094"></a>07094 movq mm7, mm6 <span class="comment">/* save MM6 in MM7 */</span> <a name="l07095"></a>07095 sub esi, 2 <span class="comment">/* move ESI pointer back 2 bytes left */</span> <a name="l07096"></a>07096 punpcklbw mm6, mm0 <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l07097"></a>07097 punpckhbw mm7, mm0 <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l07098"></a>07098 psrlw mm6, mm1 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07099"></a>07099 psrlw mm7, mm1 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07100"></a>07100 add esi, eax <span class="comment">/* move to the next row of Src */</span> <a name="l07101"></a>07101 movq mm2, [esi] <span class="comment">/* load 8 bytes from Src */</span> <a name="l07102"></a>07102 movq mm3, mm2 <span class="comment">/* save MM2 in MM3 */</span> <a name="l07103"></a>07103 add esi, 2 <span class="comment">/* move ESI pointer 2 bytes right */</span> <a name="l07104"></a>07104 punpcklbw mm2, mm0 <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l07105"></a>07105 punpckhbw mm3, mm0 <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l07106"></a>07106 psrlw mm2, mm1 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07107"></a>07107 psrlw mm3, mm1 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07108"></a>07108 paddw mm4, mm2 <span class="comment">/* add 4 low bytes to accumolator MM4 */</span> <a name="l07109"></a>07109 paddw mm5, mm3 <span class="comment">/* add 4 high bytes to accumolator MM5 */</span> <a name="l07110"></a>07110 paddw mm4, mm2 <span class="comment">/* add 4 low bytes to accumolator MM4 */</span> <a name="l07111"></a>07111 paddw mm5, mm3 <span class="comment">/* add 4 high bytes to accumolator MM5 */</span> <a name="l07112"></a>07112 movq mm2, [esi] <span class="comment">/* load 8 bytes from Src */</span> <a name="l07113"></a>07113 movq mm3, mm2 <span class="comment">/* save MM2 in MM3 */</span> <a name="l07114"></a>07114 sub esi, 2 <span class="comment">/* move ESI pointer back 2 bytes left */</span> <a name="l07115"></a>07115 punpcklbw mm2, mm0 <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l07116"></a>07116 punpckhbw mm3, mm0 <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l07117"></a>07117 psrlw mm2, mm1 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07118"></a>07118 psrlw mm3, mm1 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07119"></a>07119 paddw mm6, mm2 <span class="comment">/* add 4 low bytes to accumolator MM6 */</span> <a name="l07120"></a>07120 paddw mm7, mm3 <span class="comment">/* add 4 high bytes to accumolator MM7 */</span> <a name="l07121"></a>07121 paddw mm6, mm2 <span class="comment">/* add 4 low bytes to accumolator MM6 */</span> <a name="l07122"></a>07122 paddw mm7, mm3 <span class="comment">/* add 4 high bytes to accumolator MM7 */</span> <a name="l07123"></a>07123 add esi, eax <span class="comment">/* move to the next row of Src */</span> <a name="l07124"></a>07124 movq mm2, [esi] <span class="comment">/* load 8 bytes from Src */</span> <a name="l07125"></a>07125 movq mm3, mm2 <span class="comment">/* save MM2 in MM3 */</span> <a name="l07126"></a>07126 add esi, 2 <span class="comment">/* move ESI pointer 2 bytes right */</span> <a name="l07127"></a>07127 punpcklbw mm2, mm0 <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l07128"></a>07128 punpckhbw mm3, mm0 <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l07129"></a>07129 psrlw mm2, mm1 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07130"></a>07130 psrlw mm3, mm1 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07131"></a>07131 paddw mm4, mm2 <span class="comment">/* add 4 low bytes to accumolator MM4 */</span> <a name="l07132"></a>07132 paddw mm5, mm3 <span class="comment">/* add 4 high bytes to accumolator MM5 */</span> <a name="l07133"></a>07133 movq mm2, [esi] <span class="comment">/* load 8 bytes from Src */</span> <a name="l07134"></a>07134 movq mm3, mm2 <span class="comment">/* save MM2 in MM3 */</span> <a name="l07135"></a>07135 sub esi, 2 <span class="comment">/* move ESI pointer back 2 bytes left */</span> <a name="l07136"></a>07136 punpcklbw mm2, mm0 <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l07137"></a>07137 punpckhbw mm3, mm0 <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l07138"></a>07138 psrlw mm2, mm1 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07139"></a>07139 psrlw mm3, mm1 <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07140"></a>07140 paddw mm6, mm2 <span class="comment">/* add 4 low bytes to accumolator MM6 */</span> <a name="l07141"></a>07141 paddw mm7, mm3 <span class="comment">/* add 4 high bytes to accumolator MM7 */</span> <a name="l07142"></a>07142 <span class="comment">/* ---, */</span> <a name="l07143"></a>07143 movq mm2, mm4 <span class="comment">/* copy MM4 into MM2 */</span> <a name="l07144"></a>07144 psrlq mm4, 32 <span class="comment">/* shift 2 left words to the right */</span> <a name="l07145"></a>07145 psubw mm4, mm2 <span class="comment">/* MM4 = MM4 - MM2 */</span> <a name="l07146"></a>07146 movq mm3, mm6 <span class="comment">/* copy MM6 into MM3 */</span> <a name="l07147"></a>07147 psrlq mm6, 32 <span class="comment">/* shift 2 left words to the right */</span> <a name="l07148"></a>07148 psubw mm6, mm3 <span class="comment">/* MM6 = MM6 - MM3 */</span> <a name="l07149"></a>07149 punpckldq mm4, mm6 <span class="comment">/* combine 2 words of MM6 and 2 words of MM4 */</span> <a name="l07150"></a>07150 movq mm2, mm5 <span class="comment">/* copy MM6 into MM2 */</span> <a name="l07151"></a>07151 psrlq mm5, 32 <span class="comment">/* shift 2 left words to the right */</span> <a name="l07152"></a>07152 psubw mm5, mm2 <span class="comment">/* MM5 = MM5 - MM2 */</span> <a name="l07153"></a>07153 movq mm3, mm7 <span class="comment">/* copy MM7 into MM3 */</span> <a name="l07154"></a>07154 psrlq mm7, 32 <span class="comment">/* shift 2 left words to the right */</span> <a name="l07155"></a>07155 psubw mm7, mm3 <span class="comment">/* MM7 = MM7 - MM3 */</span> <a name="l07156"></a>07156 punpckldq mm5, mm7 <span class="comment">/* combine 2 words of MM7 and 2 words of MM5 */</span> <a name="l07157"></a>07157 <span class="comment">/* Take abs values of MM4 and MM5 */</span> <a name="l07158"></a>07158 movq mm6, mm4 <span class="comment">/* copy MM4 into MM6 */</span> <a name="l07159"></a>07159 movq mm7, mm5 <span class="comment">/* copy MM5 into MM7 */</span> <a name="l07160"></a>07160 psraw mm6, 15 <span class="comment">/* fill MM6 words with word sign bit */</span> <a name="l07161"></a>07161 psraw mm7, 15 <span class="comment">/* fill MM7 words with word sign bit */</span> <a name="l07162"></a>07162 pxor mm4, mm6 <span class="comment">/* take 1&#39;s compliment of only neg words */</span> <a name="l07163"></a>07163 pxor mm5, mm7 <span class="comment">/* take 1&#39;s compliment of only neg words */</span> <a name="l07164"></a>07164 psubsw mm4, mm6 <span class="comment">/* add 1 to only neg words, W-(-1) or W-0 */</span> <a name="l07165"></a>07165 psubsw mm5, mm7 <span class="comment">/* add 1 to only neg words, W-(-1) or W-0 */</span> <a name="l07166"></a>07166 packuswb mm4, mm5 <span class="comment">/* combine and pack/saturate MM5 and MM4 */</span> <a name="l07167"></a>07167 movq [edi], mm4 <span class="comment">/* store result in Dest */</span> <a name="l07168"></a>07168 <span class="comment">/* ---, */</span> <a name="l07169"></a>07169 sub esi, eax <span class="comment">/* move to the current top row in Src */</span> <a name="l07170"></a>07170 sub esi, eax <a name="l07171"></a>07171 add esi, 8 <span class="comment">/* move Src pointer to the next 8 pixels */</span> <a name="l07172"></a>07172 add edi, 8 <span class="comment">/* move Dest pointer to the next 8 pixels */</span> <a name="l07173"></a>07173 <span class="comment">/* ---, */</span> <a name="l07174"></a>07174 dec ecx <span class="comment">/* decrease loop counter COLUMNS */</span> <a name="l07175"></a>07175 jnz L10412 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l07176"></a>07176 mov esi, ebx <span class="comment">/* restore most left current row Src address */</span> <a name="l07177"></a>07177 mov edi, edx <span class="comment">/* restore most left current row Dest address */</span> <a name="l07178"></a>07178 add esi, eax <span class="comment">/* move to the next row in Src */</span> <a name="l07179"></a>07179 add edi, eax <span class="comment">/* move to the next row in Dest */</span> <a name="l07180"></a>07180 dec rows <span class="comment">/* decrease loop counter ROWS */</span> <a name="l07181"></a>07181 jnz L10410 <span class="comment">/* check loop termination, proceed if required */</span> <a name="l07182"></a>07182 <span class="comment">/* ---, */</span> <a name="l07183"></a>07183 emms <span class="comment">/* exit MMX state */</span> <a name="l07184"></a>07184 popa <a name="l07185"></a>07185 } <a name="l07186"></a>07186 <span class="preprocessor">#else</span> <a name="l07187"></a>07187 <span class="preprocessor"></span> <span class="keyword">asm</span> <span class="keyword">volatile</span> <a name="l07188"></a>07188 (<span class="stringliteral">&quot;pusha \n\t&quot;</span> <span class="stringliteral">&quot;pxor %%mm0, %%mm0 \n\t&quot;</span> <span class="comment">/* zero MM0 */</span> <a name="l07189"></a>07189 <span class="stringliteral">&quot;mov %3, %%eax \n\t&quot;</span> <span class="comment">/* load columns into EAX */</span> <a name="l07190"></a>07190 <span class="stringliteral">&quot;xor %%ebx, %%ebx \n\t&quot;</span> <span class="comment">/* zero EBX */</span> <a name="l07191"></a>07191 <span class="stringliteral">&quot;mov %4, %%bl \n\t&quot;</span> <span class="comment">/* load NRightShift into BL */</span> <a name="l07192"></a>07192 <span class="stringliteral">&quot;movd %%ebx, %%mm1 \n\t&quot;</span> <span class="comment">/* copy NRightShift into MM1 */</span> <a name="l07193"></a>07193 <span class="comment">/* --- */</span> <a name="l07194"></a>07194 <span class="stringliteral">&quot;mov %1, %%esi \n\t&quot;</span> <span class="comment">/* ESI = Src row 0 address */</span> <a name="l07195"></a>07195 <span class="stringliteral">&quot;mov %0, %%edi \n\t&quot;</span> <span class="comment">/* load Dest address to EDI */</span> <a name="l07196"></a>07196 <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="comment">/* EDI = EDI + columns */</span> <a name="l07197"></a>07197 <span class="stringliteral">&quot;inc %%edi \n\t&quot;</span> <span class="comment">/* 1 byte offset from the left edge */</span> <a name="l07198"></a>07198 <span class="comment">/* initialize ROWS counter */</span> <a name="l07199"></a>07199 <span class="stringliteral">&quot;subl $2, %2 \n\t&quot;</span> <span class="comment">/* do not use first and last rows */</span> <a name="l07200"></a>07200 <span class="comment">/* --- */</span> <a name="l07201"></a>07201 <span class="stringliteral">&quot;.L10410: \n\t&quot;</span> <span class="stringliteral">&quot;mov %%eax, %%ecx \n\t&quot;</span> <span class="comment">/* initialize COLUMS counter */</span> <a name="l07202"></a>07202 <span class="stringliteral">&quot;shr $3, %%ecx \n\t&quot;</span> <span class="comment">/* EBX/8 (MMX loads 8 bytes at a time) */</span> <a name="l07203"></a>07203 <span class="stringliteral">&quot;mov %%esi, %%ebx \n\t&quot;</span> <span class="comment">/* save ESI in EBX */</span> <a name="l07204"></a>07204 <span class="stringliteral">&quot;mov %%edi, %%edx \n\t&quot;</span> <span class="comment">/* save EDI in EDX */</span> <a name="l07205"></a>07205 <span class="stringliteral">&quot;.align 16 \n\t&quot;</span> <span class="comment">/* 16 byte alignment of the loop entry */</span> <a name="l07206"></a>07206 <span class="stringliteral">&quot;.L10412: \n\t&quot;</span> <a name="l07207"></a>07207 <span class="comment">/* --- */</span> <a name="l07208"></a>07208 <span class="stringliteral">&quot;movq (%%esi), %%mm4 \n\t&quot;</span> <span class="comment">/* load 8 bytes from Src */</span> <a name="l07209"></a>07209 <span class="stringliteral">&quot;movq %%mm4, %%mm5 \n\t&quot;</span> <span class="comment">/* save MM4 in MM5 */</span> <a name="l07210"></a>07210 <span class="stringliteral">&quot;add $2, %%esi \n\t&quot;</span> <span class="comment">/* move ESI pointer 2 bytes right */</span> <a name="l07211"></a>07211 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm4 \n\t&quot;</span> <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l07212"></a>07212 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm5 \n\t&quot;</span> <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l07213"></a>07213 <span class="stringliteral">&quot;psrlw %%mm1, %%mm4 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07214"></a>07214 <span class="stringliteral">&quot;psrlw %%mm1, %%mm5 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07215"></a>07215 <span class="stringliteral">&quot;movq (%%esi), %%mm6 \n\t&quot;</span> <span class="comment">/* load 8 bytes from Src */</span> <a name="l07216"></a>07216 <span class="stringliteral">&quot;movq %%mm6, %%mm7 \n\t&quot;</span> <span class="comment">/* save MM6 in MM7 */</span> <a name="l07217"></a>07217 <span class="stringliteral">&quot;sub $2, %%esi \n\t&quot;</span> <span class="comment">/* move ESI pointer back 2 bytes left */</span> <a name="l07218"></a>07218 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm6 \n\t&quot;</span> <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l07219"></a>07219 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm7 \n\t&quot;</span> <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l07220"></a>07220 <span class="stringliteral">&quot;psrlw %%mm1, %%mm6 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07221"></a>07221 <span class="stringliteral">&quot;psrlw %%mm1, %%mm7 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07222"></a>07222 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move to the next row of Src */</span> <a name="l07223"></a>07223 <span class="stringliteral">&quot;movq (%%esi), %%mm2 \n\t&quot;</span> <span class="comment">/* load 8 bytes from Src */</span> <a name="l07224"></a>07224 <span class="stringliteral">&quot;movq %%mm2, %%mm3 \n\t&quot;</span> <span class="comment">/* save MM2 in MM3 */</span> <a name="l07225"></a>07225 <span class="stringliteral">&quot;add $2, %%esi \n\t&quot;</span> <span class="comment">/* move ESI pointer 2 bytes right */</span> <a name="l07226"></a>07226 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l07227"></a>07227 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm3 \n\t&quot;</span> <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l07228"></a>07228 <span class="stringliteral">&quot;psrlw %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07229"></a>07229 <span class="stringliteral">&quot;psrlw %%mm1, %%mm3 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07230"></a>07230 <span class="stringliteral">&quot;paddw %%mm2, %%mm4 \n\t&quot;</span> <span class="comment">/* add 4 low bytes to accumolator MM4 */</span> <a name="l07231"></a>07231 <span class="stringliteral">&quot;paddw %%mm3, %%mm5 \n\t&quot;</span> <span class="comment">/* add 4 high bytes to accumolator MM5 */</span> <a name="l07232"></a>07232 <span class="stringliteral">&quot;paddw %%mm2, %%mm4 \n\t&quot;</span> <span class="comment">/* add 4 low bytes to accumolator MM4 */</span> <a name="l07233"></a>07233 <span class="stringliteral">&quot;paddw %%mm3, %%mm5 \n\t&quot;</span> <span class="comment">/* add 4 high bytes to accumolator MM5 */</span> <a name="l07234"></a>07234 <span class="stringliteral">&quot;movq (%%esi), %%mm2 \n\t&quot;</span> <span class="comment">/* load 8 bytes from Src */</span> <a name="l07235"></a>07235 <span class="stringliteral">&quot;movq %%mm2, %%mm3 \n\t&quot;</span> <span class="comment">/* save MM2 in MM3 */</span> <a name="l07236"></a>07236 <span class="stringliteral">&quot;sub $2, %%esi \n\t&quot;</span> <span class="comment">/* move ESI pointer back 2 bytes left */</span> <a name="l07237"></a>07237 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l07238"></a>07238 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm3 \n\t&quot;</span> <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l07239"></a>07239 <span class="stringliteral">&quot;psrlw %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07240"></a>07240 <span class="stringliteral">&quot;psrlw %%mm1, %%mm3 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07241"></a>07241 <span class="stringliteral">&quot;paddw %%mm2, %%mm6 \n\t&quot;</span> <span class="comment">/* add 4 low bytes to accumolator MM6 */</span> <a name="l07242"></a>07242 <span class="stringliteral">&quot;paddw %%mm3, %%mm7 \n\t&quot;</span> <span class="comment">/* add 4 high bytes to accumolator MM7 */</span> <a name="l07243"></a>07243 <span class="stringliteral">&quot;paddw %%mm2, %%mm6 \n\t&quot;</span> <span class="comment">/* add 4 low bytes to accumolator MM6 */</span> <a name="l07244"></a>07244 <span class="stringliteral">&quot;paddw %%mm3, %%mm7 \n\t&quot;</span> <span class="comment">/* add 4 high bytes to accumolator MM7 */</span> <a name="l07245"></a>07245 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move to the next row of Src */</span> <a name="l07246"></a>07246 <span class="stringliteral">&quot;movq (%%esi), %%mm2 \n\t&quot;</span> <span class="comment">/* load 8 bytes from Src */</span> <a name="l07247"></a>07247 <span class="stringliteral">&quot;movq %%mm2, %%mm3 \n\t&quot;</span> <span class="comment">/* save MM2 in MM3 */</span> <a name="l07248"></a>07248 <span class="stringliteral">&quot;add $2, %%esi \n\t&quot;</span> <span class="comment">/* move ESI pointer 2 bytes right */</span> <a name="l07249"></a>07249 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l07250"></a>07250 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm3 \n\t&quot;</span> <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l07251"></a>07251 <span class="stringliteral">&quot;psrlw %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07252"></a>07252 <span class="stringliteral">&quot;psrlw %%mm1, %%mm3 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07253"></a>07253 <span class="stringliteral">&quot;paddw %%mm2, %%mm4 \n\t&quot;</span> <span class="comment">/* add 4 low bytes to accumolator MM4 */</span> <a name="l07254"></a>07254 <span class="stringliteral">&quot;paddw %%mm3, %%mm5 \n\t&quot;</span> <span class="comment">/* add 4 high bytes to accumolator MM5 */</span> <a name="l07255"></a>07255 <span class="stringliteral">&quot;movq (%%esi), %%mm2 \n\t&quot;</span> <span class="comment">/* load 8 bytes from Src */</span> <a name="l07256"></a>07256 <span class="stringliteral">&quot;movq %%mm2, %%mm3 \n\t&quot;</span> <span class="comment">/* save MM2 in MM3 */</span> <a name="l07257"></a>07257 <span class="stringliteral">&quot;sub $2, %%esi \n\t&quot;</span> <span class="comment">/* move ESI pointer back 2 bytes left */</span> <a name="l07258"></a>07258 <span class="stringliteral">&quot;punpcklbw %%mm0, %%mm2 \n\t&quot;</span> <span class="comment">/* unpack 4 low bytes into words */</span> <a name="l07259"></a>07259 <span class="stringliteral">&quot;punpckhbw %%mm0, %%mm3 \n\t&quot;</span> <span class="comment">/* unpack 4 high bytes into words */</span> <a name="l07260"></a>07260 <span class="stringliteral">&quot;psrlw %%mm1, %%mm2 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07261"></a>07261 <span class="stringliteral">&quot;psrlw %%mm1, %%mm3 \n\t&quot;</span> <span class="comment">/* shift right each pixel NshiftRight times */</span> <a name="l07262"></a>07262 <span class="stringliteral">&quot;paddw %%mm2, %%mm6 \n\t&quot;</span> <span class="comment">/* add 4 low bytes to accumolator MM6 */</span> <a name="l07263"></a>07263 <span class="stringliteral">&quot;paddw %%mm3, %%mm7 \n\t&quot;</span> <span class="comment">/* add 4 high bytes to accumolator MM7 */</span> <a name="l07264"></a>07264 <span class="comment">/* --- */</span> <a name="l07265"></a>07265 <span class="stringliteral">&quot;movq %%mm4, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM4 into MM2 */</span> <a name="l07266"></a>07266 <span class="stringliteral">&quot;psrlq $32, %%mm4 \n\t&quot;</span> <span class="comment">/* shift 2 left words to the right */</span> <a name="l07267"></a>07267 <span class="stringliteral">&quot;psubw %%mm2, %%mm4 \n\t&quot;</span> <span class="comment">/* MM4 = MM4 - MM2 */</span> <a name="l07268"></a>07268 <span class="stringliteral">&quot;movq %%mm6, %%mm3 \n\t&quot;</span> <span class="comment">/* copy MM6 into MM3 */</span> <a name="l07269"></a>07269 <span class="stringliteral">&quot;psrlq $32, %%mm6 \n\t&quot;</span> <span class="comment">/* shift 2 left words to the right */</span> <a name="l07270"></a>07270 <span class="stringliteral">&quot;psubw %%mm3, %%mm6 \n\t&quot;</span> <span class="comment">/* MM6 = MM6 - MM3 */</span> <a name="l07271"></a>07271 <span class="stringliteral">&quot;punpckldq %%mm6, %%mm4 \n\t&quot;</span> <span class="comment">/* combine 2 words of MM6 and 2 words of MM4 */</span> <a name="l07272"></a>07272 <span class="stringliteral">&quot;movq %%mm5, %%mm2 \n\t&quot;</span> <span class="comment">/* copy MM6 into MM2 */</span> <a name="l07273"></a>07273 <span class="stringliteral">&quot;psrlq $32, %%mm5 \n\t&quot;</span> <span class="comment">/* shift 2 left words to the right */</span> <a name="l07274"></a>07274 <span class="stringliteral">&quot;psubw %%mm2, %%mm5 \n\t&quot;</span> <span class="comment">/* MM5 = MM5 - MM2 */</span> <a name="l07275"></a>07275 <span class="stringliteral">&quot;movq %%mm7, %%mm3 \n\t&quot;</span> <span class="comment">/* copy MM7 into MM3 */</span> <a name="l07276"></a>07276 <span class="stringliteral">&quot;psrlq $32, %%mm7 \n\t&quot;</span> <span class="comment">/* shift 2 left words to the right */</span> <a name="l07277"></a>07277 <span class="stringliteral">&quot;psubw %%mm3, %%mm7 \n\t&quot;</span> <span class="comment">/* MM7 = MM7 - MM3 */</span> <a name="l07278"></a>07278 <span class="stringliteral">&quot;punpckldq %%mm7, %%mm5 \n\t&quot;</span> <span class="comment">/* combine 2 words of MM7 and 2 words of MM5 */</span> <a name="l07279"></a>07279 <span class="comment">/* Take abs values of MM4 and MM5 */</span> <a name="l07280"></a>07280 <span class="stringliteral">&quot;movq %%mm4, %%mm6 \n\t&quot;</span> <span class="comment">/* copy MM4 into MM6 */</span> <a name="l07281"></a>07281 <span class="stringliteral">&quot;movq %%mm5, %%mm7 \n\t&quot;</span> <span class="comment">/* copy MM5 into MM7 */</span> <a name="l07282"></a>07282 <span class="stringliteral">&quot;psraw $15, %%mm6 \n\t&quot;</span> <span class="comment">/* fill MM6 words with word sign bit */</span> <a name="l07283"></a>07283 <span class="stringliteral">&quot;psraw $15, %%mm7 \n\t&quot;</span> <span class="comment">/* fill MM7 words with word sign bit */</span> <a name="l07284"></a>07284 <span class="stringliteral">&quot;pxor %%mm6, %%mm4 \n\t&quot;</span> <span class="comment">/* take 1&#39;s compliment of only neg. words */</span> <a name="l07285"></a>07285 <span class="stringliteral">&quot;pxor %%mm7, %%mm5 \n\t&quot;</span> <span class="comment">/* take 1&#39;s compliment of only neg. words */</span> <a name="l07286"></a>07286 <span class="stringliteral">&quot;psubsw %%mm6, %%mm4 \n\t&quot;</span> <span class="comment">/* add 1 to only neg. words, W-(-1) or W-0 */</span> <a name="l07287"></a>07287 <span class="stringliteral">&quot;psubsw %%mm7, %%mm5 \n\t&quot;</span> <span class="comment">/* add 1 to only neg. words, W-(-1) or W-0 */</span> <a name="l07288"></a>07288 <span class="stringliteral">&quot;packuswb %%mm5, %%mm4 \n\t&quot;</span> <span class="comment">/* combine and pack/saturate MM5 and MM4 */</span> <a name="l07289"></a>07289 <span class="stringliteral">&quot;movq %%mm4, (%%edi) \n\t&quot;</span> <span class="comment">/* store result in Dest */</span> <a name="l07290"></a>07290 <span class="comment">/* --- */</span> <a name="l07291"></a>07291 <span class="stringliteral">&quot;sub %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move to the current top row in Src */</span> <a name="l07292"></a>07292 <span class="stringliteral">&quot;sub %%eax, %%esi \n\t&quot;</span> <span class="stringliteral">&quot;add $8, %%esi \n\t&quot;</span> <span class="comment">/* move Src pointer to the next 8 pixels */</span> <a name="l07293"></a>07293 <span class="stringliteral">&quot;add $8, %%edi \n\t&quot;</span> <span class="comment">/* move Dest pointer to the next 8 pixels */</span> <a name="l07294"></a>07294 <span class="comment">/* --- */</span> <a name="l07295"></a>07295 <span class="stringliteral">&quot;dec %%ecx \n\t&quot;</span> <span class="comment">/* decrease loop counter COLUMNS */</span> <a name="l07296"></a>07296 <span class="stringliteral">&quot;jnz .L10412 \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l07297"></a>07297 <span class="stringliteral">&quot;mov %%ebx, %%esi \n\t&quot;</span> <span class="comment">/* restore most left current row Src address */</span> <a name="l07298"></a>07298 <span class="stringliteral">&quot;mov %%edx, %%edi \n\t&quot;</span> <span class="comment">/* restore most left current row Dest address */</span> <a name="l07299"></a>07299 <span class="stringliteral">&quot;add %%eax, %%esi \n\t&quot;</span> <span class="comment">/* move to the next row in Src */</span> <a name="l07300"></a>07300 <span class="stringliteral">&quot;add %%eax, %%edi \n\t&quot;</span> <span class="comment">/* move to the next row in Dest */</span> <a name="l07301"></a>07301 <span class="stringliteral">&quot;decl %2 \n\t&quot;</span> <span class="comment">/* decrease loop counter ROWS */</span> <a name="l07302"></a>07302 <span class="stringliteral">&quot;jnz .L10410 \n\t&quot;</span> <span class="comment">/* check loop termination, proceed if required */</span> <a name="l07303"></a>07303 <span class="comment">/* --- */</span> <a name="l07304"></a>07304 <span class="stringliteral">&quot;emms \n\t&quot;</span> <span class="comment">/* exit MMX state */</span> <a name="l07305"></a>07305 <span class="stringliteral">&quot;popa \n\t&quot;</span>:<span class="stringliteral">&quot;=m&quot;</span> (Dest) <span class="comment">/* %0 */</span> <a name="l07306"></a>07306 :<span class="stringliteral">&quot;m&quot;</span>(Src), <span class="comment">/* %1 */</span> <a name="l07307"></a>07307 <span class="stringliteral">&quot;m&quot;</span>(rows), <span class="comment">/* %2 */</span> <a name="l07308"></a>07308 <span class="stringliteral">&quot;m&quot;</span>(columns), <span class="comment">/* %3 */</span> <a name="l07309"></a>07309 <span class="stringliteral">&quot;m&quot;</span>(NRightShift) <span class="comment">/* %4 */</span> <a name="l07310"></a>07310 ); <a name="l07311"></a>07311 <span class="preprocessor">#endif</span> <a name="l07312"></a>07312 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l07313"></a>07313 <span class="preprocessor"></span> <span class="keywordflow">return</span> (0); <a name="l07314"></a>07314 } <span class="keywordflow">else</span> { <a name="l07315"></a>07315 <span class="comment">/* No non-MMX implementation yet */</span> <a name="l07316"></a>07316 <span class="keywordflow">return</span> (-1); <a name="l07317"></a>07317 } <a name="l07318"></a>07318 } <a name="l07319"></a>07319 <a name="l07323"></a><a class="code" href="_s_d_l__image_filter_8h.html#a08a45265e9e84bf8beedebba26da947c">07323</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__image_filter_8c.html#afbfcc8c03e3d791ac74c955d14a135e4" title="Align stack to 32 byte boundary,.">SDL_imageFilterAlignStack</a>(<span class="keywordtype">void</span>) <a name="l07324"></a>07324 { <a name="l07325"></a>07325 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l07326"></a>07326 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l07327"></a>07327 <span class="preprocessor"></span> __asm <a name="l07328"></a>07328 { <span class="comment">/* --- stack alignment --- */</span> <a name="l07329"></a>07329 mov ebx, esp <span class="comment">/* load ESP into EBX */</span> <a name="l07330"></a>07330 sub ebx, 4 <span class="comment">/* reserve space on stack for old value of ESP */</span> <a name="l07331"></a>07331 and ebx, -32 <span class="comment">/* align EBX along a 32 byte boundary */</span> <a name="l07332"></a>07332 mov [ebx], esp <span class="comment">/* save old value of ESP in stack, behind the bndry */</span> <a name="l07333"></a>07333 mov esp, ebx <span class="comment">/* align ESP along a 32 byte boundary */</span> <a name="l07334"></a>07334 } <a name="l07335"></a>07335 <span class="preprocessor">#else</span> <a name="l07336"></a>07336 <span class="preprocessor"></span> <span class="keyword">asm</span> <span class="keyword">volatile</span> <a name="l07337"></a>07337 ( <span class="comment">/* --- stack alignment --- */</span> <a name="l07338"></a>07338 <span class="stringliteral">&quot;mov %%esp, %%ebx \n\t&quot;</span> <span class="comment">/* load ESP into EBX */</span> <a name="l07339"></a>07339 <span class="stringliteral">&quot;sub $4, %%ebx \n\t&quot;</span> <span class="comment">/* reserve space on stack for old value of ESP */</span> <a name="l07340"></a>07340 <span class="stringliteral">&quot;and $-32, %%ebx \n\t&quot;</span> <span class="comment">/* align EBX along a 32 byte boundary */</span> <a name="l07341"></a>07341 <span class="stringliteral">&quot;mov %%esp, (%%ebx) \n\t&quot;</span> <span class="comment">/* save old value of ESP in stack, behind the bndry */</span> <a name="l07342"></a>07342 <span class="stringliteral">&quot;mov %%ebx, %%esp \n\t&quot;</span> <span class="comment">/* align ESP along a 32 byte boundary */</span> <a name="l07343"></a>07343 ::); <a name="l07344"></a>07344 <span class="preprocessor">#endif</span> <a name="l07345"></a>07345 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l07346"></a>07346 <span class="preprocessor"></span>} <a name="l07347"></a>07347 <a name="l07351"></a><a class="code" href="_s_d_l__image_filter_8h.html#a84f360601d5e6e017f0e74a2cf83be6c">07351</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__image_filter_8c.html#a3147eb5ddd4965d65702f0e533b42974" title="Restore previously aligned stack.">SDL_imageFilterRestoreStack</a>(<span class="keywordtype">void</span>) <a name="l07352"></a>07352 { <a name="l07353"></a>07353 <span class="preprocessor">#ifdef USE_MMX</span> <a name="l07354"></a>07354 <span class="preprocessor"></span><span class="preprocessor">#if !defined(GCC__)</span> <a name="l07355"></a>07355 <span class="preprocessor"></span> __asm <a name="l07356"></a>07356 { <span class="comment">/* --- restoring old stack --- */</span> <a name="l07357"></a>07357 mov ebx, [esp] <span class="comment">/* load old value of ESP */</span> <a name="l07358"></a>07358 mov esp, ebx <span class="comment">/* restore old value of ESP */</span> <a name="l07359"></a>07359 } <a name="l07360"></a>07360 <span class="preprocessor">#else</span> <a name="l07361"></a>07361 <span class="preprocessor"></span> <span class="keyword">asm</span> <span class="keyword">volatile</span> <a name="l07362"></a>07362 ( <span class="comment">/* --- restoring old stack --- */</span> <a name="l07363"></a>07363 <span class="stringliteral">&quot;mov (%%esp), %%ebx \n\t&quot;</span> <span class="comment">/* load old value of ESP */</span> <a name="l07364"></a>07364 <span class="stringliteral">&quot;mov %%ebx, %%esp \n\t&quot;</span> <span class="comment">/* restore old value of ESP */</span> <a name="l07365"></a>07365 ::); <a name="l07366"></a>07366 <span class="preprocessor">#endif</span> <a name="l07367"></a>07367 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l07368"></a>07368 <span class="preprocessor"></span>} </pre></div></div><!-- contents --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.0 </small></address> </body> </html>
YifuLiu/AliOS-Things
components/SDL2/src/gfx/Docs/html/_s_d_l__image_filter_8c_source.html
HTML
apache-2.0
863,491
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>SDL_gfx: I:/Sources/sdlgfx/SDL_imageFilter.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SDL_gfx &#160;<span id="projectnumber">2.0.25</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.8.0 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#define-members">Defines</a> &#124; <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">I:/Sources/sdlgfx/SDL_imageFilter.h File Reference</div> </div> </div><!--header--> <div class="contents"> <p><a href="_s_d_l__image_filter_8h_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="define-members"></a> Defines</h2></td></tr> <tr class="memitem:a205445dc4dec6756a28ea815437ed6dd"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a>&#160;&#160;&#160;extern</td></tr> <tr><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:a5823f6eb23fe8e74764a94f3d78204ef"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a5823f6eb23fe8e74764a94f3d78204ef">SDL_imageFilterMMXdetect</a> (void)</td></tr> <tr class="memdesc:a5823f6eb23fe8e74764a94f3d78204ef"><td class="mdescLeft">&#160;</td><td class="mdescRight">MMX detection routine (with override flag). <a href="#a5823f6eb23fe8e74764a94f3d78204ef"></a><br/></td></tr> <tr class="memitem:a403adc470cb1dd34520f18d55804d4ea"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a403adc470cb1dd34520f18d55804d4ea">SDL_imageFilterMMXoff</a> (void)</td></tr> <tr class="memdesc:a403adc470cb1dd34520f18d55804d4ea"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disable MMX check for filter functions and and force to use non-MMX C based code. <a href="#a403adc470cb1dd34520f18d55804d4ea"></a><br/></td></tr> <tr class="memitem:a848ce7e9551b25fea19fe1fb739f74fb"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a848ce7e9551b25fea19fe1fb739f74fb">SDL_imageFilterMMXon</a> (void)</td></tr> <tr class="memdesc:a848ce7e9551b25fea19fe1fb739f74fb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable MMX check for filter functions and use MMX code if available. <a href="#a848ce7e9551b25fea19fe1fb739f74fb"></a><br/></td></tr> <tr class="memitem:a9034268e2f51550d8f1d6084bda45194"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a9034268e2f51550d8f1d6084bda45194">SDL_imageFilterAdd</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:a9034268e2f51550d8f1d6084bda45194"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using Add: D = saturation255(S1 + S2) <a href="#a9034268e2f51550d8f1d6084bda45194"></a><br/></td></tr> <tr class="memitem:a69cfa83c5d198c8ae4be4ab86e8d3b8f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a69cfa83c5d198c8ae4be4ab86e8d3b8f">SDL_imageFilterMean</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:a69cfa83c5d198c8ae4be4ab86e8d3b8f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using Mean: D = S1/2 + S2/2. <a href="#a69cfa83c5d198c8ae4be4ab86e8d3b8f"></a><br/></td></tr> <tr class="memitem:a0e0fb80a3dad33d61a8147c7fb9f529d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a0e0fb80a3dad33d61a8147c7fb9f529d">SDL_imageFilterSub</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:a0e0fb80a3dad33d61a8147c7fb9f529d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using Sub: D = saturation0(S1 - S2) <a href="#a0e0fb80a3dad33d61a8147c7fb9f529d"></a><br/></td></tr> <tr class="memitem:a789ce070edcc478ad97a0d7ff90e6aa2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a789ce070edcc478ad97a0d7ff90e6aa2">SDL_imageFilterAbsDiff</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:a789ce070edcc478ad97a0d7ff90e6aa2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using AbsDiff: D = | S1 - S2 |. <a href="#a789ce070edcc478ad97a0d7ff90e6aa2"></a><br/></td></tr> <tr class="memitem:a4657c2a1e1bf55d3241dc737cd618409"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a4657c2a1e1bf55d3241dc737cd618409">SDL_imageFilterMult</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:a4657c2a1e1bf55d3241dc737cd618409"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using Mult: D = saturation255(S1 * S2) <a href="#a4657c2a1e1bf55d3241dc737cd618409"></a><br/></td></tr> <tr class="memitem:ac4f3446d0da18746b48606fe37c26385"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#ac4f3446d0da18746b48606fe37c26385">SDL_imageFilterMultNor</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:ac4f3446d0da18746b48606fe37c26385"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using MultNor: D = S1 * S2. <a href="#ac4f3446d0da18746b48606fe37c26385"></a><br/></td></tr> <tr class="memitem:aa19248767b1fd9ffdea4ba69b9f00175"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#aa19248767b1fd9ffdea4ba69b9f00175">SDL_imageFilterMultDivby2</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:aa19248767b1fd9ffdea4ba69b9f00175"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using MultDivby2: D = saturation255(S1/2 * S2) <a href="#aa19248767b1fd9ffdea4ba69b9f00175"></a><br/></td></tr> <tr class="memitem:aa92bea3946c8081c9656304a7d944fae"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#aa92bea3946c8081c9656304a7d944fae">SDL_imageFilterMultDivby4</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:aa92bea3946c8081c9656304a7d944fae"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using MultDivby4: D = saturation255(S1/2 * S2/2) <a href="#aa92bea3946c8081c9656304a7d944fae"></a><br/></td></tr> <tr class="memitem:a5f67460c0b89dadd49d04832608a345b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a5f67460c0b89dadd49d04832608a345b">SDL_imageFilterBitAnd</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:a5f67460c0b89dadd49d04832608a345b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using BitAnd: D = S1 &amp; S2. <a href="#a5f67460c0b89dadd49d04832608a345b"></a><br/></td></tr> <tr class="memitem:a0acf0eabba33f8fa7acbc08dc3015cd3"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a0acf0eabba33f8fa7acbc08dc3015cd3">SDL_imageFilterBitOr</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:a0acf0eabba33f8fa7acbc08dc3015cd3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using BitOr: D = S1 | S2. <a href="#a0acf0eabba33f8fa7acbc08dc3015cd3"></a><br/></td></tr> <tr class="memitem:aeb8ed56aa7de3c8b0d0b2aa9163c3e37"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#aeb8ed56aa7de3c8b0d0b2aa9163c3e37">SDL_imageFilterDiv</a> (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:aeb8ed56aa7de3c8b0d0b2aa9163c3e37"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using Div: D = S1 / S2. <a href="#aeb8ed56aa7de3c8b0d0b2aa9163c3e37"></a><br/></td></tr> <tr class="memitem:abc3c3fc5f018e271f6393921f3964d31"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#abc3c3fc5f018e271f6393921f3964d31">SDL_imageFilterBitNegation</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length)</td></tr> <tr class="memdesc:abc3c3fc5f018e271f6393921f3964d31"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using BitNegation: D = !S. <a href="#abc3c3fc5f018e271f6393921f3964d31"></a><br/></td></tr> <tr class="memitem:a6be6dccd000eff4baadd33297e5cc419"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a6be6dccd000eff4baadd33297e5cc419">SDL_imageFilterAddByte</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)</td></tr> <tr class="memdesc:a6be6dccd000eff4baadd33297e5cc419"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using AddByte: D = saturation255(S + C) <a href="#a6be6dccd000eff4baadd33297e5cc419"></a><br/></td></tr> <tr class="memitem:af1a17645dea69e52c7bd560521286765"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#af1a17645dea69e52c7bd560521286765">SDL_imageFilterAddUint</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C)</td></tr> <tr class="memdesc:af1a17645dea69e52c7bd560521286765"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using AddUint: D = saturation255((S[i] + Cs[i % 4]), Cs=Swap32((uint)C) <a href="#af1a17645dea69e52c7bd560521286765"></a><br/></td></tr> <tr class="memitem:a8cbdffd5dbcab3b5dc9207d57af616b3"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a8cbdffd5dbcab3b5dc9207d57af616b3">SDL_imageFilterAddByteToHalf</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)</td></tr> <tr class="memdesc:a8cbdffd5dbcab3b5dc9207d57af616b3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using AddByteToHalf: D = saturation255(S/2 + C) <a href="#a8cbdffd5dbcab3b5dc9207d57af616b3"></a><br/></td></tr> <tr class="memitem:af8f4ab4050a0661c7696783ba1a1b12b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#af8f4ab4050a0661c7696783ba1a1b12b">SDL_imageFilterSubByte</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)</td></tr> <tr class="memdesc:af8f4ab4050a0661c7696783ba1a1b12b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using SubByte: D = saturation0(S - C) <a href="#af8f4ab4050a0661c7696783ba1a1b12b"></a><br/></td></tr> <tr class="memitem:ae2f3c5992701bded7c2d256bbbfb403f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#ae2f3c5992701bded7c2d256bbbfb403f">SDL_imageFilterSubUint</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C)</td></tr> <tr class="memdesc:ae2f3c5992701bded7c2d256bbbfb403f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using SubUint: D = saturation0(S[i] - Cs[i % 4]), Cs=Swap32((uint)C) <a href="#ae2f3c5992701bded7c2d256bbbfb403f"></a><br/></td></tr> <tr class="memitem:a931f1232cd03acd2ba90af222625f4ca"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a931f1232cd03acd2ba90af222625f4ca">SDL_imageFilterShiftRight</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)</td></tr> <tr class="memdesc:a931f1232cd03acd2ba90af222625f4ca"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ShiftRight: D = saturation0(S &gt;&gt; N) <a href="#a931f1232cd03acd2ba90af222625f4ca"></a><br/></td></tr> <tr class="memitem:a4ccddf5c575cc4d6074c9a54789240a6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a4ccddf5c575cc4d6074c9a54789240a6">SDL_imageFilterShiftRightUint</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)</td></tr> <tr class="memdesc:a4ccddf5c575cc4d6074c9a54789240a6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ShiftRightUint: D = saturation0((uint)S[i] &gt;&gt; N) <a href="#a4ccddf5c575cc4d6074c9a54789240a6"></a><br/></td></tr> <tr class="memitem:add06bb6ea7847fc13a3041ddceb4ac3c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#add06bb6ea7847fc13a3041ddceb4ac3c">SDL_imageFilterMultByByte</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)</td></tr> <tr class="memdesc:add06bb6ea7847fc13a3041ddceb4ac3c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using MultByByte: D = saturation255(S * C) <a href="#add06bb6ea7847fc13a3041ddceb4ac3c"></a><br/></td></tr> <tr class="memitem:a40e1e21ede9a7ed1eddac2cdbfd0b079"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a40e1e21ede9a7ed1eddac2cdbfd0b079">SDL_imageFilterShiftRightAndMultByByte</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N, unsigned char C)</td></tr> <tr class="memdesc:a40e1e21ede9a7ed1eddac2cdbfd0b079"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ShiftRightAndMultByByte: D = saturation255((S &gt;&gt; N) * C) <a href="#a40e1e21ede9a7ed1eddac2cdbfd0b079"></a><br/></td></tr> <tr class="memitem:ac32f1ea9acbee51c2db94224ef6f7fd2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#ac32f1ea9acbee51c2db94224ef6f7fd2">SDL_imageFilterShiftLeftByte</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)</td></tr> <tr class="memdesc:ac32f1ea9acbee51c2db94224ef6f7fd2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ShiftLeftByte: D = (S &lt;&lt; N) <a href="#ac32f1ea9acbee51c2db94224ef6f7fd2"></a><br/></td></tr> <tr class="memitem:a4fd6d4a9711c13163496587454d9f1a2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a4fd6d4a9711c13163496587454d9f1a2">SDL_imageFilterShiftLeftUint</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)</td></tr> <tr class="memdesc:a4fd6d4a9711c13163496587454d9f1a2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ShiftLeftUint: D = ((uint)S &lt;&lt; N) <a href="#a4fd6d4a9711c13163496587454d9f1a2"></a><br/></td></tr> <tr class="memitem:a084f9544f049cc01e7b2f1090534abbf"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a084f9544f049cc01e7b2f1090534abbf">SDL_imageFilterShiftLeft</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)</td></tr> <tr class="memdesc:a084f9544f049cc01e7b2f1090534abbf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter ShiftLeft: D = saturation255(S &lt;&lt; N) <a href="#a084f9544f049cc01e7b2f1090534abbf"></a><br/></td></tr> <tr class="memitem:ad5bf97d7e39d018d2eeb570e97edf8c0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#ad5bf97d7e39d018d2eeb570e97edf8c0">SDL_imageFilterBinarizeUsingThreshold</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char T)</td></tr> <tr class="memdesc:ad5bf97d7e39d018d2eeb570e97edf8c0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using BinarizeUsingThreshold: D = (S &gt;= T) ? 255:0. <a href="#ad5bf97d7e39d018d2eeb570e97edf8c0"></a><br/></td></tr> <tr class="memitem:ae9d552de9cf5a4a1716d91ee905eafd7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#ae9d552de9cf5a4a1716d91ee905eafd7">SDL_imageFilterClipToRange</a> (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char Tmin, unsigned char Tmax)</td></tr> <tr class="memdesc:ae9d552de9cf5a4a1716d91ee905eafd7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ClipToRange: D = (S &gt;= Tmin) &amp; (S &lt;= Tmax) S:Tmin | Tmax. <a href="#ae9d552de9cf5a4a1716d91ee905eafd7"></a><br/></td></tr> <tr class="memitem:aacb316a18d8cb7999d5d53ee5e7b9750"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#aacb316a18d8cb7999d5d53ee5e7b9750">SDL_imageFilterNormalizeLinear</a> (unsigned char *Src, unsigned char *Dest, unsigned int length, int Cmin, int Cmax, int Nmin, int Nmax)</td></tr> <tr class="memdesc:aacb316a18d8cb7999d5d53ee5e7b9750"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using NormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin) <a href="#aacb316a18d8cb7999d5d53ee5e7b9750"></a><br/></td></tr> <tr class="memitem:a7286cd21fa0a0cfb0606806dacfbe121"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a7286cd21fa0a0cfb0606806dacfbe121">SDL_imageFilterConvolveKernel3x3Divide</a> (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor)</td></tr> <tr class="memdesc:a7286cd21fa0a0cfb0606806dacfbe121"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ConvolveKernel3x3Divide: Dij = saturation0and255( ... ) <a href="#a7286cd21fa0a0cfb0606806dacfbe121"></a><br/></td></tr> <tr class="memitem:a432d7bcc34b6bea42d1a07b4db795e1f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a432d7bcc34b6bea42d1a07b4db795e1f">SDL_imageFilterConvolveKernel5x5Divide</a> (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor)</td></tr> <tr class="memdesc:a432d7bcc34b6bea42d1a07b4db795e1f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ConvolveKernel5x5Divide: Dij = saturation0and255( ... ) <a href="#a432d7bcc34b6bea42d1a07b4db795e1f"></a><br/></td></tr> <tr class="memitem:acc177cf891758fdc4bf7533fb266e339"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#acc177cf891758fdc4bf7533fb266e339">SDL_imageFilterConvolveKernel7x7Divide</a> (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor)</td></tr> <tr class="memdesc:acc177cf891758fdc4bf7533fb266e339"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ConvolveKernel7x7Divide: Dij = saturation0and255( ... ) <a href="#acc177cf891758fdc4bf7533fb266e339"></a><br/></td></tr> <tr class="memitem:af8a8114acd0509787ae5265990049720"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#af8a8114acd0509787ae5265990049720">SDL_imageFilterConvolveKernel9x9Divide</a> (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor)</td></tr> <tr class="memdesc:af8a8114acd0509787ae5265990049720"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ConvolveKernel9x9Divide: Dij = saturation0and255( ... ) <a href="#af8a8114acd0509787ae5265990049720"></a><br/></td></tr> <tr class="memitem:a67929babce179e1e333c5cd2e5fc4091"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a67929babce179e1e333c5cd2e5fc4091">SDL_imageFilterConvolveKernel3x3ShiftRight</a> (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift)</td></tr> <tr class="memdesc:a67929babce179e1e333c5cd2e5fc4091"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... ) <a href="#a67929babce179e1e333c5cd2e5fc4091"></a><br/></td></tr> <tr class="memitem:a9aaa45452b04f51f52826c2104ea3b85"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a9aaa45452b04f51f52826c2104ea3b85">SDL_imageFilterConvolveKernel5x5ShiftRight</a> (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift)</td></tr> <tr class="memdesc:a9aaa45452b04f51f52826c2104ea3b85"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... ) <a href="#a9aaa45452b04f51f52826c2104ea3b85"></a><br/></td></tr> <tr class="memitem:a6dbe52e917c0858bd311e9ce75219587"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a6dbe52e917c0858bd311e9ce75219587">SDL_imageFilterConvolveKernel7x7ShiftRight</a> (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift)</td></tr> <tr class="memdesc:a6dbe52e917c0858bd311e9ce75219587"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... ) <a href="#a6dbe52e917c0858bd311e9ce75219587"></a><br/></td></tr> <tr class="memitem:ad2702d0524a16032118fdf67e3e0f44a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#ad2702d0524a16032118fdf67e3e0f44a">SDL_imageFilterConvolveKernel9x9ShiftRight</a> (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift)</td></tr> <tr class="memdesc:ad2702d0524a16032118fdf67e3e0f44a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using ConvolveKernel9x9ShiftRight: Dij = saturation255( ... ) <a href="#ad2702d0524a16032118fdf67e3e0f44a"></a><br/></td></tr> <tr class="memitem:a2a0e4e259150abbe33bcddb046c367ba"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a2a0e4e259150abbe33bcddb046c367ba">SDL_imageFilterSobelX</a> (unsigned char *Src, unsigned char *Dest, int rows, int columns)</td></tr> <tr class="memdesc:a2a0e4e259150abbe33bcddb046c367ba"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using SobelX: Dij = saturation255( ... ) <a href="#a2a0e4e259150abbe33bcddb046c367ba"></a><br/></td></tr> <tr class="memitem:ab9cc925cd9b135e245936d718b459032"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#ab9cc925cd9b135e245936d718b459032">SDL_imageFilterSobelXShiftRight</a> (unsigned char *Src, unsigned char *Dest, int rows, int columns, unsigned char NRightShift)</td></tr> <tr class="memdesc:ab9cc925cd9b135e245936d718b459032"><td class="mdescLeft">&#160;</td><td class="mdescRight">Filter using SobelXShiftRight: Dij = saturation255( ... ) <a href="#ab9cc925cd9b135e245936d718b459032"></a><br/></td></tr> <tr class="memitem:a08a45265e9e84bf8beedebba26da947c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a08a45265e9e84bf8beedebba26da947c">SDL_imageFilterAlignStack</a> (void)</td></tr> <tr class="memdesc:a08a45265e9e84bf8beedebba26da947c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Align stack to 32 byte boundary,. <a href="#a08a45265e9e84bf8beedebba26da947c"></a><br/></td></tr> <tr class="memitem:a84f360601d5e6e017f0e74a2cf83be6c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__image_filter_8h.html#a84f360601d5e6e017f0e74a2cf83be6c">SDL_imageFilterRestoreStack</a> (void)</td></tr> <tr class="memdesc:a84f360601d5e6e017f0e74a2cf83be6c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Restore previously aligned stack. <a href="#a84f360601d5e6e017f0e74a2cf83be6c"></a><br/></td></tr> </table> <hr/><h2>Define Documentation</h2> <a class="anchor" id="a205445dc4dec6756a28ea815437ed6dd"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define <a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a>&#160;&#160;&#160;extern</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8h_source.html#l00050">50</a> of file <a class="el" href="_s_d_l__image_filter_8h_source.html">SDL_imageFilter.h</a>.</p> </div> </div> <hr/><h2>Function Documentation</h2> <a class="anchor" id="a789ce070edcc478ad97a0d7ff90e6aa2"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a789ce070edcc478ad97a0d7ff90e6aa2">SDL_imageFilterAbsDiff</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using AbsDiff: D = | S1 - S2 |. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00539">539</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a9034268e2f51550d8f1d6084bda45194"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a9034268e2f51550d8f1d6084bda45194">SDL_imageFilterAdd</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using Add: D = saturation255(S1 + S2) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00170">170</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a6be6dccd000eff4baadd33297e5cc419"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a6be6dccd000eff4baadd33297e5cc419">SDL_imageFilterAddByte</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>C</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using AddByte: D = saturation255(S + C) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">C</td><td>Constant value to add (C).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l01788">1788</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a8cbdffd5dbcab3b5dc9207d57af616b3"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a8cbdffd5dbcab3b5dc9207d57af616b3">SDL_imageFilterAddByteToHalf</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>C</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using AddByteToHalf: D = saturation255(S/2 + C) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">C</td><td>Constant to add (C).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l02065">2065</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="af1a17645dea69e52c7bd560521286765"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#af1a17645dea69e52c7bd560521286765">SDL_imageFilterAddUint</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>C</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using AddUint: D = saturation255((S[i] + Cs[i % 4]), Cs=Swap32((uint)C) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">C</td><td>Constant to add (C).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l01916">1916</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a08a45265e9e84bf8beedebba26da947c"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> void <a class="el" href="_s_d_l__image_filter_8h.html#a08a45265e9e84bf8beedebba26da947c">SDL_imageFilterAlignStack</a> </td> <td>(</td> <td class="paramtype">void&#160;</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Align stack to 32 byte boundary,. </p> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l07323">7323</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="ad5bf97d7e39d018d2eeb570e97edf8c0"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#ad5bf97d7e39d018d2eeb570e97edf8c0">SDL_imageFilterBinarizeUsingThreshold</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>T</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using BinarizeUsingThreshold: D = (S &gt;= T) ? 255:0. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">T</td><td>The threshold boundary (inclusive).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l03531">3531</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a5f67460c0b89dadd49d04832608a345b"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a5f67460c0b89dadd49d04832608a345b">SDL_imageFilterBitAnd</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using BitAnd: D = S1 &amp; S2. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l01275">1275</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="abc3c3fc5f018e271f6393921f3964d31"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#abc3c3fc5f018e271f6393921f3964d31">SDL_imageFilterBitNegation</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using BitNegation: D = !S. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l01668">1668</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a0acf0eabba33f8fa7acbc08dc3015cd3"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a0acf0eabba33f8fa7acbc08dc3015cd3">SDL_imageFilterBitOr</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using BitOr: D = S1 | S2. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l01389">1389</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="ae9d552de9cf5a4a1716d91ee905eafd7"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#ae9d552de9cf5a4a1716d91ee905eafd7">SDL_imageFilterClipToRange</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>Tmin</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>Tmax</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ClipToRange: D = (S &gt;= Tmin) &amp; (S &lt;= Tmax) S:Tmin | Tmax. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">Tmin</td><td>Lower (inclusive) boundary of the clipping range. </td></tr> <tr><td class="paramname">Tmax</td><td>Upper (inclusive) boundary of the clipping range.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l03688">3688</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a7286cd21fa0a0cfb0606806dacfbe121"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a7286cd21fa0a0cfb0606806dacfbe121">SDL_imageFilterConvolveKernel3x3Divide</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>rows</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>columns</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">signed short *&#160;</td> <td class="paramname"><em>Kernel</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>Divisor</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ConvolveKernel3x3Divide: Dij = saturation0and255( ... ) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>The source 2D byte array to convolve. Should be different from destination. </td></tr> <tr><td class="paramname">Dest</td><td>The destination 2D byte array to store the result in. Should be different from source. </td></tr> <tr><td class="paramname">rows</td><td>Number of rows in source/destination array. Must be &gt;2. </td></tr> <tr><td class="paramname">columns</td><td>Number of columns in source/destination array. Must be &gt;2. </td></tr> <tr><td class="paramname">Kernel</td><td>The 2D convolution kernel of size 3x3. </td></tr> <tr><td class="paramname">Divisor</td><td>The divisor of the convolution sum. Must be &gt;0.</td></tr> </table> </dd> </dl> <p>Note: Non-MMX implementation not available for this function.</p> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if filter was applied, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l03977">3977</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a67929babce179e1e333c5cd2e5fc4091"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a67929babce179e1e333c5cd2e5fc4091">SDL_imageFilterConvolveKernel3x3ShiftRight</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>rows</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>columns</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">signed short *&#160;</td> <td class="paramname"><em>Kernel</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>NRightShift</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... ) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>The source 2D byte array to convolve. Should be different from destination. </td></tr> <tr><td class="paramname">Dest</td><td>The destination 2D byte array to store the result in. Should be different from source. </td></tr> <tr><td class="paramname">rows</td><td>Number of rows in source/destination array. Must be &gt;2. </td></tr> <tr><td class="paramname">columns</td><td>Number of columns in source/destination array. Must be &gt;2. </td></tr> <tr><td class="paramname">Kernel</td><td>The 2D convolution kernel of size 3x3. </td></tr> <tr><td class="paramname">NRightShift</td><td>The number of right bit shifts to apply to the convolution sum. Must be &lt;7.</td></tr> </table> </dd> </dl> <p>Note: Non-MMX implementation not available for this function.</p> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if filter was applied, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l05375">5375</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a432d7bcc34b6bea42d1a07b4db795e1f"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a432d7bcc34b6bea42d1a07b4db795e1f">SDL_imageFilterConvolveKernel5x5Divide</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>rows</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>columns</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">signed short *&#160;</td> <td class="paramname"><em>Kernel</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>Divisor</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ConvolveKernel5x5Divide: Dij = saturation0and255( ... ) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>The source 2D byte array to convolve. Should be different from destination. </td></tr> <tr><td class="paramname">Dest</td><td>The destination 2D byte array to store the result in. Should be different from source. </td></tr> <tr><td class="paramname">rows</td><td>Number of rows in source/destination array. Must be &gt;4. </td></tr> <tr><td class="paramname">columns</td><td>Number of columns in source/destination array. Must be &gt;4. </td></tr> <tr><td class="paramname">Kernel</td><td>The 2D convolution kernel of size 5x5. </td></tr> <tr><td class="paramname">Divisor</td><td>The divisor of the convolution sum. Must be &gt;0.</td></tr> </table> </dd> </dl> <p>Note: Non-MMX implementation not available for this function.</p> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if filter was applied, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l04167">4167</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a9aaa45452b04f51f52826c2104ea3b85"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a9aaa45452b04f51f52826c2104ea3b85">SDL_imageFilterConvolveKernel5x5ShiftRight</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>rows</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>columns</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">signed short *&#160;</td> <td class="paramname"><em>Kernel</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>NRightShift</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... ) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>The source 2D byte array to convolve. Should be different from destination. </td></tr> <tr><td class="paramname">Dest</td><td>The destination 2D byte array to store the result in. Should be different from source. </td></tr> <tr><td class="paramname">rows</td><td>Number of rows in source/destination array. Must be &gt;4. </td></tr> <tr><td class="paramname">columns</td><td>Number of columns in source/destination array. Must be &gt;4. </td></tr> <tr><td class="paramname">Kernel</td><td>The 2D convolution kernel of size 5x5. </td></tr> <tr><td class="paramname">NRightShift</td><td>The number of right bit shifts to apply to the convolution sum. Must be &lt;7.</td></tr> </table> </dd> </dl> <p>Note: Non-MMX implementation not available for this function.</p> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if filter was applied, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l05552">5552</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="acc177cf891758fdc4bf7533fb266e339"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#acc177cf891758fdc4bf7533fb266e339">SDL_imageFilterConvolveKernel7x7Divide</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>rows</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>columns</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">signed short *&#160;</td> <td class="paramname"><em>Kernel</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>Divisor</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ConvolveKernel7x7Divide: Dij = saturation0and255( ... ) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>The source 2D byte array to convolve. Should be different from destination. </td></tr> <tr><td class="paramname">Dest</td><td>The destination 2D byte array to store the result in. Should be different from source. </td></tr> <tr><td class="paramname">rows</td><td>Number of rows in source/destination array. Must be &gt;6. </td></tr> <tr><td class="paramname">columns</td><td>Number of columns in source/destination array. Must be &gt;6. </td></tr> <tr><td class="paramname">Kernel</td><td>The 2D convolution kernel of size 7x7. </td></tr> <tr><td class="paramname">Divisor</td><td>The divisor of the convolution sum. Must be &gt;0.</td></tr> </table> </dd> </dl> <p>Note: Non-MMX implementation not available for this function.</p> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if filter was applied, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l04470">4470</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a6dbe52e917c0858bd311e9ce75219587"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a6dbe52e917c0858bd311e9ce75219587">SDL_imageFilterConvolveKernel7x7ShiftRight</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>rows</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>columns</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">signed short *&#160;</td> <td class="paramname"><em>Kernel</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>NRightShift</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... ) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>The source 2D byte array to convolve. Should be different from destination. </td></tr> <tr><td class="paramname">Dest</td><td>The destination 2D byte array to store the result in. Should be different from source. </td></tr> <tr><td class="paramname">rows</td><td>Number of rows in source/destination array. Must be &gt;6. </td></tr> <tr><td class="paramname">columns</td><td>Number of columns in source/destination array. Must be &gt;6. </td></tr> <tr><td class="paramname">Kernel</td><td>The 2D convolution kernel of size 7x7. </td></tr> <tr><td class="paramname">NRightShift</td><td>The number of right bit shifts to apply to the convolution sum. Must be &lt;7.</td></tr> </table> </dd> </dl> <p>Note: Non-MMX implementation not available for this function.</p> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if filter was applied, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l05853">5853</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="af8a8114acd0509787ae5265990049720"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#af8a8114acd0509787ae5265990049720">SDL_imageFilterConvolveKernel9x9Divide</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>rows</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>columns</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">signed short *&#160;</td> <td class="paramname"><em>Kernel</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>Divisor</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ConvolveKernel9x9Divide: Dij = saturation0and255( ... ) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>The source 2D byte array to convolve. Should be different from destination. </td></tr> <tr><td class="paramname">Dest</td><td>The destination 2D byte array to store the result in. Should be different from source. </td></tr> <tr><td class="paramname">rows</td><td>Number of rows in source/destination array. Must be &gt;8. </td></tr> <tr><td class="paramname">columns</td><td>Number of columns in source/destination array. Must be &gt;8. </td></tr> <tr><td class="paramname">Kernel</td><td>The 2D convolution kernel of size 9x9. </td></tr> <tr><td class="paramname">Divisor</td><td>The divisor of the convolution sum. Must be &gt;0.</td></tr> </table> </dd> </dl> <p>Note: Non-MMX implementation not available for this function.</p> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if filter was applied, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l04827">4827</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="ad2702d0524a16032118fdf67e3e0f44a"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#ad2702d0524a16032118fdf67e3e0f44a">SDL_imageFilterConvolveKernel9x9ShiftRight</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>rows</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>columns</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">signed short *&#160;</td> <td class="paramname"><em>Kernel</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>NRightShift</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ConvolveKernel9x9ShiftRight: Dij = saturation255( ... ) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>The source 2D byte array to convolve. Should be different from destination. </td></tr> <tr><td class="paramname">Dest</td><td>The destination 2D byte array to store the result in. Should be different from source. </td></tr> <tr><td class="paramname">rows</td><td>Number of rows in source/destination array. Must be &gt;8. </td></tr> <tr><td class="paramname">columns</td><td>Number of columns in source/destination array. Must be &gt;8. </td></tr> <tr><td class="paramname">Kernel</td><td>The 2D convolution kernel of size 9x9. </td></tr> <tr><td class="paramname">NRightShift</td><td>The number of right bit shifts to apply to the convolution sum. Must be &lt;7.</td></tr> </table> </dd> </dl> <p>Note: Non-MMX implementation not available for this function.</p> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if filter was applied, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l06216">6216</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="aeb8ed56aa7de3c8b0d0b2aa9163c3e37"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#aeb8ed56aa7de3c8b0d0b2aa9163c3e37">SDL_imageFilterDiv</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using Div: D = S1 / S2. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l01546">1546</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a69cfa83c5d198c8ae4be4ab86e8d3b8f"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a69cfa83c5d198c8ae4be4ab86e8d3b8f">SDL_imageFilterMean</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using Mean: D = S1/2 + S2/2. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00305">305</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a5823f6eb23fe8e74764a94f3d78204ef"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a5823f6eb23fe8e74764a94f3d78204ef">SDL_imageFilterMMXdetect</a> </td> <td>(</td> <td class="paramtype">void&#160;</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>MMX detection routine (with override flag). </p> <dl class="section return"><dt>Returns:</dt><dd>1 of MMX was detected, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00077">77</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a403adc470cb1dd34520f18d55804d4ea"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> void <a class="el" href="_s_d_l__image_filter_8h.html#a403adc470cb1dd34520f18d55804d4ea">SDL_imageFilterMMXoff</a> </td> <td>(</td> <td class="paramtype">void&#160;</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Disable MMX check for filter functions and and force to use non-MMX C based code. </p> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00090">90</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a848ce7e9551b25fea19fe1fb739f74fb"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> void <a class="el" href="_s_d_l__image_filter_8h.html#a848ce7e9551b25fea19fe1fb739f74fb">SDL_imageFilterMMXon</a> </td> <td>(</td> <td class="paramtype">void&#160;</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Enable MMX check for filter functions and use MMX code if available. </p> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00098">98</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a4657c2a1e1bf55d3241dc737cd618409"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a4657c2a1e1bf55d3241dc737cd618409">SDL_imageFilterMult</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using Mult: D = saturation255(S1 * S2) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00726">726</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="add06bb6ea7847fc13a3041ddceb4ac3c"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#add06bb6ea7847fc13a3041ddceb4ac3c">SDL_imageFilterMultByByte</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>C</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using MultByByte: D = saturation255(S * C) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays. </td></tr> <tr><td class="paramname">C</td><td>Constant to multiply with (C).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l02787">2787</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="aa19248767b1fd9ffdea4ba69b9f00175"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#aa19248767b1fd9ffdea4ba69b9f00175">SDL_imageFilterMultDivby2</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using MultDivby2: D = saturation255(S1/2 * S2) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00997">997</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="aa92bea3946c8081c9656304a7d944fae"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#aa92bea3946c8081c9656304a7d944fae">SDL_imageFilterMultDivby4</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using MultDivby4: D = saturation255(S1/2 * S2/2) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l01138">1138</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="ac4f3446d0da18746b48606fe37c26385"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#ac4f3446d0da18746b48606fe37c26385">SDL_imageFilterMultNor</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using MultNor: D = S1 * S2. </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00859">859</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="aacb316a18d8cb7999d5d53ee5e7b9750"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#aacb316a18d8cb7999d5d53ee5e7b9750">SDL_imageFilterNormalizeLinear</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>Cmin</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>Cmax</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>Nmin</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>Nmax</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using NormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">Cmin</td><td>Normalization constant. </td></tr> <tr><td class="paramname">Cmax</td><td>Normalization constant. </td></tr> <tr><td class="paramname">Nmin</td><td>Normalization constant. </td></tr> <tr><td class="paramname">Nmax</td><td>Normalization constant.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l03906">3906</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a84f360601d5e6e017f0e74a2cf83be6c"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> void <a class="el" href="_s_d_l__image_filter_8h.html#a84f360601d5e6e017f0e74a2cf83be6c">SDL_imageFilterRestoreStack</a> </td> <td>(</td> <td class="paramtype">void&#160;</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Restore previously aligned stack. </p> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l07351">7351</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a084f9544f049cc01e7b2f1090534abbf"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a084f9544f049cc01e7b2f1090534abbf">SDL_imageFilterShiftLeft</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>N</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter ShiftLeft: D = saturation255(S &lt;&lt; N) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S1). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">N</td><td>Number of bit-positions to shift (N). Valid range is 0 to 8.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l03390">3390</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="ac32f1ea9acbee51c2db94224ef6f7fd2"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#ac32f1ea9acbee51c2db94224ef6f7fd2">SDL_imageFilterShiftLeftByte</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>N</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ShiftLeftByte: D = (S &lt;&lt; N) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays. </td></tr> <tr><td class="paramname">N</td><td>Number of bit-positions to shift (N). Valid range is 0 to 8.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l03090">3090</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a4fd6d4a9711c13163496587454d9f1a2"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a4fd6d4a9711c13163496587454d9f1a2">SDL_imageFilterShiftLeftUint</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>N</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ShiftLeftUint: D = ((uint)S &lt;&lt; N) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">N</td><td>Number of bit-positions to shift (N). Valid range is 0 to 32.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l03207">3207</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a931f1232cd03acd2ba90af222625f4ca"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a931f1232cd03acd2ba90af222625f4ca">SDL_imageFilterShiftRight</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>N</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ShiftRight: D = saturation0(S &gt;&gt; N) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">N</td><td>Number of bit-positions to shift (N). Valid range is 0 to 8.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l02473">2473</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a40e1e21ede9a7ed1eddac2cdbfd0b079"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a40e1e21ede9a7ed1eddac2cdbfd0b079">SDL_imageFilterShiftRightAndMultByByte</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>N</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>C</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ShiftRightAndMultByByte: D = saturation255((S &gt;&gt; N) * C) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">N</td><td>Number of bit-positions to shift (N). Valid range is 0 to 8. </td></tr> <tr><td class="paramname">C</td><td>Constant to multiply with (C).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l02940">2940</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a4ccddf5c575cc4d6074c9a54789240a6"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a4ccddf5c575cc4d6074c9a54789240a6">SDL_imageFilterShiftRightUint</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>N</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using ShiftRightUint: D = saturation0((uint)S[i] &gt;&gt; N) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S1). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">N</td><td>Number of bit-positions to shift (N). Valid range is 0 to 32.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l02591">2591</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a2a0e4e259150abbe33bcddb046c367ba"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a2a0e4e259150abbe33bcddb046c367ba">SDL_imageFilterSobelX</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>rows</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>columns</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using SobelX: Dij = saturation255( ... ) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>The source 2D byte array to sobel-filter. Should be different from destination. </td></tr> <tr><td class="paramname">Dest</td><td>The destination 2D byte array to store the result in. Should be different from source. </td></tr> <tr><td class="paramname">rows</td><td>Number of rows in source/destination array. Must be &gt;2. </td></tr> <tr><td class="paramname">columns</td><td>Number of columns in source/destination array. Must be &gt;7.</td></tr> </table> </dd> </dl> <p>Note: Non-MMX implementation not available for this function.</p> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if filter was applied, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l06796">6796</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="ab9cc925cd9b135e245936d718b459032"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#ab9cc925cd9b135e245936d718b459032">SDL_imageFilterSobelXShiftRight</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>rows</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>columns</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>NRightShift</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using SobelXShiftRight: Dij = saturation255( ... ) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src</td><td>The source 2D byte array to sobel-filter. Should be different from destination. </td></tr> <tr><td class="paramname">Dest</td><td>The destination 2D byte array to store the result in. Should be different from source. </td></tr> <tr><td class="paramname">rows</td><td>Number of rows in source/destination array. Must be &gt;2. </td></tr> <tr><td class="paramname">columns</td><td>Number of columns in source/destination array. Must be &gt;8. </td></tr> <tr><td class="paramname">NRightShift</td><td>The number of right bit shifts to apply to the filter sum. Must be &lt;7.</td></tr> </table> </dd> </dl> <p>Note: Non-MMX implementation not available for this function.</p> <dl class="section return"><dt>Returns:</dt><dd>Returns 1 if filter was applied, 0 otherwise. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l07049">7049</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="a0e0fb80a3dad33d61a8147c7fb9f529d"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#a0e0fb80a3dad33d61a8147c7fb9f529d">SDL_imageFilterSub</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using Sub: D = saturation0(S1 - S2) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the first source byte array (S1). </td></tr> <tr><td class="paramname">Src2</td><td>Pointer to the start of the second source byte array (S2). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l00419">419</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="af8f4ab4050a0661c7696783ba1a1b12b"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#af8f4ab4050a0661c7696783ba1a1b12b">SDL_imageFilterSubByte</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char&#160;</td> <td class="paramname"><em>C</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using SubByte: D = saturation0(S - C) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source arrays. </td></tr> <tr><td class="paramname">C</td><td>Constant to subtract (C).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l02193">2193</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> <a class="anchor" id="ae2f3c5992701bded7c2d256bbbfb403f"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> int <a class="el" href="_s_d_l__image_filter_8h.html#ae2f3c5992701bded7c2d256bbbfb403f">SDL_imageFilterSubUint</a> </td> <td>(</td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Src1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char *&#160;</td> <td class="paramname"><em>Dest</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int&#160;</td> <td class="paramname"><em>C</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Filter using SubUint: D = saturation0(S[i] - Cs[i % 4]), Cs=Swap32((uint)C) </p> <dl class="params"><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">Src1</td><td>Pointer to the start of the source byte array (S1). </td></tr> <tr><td class="paramname">Dest</td><td>Pointer to the start of the destination byte array (D). </td></tr> <tr><td class="paramname">length</td><td>The number of bytes in the source array. </td></tr> <tr><td class="paramname">C</td><td>Constant to subtract (C).</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns:</dt><dd>Returns 0 for success or -1 for error. </dd></dl> <p>Definition at line <a class="el" href="_s_d_l__image_filter_8c_source.html#l02322">2322</a> of file <a class="el" href="_s_d_l__image_filter_8c_source.html">SDL_imageFilter.c</a>.</p> </div> </div> </div><!-- contents --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.0 </small></address> </body> </html>
YifuLiu/AliOS-Things
components/SDL2/src/gfx/Docs/html/_s_d_l__image_filter_8h.html
HTML
apache-2.0
125,637
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>SDL_gfx: I:/Sources/sdlgfx/SDL_imageFilter.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SDL_gfx &#160;<span id="projectnumber">2.0.25</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.8.0 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="headertitle"> <div class="title">I:/Sources/sdlgfx/SDL_imageFilter.h</div> </div> </div><!--header--> <div class="contents"> <a href="_s_d_l__image_filter_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"></span> <a name="l00003"></a>00003 <span class="comment">SDL_imageFilter.h: byte-image &quot;filter&quot; routines </span> <a name="l00004"></a>00004 <span class="comment"></span> <a name="l00005"></a>00005 <span class="comment">Copyright (C) 2001-2012 Andreas Schiffler</span> <a name="l00006"></a>00006 <span class="comment"></span> <a name="l00007"></a>00007 <span class="comment">This software is provided &#39;as-is&#39;, without any express or implied</span> <a name="l00008"></a>00008 <span class="comment">warranty. In no event will the authors be held liable for any damages</span> <a name="l00009"></a>00009 <span class="comment">arising from the use of this software.</span> <a name="l00010"></a>00010 <span class="comment"></span> <a name="l00011"></a>00011 <span class="comment">Permission is granted to anyone to use this software for any purpose,</span> <a name="l00012"></a>00012 <span class="comment">including commercial applications, and to alter it and redistribute it</span> <a name="l00013"></a>00013 <span class="comment">freely, subject to the following restrictions:</span> <a name="l00014"></a>00014 <span class="comment"></span> <a name="l00015"></a>00015 <span class="comment">1. The origin of this software must not be misrepresented; you must not</span> <a name="l00016"></a>00016 <span class="comment">claim that you wrote the original software. If you use this software</span> <a name="l00017"></a>00017 <span class="comment">in a product, an acknowledgment in the product documentation would be</span> <a name="l00018"></a>00018 <span class="comment">appreciated but is not required.</span> <a name="l00019"></a>00019 <span class="comment"></span> <a name="l00020"></a>00020 <span class="comment">2. Altered source versions must be plainly marked as such, and must not be</span> <a name="l00021"></a>00021 <span class="comment">misrepresented as being the original software.</span> <a name="l00022"></a>00022 <span class="comment"></span> <a name="l00023"></a>00023 <span class="comment">3. This notice may not be removed or altered from any source</span> <a name="l00024"></a>00024 <span class="comment">distribution.</span> <a name="l00025"></a>00025 <span class="comment"></span> <a name="l00026"></a>00026 <span class="comment">Andreas Schiffler -- aschiffler at ferzkopp dot net</span> <a name="l00027"></a>00027 <span class="comment"></span> <a name="l00028"></a>00028 <span class="comment">*/</span> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="preprocessor">#ifndef _SDL_imageFilter_h</span> <a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#define _SDL_imageFilter_h</span> <a name="l00032"></a>00032 <span class="preprocessor"></span> <a name="l00033"></a>00033 <span class="comment">/* Set up for C function definitions, even when using C++ */</span> <a name="l00034"></a>00034 <span class="preprocessor">#ifdef __cplusplus</span> <a name="l00035"></a>00035 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> { <a name="l00036"></a>00036 <span class="preprocessor">#endif</span> <a name="l00037"></a>00037 <span class="preprocessor"></span> <a name="l00038"></a>00038 <span class="comment">/* ---- Function Prototypes */</span> <a name="l00039"></a>00039 <a name="l00040"></a>00040 <span class="preprocessor">#ifdef _MSC_VER</span> <a name="l00041"></a>00041 <span class="preprocessor"></span><span class="preprocessor"># if defined(DLL_EXPORT) &amp;&amp; !defined(LIBSDL_GFX_DLL_IMPORT)</span> <a name="l00042"></a>00042 <span class="preprocessor"></span><span class="preprocessor"># define SDL_IMAGEFILTER_SCOPE __declspec(dllexport)</span> <a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor"># else</span> <a name="l00044"></a>00044 <span class="preprocessor"></span><span class="preprocessor"># ifdef LIBSDL_GFX_DLL_IMPORT</span> <a name="l00045"></a>00045 <span class="preprocessor"></span><span class="preprocessor"># define SDL_IMAGEFILTER_SCOPE __declspec(dllimport)</span> <a name="l00046"></a>00046 <span class="preprocessor"></span><span class="preprocessor"># endif</span> <a name="l00047"></a>00047 <span class="preprocessor"></span><span class="preprocessor"># endif</span> <a name="l00048"></a>00048 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00049"></a>00049 <span class="preprocessor"></span><span class="preprocessor">#ifndef SDL_IMAGEFILTER_SCOPE</span> <a name="l00050"></a><a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">00050</a> <span class="preprocessor"></span><span class="preprocessor"># define SDL_IMAGEFILTER_SCOPE extern</span> <a name="l00051"></a>00051 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00052"></a>00052 <span class="preprocessor"></span> <a name="l00053"></a>00053 <span class="comment">/* Comments: */</span> <a name="l00054"></a>00054 <span class="comment">/* 1.) MMX functions work best if all data blocks are aligned on a 32 bytes boundary. */</span> <a name="l00055"></a>00055 <span class="comment">/* 2.) Data that is not within an 8 byte boundary is processed using the C routine. */</span> <a name="l00056"></a>00056 <span class="comment">/* 3.) Convolution routines do not have C routines at this time. */</span> <a name="l00057"></a>00057 <a name="l00058"></a>00058 <span class="comment">// Detect MMX capability in CPU</span> <a name="l00059"></a>00059 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917" title="MMX detection routine (with override flag).">SDL_imageFilterMMXdetect</a>(<span class="keywordtype">void</span>); <a name="l00060"></a>00060 <a name="l00061"></a>00061 <span class="comment">// Force use of MMX off (or turn possible use back on)</span> <a name="l00062"></a>00062 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__image_filter_8c.html#a5dff661660755161bb4aaf6199cd1384" title="Disable MMX check for filter functions and and force to use non-MMX C based code.">SDL_imageFilterMMXoff</a>(<span class="keywordtype">void</span>); <a name="l00063"></a>00063 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__image_filter_8c.html#a353ee234c3b51b33c4c5c4b30db5832d" title="Enable MMX check for filter functions and use MMX code if available.">SDL_imageFilterMMXon</a>(<span class="keywordtype">void</span>); <a name="l00064"></a>00064 <a name="l00065"></a>00065 <span class="comment">//</span> <a name="l00066"></a>00066 <span class="comment">// All routines return:</span> <a name="l00067"></a>00067 <span class="comment">// 0 OK</span> <a name="l00068"></a>00068 <span class="comment">// -1 Error (internal error, parameter error)</span> <a name="l00069"></a>00069 <span class="comment">//</span> <a name="l00070"></a>00070 <a name="l00071"></a>00071 <span class="comment">// SDL_imageFilterAdd: D = saturation255(S1 + S2)</span> <a name="l00072"></a>00072 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a9f06507eb0b63198dbd67495d61c9b20" title="Filter using Add: D = saturation255(S1 + S2)">SDL_imageFilterAdd</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length); <a name="l00073"></a>00073 <a name="l00074"></a>00074 <span class="comment">// SDL_imageFilterMean: D = S1/2 + S2/2</span> <a name="l00075"></a>00075 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#ace072118fef77973210eb04fb4bfc779" title="Filter using Mean: D = S1/2 + S2/2.">SDL_imageFilterMean</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length); <a name="l00076"></a>00076 <a name="l00077"></a>00077 <span class="comment">// SDL_imageFilterSub: D = saturation0(S1 - S2)</span> <a name="l00078"></a>00078 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a3c01cf8576ea7a0dfc09dbaa953c9287" title="Filter using Sub: D = saturation0(S1 - S2)">SDL_imageFilterSub</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length); <a name="l00079"></a>00079 <a name="l00080"></a>00080 <span class="comment">// SDL_imageFilterAbsDiff: D = | S1 - S2 |</span> <a name="l00081"></a>00081 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a472909f904274255cd6793c520172e48" title="Filter using AbsDiff: D = | S1 - S2 |.">SDL_imageFilterAbsDiff</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length); <a name="l00082"></a>00082 <a name="l00083"></a>00083 <span class="comment">// SDL_imageFilterMult: D = saturation(S1 * S2)</span> <a name="l00084"></a>00084 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#af4633031d40a9ea0956a2f3c6c87a384" title="Filter using Mult: D = saturation255(S1 * S2)">SDL_imageFilterMult</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length); <a name="l00085"></a>00085 <a name="l00086"></a>00086 <span class="comment">// SDL_imageFilterMultNor: D = S1 * S2 (non-MMX)</span> <a name="l00087"></a>00087 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a5f3c9fd40426bb46eba5ac167505dcc5" title="Filter using MultNor: D = S1 * S2.">SDL_imageFilterMultNor</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length); <a name="l00088"></a>00088 <a name="l00089"></a>00089 <span class="comment">// SDL_imageFilterMultDivby2: D = saturation255(S1/2 * S2)</span> <a name="l00090"></a>00090 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a80737f6427c7bdb30d39a92f6524fc14" title="Filter using MultDivby2: D = saturation255(S1/2 * S2)">SDL_imageFilterMultDivby2</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <a name="l00091"></a>00091 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length); <a name="l00092"></a>00092 <a name="l00093"></a>00093 <span class="comment">// SDL_imageFilterMultDivby4: D = saturation255(S1/2 * S2/2)</span> <a name="l00094"></a>00094 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a30e685653eb1050c7d48feaeb8f801a1" title="Filter using MultDivby4: D = saturation255(S1/2 * S2/2)">SDL_imageFilterMultDivby4</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <a name="l00095"></a>00095 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length); <a name="l00096"></a>00096 <a name="l00097"></a>00097 <span class="comment">// SDL_imageFilterBitAnd: D = S1 &amp; S2</span> <a name="l00098"></a>00098 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a85837ce1b5de1f907b6b9053922b5cbc" title="Filter using BitAnd: D = S1 &amp; S2.">SDL_imageFilterBitAnd</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length); <a name="l00099"></a>00099 <a name="l00100"></a>00100 <span class="comment">// SDL_imageFilterBitOr: D = S1 | S2</span> <a name="l00101"></a>00101 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a5cf1c477f4e32d02f74ee95d9f7b0021" title="Filter using BitOr: D = S1 | S2.">SDL_imageFilterBitOr</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length); <a name="l00102"></a>00102 <a name="l00103"></a>00103 <span class="comment">// SDL_imageFilterDiv: D = S1 / S2 (non-MMX)</span> <a name="l00104"></a>00104 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a0ea22f01c6a4724bac307da3e5355f58" title="Filter using Div: D = S1 / S2.">SDL_imageFilterDiv</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src2, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length); <a name="l00105"></a>00105 <a name="l00106"></a>00106 <span class="comment">// SDL_imageFilterBitNegation: D = !S</span> <a name="l00107"></a>00107 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#ac3abfaa8ec2e88c3c4893588c5555856" title="Filter using BitNegation: D = !S.">SDL_imageFilterBitNegation</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length); <a name="l00108"></a>00108 <a name="l00109"></a>00109 <span class="comment">// SDL_imageFilterAddByte: D = saturation255(S + C)</span> <a name="l00110"></a>00110 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a812cb307cb60ef31f1ffe81a9eee6bb1" title="Filter using AddByte: D = saturation255(S + C)">SDL_imageFilterAddByte</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> C); <a name="l00111"></a>00111 <a name="l00112"></a>00112 <span class="comment">// SDL_imageFilterAddUint: D = saturation255(S + (uint)C)</span> <a name="l00113"></a>00113 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a660543426c47dfec39a349eb3b8f905b" title="Filter using AddUint: D = saturation255((S[i] + Cs[i % 4]), Cs=Swap32((uint)C)">SDL_imageFilterAddUint</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> C); <a name="l00114"></a>00114 <a name="l00115"></a>00115 <span class="comment">// SDL_imageFilterAddByteToHalf: D = saturation255(S/2 + C)</span> <a name="l00116"></a>00116 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#ab82db97d129c8cfc36780bcdc6286fcc" title="Filter using AddByteToHalf: D = saturation255(S/2 + C)">SDL_imageFilterAddByteToHalf</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <a name="l00117"></a>00117 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> C); <a name="l00118"></a>00118 <a name="l00119"></a>00119 <span class="comment">// SDL_imageFilterSubByte: D = saturation0(S - C)</span> <a name="l00120"></a>00120 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a387fb6f0d48cc5d08f37f7f9b92d14b2" title="Filter using SubByte: D = saturation0(S - C)">SDL_imageFilterSubByte</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> C); <a name="l00121"></a>00121 <a name="l00122"></a>00122 <span class="comment">// SDL_imageFilterSubUint: D = saturation0(S - (uint)C)</span> <a name="l00123"></a>00123 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#abb343ef95e22945e1d4d648b2e176e64" title="Filter using SubUint: D = saturation0(S[i] - Cs[i % 4]), Cs=Swap32((uint)C)">SDL_imageFilterSubUint</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> C); <a name="l00124"></a>00124 <a name="l00125"></a>00125 <span class="comment">// SDL_imageFilterShiftRight: D = saturation0(S &gt;&gt; N)</span> <a name="l00126"></a>00126 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a68851aed2dcc5dfd2f3b258236f3b88c" title="Filter using ShiftRight: D = saturation0(S &gt;&gt; N)">SDL_imageFilterShiftRight</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> N); <a name="l00127"></a>00127 <a name="l00128"></a>00128 <span class="comment">// SDL_imageFilterShiftRightUint: D = saturation0((uint)S &gt;&gt; N)</span> <a name="l00129"></a>00129 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a540d4625d76bcd03318c2a59ce650fdb" title="Filter using ShiftRightUint: D = saturation0((uint)S[i] &gt;&gt; N)">SDL_imageFilterShiftRightUint</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> N); <a name="l00130"></a>00130 <a name="l00131"></a>00131 <span class="comment">// SDL_imageFilterMultByByte: D = saturation255(S * C)</span> <a name="l00132"></a>00132 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a06f7a19d6e2fc89d7b48cc45d715806d" title="Filter using MultByByte: D = saturation255(S * C)">SDL_imageFilterMultByByte</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> C); <a name="l00133"></a>00133 <a name="l00134"></a>00134 <span class="comment">// SDL_imageFilterShiftRightAndMultByByte: D = saturation255((S &gt;&gt; N) * C)</span> <a name="l00135"></a>00135 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a0713d6c267fba9756d6beae81e89f9e4" title="Filter using ShiftRightAndMultByByte: D = saturation255((S &gt;&gt; N) * C)">SDL_imageFilterShiftRightAndMultByByte</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <a name="l00136"></a>00136 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> N, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> C); <a name="l00137"></a>00137 <a name="l00138"></a>00138 <span class="comment">// SDL_imageFilterShiftLeftByte: D = (S &lt;&lt; N)</span> <a name="l00139"></a>00139 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a4561a73b249a26babc4c469ffbdae604" title="Filter using ShiftLeftByte: D = (S &lt;&lt; N)">SDL_imageFilterShiftLeftByte</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <a name="l00140"></a>00140 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> N); <a name="l00141"></a>00141 <a name="l00142"></a>00142 <span class="comment">// SDL_imageFilterShiftLeftUint: D = ((uint)S &lt;&lt; N)</span> <a name="l00143"></a>00143 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a250e796fb2db470da0a78b74b78114e8" title="Filter using ShiftLeftUint: D = ((uint)S &lt;&lt; N)">SDL_imageFilterShiftLeftUint</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <a name="l00144"></a>00144 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> N); <a name="l00145"></a>00145 <a name="l00146"></a>00146 <span class="comment">// SDL_imageFilterShiftLeft: D = saturation255(S &lt;&lt; N)</span> <a name="l00147"></a>00147 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a98372fea76310903abef7808db10d226" title="Filter ShiftLeft: D = saturation255(S &lt;&lt; N)">SDL_imageFilterShiftLeft</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> N); <a name="l00148"></a>00148 <a name="l00149"></a>00149 <span class="comment">// SDL_imageFilterBinarizeUsingThreshold: D = S &gt;= T ? 255:0</span> <a name="l00150"></a>00150 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a951a062e15df290a137428e1e0f4d5ce" title="Filter using BinarizeUsingThreshold: D = (S &gt;= T) ? 255:0.">SDL_imageFilterBinarizeUsingThreshold</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <a name="l00151"></a>00151 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> T); <a name="l00152"></a>00152 <a name="l00153"></a>00153 <span class="comment">// SDL_imageFilterClipToRange: D = (S &gt;= Tmin) &amp; (S &lt;= Tmax) 255:0</span> <a name="l00154"></a>00154 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#ab7224abc4ecc1b8a6f4441ef8379515f" title="Filter using ClipToRange: D = (S &gt;= Tmin) &amp; (S &lt;= Tmax) S:Tmin | Tmax.">SDL_imageFilterClipToRange</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src1, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <a name="l00155"></a>00155 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Tmin, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Tmax); <a name="l00156"></a>00156 <a name="l00157"></a>00157 <span class="comment">// SDL_imageFilterNormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)</span> <a name="l00158"></a>00158 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#ab018ace4db884cac953b06b09c00828b" title="Filter using NormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)...">SDL_imageFilterNormalizeLinear</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">int</span> Cmin, <a name="l00159"></a>00159 <span class="keywordtype">int</span> Cmax, <span class="keywordtype">int</span> Nmin, <span class="keywordtype">int</span> Nmax); <a name="l00160"></a>00160 <a name="l00161"></a>00161 <span class="comment">/* !!! NO C-ROUTINE FOR THESE FUNCTIONS YET !!! */</span> <a name="l00162"></a>00162 <a name="l00163"></a>00163 <span class="comment">// SDL_imageFilterConvolveKernel3x3Divide: Dij = saturation0and255( ... )</span> <a name="l00164"></a>00164 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a8e7e4138a93e26f1912763189d407770" title="Filter using ConvolveKernel3x3Divide: Dij = saturation0and255( ... )">SDL_imageFilterConvolveKernel3x3Divide</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">int</span> rows, <a name="l00165"></a>00165 <span class="keywordtype">int</span> columns, <span class="keywordtype">signed</span> <span class="keywordtype">short</span> *Kernel, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Divisor); <a name="l00166"></a>00166 <a name="l00167"></a>00167 <span class="comment">// SDL_imageFilterConvolveKernel5x5Divide: Dij = saturation0and255( ... )</span> <a name="l00168"></a>00168 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#ac9a556492480ce71f54d456a0ff7e6cb" title="Filter using ConvolveKernel5x5Divide: Dij = saturation0and255( ... )">SDL_imageFilterConvolveKernel5x5Divide</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">int</span> rows, <a name="l00169"></a>00169 <span class="keywordtype">int</span> columns, <span class="keywordtype">signed</span> <span class="keywordtype">short</span> *Kernel, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Divisor); <a name="l00170"></a>00170 <a name="l00171"></a>00171 <span class="comment">// SDL_imageFilterConvolveKernel7x7Divide: Dij = saturation0and255( ... )</span> <a name="l00172"></a>00172 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a363f48e6843fd3f48da53688b89bca48" title="Filter using ConvolveKernel7x7Divide: Dij = saturation0and255( ... )">SDL_imageFilterConvolveKernel7x7Divide</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">int</span> rows, <a name="l00173"></a>00173 <span class="keywordtype">int</span> columns, <span class="keywordtype">signed</span> <span class="keywordtype">short</span> *Kernel, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Divisor); <a name="l00174"></a>00174 <a name="l00175"></a>00175 <span class="comment">// SDL_imageFilterConvolveKernel9x9Divide: Dij = saturation0and255( ... )</span> <a name="l00176"></a>00176 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#ae1e91ff193beed110a71119ec901f09d" title="Filter using ConvolveKernel9x9Divide: Dij = saturation0and255( ... )">SDL_imageFilterConvolveKernel9x9Divide</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">int</span> rows, <a name="l00177"></a>00177 <span class="keywordtype">int</span> columns, <span class="keywordtype">signed</span> <span class="keywordtype">short</span> *Kernel, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Divisor); <a name="l00178"></a>00178 <a name="l00179"></a>00179 <span class="comment">// SDL_imageFilterConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... )</span> <a name="l00180"></a>00180 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#ac329e5a3b60351768c96c94db9f9cf97" title="Filter using ConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... )">SDL_imageFilterConvolveKernel3x3ShiftRight</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">int</span> rows, <a name="l00181"></a>00181 <span class="keywordtype">int</span> columns, <span class="keywordtype">signed</span> <span class="keywordtype">short</span> *Kernel, <a name="l00182"></a>00182 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> NRightShift); <a name="l00183"></a>00183 <a name="l00184"></a>00184 <span class="comment">// SDL_imageFilterConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... )</span> <a name="l00185"></a>00185 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a5253738dc4c892352b078d9a7dec2b20" title="Filter using ConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... )">SDL_imageFilterConvolveKernel5x5ShiftRight</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">int</span> rows, <a name="l00186"></a>00186 <span class="keywordtype">int</span> columns, <span class="keywordtype">signed</span> <span class="keywordtype">short</span> *Kernel, <a name="l00187"></a>00187 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> NRightShift); <a name="l00188"></a>00188 <a name="l00189"></a>00189 <span class="comment">// SDL_imageFilterConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... )</span> <a name="l00190"></a>00190 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a48b40065652dda699875f1425b9227a6" title="Filter using ConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... )">SDL_imageFilterConvolveKernel7x7ShiftRight</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">int</span> rows, <a name="l00191"></a>00191 <span class="keywordtype">int</span> columns, <span class="keywordtype">signed</span> <span class="keywordtype">short</span> *Kernel, <a name="l00192"></a>00192 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> NRightShift); <a name="l00193"></a>00193 <a name="l00194"></a>00194 <span class="comment">// SDL_imageFilterConvolveKernel9x9ShiftRight: Dij = saturation0and255( ... )</span> <a name="l00195"></a>00195 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a6aaa30dc51d1e51585d02d123b0f1a7a" title="Filter using ConvolveKernel9x9ShiftRight: Dij = saturation255( ... )">SDL_imageFilterConvolveKernel9x9ShiftRight</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">int</span> rows, <a name="l00196"></a>00196 <span class="keywordtype">int</span> columns, <span class="keywordtype">signed</span> <span class="keywordtype">short</span> *Kernel, <a name="l00197"></a>00197 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> NRightShift); <a name="l00198"></a>00198 <a name="l00199"></a>00199 <span class="comment">// SDL_imageFilterSobelX: Dij = saturation255( ... )</span> <a name="l00200"></a>00200 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a015fe05161b701162d9ecffb01413f1e" title="Filter using SobelX: Dij = saturation255( ... )">SDL_imageFilterSobelX</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">int</span> rows, <span class="keywordtype">int</span> columns); <a name="l00201"></a>00201 <a name="l00202"></a>00202 <span class="comment">// SDL_imageFilterSobelXShiftRight: Dij = saturation255( ... )</span> <a name="l00203"></a>00203 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__image_filter_8c.html#a0d21af83f0183fcd697324cffe3ab3d7" title="Filter using SobelXShiftRight: Dij = saturation255( ... )">SDL_imageFilterSobelXShiftRight</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Src, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *Dest, <span class="keywordtype">int</span> rows, <span class="keywordtype">int</span> columns, <a name="l00204"></a>00204 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> NRightShift); <a name="l00205"></a>00205 <a name="l00206"></a>00206 <span class="comment">// Align/restore stack to 32 byte boundary -- Functionality untested! --</span> <a name="l00207"></a>00207 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__image_filter_8c.html#afbfcc8c03e3d791ac74c955d14a135e4" title="Align stack to 32 byte boundary,.">SDL_imageFilterAlignStack</a>(<span class="keywordtype">void</span>); <a name="l00208"></a>00208 <a class="code" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_IMAGEFILTER_SCOPE</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__image_filter_8c.html#a3147eb5ddd4965d65702f0e533b42974" title="Restore previously aligned stack.">SDL_imageFilterRestoreStack</a>(<span class="keywordtype">void</span>); <a name="l00209"></a>00209 <a name="l00210"></a>00210 <span class="comment">/* Ends C function definitions when using C++ */</span> <a name="l00211"></a>00211 <span class="preprocessor">#ifdef __cplusplus</span> <a name="l00212"></a>00212 <span class="preprocessor"></span>} <a name="l00213"></a>00213 <span class="preprocessor">#endif</span> <a name="l00214"></a>00214 <span class="preprocessor"></span> <a name="l00215"></a>00215 <span class="preprocessor">#endif </span><span class="comment">/* _SDL_imageFilter_h */</span> </pre></div></div><!-- contents --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.0 </small></address> </body> </html>
YifuLiu/AliOS-Things
components/SDL2/src/gfx/Docs/html/_s_d_l__image_filter_8h_source.html
HTML
apache-2.0
45,094