LCOV - code coverage report
Current view: top level - dom/canvas - ImageData.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             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim:set ts=2 sw=2 et tw=78: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
       5             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef mozilla_dom_ImageData_h
       8             : #define mozilla_dom_ImageData_h
       9             : 
      10             : #include "nsIDOMCanvasRenderingContext2D.h"
      11             : 
      12             : #include "mozilla/Attributes.h"
      13             : #include "mozilla/dom/BindingUtils.h"
      14             : #include "mozilla/dom/TypedArray.h"
      15             : #include <stdint.h>
      16             : 
      17             : #include "nsCycleCollectionParticipant.h"
      18             : #include "nsISupportsImpl.h"
      19             : #include "js/GCAPI.h"
      20             : 
      21             : namespace mozilla {
      22             : namespace dom {
      23             : 
      24             : class ImageData final : public nsISupports
      25             : {
      26           0 :   ~ImageData()
      27           0 :   {
      28           0 :     DropData();
      29           0 :   }
      30             : 
      31             : public:
      32           0 :   ImageData(uint32_t aWidth, uint32_t aHeight, JSObject& aData)
      33           0 :     : mWidth(aWidth)
      34             :     , mHeight(aHeight)
      35           0 :     , mData(&aData)
      36             :   {
      37           0 :     HoldData();
      38           0 :   }
      39             : 
      40             :   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
      41           0 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ImageData)
      42             : 
      43             :   static already_AddRefed<ImageData>
      44             :     Constructor(const GlobalObject& aGlobal,
      45             :                 const uint32_t aWidth,
      46             :                 const uint32_t aHeight,
      47             :                 ErrorResult& aRv);
      48             : 
      49             :   static already_AddRefed<ImageData>
      50             :     Constructor(const GlobalObject& aGlobal,
      51             :                 const Uint8ClampedArray& aData,
      52             :                 const uint32_t aWidth,
      53             :                 const Optional<uint32_t>& aHeight,
      54             :                 ErrorResult& aRv);
      55             : 
      56           0 :   uint32_t Width() const
      57             :   {
      58           0 :     return mWidth;
      59             :   }
      60           0 :   uint32_t Height() const
      61             :   {
      62           0 :     return mHeight;
      63             :   }
      64           0 :   void GetData(JSContext* cx, JS::MutableHandle<JSObject*> aData) const
      65             :   {
      66           0 :     aData.set(GetDataObject());
      67           0 :   }
      68           0 :   JSObject* GetDataObject() const
      69             :   {
      70           0 :     return mData;
      71             :   }
      72             : 
      73             :   bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
      74             : 
      75             : private:
      76             :   void HoldData();
      77             :   void DropData();
      78             : 
      79             :   ImageData() = delete;
      80             : 
      81             :   uint32_t mWidth, mHeight;
      82             :   JS::Heap<JSObject*> mData;
      83             : };
      84             : 
      85             : } // namespace dom
      86             : } // namespace mozilla
      87             : 
      88             : #endif // mozilla_dom_ImageData_h

Generated by: LCOV version 1.13