Source/WebCore/platform/graphics/GraphicsContext3D.cpp
void packRGBA8ToUnsignedShort565Unmultiply(const uint8_t* source, uint16_t* destination)
{
    float scaleFactor = 1.0f / (source[3] ? source[3] / 255.0f : 1.0f);
    uint8_t sourceR = static_cast<uint8_t>(static_cast<float>(source[0]) * scaleFactor);
    uint8_t sourceG = static_cast<uint8_t>(static_cast<float>(source[1]) * scaleFactor);
    uint8_t sourceB = static_cast<uint8_t>(static_cast<float>(source[2]) * scaleFactor);
    *destination = (((sourceR & 0xF8) << 8)
                    | ((sourceG & 0xFC) << 3)
                    | ((sourceB & 0xF8) >> 3));
}
// FIXME: this routine is lossy and must be removed.
this routine is lossy and must be removed.
this routine is lossy and must be removed .
void packRGBA8ToUnsignedShort565Unmultiply(const uint8_t* source, uint16_t* destination)
{
    float scaleFactor = 1.0f / (source[3] ? source[3] / 255.0f : 1.0f);
    uint8_t sourceR = static_cast<uint8_t>(static_cast<float>(source[0]) * scaleFactor);
    uint8_t sourceG = static_cast<uint8_t>(static_cast<float>(source[1]) * scaleFactor);
    uint8_t sourceB = static_cast<uint8_t>(static_cast<float>(source[2]) * scaleFactor);
    *destination = (((sourceR & 0xF8) << 8)
                    | ((sourceG & 0xFC) << 3)
                    | ((sourceB & 0xF8) >> 3));
}
void packRGBA8ToUnsignedShort565Unmultiply ( const uint8_t * source , uint16_t * destination ) { float scaleFactor = 1.0f / ( source [ 3 ] ? source [ 3 ] / 255.0f : 1.0f ) ; uint8_t sourceR = static_cast < uint8_t > ( static_cast < float > ( source [ 0 ] ) * scaleFactor ) ; uint8_t sourceG = static_cast < uint8_t > ( static_cast < float > ( source [ 1 ] ) * scaleFactor ) ; uint8_t sourceB = static_cast < uint8_t > ( static_cast < float > ( source [ 2 ] ) * scaleFactor ) ; * destination = ( ( ( sourceR & 0xF8 ) << 8 ) | ( ( sourceG & 0xFC ) << 3 ) | ( ( sourceB & 0xF8 ) >> 3 ) ) ; }
FIXME: this routine is lossy and must be removed.
FIXME : this routine is lossy and must be removed .