Back to index

lightning-sunbird  0.9+nobinonly
Functions
nsCairoImage.cpp File Reference
#include "nsMemory.h"
#include "nsCairoImage.h"
#include "nsCairoRenderingContext.h"
#include "nsCairoDrawingSurface.h"
#include "nsIServiceManager.h"

Go to the source code of this file.

Functions

static void ARGBToThreeChannel (PRUint32 *aARGB, PRUint8 *aData)
static PRUint32 ThreeChannelToARGB (PRUint8 *aData, PRUint8 aAlpha)

Function Documentation

static void ARGBToThreeChannel ( PRUint32 aARGB,
PRUint8 aData 
) [static]

Definition at line 48 of file nsCairoImage.cpp.

                                                                {
    PRUint8 r = (PRUint8)(*aARGB >> 16);
    PRUint8 g = (PRUint8)(*aARGB >> 8);
    PRUint8 b = (PRUint8)*aARGB;
#if defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON)
    // BGR format; assume little-endian system
#ifndef IS_LITTLE_ENDIAN
#error Strange big-endian/OS combination
#endif
    // BGR, blue byte first
    aData[0] = b; aData[1] = g; aData[2] = r;
#else
    // RGB, red byte first
    aData[0] = r; aData[1] = g; aData[2] = b;
#endif
}

Here is the caller graph for this function:

static PRUint32 ThreeChannelToARGB ( PRUint8 aData,
PRUint8  aAlpha 
) [static]

Definition at line 65 of file nsCairoImage.cpp.

                                                                   {
    PRUint8 r, g, b;
#if defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON)
    // BGR format; assume little-endian system
#ifndef IS_LITTLE_ENDIAN
#error Strange big-endian/OS combination
#endif
    // BGR, blue byte first
    b = aData[0]; g = aData[1]; r = aData[2];
#else
    // RGB, red byte first
    r = aData[0]; g = aData[1]; b = aData[2];
#endif
    return (aAlpha << 24) | (r << 16) | (g << 8) | b;
}

Here is the caller graph for this function: