LCOV - code coverage report
Current view: top level - gfx/2d - SourceSurfaceSkia.h (source / functions) Hit Total Coverage
Test: output.info Lines: 3 4 75.0 %
Date: 2017-07-14 16:53:18 Functions: 4 5 80.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
       2             :  * This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #ifndef MOZILLA_GFX_SOURCESURFACESKIA_H_
       7             : #define MOZILLA_GFX_SOURCESURFACESKIA_H_
       8             : 
       9             : #include "2D.h"
      10             : #include <vector>
      11             : #include "skia/include/core/SkCanvas.h"
      12             : #include "skia/include/core/SkImage.h"
      13             : 
      14             : namespace mozilla {
      15             : 
      16             : namespace gfx {
      17             : 
      18             : class DrawTargetSkia;
      19             : 
      20             : class SourceSurfaceSkia : public DataSourceSurface
      21             : {
      22             : public:
      23        1103 :   MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(DataSourceSurfaceSkia)
      24             :   SourceSurfaceSkia();
      25             :   ~SourceSurfaceSkia();
      26             : 
      27         164 :   virtual SurfaceType GetType() const { return SurfaceType::SKIA; }
      28             :   virtual IntSize GetSize() const;
      29             :   virtual SurfaceFormat GetFormat() const;
      30             : 
      31         163 :   sk_sp<SkImage>& GetImage() { return mImage; }
      32             : 
      33             :   bool InitFromData(unsigned char* aData,
      34             :                     const IntSize &aSize,
      35             :                     int32_t aStride,
      36             :                     SurfaceFormat aFormat);
      37             : 
      38             :   bool InitFromImage(const sk_sp<SkImage>& aImage,
      39             :                      SurfaceFormat aFormat = SurfaceFormat::UNKNOWN,
      40             :                      DrawTargetSkia* aOwner = nullptr);
      41             : 
      42             :   virtual uint8_t* GetData();
      43             : 
      44           0 :   virtual int32_t Stride() { return mStride; }
      45             : 
      46             : private:
      47             :   friend class DrawTargetSkia;
      48             : 
      49             :   void DrawTargetWillChange();
      50             : 
      51             :   sk_sp<SkImage> mImage;
      52             :   SurfaceFormat mFormat;
      53             :   IntSize mSize;
      54             :   int32_t mStride;
      55             :   RefPtr<DrawTargetSkia> mDrawTarget;
      56             : };
      57             : 
      58             : } // namespace gfx
      59             : } // namespace mozilla
      60             : 
      61             : #endif /* MOZILLA_GFX_SOURCESURFACESKIA_H_ */

Generated by: LCOV version 1.13