LCOV - code coverage report
Current view: top level - dom/canvas - CanvasGradient.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 19 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 13 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* This Source Code Form is subject to the terms of the Mozilla Public
       2             :  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
       3             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       4             : 
       5             : #ifndef mozilla_dom_CanvasGradient_h
       6             : #define mozilla_dom_CanvasGradient_h
       7             : 
       8             : #include "mozilla/Attributes.h"
       9             : #include "nsTArray.h"
      10             : #include "mozilla/RefPtr.h"
      11             : #include "mozilla/dom/CanvasRenderingContext2DBinding.h"
      12             : #include "mozilla/dom/CanvasRenderingContext2D.h"
      13             : #include "mozilla/gfx/2D.h"
      14             : #include "nsWrapperCache.h"
      15             : #include "gfxGradientCache.h"
      16             : 
      17             : namespace mozilla {
      18             : namespace dom {
      19             : 
      20             : class CanvasGradient : public nsWrapperCache
      21             : {
      22             : public:
      23           0 :   NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CanvasGradient)
      24           0 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CanvasGradient)
      25             : 
      26             :   enum class Type : uint8_t {
      27             :     LINEAR = 0,
      28             :     RADIAL
      29             :   };
      30             : 
      31           0 :   Type GetType()
      32             :   {
      33           0 :     return mType;
      34             :   }
      35             : 
      36             :   mozilla::gfx::GradientStops *
      37           0 :   GetGradientStopsForTarget(mozilla::gfx::DrawTarget *aRT)
      38             :   {
      39           0 :     if (mStops && mStops->GetBackendType() == aRT->GetBackendType()) {
      40           0 :       return mStops;
      41             :     }
      42             : 
      43             :     mStops =
      44           0 :       gfx::gfxGradientCache::GetOrCreateGradientStops(aRT,
      45             :                                                       mRawStops,
      46           0 :                                                       gfx::ExtendMode::CLAMP);
      47             : 
      48           0 :     return mStops;
      49             :   }
      50             : 
      51             :   // WebIDL
      52             :   void AddColorStop(float offset, const nsAString& colorstr, ErrorResult& rv);
      53             : 
      54           0 :   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
      55             :   {
      56           0 :     return CanvasGradientBinding::Wrap(aCx, this, aGivenProto);
      57             :   }
      58             : 
      59           0 :   CanvasRenderingContext2D* GetParentObject()
      60             :   {
      61           0 :     return mContext;
      62             :   }
      63             : 
      64             : protected:
      65             :   friend struct CanvasBidiProcessor;
      66             : 
      67           0 :   CanvasGradient(CanvasRenderingContext2D* aContext, Type aType)
      68           0 :     : mContext(aContext)
      69           0 :     , mType(aType)
      70             :   {
      71           0 :   }
      72             : 
      73             :   RefPtr<CanvasRenderingContext2D> mContext;
      74             :   nsTArray<mozilla::gfx::GradientStop> mRawStops;
      75             :   RefPtr<mozilla::gfx::GradientStops> mStops;
      76             :   Type mType;
      77           0 :   virtual ~CanvasGradient() {}
      78             : };
      79             : 
      80             : } // namespace dom
      81             : } // namespace mozilla
      82             : 
      83             : #endif // mozilla_dom_CanvasGradient_h

Generated by: LCOV version 1.13