Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Member Functions | Private Attributes
nsImageQt Class Reference

#include <nsImageQt.h>

Inheritance diagram for nsImageQt:
Inheritance graph
[legend]
Collaboration diagram for nsImageQt:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsImageQt ()
virtual ~nsImageQt ()
virtual NS_DECL_ISUPPORTS nsresult Init (PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth, nsMaskRequirements aMaskRequirements)
virtual PRInt32 GetBytesPix ()
 Get the number of bytes per pixel for this image - dwc 2/3/99.
virtual PRBool GetIsRowOrderTopToBottom ()
 Get whether rows are organized top to bottom, or bottom to top - syd 3/29/99.
virtual PRInt32 GetHeight ()
 Get the height for the pixelmap - dwc 2/1/99.
virtual PRInt32 GetWidth ()
 Get the width for the pixelmap - dwc 2/1/99.
virtual PRUint8GetBits ()
 Get a pointer to the bits for the pixelmap, only if it is not optimized - dwc 2/1/99.
virtual PRInt32 GetLineStride ()
 Get the number of bytes needed to get to the next scanline for the pixelmap - dwc 2/1/99.
virtual PRBool GetHasAlphaMask ()
 Get whether this image has an alpha mask.
virtual PRUint8GetAlphaBits ()
 Get a pointer to the bits for the alpha mask - dwc 2/1/99.
virtual PRInt32 GetAlphaLineStride ()
 Get the number of bytes per scanline for the alpha mask - dwc 2/1/99.
virtual void ImageUpdated (nsIDeviceContext *aContext, PRUint8 aFlags, nsRect *aUpdateRect)
 Update the nsIImage color table - dwc 2/1/99.
virtual PRBool GetIsImageComplete ()
 
See documentation in nsIImage.h
virtual nsresult Optimize (nsIDeviceContext *aContext)
 Converted this pixelmap to an optimized pixelmap for the device - dwc 2/1/99.
virtual nsColorMapGetColorMap ()
 Get the colormap for the nsIImage - dwc 2/1/99.
NS_IMETHOD Draw (nsIRenderingContext &aContext, nsIDrawingSurface *aSurface, PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight)
 BitBlit the nsIImage to a device, the source can be scaled to the dest - dwc 2/1/99.
NS_IMETHOD Draw (nsIRenderingContext &aContext, nsIDrawingSurface *aSurface, PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight, PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight)
 BitBlit the nsIImage to a device, the source and dest can be scaled - dwc 2/1/99.
NS_IMETHOD DrawTile (nsIRenderingContext &aContext, nsIDrawingSurface *aSurface, PRInt32 aSXOffset, PRInt32 aSYOffset, PRInt32 aPadX, PRInt32 aPadY, const nsRect &aTileRect)
NS_IMETHOD DrawToImage (nsIImage *aDstImage, PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight)
 BitBlit the entire (no cropping) nsIImage to another nsImage, the source and dest can be scaled - saari 03/08/01.
virtual PRInt8 GetAlphaDepth ()
 Get the alpha depth for the image mask - lordpixel 2001/05/16.
virtual voidGetBitInfo ()
 Return information about the bits for this structure - dwc 2/1/99.
NS_IMETHOD LockImagePixels (PRBool aMaskPixels)
 LockImagePixels Lock the image pixels so that we can access them directly, with safely.
NS_IMETHOD UnlockImagePixels (PRBool aMaskPixels)
 UnlockImagePixels Unlock the image pixels.

Private Member Functions

void updatePixmap ()
 Calculate the amount of memory needed for the initialization of the image.

Private Attributes

PRInt32 mWidth
PRInt32 mHeight
PRInt32 mDepth
PRInt32 mRowBytes
PRUint8mImageBits
PRInt8 mAlphaDepth
PRInt16 mAlphaRowBytes
PRUint8mAlphaBits
PRInt8 mNumBytesPixel
nsRect mDecodedRect
QPixmap pixmap
PRBool pixmapDirty

Detailed Description

Definition at line 51 of file nsImageQt.h.


Constructor & Destructor Documentation

Definition at line 78 of file nsImageQt.cpp.

nsImageQt::~nsImageQt ( ) [virtual]

Definition at line 93 of file nsImageQt.cpp.

{
    if (nsnull != mImageBits) {
        delete[] mImageBits;
        mImageBits = nsnull;
    }
    if (nsnull != mAlphaBits) {
        delete[] mAlphaBits;
        mAlphaBits = nsnull;
    }
}

Member Function Documentation

NS_IMETHODIMP nsImageQt::Draw ( nsIRenderingContext aContext,
nsIDrawingSurface aSurface,
PRInt32  aX,
PRInt32  aY,
PRInt32  aWidth,
PRInt32  aHeight 
) [virtual]

BitBlit the nsIImage to a device, the source can be scaled to the dest - dwc 2/1/99.

Parameters:
aSurfacethe surface to blit to
aXThe destination horizontal location
aYThe destination vertical location
aWidthThe destination width of the pixelmap
aHeightThe destination height of the pixelmap
Returns:
if TRUE, no errors

Implements nsIImage.

Definition at line 287 of file nsImageQt.cpp.

{
    return Draw(aContext, aSurface, 0, 0, mWidth, mHeight, aX, aY, aWidth, aHeight);
}

Here is the caller graph for this function:

NS_IMETHODIMP nsImageQt::Draw ( nsIRenderingContext aContext,
nsIDrawingSurface aSurface,
PRInt32  aSX,
PRInt32  aSY,
PRInt32  aSWidth,
PRInt32  aSHeight,
PRInt32  aDX,
PRInt32  aDY,
PRInt32  aDWidth,
PRInt32  aDHeight 
) [virtual]

BitBlit the nsIImage to a device, the source and dest can be scaled - dwc 2/1/99.

Parameters:
aSurfacethe surface to blit to
aSXThe source width of the pixelmap
aSYThe source vertical location
aSWidthThe source width of the pixelmap
aSHeightThe source height of the pixelmap
aDXThe destination horizontal location
aDYThe destination vertical location
aDWidthThe destination width of the pixelmap
aDHeightThe destination height of the pixelmap
Returns:
if TRUE, no errors

Implements nsIImage.

Definition at line 228 of file nsImageQt.cpp.

{
    // qDebug("draw x = %d, y = %d, w = %d, h = %d, dx = %d, dy = %d, dw = %d, dy = %d",
    //         aSX, aSY, aSWidth, aSHeight, aDX, aDY, aDWidth, aDHeight);
    if (aSWidth <= 0 || aDWidth <= 0 || aSHeight <= 0 || aDHeight <= 0)
      return NS_OK;
    if (nsnull == aSurface) {
        return NS_ERROR_FAILURE;
    }
    if (pixmapDirty)
        updatePixmap();

    nsDrawingSurfaceQt *drawing = (nsDrawingSurfaceQt*)aSurface;

    // The code below seems to be wrong and not what gecko expects.
//     if ((aSWidth != aDWidth || aSHeight != aDHeight)
//         && (aSWidth != mWidth || aSHeight != mHeight)) {
//         QPixmap tmp(aSWidth, aSHeight);
//         copyBlt(&tmp, 0, 0, &pixmap, aSX, aSY, aSWidth, aSHeight);
//         drawing->GetGC()->drawPixmap(aDX, aDY, pixmap, aSX, aSY, aSWidth, aSHeight);
//     }

    nsRect sourceRect(aSX, aSY, aSWidth, aSHeight);
    if (!sourceRect.IntersectRect(sourceRect, mDecodedRect))
        return NS_OK;

    // Now get the part of the image that should be drawn
    // Copy into a new image so we can scale afterwards
    QImage image(pixmap.convertToImage().copy(sourceRect.x, sourceRect.y,
                                              sourceRect.width, sourceRect.height));

    if (image.isNull())
        return NS_ERROR_FAILURE;

    // Find the scale factor
    float w_factor = (float)aDWidth / aSWidth;
    float h_factor = (float)aDHeight / aSHeight;

    // If we had to draw only part of the requested image, must adjust
    // destination coordinates
    aDX += PRInt32((sourceRect.x - aSX) * w_factor);
    aDY += PRInt32((sourceRect.y - aSY) * h_factor);
    image = image.scale(int(sourceRect.width * w_factor), int(sourceRect.height * h_factor));
    drawing->GetGC()->drawImage(QPoint(aDX, aDY), image);

    //drawing->GetGC()->drawPixmap(aDX, aDY, pixmap, aSX, aSY, aSWidth, aSHeight);


    return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsImageQt::DrawTile ( nsIRenderingContext aContext,
nsIDrawingSurface aSurface,
PRInt32  aSXOffset,
PRInt32  aSYOffset,
PRInt32  aPadX,
PRInt32  aPadY,
const nsRect aTileRect 
) [virtual]

Implements nsIImage.

Definition at line 359 of file nsImageQt.cpp.

{
    //qDebug("draw tile");
#if 1
    nsRect aSrcRect(aSXOffset, aSYOffset, mWidth, mHeight);

    nsDrawingSurfaceQt *drawing = (nsDrawingSurfaceQt*)aSurface;

    if (aTileRect.width <= 0 || aTileRect.height <= 0) {
        NS_ASSERTION(aTileRect.width > 0 && aTileRect.height > 0,
                     "Error: image has 0 width or height!");
        return NS_OK;
    }
    if (drawing->GetDepth() == 8 || mAlphaDepth == 8) {
        PRInt32 aY0 = aTileRect.y, aX0 = aTileRect.x;
        PRInt32 aY1 = aTileRect.y + aTileRect.height;
        PRInt32 aX1 = aTileRect.x + aTileRect.width;

        for (PRInt32 y = aY0; y < aY1; y += aSrcRect.height + aPadY)
            for (PRInt32 x = aX0; x < aX1; x += aSrcRect.width + aPadX)
                Draw(aContext, aSurface, x, y, PR_MIN(aSrcRect.width, aX1 - x),
                     PR_MIN(aSrcRect.height, aY1 - y));

        return NS_OK;
    }
#if 0
    // Render unique image bits onto an off screen pixmap only once
    // The image bits can change as a result of ImageUpdated() - for
    // example: animated GIFs.
    if (nsnull == mImagePixmap) {
        CreateImagePixmap();
    }
    if (nsnull == mImagePixmap)
        return NS_ERROR_FAILURE;

    QPixmap qPmap;

    qPmap.convertFromImage(*mImagePixmap);
#endif
    /*qDebug("draw tilePixmap x = %d, y = %d, wid = %d, hei = %d, sx = %d, sy =  %d",
           aTileRect.x, aTileRect.y, aTileRect.width, aTileRect.height,
           aSrcRect.x, aSrcRect.y);*/
    drawing->GetGC()->drawTiledPixmap(aTileRect.x, aTileRect.y,
                                      aTileRect.width, aTileRect.height,
                                      pixmap, aSrcRect.x, aSrcRect.y);
    //qPmap, aSrcRect.x, aSrcRect.y);
#endif
    return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsImageQt::DrawToImage ( nsIImage aDstImage,
PRInt32  aDX,
PRInt32  aDY,
PRInt32  aDWidth,
PRInt32  aDHeight 
) [virtual]

BitBlit the entire (no cropping) nsIImage to another nsImage, the source and dest can be scaled - saari 03/08/01.

Parameters:
aDstImagethe nsImage to blit to
aDXThe destination horizontal location
aDYThe destination vertical location
aDWidthThe destination width of the pixelmap
aDHeightThe destination height of the pixelmap
Returns:
if TRUE, no errors

Implements nsIImage.

Definition at line 441 of file nsImageQt.cpp.

{
    //qDebug("DrawToIMAGE");
  nsImageQt *dest = NS_STATIC_CAST(nsImageQt *, aDstImage);

  if (!dest)
    return NS_ERROR_FAILURE;

  if (aDX >= dest->mWidth || aDY >= dest->mHeight)
    return NS_OK;

  PRUint8 *rgbPtr=0, *alphaPtr=0;
  PRUint32 rgbStride, alphaStride;

  rgbPtr = mImageBits;
  rgbStride = mRowBytes;
  alphaPtr = mAlphaBits;
  alphaStride = mAlphaRowBytes;

  PRInt32 y;
  PRInt32 ValidWidth = ( aDWidth < ( dest->mWidth - aDX ) ) ? aDWidth : ( dest->mWidth - aDX );
  PRInt32 ValidHeight = ( aDHeight < ( dest->mHeight - aDY ) ) ? aDHeight : ( dest->mHeight - aDY );

  // now composite the two images together
  switch (mAlphaDepth) {
  case 1:
    {
      PRUint8 *dst = dest->mImageBits + aDY*dest->mRowBytes + 3*aDX;
      PRUint8 *dstAlpha = dest->mAlphaBits + aDY*dest->mAlphaRowBytes;
      PRUint8 *src = rgbPtr;
      PRUint8 *alpha = alphaPtr;
      PRUint8 offset = aDX & 0x7; // x starts at 0
      int iterations = (ValidWidth+7)/8; // round up

      for (y=0; y<ValidHeight; y++) {
        for (int x=0; x<ValidWidth; x += 8, dst += 3*8, src += 3*8) {
          PRUint8 alphaPixels = *alpha++;
          if (alphaPixels == 0) {
            // all 8 transparent; jump forward
            continue;
          }

          // 1 or more bits are set, handle dstAlpha now - may not be aligned.
          // Are all 8 of these alpha pixels used?
          if (x+7 >= ValidWidth) {
            alphaPixels &= 0xff << (8 - (ValidWidth-x)); // no, mask off unused
            if (alphaPixels == 0)
              continue;  // no 1 alpha pixels left
          }
          if (offset == 0) {
            dstAlpha[(aDX+x)>>3] |= alphaPixels; // the cheap aligned case
          }
          else {
            dstAlpha[(aDX+x)>>3]       |= alphaPixels >> offset;
            // avoid write if no 1's to write - also avoids going past end of array
            PRUint8 alphaTemp = alphaPixels << (8U - offset);
            if (alphaTemp & 0xff)
              dstAlpha[((aDX+x)>>3) + 1] |= alphaTemp;
          }

          if (alphaPixels == 0xff) {
            // fix - could speed up by gathering a run of 0xff's and doing 1 memcpy
            // all 8 pixels set; copy and jump forward
            memcpy(dst,src,8*3);
            continue;
          }
          else {
            // else mix of 1's and 0's in alphaPixels, do 1 bit at a time
            // Don't go past end of line!
            PRUint8 *d = dst, *s = src;
            for (PRUint8 aMask = 1<<7, j = 0; aMask && j < ValidWidth-x; aMask >>= 1, j++) {
              // if this pixel is opaque then copy into the destination image
              if (alphaPixels & aMask) {
                // might be faster with *d++ = *s++ 3 times?
                d[0] = s[0];
                d[1] = s[1];
                d[2] = s[2];
                // dstAlpha bit already set
              }
              d += 3;
              s += 3;
            }
          }
        }
        // at end of each line, bump pointers.  Use wordy code because of
        // bug 127455 to avoid possibility of unsigned underflow
        dst = (dst - 3*8*iterations) + dest->mRowBytes;
        src = (src - 3*8*iterations) + rgbStride;
        alpha = (alpha - iterations) + alphaStride;
        dstAlpha += dest->mAlphaRowBytes;
      }
    }
    break;
  case 0:
  default:
    for (y=0; y<ValidHeight; y++)
      memcpy(dest->mImageBits + (y+aDY)*dest->mRowBytes + 3*aDX,
             rgbPtr + y*rgbStride,
             3*ValidWidth);
  }

  nsRect rect(aDX, aDY, ValidWidth, ValidHeight);
  dest->ImageUpdated(nsnull, 0, &rect);

  return NS_OK;
}

Here is the call graph for this function:

Get a pointer to the bits for the alpha mask - dwc 2/1/99.

Returns:
address of the alpha mask pixel array

Implements nsIImage.

Definition at line 194 of file nsImageQt.cpp.

{
    return mAlphaBits;
}
virtual PRInt8 nsImageQt::GetAlphaDepth ( ) [inline, virtual]

Get the alpha depth for the image mask - lordpixel 2001/05/16.

Returns:
the alpha mask depth for the image, ie, 0, 1 or 8

Implements nsIImage.

Definition at line 104 of file nsImageQt.h.

{ return(mAlphaDepth); }

Get the number of bytes per scanline for the alpha mask - dwc 2/1/99.

Returns:
The number of bytes in each scanline

Implements nsIImage.

Definition at line 199 of file nsImageQt.cpp.

{
    return mAlphaRowBytes;
}
void * nsImageQt::GetBitInfo ( ) [virtual]

Return information about the bits for this structure - dwc 2/1/99.

Returns:
a bitmap info structure for the Device Dependent Bits

Implements nsIImage.

Definition at line 179 of file nsImageQt.cpp.

{
    return nsnull;
}
PRUint8 * nsImageQt::GetBits ( ) [virtual]

Get a pointer to the bits for the pixelmap, only if it is not optimized - dwc 2/1/99.

Returns:
address of the DIB pixel array

Implements nsIImage.

Definition at line 174 of file nsImageQt.cpp.

{
    return mImageBits;
}

Get the number of bytes per pixel for this image - dwc 2/3/99.

Returns:
- the number of bytes per pixel

Implements nsIImage.

Definition at line 420 of file nsImageQt.cpp.

{
    return mNumBytesPixel;
}

Get the colormap for the nsIImage - dwc 2/1/99.

Returns:
if non null, the colormap for the pixelmap,otherwise the image is not color mapped

Implements nsIImage.

Definition at line 189 of file nsImageQt.cpp.

{
    return nsnull;
}
virtual PRBool nsImageQt::GetHasAlphaMask ( ) [inline, virtual]

Get whether this image has an alpha mask.

Preferable to testing if GetAlphaBits() is non-null. - sfraser 10/19/99

Returns:
PR_TRUE if the image has an alpha mask, PR_FALSE otherwise

Implements nsIImage.

Definition at line 71 of file nsImageQt.h.

{return mAlphaBits != nsnull;}

Get the height for the pixelmap - dwc 2/1/99.

Returns:
The height in pixels for the pixelmap

Implements nsIImage.

Definition at line 164 of file nsImageQt.cpp.

{
    return mHeight;
}


See documentation in nsIImage.h

Implements nsIImage.

Definition at line 220 of file nsImageQt.cpp.

                                     {
  return mDecodedRect.x == 0 &&
         mDecodedRect.y == 0 &&
         mDecodedRect.width == mWidth &&
         mDecodedRect.height == mHeight;
}
virtual PRBool nsImageQt::GetIsRowOrderTopToBottom ( ) [inline, virtual]

Get whether rows are organized top to bottom, or bottom to top - syd 3/29/99.

Returns:
PR_TRUE if top to bottom, else PR_FALSE

Implements nsIImage.

Definition at line 66 of file nsImageQt.h.

{return PR_TRUE;}

Get the number of bytes needed to get to the next scanline for the pixelmap - dwc 2/1/99.

Returns:
The number of bytes in each scanline

Implements nsIImage.

Definition at line 184 of file nsImageQt.cpp.

{
    return mRowBytes;
}

Get the width for the pixelmap - dwc 2/1/99.

Returns:
The width in pixels for the pixelmap

Implements nsIImage.

Definition at line 169 of file nsImageQt.cpp.

{
    return mWidth;
}
void nsImageQt::ImageUpdated ( nsIDeviceContext aContext,
PRUint8  aFlags,
nsRect aUpdateRect 
) [virtual]

Update the nsIImage color table - dwc 2/1/99.

Parameters:
aFlagsUsed to pass in parameters for the update
aUpdateRectThe rectangle to update

Implements nsIImage.

Definition at line 207 of file nsImageQt.cpp.

{
    //qDebug("image updated");
    if (IsFlagSet(nsImageUpdateFlags_kBitsChanged,aFlags))
        pixmapDirty = PR_TRUE;

    mDecodedRect.UnionRect(mDecodedRect, *aUpdateRect);
}

Here is the caller graph for this function:

nsresult nsImageQt::Init ( PRInt32  aWidth,
PRInt32  aHeight,
PRInt32  aDepth,
nsMaskRequirements  aMaskRequirements 
) [virtual]
See also:
nsIImage.h

Implements nsIImage.

Definition at line 106 of file nsImageQt.cpp.

{
    qDebug("creating a pixmap with [%d,%d,%d]", aWidth, aHeight, aDepth);
    // gfxImageFrame forces only one nsImageQt::Init
    if (aWidth == 0 || aHeight == 0) {
        return NS_ERROR_FAILURE;
    }

//     if (32 == aDepth) {
//         mNumBytesPixel = 4;
//         mDepth = aDepth;
//     }
//     else
    if (24 == aDepth) {
        mNumBytesPixel = 3;
        mDepth = aDepth;
    }
    else {
        NS_NOTREACHED("unexpected image depth");
        return NS_ERROR_UNEXPECTED;
    }
    mWidth = aWidth;
    mHeight = aHeight;
    mRowBytes = (mWidth*mDepth/8 + 3) & ~0x3;

    switch (aMaskRequirements) {
    case nsMaskRequirements_kNeeds1Bit:
        mAlphaRowBytes = (aWidth + 7) / 8;
        mAlphaDepth = 1;
        // 32-bit align each row
        mAlphaRowBytes = (mAlphaRowBytes + 3) & ~0x3;
        break;

    case nsMaskRequirements_kNeeds8Bit:
        mAlphaRowBytes = aWidth;
        mAlphaDepth = 8;
        // 32-bit align each row
        mAlphaRowBytes = (mAlphaRowBytes + 3) & ~0x3;
        break;
    default:
        mAlphaDepth = 0;
        mAlphaRowBytes = 0;
        break;
    }

    mImageBits = (PRUint8*)new PRUint8[mRowBytes * mHeight];
    mAlphaBits = new PRUint8[mAlphaRowBytes * mHeight];

    pixmapDirty = PR_TRUE;

    PR_LOG(gQtLogModule, QT_BASIC, ("nsImageQt::Init succeeded"));
    return NS_OK;
}
NS_IMETHODIMP nsImageQt::LockImagePixels ( PRBool  aMaskPixels) [virtual]

LockImagePixels Lock the image pixels so that we can access them directly, with safely.

May be a noop on some platforms.

aMaskPixels = PR_TRUE for the mask, PR_FALSE for the image

Must be balanced by a call to UnlockImagePixels().

- sfraser 10/18/99

Returns:
error result

Implements nsIImage.

Definition at line 428 of file nsImageQt.cpp.

{
    return NS_OK;
}
nsresult nsImageQt::Optimize ( nsIDeviceContext aContext) [virtual]

Converted this pixelmap to an optimized pixelmap for the device - dwc 2/1/99.

Parameters:
aContextThe device to optimize for
Returns:
the result of the operation, if NS_OK, then the pixelmap is optimized

Implements nsIImage.

Definition at line 415 of file nsImageQt.cpp.

{
    return NS_OK;
}

UnlockImagePixels Unlock the image pixels.

May be a noop on some platforms.

Should balance an earlier call to LockImagePixels().

aMaskPixels = PR_TRUE for the mask, PR_FALSE for the image

- sfraser 10/18/99

Returns:
error result

Implements nsIImage.

Definition at line 436 of file nsImageQt.cpp.

{
    return NS_OK;
}

Calculate the amount of memory needed for the initialization of the image.

Definition at line 295 of file nsImageQt.cpp.

{
    //qDebug("updatePixmap");
    QImage qimage(mWidth, mHeight, 32);
    const PRInt32 bytesPerPixel = mDepth / 8;
    PRUint8 *image = mImageBits;
    PRUint8 *alpha = mAlphaBits;

    PRInt32 i,j;
    QRgb *line;

    qimage.setAlphaBuffer(mAlphaDepth != 0);
    switch(mAlphaDepth) {
    case 0:
        for (i = 0; i < mHeight; i++) {
            line = (QRgb*)qimage.scanLine(i);

            PRUint8 *imagePtr = image;
            for (j = 0; j < mWidth; j++) {
                line[j] = qRgb(*imagePtr, *(imagePtr+1), *(imagePtr+2));
                imagePtr += bytesPerPixel;
            }
            image += mRowBytes;
        }
        break;
    case 1:
        for (i = 0; i < mHeight; i++) {
            line = (QRgb*)qimage.scanLine(i);

            PRUint8 *imagePtr = image;
            for (j = 0; j < mWidth; j++) {
                uchar a = (alpha[j / 8] & (1 << (7 - (j % 8)))) ? 0xff : 0;
                line[j] = qRgba(*imagePtr, *(imagePtr+1), *(imagePtr+2), a);
                imagePtr += bytesPerPixel;
            }
            image += mRowBytes;
            alpha += mAlphaRowBytes;
        }
        break;
    case 8:
        for (i = 0; i < mHeight; i++) {
            line = (QRgb*)qimage.scanLine(i);

            PRUint8 *imagePtr = image;
            PRUint8 *alphaPtr = alpha;
            for (j = 0; j < mWidth; j++) {
                line[j] = qRgba(*imagePtr, *(imagePtr+1), *(imagePtr+2), *alphaPtr);
                imagePtr += bytesPerPixel;
                alphaPtr++;
            }
            image += mRowBytes;
            alpha += mAlphaRowBytes;
        }
        break;
    }

    pixmap = QPixmap(qimage);

#ifdef CHECK_PIXMAPS
    savePixmap(pixmap);
#endif
    pixmapDirty = PR_FALSE;
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 128 of file nsImageQt.h.

PRInt8 nsImageQt::mAlphaDepth [private]

Definition at line 126 of file nsImageQt.h.

Definition at line 127 of file nsImageQt.h.

Definition at line 133 of file nsImageQt.h.

Definition at line 122 of file nsImageQt.h.

Definition at line 121 of file nsImageQt.h.

Definition at line 124 of file nsImageQt.h.

PRInt8 nsImageQt::mNumBytesPixel [private]

Definition at line 131 of file nsImageQt.h.

Definition at line 123 of file nsImageQt.h.

Definition at line 120 of file nsImageQt.h.

QPixmap nsImageQt::pixmap [private]

Definition at line 135 of file nsImageQt.h.

Definition at line 136 of file nsImageQt.h.


The documentation for this class was generated from the following files: