Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Member Functions | Protected Attributes
nsPrintSurface Class Reference

#include <nsDrawingSurfaceOS2.h>

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

List of all members.

Public Member Functions

 nsPrintSurface ()
virtual ~nsPrintSurface ()
NS_IMETHOD Init (HPS aPS, PRInt32 aWidth, PRInt32 aHeight, PRUint32 aFlags)
NS_IMETHOD Lock (PRInt32 aX, PRInt32 aY, PRUint32 aWidth, PRUint32 aHeight, void **aBits, PRInt32 *aStride, PRInt32 *aWidthBytes, PRUint32 aFlags)
 Lock a rect of a drawing surface and return a pointer to the upper left hand corner of the bitmap.
NS_IMETHOD Unlock ()
 Unlock a rect of a drawing surface.
NS_IMETHOD IsOffscreen (PRBool *aOffScreen)
 Get the offscreen status of the drawing surface.
NS_IMETHOD IsPixelAddressable (PRBool *aAddressable)
 Get the pixel addressability status of the drawing surface.
NS_IMETHOD GetPixelFormat (nsPixelFormat *aFormat)
 Get the pixel format of a drawing surface.
NS_IMETHOD GetDimensions (PRUint32 *aWidth, PRUint32 *aHeight)
 Get the dimensions of a drawing surface.
HPS GetPS ()
void SelectFont (nsFontOS2 *aFont)
void FlushFontCache ()
virtual PRUint32 GetHeight ()
void NS2PM_ININ (const nsRect &in, RECTL &rcl)
void NS2PM_INEX (const nsRect &in, RECTL &rcl)
void PM2NS_ININ (const RECTL &in, nsRect &out)
void NS2PM (PPOINTL aPointl, ULONG cPointls)

Protected Member Functions

NS_DECL_ISUPPORTS void DisposeFonts ()

Protected Attributes

HPS mPS
PRBool mOwnPS
PRInt32 mWidth
PRInt32 mHeight

Detailed Description

Definition at line 175 of file nsDrawingSurfaceOS2.h.


Constructor & Destructor Documentation

Definition at line 607 of file nsDrawingSurfaceOS2.cpp.

{
}

Definition at line 620 of file nsDrawingSurfaceOS2.cpp.

{
   // PS is owned by the DC; superclass dtor will deselect palette.
}

Member Function Documentation

void nsDrawingSurfaceOS2::DisposeFonts ( ) [protected, inherited]

Definition at line 67 of file nsDrawingSurfaceOS2.cpp.

{
   if( mHTFonts)
   {
      // free font things
      GFX (::GpiSetCharSet(mPS, LCID_DEFAULT), FALSE);

      for (int i = LCID_START; i <= mTopID; i++) {
         GFX (::GpiDeleteSetId(mPS, i), FALSE);
      }
      delete mHTFonts;
      mHTFonts = 0;
   }
}

Here is the caller graph for this function:

Definition at line 109 of file nsDrawingSurfaceOS2.cpp.

{
   mHTFonts->Reset();
   mNextID = LCID_START;
   // leave mTopID where it is.
}

Here is the caller graph for this function:

nsresult nsDrawingSurfaceOS2::GetDimensions ( PRUint32 aWidth,
PRUint32 aHeight 
) [virtual, inherited]

Get the dimensions of a drawing surface.

Parameters:
aWidthout parameter for width of drawing surface
aHeightout parameter for height of drawing surface
Returns:
error status

Implements nsIDrawingSurface.

Reimplemented in nsWindowSurface.

Definition at line 159 of file nsDrawingSurfaceOS2.cpp.

{
   if( !aWidth || !aHeight)
      return NS_ERROR_NULL_POINTER;

   *aWidth = mWidth;
   *aHeight = mHeight;

   return NS_OK;
}

Here is the caller graph for this function:

virtual PRUint32 nsDrawingSurfaceOS2::GetHeight ( ) [inline, virtual, inherited]

Reimplemented in nsWindowSurface.

Definition at line 96 of file nsDrawingSurfaceOS2.h.

{ return mHeight; }

Here is the caller graph for this function:

nsresult nsOnscreenSurface::GetPixelFormat ( nsPixelFormat aFormat) [virtual, inherited]

Get the pixel format of a drawing surface.

Parameters:
aOffscreenout parameter filled in with pixel format information.
Returns:
error status

Implements nsIDrawingSurface.

Definition at line 525 of file nsDrawingSurfaceOS2.cpp.

{
   EnsureProxy();
   return mProxySurface->GetPixelFormat( aFormat);
}

Here is the call graph for this function:

HPS nsDrawingSurfaceOS2::GetPS ( ) [inline, inherited]

Definition at line 93 of file nsDrawingSurfaceOS2.h.

{ return mPS; }

Here is the caller graph for this function:

nsresult nsPrintSurface::Init ( HPS  aPS,
PRInt32  aWidth,
PRInt32  aHeight,
PRUint32  aFlags 
)

Definition at line 611 of file nsDrawingSurfaceOS2.cpp.

{
   mPS = aPS;
   mHeight = aHeight;
   mWidth = aWidth;

   return NS_OK;
}

Here is the caller graph for this function:

nsresult nsOnscreenSurface::IsOffscreen ( PRBool aOffScreen) [virtual, inherited]

Get the offscreen status of the drawing surface.

Parameters:
aOffscreenout parameter for offscreen status of drawing surface. if PR_TRUE, then modifying the drawing surface does not immediately reflect the changes on the output device
Returns:
error status

Implements nsIDrawingSurface.

Definition at line 531 of file nsDrawingSurfaceOS2.cpp.

{
   if( !aOffScreen)
      return NS_ERROR_NULL_POINTER;

   *aOffScreen = PR_FALSE;

   return NS_OK;
}
nsresult nsOnscreenSurface::IsPixelAddressable ( PRBool aAddressable) [virtual, inherited]

Get the pixel addressability status of the drawing surface.

Parameters:
aAddressableout parameter for pixel addressability status of drawing surface. if PR_TRUE, then the drawing surface is optimized for pixel addressability (i.e. the Lock() method has very low overhead). All drawing surfaces support Lock()ing, but doing so on drawing surfaces that do not return PR_TRUE here may impose significant overhead.
Returns:
error status

Implements nsIDrawingSurface.

Definition at line 541 of file nsDrawingSurfaceOS2.cpp.

{
   if( !aAddressable)
      return NS_ERROR_NULL_POINTER;

   *aAddressable = PR_FALSE;

   return NS_OK;
}
nsresult nsOnscreenSurface::Lock ( PRInt32  aX,
PRInt32  aY,
PRUint32  aWidth,
PRUint32  aHeight,
void **  aBits,
PRInt32 aStride,
PRInt32 aWidthBytes,
PRUint32  aFlags 
) [virtual, inherited]

Lock a rect of a drawing surface and return a pointer to the upper left hand corner of the bitmap.

Parameters:
aXx position of subrect of bitmap
aYy position of subrect of bitmap
aWidthwidth of subrect of bitmap
aHeightheight of subrect of bitmap
aBitsout parameter for upper left hand corner of bitmap
aStrideout parameter for number of bytes to add to aBits to go from scanline to scanline
aWidthBytesout parameter for number of bytes per line in aBits to process aWidth pixels
Returns:
error status

Implements nsIDrawingSurface.

Definition at line 488 of file nsDrawingSurfaceOS2.cpp.

{
   EnsureProxy();

#ifdef DEBUG
   printf( "Locking through a proxy\n");
#endif

   // blit our 'real' bitmap to the proxy surface
   PRUint32 width, height;
   GetDimensions( &width, &height);
   POINTL pts[3] = { { 0, 0 }, { width, height }, { 0, 0 } };
   GFX (::GpiBitBlt (mProxySurface->GetPS (), mPS, 3, pts,
                     ROP_SRCCOPY, BBO_OR), GPI_ERROR);

   return mProxySurface->Lock( aX, aY, aWidth, aHeight,
                               aBits, aStride, aWidthBytes, aFlags);
}

Here is the call graph for this function:

void nsDrawingSurfaceOS2::NS2PM ( PPOINTL  aPointl,
ULONG  cPointls 
) [inherited]

Definition at line 151 of file nsDrawingSurfaceOS2.cpp.

{
   PRInt32 ulHeight = GetHeight ();

   for( ULONG i = 0; i < cPointls; i++)
      aPointl[ i].y = ulHeight - aPointl[ i].y - 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsDrawingSurfaceOS2::NS2PM_INEX ( const nsRect in,
RECTL &  rcl 
) [inherited]

Definition at line 144 of file nsDrawingSurfaceOS2.cpp.

{
   NS2PM_ININ( in, rcl);
   rcl.xRight++;
   rcl.yTop++;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsDrawingSurfaceOS2::NS2PM_ININ ( const nsRect in,
RECTL &  rcl 
) [inherited]

Definition at line 119 of file nsDrawingSurfaceOS2.cpp.

{
   const static nscoord kBottomLeftLimit = -8192;
   const static nscoord kTopRightLimit   =  16384;

   PRInt32 ulHeight = GetHeight ();

   rcl.xLeft    = PR_MAX(kBottomLeftLimit, in.x);
   rcl.xRight   = PR_MIN(in.x+in.width-1, kTopRightLimit);
   rcl.yTop     = PR_MIN(ulHeight-in.y-1, kTopRightLimit);
   rcl.yBottom  = PR_MAX(rcl.yTop-in.height+1, kBottomLeftLimit);
   return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsDrawingSurfaceOS2::PM2NS_ININ ( const RECTL &  in,
nsRect out 
) [inherited]

Definition at line 133 of file nsDrawingSurfaceOS2.cpp.

{
   PRInt32 ulHeight = GetHeight ();

   out.x = in.xLeft;
   out.width = in.xRight - in.xLeft + 1;
   out.y = ulHeight - in.yTop - 1;
   out.height = in.yTop - in.yBottom + 1;
}

Here is the call graph for this function:

Definition at line 85 of file nsDrawingSurfaceOS2.cpp.

{
   FontHandleKey key((void*)aFont->mHashMe);

   long lcid = (long) mHTFonts->Get(&key);
   if (lcid == 0) {
      if (mNextID == 255) {
         // ids used up, need to empty table and start again.
         FlushFontCache();
      }

      lcid = mNextID;
      mNextID++;
      CHK_SUCCESS (::GpiCreateLogFont(mPS, 0, lcid, &aFont->mFattrs),
                   FONT_MATCH);
      mHTFonts->Put(&key, (void *) lcid);
      if (mTopID < 254) {
         mTopID++;
      }
   }

   aFont->SelectIntoPS(mPS, lcid);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsOnscreenSurface::Unlock ( ) [virtual, inherited]

Unlock a rect of a drawing surface.

must be preceded by a call to Lock(). Lock()/Unlock() pairs do not nest.

Returns:
error status

Implements nsIDrawingSurface.

Definition at line 511 of file nsDrawingSurfaceOS2.cpp.

{
   nsresult rc = mProxySurface->Unlock();

   // blit proxy bitmap back to ours
   PRUint32 width, height;
   GetDimensions( &width, &height);
   POINTL pts[3] = { { 0, 0 }, { width, height }, { 0, 0 } };
   GFX (::GpiBitBlt (mPS, mProxySurface->GetPS (), 3, pts,
                     ROP_SRCCOPY, BBO_OR), GPI_ERROR);

   return rc;
}

Here is the call graph for this function:


Member Data Documentation

PRInt32 nsDrawingSurfaceOS2::mHeight [protected, inherited]

Definition at line 78 of file nsDrawingSurfaceOS2.h.

PRBool nsDrawingSurfaceOS2::mOwnPS [protected, inherited]

Definition at line 76 of file nsDrawingSurfaceOS2.h.

HPS nsDrawingSurfaceOS2::mPS [protected, inherited]

Definition at line 75 of file nsDrawingSurfaceOS2.h.

PRInt32 nsDrawingSurfaceOS2::mWidth [protected, inherited]

Definition at line 77 of file nsDrawingSurfaceOS2.h.


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