Source/WebCore/platform/graphics/GraphicsContext3D.cpp
void packRGBA8ToUnsignedShort4444Unmultiply(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 & 0xF0) << 8)
                    | ((sourceG & 0xF0) << 4)
                    | (sourceB & 0xF0)
                    | (source[3] >> 4));
}
// 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 packRGBA8ToUnsignedShort4444Unmultiply(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 & 0xF0) << 8)
                    | ((sourceG & 0xF0) << 4)
                    | (sourceB & 0xF0)
                    | (source[3] >> 4));
}
void packRGBA8ToUnsignedShort4444Unmultiply ( 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 & 0xF0 ) << 8 ) | ( ( sourceG & 0xF0 ) << 4 ) | ( sourceB & 0xF0 ) | ( source [ 3 ] >> 4 ) ) ; }
FIXME: this routine is lossy and must be removed.
FIXME : this routine is lossy and must be removed .