LCOV - code coverage report
Current view: top level - gfx/2d - ScaledFontBase.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 6 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 0.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_SCALEDFONTBASE_H_
       7             : #define MOZILLA_GFX_SCALEDFONTBASE_H_
       8             : 
       9             : #include "2D.h"
      10             : 
      11             : // Skia uses cairo_scaled_font_t as the internal font type in ScaledFont
      12             : #if defined(USE_SKIA) || defined(USE_CAIRO)
      13             : #define USE_CAIRO_SCALED_FONT
      14             : #endif
      15             : 
      16             : #ifdef USE_SKIA
      17             : #include "skia/include/core/SkPath.h"
      18             : #include "skia/include/core/SkTypeface.h"
      19             : #endif
      20             : #ifdef USE_CAIRO_SCALED_FONT
      21             : #include "cairo.h"
      22             : #endif
      23             : 
      24             : namespace mozilla {
      25             : namespace gfx {
      26             : 
      27             : class ScaledFontBase : public ScaledFont
      28             : {
      29             : public:
      30           0 :   MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ScaledFontBase)
      31             :   ScaledFontBase(const RefPtr<UnscaledFont>& aUnscaledFont, Float aSize);
      32             :   virtual ~ScaledFontBase();
      33             : 
      34             :   virtual already_AddRefed<Path> GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget);
      35             : 
      36             :   virtual void CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder, const Matrix *aTransformHint);
      37             : 
      38             :   virtual void GetGlyphDesignMetrics(const uint16_t* aGlyphIndices, uint32_t aNumGlyphs, GlyphMetrics* aGlyphMetrics);
      39             : 
      40           0 :   virtual Float GetSize() const { return mSize; }
      41             : 
      42             : #ifdef USE_SKIA
      43           0 :   virtual SkTypeface* GetSkTypeface() { return mTypeface; }
      44             : #endif
      45             : 
      46             :   // Not true, but required to instantiate a ScaledFontBase.
      47           0 :   virtual FontType GetType() const { return FontType::SKIA; }
      48             : 
      49             : #ifdef USE_CAIRO_SCALED_FONT
      50             :   bool PopulateCairoScaledFont();
      51           0 :   cairo_scaled_font_t* GetCairoScaledFont() { return mScaledFont; }
      52             :   void SetCairoScaledFont(cairo_scaled_font_t* font);
      53             : #endif
      54             : 
      55             : protected:
      56             :   friend class DrawTargetSkia;
      57             : #ifdef USE_SKIA
      58             :   SkTypeface* mTypeface;
      59             :   SkPath GetSkiaPathForGlyphs(const GlyphBuffer &aBuffer);
      60             : #endif
      61             : #ifdef USE_CAIRO_SCALED_FONT
      62             :   // Overridders should ensure the cairo_font_face_t has been addrefed.
      63           0 :   virtual cairo_font_face_t* GetCairoFontFace() { return nullptr; }
      64             :   cairo_scaled_font_t* mScaledFont;
      65             : #endif
      66             :   Float mSize;
      67             : };
      68             : 
      69             : } // namespace gfx
      70             : } // namespace mozilla
      71             : 
      72             : #endif /* MOZILLA_GFX_SCALEDFONTBASE_H_ */

Generated by: LCOV version 1.13