Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
nsImageMac.cpp File Reference
#include "nsImageMac.h"
#include "nsRenderingContextMac.h"
#include "nsDeviceContextMac.h"
#include "nsRegionPool.h"
#include "prmem.h"
#include <limits.h>

Go to the source code of this file.


#define COMPS_PER_PIXEL   4


static void CallCGContextDrawImage (CGContextRef c, CGRect rect, CGImageRef image)
 NS_IMPL_ISUPPORTS3 (nsImageMac, nsIImage, nsIImageMac, nsIImageMac_MOZILLA_1_8_BRANCH) nsresult nsImageMac
void DataProviderReleaseFunc (void *info, const void *data, size_t size)
void DrawTileAsPattern (void *aInfo, CGContextRef aContext)

Define Documentation

Definition at line 59 of file nsImageMac.cpp.

Definition at line 63 of file nsImageMac.cpp.


Definition at line 47 of file nsImageMac.cpp.

Definition at line 48 of file nsImageMac.cpp.

Definition at line 61 of file nsImageMac.cpp.

Definition at line 67 of file nsImageMac.cpp.

Function Documentation

static void CallCGContextDrawImage ( CGContextRef  c,
CGRect  rect,
CGImageRef  image 
) [static]

Definition at line 51 of file nsImageMac.cpp.

  if ( rect.size.width <= CG_MAX_WIDTH && rect.size.height <= CG_MAX_HEIGHT ) {
    ::CGContextDrawImage(c, rect, image);

Here is the caller graph for this function:

void DataProviderReleaseFunc ( void info,
const void data,
size_t  size 

Definition at line 224 of file nsImageMac.cpp.

  PR_Free(NS_CONST_CAST(void*, data));

Here is the caller graph for this function:

void DrawTileAsPattern ( void aInfo,
CGContextRef  aContext 

Definition at line 987 of file nsImageMac.cpp.

  CGImageRef image = static_cast<CGImageRef> (aInfo);

  float width = ::CGImageGetWidth(image);
  float height = ::CGImageGetHeight(image);
  CGRect drawRect = ::CGRectMake(0, 0, width, height);
  CallCGContextDrawImage(aContext, drawRect, image);

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 144 of file nsImageMac.cpp.

  // Assumed: Init only runs once (due to gfxIImageFrame only allowing 1 Init)

  mWidth = aWidth;
  mHeight = aHeight;

  switch (aMaskRequirements)
    case nsMaskRequirements_kNeeds1Bit:
      mAlphaDepth = 1;

    case nsMaskRequirements_kNeeds8Bit:
      mAlphaDepth = 8;

    case nsMaskRequirements_kNoMask:
      break; // avoid compiler warning

  // create the memory for the image
  // 24-bit images are 8 bits per component; the alpha component is ignored
  mRowBytes = CalculateRowBytes(aWidth, aDepth == 24 ? 32 : aDepth);
  mImageBits = (PRUint8*) PR_Malloc(mHeight * mRowBytes * sizeof(PRUint8));
  if (!mImageBits)

  if (mAlphaDepth)
    mAlphaRowBytes = CalculateRowBytes(aWidth, mAlphaDepth);
    mAlphaBits = (PRUint8*) PR_Malloc(mHeight * mAlphaRowBytes * sizeof(PRUint8));
    if (!mAlphaBits) {
      mImageBits = nsnull;
      return NS_ERROR_OUT_OF_MEMORY;

  return NS_OK;