00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #include "nsCOMPtr.h"
00040 #include "nsISVGRenderer.h"
00041 #include "nsSVGLibartPathGeometry.h"
00042 #include "nsSVGLibartCanvas.h"
00043 #include "nsSVGLibartRegion.h"
00044
00045 class nsISVGRendererGlyphMetrics;
00046 class nsISVGGlyphMetricsSource;
00047 class nsISVGRendererGlyphGeometry;
00048 class nsISVGGlyphGeometrySource;
00049
00050 nsresult
00051 NS_NewSVGLibartGlyphGeometry(nsISVGRendererGlyphGeometry **result,
00052 nsISVGGlyphGeometrySource *src);
00053
00054 nsresult
00055 NS_NewSVGLibartGlyphMetrics(nsISVGRendererGlyphMetrics **result,
00056 nsISVGGlyphMetricsSource *src);
00057
00058 void NS_InitSVGLibartGlyphMetricsGlobals();
00059 void NS_FreeSVGLibartGlyphMetricsGlobals();
00060
00062
00063
00064 void NS_InitSVGRendererLibartGlobals()
00065 {
00066 NS_InitSVGLibartGlyphMetricsGlobals();
00067 }
00068
00069 void NS_FreeSVGRendererLibartGlobals()
00070 {
00071 NS_FreeSVGLibartGlyphMetricsGlobals();
00072 }
00073
00078
00079
00082 class nsSVGRendererLibart : public nsISVGRenderer
00083 {
00084 protected:
00085 friend nsresult NS_NewSVGRendererLibart(nsISVGRenderer** aResult);
00086
00087 nsSVGRendererLibart();
00088 virtual ~nsSVGRendererLibart();
00089
00090 public:
00091
00092 NS_DECL_ISUPPORTS
00093
00094
00095 NS_DECL_NSISVGRENDERER
00096
00097 private:
00098 };
00099
00102
00103
00104
00105 nsSVGRendererLibart::nsSVGRendererLibart()
00106 {
00107 }
00108
00109 nsSVGRendererLibart::~nsSVGRendererLibart()
00110 {
00111 }
00112
00113 nsresult
00114 NS_NewSVGRendererLibart(nsISVGRenderer** aResult)
00115 {
00116 NS_PRECONDITION(aResult != nsnull, "null ptr");
00117 if (! aResult)
00118 return NS_ERROR_NULL_POINTER;
00119
00120 nsSVGRendererLibart* result = new nsSVGRendererLibart();
00121 if (! result)
00122 return NS_ERROR_OUT_OF_MEMORY;
00123
00124 NS_ADDREF(result);
00125 *aResult = result;
00126 return NS_OK;
00127 }
00128
00129
00130
00131
00132 NS_IMPL_ISUPPORTS1(nsSVGRendererLibart, nsISVGRenderer);
00133
00134
00135
00136
00138 NS_IMETHODIMP
00139 nsSVGRendererLibart::CreatePathGeometry(nsISVGPathGeometrySource *src,
00140 nsISVGRendererPathGeometry **_retval)
00141 {
00142 return NS_NewSVGLibartPathGeometry(_retval, src);
00143 }
00144
00146 NS_IMETHODIMP
00147 nsSVGRendererLibart::CreateGlyphMetrics(nsISVGGlyphMetricsSource *src,
00148 nsISVGRendererGlyphMetrics **_retval)
00149 {
00150 return NS_NewSVGLibartGlyphMetrics(_retval, src);
00151 }
00152
00154 NS_IMETHODIMP
00155 nsSVGRendererLibart::CreateGlyphGeometry(nsISVGGlyphGeometrySource *src,
00156 nsISVGRendererGlyphGeometry **_retval)
00157 {
00158 return NS_NewSVGLibartGlyphGeometry(_retval, src);
00159 }
00160
00163 NS_IMETHODIMP
00164 nsSVGRendererLibart::CreateCanvas(nsIRenderingContext *ctx,
00165 nsIPresContext *presContext,
00166 const nsRect & dirtyRect,
00167 nsISVGRendererCanvas **_retval)
00168 {
00169 return NS_NewSVGLibartCanvas(_retval, ctx, presContext, dirtyRect);
00170 }
00171
00173 NS_IMETHODIMP
00174 nsSVGRendererLibart::CreateRectRegion(float x, float y, float width, float height,
00175 nsISVGRendererRegion **_retval)
00176 {
00177 return NS_NewSVGLibartRectRegion(_retval, x, y, width, height);
00178 }
00179