Back to index

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

#include <nsRenderingContextImpl.h>

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

List of all members.

Public Member Functions

 nsRenderingContextImpl ()
 
See documentation in nsIRenderingContext.h 3/16/00 dwc
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 DrawImage (imgIContainer *aImage, const nsRect &aSrcRect, const nsRect &aDestRect)
 Draw a portion of an image, scaling it to fit within a specified rect.
NS_IMETHOD DrawTile (imgIContainer *aImage, nscoord aXOffset, nscoord aYOffset, const nsRect *aTargetRect)
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 GetWidth (char aC, nscoord &aWidth)=0
 Returns the width (in app units) of an 8-bit character If no font has been Set, the results are undefined.
NS_IMETHOD GetWidth (PRUnichar aC, nscoord &aWidth, PRInt32 *aFontID=nsnull)=0
 Returns the width (in app units) of a unicode character If no font has been Set, the results are undefined.
NS_IMETHOD GetWidth (const nsString &aString, nscoord &aWidth, PRInt32 *aFontID=nsnull)
 Returns the width (in app units) of an nsString If no font has been Set, the results are undefined.
NS_IMETHOD GetWidth (const char *aString, nscoord &aWidth)
 Returns the width (in app units) of an 8-bit character string If no font has been Set, the results are undefined.
NS_IMETHOD DrawString (const nsString &aString, nscoord aX, nscoord aY, PRInt32 aFontID=-1, const nscoord *aSpacing=nsnull)
 Draw a string in the RenderingContext.
NS_IMETHOD GetWidth (const char *aString, PRUint32 aLength, nscoord &aWidth)
 Returns the width (in app units) of an 8-bit character string If no font has been Set, the results are undefined.
NS_IMETHOD GetWidth (const PRUnichar *aString, PRUint32 aLength, nscoord &aWidth, PRInt32 *aFontID=nsnull)
 Returns the width (in app units) of a Unicode character string If no font has been Set, the results are undefined.
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=nsnull)
NS_IMETHOD DrawString (const char *aString, PRUint32 aLength, nscoord aX, nscoord aY, const nscoord *aSpacing=nsnull)
 Draw a string in the RenderingContext.
NS_IMETHOD DrawString (const PRUnichar *aString, PRUint32 aLength, nscoord aX, nscoord aY, PRInt32 aFontID=-1, const nscoord *aSpacing=nsnull)
 Draw a string in the RenderingContext.
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)
NS_IMETHOD RenderEPS (const nsRect &aRect, FILE *aDataFile)
 Render an encapsulated postscript object onto the current rendering surface.
NS_IMETHOD Init (nsIDeviceContext *aContext, nsIWidget *aWidget)=0
 Initialize the RenderingContext.
NS_IMETHOD Init (nsIDeviceContext *aContext, nsIDrawingSurface *aSurface)=0
 Initialize the RenderingContext.
NS_IMETHOD Reset (void)=0
 Reset the rendering context.
NS_IMETHOD GetDeviceContext (nsIDeviceContext *&aDeviceContext)=0
 Get the DeviceContext that this RenderingContext was initialized with.
NS_IMETHOD LockDrawingSurface (PRInt32 aX, PRInt32 aY, PRUint32 aWidth, PRUint32 aHeight, void **aBits, PRInt32 *aStride, PRInt32 *aWidthBytes, PRUint32 aFlags)=0
 Lock a rect of the drawing surface associated with the rendering context.
NS_IMETHOD UnlockDrawingSurface (void)=0
 Unlock a rect of the drawing surface associated with the rendering context.
NS_IMETHOD SelectOffScreenDrawingSurface (nsIDrawingSurface *aSurface)=0
 Selects an offscreen drawing surface into the RenderingContext to draw to.
NS_IMETHOD GetDrawingSurface (nsIDrawingSurface **aSurface)=0
 Get the currently selected drawing surface.
NS_IMETHOD GetHints (PRUint32 &aResult)=0
 Returns in aResult any rendering hints that the context has.
NS_IMETHOD PushState (void)=0
 Save a graphical state onto a stack.
NS_IMETHOD PopState (void)=0
 Get and and set RenderingContext to this graphical state.
NS_IMETHOD IsVisibleRect (const nsRect &aRect, PRBool &aIsVisible)=0
 Tells if a given rectangle is visible within the rendering context.
NS_IMETHOD SetClipRect (const nsRect &aRect, nsClipCombine aCombine)=0
 Sets the clipping for the RenderingContext to the passed in rectangle.
NS_IMETHOD GetClipRect (nsRect &aRect, PRBool &aHasLocalClip)=0
 Gets the bounds of the clip region of the RenderingContext.
NS_IMETHOD SetLineStyle (nsLineStyle aLineStyle)=0
 Sets the line style for the RenderingContext.
NS_IMETHOD GetLineStyle (nsLineStyle &aLineStyle)=0
 Gets the line style for the RenderingContext.
NS_IMETHOD SetClipRegion (const nsIRegion &aRegion, nsClipCombine aCombine)=0
 Sets the clipping for the RenderingContext to the passed in region.
NS_IMETHOD CopyClipRegion (nsIRegion &aRegion)=0
 Gets a copy of the current clipping region for the RenderingContext The region is in device coordinates!
NS_IMETHOD GetClipRegion (nsIRegion **aRegion)=0
 Gets the current clipping region for the RenderingContext The region is in device coordinates!
NS_IMETHOD SetColor (nscolor aColor)=0
 Sets the forground color for the RenderingContext.
NS_IMETHOD GetColor (nscolor &aColor) const =0
 Get the forground color for the RenderingContext.
NS_IMETHOD SetFont (const nsFont &aFont, nsIAtom *aLangGroup)=0
 Sets the font for the RenderingContext.
NS_IMETHOD SetFont (nsIFontMetrics *aFontMetrics)=0
 Sets the font for the RenderingContext.
NS_IMETHOD GetFontMetrics (nsIFontMetrics *&aFontMetrics)=0
 Get the current fontmetrics for the RenderingContext.
NS_IMETHOD Translate (nscoord aX, nscoord aY)=0
 Add in a translate to the RenderingContext's transformation matrix.
NS_IMETHOD Scale (float aSx, float aSy)=0
 Add in a scale to the RenderingContext's transformation matrix.
NS_IMETHOD GetCurrentTransform (nsTransform2D *&aTransform)=0
 Get the current transformation matrix for the RenderingContext.
NS_IMETHOD CreateDrawingSurface (const nsRect &aBounds, PRUint32 aSurfFlags, nsIDrawingSurface *&aSurface)=0
 Create an offscreen drawing surface compatible with this RenderingContext.
NS_IMETHOD DestroyDrawingSurface (nsIDrawingSurface *aDS)=0
 Destroy a drawing surface created by CreateDrawingSurface()
NS_IMETHOD DrawLine (nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1)=0
 Draw a line.
NS_IMETHOD DrawPolyline (const nsPoint aPoints[], PRInt32 aNumPoints)=0
 Draw a polyline.
NS_IMETHOD DrawRect (const nsRect &aRect)=0
 Draw a rectangle.
NS_IMETHOD DrawRect (nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)=0
 Draw a rectangle.
NS_IMETHOD FillRect (const nsRect &aRect)=0
 Fill a rectangle in the current foreground color.
NS_IMETHOD FillRect (nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)=0
 Fill a rectangle in the current foreground color.
NS_IMETHOD InvertRect (const nsRect &aRect)=0
 XOR Invert a rectangle in the current foreground color.
NS_IMETHOD InvertRect (nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)=0
 XOR Invert a rectangle in the current foreground color.
NS_IMETHOD DrawPolygon (const nsPoint aPoints[], PRInt32 aNumPoints)=0
 Draw a poly in the current foreground color.
NS_IMETHOD FillPolygon (const nsPoint aPoints[], PRInt32 aNumPoints)=0
 Fill a poly in the current foreground color.
NS_IMETHOD DrawEllipse (const nsRect &aRect)=0
 Draw an ellipse in the current foreground color.
NS_IMETHOD DrawEllipse (nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)=0
 Draw an ellipse in the current foreground color.
NS_IMETHOD FillEllipse (const nsRect &aRect)=0
 Fill an ellipse in the current foreground color.
NS_IMETHOD FillEllipse (nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)=0
 Fill an ellipse in the current foreground color.
NS_IMETHOD DrawArc (const nsRect &aRect, float aStartAngle, float aEndAngle)=0
 Draw an arc in the current forground color.
NS_IMETHOD DrawArc (nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight, float aStartAngle, float aEndAngle)=0
 Draw an arc in the current forground color.
NS_IMETHOD FillArc (const nsRect &aRect, float aStartAngle, float aEndAngle)=0
 Fill an arc in the current forground color.
NS_IMETHOD FillArc (nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight, float aStartAngle, float aEndAngle)=0
 Fill an arc in the current forground color.
NS_IMETHOD CopyOffScreenBits (nsIDrawingSurface *aSrcSurf, PRInt32 aSrcX, PRInt32 aSrcY, const nsRect &aDestBounds, PRUint32 aCopyFlags)=0
 Copy offscreen pixelmap to this RenderingContext.
NS_IMETHOD RetrieveCurrentNativeGraphicData (void **ngd)=0

Protected Member Functions

virtual ~nsRenderingContextImpl ()
 
See documentation in nsIRenderingContext.h 3/16/00 dwc
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

nsTransform2D * mTranMatrix
int mAct
EdgemActive
nsPenMode mPenMode

Static Private Attributes

static nsIDrawingSurfacegBackbuffer = nsnull
static nsRect gBackbufferBounds = nsRect(0, 0, 0, 0)
static nsSize gLargestRequestedSize = nsSize(0, 0)

Detailed Description

Definition at line 56 of file nsRenderingContextImpl.h.


Constructor & Destructor Documentation


See documentation in nsIRenderingContext.h 3/16/00 dwc

Definition at line 58 of file nsRenderingContextImpl.cpp.


See documentation in nsIRenderingContext.h 3/16/00 dwc

Definition at line 70 of file nsRenderingContextImpl.cpp.

{


}

Member Function Documentation

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

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]

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]

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:

NS_IMETHOD nsIRenderingContext::CopyClipRegion ( nsIRegion aRegion) [pure virtual, inherited]

Gets a copy of the current clipping region for the RenderingContext The region is in device coordinates!

Parameters:
aRegioninout parameter representing the clip region. if SetClipRegion() is called, do not assume that GetClipRegion() will return the same object.

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsCairoRenderingContext, nsRenderingContextMac, and nsRenderingContextBeOS.

NS_IMETHOD nsIRenderingContext::CopyOffScreenBits ( nsIDrawingSurface aSrcSurf,
PRInt32  aSrcX,
PRInt32  aSrcY,
const nsRect aDestBounds,
PRUint32  aCopyFlags 
) [pure virtual, inherited]

Copy offscreen pixelmap to this RenderingContext.

Parameters:
aSrcSurfdrawing surface to copy bits from
aSrcXx offset into source pixelmap to copy from
aSrcYy offset into source pixelmap to copy from
aDestBoundsDestination rectangle to copy to
aCopyFlagssee below

Implemented in nsRenderingContextPh, nsRenderingContextWin, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextQt, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextMac, nsCairoRenderingContext, and nsRenderingContextBeOS.

NS_IMETHOD nsIRenderingContext::CreateDrawingSurface ( const nsRect aBounds,
PRUint32  aSurfFlags,
nsIDrawingSurface *&  aSurface 
) [pure virtual, inherited]

Create an offscreen drawing surface compatible with this RenderingContext.

The rect passed in is not affected by any transforms in the rendering context and the values are in device units.

Parameters:
aBoundsA rectangle representing the size for the drawing surface. if nsnull then a bitmap will not be created and associated with the new drawing surface
aSurfFlagssee bottom of nsIRenderingContext.h
Returns:
A nsIDrawingSurface*

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

Here is the caller graph for this function:

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:

Destroy a drawing surface created by CreateDrawingSurface()

Parameters:
aDSA drawing surface to destroy

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

Here is the caller graph for this function:

NS_IMETHOD nsIRenderingContext::DrawArc ( const nsRect aRect,
float  aStartAngle,
float  aEndAngle 
) [pure virtual, inherited]

Draw an arc in the current forground color.

Parameters:
aRectThe rectangle define bounds of ellipse to use
aStartAnglethe starting angle of the arc, in degrees
aEndAngleThe ending angle of the arc, in degrees

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextWin, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

NS_IMETHOD nsIRenderingContext::DrawArc ( nscoord  aX,
nscoord  aY,
nscoord  aWidth,
nscoord  aHeight,
float  aStartAngle,
float  aEndAngle 
) [pure virtual, inherited]

Draw an arc in the current forground color.

Parameters:
aXHorizontal left Coordinate in twips
aYVertical top Coordinate in twips
aWidthWidth of horizontal axis in twips
aHeightHeight of vertical axis in twips
aStartAnglethe starting angle of the arc, in degrees
aEndAngleThe ending angle of the arc, in degrees

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextWin, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

NS_IMETHOD nsIRenderingContext::DrawEllipse ( const nsRect aRect) [pure virtual, inherited]

Draw an ellipse in the current foreground color.

Parameters:
aRectThe rectangle define bounds of ellipse to draw

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextWin, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

Here is the caller graph for this function:

NS_IMETHOD nsIRenderingContext::DrawEllipse ( nscoord  aX,
nscoord  aY,
nscoord  aWidth,
nscoord  aHeight 
) [pure virtual, inherited]

Draw an ellipse in the current foreground color.

Parameters:
aXHorizontal left Coordinate in twips
aYVertical top Coordinate in twips
aWidthWidth of horizontal axis in twips
aHeightHeight of vertical axis in twips

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextWin, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

NS_IMETHODIMP nsRenderingContextImpl::DrawImage ( imgIContainer aImage,
const nsRect aSrcRect,
const nsRect aDestRect 
) [virtual]

Draw a portion of an image, scaling it to fit within 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.

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextXlib, nsRenderingContextMac, and nsRenderingContextXp.

Definition at line 304 of file nsRenderingContextImpl.cpp.

{
  nsRect dr = aDestRect;
  mTranMatrix->TransformCoord(&dr.x, &dr.y, &dr.width, &dr.height);

  nsRect sr = aSrcRect;
  mTranMatrix->TransformCoord(&sr.x, &sr.y, &sr.width, &sr.height);
  
  if (sr.IsEmpty() || dr.IsEmpty())
    return NS_OK;

  sr.x = aSrcRect.x;
  sr.y = aSrcRect.y;
  mTranMatrix->TransformNoXLateCoord(&sr.x, &sr.y);

  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;

  nsIDrawingSurface *surface = nsnull;
  GetDrawingSurface(&surface);
  if (!surface) return NS_ERROR_FAILURE;

  // For Bug 87819
  // iframe may want image to start at different position, so adjust
  nsRect iframeRect;
  iframe->GetRect(iframeRect);
  
  if (iframeRect.x > 0) {
    // Adjust for the iframe offset before we do scaling.
    sr.x -= iframeRect.x;

    nscoord scaled_x = sr.x;
    if (dr.width != sr.width) {
      PRFloat64 scale_ratio = PRFloat64(dr.width) / PRFloat64(sr.width);
      scaled_x = NSToCoordRound(scaled_x * scale_ratio);
    }
    if (sr.x < 0) {
      dr.x -= scaled_x;
      sr.width += sr.x;
      dr.width += scaled_x;
      if (sr.width <= 0 || dr.width <= 0)
        return NS_OK;
      sr.x = 0;
    } else if (sr.x > iframeRect.width) {
      return NS_OK;
    }
  }

  if (iframeRect.y > 0) {
    // Adjust for the iframe offset before we do scaling.
    sr.y -= iframeRect.y;

    nscoord scaled_y = sr.y;
    if (dr.height != sr.height) {
      PRFloat64 scale_ratio = PRFloat64(dr.height) / PRFloat64(sr.height);
      scaled_y = NSToCoordRound(scaled_y * scale_ratio);
    }
    if (sr.y < 0) {
      dr.y -= scaled_y;
      sr.height += sr.y;
      dr.height += scaled_y;
      if (sr.height <= 0 || dr.height <= 0)
        return NS_OK;
      sr.y = 0;
    } else if (sr.y > iframeRect.height) {
      return NS_OK;
    }
  }

  // Multiple paint rects may have been coalesced into a bounding box, so
  // ensure that this rect is actually within the clip region before we draw.
  nsCOMPtr<nsIRegion> clipRegion;
  GetClipRegion(getter_AddRefs(clipRegion));
  if (clipRegion && !clipRegion->ContainsRect(dr.x, dr.y, dr.width, dr.height))
    return NS_OK;

  return img->Draw(*this, surface, sr.x, sr.y, sr.width, sr.height,
                   dr.x, dr.y, dr.width, dr.height);
}

Here is the call graph for this function:

NS_IMETHOD nsIRenderingContext::DrawLine ( nscoord  aX0,
nscoord  aY0,
nscoord  aX1,
nscoord  aY1 
) [pure virtual, inherited]

Draw a line.

Parameters:
aXOstarting horiztonal coord in twips
aY0starting vertical coord in twips
aX1end horiztonal coord in twips
aY1end vertical coord in twips

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

Here is the caller graph for this function:

NS_IMETHOD nsIRenderingContext::DrawPolygon ( const nsPoint  aPoints[],
PRInt32  aNumPoints 
) [pure virtual, inherited]

Draw a poly in the current foreground color.

Parameters:
aPointspoints to use for the drawing, last must equal first
aNumPontsnumber of points in the polygon

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

NS_IMETHOD nsIRenderingContext::DrawPolyline ( const nsPoint  aPoints[],
PRInt32  aNumPoints 
) [pure virtual, inherited]

Draw a polyline.

Parameters:
aPointsarray of endpoints
aNumPontsnumber of points

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

Here is the caller graph for this function:

NS_IMETHOD nsIRenderingContext::DrawRect ( const nsRect aRect) [pure virtual, inherited]

Draw a rectangle.

Parameters:
aRectThe rectangle to draw

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

Here is the caller graph for this function:

NS_IMETHOD nsIRenderingContext::DrawRect ( nscoord  aX,
nscoord  aY,
nscoord  aWidth,
nscoord  aHeight 
) [pure virtual, inherited]

Draw a rectangle.

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

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

NS_IMETHODIMP nsRenderingContextImpl::DrawString ( const nsString aString,
nscoord  aX,
nscoord  aY,
PRInt32  aFontID = -1,
const nscoord aSpacing = nsnull 
) [virtual]

Draw a string in the RenderingContext.

Parameters:
aStringA nsString of the string
aXHorizontal starting point of baseline
aYVertical starting point of baseline.
aFontIDan optional parameter used to speed font selection for complex unicode strings. the value passed is returned by the DrawString() methods.
aSpacinginter-character spacing to apply

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextPh, nsRenderingContextQt, nsRenderingContextOS2, nsRenderingContextBeOS, nsRenderingContextXlib, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextGTK, and nsRenderingContextMac.

Definition at line 551 of file nsRenderingContextImpl.cpp.

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

Here is the call graph for this function:

NS_IMETHODIMP nsRenderingContextImpl::DrawString ( const char *  aString,
PRUint32  aLength,
nscoord  aX,
nscoord  aY,
const nscoord aSpacing = nsnull 
) [virtual]

Draw a string in the RenderingContext.

Parameters:
aStringThe string to draw
aLengthThe length of the aString
aXHorizontal starting point of baseline
aYVertical starting point of baseline.
aSpacinginter-character spacing to apply

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextPh, nsRenderingContextQt, nsRenderingContextOS2, nsRenderingContextBeOS, nsRenderingContextXlib, and nsRenderingContextPS.

Definition at line 847 of file nsRenderingContextImpl.cpp.

{
  PRUint32 maxChunkLength = GetMaxChunkLength(this);
  while (aLength > 0) {
    PRInt32 len = FindSafeLength(this, aString, aLength, maxChunkLength);
    nsresult rv = DrawStringInternal(aString, len, aX, aY);
    if (NS_FAILED(rv))
      return rv;
    aLength -= len;

    if (aLength > 0) {
      nscoord width;
      rv = GetWidthInternal(aString, len, width);
      if (NS_FAILED(rv))
        return rv;
      aX += width;
      aString += len;
    }
  }
  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsRenderingContextImpl::DrawString ( const PRUnichar aString,
PRUint32  aLength,
nscoord  aX,
nscoord  aY,
PRInt32  aFontID = -1,
const nscoord aSpacing = nsnull 
) [virtual]

Draw a string in the RenderingContext.

Parameters:
aStringA PRUnichar of the string
aLengthThe length of the aString
aXHorizontal starting point of baseline
aYVertical starting point of baseline.
aFontIDan optional parameter used to speed font selection for complex unicode strings. the value passed is returned by the DrawString() methods.
aSpacinginter-character spacing to apply

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextPh, nsRenderingContextQt, nsRenderingContextOS2, nsRenderingContextBeOS, nsRenderingContextXlib, and nsRenderingContextPS.

Definition at line 872 of file nsRenderingContextImpl.cpp.

{
  PRUint32 maxChunkLength = GetMaxChunkLength(this);
  if (aLength <= maxChunkLength) {
    return DrawStringInternal(aString, aLength, aX, aY, aFontID, aSpacing);
  }

  PRBool isRTL = PR_FALSE;
  GetRightToLeftText(&isRTL);

  if (isRTL) {
    nscoord totalWidth = 0;
    if (aSpacing) {
      for (PRUint32 i = 0; i < aLength; ++i) {
        totalWidth += aSpacing[i];
      }
    } else {
      nsresult rv = GetWidth(aString, aLength, totalWidth);
      if (NS_FAILED(rv))
        return rv;
    }
    aX += totalWidth;
  }
  
  while (aLength > 0) {
    PRInt32 len = FindSafeLength(this, aString, aLength, maxChunkLength);
    nscoord width = 0;
    if (aSpacing) {
      for (PRInt32 i = 0; i < len; ++i) {
        width += aSpacing[i];
      }
    } else {
      nsresult rv = GetWidthInternal(aString, len, width);
      if (NS_FAILED(rv))
        return rv;
    }

    if (isRTL) {
      aX -= width;
    }
    nsresult rv = DrawStringInternal(aString, len, aX, aY, aFontID, aSpacing);
    if (NS_FAILED(rv))
      return rv;
    aLength -= len;
    if (!isRTL) {
      aX += width;
    }
    aString += len;
    if (aSpacing) {
      aSpacing += len;
    }
  }
  return NS_OK;
}

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]

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]
NS_IMETHODIMP nsRenderingContextImpl::DrawTile ( imgIContainer aImage,
nscoord  aXOffset,
nscoord  aYOffset,
const nsRect aTargetRect 
) [virtual]

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextPS, nsRenderingContextMac, and nsRenderingContextXp.

Definition at line 390 of file nsRenderingContextImpl.cpp.

{
  nsRect dr(*aTargetRect);
  mTranMatrix->TransformCoord(&dr.x, &dr.y, &dr.width, &dr.height);
  mTranMatrix->TransformCoord(&aXImageStart, &aYImageStart);

  // may have become empty due to transform shinking small number to 0
  if (dr.IsEmpty())
    return NS_OK;

  nscoord width, height;
  aImage->GetWidth(&width);
  aImage->GetHeight(&height);

  if (width == 0 || height == 0)
    return NS_OK;

  nscoord xOffset = (dr.x - aXImageStart) % width;
  nscoord yOffset = (dr.y - aYImageStart) % height;

  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;

  nsIDrawingSurface *surface = nsnull;
  GetDrawingSurface(&surface);
  if (!surface) return NS_ERROR_FAILURE;

  /* bug 113561 - frame can be smaller than container */
  nsRect iframeRect;
  iframe->GetRect(iframeRect);
  PRInt32 padx = width - iframeRect.width;
  PRInt32 pady = height - iframeRect.height;

  return img->DrawTile(*this, surface,
                       xOffset - iframeRect.x, yOffset - iframeRect.y,
                       padx, pady,
                       dr);
}

Here is the call graph for this function:

NS_IMETHOD nsIRenderingContext::FillArc ( const nsRect aRect,
float  aStartAngle,
float  aEndAngle 
) [pure virtual, inherited]

Fill an arc in the current forground color.

Parameters:
aRectThe rectangle define bounds of ellipse to use
aStartAnglethe starting angle of the arc, in degrees
aEndAngleThe ending angle of the arc, in degrees

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextWin, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

NS_IMETHOD nsIRenderingContext::FillArc ( nscoord  aX,
nscoord  aY,
nscoord  aWidth,
nscoord  aHeight,
float  aStartAngle,
float  aEndAngle 
) [pure virtual, inherited]

Fill an arc in the current forground color.

Parameters:
aXHorizontal left Coordinate in twips
aYVertical top Coordinate in twips
aWidthWidth of horizontal axis in twips
aHeightHeight of vertical axis in twips
aStartAnglethe starting angle of the arc, in degrees
aEndAngleThe ending angle of the arc, in degrees

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextWin, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

NS_IMETHOD nsIRenderingContext::FillEllipse ( const nsRect aRect) [pure virtual, inherited]

Fill an ellipse in the current foreground color.

Parameters:
aRectThe rectangle define bounds of ellipse to draw

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextWin, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

Here is the caller graph for this function:

NS_IMETHOD nsIRenderingContext::FillEllipse ( nscoord  aX,
nscoord  aY,
nscoord  aWidth,
nscoord  aHeight 
) [pure virtual, inherited]

Fill an ellipse in the current foreground color.

Parameters:
aXHorizontal left Coordinate in twips
aYVertical top Coordinate in twips
aWidthWidth of horizontal axis in twips
aHeightHeight of vertical axis in twips

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextWin, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

NS_IMETHOD nsIRenderingContext::FillPolygon ( const nsPoint  aPoints[],
PRInt32  aNumPoints 
) [pure virtual, inherited]

Fill a poly in the current foreground color.

Parameters:
aPointspoints to use for the drawing, last must equal first
aNumPontsnumber of points in the polygon

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

Here is the caller graph for this function:

NS_IMETHOD nsIRenderingContext::FillRect ( const nsRect aRect) [pure virtual, inherited]

Fill a rectangle in the current foreground color.

Parameters:
aRectThe rectangle to draw

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

Here is the caller graph for this function:

NS_IMETHOD nsIRenderingContext::FillRect ( nscoord  aX,
nscoord  aY,
nscoord  aWidth,
nscoord  aHeight 
) [pure virtual, inherited]

Fill 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

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

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]

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]

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_IMETHOD nsIRenderingContext::GetClipRect ( nsRect aRect,
PRBool aHasLocalClip 
) [pure virtual, inherited]

Gets the bounds of the clip region of the RenderingContext.

The bounds are returned in device units!

Parameters:
aRectout parameter to contain the clip region bounds for the RenderingContext
Returns:
PR_TRUE if the rendering context has a local cliprect set else aRect is undefined

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsCairoRenderingContext, nsRenderingContextMac, and nsRenderingContextBeOS.

Here is the caller graph for this function:

NS_IMETHOD nsIRenderingContext::GetClipRegion ( nsIRegion **  aRegion) [pure virtual, inherited]

Gets the current clipping region for the RenderingContext The region is in device coordinates!

Parameters:
aRegionout parameter representing the clip region. if SetClipRegion() is called, do not assume that GetClipRegion() will return the same object.

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsCairoRenderingContext, nsRenderingContextMac, and nsRenderingContextBeOS.

Here is the caller graph for this function:

NS_IMETHODIMP nsRenderingContextImpl::GetClusterInfo ( const PRUnichar aText,
PRUint32  aLength,
PRUint8 aClusterStarts 
) [virtual]

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_IMETHOD nsIRenderingContext::GetColor ( nscolor aColor) const [pure virtual, inherited]

Get the forground color for the RenderingContext.

Returns:
The current forground color of the RenderingContext

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsCairoRenderingContext, nsRenderingContextBeOS, and nsRenderingContextMac.

Here is the caller graph for this function:

NS_IMETHOD nsIRenderingContext::GetCurrentTransform ( nsTransform2D *&  aTransform) [pure virtual, inherited]

Get the current transformation matrix for the RenderingContext.

Returns:
The transformation matrix for the RenderingContext

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

Here is the caller graph for this function:

NS_IMETHOD nsIRenderingContext::GetDeviceContext ( nsIDeviceContext *&  aDeviceContext) [pure virtual, inherited]

Get the DeviceContext that this RenderingContext was initialized with.

Returns:
the device context

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextMac, nsCairoRenderingContext, nsRenderingContextGTK, and nsRenderingContextBeOS.

Here is the caller graph for this function:

NS_IMETHOD nsIRenderingContext::GetDrawingSurface ( nsIDrawingSurface **  aSurface) [pure virtual, inherited]

Get the currently selected drawing surface.

Parameters:
aSurfaceout parameter for the current drawing surface

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextPS, nsRenderingContextWin, nsCairoRenderingContext, nsRenderingContextGTK, nsRenderingContextMac, and nsRenderingContextBeOS.

Here is the caller graph for this function:

void nsRenderingContextImpl::GetDrawingSurfaceSize ( const nsRect aMaxBackbufferSize,
const nsRect aRequestedSize,
nsRect aSurfaceSize 
) [protected]

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:

NS_IMETHOD nsIRenderingContext::GetFontMetrics ( nsIFontMetrics *&  aFontMetrics) [pure virtual, inherited]

Get the current fontmetrics for the RenderingContext.

Returns:
The current font of the RenderingContext

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

Here is the caller graph for this function:

NS_IMETHOD nsIRenderingContext::GetHints ( PRUint32 aResult) [pure virtual, inherited]

Returns in aResult any rendering hints that the context has.

See below for the hints bits. Always returns NS_OK.

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextPS, nsRenderingContextWin, nsCairoRenderingContext, nsRenderingContextGTK, nsRenderingContextMac, and nsRenderingContextBeOS.

Here is the caller graph for this function:

NS_IMETHOD nsIRenderingContext::GetLineStyle ( nsLineStyle aLineStyle) [pure virtual, inherited]

Gets the line style for the RenderingContext.

Parameters:
aLineStyleThe line style to be retrieved
Returns:
NS_OK if the line style is correctly retrieved

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextBeOS, nsRenderingContextMac, and nsCairoRenderingContext.

virtual PRInt32 nsRenderingContextImpl::GetMaxStringLength ( ) [inline, virtual]

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]

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]

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;
}
NS_IMETHODIMP nsRenderingContextImpl::GetRangeWidth ( const PRUnichar aText,
PRUint32  aLength,
PRUint32  aStart,
PRUint32  aEnd,
PRUint32 aWidth 
) [virtual]

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]

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 nsRenderingContextImpl::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)

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextPh, nsRenderingContextPS, nsRenderingContextXlib, nsRenderingContextOS2, nsRenderingContextQt, and nsRenderingContextBeOS.

Definition at line 601 of file nsRenderingContextImpl.cpp.

{
  PRUint32 maxChunkLength = GetMaxChunkLength(this);
  if (aLength <= maxChunkLength)
    return GetTextDimensionsInternal(aString, aLength, aDimensions);
 
  PRBool firstIteration = PR_TRUE;
  while (aLength > 0) {
    PRInt32 len = FindSafeLength(this, aString, aLength, maxChunkLength);
    nsTextDimensions dimensions;
    nsresult rv = GetTextDimensionsInternal(aString, len, dimensions);
    if (NS_FAILED(rv))
      return rv;
    if (firstIteration) {
      // Instead of combining with a Clear()ed nsTextDimensions, we assign
      // directly in the first iteration. This ensures that negative ascent/
      // descent can be returned.
      aDimensions = dimensions;
    } else {
      aDimensions.Combine(dimensions);
    }
    aLength -= len;
    aString += len;
    firstIteration = PR_FALSE;
  }
  return NS_OK;
}

Here is the call graph for this function:

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

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextPh, nsRenderingContextPS, nsRenderingContextXlib, nsRenderingContextOS2, nsRenderingContextQt, and nsRenderingContextBeOS.

Definition at line 631 of file nsRenderingContextImpl.cpp.

{
  PRUint32 maxChunkLength = GetMaxChunkLength(this);
  if (aLength <= maxChunkLength)
    return GetTextDimensionsInternal(aString, aLength, aDimensions);
    
  if (aFontID) {
    *aFontID = nsnull;
  }
 
  PRBool firstIteration = PR_TRUE;
  while (aLength > 0) {
    PRInt32 len = FindSafeLength(this, aString, aLength, maxChunkLength);
    nsTextDimensions dimensions;
    nsresult rv = GetTextDimensionsInternal(aString, len, dimensions);
    if (NS_FAILED(rv))
      return rv;
    if (firstIteration) {
      // Instead of combining with a Clear()ed nsTextDimensions, we assign
      // directly in the first iteration. This ensures that negative ascent/
      // descent can be returned.
      aDimensions = dimensions;
    } else {
      aDimensions.Combine(dimensions);
    }
    aLength -= len;
    aString += len;
    firstIteration = PR_FALSE;
  }
  return NS_OK;  
}

Here is the call graph for this function:

NS_IMETHOD nsRenderingContextImpl::GetTextDimensionsInternal ( const char *  aString,
PRUint32  aLength,
nsTextDimensions aDimensions 
) [inline]

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]
NS_IMETHOD nsRenderingContextImpl::GetWidth ( char  aC,
nscoord aWidth 
) [pure virtual]

Returns the width (in app units) of an 8-bit character If no font has been Set, the results are undefined.

Parameters:
aCcharacter to measure
aWidthout parameter for width
Returns:
error status

Implements nsIRenderingContext.

Implemented in nsRenderingContextPh, nsRenderingContextWin, nsRenderingContextGTK, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextPS, nsRenderingContextMac, and nsRenderingContextBeOS.

Here is the caller graph for this function:

NS_IMETHOD nsRenderingContextImpl::GetWidth ( PRUnichar  aC,
nscoord aWidth,
PRInt32 aFontID = nsnull 
) [pure virtual]

Returns the width (in app units) of a unicode character If no font has been Set, the results are undefined.

Parameters:
aCcharacter to measure
aWidthout parameter for width
aFontIDan optional out parameter used to store a font identifier that can be passed into the DrawString() methods to speed rendering
Returns:
error status

Implements nsIRenderingContext.

Implemented in nsRenderingContextPh, nsRenderingContextWin, nsRenderingContextGTK, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextPS, nsRenderingContextMac, and nsRenderingContextBeOS.

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

Returns the width (in app units) of an nsString If no font has been Set, the results are undefined.

Parameters:
aStringstring to measure
aWidthout parameter for width
aFontIDan optional out parameter used to store a font identifier that can be passed into the DrawString() methods to speed rendering
Returns:
error status

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextWin, nsRenderingContextPS, nsRenderingContextGTK, nsRenderingContextBeOS, and nsRenderingContextMac.

Definition at line 538 of file nsRenderingContextImpl.cpp.

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

Here is the call graph for this function:

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

Returns the width (in app units) of an 8-bit character string If no font has been Set, the results are undefined.

Parameters:
aStringstring to measure
aWidthout parameter for width
Returns:
error status

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextWin, nsRenderingContextPS, nsRenderingContextGTK, nsRenderingContextBeOS, and nsRenderingContextMac.

Definition at line 545 of file nsRenderingContextImpl.cpp.

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

Here is the call graph for this function:

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

Returns the width (in app units) of an 8-bit character string If no font has been Set, the results are undefined.

Parameters:
aStringstring to measure
aLengthnumber of characters in string
aWidthout parameter for width
Returns:
error status

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextWin, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextBeOS, and nsRenderingContextMac.

Definition at line 558 of file nsRenderingContextImpl.cpp.

{
  PRUint32 maxChunkLength = GetMaxChunkLength(this);
  aWidth = 0;
  while (aLength > 0) {
    PRInt32 len = FindSafeLength(this, aString, aLength, maxChunkLength);
    nscoord width;
    nsresult rv = GetWidthInternal(aString, len, width);
    if (NS_FAILED(rv))
      return rv;
    aWidth += width;
    aLength -= len;
    aString += len;
  }
  return NS_OK;
}

Here is the call graph for this function:

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

Returns the width (in app units) of a Unicode character string If no font has been Set, the results are undefined.

Parameters:
aStringstring to measure
aLengthnumber of characters in string
aWidthout parameter for width
aFontIDan optional out parameter used to store a font identifier that can be passed into the DrawString() methods to speed rendering
Returns:
error status

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextWin, nsRenderingContextGTK, nsRenderingContextQt, nsRenderingContextPS, nsRenderingContextBeOS, and nsRenderingContextMac.

Definition at line 577 of file nsRenderingContextImpl.cpp.

{
  PRUint32 maxChunkLength = GetMaxChunkLength(this);
  aWidth = 0;
  
  if (aFontID) {
    *aFontID = 0;
  }
  
  while (aLength > 0) {
    PRInt32 len = FindSafeLength(this, aString, aLength, maxChunkLength);
    nscoord width;
    nsresult rv = GetWidthInternal(aString, len, width);
    if (NS_FAILED(rv))
      return rv;
    aWidth += width;
    aLength -= len;
    aString += len;
  }
  return NS_OK;
}  

Here is the call graph for this function:

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

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]
NS_IMETHOD nsIRenderingContext::Init ( nsIDeviceContext aContext,
nsIWidget aWidget 
) [pure virtual, inherited]

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

Implemented in nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextPh, nsRenderingContextQt, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextMac, nsCairoRenderingContext, nsRenderingContextGTK, nsRenderingContextBeOS, and nsRenderingContextXp.

Here is the caller graph for this function:

NS_IMETHOD nsIRenderingContext::Init ( nsIDeviceContext aContext,
nsIDrawingSurface aSurface 
) [pure virtual, inherited]

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

Implemented in nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextPh, nsRenderingContextQt, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextMac, nsCairoRenderingContext, nsRenderingContextGTK, nsRenderingContextBeOS, and nsRenderingContextXp.

NS_IMETHOD nsIRenderingContext::InvertRect ( const nsRect aRect) [pure virtual, inherited]

XOR Invert a rectangle in the current foreground color.

Parameters:
aRectThe rectangle to draw

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

Here is the caller graph for this function:

NS_IMETHOD nsIRenderingContext::InvertRect ( nscoord  aX,
nscoord  aY,
nscoord  aWidth,
nscoord  aHeight 
) [pure virtual, inherited]

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

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

NS_IMETHOD nsIRenderingContext::IsVisibleRect ( const nsRect aRect,
PRBool aIsVisible 
) [pure virtual, inherited]

Tells if a given rectangle is visible within the rendering context.

Parameters:
aRectis the rectangle that will be checked for visiblity
Returns:
If true, that rectanglular area is visable.

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsCairoRenderingContext, nsRenderingContextMac, and nsRenderingContextBeOS.

NS_IMETHOD nsIRenderingContext::LockDrawingSurface ( PRInt32  aX,
PRInt32  aY,
PRUint32  aWidth,
PRUint32  aHeight,
void **  aBits,
PRInt32 aStride,
PRInt32 aWidthBytes,
PRUint32  aFlags 
) [pure virtual, inherited]

Lock a rect of the drawing surface associated with the rendering context.

do not attempt to use any of the Rendering Context rendering or state management methods until the drawing surface has been Unlock()ed. if a drawing surface is Lock()ed with this method, it must be Unlock()ed by calling UnlockDrawingSurface() rather than just calling the Unlock() method on the drawing surface directly. see nsIDrawingSurface.h for more information

Returns:
error status

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextPS, nsRenderingContextWin, nsCairoRenderingContext, nsRenderingContextGTK, nsRenderingContextMac, nsRenderingContextBeOS, and nsRenderingContextXp.

NS_IMETHOD nsIRenderingContext::PopState ( void  ) [pure virtual, inherited]

Get and and set RenderingContext to this graphical state.

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsCairoRenderingContext, nsRenderingContextMac, and nsRenderingContextBeOS.

Here is the caller 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:

NS_IMETHOD nsIRenderingContext::PushState ( void  ) [pure virtual, inherited]

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]

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 nsRenderingContextImpl::RenderEPS ( const nsRect aRect,
FILE aDataFile 
) [virtual]

Render an encapsulated postscript object onto the current rendering surface.

The EPS object must conform to the EPSF standard. See Adobe specification #5002, "Encapsulated PostScript File Format Specification" at http://partners.adobe.com/asn/developer/pdfs/tn/5002.EPSF_Spec.pdf. In particular, the EPS object must contain a BoundingBox comment.

Parameters:
aRectRectangle in which to render the EPSF.
aDataFile- plugin data stored in a file
Returns:
NS_OK for success, or a suitable error value. NS_ERROR_NOT_IMPLEMENTED is returned if the rendering context doesn't support rendering EPSF,

Implements nsIRenderingContext.

Reimplemented in nsRenderingContextPS, and nsRenderingContextXp.

Definition at line 931 of file nsRenderingContextImpl.cpp.

NS_IMETHOD nsIRenderingContext::Reset ( void  ) [pure virtual, inherited]
NS_IMETHOD nsIRenderingContext::Scale ( float  aSx,
float  aSy 
) [pure virtual, inherited]

Add in a scale to the RenderingContext's transformation matrix.

Parameters:
aXThe horizontal scale
aYThe vertical scale

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

Here is the caller graph for this function:

Selects an offscreen drawing surface into the RenderingContext to draw to.

Parameters:
aSurfaceis the offscreen surface we are going to draw to. if nsnull, the original drawing surface obtained at initialization should be selected.

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextPS, nsRenderingContextWin, nsCairoRenderingContext, nsRenderingContextGTK, nsRenderingContextMac, and nsRenderingContextBeOS.

Here is the caller graph for this function:

NS_IMETHOD nsIRenderingContext::SetClipRect ( const nsRect aRect,
nsClipCombine  aCombine 
) [pure virtual, inherited]

Sets the clipping for the RenderingContext to the passed in rectangle.

The rectangle is in app units!

Parameters:
aRectThe rectangle to set the clipping rectangle to
aCombinehow to combine this rect with the current clip region. see the bottom of nsIRenderingContext.h

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsCairoRenderingContext, nsRenderingContextMac, and nsRenderingContextBeOS.

Here is the caller graph for this function:

NS_IMETHOD nsIRenderingContext::SetClipRegion ( const nsIRegion aRegion,
nsClipCombine  aCombine 
) [pure virtual, inherited]

Sets the clipping for the RenderingContext to the passed in region.

The region is in device coordinates!

Parameters:
aRegionThe region to set the clipping area to, IN DEVICE COORDINATES
aCombinehow to combine this region with the current clip region. see the bottom of nsIRenderingContext.h

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsCairoRenderingContext, nsRenderingContextMac, and nsRenderingContextBeOS.

Here is the caller graph for this function:

NS_IMETHOD nsIRenderingContext::SetColor ( nscolor  aColor) [pure virtual, inherited]

Sets the forground color for the RenderingContext.

Parameters:
aColorThe color to set the RenderingContext to

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsCairoRenderingContext, nsRenderingContextBeOS, and nsRenderingContextMac.

NS_IMETHOD nsIRenderingContext::SetFont ( const nsFont aFont,
nsIAtom aLangGroup 
) [pure virtual, inherited]

Sets the font for the RenderingContext.

Parameters:
aFontThe font to use in the RenderingContext

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsCairoRenderingContext, nsRenderingContextBeOS, and nsRenderingContextMac.

Here is the caller graph for this function:

NS_IMETHOD nsIRenderingContext::SetFont ( nsIFontMetrics aFontMetrics) [pure virtual, inherited]

Sets the font for the RenderingContext.

Parameters:
aFontMetricThe font metrics representing the font to use in the RenderingContext

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsCairoRenderingContext, nsRenderingContextBeOS, and nsRenderingContextMac.

NS_IMETHOD nsIRenderingContext::SetLineStyle ( nsLineStyle  aLineStyle) [pure virtual, inherited]

Sets the line style for the RenderingContext.

Parameters:
aLineStyleThe line style
Returns:
NS_OK if the line style is correctly set

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextBeOS, nsRenderingContextMac, and nsCairoRenderingContext.

Here is the caller graph for this function:

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

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;
}
NS_IMETHOD nsIRenderingContext::Translate ( nscoord  aX,
nscoord  aY 
) [pure virtual, inherited]

Add in a translate to the RenderingContext's transformation matrix.

Parameters:
aXThe horizontal translation
aYThe vertical translation

Implemented in nsRenderingContextPh, nsRenderingContextOS2, nsRenderingContextXlib, nsRenderingContextQt, nsRenderingContextGTK, nsRenderingContextPS, nsRenderingContextWin, nsRenderingContextBeOS, nsCairoRenderingContext, and nsRenderingContextMac.

Here is the caller graph for this function:

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

Definition at line 323 of file nsRenderingContextImpl.h.

nsRect nsRenderingContextImpl::gBackbufferBounds = nsRect(0, 0, 0, 0) [static, private]

Definition at line 324 of file nsRenderingContextImpl.h.

Definition at line 326 of file nsRenderingContextImpl.h.

Definition at line 65 of file nsRenderingContextImpl.h.

Definition at line 66 of file nsRenderingContextImpl.h.

Definition at line 321 of file nsRenderingContextImpl.h.

nsTransform2D* nsRenderingContextImpl::mTranMatrix [protected]

Definition at line 64 of file nsRenderingContextImpl.h.


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