/layout/svg/renderer/src/libart/nsSVGRendererLibart.cpp

Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ----- BEGIN LICENSE BLOCK -----
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License
00006  * Version 1.1 (the "License"); you may not use this file except in
00007  * compliance with the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is the Mozilla SVG project.
00016  *
00017  * The Initial Developer of the Original Code is Alex Fritze.
00018  *
00019  * Portions created by the Initial Developer are Copyright (C) 2002
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *    Alex Fritze <alex@croczilla.com> (original author)
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or 
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the NPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ----- END LICENSE BLOCK ----- */
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 // module initialisation
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   // nsISupports interface
00092   NS_DECL_ISUPPORTS
00093 
00094   // nsISVGRenderer interface
00095   NS_DECL_NSISVGRENDERER
00096 
00097 private:
00098 };
00099 
00102 //----------------------------------------------------------------------
00103 // construction/destruction
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 // nsISupports methods
00131 
00132 NS_IMPL_ISUPPORTS1(nsSVGRendererLibart, nsISVGRenderer);
00133 
00134 //----------------------------------------------------------------------
00135 // nsISVGRenderer methods
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 

Generated on Wed Sep 10 22:25:24 2003 for Mozilla SVG Project Rendering Backend by doxygen1.3