OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrFontScaler_DEFINED | 8 #ifndef GrFontScaler_DEFINED |
9 #define GrFontScaler_DEFINED | 9 #define GrFontScaler_DEFINED |
10 | 10 |
11 #include "GrGlyph.h" | 11 #include "GrGlyph.h" |
12 #include "GrTypes.h" | 12 #include "GrTypes.h" |
13 | 13 |
14 #include "SkDescriptor.h" | 14 #include "SkDescriptor.h" |
15 | 15 |
16 class SkPath; | 16 class SkPath; |
17 | 17 |
18 /* | 18 /* |
19 * Wrapper class to turn a font cache descriptor into a key | 19 * Wrapper class to turn a font cache descriptor into a key |
20 * for GrFontScaler-related lookups | 20 * for GrFontScaler-related lookups |
21 */ | 21 */ |
22 class GrFontDescKey : public SkRefCnt { | 22 class GrFontDescKey : public SkRefCnt { |
23 public: | 23 public: |
24 SK_DECLARE_INST_COUNT(GrFontDescKey) | 24 |
25 | 25 |
26 typedef uint32_t Hash; | 26 typedef uint32_t Hash; |
27 | 27 |
28 explicit GrFontDescKey(const SkDescriptor& desc); | 28 explicit GrFontDescKey(const SkDescriptor& desc); |
29 virtual ~GrFontDescKey(); | 29 virtual ~GrFontDescKey(); |
30 | 30 |
31 Hash getHash() const { return fHash; } | 31 Hash getHash() const { return fHash; } |
32 | 32 |
33 bool operator<(const GrFontDescKey& rh) const { | 33 bool operator<(const GrFontDescKey& rh) const { |
34 return fHash < rh.fHash || (fHash == rh.fHash && this->lt(rh)); | 34 return fHash < rh.fHash || (fHash == rh.fHash && this->lt(rh)); |
(...skipping 18 matching lines...) Expand all Loading... |
53 }; | 53 }; |
54 | 54 |
55 /* | 55 /* |
56 * This is Gr's interface to the host platform's font scaler. | 56 * This is Gr's interface to the host platform's font scaler. |
57 * | 57 * |
58 * The client is responsible for instantiating this. The instance is created | 58 * The client is responsible for instantiating this. The instance is created |
59 * for a specific font+size+matrix. | 59 * for a specific font+size+matrix. |
60 */ | 60 */ |
61 class GrFontScaler : public SkRefCnt { | 61 class GrFontScaler : public SkRefCnt { |
62 public: | 62 public: |
63 SK_DECLARE_INST_COUNT(GrFontScaler) | 63 |
64 | 64 |
65 explicit GrFontScaler(SkGlyphCache* strike); | 65 explicit GrFontScaler(SkGlyphCache* strike); |
66 virtual ~GrFontScaler(); | 66 virtual ~GrFontScaler(); |
67 | 67 |
68 const GrFontDescKey* getKey(); | 68 const GrFontDescKey* getKey(); |
69 GrMaskFormat getMaskFormat() const; | 69 GrMaskFormat getMaskFormat() const; |
70 GrMaskFormat getPackedGlyphMaskFormat(GrGlyph::PackedID) const; | 70 GrMaskFormat getPackedGlyphMaskFormat(GrGlyph::PackedID) const; |
71 bool getPackedGlyphBounds(GrGlyph::PackedID, SkIRect* bounds); | 71 bool getPackedGlyphBounds(GrGlyph::PackedID, SkIRect* bounds); |
72 bool getPackedGlyphImage(GrGlyph::PackedID, int width, int height, | 72 bool getPackedGlyphImage(GrGlyph::PackedID, int width, int height, |
73 int rowBytes, void* image); | 73 int rowBytes, void* image); |
74 bool getPackedGlyphDFBounds(GrGlyph::PackedID, SkIRect* bounds); | 74 bool getPackedGlyphDFBounds(GrGlyph::PackedID, SkIRect* bounds); |
75 bool getPackedGlyphDFImage(GrGlyph::PackedID, int width, int height, | 75 bool getPackedGlyphDFImage(GrGlyph::PackedID, int width, int height, |
76 void* image); | 76 void* image); |
77 bool getGlyphPath(uint16_t glyphID, SkPath*); | 77 bool getGlyphPath(uint16_t glyphID, SkPath*); |
78 | 78 |
79 private: | 79 private: |
80 SkGlyphCache* fStrike; | 80 SkGlyphCache* fStrike; |
81 GrFontDescKey* fKey; | 81 GrFontDescKey* fKey; |
82 | 82 |
83 typedef SkRefCnt INHERITED; | 83 typedef SkRefCnt INHERITED; |
84 }; | 84 }; |
85 | 85 |
86 #endif | 86 #endif |
OLD | NEW |