LCOV - code coverage report
Current view: directory - content/svg/content/src - SVGMotionSMILType.h (source / functions) Found Hit Coverage
Test: app.info Lines: 2 2 100.0 %
Date: 2012-06-02 Functions: 2 2 100.0 %

       1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is the Mozilla SVG project.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is the Mozilla Corporation.
      18                 :  * Portions created by the Initial Developer are Copyright (C) 2010
      19                 :  * the Initial Developer. All Rights Reserved.
      20                 :  *
      21                 :  * Contributor(s):
      22                 :  *   Daniel Holbert <dholbert@mozilla.com>
      23                 :  *
      24                 :  * Alternatively, the contents of this file may be used under the terms of
      25                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      26                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      27                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      28                 :  * of those above. If you wish to allow use of your version of this file only
      29                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      30                 :  * use your version of this file under the terms of the MPL, indicate your
      31                 :  * decision by deleting the provisions above and replace them with the notice
      32                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      33                 :  * the provisions above, a recipient may use your version of this file under
      34                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      35                 :  *
      36                 :  * ***** END LICENSE BLOCK ***** */
      37                 : 
      38                 : /* implementation of nsISMILType for use by <animateMotion> element */
      39                 : 
      40                 : #ifndef MOZILLA_SVGMOTIONSMILTYPE_H_
      41                 : #define MOZILLA_SVGMOTIONSMILTYPE_H_
      42                 : 
      43                 : #include "gfxMatrix.h"
      44                 : #include "nsISMILType.h"
      45                 : 
      46                 : class gfxFlattenedPath;
      47                 : class nsSMILValue;
      48                 : 
      49                 : namespace mozilla {
      50                 : 
      51                 : /**
      52                 :  * MotionRotateType: Enum to indicate the type of our "rotate" attribute.
      53                 :  */
      54                 : enum RotateType {
      55                 :   eRotateType_Explicit,     // for e.g. rotate="45"/"45deg"/"0.785rad"
      56                 :   eRotateType_Auto,         // for rotate="auto"
      57                 :   eRotateType_AutoReverse   // for rotate="auto-reverse"
      58                 : };
      59                 : 
      60                 : /**
      61                 :  * SVGMotionSMILType: Implements the nsISMILType interface for SMIL animations
      62                 :  * from <animateMotion>.
      63                 :  *
      64                 :  * NOTE: Even though there's technically no "motion" attribute, we behave in
      65                 :  * many ways as if there were, for simplicity.
      66                 :  */
      67                 : class SVGMotionSMILType : public nsISMILType
      68                 : {
      69                 : public:
      70                 :   // Singleton for nsSMILValue objects to hold onto.
      71                 :   static SVGMotionSMILType sSingleton;
      72                 : 
      73                 : protected:
      74                 :   // nsISMILType Methods
      75                 :   // -------------------
      76                 :   virtual void     Init(nsSMILValue& aValue) const;
      77                 :   virtual void     Destroy(nsSMILValue& aValue) const;
      78                 :   virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const;
      79                 :   virtual bool     IsEqual(const nsSMILValue& aLeft,
      80                 :                            const nsSMILValue& aRight) const;
      81                 :   virtual nsresult Add(nsSMILValue& aDest,
      82                 :                        const nsSMILValue& aValueToAdd,
      83                 :                        PRUint32 aCount) const;
      84                 :   virtual nsresult SandwichAdd(nsSMILValue& aDest,
      85                 :                                const nsSMILValue& aValueToAdd) const;
      86                 :   virtual nsresult ComputeDistance(const nsSMILValue& aFrom,
      87                 :                                    const nsSMILValue& aTo,
      88                 :                                    double& aDistance) const;
      89                 :   virtual nsresult Interpolate(const nsSMILValue& aStartVal,
      90                 :                                const nsSMILValue& aEndVal,
      91                 :                                double aUnitDistance,
      92                 :                                nsSMILValue& aResult) const;
      93                 : public:
      94                 :   // Used to generate a transform matrix from an <animateMotion> nsSMILValue.
      95                 :   static gfxMatrix CreateMatrix(const nsSMILValue& aSMILVal);
      96                 : 
      97                 :   // Used to generate a nsSMILValue for the point at the given distance along
      98                 :   // the given path.
      99                 :   static nsSMILValue ConstructSMILValue(gfxFlattenedPath* aPath,
     100                 :                                         float aDist,
     101                 :                                         RotateType aRotateType,
     102                 :                                         float aRotateAngle);
     103                 : 
     104                 : private:
     105                 :   // Private constructor & destructor: prevent instances beyond my singleton,
     106                 :   // and prevent others from deleting my singleton.
     107            1464 :   SVGMotionSMILType()  {}
     108            1487 :   ~SVGMotionSMILType() {}
     109                 : };
     110                 : 
     111                 : } // namespace mozilla
     112                 : 
     113                 : #endif // MOZILLA_SVGMOTIONSMILTYPE_H_

Generated by: LCOV version 1.7