LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/core - SkFontDescriptor.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 19 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 15 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright 2012 Google Inc.
       3             :  *
       4             :  * Use of this source code is governed by a BSD-style license that can be
       5             :  * found in the LICENSE file.
       6             :  */
       7             : 
       8             : #ifndef SkFontDescriptor_DEFINED
       9             : #define SkFontDescriptor_DEFINED
      10             : 
      11             : #include "SkFixed.h"
      12             : #include "SkStream.h"
      13             : #include "SkString.h"
      14             : #include "SkTypeface.h"
      15             : 
      16           0 : class SkFontData {
      17             : public:
      18             :     /** Makes a copy of the data in 'axis'. */
      19           0 :     SkFontData(std::unique_ptr<SkStreamAsset> stream, int index, const SkFixed axis[],int axisCount)
      20           0 :         : fStream(std::move(stream)), fIndex(index), fAxisCount(axisCount), fAxis(axisCount)
      21             :     {
      22           0 :         for (int i = 0; i < axisCount; ++i) {
      23           0 :             fAxis[i] = axis[i];
      24             :         }
      25           0 :     }
      26             :     SkFontData(const SkFontData& that)
      27             :         : fStream(that.fStream->duplicate())
      28             :         , fIndex(that.fIndex)
      29             :         , fAxisCount(that.fAxisCount)
      30             :         , fAxis(fAxisCount)
      31             :     {
      32             :         for (int i = 0; i < fAxisCount; ++i) {
      33             :             fAxis[i] = that.fAxis[i];
      34             :         }
      35             :     }
      36           0 :     bool hasStream() const { return fStream.get() != nullptr; }
      37           0 :     std::unique_ptr<SkStreamAsset> detachStream() { return std::move(fStream); }
      38             :     SkStreamAsset* getStream() { return fStream.get(); }
      39             :     SkStreamAsset const* getStream() const { return fStream.get(); }
      40           0 :     int getIndex() const { return fIndex; }
      41           0 :     int getAxisCount() const { return fAxisCount; }
      42           0 :     const SkFixed* getAxis() const { return fAxis.get(); }
      43             : 
      44             : private:
      45             :     std::unique_ptr<SkStreamAsset> fStream;
      46             :     int fIndex;
      47             :     int fAxisCount;
      48             :     SkAutoSTMalloc<4, SkFixed> fAxis;
      49             : };
      50             : 
      51           0 : class SkFontDescriptor : SkNoncopyable {
      52             : public:
      53             :     SkFontDescriptor();
      54             :     // Does not affect ownership of SkStream.
      55             :     static bool Deserialize(SkStream*, SkFontDescriptor* result);
      56             : 
      57             :     void serialize(SkWStream*);
      58             : 
      59           0 :     SkFontStyle getStyle() { return fStyle; }
      60             :     void setStyle(SkFontStyle style) { fStyle = style; }
      61             : 
      62           0 :     const char* getFamilyName() const { return fFamilyName.c_str(); }
      63           0 :     const char* getFullName() const { return fFullName.c_str(); }
      64           0 :     const char* getPostscriptName() const { return fPostscriptName.c_str(); }
      65           0 :     bool hasFontData() const { return fFontData.get() != nullptr; }
      66           0 :     std::unique_ptr<SkFontData> detachFontData() { return std::move(fFontData); }
      67             : 
      68             :     void setFamilyName(const char* name) { fFamilyName.set(name); }
      69             :     void setFullName(const char* name) { fFullName.set(name); }
      70             :     void setPostscriptName(const char* name) { fPostscriptName.set(name); }
      71             :     /** Set the font data only if it is necessary for serialization. */
      72           0 :     void setFontData(std::unique_ptr<SkFontData> data) { fFontData = std::move(data); }
      73             : 
      74             : private:
      75             :     SkString fFamilyName;
      76             :     SkString fFullName;
      77             :     SkString fPostscriptName;
      78             :     std::unique_ptr<SkFontData> fFontData;
      79             : 
      80             :     SkFontStyle fStyle;
      81             : };
      82             : 
      83             : #endif // SkFontDescriptor_DEFINED

Generated by: LCOV version 1.13