Back to index

lightning-sunbird  0.9+nobinonly
Classes
Libart Rendering Engine

Classes

class  nsISVGLibartBitmap
 'Private' rendering engine interface More...
class  nsISVGLibartCanvas
 'Private' rendering engine interface More...
class  nsISVGLibartGlyphMetricsFT
 'Private' rendering engine interface More...
class  nsISVGLibartRegion
 'Private' rendering engine interface More...
class  nsSVGFill
class  nsSVGLibartBitmapAlpha
 A libart-bitmap implementation based on gfxIImageFrame that supports compositing through a very ugly hack. More...
class  nsSVGLibartBitmapDefault
 A libart-bitmap implementation based on gfxIImageFrame that should work on all platforms but doesn't support obtaining RenderingContexts with Lock/UnlockRenderingContext and is generally a bit of a hack. More...
class  nsSVGLibartBitmapGdk
 A libart-bitmap implementation for gtk 2.0. More...
class  nsSVGLibartBitmapMac
 A libart bitmap implementation based on gfxIImageFrame that should work for Mac but doesn't support obtaining RenderingContexts with Lock/UnlockRenderingContext. More...
class  nsSVGLibartBPathBuilder
 Libart path builder implementation. More...
class  nsSVGLibartCanvas
 Libart canvas implementation. More...
class  nsSVGLibartGlyphGeometry
 Libart glyph geometry implementation. More...
class  nsSVGLibartGlyphGeometryFT
 Libart freetype-based glyph geometry implementation. More...
class  nsSVGLibartGlyphMetrics
 Default Libart glyph metrics implementation. More...
class  nsSVGLibartGlyphMetricsFT
 Libart freetype-based glyph metrics implementation. More...
struct  nsSVGLibartGlyphMetricsFT::GlyphDescriptor
class  nsSVGLibartPathGeometry
 Libart path geometry implementation. More...
class  nsSVGLibartRegion
 Libart region implementation. More...
class  nsSVGRendererLibart
 Libart-based renderer implementation. More...
class  nsSVGRenderItem
 Wraps a libart sorted vector path. More...
class  nsSVGStroke

Class Documentation

class nsISVGLibartBitmap

'Private' rendering engine interface

Abstraction of a libart-compatible bitmap hiding platform-specific implementation details.

Definition at line 65 of file nsISVGLibartBitmap.h.

Inheritance diagram for nsISVGLibartBitmap:
Collaboration diagram for nsISVGLibartBitmap:

Public Types

enum  PixelFormat {
  PIXEL_FORMAT_24_RGB = 1, PIXEL_FORMAT_24_BGR = 2, PIXEL_FORMAT_32_ABGR = 3, PIXEL_FORMAT_32_RGBA = 4,
  PIXEL_FORMAT_32_BGRA = 5
}

Public Member Functions

 NS_IMETHOD_ (PRUint8 *) GetBits()=0
 NS_IMETHOD_ (PixelFormat) GetPixelFormat()=0
 NS_IMETHOD_ (int) GetLineStride()=0
 Linestride in bytes.
 NS_IMETHOD_ (int) GetWidth()=0
 Width in pixels.
 NS_IMETHOD_ (int) GetHeight()=0
 Height in pixels.
 NS_IMETHOD_ (void) LockRenderingContext(const nsRect &rect
 Obtain a rendering context for part of the bitmap.
 NS_IMETHOD_ (void) UnlockRenderingContext()=0
 NS_IMETHOD_ (void) Flush()=0
 Flush changes to the rendering context passed at initialization time.

Public Attributes

nsIRenderingContext ** ctx = 0

Member Enumeration Documentation

Enumerator:
PIXEL_FORMAT_24_RGB 
PIXEL_FORMAT_24_BGR 
PIXEL_FORMAT_32_ABGR 
PIXEL_FORMAT_32_RGBA 
PIXEL_FORMAT_32_BGRA 

Definition at line 70 of file nsISVGLibartBitmap.h.

                   {
    PIXEL_FORMAT_24_RGB  = 1, // linux
    PIXEL_FORMAT_24_BGR  = 2, // windows
    PIXEL_FORMAT_32_ABGR = 3, // mac
    PIXEL_FORMAT_32_RGBA = 4, // mac/linux + compositing
    PIXEL_FORMAT_32_BGRA = 5  // windows + compositing
  };

Member Function Documentation

Obtain a rendering context for part of the bitmap.

In general this will be different to the RC passed at initialization time.

Reimplemented in nsSVGLibartBitmapAlpha, nsSVGLibartBitmapDefault, nsSVGLibartBitmapMac, and nsSVGLibartBitmapGdk.


Member Data Documentation

class nsISVGLibartCanvas

'Private' rendering engine interface

Definition at line 59 of file nsISVGLibartCanvas.h.

Inheritance diagram for nsISVGLibartCanvas:
Collaboration diagram for nsISVGLibartCanvas:

Public Member Functions

 NS_IMETHOD_ (ArtRender *) NewRender()=0
 Deprecated.
 NS_IMETHOD_ (ArtRender *) NewRender(int x0
 Construct a new render object for the given rect.
 NS_IMETHOD_ (void) InvokeRender(ArtRender *render)=0
 Invoke the render object previously constructed with a call to NewRender().
 NS_IMETHOD_ (void) GetArtColor(nscolor rgb
 Convert an rgb value into a libart color value.
nsIRenderingContext lockRenderingContext ([const ] in nsRectRef rect)
 Lock a portion of the canvas and obtain a rendering context onto which Mozilla can paint non-svg content.
void unlockRenderingContext ()
 Unlock the canvas portion locked with a previous call to lockRenderingContext().
nsPresContext getPresContext ()
void clear (in nscolor color)
 Fill the canvas with the given color.
void flush ()
 Ensure that all renderings on the canvas have been flushed to the Mozilla-native rendering context.
void pushClip ()
 Push/Pop clip path.
void popClip ()
void setClipRect (in nsIDOMSVGMatrix canvasTM, in float x, in float y, in float width, in float height)
 Set rectangular clip region.
void pushSurface (in nsISVGRendererSurface surface)
 Push/Pop surface as primary drawing surface.
void popSurface ()
void compositeSurface (in nsISVGRendererSurface surface, in unsigned long x, in unsigned long y, in float opacity)
 Surface composition.
void compositeSurfaceMatrix (in nsISVGRendererSurface surface, in nsIDOMSVGMatrix canvasTM, in float opacity)

Static Public Member Functions

static const nsIIDGetIID ()

Public Attributes

int y0
int int x1
int int int y1 = 0
ArtColorartColor = 0
const unsigned short SVG_RENDER_MODE_NORMAL = 0
 Set render mode (clipping or normal draw)
const unsigned short SVG_RENDER_MODE_CLIP = 1
attribute unsigned short renderMode

Member Function Documentation

void nsISVGRendererCanvas::clear ( in nscolor  color) [inherited]

Fill the canvas with the given color.

Parameters:
colorFill color.
void nsISVGRendererCanvas::compositeSurface ( in nsISVGRendererSurface  surface,
in unsigned long  x,
in unsigned long  y,
in float  opacity 
) [inherited]

Surface composition.

void nsISVGRendererCanvas::compositeSurfaceMatrix ( in nsISVGRendererSurface  surface,
in nsIDOMSVGMatrix  canvasTM,
in float  opacity 
) [inherited]

Ensure that all renderings on the canvas have been flushed to the Mozilla-native rendering context.

static const nsIID& nsISVGLibartCanvas::GetIID ( ) [inline, static]

Definition at line 62 of file nsISVGLibartCanvas.h.

{ static nsIID iid = NS_ISVGLIBARTCANVAS_IID; return iid; }

Here is the caller graph for this function:

Lock a portion of the canvas and obtain a rendering context onto which Mozilla can paint non-svg content.

This is needed for (partial) foreignObject support.

lockRenderingContext() calls are paired with unlockRenderingContext() calls.

Parameters:
rectArea to be locked.
Returns:
Mozilla-native rendering context for the locked area.
nsISVGLibartCanvas::NS_IMETHOD_ ( ArtRender *  ) [pure virtual]

Deprecated.

Use NewRender(int x0, int y0, int x1, int y1).

Implemented in nsSVGLibartCanvas, and nsSVGLibartCanvas.

Construct a new render object for the given rect.

Returns:
New render object or 0 if the requested rect doesn't overlap the dirty rect or if there is an error.

Reimplemented in nsSVGLibartCanvas, and nsSVGLibartCanvas.

nsISVGLibartCanvas::NS_IMETHOD_ ( void  ) [pure virtual]

Invoke the render object previously constructed with a call to NewRender().

Implemented in nsSVGLibartCanvas, and nsSVGLibartCanvas.

Convert an rgb value into a libart color value.

Reimplemented in nsSVGLibartCanvas, and nsSVGLibartCanvas.

Push/Pop clip path.

Push/Pop surface as primary drawing surface.

void nsISVGRendererCanvas::setClipRect ( in nsIDOMSVGMatrix  canvasTM,
in float  x,
in float  y,
in float  width,
in float  height 
) [inherited]

Set rectangular clip region.

Unlock the canvas portion locked with a previous call to lockRenderingContext().


Member Data Documentation

Reimplemented in nsSVGLibartCanvas.

Definition at line 86 of file nsISVGLibartCanvas.h.

attribute unsigned short nsISVGRendererCanvas::renderMode [inherited]

Definition at line 115 of file nsISVGRendererCanvas.idl.

const unsigned short nsISVGRendererCanvas::SVG_RENDER_MODE_CLIP = 1 [inherited]

Definition at line 114 of file nsISVGRendererCanvas.idl.

const unsigned short nsISVGRendererCanvas::SVG_RENDER_MODE_NORMAL = 0 [inherited]

Set render mode (clipping or normal draw)

Definition at line 113 of file nsISVGRendererCanvas.idl.

Reimplemented in nsSVGLibartCanvas.

Definition at line 75 of file nsISVGLibartCanvas.h.

Reimplemented in nsSVGLibartCanvas.

Definition at line 75 of file nsISVGLibartCanvas.h.

Reimplemented in nsSVGLibartCanvas.

Definition at line 75 of file nsISVGLibartCanvas.h.

class nsISVGLibartGlyphMetricsFT

'Private' rendering engine interface

Definition at line 57 of file nsISVGLibartGlyphMetricsFT.h.

Inheritance diagram for nsISVGLibartGlyphMetricsFT:
Collaboration diagram for nsISVGLibartGlyphMetricsFT:

Public Member Functions

 NS_IMETHOD_ (FT_Face) GetFTFace()=0
 NS_IMETHOD_ (float) GetPixelScale()=0
 NS_IMETHOD_ (float) GetTwipsToPixels()=0
 NS_IMETHOD_ (const FT_BBox *) GetBoundingBox()=0
 NS_IMETHOD_ (PRUint32) GetGlyphCount()=0
 NS_IMETHOD_ (FT_Glyph) GetGlyphAt(PRUint32 pos)=0
nsIDOMSVGRect getExtentOfChar (in unsigned long charnum)
 Get the untransformed bounding box of an individual glyph.
float getAdvanceOfChar (in unsigned long charnum)
 Get the advance of an individual glyph.
float getBaselineOffset (in unsigned short baselineIdentifier)
 Retrieve the (y-axis) offset of the given baseline.
boolean update (in unsigned long updatemask)
 Called by this object's corresponding nsISVGGlyphMetricsSource as a notification that some of the source's data (identified by paramter 'updatemask') has changed.

Public Attributes

readonly attribute float advance
 Untransformed width of the composite glyph in pixels.
Baseline offset constants for getBaselineOffset()
const unsigned short BASELINE_ALPHABETIC = 0
const unsigned short BASELINE_HANGING = 1
const unsigned short BASELINE_IDEOGRAPHC = 2
const unsigned short BASELINE_MATHEMATICAL = 3
const unsigned short BASELINE_CENTRAL = 4
const unsigned short BASELINE_MIDDLE = 5
const unsigned short BASELINE_TEXT_BEFORE_EDGE = 6
const unsigned short BASELINE_TEXT_AFTER_EDGE = 7

Member Function Documentation

float nsISVGRendererGlyphMetrics::getAdvanceOfChar ( in unsigned long  charnum) [inherited]

Get the advance of an individual glyph.

float nsISVGRendererGlyphMetrics::getBaselineOffset ( in unsigned short  baselineIdentifier) [inherited]

Retrieve the (y-axis) offset of the given baseline.

Parameters:
baselineIdentifierOne of the BASELINE_* constants defined in this interface.
Returns:
Y-axis offset in pixels relative to top of bounding box.

Get the untransformed bounding box of an individual glyph.

Parameters:
charnumThe index of the character in nsISVGGlyphMetricsSource::characterData whose glyph bounding box is to be determined
Returns:
The untransformed bounding box in pixel coordinates
boolean nsISVGRendererGlyphMetrics::update ( in unsigned long  updatemask) [inherited]

Called by this object's corresponding nsISVGGlyphMetricsSource as a notification that some of the source's data (identified by paramter 'updatemask') has changed.

Parameters:
updatemaskAn OR-ed combination of the UPDATEMASK_* constants defined in nsISVGGlyphMetricsSource.
Returns:
PR_TRUE if the metrics have changed as a result of the source update, PR_FALSE otherwise.

Member Data Documentation

readonly attribute float nsISVGRendererGlyphMetrics::advance [inherited]

Untransformed width of the composite glyph in pixels.

Definition at line 71 of file nsISVGRendererGlyphMetrics.idl.

Definition at line 92 of file nsISVGRendererGlyphMetrics.idl.

const unsigned short nsISVGRendererGlyphMetrics::BASELINE_CENTRAL = 4 [inherited]

Definition at line 96 of file nsISVGRendererGlyphMetrics.idl.

const unsigned short nsISVGRendererGlyphMetrics::BASELINE_HANGING = 1 [inherited]

Definition at line 93 of file nsISVGRendererGlyphMetrics.idl.

Definition at line 94 of file nsISVGRendererGlyphMetrics.idl.

Definition at line 95 of file nsISVGRendererGlyphMetrics.idl.

const unsigned short nsISVGRendererGlyphMetrics::BASELINE_MIDDLE = 5 [inherited]

Definition at line 97 of file nsISVGRendererGlyphMetrics.idl.

Definition at line 99 of file nsISVGRendererGlyphMetrics.idl.

Definition at line 98 of file nsISVGRendererGlyphMetrics.idl.

class nsISVGLibartRegion

'Private' rendering engine interface

Definition at line 57 of file nsISVGLibartRegion.h.

Inheritance diagram for nsISVGLibartRegion:
Collaboration diagram for nsISVGLibartRegion:

Public Member Functions

 NS_IMETHOD_ (ArtUta *) GetUta()=0
 Get region as a libart microtile array.
nsISVGRendererRegion combine (in nsISVGRendererRegion other)
 Return union of this region with another region.
void getRectangleScans (in nsISVGRectangleSink sink)
 Write a sequence of rectangles approximating this region to the sink object.

Member Function Documentation

Return union of this region with another region.

Parameters:
otherRegion to combine with.
Returns:
Union region.

Write a sequence of rectangles approximating this region to the sink object.

The approximation can be crude but should fully contain the actual region area.

Parameters:
sinkRectangle sink to write to.
nsISVGLibartRegion::NS_IMETHOD_ ( ArtUta *  ) [pure virtual]

Get region as a libart microtile array.

Implemented in nsSVGLibartRegion.

class nsSVGFill

Definition at line 52 of file nsSVGFill.h.

Inheritance diagram for nsSVGFill:
Collaboration diagram for nsSVGFill:

Public Member Functions

void Build (ArtVpath *path, nsISVGPathGeometrySource *source)
void Clear ()
ArtSVP * GetSvp ()
ArtUta * GetUta ()
PRBool IsEmpty ()
PRBool Contains (float x, float y)

Protected Attributes

ArtSVP * mSvp

Member Function Documentation

void nsSVGFill::Build ( ArtVpath *  path,
nsISVGPathGeometrySource source 
)

Definition at line 115 of file nsSVGFill.cpp.

{
  if (mSvp) {
    art_svp_free(mSvp);
    mSvp = nsnull;
  }

  NS_ASSERTION(path, "null vpath");
  
  // clip
  ArtVpathArrayIterator src_iter;
//  ArtVpathPolyRectClipFilter clip_filter;
  
  art_vpath_array_iterator_init((ArtVpath*)path, &src_iter);
//  art_vpath_poly_rect_clip_filter_init((ArtVpathIterator*)&src_iter,
//                                       canvasSpecs->GetClipRect(),
//                                       &clip_filter);
  
//  path = art_vpath_new_vpath_array((ArtVpathIterator*)&clip_filter);
  path = art_vpath_new_vpath_array((ArtVpathIterator*)&src_iter);

  
  if (ContainsOpenPath(path)) {
    ArtVpath* tmp_path = path;
    path = CloseOpenPath(tmp_path);
    art_free(tmp_path);
  }
  
  ArtVpath* perturbedVP = art_vpath_perturb(path);
  art_free(path);
  
  ArtSVP* svp = art_svp_from_vpath(perturbedVP);
  art_free(perturbedVP);
  
  ArtSVP* uncrossedSVP = art_svp_uncross(svp);
  art_svp_free(svp);
  
  PRUint16 fillrule;
  source->GetFillRule(&fillrule);
  ArtWindRule wind;
  switch (fillrule) {
    case nsISVGGeometrySource::FILL_RULE_NONZERO:
      wind = ART_WIND_RULE_NONZERO;
      break;
    case nsISVGGeometrySource::FILL_RULE_EVENODD:
      wind = ART_WIND_RULE_ODDEVEN;
      break;
    default:
      NS_ERROR("not reached");
  }
  
  mSvp = art_svp_rewind_uncrossed (uncrossedSVP, wind);
  art_svp_free (uncrossedSVP);

}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsSVGRenderItem::Clear ( void  ) [inherited]

Definition at line 52 of file nsSVGRenderItem.cpp.

{
  if (mSvp)
    art_svp_free(mSvp);
  mSvp = nsnull;
}  

Here is the caller graph for this function:

PRBool nsSVGRenderItem::Contains ( float  x,
float  y 
) [inherited]

Definition at line 67 of file nsSVGRenderItem.cpp.

{
  if (!mSvp) return PR_FALSE;
  return (art_svp_point_wind(GetSvp(), x, y) != 0);
}

Here is the call graph for this function:

ArtSVP* nsSVGRenderItem::GetSvp ( ) [inline, inherited]

Definition at line 60 of file nsSVGRenderItem.h.

{ return mSvp; }

Here is the caller graph for this function:

ArtUta * nsSVGRenderItem::GetUta ( ) [inherited]

Definition at line 60 of file nsSVGRenderItem.cpp.

{
  if (!mSvp) return nsnull;
  return art_uta_from_svp(mSvp);
}
PRBool nsSVGRenderItem::IsEmpty ( void  ) [inline, inherited]

Definition at line 63 of file nsSVGRenderItem.h.

{ return (mSvp == nsnull); }

Here is the caller graph for this function:


Member Data Documentation

ArtSVP* nsSVGRenderItem::mSvp [protected, inherited]

Definition at line 68 of file nsSVGRenderItem.h.

class nsSVGLibartBitmapAlpha

A libart-bitmap implementation based on gfxIImageFrame that supports compositing through a very ugly hack.

Bitmap data is written to a temporary buffer in RGBA format until the bitmap is flushed and then the alpha data is extracted to a separate buffer and the remaining RGB data placed in the actual bitmap buffer. This is because libart does not seem to support writing alpha information to a separate alpha buffer.

Definition at line 67 of file nsSVGLibartBitmapAlpha.cpp.

Inheritance diagram for nsSVGLibartBitmapAlpha:
Collaboration diagram for nsSVGLibartBitmapAlpha:

Public Types

enum  PixelFormat {
  PIXEL_FORMAT_24_RGB = 1, PIXEL_FORMAT_24_BGR = 2, PIXEL_FORMAT_32_ABGR = 3, PIXEL_FORMAT_32_RGBA = 4,
  PIXEL_FORMAT_32_BGRA = 5
}

Public Member Functions

 nsSVGLibartBitmapAlpha ()
 ~nsSVGLibartBitmapAlpha ()
nsresult Init (nsIRenderingContext *ctx, nsPresContext *presContext, const nsRect &rect)
NS_DECL_ISUPPORTS NS_IMETHOD_ (PRUint8 *) GetBits()
 NS_IMETHOD_ (nsISVGLibartBitmap::PixelFormat) GetPixelFormat()
 NS_IMETHOD_ (int) GetLineStride()
 Linestride in bytes.
 NS_IMETHOD_ (int) GetWidth()
 Linestride in bytes.
 NS_IMETHOD_ (int) GetHeight()
 Linestride in bytes.
 NS_IMETHOD_ (void) LockRenderingContext(const nsRect &rect
 Obtain a rendering context for part of the bitmap.
 NS_IMETHOD_ (void) UnlockRenderingContext()
 NS_IMETHOD_ (void) Flush()

Public Attributes

nsIRenderingContext ** ctx

Private Member Functions

void LockBuffer ()
void UnlockBuffer ()

Private Attributes

PRBool mLocked
nsCOMPtr< nsIRenderingContextmRenderingContext
nsCOMPtr< imgIContainermContainer
nsCOMPtr< gfxIImageFramemBuffer
nsRect mRectTwips
nsRect mRect
PRUint8mTempBits
PRInt32 mTempLineStride

Member Enumeration Documentation

Enumerator:
PIXEL_FORMAT_24_RGB 
PIXEL_FORMAT_24_BGR 
PIXEL_FORMAT_32_ABGR 
PIXEL_FORMAT_32_RGBA 
PIXEL_FORMAT_32_BGRA 

Definition at line 70 of file nsISVGLibartBitmap.h.

                   {
    PIXEL_FORMAT_24_RGB  = 1, // linux
    PIXEL_FORMAT_24_BGR  = 2, // windows
    PIXEL_FORMAT_32_ABGR = 3, // mac
    PIXEL_FORMAT_32_RGBA = 4, // mac/linux + compositing
    PIXEL_FORMAT_32_BGRA = 5  // windows + compositing
  };

Constructor & Destructor Documentation

Definition at line 111 of file nsSVGLibartBitmapAlpha.cpp.

Here is the caller graph for this function:


Member Function Documentation

Definition at line 125 of file nsSVGLibartBitmapAlpha.cpp.

{
  mRenderingContext = ctx;

  PRUint32 tempSize;
  float twipsPerPx;

  twipsPerPx = presContext->PixelsToTwips();
  mRectTwips.x = (nscoord)(rect.x*twipsPerPx);
  mRectTwips.y = (nscoord)(rect.y*twipsPerPx);
  mRectTwips.width = (nscoord)(rect.width*twipsPerPx);
  mRectTwips.height = (nscoord)(rect.height*twipsPerPx);
  mRect = rect;
  
  mContainer = do_CreateInstance("@mozilla.org/image/container;1");
  mContainer->Init(rect.width, rect.height, nsnull);
    
  mBuffer = do_CreateInstance("@mozilla.org/gfx/image/frame;2");
  mBuffer->Init(0, 0, rect.width, rect.height, gfxIFormats::RGB_A8, 24);
  mContainer->AppendFrame(mBuffer);

  mTempLineStride = rect.width * 4; // i.e. 4-bytes per pixel (RGBA)
  mTempLineStride = (mTempLineStride + 3) & ~0x3; // 32-bit align
  tempSize = mTempLineStride * rect.height;
  mTempBits = new PRUint8[tempSize];
  if (!mTempBits) return NS_ERROR_OUT_OF_MEMORY;

  memset(mTempBits, 0, tempSize); // initialise to black and transparent
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 195 of file nsSVGLibartBitmapAlpha.cpp.

{
  // XXX not really sure if this makes sense now that we're using a temporary
  // buffer. Really we should lock the temporary buffer instead.
  if (mLocked) return;

  mBuffer->LockImageData();
  mBuffer->LockAlphaData();
  mLocked = PR_TRUE;
}

Linestride in bytes.

Implements nsISVGLibartBitmap.

Linestride in bytes.

Implements nsISVGLibartBitmap.

Linestride in bytes.

Implements nsISVGLibartBitmap.

Obtain a rendering context for part of the bitmap.

In general this will be different to the RC passed at initialization time.

Reimplemented from nsISVGLibartBitmap.

Definition at line 207 of file nsSVGLibartBitmapAlpha.cpp.

{
  if (!mLocked) return;

  mBuffer->UnlockAlphaData();
  mBuffer->UnlockImageData();
  mLocked = PR_FALSE;
}

Member Data Documentation

Definition at line 101 of file nsSVGLibartBitmapAlpha.cpp.

class nsSVGLibartBitmapDefault

A libart-bitmap implementation based on gfxIImageFrame that should work on all platforms but doesn't support obtaining RenderingContexts with Lock/UnlockRenderingContext and is generally a bit of a hack.

Definition at line 64 of file nsSVGLibartBitmapDefault.cpp.

Inheritance diagram for nsSVGLibartBitmapDefault:
Collaboration diagram for nsSVGLibartBitmapDefault:

Public Types

enum  PixelFormat {
  PIXEL_FORMAT_24_RGB = 1, PIXEL_FORMAT_24_BGR = 2, PIXEL_FORMAT_32_ABGR = 3, PIXEL_FORMAT_32_RGBA = 4,
  PIXEL_FORMAT_32_BGRA = 5
}

Public Member Functions

 nsSVGLibartBitmapDefault ()
 ~nsSVGLibartBitmapDefault ()
nsresult Init (nsIRenderingContext *ctx, nsPresContext *presContext, const nsRect &rect)
NS_DECL_ISUPPORTS NS_IMETHOD_ (PRUint8 *) GetBits()
 NS_IMETHOD_ (nsISVGLibartBitmap::PixelFormat) GetPixelFormat()
 NS_IMETHOD_ (int) GetLineStride()
 Linestride in bytes.
 NS_IMETHOD_ (int) GetWidth()
 Linestride in bytes.
 NS_IMETHOD_ (int) GetHeight()
 Linestride in bytes.
 NS_IMETHOD_ (void) LockRenderingContext(const nsRect &rect
 Obtain a rendering context for part of the bitmap.
 NS_IMETHOD_ (void) UnlockRenderingContext()
 NS_IMETHOD_ (void) Flush()

Public Attributes

nsIRenderingContext ** ctx

Private Member Functions

void LockBuffer ()
void UnlockBuffer ()

Private Attributes

PRBool mLocked
nsCOMPtr< nsIRenderingContextmRenderingContext
nsCOMPtr< imgIContainermContainer
nsCOMPtr< gfxIImageFramemBuffer
nsRect mRectTwips
nsRect mRect

Member Enumeration Documentation

Enumerator:
PIXEL_FORMAT_24_RGB 
PIXEL_FORMAT_24_BGR 
PIXEL_FORMAT_32_ABGR 
PIXEL_FORMAT_32_RGBA 
PIXEL_FORMAT_32_BGRA 

Definition at line 70 of file nsISVGLibartBitmap.h.

                   {
    PIXEL_FORMAT_24_RGB  = 1, // linux
    PIXEL_FORMAT_24_BGR  = 2, // windows
    PIXEL_FORMAT_32_ABGR = 3, // mac
    PIXEL_FORMAT_32_RGBA = 4, // mac/linux + compositing
    PIXEL_FORMAT_32_BGRA = 5  // windows + compositing
  };

Constructor & Destructor Documentation

Definition at line 103 of file nsSVGLibartBitmapDefault.cpp.

    : mLocked(PR_FALSE)
{
}

Here is the caller graph for this function:


Member Function Documentation

Definition at line 114 of file nsSVGLibartBitmapDefault.cpp.

{
  mRenderingContext = ctx;

  float twipsPerPx;
  twipsPerPx = presContext->PixelsToTwips();
  mRectTwips.x = (nscoord)(rect.x*twipsPerPx);
  mRectTwips.y = (nscoord)(rect.y*twipsPerPx);
  mRectTwips.width = (nscoord)(rect.width*twipsPerPx);
  mRectTwips.height = (nscoord)(rect.height*twipsPerPx);
  mRect = rect;
  
  mContainer = do_CreateInstance("@mozilla.org/image/container;1");
  mContainer->Init(rect.width, rect.height, nsnull);
    
  mBuffer = do_CreateInstance("@mozilla.org/gfx/image/frame;2");
  mBuffer->Init(0, 0, rect.width, rect.height, gfxIFormats::RGB, 24);
  mContainer->AppendFrame(mBuffer);
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 174 of file nsSVGLibartBitmapDefault.cpp.

{
  if (mLocked) return;

  mBuffer->LockImageData();    
  mLocked = PR_TRUE;
}

Linestride in bytes.

Implements nsISVGLibartBitmap.

Linestride in bytes.

Implements nsISVGLibartBitmap.

Linestride in bytes.

Implements nsISVGLibartBitmap.

Obtain a rendering context for part of the bitmap.

In general this will be different to the RC passed at initialization time.

Reimplemented from nsISVGLibartBitmap.

Definition at line 183 of file nsSVGLibartBitmapDefault.cpp.

{
  if (!mLocked) return;

  mBuffer->UnlockImageData();
  mLocked = PR_FALSE;
}

Member Data Documentation

class nsSVGLibartBitmapGdk

A libart-bitmap implementation for gtk 2.0.

Definition at line 58 of file nsSVGLibartBitmapGdk.cpp.

Inheritance diagram for nsSVGLibartBitmapGdk:
Collaboration diagram for nsSVGLibartBitmapGdk:

Public Types

enum  PixelFormat {
  PIXEL_FORMAT_24_RGB = 1, PIXEL_FORMAT_24_BGR = 2, PIXEL_FORMAT_32_ABGR = 3, PIXEL_FORMAT_32_RGBA = 4,
  PIXEL_FORMAT_32_BGRA = 5
}

Public Member Functions

 nsSVGLibartBitmapGdk ()
 ~nsSVGLibartBitmapGdk ()
nsresult Init (nsIRenderingContext *ctx, nsPresContext *presContext, const nsRect &rect)
NS_DECL_ISUPPORTS NS_IMETHOD_ (PRUint8 *) GetBits()
 NS_IMETHOD_ (nsISVGLibartBitmap::PixelFormat) GetPixelFormat()
 NS_IMETHOD_ (int) GetLineStride()
 Linestride in bytes.
 NS_IMETHOD_ (int) GetWidth()
 Linestride in bytes.
 NS_IMETHOD_ (int) GetHeight()
 Linestride in bytes.
 NS_IMETHOD_ (void) LockRenderingContext(const nsRect &rect
 Obtain a rendering context for part of the bitmap.
 NS_IMETHOD_ (void) UnlockRenderingContext()
 NS_IMETHOD_ (void) Flush()

Public Attributes

nsIRenderingContext ** ctx

Private Attributes

nsCOMPtr< nsIRenderingContextmRenderingContext
nsRect mBufferRect
GdkPixbuf * mBuffer
nsRect mLockRect
nsIDrawingSurfacemTempSurface

Member Enumeration Documentation

Enumerator:
PIXEL_FORMAT_24_RGB 
PIXEL_FORMAT_24_BGR 
PIXEL_FORMAT_32_ABGR 
PIXEL_FORMAT_32_RGBA 
PIXEL_FORMAT_32_BGRA 

Definition at line 70 of file nsISVGLibartBitmap.h.

                   {
    PIXEL_FORMAT_24_RGB  = 1, // linux
    PIXEL_FORMAT_24_BGR  = 2, // windows
    PIXEL_FORMAT_32_ABGR = 3, // mac
    PIXEL_FORMAT_32_RGBA = 4, // mac/linux + compositing
    PIXEL_FORMAT_32_BGRA = 5  // windows + compositing
  };

Constructor & Destructor Documentation

Definition at line 93 of file nsSVGLibartBitmapGdk.cpp.

Here is the caller graph for this function:

Definition at line 99 of file nsSVGLibartBitmapGdk.cpp.

{
  if (mBuffer) {
    gdk_pixbuf_unref(mBuffer);
  }
}

Member Function Documentation

Definition at line 107 of file nsSVGLibartBitmapGdk.cpp.

{
  mRenderingContext = ctx;
  mBufferRect = rect;
  
  mBuffer = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, rect.width, rect.height);

  return NS_OK;
}

Here is the caller graph for this function:

Linestride in bytes.

Implements nsISVGLibartBitmap.

Linestride in bytes.

Implements nsISVGLibartBitmap.

Linestride in bytes.

Implements nsISVGLibartBitmap.

Obtain a rendering context for part of the bitmap.

In general this will be different to the RC passed at initialization time.

Reimplemented from nsISVGLibartBitmap.


Member Data Documentation

GdkPixbuf* nsSVGLibartBitmapGdk::mBuffer [private]

Definition at line 83 of file nsSVGLibartBitmapGdk.cpp.

Definition at line 84 of file nsSVGLibartBitmapGdk.cpp.

class nsSVGLibartBitmapMac

A libart bitmap implementation based on gfxIImageFrame that should work for Mac but doesn't support obtaining RenderingContexts with Lock/UnlockRenderingContext.

Definition at line 63 of file nsSVGLibartBitmapMac.cpp.

Inheritance diagram for nsSVGLibartBitmapMac:
Collaboration diagram for nsSVGLibartBitmapMac:

Public Types

enum  PixelFormat {
  PIXEL_FORMAT_24_RGB = 1, PIXEL_FORMAT_24_BGR = 2, PIXEL_FORMAT_32_ABGR = 3, PIXEL_FORMAT_32_RGBA = 4,
  PIXEL_FORMAT_32_BGRA = 5
}

Public Member Functions

 nsSVGLibartBitmapMac ()
 ~nsSVGLibartBitmapMac ()
nsresult Init (nsIRenderingContext *ctx, nsPresContext *presContext, const nsRect &rect)
NS_DECL_ISUPPORTS NS_IMETHOD_ (PRUint8 *) GetBits()
 NS_IMETHOD_ (nsISVGLibartBitmap::PixelFormat) GetPixelFormat()
 NS_IMETHOD_ (int) GetLineStride()
 Linestride in bytes.
 NS_IMETHOD_ (int) GetWidth()
 Linestride in bytes.
 NS_IMETHOD_ (int) GetHeight()
 Linestride in bytes.
 NS_IMETHOD_ (void) LockRenderingContext(const nsRect &rect
 Obtain a rendering context for part of the bitmap.
 NS_IMETHOD_ (void) UnlockRenderingContext()
 NS_IMETHOD_ (void) Flush()

Public Attributes

nsIRenderingContext ** ctx

Private Member Functions

void LockBuffer ()
void UnlockBuffer ()

Private Attributes

PRBool mLocked
nsCOMPtr< nsIRenderingContextmRenderingContext
nsCOMPtr< imgIContainermContainer
nsCOMPtr< gfxIImageFramemBuffer
nsRect mRectTwips
nsRect mRect

Member Enumeration Documentation

Enumerator:
PIXEL_FORMAT_24_RGB 
PIXEL_FORMAT_24_BGR 
PIXEL_FORMAT_32_ABGR 
PIXEL_FORMAT_32_RGBA 
PIXEL_FORMAT_32_BGRA 

Definition at line 70 of file nsISVGLibartBitmap.h.

                   {
    PIXEL_FORMAT_24_RGB  = 1, // linux
    PIXEL_FORMAT_24_BGR  = 2, // windows
    PIXEL_FORMAT_32_ABGR = 3, // mac
    PIXEL_FORMAT_32_RGBA = 4, // mac/linux + compositing
    PIXEL_FORMAT_32_BGRA = 5  // windows + compositing
  };

Constructor & Destructor Documentation

Definition at line 102 of file nsSVGLibartBitmapMac.cpp.

    : mLocked(PR_FALSE)
{
}

Here is the caller graph for this function:


Member Function Documentation

Definition at line 113 of file nsSVGLibartBitmapMac.cpp.

{
  mRenderingContext = ctx;

  float twipsPerPx;
  twipsPerPx = presContext->PixelsToTwips();
  mRectTwips.x = (nscoord)(rect.x*twipsPerPx);
  mRectTwips.y = (nscoord)(rect.y*twipsPerPx);
  mRectTwips.width = (nscoord)(rect.width*twipsPerPx);
  mRectTwips.height = (nscoord)(rect.height*twipsPerPx);
  mRect = rect;
  
  mContainer = do_CreateInstance("@mozilla.org/image/container;1");
  mContainer->Init(rect.width, rect.height, nsnull);
    
  mBuffer = do_CreateInstance("@mozilla.org/gfx/image/frame;2");
  // even though we request a 24bpp buffer, on the mac we get a 32bpp one...
  mBuffer->Init(0, 0, rect.width, rect.height, gfxIFormats::RGB, 24);
  mContainer->AppendFrame(mBuffer);
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 174 of file nsSVGLibartBitmapMac.cpp.

{
  if (mLocked) return;

  mBuffer->LockImageData();    
  mLocked = PR_TRUE;
}

Linestride in bytes.

Implements nsISVGLibartBitmap.

Linestride in bytes.

Implements nsISVGLibartBitmap.

Linestride in bytes.

Implements nsISVGLibartBitmap.

Obtain a rendering context for part of the bitmap.

In general this will be different to the RC passed at initialization time.

Reimplemented from nsISVGLibartBitmap.

Definition at line 183 of file nsSVGLibartBitmapMac.cpp.

{
  if (!mLocked) return;

  mBuffer->UnlockImageData();
  mLocked = PR_FALSE;
}

Member Data Documentation

Definition at line 89 of file nsSVGLibartBitmapMac.cpp.

Definition at line 94 of file nsSVGLibartBitmapMac.cpp.

Definition at line 93 of file nsSVGLibartBitmapMac.cpp.

class nsSVGLibartBPathBuilder

Libart path builder implementation.

Definition at line 53 of file nsSVGLibartBPathBuilder.cpp.

Inheritance diagram for nsSVGLibartBPathBuilder:
Collaboration diagram for nsSVGLibartBPathBuilder:

Public Member Functions

void moveto (in float x, in float y)
 Move current position and start new sub-path.
void lineto (in float x, in float y)
 Draw a straight line from the current position to (x,y).
void curveto (in float x, in float y, in float x1, in float y1, in float x2, in float y2)
 Draw cubic Bezier curve from the current position to (x,y) using (x1,y1) as the control point at the beginning og the curve and (x2,y2) as the control point at the end of the curve.
void arcto (in float x, in float y, in float r1, in float r2, in float angle, in boolean largeArcFlag, in boolean sweepFlag)
 Draw an elliptical arc from the current position to (x,y).
void closePath (out float newX, out float newY)
 Close the current subpath.
void endPath ()
 End the path description.

Protected Member Functions

 nsSVGLibartBPathBuilder (ArtBpath **dest)

Private Member Functions

void EnsureBPathSpace (PRUint32 space=1)
void EnsureBPathTerminated ()
PRInt32 GetLastOpenBPath ()

Private Attributes

ArtBpath ** mBPath
PRUint32 mBPathSize
PRUint32 mBPathEnd

Friends

nsresult NS_NewSVGLibartBPathBuilder (nsISVGRendererPathBuilder **result, ArtBpath **dest)

Constructor & Destructor Documentation

nsSVGLibartBPathBuilder::nsSVGLibartBPathBuilder ( ArtBpath **  dest) [protected]

Definition at line 84 of file nsSVGLibartBPathBuilder.cpp.

    : mBPath(dest),
      mBPathSize(0),
      mBPathEnd(0)
{
}

Member Function Documentation

void nsISVGRendererPathBuilder::arcto ( in float  x,
in float  y,
in float  r1,
in float  r2,
in float  angle,
in boolean  largeArcFlag,
in boolean  sweepFlag 
) [inherited]

Draw an elliptical arc from the current position to (x,y).

Advance current position to (x,y).

Parameters:
xX-coordinate of end point (untransformed).
yY-coordinate of end point (untransformed).
r1Radius of ellipse in X direction (untransformed).
r2Radius of ellipse in Y direction (untransformed).
angleRotation of ellipse as a whole (untransformed).
largeArcFlagPR_TRUE: choose the large arc (>=180 degrees), PR_FALSE: choose the smaller arc (<=180 degrees)
sweepFlagPR_TRUE: sweep in positive angle direction, PR_FALSE: sweep in negative angle direction
void nsISVGRendererPathBuilder::closePath ( out float  newX,
out float  newY 
) [inherited]

Close the current subpath.

Move current position back to beginning of subpath.

Parameters:
newXX-coordinate of new current position (untransformed).
newYY-coordinate of new current position (untransformed).
void nsISVGRendererPathBuilder::curveto ( in float  x,
in float  y,
in float  x1,
in float  y1,
in float  x2,
in float  y2 
) [inherited]

Draw cubic Bezier curve from the current position to (x,y) using (x1,y1) as the control point at the beginning og the curve and (x2,y2) as the control point at the end of the curve.

Advance current position to (x,y).

Parameters:
xX-coordinate of end point (untransformed).
yY-coordinate of end point (untransformed).
x1X-coordinate of first control point (untransformed).
y1Y-coordinate of first control point (untransformed).
x2X-coordinate of second control point (untransformed).
y2Y-coordinate of second control point (untransformed).

End the path description.

Guaranteed to be the last function called.

Definition at line 324 of file nsSVGLibartBPathBuilder.cpp.

{
  const PRInt32 minGrowSize = 10;

  if (mBPathSize - mBPathEnd >= space)
    return;

  if (space < minGrowSize)
    space = minGrowSize;
  
  mBPathSize += space;
  
  if (!*mBPath) {
    *mBPath = art_new(ArtBpath, mBPathSize);
  }
  else {
    *mBPath = art_renew(*mBPath, ArtBpath, mBPathSize);
  }
}

Here is the caller graph for this function:

Definition at line 345 of file nsSVGLibartBPathBuilder.cpp.

{
  NS_ASSERTION (*mBPath, "no bpath");  
  NS_ASSERTION (mBPathEnd>0, "trying to terminate empty bpath");
  
  if (mBPathEnd>0 && (*mBPath)[mBPathEnd-1].code == ART_END) return;

  EnsureBPathSpace(1);
  (*mBPath)[mBPathEnd++].code = ART_END;
}

Here is the call graph for this function:

Definition at line 357 of file nsSVGLibartBPathBuilder.cpp.

{
  if (!*mBPath) return -1;
  
  PRInt32 i = mBPathEnd;
  while (--i >= 0) {
    if ((*mBPath)[i].code == ART_MOVETO_OPEN)
      return i;
  }
  return -1;
}
void nsISVGRendererPathBuilder::lineto ( in float  x,
in float  y 
) [inherited]

Draw a straight line from the current position to (x,y).

Advance current position to (x,y).

Parameters:
xX-coordinate of end point (untransformed).
yY-coordinate of end point (untransformed).
void nsISVGRendererPathBuilder::moveto ( in float  x,
in float  y 
) [inherited]

Move current position and start new sub-path.

Parameters:
xX-coordinate (untransformed).
yY-coordinate (untransformed).

Friends And Related Function Documentation

nsresult NS_NewSVGLibartBPathBuilder ( nsISVGRendererPathBuilder **  result,
ArtBpath **  dest 
) [friend]

Definition at line 92 of file nsSVGLibartBPathBuilder.cpp.

{
  *result = new nsSVGLibartBPathBuilder(dest);
  if (!result) return NS_ERROR_OUT_OF_MEMORY;

  NS_ADDREF(*result);

  return NS_OK;
}

Member Data Documentation

ArtBpath** nsSVGLibartBPathBuilder::mBPath [private]

Definition at line 74 of file nsSVGLibartBPathBuilder.cpp.

class nsSVGLibartCanvas

Libart canvas implementation.

Definition at line 59 of file nsSVGLibartCanvas.cpp.

Inheritance diagram for nsSVGLibartCanvas:
Collaboration diagram for nsSVGLibartCanvas:

Public Member Functions

 nsSVGLibartCanvas ()
 ~nsSVGLibartCanvas ()
nsresult Init (nsIRenderingContext *ctx, nsPresContext *presContext, const nsRect &dirtyRect)
NS_DECL_ISUPPORTS
NS_DECL_NSISVGRENDERERCANVAS 
NS_IMETHOD_ (ArtRender *) NewRender()
 Deprecated.
 NS_IMETHOD_ (ArtRender *) NewRender(int x0
 Deprecated.
 NS_IMETHOD_ (void) InvokeRender(ArtRender *render)
 Invoke the render object previously constructed with a call to NewRender().
 NS_IMETHOD_ (void) GetArtColor(nscolor rgb
 Invoke the render object previously constructed with a call to NewRender().
nsIRenderingContext lockRenderingContext ([const ] in nsRectRef rect)
 Lock a portion of the canvas and obtain a rendering context onto which Mozilla can paint non-svg content.
void unlockRenderingContext ()
 Unlock the canvas portion locked with a previous call to lockRenderingContext().
nsPresContext getPresContext ()
void clear (in nscolor color)
 Fill the canvas with the given color.
void flush ()
 Ensure that all renderings on the canvas have been flushed to the Mozilla-native rendering context.
void pushClip ()
 Push/Pop clip path.
void popClip ()
void setClipRect (in nsIDOMSVGMatrix canvasTM, in float x, in float y, in float width, in float height)
 Set rectangular clip region.
void pushSurface (in nsISVGRendererSurface surface)
 Push/Pop surface as primary drawing surface.
void popSurface ()
void compositeSurface (in nsISVGRendererSurface surface, in unsigned long x, in unsigned long y, in float opacity)
 Surface composition.
void compositeSurfaceMatrix (in nsISVGRendererSurface surface, in nsIDOMSVGMatrix canvasTM, in float opacity)

Static Public Member Functions

static const nsIIDGetIID ()

Public Attributes

int y0
int int x1
int int int y1
ArtColorartColor
const unsigned short SVG_RENDER_MODE_NORMAL = 0
 Set render mode (clipping or normal draw)
const unsigned short SVG_RENDER_MODE_CLIP = 1
attribute unsigned short renderMode

Private Attributes

nsCOMPtr< nsIRenderingContextmRenderingContext
nsCOMPtr< nsPresContextmPresContext
nsCOMPtr< nsISVGLibartBitmapmBitmap
nsRect mDirtyRect

Constructor & Destructor Documentation

Definition at line 92 of file nsSVGLibartCanvas.cpp.

{
}

Here is the caller graph for this function:

Definition at line 96 of file nsSVGLibartCanvas.cpp.

{
}

Member Function Documentation

void nsISVGRendererCanvas::clear ( in nscolor  color) [inherited]

Fill the canvas with the given color.

Parameters:
colorFill color.
void nsISVGRendererCanvas::compositeSurface ( in nsISVGRendererSurface  surface,
in unsigned long  x,
in unsigned long  y,
in float  opacity 
) [inherited]

Surface composition.

void nsISVGRendererCanvas::compositeSurfaceMatrix ( in nsISVGRendererSurface  surface,
in nsIDOMSVGMatrix  canvasTM,
in float  opacity 
) [inherited]

Ensure that all renderings on the canvas have been flushed to the Mozilla-native rendering context.

static const nsIID& nsISVGLibartCanvas::GetIID ( ) [inline, static, inherited]

Definition at line 62 of file nsISVGLibartCanvas.h.

{ static nsIID iid = NS_ISVGLIBARTCANVAS_IID; return iid; }

Here is the caller graph for this function:

nsresult nsSVGLibartCanvas::Init ( nsIRenderingContext ctx,
nsPresContext presContext,
const nsRect dirtyRect 
)

Definition at line 101 of file nsSVGLibartCanvas.cpp.

{
  mPresContext = presContext;
  NS_ASSERTION(mPresContext, "empty prescontext");
  mRenderingContext = ctx;
  NS_ASSERTION(mRenderingContext, "empty rendering context");

  mDirtyRect = dirtyRect;
  NS_NewSVGLibartBitmap(getter_AddRefs(mBitmap), ctx, presContext,
                        dirtyRect);
  if (!mBitmap) {
    NS_ERROR("could not construct bitmap");
    return NS_ERROR_FAILURE;
  }
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Lock a portion of the canvas and obtain a rendering context onto which Mozilla can paint non-svg content.

This is needed for (partial) foreignObject support.

lockRenderingContext() calls are paired with unlockRenderingContext() calls.

Parameters:
rectArea to be locked.
Returns:
Mozilla-native rendering context for the locked area.
NS_DECL_ISUPPORTS NS_DECL_NSISVGRENDERERCANVAS nsSVGLibartCanvas::NS_IMETHOD_ ( ArtRender *  ) [virtual]

Deprecated.

Use NewRender(int x0, int y0, int x1, int y1).

Implements nsISVGLibartCanvas.

nsSVGLibartCanvas::NS_IMETHOD_ ( ArtRender *  ) [virtual]

Deprecated.

Use NewRender(int x0, int y0, int x1, int y1).

Implements nsISVGLibartCanvas.

Invoke the render object previously constructed with a call to NewRender().

Implements nsISVGLibartCanvas.

Invoke the render object previously constructed with a call to NewRender().

Implements nsISVGLibartCanvas.

Push/Pop clip path.

Push/Pop surface as primary drawing surface.

void nsISVGRendererCanvas::setClipRect ( in nsIDOMSVGMatrix  canvasTM,
in float  x,
in float  y,
in float  width,
in float  height 
) [inherited]

Set rectangular clip region.

Unlock the canvas portion locked with a previous call to lockRenderingContext().


Member Data Documentation

Reimplemented from nsISVGLibartCanvas.

Definition at line 77 of file nsSVGLibartCanvas.cpp.

Definition at line 83 of file nsSVGLibartCanvas.cpp.

attribute unsigned short nsISVGRendererCanvas::renderMode [inherited]

Definition at line 115 of file nsISVGRendererCanvas.idl.

const unsigned short nsISVGRendererCanvas::SVG_RENDER_MODE_CLIP = 1 [inherited]

Definition at line 114 of file nsISVGRendererCanvas.idl.

const unsigned short nsISVGRendererCanvas::SVG_RENDER_MODE_NORMAL = 0 [inherited]

Set render mode (clipping or normal draw)

Definition at line 113 of file nsISVGRendererCanvas.idl.

Reimplemented from nsISVGLibartCanvas.

Definition at line 75 of file nsSVGLibartCanvas.cpp.

Reimplemented from nsISVGLibartCanvas.

Definition at line 75 of file nsSVGLibartCanvas.cpp.

Reimplemented from nsISVGLibartCanvas.

Definition at line 75 of file nsSVGLibartCanvas.cpp.

class nsSVGLibartGlyphGeometry

Libart glyph geometry implementation.

Definition at line 60 of file nsSVGLibartGlyphGeometryDefault.cpp.

Inheritance diagram for nsSVGLibartGlyphGeometry:
Collaboration diagram for nsSVGLibartGlyphGeometry:

Public Member Functions

void render (in nsISVGRendererCanvas canvas)
 Paint this object.
nsISVGRendererRegion update (in unsigned long updatemask)
 Called by this object's corresponding nsISVGGlyphGeometrySource as a notification that some of the source's data (identified by paramter 'updatemask') has changed.
nsISVGRendererRegion getCoveredRegion ()
 Get a region object describing the area covered with paint by this glyph geometry.
boolean containsPoint (in float x, in float y)
 Hit-testing method.

Public Attributes

readonly attribute nsIDOMSVGRect boundingBox
 Transformed bounding box (does not include stroke width)

Protected Member Functions

 nsSVGLibartGlyphGeometry ()
 ~nsSVGLibartGlyphGeometry ()
nsresult Init (nsISVGGlyphGeometrySource *src)

Friends

nsresult NS_NewSVGLibartGlyphGeometryDefault (nsISVGRendererGlyphGeometry **result, nsISVGGlyphGeometrySource *src)

Constructor & Destructor Documentation


Member Function Documentation

boolean nsISVGRendererGlyphGeometry::containsPoint ( in float  x,
in float  y 
) [inherited]

Hit-testing method.

Does this glyph geometry (with all relevant transformations applied) contain the point x,y? Should work on a character-cell basis, rather than the actual character outline.

Parameters:
xX-coordinate of test point.
yY-coordinate of test point.
Returns:
PR_TRUE if the glyph geometry contains the point, PR_FALSE otherwise.

Get a region object describing the area covered with paint by this glyph geometry.

Returns:
Covered region.

Definition at line 93 of file nsSVGLibartGlyphGeometryDefault.cpp.

{
  return NS_OK;
}

Here is the caller graph for this function:

Paint this object.

Parameters:
canvasThe canvas to render to.

Here is the caller graph for this function:

nsISVGRendererRegion nsISVGRendererGlyphGeometry::update ( in unsigned long  updatemask) [inherited]

Called by this object's corresponding nsISVGGlyphGeometrySource as a notification that some of the source's data (identified by paramter 'updatemask') has changed.

Parameters:
updatemaskAn OR-ed combination of the UPDATEMASK_* constants defined in nsISVGGlyphGeometrySource.
Returns:
Region that needs to be redrawn.

Friends And Related Function Documentation

Definition at line 100 of file nsSVGLibartGlyphGeometryDefault.cpp.

{
  *result = nsnull;
  
  nsSVGLibartGlyphGeometry* gg = new nsSVGLibartGlyphGeometry();
  if (!gg) return NS_ERROR_OUT_OF_MEMORY;

  NS_ADDREF(gg);

  nsresult rv = gg->Init(src);

  if (NS_FAILED(rv)) {
    NS_RELEASE(gg);
    return rv;
  }
  
  *result = gg;
  return rv;
}

Member Data Documentation

Transformed bounding box (does not include stroke width)

Definition at line 110 of file nsISVGRendererGlyphGeometry.idl.

class nsSVGLibartGlyphGeometryFT

Libart freetype-based glyph geometry implementation.

Definition at line 73 of file nsSVGLibartGlyphGeometryFT.cpp.

Inheritance diagram for nsSVGLibartGlyphGeometryFT:
Collaboration diagram for nsSVGLibartGlyphGeometryFT:

Public Member Functions

void render (in nsISVGRendererCanvas canvas)
 Paint this object.
nsISVGRendererRegion update (in unsigned long updatemask)
 Called by this object's corresponding nsISVGGlyphGeometrySource as a notification that some of the source's data (identified by paramter 'updatemask') has changed.
nsISVGRendererRegion getCoveredRegion ()
 Get a region object describing the area covered with paint by this glyph geometry.
boolean containsPoint (in float x, in float y)
 Hit-testing method.

Public Attributes

readonly attribute nsIDOMSVGRect boundingBox
 Transformed bounding box (does not include stroke width)

Protected Member Functions

 nsSVGLibartGlyphGeometryFT ()
 ~nsSVGLibartGlyphGeometryFT ()
nsresult Init (nsISVGGlyphGeometrySource *src)
void PaintFill (nsISVGLibartCanvas *canvas, nsISVGLibartGlyphMetricsFT *metrics)

Protected Attributes

nsCOMPtr
< nsISVGGlyphGeometrySource
mSource

Friends

nsresult NS_NewSVGLibartGlyphGeometryFT (nsISVGRendererGlyphGeometry **result, nsISVGGlyphGeometrySource *src)

Constructor & Destructor Documentation


Member Function Documentation

boolean nsISVGRendererGlyphGeometry::containsPoint ( in float  x,
in float  y 
) [inherited]

Hit-testing method.

Does this glyph geometry (with all relevant transformations applied) contain the point x,y? Should work on a character-cell basis, rather than the actual character outline.

Parameters:
xX-coordinate of test point.
yY-coordinate of test point.
Returns:
PR_TRUE if the glyph geometry contains the point, PR_FALSE otherwise.

Get a region object describing the area covered with paint by this glyph geometry.

Returns:
Covered region.

Definition at line 112 of file nsSVGLibartGlyphGeometryFT.cpp.

{
  mSource = src;
  return NS_OK;
}

Here is the caller graph for this function:

Definition at line 226 of file nsSVGLibartGlyphGeometryFT.cpp.

{
  FT_Matrix xform;
  FT_Vector delta;
  {
    float x,y;
    mSource->GetX(&x);
    mSource->GetY(&y);
    
    nsCOMPtr<nsIDOMSVGMatrix> ctm;
    mSource->GetCanvasTM(getter_AddRefs(ctm));
    NS_ASSERTION(ctm, "graphic source didn't specify a ctm");

    // negations of B,C,F are to transform matrix from y-down to y-up

    float a,b,c,d,e,f;
    ctm->GetA(&a);
    xform.xx = (FT_Fixed)(a*0x10000L); // convert to 16.16 fixed
    ctm->GetB(&b);
    xform.yx = (FT_Fixed)(-b*0x10000L);
    ctm->GetC(&c);
    xform.xy = (FT_Fixed)(-c*0x10000L);
    ctm->GetD(&d);
    xform.yy = (FT_Fixed)(d*0x10000L);
    ctm->GetE(&e);
    delta.x = (FT_Pos)((a*x+c*y+e)*64); // convert to 26.6 fixed
    ctm->GetF(&f);
    delta.y = (FT_Pos)(-(b*x+d*y+f)*64);
  }
  
  float opacity;
  mSource->GetFillOpacity(&opacity);

  // Define the variables we want to fill only once and use in the loop
  ArtColor fill_color;
  PRUint16 type;
  nsCOMPtr<nsISVGGradient> aGrad;
  nsCOMPtr<nsISVGLibartRegion> aLibartRegion;

  // Get the fill type
  mSource->GetFillPaintType(&type);
  if (type == nsISVGGeometrySource::PAINT_TYPE_SOLID_COLOR) {
    nscolor rgb;
    mSource->GetFillPaint(&rgb);
    canvas->GetArtColor(rgb, fill_color);
  } else if (type == nsISVGGeometrySource::PAINT_TYPE_SERVER) {
    // Handle gradients
    mSource->GetFillGradient(getter_AddRefs(aGrad));

    // Now, get the appropriate gradient fill
    nsCOMPtr<nsISVGRendererRegion> region;
    GetCoveredRegion(getter_AddRefs(region));
    aLibartRegion = do_QueryInterface(region);
  }
  
  PRUint32 glyph_count = metrics->GetGlyphCount();
  
  for (PRUint32 i=0; i<glyph_count; ++i) {
    FT_Glyph glyph;
    nsSVGLibartFreetype::ft2->GlyphCopy(metrics->GetGlyphAt(i), &glyph);

    nsSVGLibartFreetype::ft2->GlyphTransform(glyph, &xform, &delta);
    
    if (NS_SUCCEEDED(nsSVGLibartFreetype::ft2->GlyphToBitmap(&glyph,
                                                             FT_RENDER_MODE_NORMAL,
                                                             nsnull, // translation
                                                             1 // destroy glyph copy
                                                             ))) {
      FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyph;
      
      ArtRender* render = canvas->NewRender(bitmap->left,
                                            -bitmap->top,
                                            bitmap->left+bitmap->bitmap.width,
                                            -bitmap->top+bitmap->bitmap.rows);
      if (render) {
        if(type == nsISVGGeometrySource::PAINT_TYPE_SOLID_COLOR)
          art_render_image_solid(render, fill_color);
        else if (type == nsISVGGeometrySource::PAINT_TYPE_SERVER) {
          nsCOMPtr<nsIDOMSVGMatrix> ctm;
          mSource->GetCanvasTM(getter_AddRefs(ctm));
          LibartGradient(render, ctm, aGrad, aLibartRegion, mSource);
        }
        art_render_mask_solid(render, (int)(0x10000*opacity));
        
        art_render_mask(render,
                        bitmap->left,
                        -bitmap->top,
                        bitmap->left+bitmap->bitmap.width,
                        -bitmap->top+bitmap->bitmap.rows,
                        bitmap->bitmap.buffer,
                        bitmap->bitmap.pitch);
        canvas->InvokeRender(render);
      }
    }
    nsSVGLibartFreetype::ft2->DoneGlyph(glyph);
  }
}

Here is the call graph for this function:

Paint this object.

Parameters:
canvasThe canvas to render to.

Here is the caller graph for this function:

nsISVGRendererRegion nsISVGRendererGlyphGeometry::update ( in unsigned long  updatemask) [inherited]

Called by this object's corresponding nsISVGGlyphGeometrySource as a notification that some of the source's data (identified by paramter 'updatemask') has changed.

Parameters:
updatemaskAn OR-ed combination of the UPDATEMASK_* constants defined in nsISVGGlyphGeometrySource.
Returns:
Region that needs to be redrawn.

Friends And Related Function Documentation

Definition at line 119 of file nsSVGLibartGlyphGeometryFT.cpp.

{
  *result = nsnull;
  
  nsSVGLibartGlyphGeometryFT* gg = new nsSVGLibartGlyphGeometryFT();
  if (!gg) return NS_ERROR_OUT_OF_MEMORY;

  NS_ADDREF(gg);

  nsresult rv = gg->Init(src);

  if (NS_FAILED(rv)) {
    NS_RELEASE(gg);
    return rv;
  }
  
  *result = gg;
  return rv;
}

Member Data Documentation

Transformed bounding box (does not include stroke width)

Definition at line 110 of file nsISVGRendererGlyphGeometry.idl.

class nsSVGLibartGlyphMetrics

Default Libart glyph metrics implementation.

Definition at line 60 of file nsSVGLibartGlyphMetricsDefault.cpp.

Inheritance diagram for nsSVGLibartGlyphMetrics:
Collaboration diagram for nsSVGLibartGlyphMetrics:

Public Member Functions

nsIDOMSVGRect getExtentOfChar (in unsigned long charnum)
 Get the untransformed bounding box of an individual glyph.
float getAdvanceOfChar (in unsigned long charnum)
 Get the advance of an individual glyph.
float getBaselineOffset (in unsigned short baselineIdentifier)
 Retrieve the (y-axis) offset of the given baseline.
boolean update (in unsigned long updatemask)
 Called by this object's corresponding nsISVGGlyphMetricsSource as a notification that some of the source's data (identified by paramter 'updatemask') has changed.

Public Attributes

readonly attribute float advance
 Untransformed width of the composite glyph in pixels.
Baseline offset constants for getBaselineOffset()
const unsigned short BASELINE_ALPHABETIC = 0
const unsigned short BASELINE_HANGING = 1
const unsigned short BASELINE_IDEOGRAPHC = 2
const unsigned short BASELINE_MATHEMATICAL = 3
const unsigned short BASELINE_CENTRAL = 4
const unsigned short BASELINE_MIDDLE = 5
const unsigned short BASELINE_TEXT_BEFORE_EDGE = 6
const unsigned short BASELINE_TEXT_AFTER_EDGE = 7

Protected Member Functions

 nsSVGLibartGlyphMetrics (nsISVGGlyphMetricsSource *src)
 ~nsSVGLibartGlyphMetrics ()

Friends

nsresult NS_NewSVGLibartGlyphMetricsDefault (nsISVGRendererGlyphMetrics **result, nsISVGGlyphMetricsSource *src)

Constructor & Destructor Documentation


Member Function Documentation

float nsISVGRendererGlyphMetrics::getAdvanceOfChar ( in unsigned long  charnum) [inherited]

Get the advance of an individual glyph.

float nsISVGRendererGlyphMetrics::getBaselineOffset ( in unsigned short  baselineIdentifier) [inherited]

Retrieve the (y-axis) offset of the given baseline.

Parameters:
baselineIdentifierOne of the BASELINE_* constants defined in this interface.
Returns:
Y-axis offset in pixels relative to top of bounding box.

Get the untransformed bounding box of an individual glyph.

Parameters:
charnumThe index of the character in nsISVGGlyphMetricsSource::characterData whose glyph bounding box is to be determined
Returns:
The untransformed bounding box in pixel coordinates
boolean nsISVGRendererGlyphMetrics::update ( in unsigned long  updatemask) [inherited]

Called by this object's corresponding nsISVGGlyphMetricsSource as a notification that some of the source's data (identified by paramter 'updatemask') has changed.

Parameters:
updatemaskAn OR-ed combination of the UPDATEMASK_* constants defined in nsISVGGlyphMetricsSource.
Returns:
PR_TRUE if the metrics have changed as a result of the source update, PR_FALSE otherwise.

Friends And Related Function Documentation

Definition at line 93 of file nsSVGLibartGlyphMetricsDefault.cpp.

{
  *result = new nsSVGLibartGlyphMetrics(src);
  if (!*result) return NS_ERROR_OUT_OF_MEMORY;
  
  NS_ADDREF(*result);
  return NS_OK;
}

Member Data Documentation

readonly attribute float nsISVGRendererGlyphMetrics::advance [inherited]

Untransformed width of the composite glyph in pixels.

Definition at line 71 of file nsISVGRendererGlyphMetrics.idl.

Definition at line 92 of file nsISVGRendererGlyphMetrics.idl.

const unsigned short nsISVGRendererGlyphMetrics::BASELINE_CENTRAL = 4 [inherited]

Definition at line 96 of file nsISVGRendererGlyphMetrics.idl.

const unsigned short nsISVGRendererGlyphMetrics::BASELINE_HANGING = 1 [inherited]

Definition at line 93 of file nsISVGRendererGlyphMetrics.idl.

Definition at line 94 of file nsISVGRendererGlyphMetrics.idl.

Definition at line 95 of file nsISVGRendererGlyphMetrics.idl.

const unsigned short nsISVGRendererGlyphMetrics::BASELINE_MIDDLE = 5 [inherited]

Definition at line 97 of file nsISVGRendererGlyphMetrics.idl.

Definition at line 99 of file nsISVGRendererGlyphMetrics.idl.

Definition at line 98 of file nsISVGRendererGlyphMetrics.idl.

class nsSVGLibartGlyphMetricsFT

Libart freetype-based glyph metrics implementation.

Conditionally compiled in for freetype-enabled builds only.

Definition at line 68 of file nsSVGLibartGlyphMetricsFT.cpp.

Inheritance diagram for nsSVGLibartGlyphMetricsFT:
Collaboration diagram for nsSVGLibartGlyphMetricsFT:

Public Member Functions

nsIDOMSVGRect getExtentOfChar (in unsigned long charnum)
 Get the untransformed bounding box of an individual glyph.
float getAdvanceOfChar (in unsigned long charnum)
 Get the advance of an individual glyph.
float getBaselineOffset (in unsigned short baselineIdentifier)
 Retrieve the (y-axis) offset of the given baseline.
boolean update (in unsigned long updatemask)
 Called by this object's corresponding nsISVGGlyphMetricsSource as a notification that some of the source's data (identified by paramter 'updatemask') has changed.

Public Attributes

readonly attribute float advance
 Untransformed width of the composite glyph in pixels.
Baseline offset constants for getBaselineOffset()
const unsigned short BASELINE_ALPHABETIC = 0
const unsigned short BASELINE_HANGING = 1
const unsigned short BASELINE_IDEOGRAPHC = 2
const unsigned short BASELINE_MATHEMATICAL = 3
const unsigned short BASELINE_CENTRAL = 4
const unsigned short BASELINE_MIDDLE = 5
const unsigned short BASELINE_TEXT_BEFORE_EDGE = 6
const unsigned short BASELINE_TEXT_AFTER_EDGE = 7

Static Public Attributes

static nsDataHashtable
< nsStringHashKey, const
nsString * > 
sFontAliases

Protected Member Functions

 nsSVGLibartGlyphMetricsFT (nsISVGGlyphMetricsSource *src)
 ~nsSVGLibartGlyphMetricsFT ()
NS_DECL_ISUPPORTS
NS_DECL_NSISVGRENDERERGLYPHMETRICS 
NS_IMETHOD_ (FT_Face) GetFTFace()
 NS_IMETHOD_ (float) GetPixelScale()
 NS_IMETHOD_ (float) GetTwipsToPixels()
 NS_IMETHOD_ (const FT_BBox *) GetBoundingBox()
 NS_IMETHOD_ (PRUint32) GetGlyphCount()
 NS_IMETHOD_ (FT_Glyph) GetGlyphAt(PRUint32 pos)
void InitializeFace ()
void ClearFace ()
void InitializeGlyphArray ()
void ClearGlyphArray ()

Private Attributes

FT_Face mFace
GlyphDescriptormGlyphArray
PRUint32 mGlyphArrayLength
FT_BBox mBBox
nsCOMPtr
< nsISVGGlyphMetricsSource
mSource

Friends

nsresult NS_NewSVGLibartGlyphMetricsFT (nsISVGRendererGlyphMetrics **result, nsISVGGlyphMetricsSource *src)
void NS_InitSVGLibartGlyphMetricsFTGlobals ()
void NS_FreeSVGLibartGlyphMetricsFTGlobals ()

Constructor & Destructor Documentation

Definition at line 132 of file nsSVGLibartGlyphMetricsFT.cpp.

Here is the call graph for this function:


Member Function Documentation

void nsSVGLibartGlyphMetricsFT::ClearFace ( ) [inline, protected]

Definition at line 95 of file nsSVGLibartGlyphMetricsFT.cpp.

{ mFace = nsnull; }

Here is the caller graph for this function:

Definition at line 524 of file nsSVGLibartGlyphMetricsFT.cpp.

{
  if (mGlyphArray)
    delete[] mGlyphArray;
  mGlyphArray = nsnull;
}

Here is the caller graph for this function:

float nsISVGRendererGlyphMetrics::getAdvanceOfChar ( in unsigned long  charnum) [inherited]

Get the advance of an individual glyph.

float nsISVGRendererGlyphMetrics::getBaselineOffset ( in unsigned short  baselineIdentifier) [inherited]

Retrieve the (y-axis) offset of the given baseline.

Parameters:
baselineIdentifierOne of the BASELINE_* constants defined in this interface.
Returns:
Y-axis offset in pixels relative to top of bounding box.

Get the untransformed bounding box of an individual glyph.

Parameters:
charnumThe index of the character in nsISVGGlyphMetricsSource::characterData whose glyph bounding box is to be determined
Returns:
The untransformed bounding box in pixel coordinates

Definition at line 406 of file nsSVGLibartGlyphMetricsFT.cpp.

{
  if (mFace) return; // already initialized
  
  FindFontStruct font_data;
  mSource->GetFont(&font_data.font);

  font_data.font.EnumerateFamilies(FindFont, (void*)&font_data);

  if (!font_data.font_entry) {
    // try to find *any* font
    nsAutoString empty;
    FindFont(empty, PR_FALSE, (void*)&font_data);
  }
  
  if (!font_data.font_entry) {
    NS_ERROR("svg libart renderer can't find a font (let alone a suitable one)");
    return;
  }

  FTC_Image_Desc imageDesc;
  imageDesc.font.face_id=(void*)font_data.font_entry.get(); // XXX do we need to addref?
  float twipstopixel = GetTwipsToPixels();
  float scale = GetPixelScale();
  imageDesc.font.pix_width = (int)((float)(font_data.font.size)*twipstopixel/scale);
  imageDesc.font.pix_height = (int)((float)(font_data.font.size)*twipstopixel/scale);
  imageDesc.image_type |= ftc_image_grays;

  // get the face
  nsresult rv;
  FTC_Manager mgr;
  nsSVGLibartFreetype::ft2->GetFTCacheManager(&mgr);
  rv = nsSVGLibartFreetype::ft2->ManagerLookupSize(mgr, &imageDesc.font, &mFace, nsnull);
  NS_ASSERTION(mFace, "failed to get face/size");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 442 of file nsSVGLibartGlyphMetricsFT.cpp.

{
  if (mGlyphArray) return; // already initialized

  InitializeFace();
  if (!mFace) {
    NS_ERROR("no face");
    return;
  }
  FT_GlyphSlot glyphslot=mFace->glyph;

  mBBox.xMin = mBBox.yMin = 3200;
  mBBox.xMax = mBBox.yMax = -3200;
  
  nsAutoString text;
  mSource->GetCharacterData(text);
  mGlyphArrayLength = text.Length();
  if (mGlyphArrayLength == 0) return;

  mGlyphArray = new GlyphDescriptor[mGlyphArrayLength];
  NS_ASSERTION(mGlyphArray, "could not allocate glyph descriptor array");

  GlyphDescriptor* glyph = mGlyphArray;
  bool use_kerning = FT_HAS_KERNING(mFace);
  FT_UInt previous_glyph = 0;
  FT_Vector pen; // pen position in 26.6 format
  pen.x = 0;
  pen.y = 0;
  
  nsAString::const_iterator start, end;
  text.BeginReading(start);
  text.EndReading(end);
  PRUint32 size;
  
  for ( ; start!=end; start.advance(size)) {
    const PRUnichar* buf = start.get();
    size = start.size_forward();
    // fragment at 'buf' is 'size' characters long
    for (PRUint32 i=0; i<size; ++i) {
      nsSVGLibartFreetype::ft2->GetCharIndex(mFace, buf[i], &glyph->index);
      
      if (use_kerning && previous_glyph && glyph->index) {
        FT_Vector delta;
        nsSVGLibartFreetype::ft2->GetKerning(mFace, previous_glyph,
                                             glyph->index,
                                             FT_KERNING_DEFAULT,
                                             &delta);
        pen.x += delta.x;
      }

      // load glyph into the face's shared glyph slot:
      if (NS_FAILED(nsSVGLibartFreetype::ft2->LoadGlyph(mFace,
                                                        glyph->index,
                                                        FT_LOAD_DEFAULT))) {
        NS_ERROR("error loading glyph");
        continue;
      }

      // copy glyph image into array:
      if (NS_FAILED(nsSVGLibartFreetype::ft2->GetGlyph(glyphslot, &glyph->image))) {
        NS_ERROR("error copying glyph");
        continue;
      }

      // translate glyph image to correct location within string:
      nsSVGLibartFreetype::ft2->GlyphTransform(glyph->image, 0, &pen);

      // update the string's bounding box:
      FT_BBox glyph_bbox;
      nsSVGLibartFreetype::ft2->GlyphGetCBox(glyph->image, ft_glyph_bbox_pixels, &glyph_bbox);
      mBBox.xMin = PR_MIN(mBBox.xMin, glyph_bbox.xMin);
      mBBox.xMax = PR_MAX(mBBox.xMax, glyph_bbox.xMax);
      mBBox.yMin = PR_MIN(mBBox.yMin, glyph_bbox.yMin);
      mBBox.yMax = PR_MAX(mBBox.yMax, glyph_bbox.yMax);
      
      pen.x += glyphslot->advance.x;
      previous_glyph = glyph->index;
      ++glyph;
    }
  }
}

Here is the call graph for this function:

NS_DECL_ISUPPORTS NS_DECL_NSISVGRENDERERGLYPHMETRICS nsSVGLibartGlyphMetricsFT::NS_IMETHOD_ ( FT_Face  ) [protected, virtual]
nsSVGLibartGlyphMetricsFT::NS_IMETHOD_ ( float  ) [protected, virtual]
nsSVGLibartGlyphMetricsFT::NS_IMETHOD_ ( float  ) [protected, virtual]
boolean nsISVGRendererGlyphMetrics::update ( in unsigned long  updatemask) [inherited]

Called by this object's corresponding nsISVGGlyphMetricsSource as a notification that some of the source's data (identified by paramter 'updatemask') has changed.

Parameters:
updatemaskAn OR-ed combination of the UPDATEMASK_* constants defined in nsISVGGlyphMetricsSource.
Returns:
PR_TRUE if the metrics have changed as a result of the source update, PR_FALSE otherwise.

Friends And Related Function Documentation

Definition at line 149 of file nsSVGLibartGlyphMetricsFT.cpp.

{
  
  NS_ASSERTION(!nsSVGLibartGlyphMetricsFT::sFontAliases.IsInitialized(),
               "font aliases already initialized");
  nsSVGLibartGlyphMetricsFT::sFontAliases.Init(3);

  static NS_NAMED_LITERAL_STRING(arial, "arial");
  nsSVGLibartGlyphMetricsFT::sFontAliases.Put(NS_LITERAL_STRING("helvetica"),
                                              &arial);

  static NS_NAMED_LITERAL_STRING(courier, "courier new");
  nsSVGLibartGlyphMetricsFT::sFontAliases.Put(NS_LITERAL_STRING("courier"),
                                              &courier);

  static NS_NAMED_LITERAL_STRING(times, "times new roman");
  nsSVGLibartGlyphMetricsFT::sFontAliases.Put(NS_LITERAL_STRING("times"),
                                              &times);
}

Definition at line 139 of file nsSVGLibartGlyphMetricsFT.cpp.

{
  *result = new nsSVGLibartGlyphMetricsFT(src);
  if (!*result) return NS_ERROR_OUT_OF_MEMORY;
  
  NS_ADDREF(*result);
  return NS_OK;
}

Member Data Documentation

readonly attribute float nsISVGRendererGlyphMetrics::advance [inherited]

Untransformed width of the composite glyph in pixels.

Definition at line 71 of file nsISVGRendererGlyphMetrics.idl.

Definition at line 92 of file nsISVGRendererGlyphMetrics.idl.

const unsigned short nsISVGRendererGlyphMetrics::BASELINE_CENTRAL = 4 [inherited]

Definition at line 96 of file nsISVGRendererGlyphMetrics.idl.

const unsigned short nsISVGRendererGlyphMetrics::BASELINE_HANGING = 1 [inherited]

Definition at line 93 of file nsISVGRendererGlyphMetrics.idl.

Definition at line 94 of file nsISVGRendererGlyphMetrics.idl.

Definition at line 95 of file nsISVGRendererGlyphMetrics.idl.

const unsigned short nsISVGRendererGlyphMetrics::BASELINE_MIDDLE = 5 [inherited]

Definition at line 97 of file nsISVGRendererGlyphMetrics.idl.

Definition at line 99 of file nsISVGRendererGlyphMetrics.idl.

Definition at line 98 of file nsISVGRendererGlyphMetrics.idl.

struct nsSVGLibartGlyphMetricsFT::GlyphDescriptor

Definition at line 101 of file nsSVGLibartGlyphMetricsFT.cpp.

Public Member Functions

 GlyphDescriptor ()
 ~GlyphDescriptor ()

Public Attributes

FT_UInt index
FT_Glyph image

Constructor & Destructor Documentation


Member Data Documentation

class nsSVGLibartPathGeometry

Libart path geometry implementation.

Definition at line 77 of file nsSVGLibartPathGeometry.cpp.

Inheritance diagram for nsSVGLibartPathGeometry:
Collaboration diagram for nsSVGLibartPathGeometry:

Public Member Functions

void render (in nsISVGRendererCanvas canvas)
 Paint this object.
nsISVGRendererRegion update (in unsigned long updatemask)
 Called by this object's corresponding nsISVGPathGeometrySource as a notification that some of the source's data (identified by paramter 'updatemask') has changed.
nsISVGRendererRegion getCoveredRegion ()
 Get a region object describing the area covered with paint by this path geometry.
boolean containsPoint (in float x, in float y)
 Hit-testing method.
void flatten (out nsSVGPathData data)

Public Attributes

readonly attribute nsIDOMSVGRect boundingBox
 Bounding box (does not include stroke width)

Protected Member Functions

 nsSVGLibartPathGeometry ()
 ~nsSVGLibartPathGeometry ()
nsresult Init (nsISVGPathGeometrySource *src)
void ClearPath ()
void ClearFill ()
void ClearStroke ()
void ClearCoveredRegion ()
ArtVpath * GetPath ()
ArtSVP * GetFill ()
ArtSVP * GetStroke ()
ArtSVP * GetGradient ()

Private Attributes

nsCOMPtr
< nsISVGPathGeometrySource
mSource
nsCOMPtr< nsISVGRendererRegionmCoveredRegion
ArtVpath * mVPath
nsSVGFill mFill
nsSVGStroke mStroke

Friends

nsresult NS_NewSVGLibartPathGeometry (nsISVGRendererPathGeometry **result, nsISVGPathGeometrySource *src)

Constructor & Destructor Documentation

Definition at line 123 of file nsSVGLibartPathGeometry.cpp.

{
  ClearPath();
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 98 of file nsSVGLibartPathGeometry.cpp.

void nsSVGLibartPathGeometry::ClearFill ( ) [inline, protected]

Definition at line 96 of file nsSVGLibartPathGeometry.cpp.

{ mFill.Clear(); }

Here is the call graph for this function:

void nsSVGLibartPathGeometry::ClearPath ( ) [inline, protected]

Definition at line 95 of file nsSVGLibartPathGeometry.cpp.

{ if (mVPath) { art_free(mVPath); mVPath=nsnull; } }

Here is the caller graph for this function:

void nsSVGLibartPathGeometry::ClearStroke ( ) [inline, protected]

Definition at line 97 of file nsSVGLibartPathGeometry.cpp.

{ mStroke.Clear(); }

Here is the call graph for this function:

boolean nsISVGRendererPathGeometry::containsPoint ( in float  x,
in float  y 
) [inherited]

Hit-testing method.

Does this path geometry (with all relevant transformations applied) contain the point x,y? Mode of operation (e.g. whether to test fill or stroke) is determined by nsISVGPathGeometrySource::hittestMask.

Parameters:
xX-coordinate of test point.
yY-coordinate of test point.
Returns:
PR_TRUE if the path geometry contains the point, PR_FALSE otherwise.

Get a region object describing the area covered with paint by this path geometry.

Returns:
Covered region.
ArtSVP * nsSVGLibartPathGeometry::GetFill ( ) [protected]

Definition at line 225 of file nsSVGLibartPathGeometry.cpp.

{
  if (!mFill.IsEmpty() || !GetPath()) return mFill.GetSvp();
  
  mFill.Build(GetPath(), mSource);
  
  return mFill.GetSvp();
}

Here is the call graph for this function:

ArtSVP* nsSVGLibartPathGeometry::GetGradient ( ) [protected]

Definition at line 169 of file nsSVGLibartPathGeometry.cpp.

{
  if (mVPath) return mVPath;

  // 1. construct a bezier path:
  ArtBpath*bpath = nsnull;
  
  nsCOMPtr<nsISVGRendererPathBuilder> builder;
  NS_NewSVGLibartBPathBuilder(getter_AddRefs(builder), &bpath);
  mSource->ConstructPath(builder);
  builder->EndPath();

  // 2. transform the bpath into global coords:
  double matrix[6];
  {
    nsCOMPtr<nsIDOMSVGMatrix> ctm;
    mSource->GetCanvasTM(getter_AddRefs(ctm));
    NS_ASSERTION(ctm, "graphic source didn't have a ctm");
    
    float val;
    ctm->GetA(&val);
    matrix[0] = val;
    
    ctm->GetB(&val);
    matrix[1] = val;
    
    ctm->GetC(&val);  
    matrix[2] = val;  
    
    ctm->GetD(&val);  
    matrix[3] = val;  
    
    ctm->GetE(&val);
    matrix[4] = val;
    
    ctm->GetF(&val);
    matrix[5] = val;
  }

  if ( bpath &&
       ( matrix[0] != 1.0 || matrix[2] != 0.0 || matrix[4] != 0.0 ||
         matrix[1] != 0.0 || matrix[3] != 1.0 || matrix[5] != 0.0 ))
  {
    ArtBpath* temp = bpath;
    bpath = art_bpath_affine_transform(bpath, matrix);
    art_free(temp);
  }

  // 3. convert the bpath into a vpath:
  if (bpath)
    mVPath = art_bez_path_to_vec(bpath, SVG_BEZIER_FLATNESS);

  return mVPath;
}

Here is the call graph for this function:

Here is the caller graph for this function:

ArtSVP * nsSVGLibartPathGeometry::GetStroke ( ) [protected]

Definition at line 235 of file nsSVGLibartPathGeometry.cpp.

{
  if (!mStroke.IsEmpty() || !GetPath()) return mStroke.GetSvp();

  mStroke.Build(GetPath(), mSource);
  
  return mStroke.GetSvp();
}

Here is the call graph for this function:

Definition at line 128 of file nsSVGLibartPathGeometry.cpp.

{
  mSource = src;
  return NS_OK;
}

Here is the caller graph for this function:

Paint this object.

Parameters:
canvasThe canvas to render to.
nsISVGRendererRegion nsISVGRendererPathGeometry::update ( in unsigned long  updatemask) [inherited]

Called by this object's corresponding nsISVGPathGeometrySource as a notification that some of the source's data (identified by paramter 'updatemask') has changed.

Parameters:
updatemaskAn OR-ed combination of the UPDATEMASK_* constants defined in nsISVGPathGeometrySource.
Returns:
Region that needs to be redrawn.

Friends And Related Function Documentation

Definition at line 136 of file nsSVGLibartPathGeometry.cpp.

{
  nsSVGLibartPathGeometry* pg = new nsSVGLibartPathGeometry();
  if (!pg) return NS_ERROR_OUT_OF_MEMORY;

  NS_ADDREF(pg);

  nsresult rv = pg->Init(src);

  if (NS_FAILED(rv)) {
    NS_RELEASE(pg);
    return rv;
  }
  
  *result = pg;
  return rv;
}

Member Data Documentation

Bounding box (does not include stroke width)

Definition at line 111 of file nsISVGRendererPathGeometry.idl.

ArtVpath* nsSVGLibartPathGeometry::mVPath [private]

Definition at line 108 of file nsSVGLibartPathGeometry.cpp.

class nsSVGLibartRegion

Libart region implementation.

Definition at line 53 of file nsSVGLibartRegion.cpp.

Inheritance diagram for nsSVGLibartRegion:
Collaboration diagram for nsSVGLibartRegion:

Public Member Functions

NS_DECL_ISUPPORTS NS_IMETHOD_ (ArtUta *) GetUta()
 Get region as a libart microtile array.
nsISVGRendererRegion combine (in nsISVGRendererRegion other)
 Return union of this region with another region.
void getRectangleScans (in nsISVGRectangleSink sink)
 Write a sequence of rectangles approximating this region to the sink object.

Protected Member Functions

 nsSVGLibartRegion (ArtIRect *rect)
 nsSVGLibartRegion (ArtSVP *path)
 nsSVGLibartRegion (ArtUta *uta)
 ~nsSVGLibartRegion ()

Private Attributes

ArtUta * mUta

Friends

nsresult NS_NewSVGLibartRectRegion (nsISVGRendererRegion **result, float x, float y, float width, float height)
nsresult NS_NewSVGLibartSVPRegion (nsISVGRendererRegion **result, ArtSVP *path)

Constructor & Destructor Documentation

nsSVGLibartRegion::nsSVGLibartRegion ( ArtIRect *  rect) [protected]

Definition at line 86 of file nsSVGLibartRegion.cpp.

{
  mUta = art_uta_from_irect(rect);
}
nsSVGLibartRegion::nsSVGLibartRegion ( ArtSVP *  path) [protected]

Definition at line 91 of file nsSVGLibartRegion.cpp.

{
  mUta = path ? art_uta_from_svp(path) : nsnull;  
}
nsSVGLibartRegion::nsSVGLibartRegion ( ArtUta *  uta) [protected]

Definition at line 96 of file nsSVGLibartRegion.cpp.

    : mUta(uta)
{
}

Definition at line 101 of file nsSVGLibartRegion.cpp.

{
  if (mUta)
    art_uta_free(mUta);
}

Member Function Documentation

Return union of this region with another region.

Parameters:
otherRegion to combine with.
Returns:
Union region.

Write a sequence of rectangles approximating this region to the sink object.

The approximation can be crude but should fully contain the actual region area.

Parameters:
sinkRectangle sink to write to.

Get region as a libart microtile array.

Implements nsISVGLibartRegion.


Friends And Related Function Documentation

nsresult NS_NewSVGLibartRectRegion ( nsISVGRendererRegion **  result,
float  x,
float  y,
float  width,
float  height 
) [friend]

Definition at line 108 of file nsSVGLibartRegion.cpp.

{
  if (width<=0.0f || height<=0.0f) {
    *result = new nsSVGLibartRegion((ArtUta*)nsnull);
  }
  else {
    ArtIRect irect;
    irect.x0 = (int)x; // floor(x)
    irect.y0 = (int)y; // floor(y)
    irect.x1 = (int)ceil(x+width);
    irect.y1 = (int)ceil(y+height);
    NS_ASSERTION(irect.x0!=irect.x1 && irect.y0!=irect.y1, "empty region");
    *result = new nsSVGLibartRegion(&irect);
  }
  
  if (!*result) return NS_ERROR_OUT_OF_MEMORY;
  
  NS_ADDREF(*result);
  return NS_OK;
}
nsresult NS_NewSVGLibartSVPRegion ( nsISVGRendererRegion **  result,
ArtSVP *  path 
) [friend]

Definition at line 132 of file nsSVGLibartRegion.cpp.

{
  *result = new nsSVGLibartRegion(path);
  if (!*result) return NS_ERROR_OUT_OF_MEMORY;

  NS_ADDREF(*result);
  return NS_OK;  
}

Member Data Documentation

ArtUta* nsSVGLibartRegion::mUta [private]

Definition at line 78 of file nsSVGLibartRegion.cpp.

class nsSVGRendererLibart

Libart-based renderer implementation.

Definition at line 64 of file nsSVGRendererLibart.cpp.

Inheritance diagram for nsSVGRendererLibart:
Collaboration diagram for nsSVGRendererLibart:

Public Member Functions

nsISVGRendererPathGeometry createPathGeometry (in nsISVGPathGeometrySource src)
 Create a rendering engine-native path geometry object for the source object given by 'src'.
nsISVGRendererGlyphMetrics createGlyphMetrics (in nsISVGGlyphMetricsSource src)
 Create a rendering engine-native glyph metrics object for the source object given by 'src'.
nsISVGRendererGlyphGeometry createGlyphGeometry (in nsISVGGlyphGeometrySource src)
 Create a rendering engine-native glyph geometry object for the source object given by 'src'.
nsISVGRendererCanvas createCanvas (in nsIRenderingContext ctx, in nsPresContext presContext,[const ] in nsRectRef dirtyRect)
 Create a rendering engine-native canvas object for the Mozilla-native rendering context 'ctx' and presentation context 'presContext'.
nsISVGRendererRegion createRectRegion (in float x, in float y, in float width, in float height)
 Create a rendering engine-native region object for the given axis-aligned rectangle.
nsISVGRendererSurface createSurface (in unsigned long width, in unsigned long height)
 Create a rendering engine-native surface object.

Static Public Attributes

NS_DECL_ISUPPORTS static
NS_DECL_NSISVGRENDERER PRBool 
sGlobalsInited = PR_FALSE

Protected Member Functions

 nsSVGRendererLibart ()
virtual ~nsSVGRendererLibart ()

Friends

nsresult NS_NewSVGRendererLibart (nsISVGRenderer **aResult)

Constructor & Destructor Documentation

Definition at line 96 of file nsSVGRendererLibart.cpp.

{
}

Definition at line 100 of file nsSVGRendererLibart.cpp.

{
}

Member Function Documentation

nsISVGRendererCanvas nsISVGRenderer::createCanvas ( in nsIRenderingContext  ctx,
in nsPresContext  presContext,
[const ] in nsRectRef  dirtyRect 
) [inherited]

Create a rendering engine-native canvas object for the Mozilla-native rendering context 'ctx' and presentation context 'presContext'.

Parameters:
ctxMozilla-native rendering context.
presContextPresentation context.
dirtyRectArea that the canvas should cover.
Returns:
A rendering engine-native canvas object.

Create a rendering engine-native glyph geometry object for the source object given by 'src'.

Parameters:
srcThe source object describing the glyph for which this object is being created.
Returns:
A rendering engine-native glyph geometry object.

Create a rendering engine-native glyph metrics object for the source object given by 'src'.

Parameters:
srcThe source object describing the glyph for which this metrics object is being created.
Returns:
A rendering engine-native glyph metrics object.

Create a rendering engine-native path geometry object for the source object given by 'src'.

Parameters:
srcThe source object describing the path for which this object is being created.
Returns:
A rendering engine-native path geometry object.
nsISVGRendererRegion nsISVGRenderer::createRectRegion ( in float  x,
in float  y,
in float  width,
in float  height 
) [inherited]

Create a rendering engine-native region object for the given axis-aligned rectangle.

Parameters:
xX-coordinate of rectangle (pixels).
yY-coordinate of rectangle (pixels).
widthWidth of rectangle (pixels).
heightHeight of rectangle (pixels).
Returns:
A rendering engine-native region object.
nsISVGRendererSurface nsISVGRenderer::createSurface ( in unsigned long  width,
in unsigned long  height 
) [inherited]

Create a rendering engine-native surface object.

Parameters:
widthWidth of rectangle (pixels).
heightHeight of rectangle (pixels).
Returns:
A rendering engine-native surface object.

Friends And Related Function Documentation

Definition at line 105 of file nsSVGRendererLibart.cpp.

{
  NS_PRECONDITION(aResult != nsnull, "null ptr");
  if (! aResult)
    return NS_ERROR_NULL_POINTER;

  nsSVGRendererLibart* result = new nsSVGRendererLibart();
  if (! result)
    return NS_ERROR_OUT_OF_MEMORY;

  NS_ADDREF(result);
  *aResult = result;

  if (!nsSVGRendererLibart::sGlobalsInited) {
#ifdef MOZ_ENABLE_FREETYPE2
    if (!nsSVGLibartFreetype::Init()) {
      nsCOMPtr<nsIPromptService> prompter(do_GetService(NS_PROMPTSERVICE_CONTRACTID));
      NS_NAMED_LITERAL_STRING(title, "Freetype error");
      NS_NAMED_LITERAL_STRING(msg, "The Libart/Freetype SVG rendering engine could not initialize the freetype library. Please go to http://www.mozilla.org/projects/fonts/unix/enabling_truetype.html and follow steps 2-7.");
      prompter->Alert(nsnull, title.get(), msg.get());
    }
    else if (!nsSVGLibartFreetype::HasSuitableFonts()) {
      nsCOMPtr<nsIPromptService> prompter(do_GetService(NS_PROMPTSERVICE_CONTRACTID));
      NS_NAMED_LITERAL_STRING(title, "Font Configuration Error");
      NS_NAMED_LITERAL_STRING(msg, "The Libart/Freetype SVG rendering engine can't find any truetype fonts on your system. Please go to http://www.mozilla.org/projects/fonts/unix/enabling_truetype.html and follow steps 2-7.");
      prompter->Alert(nsnull, title.get(), msg.get());
      nsSVGLibartFreetype::Shutdown();
    }
    else {
      nsSVGRendererLibart::sUseFreetype = PR_TRUE;
      NS_InitSVGLibartGlyphMetricsFTGlobals();
    }
#endif    
    nsSVGRendererLibart::sGlobalsInited = PR_TRUE;
  }
  
  return NS_OK;
}

Member Data Documentation

class nsSVGRenderItem

Wraps a libart sorted vector path.

Definition at line 52 of file nsSVGRenderItem.h.

Inheritance diagram for nsSVGRenderItem:

Public Member Functions

 nsSVGRenderItem ()
virtual ~nsSVGRenderItem ()
void Clear ()
ArtSVP * GetSvp ()
ArtUta * GetUta ()
PRBool IsEmpty ()
PRBool Contains (float x, float y)

Protected Attributes

ArtSVP * mSvp

Constructor & Destructor Documentation

Definition at line 41 of file nsSVGRenderItem.cpp.

    : mSvp(nsnull)
{
  
}

Definition at line 47 of file nsSVGRenderItem.cpp.

{
  Clear();
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 52 of file nsSVGRenderItem.cpp.

{
  if (mSvp)
    art_svp_free(mSvp);
  mSvp = nsnull;
}  

Here is the caller graph for this function:

PRBool nsSVGRenderItem::Contains ( float  x,
float  y 
)

Definition at line 67 of file nsSVGRenderItem.cpp.

{
  if (!mSvp) return PR_FALSE;
  return (art_svp_point_wind(GetSvp(), x, y) != 0);
}

Here is the call graph for this function:

ArtSVP* nsSVGRenderItem::GetSvp ( ) [inline]

Definition at line 60 of file nsSVGRenderItem.h.

{ return mSvp; }

Here is the caller graph for this function:

Definition at line 60 of file nsSVGRenderItem.cpp.

{
  if (!mSvp) return nsnull;
  return art_uta_from_svp(mSvp);
}

Definition at line 63 of file nsSVGRenderItem.h.

{ return (mSvp == nsnull); }

Here is the caller graph for this function:


Member Data Documentation

ArtSVP* nsSVGRenderItem::mSvp [protected]

Definition at line 68 of file nsSVGRenderItem.h.

class nsSVGStroke

Definition at line 51 of file nsSVGStroke.h.

Inheritance diagram for nsSVGStroke:
Collaboration diagram for nsSVGStroke:

Public Member Functions

void Build (ArtVpath *path, nsISVGPathGeometrySource *source)
void Clear ()
ArtSVP * GetSvp ()
ArtUta * GetUta ()
PRBool IsEmpty ()
PRBool Contains (float x, float y)

Protected Attributes

ArtSVP * mSvp

Member Function Documentation

void nsSVGStroke::Build ( ArtVpath *  path,
nsISVGPathGeometrySource source 
)

Definition at line 51 of file nsSVGStroke.cpp.

{
  if (mSvp)
    art_svp_free(mSvp);

  float width;
  source->GetStrokeWidth(&width);

  // XXX since we construct the stroke from a pre-transformed path, we
  // adjust the stroke width according to the expansion part of
  // transformation. This is not true anamorphic scaling, but the best
  // we can do given the circumstances...
  float expansion; 
  {
    double matrix[6];
    nsCOMPtr<nsIDOMSVGMatrix> ctm;
    source->GetCanvasTM(getter_AddRefs(ctm));
    NS_ASSERTION(ctm, "graphic source didn't have a ctm");
    
    float val;
    ctm->GetA(&val);
    matrix[0] = val;
    
    ctm->GetB(&val);
    matrix[1] = val;
    
    ctm->GetC(&val);  
    matrix[2] = val;  
    
    ctm->GetD(&val);  
    matrix[3] = val;  
    
    ctm->GetE(&val);
    matrix[4] = val;
    
    ctm->GetF(&val);
    matrix[5] = val;
    
    expansion = sqrt((float)fabs(matrix[0]*matrix[3]-matrix[2]*matrix[1]));
  }

  width*=expansion;
  if (width==0.0) return;
  
  PRUint16 strokelinecap;
  source->GetStrokeLinecap(&strokelinecap);  
  ArtPathStrokeCapType captype;
  switch(strokelinecap) {
    case nsISVGGeometrySource::STROKE_LINECAP_BUTT:
      captype = ART_PATH_STROKE_CAP_BUTT;
      break;
    case nsISVGGeometrySource::STROKE_LINECAP_ROUND:
      captype = ART_PATH_STROKE_CAP_ROUND;
      break;
    case nsISVGGeometrySource::STROKE_LINECAP_SQUARE:
      captype = ART_PATH_STROKE_CAP_SQUARE;
      break;
    default:
      NS_ERROR("not reached");
  }

  PRUint16 strokelinejoin;
  source->GetStrokeLinejoin(&strokelinejoin);

  ArtPathStrokeJoinType jointype;
  switch(strokelinejoin) {
    case nsISVGGeometrySource::STROKE_LINEJOIN_MITER:
      jointype = ART_PATH_STROKE_JOIN_MITER;
      break;
    case nsISVGGeometrySource::STROKE_LINEJOIN_ROUND:
      jointype = ART_PATH_STROKE_JOIN_ROUND;
      break;
    case nsISVGGeometrySource::STROKE_LINEJOIN_BEVEL:
      jointype = ART_PATH_STROKE_JOIN_BEVEL;
      break;
    default:
      NS_ERROR("not reached");
  }

  float *dashArray;
  PRUint32 dashCount;
  source->GetStrokeDashArray(&dashArray, &dashCount);
  if (dashCount>0) {
    ArtVpathDash dashes;

    float offset;
    source->GetStrokeDashoffset(&offset);
    dashes.offset = offset;

    dashes.n_dash = dashCount;
    dashes.dash = new double[dashCount];
    while (dashCount--)
      dashes.dash[dashCount] = dashArray[dashCount];

    nsMemory::Free(dashArray);

    // create a dashed vpath:

    ArtVpathArrayIterator src_iter;
//      ArtVpathClipFilter clip_filter;
    ArtVpathDashFilter dash_filter;
      
    art_vpath_array_iterator_init((ArtVpath*)path, &src_iter);
//      art_vpath_clip_filter_init((ArtVpathIterator*)&src_iter, canvasSpecs->GetClipRect(), &clip_filter);
//      art_vpath_dash_filter_init((ArtVpathIterator*)&clip_filter, &dash, &dash_filter);
    art_vpath_dash_filter_init((ArtVpathIterator*)&src_iter, &dashes, &dash_filter);
    
    path = art_vpath_new_vpath_array((ArtVpathIterator*)&dash_filter);
    
    // clean up
    delete[] dashes.dash;
  }
  else
  {
    // no dash pattern - just clip & contract with moveto_open
      ArtVpathArrayIterator src_iter;
//      ArtVpathClipFilter clip_filter;
//      ArtVpathContractFilter contract_filter;
      
      art_vpath_array_iterator_init((ArtVpath*)path, &src_iter);
//      art_vpath_clip_filter_init((ArtVpathIterator*)&src_iter, canvasSpecs->GetClipRect(), &clip_filter);
//      art_vpath_contract_filter_init((ArtVpathIterator*)&clip_filter,
//                                     ART_LINETO_CLIPPED,
//                                     ART_MOVETO_OPEN,
//                                     &contract_filter);
      
//      path = art_vpath_new_vpath_array((ArtVpathIterator*)&contract_filter);
      path = art_vpath_new_vpath_array((ArtVpathIterator*)&src_iter);
  }    

  float miterlimit;
  source->GetStrokeMiterlimit(&miterlimit);

  mSvp = art_svp_vpath_stroke(path,
                              jointype,
                              captype,
                              width,
                              miterlimit,
                              SVG_STROKE_FLATNESS);
  art_free(path);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsSVGRenderItem::Clear ( void  ) [inherited]

Definition at line 52 of file nsSVGRenderItem.cpp.

{
  if (mSvp)
    art_svp_free(mSvp);
  mSvp = nsnull;
}  

Here is the caller graph for this function:

PRBool nsSVGRenderItem::Contains ( float  x,
float  y 
) [inherited]

Definition at line 67 of file nsSVGRenderItem.cpp.

{
  if (!mSvp) return PR_FALSE;
  return (art_svp_point_wind(GetSvp(), x, y) != 0);
}

Here is the call graph for this function:

ArtSVP* nsSVGRenderItem::GetSvp ( ) [inline, inherited]

Definition at line 60 of file nsSVGRenderItem.h.

{ return mSvp; }

Here is the caller graph for this function:

ArtUta * nsSVGRenderItem::GetUta ( ) [inherited]

Definition at line 60 of file nsSVGRenderItem.cpp.

{
  if (!mSvp) return nsnull;
  return art_uta_from_svp(mSvp);
}
PRBool nsSVGRenderItem::IsEmpty ( void  ) [inline, inherited]

Definition at line 63 of file nsSVGRenderItem.h.

{ return (mSvp == nsnull); }

Here is the caller graph for this function:


Member Data Documentation

ArtSVP* nsSVGRenderItem::mSvp [protected, inherited]

Definition at line 68 of file nsSVGRenderItem.h.