Fixed Visual Studio warning 4244

main
Sam Lantinga 2023-03-30 14:04:32 -07:00
parent 85ee1498a5
commit 308bcbbe76
29 changed files with 160 additions and 155 deletions

View File

@ -1162,7 +1162,7 @@ GetDefaultSamplesFromFreq(int freq)
{
/* Pick a default of ~46 ms at desired frequency */
/* !!! FIXME: remove this when the non-Po2 resampling is in. */
const Uint16 max_sample = (freq / 1000) * 46;
const Uint16 max_sample = (Uint16)((freq / 1000) * 46);
Uint16 current_sample = 1;
while (current_sample < max_sample) {
current_sample *= 2;
@ -1373,7 +1373,13 @@ static SDL_AudioDeviceID open_audio_device(const char *devname, int iscapture,
* value we got from 'desired' and round up to the nearest value
*/
if (!current_audio.impl.SupportsNonPow2Samples && device->spec.samples > 0) {
device->spec.samples = SDL_powerof2(device->spec.samples);
int samples = SDL_powerof2(device->spec.samples);
if (samples <= SDL_MAX_UINT16) {
device->spec.samples = (Uint16)samples;
} else {
SDL_SetError("Couldn't hold sample count %d\n", samples);
return 0;
}
}
if (current_audio.impl.OpenDevice(device, devname) < 0) {

View File

@ -78,8 +78,8 @@ static const Uint8 mix8[] = {
};
/* The volume ranges from 0 - 128 */
#define ADJUST_VOLUME(s, v) ((s) = ((s) * (v)) / SDL_MIX_MAXVOLUME)
#define ADJUST_VOLUME_U8(s, v) ((s) = ((((s) - 128) * (v)) / SDL_MIX_MAXVOLUME) + 128)
#define ADJUST_VOLUME(type, s, v) ((s) = (type)(((s) * (v)) / SDL_MIX_MAXVOLUME))
#define ADJUST_VOLUME_U8(s, v) ((s) = (Uint8)(((((s) - 128) * (v)) / SDL_MIX_MAXVOLUME) + 128))
int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
Uint32 len, int volume)
@ -115,14 +115,14 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
dst8 = (Sint8 *)dst;
while (len--) {
src_sample = *src8;
ADJUST_VOLUME(src_sample, volume);
ADJUST_VOLUME(Sint8, src_sample, volume);
dst_sample = *dst8 + src_sample;
if (dst_sample > max_audioval) {
dst_sample = max_audioval;
} else if (dst_sample < min_audioval) {
dst_sample = min_audioval;
}
*dst8 = dst_sample;
*dst8 = (Sint8)dst_sample;
++dst8;
++src8;
}
@ -138,7 +138,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
len /= 2;
while (len--) {
src1 = SDL_SwapLE16(*(Sint16 *)src);
ADJUST_VOLUME(src1, volume);
ADJUST_VOLUME(Sint16, src1, volume);
src2 = SDL_SwapLE16(*(Sint16 *)dst);
src += 2;
dst_sample = src1 + src2;
@ -147,7 +147,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
} else if (dst_sample < min_audioval) {
dst_sample = min_audioval;
}
*(Sint16 *)dst = SDL_SwapLE16(dst_sample);
*(Sint16 *)dst = SDL_SwapLE16((Sint16)dst_sample);
dst += 2;
}
} break;
@ -162,7 +162,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
len /= 2;
while (len--) {
src1 = SDL_SwapBE16(*(Sint16 *)src);
ADJUST_VOLUME(src1, volume);
ADJUST_VOLUME(Sint16, src1, volume);
src2 = SDL_SwapBE16(*(Sint16 *)dst);
src += 2;
dst_sample = src1 + src2;
@ -171,7 +171,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
} else if (dst_sample < min_audioval) {
dst_sample = min_audioval;
}
*(Sint16 *)dst = SDL_SwapBE16(dst_sample);
*(Sint16 *)dst = SDL_SwapBE16((Sint16)dst_sample);
dst += 2;
}
} break;
@ -189,7 +189,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
while (len--) {
src1 = (Sint64)((Sint32)SDL_SwapLE32(*src32));
src32++;
ADJUST_VOLUME(src1, volume);
ADJUST_VOLUME(Sint64, src1, volume);
src2 = (Sint64)((Sint32)SDL_SwapLE32(*dst32));
dst_sample = src1 + src2;
if (dst_sample > max_audioval) {
@ -214,7 +214,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
while (len--) {
src1 = (Sint64)((Sint32)SDL_SwapBE32(*src32));
src32++;
ADJUST_VOLUME(src1, volume);
ADJUST_VOLUME(Sint64, src1, volume);
src2 = (Sint64)((Sint32)SDL_SwapBE32(*dst32));
dst_sample = src1 + src2;
if (dst_sample > max_audioval) {

View File

@ -134,7 +134,7 @@ SDL_HapticOpen(int device_index)
/* Initialize the haptic device */
SDL_memset(haptic, 0, sizeof(*haptic));
haptic->rumble_id = -1;
haptic->index = device_index;
haptic->index = (Uint8)device_index;
if (SDL_SYS_HapticOpen(haptic) < 0) {
SDL_free(haptic);
return NULL;

View File

@ -463,7 +463,7 @@ int SDL_DINPUT_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
int SDL_DINPUT_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick)
{
SDL_hapticlist_item *item;
int index = 0;
Uint8 index = 0;
HRESULT ret;
DIDEVICEINSTANCE joy_instance;

View File

@ -226,7 +226,7 @@ int SDL_XINPUT_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
int SDL_XINPUT_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick)
{
SDL_hapticlist_item *item;
int index = 0;
Uint8 index = 0;
/* Since it comes from a joystick we have to try to match it with a haptic device on our haptic list. */
for (item = SDL_hapticlist; item != NULL; item = item->next) {

View File

@ -603,7 +603,7 @@ static int hid_get_bluetooth_info(const char *path, struct hid_device_info* dev)
for (id = compatible_ids; *id; id += wcslen(id) + 1) {
/* Normalize to upper case */
wchar_t* p = id;
for (; *p; ++p) *p = towupper(*p);
for (; *p; ++p) *p = (wchar_t)towupper(*p);
/* USB devices
https://docs.microsoft.com/windows-hardware/drivers/hid/plug-and-play-support

View File

@ -1421,7 +1421,7 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID instance_id)
void SDL_PrivateJoystickForceRecentering(SDL_Joystick *joystick)
{
int i, j;
Uint8 i, j;
Uint64 timestamp = SDL_GetTicksNS();
SDL_AssertJoysticksLocked();

View File

@ -117,8 +117,8 @@ static int HIDAPI_DriverLuna_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joyst
Uint8 rumble_packet[] = { 0x03, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xEB };
/* Magnitude is 1..100 so scale the 16-bit input here */
rumble_packet[4] = low_frequency_rumble / 655;
rumble_packet[5] = high_frequency_rumble / 655;
rumble_packet[4] = (Uint8)(low_frequency_rumble / 655);
rumble_packet[5] = (Uint8)(high_frequency_rumble / 655);
if (SDL_HIDAPI_SendRumble(device, rumble_packet, sizeof(rumble_packet)) != sizeof(rumble_packet)) {
return SDL_SetError("Couldn't send rumble packet");

View File

@ -447,7 +447,7 @@ static void HIDAPI_DriverPS3_HandleStatePacket(SDL_Joystick *joystick, SDL_Drive
17, /* SDL_GAMEPAD_BUTTON_DPAD_LEFT */
15, /* SDL_GAMEPAD_BUTTON_DPAD_RIGHT */
};
int i, axis_index = 6;
Uint8 i, axis_index = 6;
for (i = 0; i < SDL_arraysize(button_axis_offsets); ++i) {
int offset = button_axis_offsets[i];
@ -772,7 +772,7 @@ static void HIDAPI_DriverPS3ThirdParty_HandleStatePacket18(SDL_Joystick *joystic
7, /* SDL_GAMEPAD_BUTTON_DPAD_LEFT */
6, /* SDL_GAMEPAD_BUTTON_DPAD_RIGHT */
};
int i, axis_index = 6;
Uint8 i, axis_index = 6;
for (i = 0; i < SDL_arraysize(button_axis_offsets); ++i) {
int offset = button_axis_offsets[i];
@ -888,7 +888,7 @@ static void HIDAPI_DriverPS3ThirdParty_HandleStatePacket19(SDL_Joystick *joystic
8, /* SDL_GAMEPAD_BUTTON_DPAD_LEFT */
7, /* SDL_GAMEPAD_BUTTON_DPAD_RIGHT */
};
int i, axis_index = 6;
Uint8 i, axis_index = 6;
for (i = 0; i < SDL_arraysize(button_axis_offsets); ++i) {
int offset = button_axis_offsets[i];

View File

@ -516,7 +516,7 @@ static bool ResetSteamController(SDL_hid_device *dev, bool bSuppressErrorSpew, u
ADD_SETTING(SETTING_RIGHT_TRACKPAD_MODE, TRACKPAD_NONE);
ADD_SETTING(SETTING_SMOOTH_ABSOLUTE_MOUSE, 0);
#endif
buf[2] = nSettings * 3;
buf[2] = (unsigned char)(nSettings * 3);
res = SetFeatureReport(dev, buf, 3 + nSettings * 3);
if (res < 0) {
@ -616,7 +616,7 @@ static void CloseSteamController(SDL_hid_device *dev)
SDL_memset(buf, 0, 65);
buf[1] = ID_SET_SETTINGS_VALUES;
ADD_SETTING(SETTING_RIGHT_TRACKPAD_MODE, TRACKPAD_ABSOLUTE_MOUSE);
buf[2] = nSettings * 3;
buf[2] = (unsigned char)(nSettings * 3);
SetFeatureReport(dev, buf, 3 + nSettings * 3);
}
@ -640,14 +640,14 @@ static float RemapValClamped(float val, float A, float B, float C, float D)
//---------------------------------------------------------------------------
static void RotatePad(int *pX, int *pY, float flAngleInRad)
{
short int origX = *pX, origY = *pY;
int origX = *pX, origY = *pY;
*pX = (int)(SDL_cosf(flAngleInRad) * origX - SDL_sinf(flAngleInRad) * origY);
*pY = (int)(SDL_sinf(flAngleInRad) * origX + SDL_cosf(flAngleInRad) * origY);
}
static void RotatePadShort(short *pX, short *pY, float flAngleInRad)
{
short int origX = *pX, origY = *pY;
int origX = *pX, origY = *pY;
*pX = (short)(SDL_cosf(flAngleInRad) * origX - SDL_sinf(flAngleInRad) * origY);
*pY = (short)(SDL_sinf(flAngleInRad) * origX + SDL_cosf(flAngleInRad) * origY);
@ -753,8 +753,8 @@ static void FormatStatePacketUntilGyro(SteamControllerStateInternal_t *pState, V
nPadOffset = 0;
}
pState->sLeftPadX = clamp(nLeftPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sLeftPadY = clamp(nLeftPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sLeftPadX = (short)clamp(nLeftPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sLeftPadY = (short)clamp(nLeftPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
nPadOffset = 0;
if (pState->ulButtons & STEAM_RIGHTPAD_FINGERDOWN_MASK) {
@ -763,8 +763,8 @@ static void FormatStatePacketUntilGyro(SteamControllerStateInternal_t *pState, V
nPadOffset = 0;
}
pState->sRightPadX = clamp(nRightPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sRightPadY = clamp(nRightPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sRightPadX = (short)clamp(nRightPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sRightPadY = (short)clamp(nRightPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sTriggerL = (unsigned short)RemapValClamped((float)((pStatePacket->ButtonTriggerData.Triggers.nLeft << 7) | pStatePacket->ButtonTriggerData.Triggers.nLeft), 0, STEAMCONTROLLER_TRIGGER_MAX_ANALOG, 0, SDL_MAX_SINT16);
pState->sTriggerR = (unsigned short)RemapValClamped((float)((pStatePacket->ButtonTriggerData.Triggers.nRight << 7) | pStatePacket->ButtonTriggerData.Triggers.nRight), 0, STEAMCONTROLLER_TRIGGER_MAX_ANALOG, 0, SDL_MAX_SINT16);
@ -815,8 +815,8 @@ static bool UpdateBLESteamControllerState(const uint8_t *pData, int nDataSize, S
}
RotatePadShort(&pState->sLeftPadX, &pState->sLeftPadY, -flRotationAngle);
pState->sLeftPadX = clamp(pState->sLeftPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sLeftPadY = clamp(pState->sLeftPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sLeftPadX = (short)clamp(pState->sLeftPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sLeftPadY = (short)clamp(pState->sLeftPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pData += nLength;
}
if (ucOptionDataMask & k_EBLERightTrackpadChunk) {
@ -832,8 +832,8 @@ static bool UpdateBLESteamControllerState(const uint8_t *pData, int nDataSize, S
}
RotatePadShort(&pState->sRightPadX, &pState->sRightPadY, flRotationAngle);
pState->sRightPadX = clamp(pState->sRightPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sRightPadY = clamp(pState->sRightPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sRightPadX = (short)clamp(pState->sRightPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pState->sRightPadY = (short)clamp(pState->sRightPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
pData += nLength;
}
if (ucOptionDataMask & k_EBLEIMUAccelChunk) {
@ -1074,7 +1074,7 @@ static int HIDAPI_DriverSteam_SetSensorsEnabled(SDL_HIDAPI_Device *device, SDL_J
} else {
ADD_SETTING(SETTING_GYRO_MODE, 0x00 /* SETTING_GYRO_MODE_OFF */);
}
buf[2] = nSettings * 3;
buf[2] = (unsigned char)(nSettings * 3);
if (SetFeatureReport(device->dev, buf, 3 + nSettings * 3) < 0) {
return SDL_SetError("Couldn't write feature report");
}

View File

@ -681,12 +681,15 @@ static void SDLCALL SDL_HomeLEDHintChanged(void *userdata, const char *name, con
if (SDL_strchr(hint, '.') != NULL) {
value = (int)(100.0f * SDL_atof(hint));
if (value > 255) {
value = 255;
}
} else if (SDL_GetStringBoolean(hint, SDL_TRUE)) {
value = 100;
} else {
value = 0;
}
SetHomeLED(ctx, value);
SetHomeLED(ctx, (Uint8)value);
}
}

View File

@ -256,11 +256,11 @@ static SDL_bool WriteRegister(SDL_DriverWii_Context *ctx, Uint32 address, const
SDL_zeroa(writeRequest);
writeRequest[0] = k_eWiiOutputReportIDs_WriteMemory;
writeRequest[1] = 0x04 | ctx->m_bRumbleActive;
writeRequest[1] = (Uint8)(0x04 | ctx->m_bRumbleActive);
writeRequest[2] = (address >> 16) & 0xff;
writeRequest[3] = (address >> 8) & 0xff;
writeRequest[4] = address & 0xff;
writeRequest[5] = size;
writeRequest[5] = (Uint8)size;
SDL_assert(size > 0 && size <= 16);
SDL_memcpy(writeRequest + 6, data, size);
@ -285,7 +285,7 @@ static SDL_bool ReadRegister(SDL_DriverWii_Context *ctx, Uint32 address, int siz
Uint8 readRequest[7];
readRequest[0] = k_eWiiOutputReportIDs_ReadMemory;
readRequest[1] = 0x04 | ctx->m_bRumbleActive;
readRequest[1] = (Uint8)(0x04 | ctx->m_bRumbleActive);
readRequest[2] = (address >> 16) & 0xff;
readRequest[3] = (address >> 8) & 0xff;
readRequest[4] = address & 0xff;
@ -1400,7 +1400,7 @@ static void GetExtensionData(WiiButtonData *dst, const Uint8 *src, int size)
}
if (valid_data) {
SDL_memcpy(dst->rgucExtension, src, size);
dst->ucNExtensionBytes = size;
dst->ucNExtensionBytes = (Uint8)size;
}
}

View File

@ -514,8 +514,8 @@ static int HIDAPI_DriverXboxOne_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Jo
SDL_DriverXboxOne_Context *ctx = (SDL_DriverXboxOne_Context *)device->context;
/* Magnitude is 1..100 so scale the 16-bit input here */
ctx->low_frequency_rumble = low_frequency_rumble / 655;
ctx->high_frequency_rumble = high_frequency_rumble / 655;
ctx->low_frequency_rumble = (Uint8)(low_frequency_rumble / 655);
ctx->high_frequency_rumble = (Uint8)(high_frequency_rumble / 655);
ctx->rumble_pending = SDL_TRUE;
return HIDAPI_DriverXboxOne_UpdateRumble(device);
@ -530,8 +530,8 @@ static int HIDAPI_DriverXboxOne_RumbleJoystickTriggers(SDL_HIDAPI_Device *device
}
/* Magnitude is 1..100 so scale the 16-bit input here */
ctx->left_trigger_rumble = left_rumble / 655;
ctx->right_trigger_rumble = right_rumble / 655;
ctx->left_trigger_rumble = (Uint8)(left_rumble / 655);
ctx->right_trigger_rumble = (Uint8)(right_rumble / 655);
ctx->rumble_pending = SDL_TRUE;
return HIDAPI_DriverXboxOne_UpdateRumble(device);
@ -638,7 +638,7 @@ static void HIDAPI_DriverXboxOne_HandleUnmappedStatePacket(SDL_Joystick *joystic
}
if (ctx->last_paddle_state != data[paddle_index]) {
int nButton = SDL_GAMEPAD_BUTTON_MISC1 + ctx->has_share_button; /* Next available button */
Uint8 nButton = (Uint8)(SDL_GAMEPAD_BUTTON_MISC1 + ctx->has_share_button); /* Next available button */
SDL_SendJoystickButton(timestamp, joystick, nButton++, (data[paddle_index] & button1_bit) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, nButton++, (data[paddle_index] & button2_bit) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, nButton++, (data[paddle_index] & button3_bit) ? SDL_PRESSED : SDL_RELEASED);
@ -781,7 +781,7 @@ static void HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_D
}
if (ctx->last_paddle_state != data[paddle_index]) {
int nButton = SDL_GAMEPAD_BUTTON_MISC1 + ctx->has_share_button; /* Next available button */
Uint8 nButton = (Uint8)(SDL_GAMEPAD_BUTTON_MISC1 + ctx->has_share_button); /* Next available button */
SDL_SendJoystickButton(timestamp, joystick, nButton++, (data[paddle_index] & button1_bit) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, nButton++, (data[paddle_index] & button2_bit) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, nButton++, (data[paddle_index] & button3_bit) ? SDL_PRESSED : SDL_RELEASED);
@ -948,7 +948,7 @@ static void HIDAPI_DriverXboxOneBluetooth_HandleButtons(Uint64 timestamp, SDL_Jo
}
if (ctx->last_paddle_state != data[paddle_index]) {
int nButton = SDL_GAMEPAD_BUTTON_MISC1; /* Next available button */
Uint8 nButton = SDL_GAMEPAD_BUTTON_MISC1; /* Next available button */
SDL_SendJoystickButton(timestamp, joystick, nButton++, (data[paddle_index] & button1_bit) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, nButton++, (data[paddle_index] & button2_bit) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, nButton++, (data[paddle_index] & button3_bit) ? SDL_PRESSED : SDL_RELEASED);

View File

@ -530,7 +530,7 @@ static int VIRTUAL_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool en
static void VIRTUAL_JoystickUpdate(SDL_Joystick *joystick)
{
joystick_hwdata *hwdata;
int i;
Uint8 i;
Uint64 timestamp = SDL_GetTicksNS();
SDL_AssertJoysticksLocked();
@ -582,8 +582,8 @@ static void VIRTUAL_JoystickQuit(void)
static SDL_bool VIRTUAL_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
{
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
int current_button = 0;
int current_axis = 0;
Uint8 current_button = 0;
Uint8 current_axis = 0;
if (hwdata->desc.type != SDL_JOYSTICK_TYPE_GAMEPAD) {
return SDL_FALSE;

View File

@ -607,12 +607,12 @@ static BOOL CALLBACK EnumDevObjectsCallback(LPCDIDEVICEOBJECTINSTANCE pDeviceObj
if (pDeviceObject->dwType & DIDFT_BUTTON) {
in->type = BUTTON;
in->num = joystick->nbuttons;
in->num = (Uint8)joystick->nbuttons;
in->ofs = DIJOFS_BUTTON(in->num);
joystick->nbuttons++;
} else if (pDeviceObject->dwType & DIDFT_POV) {
in->type = HAT;
in->num = joystick->nhats;
in->num = (Uint8)joystick->nhats;
in->ofs = DIJOFS_POV(in->num);
joystick->nhats++;
} else if (pDeviceObject->dwType & DIDFT_AXIS) {
@ -620,7 +620,7 @@ static BOOL CALLBACK EnumDevObjectsCallback(LPCDIDEVICEOBJECTINSTANCE pDeviceObj
DIPROPDWORD dilong;
in->type = AXIS;
in->num = joystick->naxes;
in->num = (Uint8)joystick->naxes;
if (SDL_memcmp(&pDeviceObject->guidType, &GUID_XAxis, sizeof(pDeviceObject->guidType)) == 0) {
in->ofs = DIJOFS_X;
} else if (SDL_memcmp(&pDeviceObject->guidType, &GUID_YAxis, sizeof(pDeviceObject->guidType)) == 0) {
@ -703,9 +703,9 @@ static int SDLCALL SortDevFunc(const void *a, const void *b)
static void SortDevObjects(SDL_Joystick *joystick)
{
input_t *inputs = joystick->hwdata->Inputs;
int nButtons = 0;
int nHats = 0;
int nAxis = 0;
Uint8 nButtons = 0;
Uint8 nHats = 0;
Uint8 nAxis = 0;
int n;
SDL_qsort(inputs, joystick->hwdata->NumInputs, sizeof(input_t), SortDevFunc);
@ -949,7 +949,7 @@ SDL_DINPUT_JoystickGetCapabilities(SDL_Joystick *joystick)
static Uint8 TranslatePOV(DWORD value)
{
const int HAT_VALS[] = {
const Uint8 HAT_VALS[] = {
SDL_HAT_UP,
SDL_HAT_UP | SDL_HAT_RIGHT,
SDL_HAT_RIGHT,

View File

@ -34,7 +34,7 @@ struct SDL_SW_YUVTexture
Uint8 *pixels;
/* These are just so we don't have to allocate them separately */
Uint16 pitches[3];
int pitches[3];
Uint8 *planes[3];
/* This is a temporary surface in case we have to stretch copy */

View File

@ -343,16 +343,16 @@ static void transformSurfaceRGBA(SDL_Surface *src, SDL_Surface *dst, int isin, i
ey = (sdy & 0xffff);
t1 = ((((c01.r - c00.r) * ex) >> 16) + c00.r) & 0xff;
t2 = ((((c11.r - c10.r) * ex) >> 16) + c10.r) & 0xff;
pc->r = (((t2 - t1) * ey) >> 16) + t1;
pc->r = (Uint8)((((t2 - t1) * ey) >> 16) + t1);
t1 = ((((c01.g - c00.g) * ex) >> 16) + c00.g) & 0xff;
t2 = ((((c11.g - c10.g) * ex) >> 16) + c10.g) & 0xff;
pc->g = (((t2 - t1) * ey) >> 16) + t1;
pc->g = (Uint8)((((t2 - t1) * ey) >> 16) + t1);
t1 = ((((c01.b - c00.b) * ex) >> 16) + c00.b) & 0xff;
t2 = ((((c11.b - c10.b) * ex) >> 16) + c10.b) & 0xff;
pc->b = (((t2 - t1) * ey) >> 16) + t1;
pc->b = (Uint8)((((t2 - t1) * ey) >> 16) + t1);
t1 = ((((c01.a - c00.a) * ex) >> 16) + c00.a) & 0xff;
t2 = ((((c11.a - c10.a) * ex) >> 16) + c10.a) & 0xff;
pc->a = (((t2 - t1) * ey) >> 16) + t1;
pc->a = (Uint8)((((t2 - t1) * ey) >> 16) + t1);
}
sdx += icos;
sdy += isin;

View File

@ -171,11 +171,11 @@ static void bounding_rect(const SDL_Point *a, const SDL_Point *b, const SDL_Poin
int srcy = (int)(((Sint64)w0 * s2s0_y + (Sint64)w1 * s2s1_y + s2_x_area.y) / area);
#define TRIANGLE_GET_MAPPED_COLOR \
int r = (int)(((Sint64)w0 * c0.r + (Sint64)w1 * c1.r + (Sint64)w2 * c2.r) / area); \
int g = (int)(((Sint64)w0 * c0.g + (Sint64)w1 * c1.g + (Sint64)w2 * c2.g) / area); \
int b = (int)(((Sint64)w0 * c0.b + (Sint64)w1 * c1.b + (Sint64)w2 * c2.b) / area); \
int a = (int)(((Sint64)w0 * c0.a + (Sint64)w1 * c1.a + (Sint64)w2 * c2.a) / area); \
int color = SDL_MapRGBA(format, r, g, b, a);
Uint8 r = (Uint8)(((Sint64)w0 * c0.r + (Sint64)w1 * c1.r + (Sint64)w2 * c2.r) / area); \
Uint8 g = (Uint8)(((Sint64)w0 * c0.g + (Sint64)w1 * c1.g + (Sint64)w2 * c2.g) / area); \
Uint8 b = (Uint8)(((Sint64)w0 * c0.b + (Sint64)w1 * c1.b + (Sint64)w2 * c2.b) / area); \
Uint8 a = (Uint8)(((Sint64)w0 * c0.a + (Sint64)w1 * c1.a + (Sint64)w2 * c2.a) / area); \
Uint32 color = SDL_MapRGBA(format, r, g, b, a);
#define TRIANGLE_GET_COLOR \
int r = (int)(((Sint64)w0 * c0.r + (Sint64)w1 * c1.r + (Sint64)w2 * c2.r) / area); \
@ -366,13 +366,13 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin
} else if (dstbpp == 2) {
TRIANGLE_BEGIN_LOOP
{
*(Uint16 *)dptr = color;
*(Uint16 *)dptr = (Uint16)color;
}
TRIANGLE_END_LOOP
} else if (dstbpp == 1) {
TRIANGLE_BEGIN_LOOP
{
*dptr = color;
*dptr = (Uint8)color;
}
TRIANGLE_END_LOOP
}
@ -402,14 +402,14 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin
TRIANGLE_BEGIN_LOOP
{
TRIANGLE_GET_MAPPED_COLOR
*(Uint16 *)dptr = color;
*(Uint16 *)dptr = (Uint16)color;
}
TRIANGLE_END_LOOP
} else if (dstbpp == 1) {
TRIANGLE_BEGIN_LOOP
{
TRIANGLE_GET_MAPPED_COLOR
*dptr = color;
*dptr = (Uint8)color;
}
TRIANGLE_END_LOOP
}

View File

@ -479,8 +479,8 @@ int SDL_wcscasecmp(const wchar_t *str1, const wchar_t *str2)
a = *str1;
b = *str2;
} else {
a = SDL_toupper((unsigned char)*str1);
b = SDL_toupper((unsigned char)*str2);
a = (wchar_t)SDL_toupper((unsigned char)*str1);
b = (wchar_t)SDL_toupper((unsigned char)*str2);
}
if (a != b) {
break;
@ -494,8 +494,8 @@ int SDL_wcscasecmp(const wchar_t *str1, const wchar_t *str2)
a = *str1;
b = *str2;
} else {
a = SDL_toupper((unsigned char)*str1);
b = SDL_toupper((unsigned char)*str2);
a = (wchar_t)SDL_toupper((unsigned char)*str1);
b = (wchar_t)SDL_toupper((unsigned char)*str2);
}
return (int)((unsigned int)a - (unsigned int)b);
#endif /* HAVE__WCSICMP */
@ -516,8 +516,8 @@ int SDL_wcsncasecmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen)
a = *str1;
b = *str2;
} else {
a = SDL_toupper((unsigned char)*str1);
b = SDL_toupper((unsigned char)*str2);
a = (wchar_t)SDL_toupper((unsigned char)*str1);
b = (wchar_t)SDL_toupper((unsigned char)*str2);
}
if (a != b) {
break;
@ -535,8 +535,8 @@ int SDL_wcsncasecmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen)
a = *str1;
b = *str2;
} else {
a = SDL_toupper((unsigned char)*str1);
b = SDL_toupper((unsigned char)*str2);
a = (wchar_t)SDL_toupper((unsigned char)*str1);
b = (wchar_t)SDL_toupper((unsigned char)*str2);
}
return (int)((unsigned int)a - (unsigned int)b);
}
@ -565,7 +565,7 @@ SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_
size_t src_bytes = SDL_strlen(src);
size_t bytes = SDL_min(src_bytes, dst_bytes - 1);
size_t i = 0;
unsigned char trailing_bytes = 0;
size_t trailing_bytes = 0;
if (bytes) {
unsigned char c = (unsigned char)src[bytes - 1];
@ -576,7 +576,7 @@ SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_
c = (unsigned char)src[i];
trailing_bytes = UTF8_GetTrailingBytes(c);
if (trailing_bytes) {
if ((bytes - i) != ((size_t)trailing_bytes + 1)) {
if ((bytes - i) != (trailing_bytes + 1)) {
bytes = i;
}
@ -678,7 +678,7 @@ SDL_strupr(char *string)
#else
char *bufp = string;
while (*bufp) {
*bufp = SDL_toupper((unsigned char)*bufp);
*bufp = (char)SDL_toupper((unsigned char)*bufp);
++bufp;
}
return string;
@ -693,7 +693,7 @@ SDL_strlwr(char *string)
#else
char *bufp = string;
while (*bufp) {
*bufp = SDL_tolower((unsigned char)*bufp);
*bufp = (char)SDL_tolower((unsigned char)*bufp);
++bufp;
}
return string;
@ -1652,7 +1652,7 @@ SDL_PrintFloat(char *text, size_t maxlen, SDL_FormatInfo *info, double arg, SDL_
arg *= 10.0;
arg = SDL_modf(arg, &integer_value);
SDL_assert(length < sizeof(num));
num[length++] = '0' + (int)integer_value;
num[length++] = '0' + (char)integer_value;
--precision;
}
if (precision == 1) {
@ -1682,7 +1682,7 @@ SDL_PrintFloat(char *text, size_t maxlen, SDL_FormatInfo *info, double arg, SDL_
num[length++] = '0';
} else {
SDL_assert(length < sizeof(num));
num[length++] = '0' + (int)integer_value;
num[length++] = '0' + (char)integer_value;
}
}

View File

@ -1111,20 +1111,20 @@ static int RLEAlphaSurface(SDL_Surface *surface)
Uint8 *lastline = dst; /* end of last non-blank line */
/* opaque counts are 8 or 16 bits, depending on target depth */
#define ADD_OPAQUE_COUNTS(n, m) \
if (df->BytesPerPixel == 4) { \
((Uint16 *)dst)[0] = n; \
((Uint16 *)dst)[1] = m; \
dst += 4; \
} else { \
dst[0] = n; \
dst[1] = m; \
dst += 2; \
#define ADD_OPAQUE_COUNTS(n, m) \
if (df->BytesPerPixel == 4) { \
((Uint16 *)dst)[0] = (Uint16)n; \
((Uint16 *)dst)[1] = (Uint16)m; \
dst += 4; \
} else { \
dst[0] = (Uint8)n; \
dst[1] = (Uint8)m; \
dst += 2; \
}
/* translucent counts are always 16 bit */
#define ADD_TRANSL_COUNTS(n, m) \
(((Uint16 *)dst)[0] = n, ((Uint16 *)dst)[1] = m, dst += 4)
(((Uint16 *)dst)[0] = (Uint16)n, ((Uint16 *)dst)[1] = (Uint16)m, dst += 4)
for (y = 0; y < h; y++) {
int runstart, skipstart;
@ -1314,15 +1314,15 @@ static int RLEColorkeySurface(SDL_Surface *surface)
w = surface->w;
h = surface->h;
#define ADD_COUNTS(n, m) \
if (bpp == 4) { \
((Uint16 *)dst)[0] = n; \
((Uint16 *)dst)[1] = m; \
dst += 4; \
} else { \
dst[0] = n; \
dst[1] = m; \
dst += 2; \
#define ADD_COUNTS(n, m) \
if (bpp == 4) { \
((Uint16 *)dst)[0] = (Uint16)n; \
((Uint16 *)dst)[1] = (Uint16)m; \
dst += 4; \
} else { \
dst[0] = (Uint8)n; \
dst[1] = (Uint8)m; \
dst += 2; \
}
for (y = 0; y < h; y++) {

View File

@ -226,11 +226,11 @@ extern SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface);
}
#define RGB565_FROM_RGB(Pixel, r, g, b) \
{ \
Pixel = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3); \
Pixel = (Uint16)(((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3)); \
}
#define RGB555_FROM_RGB(Pixel, r, g, b) \
{ \
Pixel = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3); \
Pixel = (Uint16)(((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3)); \
}
#define RGB888_FROM_RGB(Pixel, r, g, b) \
{ \
@ -574,9 +574,8 @@ extern SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface);
#endif /* USE_DUFFS_LOOP */
/* Prevent Visual C++ 6.0 from printing out stupid warnings */
#if defined(_MSC_VER) && (_MSC_VER >= 600)
#pragma warning(disable : 4550)
#pragma warning(disable : 4244) /* '=': conversion from 'X' to 'Y', possible loss of data */
#endif
#endif /* SDL_blit_h_ */

View File

@ -492,7 +492,7 @@ static void Blit1toNAlphaKey(SDL_BlitInfo *info)
sB = srcpal[*src].b;
DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA);
ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
}
src++;
dst += dstbpp;

View File

@ -58,7 +58,7 @@ static void BlitNto1SurfaceAlpha(SDL_BlitInfo *info)
dB &= 0xff;
/* Pack RGB into 8bit pixel */
if ( palmap == NULL ) {
*dst =((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0));
*dst = (Uint8)(((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0)));
} else {
*dst = palmap[((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0))];
}
@ -103,7 +103,7 @@ static void BlitNto1PixelAlpha(SDL_BlitInfo *info)
dB &= 0xff;
/* Pack RGB into 8bit pixel */
if ( palmap == NULL ) {
*dst =((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0));
*dst = (Uint8)(((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0)));
} else {
*dst = palmap[((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0))];
}
@ -151,7 +151,7 @@ static void BlitNto1SurfaceAlphaKey(SDL_BlitInfo *info)
dB &= 0xff;
/* Pack RGB into 8bit pixel */
if ( palmap == NULL ) {
*dst =((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0));
*dst = (Uint8)(((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0)));
} else {
*dst = palmap[((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0))];
}

View File

@ -2117,9 +2117,7 @@ static void BlitNto1(SDL_BlitInfo *info)
sR, sG, sB);
if ( 1 ) {
/* Pack RGB into 8bit pixel */
*dst = ((sR>>5)<<(3+2))|
((sG>>5)<<(2)) |
((sB>>6)<<(0)) ;
*dst = (Uint8)(((sR>>5)<<(3+2)) | ((sG>>5)<<(2)) | ((sB>>6)<<(0)));
}
dst++;
src += srcbpp;
@ -2343,7 +2341,7 @@ static void BlitNtoN(SDL_BlitInfo *info)
dst[1] = src[p1];
dst[2] = src[p2];
dst[3] = src[p3];
dst[alpha_channel] = alpha;
dst[alpha_channel] = (Uint8)alpha;
src += 4;
dst += 4;
}, width);
@ -2397,7 +2395,7 @@ static void BlitNtoN(SDL_BlitInfo *info)
dst[1] = src[p1];
dst[2] = src[p2];
dst[3] = src[p3];
dst[alpha_channel] = alpha;
dst[alpha_channel] = (Uint8)alpha;
src += 3;
dst += 4;
}, width);
@ -2670,7 +2668,7 @@ static void BlitNtoNKey(SDL_BlitInfo *info)
dst[1] = src[p1];
dst[2] = src[p2];
dst[3] = src[p3];
dst[alpha_channel] = alpha;
dst[alpha_channel] = (Uint8)alpha;
}
src += 4;
dst += 4;
@ -2819,7 +2817,7 @@ static void BlitNtoNKey(SDL_BlitInfo *info)
dst[1] = src[p1];
dst[2] = src[p2];
dst[3] = src[p3];
dst[alpha_channel] = alpha;
dst[alpha_channel] = (Uint8)alpha;
}
src += 3;
dst += 4;

View File

@ -565,8 +565,8 @@ int SDL_InitFormat(SDL_PixelFormat *format, Uint32 pixel_format)
/* Set up the format */
SDL_zerop(format);
format->format = pixel_format;
format->BitsPerPixel = bpp;
format->BytesPerPixel = (bpp + 7) / 8;
format->BitsPerPixel = (Uint8)bpp;
format->BytesPerPixel = (Uint8)((bpp + 7) / 8);
format->Rmask = Rmask;
format->Rshift = 0;
@ -772,14 +772,14 @@ void SDL_DitherColors(SDL_Color *colors, int bpp)
so 0 is mapped to (0, 0, 0) and 255 to (255, 255, 255) */
r = i & 0xe0;
r |= r >> 3 | r >> 6;
colors[i].r = r;
colors[i].r = (Uint8)r;
g = (i << 3) & 0xe0;
g |= g >> 3 | g >> 6;
colors[i].g = g;
colors[i].g = (Uint8)g;
b = i & 0x3;
b |= b << 2;
b |= b << 4;
colors[i].b = b;
colors[i].b = (Uint8)b;
colors[i].a = SDL_ALPHA_OPAQUE;
}
}
@ -804,7 +804,7 @@ Uint8 SDL_FindColor(SDL_Palette *pal, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
ad = pal->colors[i].a - a;
distance = (rd * rd) + (gd * gd) + (bd * bd) + (ad * ad);
if (distance < smallest) {
pixel = i;
pixel = (Uint8)i;
if (distance == 0) { /* Perfect match! */
break;
}

View File

@ -263,10 +263,10 @@ static SDL_INLINE void INTERPOL(const Uint32 *src_x0, const Uint32 *src_x1, int
cx->c = c0->c + INTEGER(frac0 * (c1->c - c0->c));
cx->d = c0->d + INTEGER(frac0 * (c1->d - c0->d));
#else
cx->a = INTEGER(frac1 * c0->a + frac0 * c1->a);
cx->b = INTEGER(frac1 * c0->b + frac0 * c1->b);
cx->c = INTEGER(frac1 * c0->c + frac0 * c1->c);
cx->d = INTEGER(frac1 * c0->d + frac0 * c1->d);
cx->a = (Uint8)INTEGER(frac1 * c0->a + frac0 * c1->a);
cx->b = (Uint8)INTEGER(frac1 * c0->b + frac0 * c1->b);
cx->c = (Uint8)INTEGER(frac1 * c0->c + frac0 * c1->c);
cx->d = (Uint8)INTEGER(frac1 * c0->d + frac0 * c1->d);
#endif
}
@ -375,7 +375,7 @@ static SDL_INLINE void SDL_TARGETING("sse2") INTERPOL_BILINEAR_SSE(const Uint32
int f, f2;
f = frac_w;
f2 = FRAC_ONE - frac_w;
v_frac_w0 = _mm_set_epi16(f, f2, f, f2, f, f2, f, f2);
v_frac_w0 = _mm_set_epi16((short)f, (short)f2, (short)f, (short)f2, (short)f, (short)f2, (short)f, (short)f2);
x_00_01 = _mm_loadl_epi64((const __m128i *)s0); /* Load x00 and x01 */
x_10_11 = _mm_loadl_epi64((const __m128i *)s1);
@ -418,8 +418,8 @@ static int SDL_TARGETING("sse2") scale_mat_SSE(const Uint32 *src, int src_w, int
nb_block2 = middle / 2;
v_frac_h0 = _mm_set_epi16(frac_h0, frac_h0, frac_h0, frac_h0, frac_h0, frac_h0, frac_h0, frac_h0);
v_frac_h1 = _mm_set_epi16(frac_h1, frac_h1, frac_h1, frac_h1, frac_h1, frac_h1, frac_h1, frac_h1);
v_frac_h0 = _mm_set_epi16((short)frac_h0, (short)frac_h0, (short)frac_h0, (short)frac_h0, (short)frac_h0, (short)frac_h0, (short)frac_h0, (short)frac_h0);
v_frac_h1 = _mm_set_epi16((short)frac_h1, (short)frac_h1, (short)frac_h1, (short)frac_h1, (short)frac_h1, (short)frac_h1, (short)frac_h1, (short)frac_h1);
zero = _mm_setzero_si128();
while (left_pad_w--) {
@ -460,11 +460,11 @@ static int SDL_TARGETING("sse2") scale_mat_SSE(const Uint32 *src, int src_w, int
f = frac_w_0;
f2 = FRAC_ONE - frac_w_0;
v_frac_w0 = _mm_set_epi16(f, f2, f, f2, f, f2, f, f2);
v_frac_w0 = _mm_set_epi16((short)f, (short)f2, (short)f, (short)f2, (short)f, (short)f2, (short)f, (short)f2);
f = frac_w_1;
f2 = FRAC_ONE - frac_w_1;
v_frac_w1 = _mm_set_epi16(f, f2, f, f2, f, f2, f, f2);
v_frac_w1 = _mm_set_epi16((short)f, (short)f2, (short)f, (short)f2, (short)f, (short)f2, (short)f, (short)f2);
x_00_01 = _mm_loadl_epi64((const __m128i *)s_00_01); /* Load x00 and x01 */
x_02_03 = _mm_loadl_epi64((const __m128i *)s_02_03);

View File

@ -1105,7 +1105,7 @@ SDL_ConvertSurface(SDL_Surface *surface, const SDL_PixelFormat *format)
SDL_Rect bounds;
int ret;
SDL_bool palette_ck_transform = SDL_FALSE;
int palette_ck_value = 0;
Uint8 palette_ck_value = 0;
SDL_bool palette_has_alpha = SDL_FALSE;
Uint8 *palette_saved_alpha = NULL;
int palette_saved_alpha_ncolors = 0;

View File

@ -414,8 +414,8 @@ static void Vec2ToDLU(short *x, short *y)
{
SDL_assert(s_BaseUnitsX != 0); /* we init in WIN_ShowMessageBox(), which is the only public function... */
*x = MulDiv(*x, 4, s_BaseUnitsX);
*y = MulDiv(*y, 8, s_BaseUnitsY);
*x = (short)MulDiv(*x, 4, s_BaseUnitsX);
*y = (short)MulDiv(*y, 8, s_BaseUnitsY);
}
static SDL_bool AddDialogControl(WIN_DialogData *dialog, WORD type, DWORD style, DWORD exStyle, int x, int y, int w, int h, int id, const char *caption, WORD ordinal)
@ -427,10 +427,10 @@ static SDL_bool AddDialogControl(WIN_DialogData *dialog, WORD type, DWORD style,
SDL_zero(item);
item.style = style;
item.exStyle = exStyle;
item.x = x;
item.y = y;
item.cx = w;
item.cy = h;
item.x = (short)x;
item.y = (short)y;
item.cx = (short)w;
item.cy = (short)h;
item.id = id;
Vec2ToDLU(&item.x, &item.y);
@ -516,8 +516,8 @@ static WIN_DialogData *CreateDialogData(int w, int h, const char *caption)
dialogTemplate.style = (WS_CAPTION | DS_CENTER | DS_SHELLFONT);
dialogTemplate.x = 0;
dialogTemplate.y = 0;
dialogTemplate.cx = w;
dialogTemplate.cy = h;
dialogTemplate.cx = (short)w;
dialogTemplate.cy = (short)h;
Vec2ToDLU(&dialogTemplate.cx, &dialogTemplate.cy);
dialog = (WIN_DialogData *)SDL_calloc(1, sizeof(*dialog));

View File

@ -249,25 +249,24 @@ static void WIN_GL_SetupPixelFormat(_THIS, PIXELFORMATDESCRIPTOR *pfd)
}
pfd->iLayerType = PFD_MAIN_PLANE;
pfd->iPixelType = PFD_TYPE_RGBA;
pfd->cRedBits = _this->gl_config.red_size;
pfd->cGreenBits = _this->gl_config.green_size;
pfd->cBlueBits = _this->gl_config.blue_size;
pfd->cAlphaBits = _this->gl_config.alpha_size;
pfd->cRedBits = (BYTE)_this->gl_config.red_size;
pfd->cGreenBits = (BYTE)_this->gl_config.green_size;
pfd->cBlueBits = (BYTE)_this->gl_config.blue_size;
pfd->cAlphaBits = (BYTE)_this->gl_config.alpha_size;
if (_this->gl_config.buffer_size) {
pfd->cColorBits =
_this->gl_config.buffer_size - _this->gl_config.alpha_size;
pfd->cColorBits = (BYTE)(_this->gl_config.buffer_size - _this->gl_config.alpha_size);
} else {
pfd->cColorBits = (pfd->cRedBits + pfd->cGreenBits + pfd->cBlueBits);
}
pfd->cAccumRedBits = _this->gl_config.accum_red_size;
pfd->cAccumGreenBits = _this->gl_config.accum_green_size;
pfd->cAccumBlueBits = _this->gl_config.accum_blue_size;
pfd->cAccumAlphaBits = _this->gl_config.accum_alpha_size;
pfd->cAccumRedBits = (BYTE)_this->gl_config.accum_red_size;
pfd->cAccumGreenBits = (BYTE)_this->gl_config.accum_green_size;
pfd->cAccumBlueBits = (BYTE)_this->gl_config.accum_blue_size;
pfd->cAccumAlphaBits = (BYTE)_this->gl_config.accum_alpha_size;
pfd->cAccumBits =
(pfd->cAccumRedBits + pfd->cAccumGreenBits + pfd->cAccumBlueBits +
pfd->cAccumAlphaBits);
pfd->cDepthBits = _this->gl_config.depth_size;
pfd->cStencilBits = _this->gl_config.stencil_size;
pfd->cDepthBits = (BYTE)_this->gl_config.depth_size;
pfd->cStencilBits = (BYTE)_this->gl_config.stencil_size;
}
/* Choose the closest pixel format that meets or exceeds the target.