LCOV - code coverage report
Current view: top level - dom/canvas - ImageBitmapRenderingContext.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 1 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 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 ImageBitmapRenderingContext_h
       6             : #define ImageBitmapRenderingContext_h
       7             : 
       8             : #include "nsICanvasRenderingContextInternal.h"
       9             : #include "nsWrapperCache.h"
      10             : 
      11             : namespace mozilla {
      12             : 
      13             : namespace gfx {
      14             : class DataSourceSurface;
      15             : class DrawTarget;
      16             : class SourceSurface;
      17             : }
      18             : 
      19             : namespace layers {
      20             : class Image;
      21             : class ImageContainer;
      22             : }
      23             : 
      24             : namespace dom {
      25             : 
      26             : /**
      27             :  * The purpose of ImageBitmapRenderingContext is to provide a faster and efficient
      28             :  * way to display ImageBitmap. Simply call TransferFromImageBitmap() then we'll transfer
      29             :  * the surface of ImageBitmap to this context and then to use it to display.
      30             :  *
      31             :  * See more details in spec: https://wiki.whatwg.org/wiki/OffscreenCanvas
      32             :  */
      33             : class ImageBitmapRenderingContext final :
      34             :   public nsICanvasRenderingContextInternal,
      35             :   public nsWrapperCache
      36             : {
      37             :   virtual ~ImageBitmapRenderingContext();
      38             : 
      39             : public:
      40             :   ImageBitmapRenderingContext();
      41             : 
      42             :   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
      43             : 
      44             :   // nsISupports interface + CC
      45             :   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
      46             : 
      47           0 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ImageBitmapRenderingContext)
      48             : 
      49             :   void TransferImageBitmap(ImageBitmap& aImageBitmap);
      50             :   void TransferFromImageBitmap(ImageBitmap& aImageBitmap);
      51             : 
      52             :   // nsICanvasRenderingContextInternal
      53             :   virtual int32_t GetWidth() const override;
      54             :   virtual int32_t GetHeight() const override;
      55             : 
      56             :   NS_IMETHOD SetDimensions(int32_t aWidth, int32_t aHeight) override;
      57             : 
      58             :   NS_IMETHOD InitializeWithDrawTarget(nsIDocShell* aDocShell,
      59             :                                       NotNull<gfx::DrawTarget*> aTarget) override;
      60             : 
      61             :   virtual mozilla::UniquePtr<uint8_t[]> GetImageBuffer(int32_t* aFormat) override;
      62             :   NS_IMETHOD GetInputStream(const char* aMimeType,
      63             :                             const char16_t* aEncoderOptions,
      64             :                             nsIInputStream** aStream) override;
      65             : 
      66             :   virtual already_AddRefed<mozilla::gfx::SourceSurface>
      67             :   GetSurfaceSnapshot(gfxAlphaType* aOutAlphaType) override;
      68             : 
      69             :   virtual void SetIsOpaque(bool aIsOpaque) override;
      70             :   virtual bool GetIsOpaque() override;
      71             :   NS_IMETHOD Reset() override;
      72             :   virtual already_AddRefed<Layer> GetCanvasLayer(nsDisplayListBuilder* aBuilder,
      73             :                                                  Layer* aOldLayer,
      74             :                                                  LayerManager* aManager,
      75             :                                                  bool aMirror = false) override;
      76             :   virtual void MarkContextClean() override;
      77             : 
      78             :   NS_IMETHOD Redraw(const gfxRect& aDirty) override;
      79             :   NS_IMETHOD SetIsIPC(bool aIsIPC) override;
      80             : 
      81             :   virtual void DidRefresh() override;
      82             : 
      83             :   virtual void MarkContextCleanForFrameCapture() override;
      84             :   virtual bool IsContextCleanForFrameCapture() override;
      85             : 
      86             : protected:
      87             :   already_AddRefed<gfx::DataSourceSurface> MatchWithIntrinsicSize();
      88             :   already_AddRefed<layers::Image> ClipToIntrinsicSize();
      89             :   int32_t mWidth;
      90             :   int32_t mHeight;
      91             : 
      92             :   RefPtr<layers::Image> mImage;
      93             : };
      94             : 
      95             : }
      96             : }
      97             : 
      98             : #endif /* ImageBitmapRenderingContext_h */

Generated by: LCOV version 1.13