OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2009, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2009, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007-2008 Torch Mobile Inc. | 3 * Copyright (C) 2007-2008 Torch Mobile Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 17 matching lines...) Expand all Loading... |
28 */ | 28 */ |
29 | 29 |
30 #ifndef GlyphBuffer_h | 30 #ifndef GlyphBuffer_h |
31 #define GlyphBuffer_h | 31 #define GlyphBuffer_h |
32 | 32 |
33 #include "core/platform/graphics/FloatSize.h" | 33 #include "core/platform/graphics/FloatSize.h" |
34 #include "core/platform/graphics/Glyph.h" | 34 #include "core/platform/graphics/Glyph.h" |
35 #include "wtf/UnusedParam.h" | 35 #include "wtf/UnusedParam.h" |
36 #include "wtf/Vector.h" | 36 #include "wtf/Vector.h" |
37 | 37 |
38 #if OS(DARWIN) | 38 #if OS(MACOSX) |
39 #include <ApplicationServices/ApplicationServices.h> | 39 #include <ApplicationServices/ApplicationServices.h> |
40 #endif | 40 #endif |
41 | 41 |
42 namespace WebCore { | 42 namespace WebCore { |
43 | 43 |
44 class SimpleFontData; | 44 class SimpleFontData; |
45 | 45 |
46 typedef Glyph GlyphBufferGlyph; | 46 typedef Glyph GlyphBufferGlyph; |
47 | 47 |
48 // CG uses CGSize instead of FloatSize so that the result of advances() | 48 // CG uses CGSize instead of FloatSize so that the result of advances() |
49 // can be passed directly to CGContextShowGlyphsWithAdvances in FontMac.mm | 49 // can be passed directly to CGContextShowGlyphsWithAdvances in FontMac.mm |
50 #if OS(DARWIN) | 50 #if OS(MACOSX) |
51 struct GlyphBufferAdvance : CGSize { | 51 struct GlyphBufferAdvance : CGSize { |
52 public: | 52 public: |
53 GlyphBufferAdvance(CGSize size) : CGSize(size) | 53 GlyphBufferAdvance(CGSize size) : CGSize(size) |
54 { | 54 { |
55 } | 55 } |
56 | 56 |
57 void setWidth(CGFloat width) { this->CGSize::width = width; } | 57 void setWidth(CGFloat width) { this->CGSize::width = width; } |
58 CGFloat width() const { return this->CGSize::width; } | 58 CGFloat width() const { return this->CGSize::width; } |
59 CGFloat height() const { return this->CGSize::height; } | 59 CGFloat height() const { return this->CGSize::height; } |
60 }; | 60 }; |
(...skipping 28 matching lines...) Expand all Loading... |
89 float advanceAt(int index) const | 89 float advanceAt(int index) const |
90 { | 90 { |
91 return m_advances[index].width(); | 91 return m_advances[index].width(); |
92 } | 92 } |
93 | 93 |
94 void add(Glyph glyph, const SimpleFontData* font, float width) | 94 void add(Glyph glyph, const SimpleFontData* font, float width) |
95 { | 95 { |
96 m_fontData.append(font); | 96 m_fontData.append(font); |
97 m_glyphs.append(glyph); | 97 m_glyphs.append(glyph); |
98 | 98 |
99 #if OS(DARWIN) | 99 #if OS(MACOSX) |
100 CGSize advance = { width, 0 }; | 100 CGSize advance = { width, 0 }; |
101 m_advances.append(advance); | 101 m_advances.append(advance); |
102 #else | 102 #else |
103 m_advances.append(FloatSize(width, 0)); | 103 m_advances.append(FloatSize(width, 0)); |
104 #endif | 104 #endif |
105 } | 105 } |
106 | 106 |
107 void add(Glyph glyph, const SimpleFontData* font, GlyphBufferAdvance advance
) | 107 void add(Glyph glyph, const SimpleFontData* font, GlyphBufferAdvance advance
) |
108 { | 108 { |
109 m_fontData.append(font); | 109 m_fontData.append(font); |
(...skipping 30 matching lines...) Expand all Loading... |
140 m_advances[index2] = s; | 140 m_advances[index2] = s; |
141 } | 141 } |
142 | 142 |
143 Vector<const SimpleFontData*, 2048> m_fontData; | 143 Vector<const SimpleFontData*, 2048> m_fontData; |
144 Vector<GlyphBufferGlyph, 2048> m_glyphs; | 144 Vector<GlyphBufferGlyph, 2048> m_glyphs; |
145 Vector<GlyphBufferAdvance, 2048> m_advances; | 145 Vector<GlyphBufferAdvance, 2048> m_advances; |
146 }; | 146 }; |
147 | 147 |
148 } | 148 } |
149 #endif | 149 #endif |
OLD | NEW |