1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-27 04:28:52 -05:00

Fix VC++ build failure

Regression caused by 71c72db1e3.
This commit is contained in:
Camilla Berglund 2016-02-23 11:47:14 +01:00
parent 165171f9c8
commit 93b4c828c1
3 changed files with 9 additions and 16 deletions

View File

@ -233,13 +233,6 @@ typedef VkResult (APIENTRY * PFN_vkEnumerateInstanceExtensionProperties)(const c
y = t; \ y = t; \
} }
// Helper for non-premultiplied alpha to premultiplied alpha conversion
static inline unsigned char _glfwMultiplyAlpha(unsigned char alpha,
unsigned char value)
{
return (unsigned char) ((value * (unsigned int) alpha) / 255);
}
//======================================================================== //========================================================================
// Platform-independent structures // Platform-independent structures

View File

@ -588,12 +588,12 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
unsigned char* target = data; unsigned char* target = data;
for (i = 0; i < image->width * image->height; i++, source += 4) for (i = 0; i < image->width * image->height; i++, source += 4)
{ {
unsigned char alpha = source[3]; unsigned int alpha = source[3];
*target++ = _glfwMultiplyAlpha(alpha, source[2]); *target++ = (unsigned char) ((source[2] * alpha) / 255);
*target++ = _glfwMultiplyAlpha(alpha, source[1]); *target++ = (unsigned char) ((source[1] * alpha) / 255);
*target++ = _glfwMultiplyAlpha(alpha, source[0]); *target++ = (unsigned char) ((source[0] * alpha) / 255);
*target++ = alpha; *target++ = (unsigned char) alpha;
} }
cursor->wl.buffer = cursor->wl.buffer =

View File

@ -690,12 +690,12 @@ Cursor _glfwCreateCursorX11(const GLFWimage* image, int xhot, int yhot)
for (i = 0; i < image->width * image->height; i++, target++, source += 4) for (i = 0; i < image->width * image->height; i++, target++, source += 4)
{ {
unsigned char alpha = source[3]; unsigned int alpha = source[3];
*target = (alpha << 24) | *target = (alpha << 24) |
(_glfwMultiplyAlpha(alpha, source[0]) << 16) | ((unsigned char) ((source[0] * alpha) / 255) << 16) |
(_glfwMultiplyAlpha(alpha, source[1]) << 8) | ((unsigned char) ((source[1] * alpha) / 255) << 8) |
_glfwMultiplyAlpha(alpha, source[2]); ((unsigned char) ((source[2] * alpha) / 255) << 0);
} }
cursor = XcursorImageLoadCursor(_glfw.x11.display, native); cursor = XcursorImageLoadCursor(_glfw.x11.display, native);