Back to index

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

#include <nsRenderingContextPS.h>

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

List of all members.

Public Member Functions

 nsRenderingContextPS ()
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
virtual ~nsRenderingContextPS ()
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD Init (nsIDeviceContext *aContext)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD Init (nsIDeviceContext *aContext, nsIWidget *aWidget)
 Initialize the RenderingContext.
NS_IMETHOD Init (nsIDeviceContext *aContext, nsIDrawingSurface *aSurface)
 Initialize the RenderingContext.
NS_IMETHOD Reset (void)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD GetDeviceContext (nsIDeviceContext *&aContext)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD LockDrawingSurface (PRInt32 aX, PRInt32 aY, PRUint32 aWidth, PRUint32 aHeight, void **aBits, PRInt32 *aStride, PRInt32 *aWidthBytes, PRUint32 aFlags)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD UnlockDrawingSurface (void)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD SelectOffScreenDrawingSurface (nsIDrawingSurface *aSurface)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD GetDrawingSurface (nsIDrawingSurface **aSurface)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD GetHints (PRUint32 &aResult)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD PushState (void)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD PopState (void)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD IsVisibleRect (const nsRect &aRect, PRBool &aClipState)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD SetClipRect (const nsRect &aRect, nsClipCombine aCombine)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD GetClipRect (nsRect &aRect, PRBool &aClipState)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD SetClipRegion (const nsIRegion &aRegion, nsClipCombine aCombine)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD CopyClipRegion (nsIRegion &aRegion)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD GetClipRegion (nsIRegion **aRegion)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD SetLineStyle (nsLineStyle aLineStyle)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD GetLineStyle (nsLineStyle &aLineStyle)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD SetColor (nscolor aColor)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD GetColor (nscolor &aColor) const
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD SetFont (const nsFont &aFont, nsIAtom *aLangGroup)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD SetFont (nsIFontMetrics *aFontMetrics)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD GetFontMetrics (nsIFontMetrics *&aFontMetrics)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD Translate (nscoord aX, nscoord aY)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD Scale (float aSx, float aSy)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD GetCurrentTransform (nsTransform2D *&aTransform)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD CreateDrawingSurface (const nsRect &aBounds, PRUint32 aSurfFlags, nsIDrawingSurface *&aSurface)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD DestroyDrawingSurface (nsIDrawingSurface *aDS)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD DrawLine (nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD DrawPolyline (const nsPoint aPoints[], PRInt32 aNumPoints)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD DrawRect (const nsRect &aRect)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD DrawRect (nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD FillRect (const nsRect &aRect)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD FillRect (nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD InvertRect (const nsRect &aRect)
 XOR Invert a rectangle in the current foreground color.
NS_IMETHOD InvertRect (nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
 XOR Invert a rectangle in the current foreground color.
NS_IMETHOD DrawPolygon (const nsPoint aPoints[], PRInt32 aNumPoints)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD FillPolygon (const nsPoint aPoints[], PRInt32 aNumPoints)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD DrawEllipse (const nsRect &aRect)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD DrawEllipse (nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD FillEllipse (const nsRect &aRect)
 Fill an ellipse in the current foreground color.
NS_IMETHOD FillEllipse (nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD DrawArc (const nsRect &aRect, float aStartAngle, float aEndAngle)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD DrawArc (nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight, float aStartAngle, float aEndAngle)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD FillArc (const nsRect &aRect, float aStartAngle, float aEndAngle)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD FillArc (nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight, float aStartAngle, float aEndAngle)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD GetWidth (char aC, nscoord &aWidth)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD GetWidth (PRUnichar aC, nscoord &aWidth, PRInt32 *aFontID)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD GetWidth (const nsString &aString, nscoord &aWidth, PRInt32 *aFontID)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD GetWidth (const char *aString, nscoord &aWidth)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD GetWidth (const char *aString, PRUint32 aLength, nscoord &aWidth)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD GetWidth (const PRUnichar *aString, PRUint32 aLength, nscoord &aWidth, PRInt32 *aFontID)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD DrawString (const char *aString, PRUint32 aLength, nscoord aX, nscoord aY, const nscoord *aSpacing)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD DrawString (const PRUnichar *aString, PRUint32 aLength, nscoord aX, nscoord aY, PRInt32 aFontID, const nscoord *aSpacing)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD DrawString (const nsString &aString, nscoord aX, nscoord aY, PRInt32 aFontID, const nscoord *aSpacing)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD GetTextDimensions (const char *aString, PRUint32 aLength, nsTextDimensions &aDimensions)
 Returns the dimensions of a string, i.e., the overall extent of a string whose rendering may involve switching between different fonts that have different metrics.
NS_IMETHOD GetTextDimensions (const PRUnichar *aString, PRUint32 aLength, nsTextDimensions &aDimensions, PRInt32 *aFontID)
NS_IMETHOD GetTextDimensions (const char *aString, PRInt32 aLength, PRInt32 aAvailWidth, PRInt32 *aBreaks, PRInt32 aNumBreaks, nsTextDimensions &aDimensions, PRInt32 &aNumCharsFit, nsTextDimensions &aLastWordDimensions, PRInt32 *aFontID=nsnull)
 

NS_IMETHOD GetTextDimensions (const PRUnichar *aString, PRInt32 aLength, PRInt32 aAvailWidth, PRInt32 *aBreaks, PRInt32 aNumBreaks, nsTextDimensions &aDimensions, PRInt32 &aNumCharsFit, nsTextDimensions &aLastWordDimensions, PRInt32 *aFontID=nsnull)
NS_IMETHOD DrawImage (imgIContainer *aImage, const nsRect &aSrcRect, const nsRect &aDestRect)
 Draw a portion of an image, scaling it to fit a specified rect.
NS_IMETHOD DrawTile (imgIContainer *aImage, nscoord aXImageStart, nscoord aYImageStart, const nsRect *aTargetRect)
NS_IMETHOD CopyOffScreenBits (nsIDrawingSurface *aSrcSurf, PRInt32 aSrcX, PRInt32 aSrcY, const nsRect &aDestBounds, PRUint32 aCopyFlags)
 
See documentation in nsIRenderingContext.h 12/21/98 dwc
NS_IMETHOD RetrieveCurrentNativeGraphicData (void **ngd)
void PostscriptFont (nscoord aHeight, PRUint8 aStyle, PRUint8 aVariant, PRUint16 aWeight, PRUint8 decorations)
 
Set the current postscript font 12/21/98 dwc
nsPostScriptObj * GetPostScriptObj ()
NS_IMETHOD RenderEPS (const nsRect &aRect, FILE *aDataFile)
 
Output an encapsulated postscript file to the print job.
NS_IMETHOD FlushRect (const nsRect &aRect)
 For platforms (e.g., Cocoa) that implicitly double buffer, this call can be used to force a buffer flush following the painting of a rectangle.
NS_IMETHOD FlushRect (nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
NS_IMETHOD GetPenMode (nsPenMode &aPenMode)
 Gets the Pen Mode for the RenderingContext.
NS_IMETHOD SetPenMode (nsPenMode aPenMode)
 Sets the Pen Mode for the RenderingContext.
NS_IMETHOD GetBackbuffer (const nsRect &aRequestedSize, const nsRect &aMaxSize, PRBool aForBlending, nsIDrawingSurface *&aBackbuffer)
 Get a drawing surface used as a backbuffer.
NS_IMETHOD ReleaseBackbuffer (void)
 Release a drawing surface used as the backbuffer If the platform caches the backbuffer this call will destroy it.
NS_IMETHOD DestroyCachedBackbuffer (void)
 Destroy the drawing surface used as the backbuffer.
NS_IMETHOD UseBackbuffer (PRBool *aUseBackbuffer)
 Some platforms may not want a backbuffer at all.
NS_IMETHOD PushTranslation (PushedTranslation *aState)
NS_IMETHOD PopTranslation (PushedTranslation *aState)
virtual PRInt32 GetMaxStringLength ()
 Return the maximum length of a string that can be handled by the platform using the current font metrics.
NS_IMETHOD SetRightToLeftText (PRBool aIsRTL)
 Let the device context know whether we want text reordered with right-to-left base direction.
NS_IMETHOD GetRightToLeftText (PRBool *aIsRTL)
NS_IMETHOD GetClusterInfo (const PRUnichar *aText, PRUint32 aLength, PRUint8 *aClusterStarts)
 Get cluster details for a chunk of text.
virtual PRInt32 GetPosition (const PRUnichar *aText, PRUint32 aLength, nsPoint aPt)
 Find the closest cursor position for a given x coordinate.
NS_IMETHOD GetRangeWidth (const PRUnichar *aText, PRUint32 aLength, PRUint32 aStart, PRUint32 aEnd, PRUint32 &aWidth)
 Get the width for the specific range of a given string.
NS_IMETHOD GetRangeWidth (const char *aText, PRUint32 aLength, PRUint32 aStart, PRUint32 aEnd, PRUint32 &aWidth)
 Get the width for the specific range of a given string.
NS_IMETHOD GetWidthInternal (const char *aString, PRUint32 aLength, nscoord &aWidth)
NS_IMETHOD GetWidthInternal (const PRUnichar *aString, PRUint32 aLength, nscoord &aWidth, PRInt32 *aFontID=nsnull)
NS_IMETHOD GetTextDimensionsInternal (const char *aString, PRUint32 aLength, nsTextDimensions &aDimensions)
NS_IMETHOD GetTextDimensionsInternal (const PRUnichar *aString, PRUint32 aLength, nsTextDimensions &aDimensions, PRInt32 *aFontID=nsnull)
NS_IMETHOD DrawStringInternal (const char *aString, PRUint32 aLength, nscoord aX, nscoord aY, const nscoord *aSpacing=nsnull)
NS_IMETHOD DrawStringInternal (const PRUnichar *aString, PRUint32 aLength, nscoord aX, nscoord aY, PRInt32 aFontID=-1, const nscoord *aSpacing=nsnull)

Protected Member Functions

PRInt32 DrawString (const PRUnichar *aString, PRUint32 aLength, nscoord aX, nscoord aY, nsFontPS *aFontPS, const nscoord *aSpacing)
PRInt32 DrawString (const char *aString, PRUint32 aLength, nscoord &aX, nscoord &aY, nsFontPS *aFontPS, const nscoord *aSpacing)
PRBool RectFitsInside (const nsRect &aRect, PRInt32 aWidth, PRInt32 aHeight) const
 Determine if a rect's width and height will fit within a specified width and height.
PRBool BothRectsFitInside (const nsRect &aRect1, const nsRect &aRect2, PRInt32 aWidth, PRInt32 aHeight, nsRect &aNewSize) const
 Determine if two rectangles width and height will fit within a specified width and height.
void CalculateDiscreteSurfaceSize (const nsRect &aMaxBackbufferSize, const nsRect &aRequestedSize, nsRect &aSize)
 Return an offscreen surface size from a set of discrete surface sizes.
void GetDrawingSurfaceSize (const nsRect &aMaxBackbufferSize, const nsRect &aRequestedSize, nsRect &aSurfaceSize)
 Get the size of the offscreen drawing surface.
nsresult AllocateBackbuffer (const nsRect &aRequestedSize, const nsRect &aMaxSize, nsIDrawingSurface *&aBackbuffer, PRBool aCacheBackbuffer, PRUint32 aSurfFlags)
 Utility method used to implement NS_IMETHOD GetBackbuffer.

Protected Attributes

nsCOMPtr< nsIDeviceContextmContext
nsCOMPtr< nsIFontMetricsmFontMetrics
nsLineStyle mCurrLineStyle
PS_StatemStates
nsVoidArraymStateCache
float mP2T
nscolor mCurrentColor
PRUint8mGammaTable
nsPostScriptObj * mPSObj
nsTransform2D * mTranMatrix
int mAct
EdgemActive
nsPenMode mPenMode

Private Member Functions

nsresult CommonInit (void)
void PushClipState (void)

Detailed Description

Definition at line 60 of file nsRenderingContextPS.h.


Constructor & Destructor Documentation


See documentation in nsIRenderingContext.h 12/21/98 dwc

Definition at line 143 of file nsRenderingContextPS.cpp.

{
  mPSObj = nsnull;     // local copy of printcontext, will be set on the init process
  mContext = nsnull;
  mFontMetrics = nsnull;

  mStateCache = new nsVoidArray();

  mP2T = 1.0f;

  PushState();
}

Here is the call graph for this function:


See documentation in nsIRenderingContext.h 12/21/98 dwc

Definition at line 160 of file nsRenderingContextPS.cpp.

{
  if (mStateCache){
    PRInt32 cnt = mStateCache->Count();

    while (--cnt >= 0){
      PS_State *state = (PS_State *)mStateCache->ElementAt(cnt);
      mStateCache->RemoveElementAt(cnt);

      if (state)
        delete state;
    }

    delete mStateCache;
    mStateCache = nsnull;
  }

  mTranMatrix = nsnull;
}

Member Function Documentation

nsresult nsRenderingContextImpl::AllocateBackbuffer ( const nsRect aRequestedSize,
const nsRect aMaxSize,
nsIDrawingSurface *&  aBackbuffer,
PRBool  aCacheBackbuffer,
PRUint32  aSurfFlags 
) [protected, inherited]

Utility method used to implement NS_IMETHOD GetBackbuffer.

Parameters:
aRequestedSizesize of the backbuffer area requested
aMaxSizemaximum size that may be requested for the backbuffer
aBackbufferdrawing surface used as the backbuffer
aCacheBackbufferPR_TRUE then the backbuffer will be cached, if PR_FALSE it is created each time
aSurfFlagsflags passed to CreateDrawingSurface()

Definition at line 86 of file nsRenderingContextImpl.cpp.

{
  nsRect newBounds;
  nsresult rv = NS_OK;

   if (! aCacheBackbuffer) {
    newBounds = aRequestedSize;
  } else {
    GetDrawingSurfaceSize(aMaxSize, aRequestedSize, newBounds);
  }

  if ((nsnull == gBackbuffer)
      || (gBackbufferBounds.width != newBounds.width)
      || (gBackbufferBounds.height != newBounds.height))
    {
      if (gBackbuffer) {
        //destroy existing DS
        DestroyDrawingSurface(gBackbuffer);
        gBackbuffer = nsnull;
      }

      rv = CreateDrawingSurface(newBounds, aSurfFlags, gBackbuffer);
      //   printf("Allocating a new drawing surface %d %d\n", newBounds.width, newBounds.height);
      if (NS_SUCCEEDED(rv)) {
        gBackbufferBounds = newBounds;
        SelectOffScreenDrawingSurface(gBackbuffer);
      } else {
        gBackbufferBounds.SetRect(0,0,0,0);
        gBackbuffer = nsnull;
      }
    } else {
      SelectOffScreenDrawingSurface(gBackbuffer);

      float p2t;
      nsCOMPtr<nsIDeviceContext>  dx;
      GetDeviceContext(*getter_AddRefs(dx));
      p2t = dx->DevUnitsToAppUnits();
      nsRect bounds = aRequestedSize;
      bounds *= p2t;

      SetClipRect(bounds, nsClipCombine_kReplace);
    }

  aBackbuffer = gBackbuffer;
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsRenderingContextImpl::BothRectsFitInside ( const nsRect aRect1,
const nsRect aRect2,
PRInt32  aWidth,
PRInt32  aHeight,
nsRect aNewSize 
) const [protected, inherited]

Determine if two rectangles width and height will fit within a specified width and height.

Parameters:
aRect1first rectangle to test
aRect1second rectangle to test
aWidthwidth to determine if both rectangle's width will fit within
aHeightheight to determine if both rectangles height will fit within
Returns:
PR_TRUE if the rect1's and rect2's width and height fits with aWidth, aHeight, PR_FALSE otherwise.

Definition at line 199 of file nsRenderingContextImpl.cpp.

{
  if (PR_FALSE == RectFitsInside(aRect1, aWidth, aHeight)) {
    return PR_FALSE;
  }

  if (PR_FALSE == RectFitsInside(aRect2, aWidth, aHeight)) {
    return PR_FALSE;
  }

  aNewSize.width = aWidth;
  aNewSize.height = aHeight;

  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsRenderingContextImpl::CalculateDiscreteSurfaceSize ( const nsRect aMaxBackbufferSize,
const nsRect aRequestedSize,
nsRect aSize 
) [protected, inherited]

Return an offscreen surface size from a set of discrete surface sizes.

The smallest discrete surface size that can enclose both the Maximum widget size (

See also:
GetMaxWidgetBounds) and the requested size is returned.
Parameters:
aMaxBackbufferSizeMaximum size that may be requested for the backbuffer
aRequestedSizeRequested size for the offscreen.
aSurfaceSizecontains the surface size

Definition at line 221 of file nsRenderingContextImpl.cpp.

{
  // Get the height and width of the screen
  PRInt32 height;
  PRInt32 width;

  nsCOMPtr<nsIDeviceContext>  dx;
  GetDeviceContext(*getter_AddRefs(dx));
  dx->GetDeviceSurfaceDimensions(width, height);

  float devUnits;
  devUnits = dx->DevUnitsToAppUnits();
  PRInt32 screenHeight = NSToIntRound(float( height) / devUnits );
  PRInt32 screenWidth = NSToIntRound(float( width) / devUnits );

  // These tests must go from smallest rectangle to largest rectangle.

  // 1/8 screen
  if (BothRectsFitInside(aRequestedSize, aMaxBackbufferSize, screenWidth / 8, screenHeight / 8, aSurfaceSize)) {
    return;
  }

  // 1/4 screen
  if (BothRectsFitInside(aRequestedSize, aMaxBackbufferSize, screenWidth / 4, screenHeight / 4, aSurfaceSize)) {
    return;
  }

  // 1/2 screen
  if (BothRectsFitInside(aRequestedSize, aMaxBackbufferSize, screenWidth / 2, screenHeight / 2, aSurfaceSize)) {
    return;
  }

  // 3/4 screen
  if (BothRectsFitInside(aRequestedSize, aMaxBackbufferSize, (screenWidth * 3) / 4, (screenHeight * 3) / 4, aSurfaceSize)) {
    return;
  }

  // 3/4 screen width full screen height
  if (BothRectsFitInside(aRequestedSize, aMaxBackbufferSize, (screenWidth * 3) / 4, screenHeight, aSurfaceSize)) {
    return;
  }

  // Full screen
  if (BothRectsFitInside(aRequestedSize, aMaxBackbufferSize, screenWidth, screenHeight, aSurfaceSize)) {
    return;
  }

  // Bigger than Full Screen use the largest request every made.
  if (BothRectsFitInside(aRequestedSize, aMaxBackbufferSize, gLargestRequestedSize.width, gLargestRequestedSize.height, aSurfaceSize)) {
    return;
  } else {
    gLargestRequestedSize.width = PR_MAX(aRequestedSize.width, aMaxBackbufferSize.width);
    gLargestRequestedSize.height = PR_MAX(aRequestedSize.height, aMaxBackbufferSize.height);
    aSurfaceSize.width = gLargestRequestedSize.width;
    aSurfaceSize.height = gLargestRequestedSize.height;
    //   printf("Expanding the largested requested size to %d %d\n", gLargestRequestedSize.width, gLargestRequestedSize.height);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 433 of file nsRenderingContextPS.cpp.

{
  //XXX wow, needs to do something.
  return NS_OK; 
}
NS_IMETHODIMP nsRenderingContextPS::CopyOffScreenBits ( nsIDrawingSurface aSrcSurf,
PRInt32  aSrcX,
PRInt32  aSrcY,
const nsRect aDestBounds,
PRUint32  aCopyFlags 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 1371 of file nsRenderingContextPS.cpp.

{
  return NS_OK;
}
NS_IMETHODIMP nsRenderingContextPS::CreateDrawingSurface ( const nsRect aBounds,
PRUint32  aSurfFlags,
nsIDrawingSurface *&  aSurface 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 571 of file nsRenderingContextPS.cpp.

{
  return NS_OK;   // offscreen test
}

Destroy the drawing surface used as the backbuffer.

If the platform does not maintain a cached backbuffer this call will do nothing.

Implements nsIRenderingContext.

Definition at line 140 of file nsRenderingContextImpl.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 581 of file nsRenderingContextPS.cpp.

{
  return NS_OK;   // offscreen test
}
NS_IMETHODIMP nsRenderingContextPS::DrawArc ( const nsRect aRect,
float  aStartAngle,
float  aEndAngle 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 857 of file nsRenderingContextPS.cpp.

{
  return DrawArc(aRect.x,aRect.y,aRect.width,aRect.height,aStartAngle,aEndAngle);
}
NS_IMETHODIMP nsRenderingContextPS::DrawArc ( nscoord  aX,
nscoord  aY,
nscoord  aWidth,
nscoord  aHeight,
float  aStartAngle,
float  aEndAngle 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 868 of file nsRenderingContextPS.cpp.

{
  if (nsLineStyle_kNone == mCurrLineStyle)
    return NS_OK;

  //SetupPen();
  mTranMatrix->TransformCoord(&aX, &aY, &aWidth, &aHeight);

  mPSObj->comment("arc");
  mPSObj->newpath();
  mPSObj->moveto(aX, aY);
  mPSObj->arc(aWidth, aHeight, aStartAngle, aEndAngle);
  mPSObj->closepath();
  mPSObj->stroke();

  return NS_OK;
}


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 800 of file nsRenderingContextPS.cpp.

{
  return DrawEllipse(aRect.x, aRect.y, aRect.width, aRect.height);
}
NS_IMETHODIMP nsRenderingContextPS::DrawEllipse ( nscoord  aX,
nscoord  aY,
nscoord  aWidth,
nscoord  aHeight 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 810 of file nsRenderingContextPS.cpp.

{
  if (nsLineStyle_kNone == mCurrLineStyle)
    return NS_OK;

  //SetupPen();
  mTranMatrix->TransformCoord(&aX, &aY, &aWidth, &aHeight);

  mPSObj->comment("ellipse");
  mPSObj->newpath();
  mPSObj->moveto(aX, aY);
  mPSObj->arc(aWidth, aHeight, 0.0, 360.0);
  mPSObj->closepath();
  mPSObj->stroke();

  return NS_OK;
}
NS_IMETHODIMP nsRenderingContextPS::DrawImage ( imgIContainer aImage,
const nsRect aSrcRect,
const nsRect aDestRect 
) [virtual]

Draw a portion of an image, scaling it to fit a specified rect.

Parameters:
aImageThe image to draw
aSrcRectThe rect (in twips) of the image to draw. [x,y] denotes the top left corner of the region.
aDestRectThe device context rect (in twips) that the image portion should occupy. [x,y] denotes the top left corner. [height,width] denotes the desired image size.

Reimplemented from nsRenderingContextImpl.

Definition at line 1250 of file nsRenderingContextPS.cpp.

{
  // Transform the destination rectangle.
  nsRect dr = aDestRect;
  mTranMatrix->TransformCoord(&dr.x, &dr.y, &dr.width, &dr.height);

  // Transform the source rectangle. We don't use the matrix for this;
  // just convert the twips back into points.
  nsRect sr = aSrcRect;
  sr.x /= TWIPS_PER_POINT_INT;
  sr.y /= TWIPS_PER_POINT_INT;
  sr.width /= TWIPS_PER_POINT_INT;
  sr.height /= TWIPS_PER_POINT_INT;

  nsCOMPtr<gfxIImageFrame> iframe;
  aImage->GetCurrentFrame(getter_AddRefs(iframe));
  if (!iframe) return NS_ERROR_FAILURE;

  nsCOMPtr<nsIImage> img(do_GetInterface(iframe));
  if (!img) return NS_ERROR_FAILURE;

  nsRect ir;
  iframe->GetRect(ir);
  mPSObj->draw_image(img, sr, ir, dr);
  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsRenderingContextPS::DrawLine ( nscoord  aX0,
nscoord  aY0,
nscoord  aX1,
nscoord  aY1 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 591 of file nsRenderingContextPS.cpp.

{
  if (nsLineStyle_kNone == mCurrLineStyle)
    return NS_OK;

  // Layout expects lines to be one scaled pixel wide.
  float scale;
  NS_REINTERPRET_CAST(DeviceContextImpl *, mContext.get())->GetCanonicalPixelScale(scale);
  int width = NSToCoordRound(TWIPS_PER_POINT_FLOAT * scale);

  // If this line is vertical (horizontal), the geometric line defined
  // by our start and end points is actually the left edge (top edge)
  // of the line that should appear on the page.
  if (aX0 == aX1) {
    // Vertical. For better control we draw this as a filled
    // rectangle instead of a stroked line.
    return FillRect(aX0, aY0, width, aY1 - aY0);
  }
  else if (aY0 == aY1) {
    // Horizontal.
    return FillRect(aX0, aY0, aX1 - aX0, width);
  }
  else {
    // Angled line. Just stroke it.
    mTranMatrix->TransformCoord(&aX0,&aY0);
    mTranMatrix->TransformCoord(&aX1,&aY1);
    mPSObj->line(aX0, aY0, aX1, aY1, width);
    return NS_OK;
  }
}

Here is the call graph for this function:

NS_IMETHODIMP nsRenderingContextPS::DrawPolygon ( const nsPoint  aPoints[],
PRInt32  aNumPoints 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 728 of file nsRenderingContextPS.cpp.

{
const nsPoint*  np;
nsPoint         pp;

  mPSObj->newpath();

  // point np to the polypoints
  np = &aPoints[0];

  // do the initial moveto
       pp.x = np->x;
       pp.y = np->y;
  mTranMatrix->TransformCoord(&pp.x, &pp.y);
  mPSObj->moveto(pp.x, pp.y);
  np++;

  // add all the points to the path
       for (PRInt32 i = 1; i < aNumPoints; i++, np++){
              pp.x = np->x;
              pp.y = np->y;
                mTranMatrix->TransformCoord(&pp.x, &pp.y);
                mPSObj->lineto(pp.x, pp.y);
       }

  mPSObj->closepath();
  mPSObj->stroke();

  return NS_OK;
}
NS_IMETHODIMP nsRenderingContextPS::DrawPolyline ( const nsPoint  aPoints[],
PRInt32  aNumPoints 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 627 of file nsRenderingContextPS.cpp.

{

const nsPoint*  np;
nsPoint         pp;

  // First transform nsPoint's into POINT's; perform coordinate space
  // transformation at the same time
  np = &aPoints[0];

  pp.x = np->x;
  pp.y = np->y;
  mTranMatrix->TransformCoord(&pp.x, &pp.y);
  mPSObj->moveto(pp.x, pp.y);
  np++;

  // we are ignoring the linestyle
       for (PRInt32 i = 1; i < aNumPoints; i++, np++){
              pp.x = np->x;
              pp.y = np->y;
                mTranMatrix->TransformCoord(&pp.x, &pp.y);
                mPSObj->lineto(pp.x, pp.y);
       }

  // we dont close the path, this will give us a polyline
  mPSObj->stroke();

  return NS_OK;
}


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 662 of file nsRenderingContextPS.cpp.

{
  return DrawRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
NS_IMETHODIMP nsRenderingContextPS::DrawRect ( nscoord  aX,
nscoord  aY,
nscoord  aWidth,
nscoord  aHeight 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 672 of file nsRenderingContextPS.cpp.

{

       mTranMatrix->TransformCoord(&aX,&aY,&aWidth,&aHeight);
  mPSObj->newpath();
  mPSObj->box(aX, aY, aWidth, aHeight);
  mPSObj->stroke();
  return NS_OK;
}
NS_IMETHODIMP nsRenderingContextPS::DrawString ( const char *  aString,
PRUint32  aLength,
nscoord  aX,
nscoord  aY,
const nscoord aSpacing 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Reimplemented from nsRenderingContextImpl.

Definition at line 1068 of file nsRenderingContextPS.cpp.

{
  NS_ENSURE_TRUE(mTranMatrix && mPSObj && mFontMetrics, NS_ERROR_NULL_POINTER);

  nsFontMetricsPS *metrics = NS_REINTERPRET_CAST(nsFontMetricsPS *, mFontMetrics.get());
  NS_ENSURE_TRUE(metrics, NS_ERROR_FAILURE);

  // When FT2 printing is enabled, we don't need to set langgroup
#if defined(MOZ_ENABLE_FREETYPE2) || defined(MOZ_ENABLE_XFT)
  if (!NS_REINTERPRET_CAST(nsDeviceContextPS *, mContext.get())->mFTPEnable) {
#endif
    nsCOMPtr<nsIAtom> langGroup;
    mFontMetrics->GetLangGroup(getter_AddRefs(langGroup));
    mPSObj->setlanggroup(langGroup);
#if defined(MOZ_ENABLE_FREETYPE2) || defined(MOZ_ENABLE_XFT)
  }
#endif

  if (aLength == 0)
    return NS_OK;
  nsFontPS* fontPS = nsFontPS::FindFont(aString[0], metrics->Font(), metrics);
  NS_ENSURE_TRUE(fontPS, NS_ERROR_FAILURE);
  fontPS->SetupFont(this);

  PRUint32 i, start = 0;
  for (i=0; i<aLength; i++) {
    nsFontPS* fontThisChar;
    fontThisChar = nsFontPS::FindFont(aString[i], metrics->Font(), metrics);
    NS_ENSURE_TRUE(fontThisChar, NS_ERROR_FAILURE);
    if (fontThisChar != fontPS) {
      // draw text up to this point
      aX += DrawString(aString+start, i-start, aX, aY, fontPS, 
                       aSpacing?aSpacing+start:nsnull);
      start = i;

      // setup for following text
      fontPS = fontThisChar;
      fontPS->SetupFont(this);
    }
  }

  // draw the last part
  if (aLength-start)
    DrawString(aString+start, aLength-start, aX, aY, fontPS, 
               aSpacing?aSpacing+start:nsnull);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsRenderingContextPS::DrawString ( const PRUnichar aString,
PRUint32  aLength,
nscoord  aX,
nscoord  aY,
PRInt32  aFontID,
const nscoord aSpacing 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Reimplemented from nsRenderingContextImpl.

Definition at line 1124 of file nsRenderingContextPS.cpp.

{
  NS_ENSURE_TRUE(mTranMatrix && mPSObj && mFontMetrics, NS_ERROR_NULL_POINTER);
  
  nsFontMetricsPS *metrics = NS_REINTERPRET_CAST(nsFontMetricsPS *, mFontMetrics.get());
  NS_ENSURE_TRUE(metrics, NS_ERROR_FAILURE);

#if defined(MOZ_ENABLE_FREETYPE2) || defined(MOZ_ENABLE_XFT)
  // When FT2 printing is enabled, we don't need to set langgroup
  if (!NS_REINTERPRET_CAST(nsDeviceContextPS *, mContext.get())->mFTPEnable) {
#endif
    nsCOMPtr<nsIAtom> langGroup = nsnull;
    mFontMetrics->GetLangGroup(getter_AddRefs(langGroup));
    mPSObj->setlanggroup(langGroup);
#if defined(MOZ_ENABLE_FREETYPE2) || defined(MOZ_ENABLE_XFT)
  }
#endif

  /* build up conversion table */
  mPSObj->preshow(aString, aLength);

  if (aLength == 0)
    return NS_OK;
  nsFontPS* fontPS = nsFontPS::FindFont(aString[0], metrics->Font(), metrics);
  NS_ENSURE_TRUE(fontPS, NS_ERROR_FAILURE);
  fontPS->SetupFont(this);

  PRUint32 i, start = 0;
  for (i=0; i<aLength; i++) {
    nsFontPS* fontThisChar;
    fontThisChar = nsFontPS::FindFont(aString[i], metrics->Font(), metrics);
    NS_ENSURE_TRUE(fontThisChar, NS_ERROR_FAILURE);
    if (fontThisChar != fontPS) {
      // draw text up to this point
      aX += DrawString(aString+start, i-start, aX, aY, fontPS, 
                       aSpacing?aSpacing+start:nsnull);
      start = i;

      // setup for following text
      fontPS = fontThisChar;
      fontPS->SetupFont(this);
    }
  }

  // draw the last part
  if (aLength-start)
    DrawString(aString+start, aLength-start, aX, aY, fontPS, 
               aSpacing?aSpacing+start:nsnull);

  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsRenderingContextPS::DrawString ( const nsString aString,
nscoord  aX,
nscoord  aY,
PRInt32  aFontID,
const nscoord aSpacing 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Reimplemented from nsRenderingContextImpl.

Definition at line 1243 of file nsRenderingContextPS.cpp.

{
  return DrawString(aString.get(), aString.Length(), aX, aY, aFontID, aSpacing);
}

Here is the call graph for this function:

PRInt32 nsRenderingContextPS::DrawString ( const PRUnichar aString,
PRUint32  aLength,
nscoord  aX,
nscoord  aY,
nsFontPS aFontPS,
const nscoord aSpacing 
) [protected]

Definition at line 1210 of file nsRenderingContextPS.cpp.

{
  nscoord width = 0;
  PRInt32 x = aX;
  PRInt32 y = aY;

  if (aSpacing) {
    // Slow, but accurate rendering
    const PRUnichar* end = aString + aLength;
    while (aString < end){
      x = aX;
      y = aY;
      mTranMatrix->TransformCoord(&x, &y);
      aFontPS->DrawString(this, x, y, aString, 1);
      aX += *aSpacing++;
      aString++;
    }
    width = aX;
  } else {
    mTranMatrix->TransformCoord(&x, &y);
    width = aFontPS->DrawString(this, x, y, aString, aLength);
  }

  return width;
}

Here is the call graph for this function:

PRInt32 nsRenderingContextPS::DrawString ( const char *  aString,
PRUint32  aLength,
nscoord aX,
nscoord aY,
nsFontPS aFontPS,
const nscoord aSpacing 
) [protected]

Definition at line 1179 of file nsRenderingContextPS.cpp.

{
  nscoord width = 0;
  PRInt32 x = aX;
  PRInt32 y = aY;

  PRInt32 dxMem[500];
  PRInt32* dx0 = 0;
  if (aSpacing) {
    dx0 = dxMem;
    if (aLength > 500) {
      dx0 = new PRInt32[aLength];
      NS_ENSURE_TRUE(dx0, NS_ERROR_OUT_OF_MEMORY);
    }
    mTranMatrix->ScaleXCoords(aSpacing, aLength, dx0);
  }

  mTranMatrix->TransformCoord(&x, &y);
  width = aFontPS->DrawString(this, x, y, aString, aLength);

  if ((aSpacing) && (dx0 != dxMem)) {
    delete [] dx0;
  }

  return width;
}

Here is the call graph for this function:

NS_IMETHOD nsRenderingContextImpl::DrawStringInternal ( const char *  aString,
PRUint32  aLength,
nscoord  aX,
nscoord  aY,
const nscoord aSpacing = nsnull 
) [inline, inherited]

Reimplemented in nsRenderingContextWin, nsRenderingContextGTK, and nsRenderingContextMac.

Definition at line 250 of file nsRenderingContextImpl.h.

Here is the caller graph for this function:

NS_IMETHOD nsRenderingContextImpl::DrawStringInternal ( const PRUnichar aString,
PRUint32  aLength,
nscoord  aX,
nscoord  aY,
PRInt32  aFontID = -1,
const nscoord aSpacing = nsnull 
) [inline, inherited]
NS_IMETHODIMP nsRenderingContextPS::DrawTile ( imgIContainer aImage,
nscoord  aXImageStart,
nscoord  aYImageStart,
const nsRect aTargetRect 
) [virtual]

Reimplemented from nsRenderingContextImpl.

Definition at line 1278 of file nsRenderingContextPS.cpp.

{
  // Get image size 
  nscoord width, height;
  aImage->GetWidth(&width);
  aImage->GetHeight(&height);
  
  // Second para for nsPostscriptObj::draw_image
  nsRect imgRect;
  imgRect.x = 0;
  imgRect.y = 0;
  imgRect.width = width;
  imgRect.height = height;
  
  // Transform image's width-height into twips
  width = NSToCoordRound(width*mP2T);
  height = NSToCoordRound(height*mP2T);

  // Get current frame
  nsCOMPtr<gfxIImageFrame> iframe;
  aImage->GetCurrentFrame(getter_AddRefs(iframe));
  if (!iframe) return NS_ERROR_FAILURE;

  // Third para for nsPoscriptObj::draw_image 
  nsCOMPtr<nsIImage> img(do_GetInterface(iframe));
  if (!img) return NS_ERROR_FAILURE;
  nsRect ir;
  iframe->GetRect(ir);
   
  // Save states
  mPSObj->graphics_save();

  // Set clip region for tile 
  nsRect targetRect = (*aTargetRect);
  mTranMatrix->TransformCoord(&targetRect.x, &targetRect.y, 
                              &targetRect.width, &targetRect.height);
  mPSObj->box(targetRect.x,targetRect.y,targetRect.width,targetRect.height);
  mPSObj->clip();

  // Begin drawing tiles
  nsRect dstRect;
  for(PRInt32 y = aYImageStart; y < aTargetRect->y + aTargetRect->height; y += height)
    for(PRInt32 x = aXImageStart; x < aTargetRect->x + aTargetRect->width; x += width)
    {
      dstRect.x = x;
      dstRect.y = y;
      dstRect.width = width;
      dstRect.height = height;
      mTranMatrix->TransformCoord(&dstRect.x, &dstRect.y, &dstRect.width, &dstRect.height);
      mPSObj->draw_image(img, imgRect, ir, dstRect);
    }

  // Restore states
  mPSObj->graphics_restore();

  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsRenderingContextPS::FillArc ( const nsRect aRect,
float  aStartAngle,
float  aEndAngle 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 892 of file nsRenderingContextPS.cpp.

{
  return FillArc(aRect.x, aRect.y, aRect.width, aRect.height, aStartAngle, aEndAngle);
}
NS_IMETHODIMP nsRenderingContextPS::FillArc ( nscoord  aX,
nscoord  aY,
nscoord  aWidth,
nscoord  aHeight,
float  aStartAngle,
float  aEndAngle 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 903 of file nsRenderingContextPS.cpp.

{
  if (nsLineStyle_kNone == mCurrLineStyle)
    return NS_OK;

  //SetupPen();
  mTranMatrix->TransformCoord(&aX, &aY, &aWidth, &aHeight);

  mPSObj->comment("arc");
  mPSObj->newpath();
  mPSObj->moveto(aX, aY);
  mPSObj->arc(aWidth, aHeight, aStartAngle, aEndAngle);
  mPSObj->closepath();
  mPSObj->fill();

  return NS_OK;
}

Fill an ellipse in the current foreground color.

Parameters:
aRectThe rectangle define bounds of ellipse to draw

Implements nsIRenderingContext.

Definition at line 829 of file nsRenderingContextPS.cpp.

{
  return FillEllipse(aRect.x, aRect.y, aRect.width, aRect.height);
}
NS_IMETHODIMP nsRenderingContextPS::FillEllipse ( nscoord  aX,
nscoord  aY,
nscoord  aWidth,
nscoord  aHeight 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 838 of file nsRenderingContextPS.cpp.

{
  mTranMatrix->TransformCoord(&aX, &aY, &aWidth, &aHeight);

  mPSObj->comment("ellipse");
  mPSObj->newpath();
  mPSObj->moveto(aX, aY);
  mPSObj->arc(aWidth, aHeight, 0.0, 360.0);
  mPSObj->closepath();
  mPSObj->fill();

  return NS_OK;
}
NS_IMETHODIMP nsRenderingContextPS::FillPolygon ( const nsPoint  aPoints[],
PRInt32  aNumPoints 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 764 of file nsRenderingContextPS.cpp.

{
const nsPoint*  np;
nsPoint         pp;

  mPSObj->newpath();

  // point np to the polypoints
  np = &aPoints[0];

  // do the initial moveto
       pp.x = np->x;
       pp.y = np->y;
  mTranMatrix->TransformCoord(&pp.x, &pp.y);
  mPSObj->moveto(pp.x, pp.y);
  np++;

  // add all the points to the path
       for (PRInt32 i = 1; i < aNumPoints; i++, np++){
              pp.x = np->x;
              pp.y = np->y;
                mTranMatrix->TransformCoord(&pp.x, &pp.y);
                mPSObj->lineto(pp.x, pp.y);
       }

  mPSObj->closepath();
  mPSObj->fill();

  return NS_OK;
}


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 687 of file nsRenderingContextPS.cpp.

{
  return FillRect(aRect.x, aRect.y, aRect.width, aRect.height);
}

Here is the caller graph for this function:

NS_IMETHODIMP nsRenderingContextPS::FillRect ( nscoord  aX,
nscoord  aY,
nscoord  aWidth,
nscoord  aHeight 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 697 of file nsRenderingContextPS.cpp.

{

       mTranMatrix->TransformCoord(&aX,&aY,&aWidth,&aHeight);
  mPSObj->newpath();
  mPSObj->box(aX, aY, aWidth, aHeight);
  mPSObj->fill();
  return NS_OK;
}
NS_IMETHODIMP nsRenderingContextImpl::FlushRect ( const nsRect aRect) [virtual, inherited]

For platforms (e.g., Cocoa) that implicitly double buffer, this call can be used to force a buffer flush following the painting of a rectangle.

This call needs to be used any time drawing of rects is being done "on the fly", outside of the normal painting process. Examples include the blinking caret and tabbing through subimages in an image map.

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextMac.

Definition at line 436 of file nsRenderingContextImpl.cpp.

{
  return NS_OK;
}
NS_IMETHODIMP nsRenderingContextImpl::FlushRect ( nscoord  aX,
nscoord  aY,
nscoord  aWidth,
nscoord  aHeight 
) [virtual, inherited]

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextMac.

Definition at line 442 of file nsRenderingContextImpl.cpp.

{
    return NS_OK;
}
NS_IMETHODIMP nsRenderingContextImpl::GetBackbuffer ( const nsRect aRequestedSize,
const nsRect aMaxSize,
PRBool  aForBlending,
nsIDrawingSurface *&  aBackbuffer 
) [virtual, inherited]

Get a drawing surface used as a backbuffer.

Depending on the platform this will either cause a backbuffer surface to be allocated or an existing cached backbuffer will be returned. If the backbuffer is being cached asking for aMaxSize which is different from a previous request may cause the platform to dump it's cached backbuffer and reallocate a backbuffer of a size which will allow aMaxSize buffer to be allocated.

Parameters:
aRequestedSizesize of the backbuffer area requested
aMaxSizemaximum size that may be requested for the backbuffer
aForBlendingparameter telling if the buffer will be used for blending
aBackbufferdrawing surface used as the backbuffer

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextGTK, nsRenderingContextWin, and nsRenderingContextXlib.

Definition at line 77 of file nsRenderingContextImpl.cpp.

{
  // Default implementation assumes the backbuffer will be cached.
  // If the platform implementation does not require the backbuffer to
  // be cached override this method and make the following call instead:
  // AllocateBackbuffer(aRequestedSize, aMaxSize, aBackbuffer, PR_FALSE);
  return AllocateBackbuffer(aRequestedSize, aMaxSize, aBackbuffer, PR_TRUE, 0);
}

Here is the call graph for this function:

NS_IMETHODIMP nsRenderingContextPS::GetClipRect ( nsRect aRect,
PRBool aClipState 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 401 of file nsRenderingContextPS.cpp.

{
  if (mStates->mLocalClip.width !=0){
    aRect = mStates->mLocalClip;
    aClipValid = PR_TRUE;
  }else{
    aClipValid = PR_FALSE;
  }

  return NS_OK;
}


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 444 of file nsRenderingContextPS.cpp.

{
  //XXX wow, needs to do something.
  return NS_OK; 
}
NS_IMETHODIMP nsRenderingContextImpl::GetClusterInfo ( const PRUnichar aText,
PRUint32  aLength,
PRUint8 aClusterStarts 
) [virtual, inherited]

Get cluster details for a chunk of text.

This will fill in the aClusterStarts array with information about what characters are the start of clusters for display. The information is just a bitfield that is set to 1 if the character is the start of a cluster. aClusterStarts must already be allocated to at least aLength items in length. Array index zero being set to one indicates that the first character is the beginning of a cluster.

Parameters:
aTextText on which to get details.
aLengthLength of the text.
aClusterStartsArray of ints that will be populated with information about which characters are the starts of clusters.

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextGTK.

Definition at line 448 of file nsRenderingContextImpl.cpp.

Here is the caller graph for this function:

NS_IMETHODIMP nsRenderingContextPS::GetColor ( nscolor aColor) const [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 467 of file nsRenderingContextPS.cpp.

{
  aColor = mCurrentColor;
  return NS_OK;
}
NS_IMETHODIMP nsRenderingContextPS::GetCurrentTransform ( nsTransform2D *&  aTransform) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 560 of file nsRenderingContextPS.cpp.

{
  aTransform = mTranMatrix;
  return NS_OK;
}


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 272 of file nsRenderingContextPS.cpp.

{
  aContext = mContext;
  NS_IF_ADDREF(aContext);
  return NS_OK;
}


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 241 of file nsRenderingContextPS.cpp.

{
  *aSurface = nsnull;
  return NS_OK;
}
void nsRenderingContextImpl::GetDrawingSurfaceSize ( const nsRect aMaxBackbufferSize,
const nsRect aRequestedSize,
nsRect aSurfaceSize 
) [protected, inherited]

Get the size of the offscreen drawing surface.

Parameters:
aMaxBackbufferSizeMaximum size that may be requested for the backbuffer
aRequestedSizeDesired size for the offscreen.
aSurfaceSizeOffscreen adjusted to a discrete size which encloses aRequestedSize.

Definition at line 215 of file nsRenderingContextImpl.cpp.

{ 
  CalculateDiscreteSurfaceSize(aMaxBackbufferSize, aRequestedSize, aNewSize);
  aNewSize.MoveTo(aRequestedSize.x, aRequestedSize.y);
}

Here is the call graph for this function:

Here is the caller graph for this function:


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 526 of file nsRenderingContextPS.cpp.

{
  aFontMetrics = (nsIFontMetrics *)mFontMetrics;
  NS_IF_ADDREF(aFontMetrics);
  return NS_OK;
}


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 252 of file nsRenderingContextPS.cpp.

{
  return NS_OK;
}


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 488 of file nsRenderingContextPS.cpp.

{
  aLineStyle = mCurrLineStyle;
  return NS_OK;
}
virtual PRInt32 nsRenderingContextImpl::GetMaxStringLength ( ) [inline, virtual, inherited]

Return the maximum length of a string that can be handled by the platform using the current font metrics.

The implementation here is just a stub; classes that don't override the safe string methods need to implement this.

Reimplemented in nsRenderingContextWin, nsRenderingContextGTK, and nsRenderingContextMac.

Definition at line 106 of file nsRenderingContextImpl.h.

{ return 1; }

Here is the caller graph for this function:

NS_IMETHOD nsRenderingContextImpl::GetPenMode ( nsPenMode aPenMode) [inline, virtual, inherited]

Gets the Pen Mode for the RenderingContext.

Parameters:
aPenModeThe Pen Mode to be retrieved
Returns:
NS_OK if the Pen Mode is correctly retrieved

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextWin.

Definition at line 83 of file nsRenderingContextImpl.h.

{ return NS_ERROR_FAILURE;}
PRInt32 nsRenderingContextImpl::GetPosition ( const PRUnichar aText,
PRUint32  aLength,
nsPoint  aPt 
) [virtual, inherited]

Find the closest cursor position for a given x coordinate.

This will find the closest byte index for a given x coordinate. This takes into account grapheme clusters and bidi text.

Parameters:
aTextText on which to operate.
aLengthLength of the text.
aPtthe x/y position in the string to check.
Returns:
Index where the cursor falls. If the return is zero, it's before the first character, if it falls off the end of the string it's the length of the string + 1.

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextGTK.

Definition at line 456 of file nsRenderingContextImpl.cpp.

{
  return -1;
}
nsPostScriptObj* nsRenderingContextPS::GetPostScriptObj ( ) [inline]

Definition at line 234 of file nsRenderingContextPS.h.

{ return mPSObj; };

Here is the caller graph for this function:

NS_IMETHODIMP nsRenderingContextImpl::GetRangeWidth ( const PRUnichar aText,
PRUint32  aLength,
PRUint32  aStart,
PRUint32  aEnd,
PRUint32 aWidth 
) [virtual, inherited]

Get the width for the specific range of a given string.

This function is similar to other GetWidth functions, except that it gets the width for a part of the string instead of the entire string. This is useful when you're interested in finding out the length of a chunk in the middle of the string. Lots of languages require you to include surrounding information to accurately determine the length of a substring.

Parameters:
aTextText on which to operate
aLengthLength of the text
aStartStart index into the string
aEndEnd index into the string (inclusive)
aWidthReturned with in app coordinates

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextGTK.

Definition at line 464 of file nsRenderingContextImpl.cpp.

NS_IMETHODIMP nsRenderingContextImpl::GetRangeWidth ( const char *  aText,
PRUint32  aLength,
PRUint32  aStart,
PRUint32  aEnd,
PRUint32 aWidth 
) [virtual, inherited]

Get the width for the specific range of a given string.

Same as GetRangeWidth for PRUnichar, but takes a char * as the text argument.

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextGTK.

Definition at line 474 of file nsRenderingContextImpl.cpp.

Reimplemented in nsRenderingContextWin, nsRenderingContextGTK, and nsRenderingContextMac.

Definition at line 293 of file nsRenderingContextImpl.cpp.

{
  *aIsRTL = PR_FALSE;
  return NS_OK;
}

Here is the caller graph for this function:

NS_IMETHODIMP nsRenderingContextPS::GetTextDimensions ( const char *  aString,
PRUint32  aLength,
nsTextDimensions aDimensions 
) [virtual]

Returns the dimensions of a string, i.e., the overall extent of a string whose rendering may involve switching between different fonts that have different metrics.

Parameters:
aStringstring to measure
aLengthnumber of characters in string
aFontIDan optional out parameter used to store a font identifier that can be passed into the DrawString() methods to speed measurements
Returns:
aDimensions struct that contains the extent of the string (see below)

Reimplemented from nsRenderingContextImpl.

Definition at line 1029 of file nsRenderingContextPS.cpp.

{
  nsresult rv = NS_ERROR_FAILURE;

  if (mFontMetrics) {
    nsFontMetricsPS *metrics = NS_REINTERPRET_CAST(nsFontMetricsPS *, mFontMetrics.get());
    metrics->GetStringWidth(aString, aDimensions.width, aLength);
    metrics->GetMaxAscent(aDimensions.ascent);
    metrics->GetMaxDescent(aDimensions.descent);
    rv = NS_OK;
  }
  
  return rv;
}

Here is the call graph for this function:

NS_IMETHODIMP nsRenderingContextPS::GetTextDimensions ( const PRUnichar aString,
PRUint32  aLength,
nsTextDimensions aDimensions,
PRInt32 aFontID 
) [virtual]

Reimplemented from nsRenderingContextImpl.

Definition at line 1046 of file nsRenderingContextPS.cpp.

{
  nsresult rv = NS_ERROR_FAILURE;

  if (mFontMetrics) {
    nsFontMetricsPS *metrics = NS_REINTERPRET_CAST(nsFontMetricsPS *, mFontMetrics.get());
    metrics->GetStringWidth(aString, aDimensions.width, aLength);
     //XXX temporary - bug 96609
    metrics->GetMaxAscent(aDimensions.ascent);
    metrics->GetMaxDescent(aDimensions.descent);
    rv = NS_OK;
  }

  return rv;
}

Here is the call graph for this function:

NS_IMETHODIMP nsRenderingContextPS::GetTextDimensions ( const char *  aString,
PRInt32  aLength,
PRInt32  aAvailWidth,
PRInt32 aBreaks,
PRInt32  aNumBreaks,
nsTextDimensions aDimensions,
PRInt32 aNumCharsFit,
nsTextDimensions aLastWordDimensions,
PRInt32 aFontID = nsnull 
)


Definition at line 999 of file nsRenderingContextPS.cpp.

{
  NS_NOTYETIMPLEMENTED("nsRenderingContextPS::GetTextDimensions");
  return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsRenderingContextPS::GetTextDimensions ( const PRUnichar aString,
PRInt32  aLength,
PRInt32  aAvailWidth,
PRInt32 aBreaks,
PRInt32  aNumBreaks,
nsTextDimensions aDimensions,
PRInt32 aNumCharsFit,
nsTextDimensions aLastWordDimensions,
PRInt32 aFontID = nsnull 
)

Definition at line 1014 of file nsRenderingContextPS.cpp.

{
  NS_NOTYETIMPLEMENTED("nsRenderingContextPS::GetTextDimensions");
  return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD nsRenderingContextImpl::GetTextDimensionsInternal ( const char *  aString,
PRUint32  aLength,
nsTextDimensions aDimensions 
) [inline, inherited]

Reimplemented in nsRenderingContextWin, nsRenderingContextGTK, and nsRenderingContextMac.

Definition at line 207 of file nsRenderingContextImpl.h.

Here is the caller graph for this function:

NS_IMETHOD nsRenderingContextImpl::GetTextDimensionsInternal ( const PRUnichar aString,
PRUint32  aLength,
nsTextDimensions aDimensions,
PRInt32 aFontID = nsnull 
) [inline, inherited]
NS_IMETHODIMP nsRenderingContextPS::GetWidth ( char  aC,
nscoord aWidth 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsRenderingContextImpl.

Definition at line 927 of file nsRenderingContextPS.cpp.

{
  char buf[1];
  buf[0] = ch;
  return GetWidth(buf, 1, aWidth);
}

Here is the caller graph for this function:

NS_IMETHODIMP nsRenderingContextPS::GetWidth ( PRUnichar  aC,
nscoord aWidth,
PRInt32 aFontID 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsRenderingContextImpl.

Definition at line 939 of file nsRenderingContextPS.cpp.

{
  PRUnichar buf[1];
  buf[0] = ch;
  return GetWidth(buf, 1, aWidth, aFontID);
}

Here is the call graph for this function:

NS_IMETHODIMP nsRenderingContextPS::GetWidth ( const nsString aString,
nscoord aWidth,
PRInt32 aFontID 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Reimplemented from nsRenderingContextImpl.

Definition at line 976 of file nsRenderingContextPS.cpp.

{
  return GetWidth(aString.get(), aString.Length(), aWidth, aFontID);
}

Here is the call graph for this function:

NS_IMETHODIMP nsRenderingContextPS::GetWidth ( const char *  aString,
nscoord aWidth 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Reimplemented from nsRenderingContextImpl.

Definition at line 951 of file nsRenderingContextPS.cpp.

{
  return GetWidth(aString, strlen(aString),aWidth);
}

Here is the call graph for this function:

NS_IMETHODIMP nsRenderingContextPS::GetWidth ( const char *  aString,
PRUint32  aLength,
nscoord aWidth 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Reimplemented from nsRenderingContextImpl.

Definition at line 961 of file nsRenderingContextPS.cpp.

{
  nsresult rv = NS_ERROR_FAILURE;
  if (mFontMetrics) {
    rv = NS_REINTERPRET_CAST(nsFontMetricsPS *, mFontMetrics.get())->GetStringWidth(aString,aWidth,aLength);
  }
  
  return rv;
}

Here is the call graph for this function:

NS_IMETHODIMP nsRenderingContextPS::GetWidth ( const PRUnichar aString,
PRUint32  aLength,
nscoord aWidth,
PRInt32 aFontID 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Reimplemented from nsRenderingContextImpl.

Definition at line 986 of file nsRenderingContextPS.cpp.

{
  nsresult rv = NS_ERROR_FAILURE;

  if (mFontMetrics) {
    rv = NS_REINTERPRET_CAST(nsFontMetricsPS *, mFontMetrics.get())->GetStringWidth(aString, aWidth, aLength);
  }

  return rv;
}

Here is the call graph for this function:

NS_IMETHOD nsRenderingContextImpl::GetWidthInternal ( const char *  aString,
PRUint32  aLength,
nscoord aWidth 
) [inline, inherited]

Reimplemented in nsRenderingContextWin, nsRenderingContextGTK, and nsRenderingContextMac.

Definition at line 201 of file nsRenderingContextImpl.h.

Here is the caller graph for this function:

NS_IMETHOD nsRenderingContextImpl::GetWidthInternal ( const PRUnichar aString,
PRUint32  aLength,
nscoord aWidth,
PRInt32 aFontID = nsnull 
) [inline, inherited]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Definition at line 185 of file nsRenderingContextPS.cpp.

{
  NS_ENSURE_TRUE(nsnull != aContext, NS_ERROR_NULL_POINTER);

  mContext = aContext;
  mP2T = mContext->DevUnitsToAppUnits();

  mPSObj = NS_REINTERPRET_CAST(nsDeviceContextPS *, mContext.get())->GetPrintContext();

  NS_ENSURE_TRUE(nsnull != mPSObj, NS_ERROR_NULL_POINTER);

  // Layout's coordinate system places the origin at top left with Y
  // increasing down; PS places the origin at bottom left with Y increasing
  // upward. Both systems use twips for units, so no resizing is needed.
  mTranMatrix->SetToScale(1.0, -1.0);
  mTranMatrix->AddTranslation(0, -mPSObj->mPrintSetup->height);

  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHOD nsRenderingContextPS::Init ( nsIDeviceContext aContext,
nsIWidget aWidget 
) [inline, virtual]

Initialize the RenderingContext.

Parameters:
aContextthe device context to use.
aWidgetthe widget to hook up to
Returns:
The result of the initialization, NS_Ok if no errors

Implements nsIRenderingContext.

Definition at line 73 of file nsRenderingContextPS.h.

NS_IMETHOD nsRenderingContextPS::Init ( nsIDeviceContext aContext,
nsIDrawingSurface aSurface 
) [inline, virtual]

Initialize the RenderingContext.

Parameters:
aContextthe device context to use for the drawing.
aSurfacethe surface to draw into
Returns:
The result of the initialization, NS_Ok if no errors

Implements nsIRenderingContext.

Definition at line 74 of file nsRenderingContextPS.h.

XOR Invert a rectangle in the current foreground color.

Parameters:
aRectThe rectangle to draw

Implements nsIRenderingContext.

Definition at line 708 of file nsRenderingContextPS.cpp.

{
       NS_NOTYETIMPLEMENTED("nsRenderingContextPS::InvertRect");

  return NS_OK;
}
NS_IMETHODIMP nsRenderingContextPS::InvertRect ( nscoord  aX,
nscoord  aY,
nscoord  aWidth,
nscoord  aHeight 
) [virtual]

XOR Invert a rectangle in the current foreground color.

Parameters:
aXHorizontal left Coordinate in twips
aYVertical top Coordinate in twips
aWidthWidth of rectangle in twips
aHeightHeight of rectangle in twips

Implements nsIRenderingContext.

Definition at line 716 of file nsRenderingContextPS.cpp.

{
       NS_NOTYETIMPLEMENTED("nsRenderingContextPS::InvertRect");

  return NS_OK;
}
NS_IMETHODIMP nsRenderingContextPS::IsVisibleRect ( const nsRect aRect,
PRBool aClipState 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 353 of file nsRenderingContextPS.cpp.

{
  aVisible = PR_TRUE;
  return NS_OK;
}
NS_IMETHODIMP nsRenderingContextPS::LockDrawingSurface ( PRInt32  aX,
PRInt32  aY,
PRUint32  aWidth,
PRUint32  aHeight,
void **  aBits,
PRInt32 aStride,
PRInt32 aWidthBytes,
PRUint32  aFlags 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 209 of file nsRenderingContextPS.cpp.

{
  return NS_OK;
}


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 325 of file nsRenderingContextPS.cpp.

{
  if (nsnull == mStates){
    NS_ASSERTION(!(nsnull == mStates), "state underflow");
  } else {
    PS_State *oldstate = mStates;

    mStates = mStates->mNext;

    mStateCache->AppendElement(oldstate);

    if (nsnull != mStates){
      mTranMatrix = &mStates->mMatrix;
      SetLineStyle(mStates->mLineStyle);
    }
    else
      mTranMatrix = nsnull;
  }

  mPSObj->graphics_restore();

  return NS_OK;
}

Here is the call graph for this function:

Implements nsIRenderingContext.

Definition at line 178 of file nsRenderingContextImpl.cpp.

{
  nsTransform2D *theTransform; 
  GetCurrentTransform(theTransform);
  NS_ASSERTION(theTransform != nsnull, "The rendering context transform is null");
  theTransform->SetTranslation(aState->mSavedX, aState->mSavedY);

  return NS_OK;
}

Here is the call graph for this function:

void nsRenderingContextPS::PostscriptFont ( nscoord  aHeight,
PRUint8  aStyle,
PRUint8  aVariant,
PRUint16  aWeight,
PRUint8  decorations 
)


Set the current postscript font 12/21/98 dwc


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 285 of file nsRenderingContextPS.cpp.

{
  PRInt32 cnt = mStateCache->Count();

  if (cnt == 0){
    if (nsnull == mStates)
      mStates = new PS_State();
    else
      mStates = new PS_State(*mStates);
  } else {
    PS_State *state = (PS_State *)mStateCache->ElementAt(cnt - 1);
    mStateCache->RemoveElementAt(cnt - 1);

    state->mNext = mStates;

    //clone state info
    state->mMatrix = mStates->mMatrix;
    state->mLocalClip = mStates->mLocalClip;
    state->mCurrentColor = mStates->mCurrentColor;
    state->mFontMetrics = mStates->mFontMetrics;
    state->mTextColor = mStates->mTextColor;
    state->mLineStyle = mStates->mLineStyle;

    mStates = state;
  }

  mTranMatrix = &mStates->mMatrix;

  // at startup, the graphics state is not saved yet
  if(mPSObj)
    mPSObj->graphics_save();

  return NS_OK;
}

Implements nsIRenderingContext.

Definition at line 155 of file nsRenderingContextImpl.cpp.

{
  // The transform components are saved and restored instead 
  // of using PushState and PopState because they are too slow
  // because they also save and restore the clip state.
  // Note: Setting a negative translation to restore the 
  // state does not work because the floating point errors can accumulate
  // causing the display of some frames to be off by one pixel. 
  // This happens frequently when running in 120DPI mode where frames are
  // often positioned at 1/2 pixel locations and small floating point errors
  // will cause the frames to vary their pixel x location during scrolling
  // operations causes a single scan line of pixels to be shifted left relative
  // to the other scan lines for the same text. 
  
  // Save the transformation matrix's translation components.
  nsTransform2D *theTransform; 
  GetCurrentTransform(theTransform);
  NS_ASSERTION(theTransform != nsnull, "The rendering context transform is null");
  theTransform->GetTranslation(&aState->mSavedX, &aState->mSavedY);
  
  return NS_OK;
}

Here is the call graph for this function:

PRBool nsRenderingContextImpl::RectFitsInside ( const nsRect aRect,
PRInt32  aWidth,
PRInt32  aHeight 
) const [protected, inherited]

Determine if a rect's width and height will fit within a specified width and height.

Parameters:
aRectrectangle to test
aWidthwidth to determine if the rectangle's width will fit within
aHeightheight to determine if the rectangles height will fit within
Returns:
PR_TRUE if the rect width and height fits with aWidth, aHeight, PR_FALSE otherwise.

Definition at line 188 of file nsRenderingContextImpl.cpp.

{
  if (aRect.width > aWidth)
    return (PR_FALSE);

  if (aRect.height > aHeight)
    return (PR_FALSE);

  return PR_TRUE;
}

Here is the caller graph for this function:

Release a drawing surface used as the backbuffer If the platform caches the backbuffer this call will destroy it.

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextGTK, nsRenderingContextWin, nsRenderingContextXlib, and nsRenderingContextMac.

Definition at line 133 of file nsRenderingContextImpl.cpp.

{
  // If the platform does not require the backbuffer to be cached
  // override this method and call DestroyCachedBackbuffer
  return NS_OK;
}
NS_IMETHODIMP nsRenderingContextPS::RenderEPS ( const nsRect aRect,
FILE aDataFile 
) [virtual]


Output an encapsulated postscript file to the print job.


See documentation in nsRenderingContextPS.h and gfx/public/nsIRenderingContext.h.

See documentation in gfx/public/nsIRenderingContext.h. 3/6/2004 kherron

Parameters:
aRectRectangle in which to render the EPS
aDataFile- data stored in a file
Returns:
NS_OK or a suitable error code.

3/6/2004

Parameters:
@paramaRect Rectangle in which to render the EPSF.
aDataFile- data stored in a file
Returns:
NS_OK or a suitable error code.

Reimplemented from nsRenderingContextImpl.

Definition at line 1392 of file nsRenderingContextPS.cpp.

{
  nsresult    rv;

  /* EPSFs aren't supposed to have side effects, so if width or height is
   * zero, just return. */
  if ((aRect.width == 0) || (aRect.height == 0))
    return NS_OK;

  nsEPSObjectPS eps(aDataFile);
  if (NS_FAILED(eps.GetStatus())) {
    return NS_ERROR_INVALID_ARG;
  }
 
  nsRect trect = aRect;
  mTranMatrix->TransformCoord(&trect.x, &trect.y, &trect.width, &trect.height);
 
  rv = mPSObj->render_eps(trect, eps);

  return rv;
}

Here is the call graph for this function:


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 262 of file nsRenderingContextPS.cpp.

{
  return NS_OK;
}

Implements nsIRenderingContext.

Definition at line 1379 of file nsRenderingContextPS.cpp.

{
  return NS_OK;
}
NS_IMETHODIMP nsRenderingContextPS::Scale ( float  aSx,
float  aSy 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 549 of file nsRenderingContextPS.cpp.

{
       mTranMatrix->AddScale(aSx, aSy);
  return NS_OK;
}


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 231 of file nsRenderingContextPS.cpp.

{
  return NS_OK;
}


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 363 of file nsRenderingContextPS.cpp.

{
  nsRect  trect = aRect;

  mStates->mLocalClip = aRect;

  mTranMatrix->TransformCoord(&trect.x, &trect.y,&trect.width, &trect.height);
  mStates->mFlags |= FLAG_LOCAL_CLIP_VALID;

  if (aCombine == nsClipCombine_kIntersect){
    mPSObj->newpath();
    mPSObj->box(trect.x, trect.y, trect.width, trect.height);
  } else if (aCombine == nsClipCombine_kUnion){
    mPSObj->newpath();
    mPSObj->box(trect.x, trect.y, trect.width, trect.height);
  }else if (aCombine == nsClipCombine_kSubtract){
    mPSObj->newpath();
    mPSObj->clippath();   // get the current path
    mPSObj->box_subtract(trect.x, trect.y, trect.width, trect.height);
  }else if (aCombine == nsClipCombine_kReplace){
    mPSObj->initclip();
    mPSObj->newpath();
    mPSObj->box(trect.x, trect.y, trect.width, trect.height);
  }else{
    NS_ASSERTION(PR_FALSE, "illegal clip combination");
    return NS_ERROR_INVALID_ARG;
  }
  mPSObj->clip();
  mPSObj->newpath();

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 418 of file nsRenderingContextPS.cpp.

{
  nsRect rect;
  nsIRegion* pRegion = (nsIRegion*)&aRegion;
  pRegion->GetBoundingBox(&rect.x, &rect.y, &rect.width, &rect.height);
  SetClipRect(rect, aCombine);

  return NS_OK; 
}

Here is the call graph for this function:


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 455 of file nsRenderingContextPS.cpp.

{
  mPSObj->setcolor(aColor);
  mCurrentColor = aColor;

  return NS_OK;
}
NS_IMETHODIMP nsRenderingContextPS::SetFont ( const nsFont aFont,
nsIAtom aLangGroup 
) [virtual]


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 499 of file nsRenderingContextPS.cpp.

{
  nsCOMPtr<nsIFontMetrics> newMetrics;
  nsresult rv = mContext->GetMetricsFor( aFont, aLangGroup, *getter_AddRefs(newMetrics) );

  if (NS_SUCCEEDED(rv)) {
    rv = SetFont(newMetrics);
  }
  return rv;
}

Here is the call graph for this function:


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 515 of file nsRenderingContextPS.cpp.

{
  mFontMetrics = (nsFontMetricsPS *)aFontMetrics;
  return NS_OK;
}


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 477 of file nsRenderingContextPS.cpp.

{
  mCurrLineStyle = aLineStyle;
  return NS_OK;
}

Here is the caller graph for this function:

NS_IMETHOD nsRenderingContextImpl::SetPenMode ( nsPenMode  aPenMode) [inline, virtual, inherited]

Sets the Pen Mode for the RenderingContext.

Parameters:
aPenModeThe Pen Mode
Returns:
NS_OK if the Pen Mode is correctly set

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextWin.

Definition at line 90 of file nsRenderingContextImpl.h.

{ return NS_ERROR_FAILURE;};

Let the device context know whether we want text reordered with right-to-left base direction.

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextWin, nsRenderingContextGTK, and nsRenderingContextMac.

Definition at line 287 of file nsRenderingContextImpl.cpp.

{
  return NS_OK;
}


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 538 of file nsRenderingContextPS.cpp.

{
  mTranMatrix->AddTranslation((float)aX,(float)aY);
  return NS_OK;
}


See documentation in nsIRenderingContext.h 12/21/98 dwc

Implements nsIRenderingContext.

Definition at line 221 of file nsRenderingContextPS.cpp.

{
  return NS_OK;
}
NS_IMETHODIMP nsRenderingContextImpl::UseBackbuffer ( PRBool aUseBackbuffer) [virtual, inherited]

Some platforms may not want a backbuffer at all.

Returning false here allows them to achieve that

Parameters:
aUseBackbufferPR_TRUE if we should use a backbuffer, PR_FALSE if not

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextMac.

Definition at line 149 of file nsRenderingContextImpl.cpp.

{
  *aUseBackbuffer = PR_TRUE;
  return NS_OK;
}

Member Data Documentation

int nsRenderingContextImpl::mAct [protected, inherited]

Definition at line 65 of file nsRenderingContextImpl.h.

Edge* nsRenderingContextImpl::mActive [protected, inherited]

Definition at line 66 of file nsRenderingContextImpl.h.

Definition at line 292 of file nsRenderingContextPS.h.

Definition at line 298 of file nsRenderingContextPS.h.

Definition at line 294 of file nsRenderingContextPS.h.

Definition at line 293 of file nsRenderingContextPS.h.

Definition at line 301 of file nsRenderingContextPS.h.

float nsRenderingContextPS::mP2T [protected]

Definition at line 297 of file nsRenderingContextPS.h.

Definition at line 321 of file nsRenderingContextImpl.h.

nsPostScriptObj* nsRenderingContextPS::mPSObj [protected]

Definition at line 302 of file nsRenderingContextPS.h.

Definition at line 296 of file nsRenderingContextPS.h.

Definition at line 295 of file nsRenderingContextPS.h.

nsTransform2D* nsRenderingContextImpl::mTranMatrix [protected, inherited]

Definition at line 64 of file nsRenderingContextImpl.h.


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