OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CCFontAtlas_h | 5 #ifndef CCFontAtlas_h |
6 #define CCFontAtlas_h | 6 #define CCFontAtlas_h |
7 | 7 |
8 #if USE(ACCELERATED_COMPOSITING) | 8 #if USE(ACCELERATED_COMPOSITING) |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 14 matching lines...) Expand all Loading... |
25 class Color; | 25 class Color; |
26 class FontDescription; | 26 class FontDescription; |
27 class GraphicsContext; | 27 class GraphicsContext; |
28 class IntSize; | 28 class IntSize; |
29 | 29 |
30 // This class provides basic ability to draw text onto the heads-up display. | 30 // This class provides basic ability to draw text onto the heads-up display. |
31 class CCFontAtlas { | 31 class CCFontAtlas { |
32 public: | 32 public: |
33 static scoped_ptr<CCFontAtlas> create(SkBitmap bitmap, IntRect asciiToRectTa
ble[128], int fontHeight) | 33 static scoped_ptr<CCFontAtlas> create(SkBitmap bitmap, IntRect asciiToRectTa
ble[128], int fontHeight) |
34 { | 34 { |
35 return scoped_ptr<CCFontAtlas>(new CCFontAtlas(bitmap, asciiToRectTable,
fontHeight)); | 35 return make_scoped_ptr(new CCFontAtlas(bitmap, asciiToRectTable, fontHei
ght)); |
36 } | 36 } |
37 ~CCFontAtlas(); | 37 ~CCFontAtlas(); |
38 | 38 |
39 // Draws multiple lines of text where each line of text is separated by '\n'
. | 39 // Draws multiple lines of text where each line of text is separated by '\n'
. |
40 // - Correct glyphs will be drawn for ASCII codes in the range 32-127; any c
haracters | 40 // - Correct glyphs will be drawn for ASCII codes in the range 32-127; any c
haracters |
41 // outside that range will be displayed as a default rectangle glyph. | 41 // outside that range will be displayed as a default rectangle glyph. |
42 // - IntSize clip is used to avoid wasting time drawing things that are outs
ide the | 42 // - IntSize clip is used to avoid wasting time drawing things that are outs
ide the |
43 // target canvas bounds. | 43 // target canvas bounds. |
44 // - Should only be called only on the impl thread. | 44 // - Should only be called only on the impl thread. |
45 void drawText(SkCanvas*, const SkPaint&, const std::string& text, const gfx:
:Point& destPosition, const IntSize& clip) const; | 45 void drawText(SkCanvas*, const SkPaint&, const std::string& text, const gfx:
:Point& destPosition, const IntSize& clip) const; |
(...skipping 10 matching lines...) Expand all Loading... |
56 SkBitmap m_atlas; | 56 SkBitmap m_atlas; |
57 | 57 |
58 // The look-up tables mapping ascii characters to their IntRect locations on
the atlas. | 58 // The look-up tables mapping ascii characters to their IntRect locations on
the atlas. |
59 IntRect m_asciiToRectTable[128]; | 59 IntRect m_asciiToRectTable[128]; |
60 | 60 |
61 int m_fontHeight; | 61 int m_fontHeight; |
62 | 62 |
63 DISALLOW_COPY_AND_ASSIGN(CCFontAtlas); | 63 DISALLOW_COPY_AND_ASSIGN(CCFontAtlas); |
64 }; | 64 }; |
65 | 65 |
66 } // namespace cc | 66 } // namespace cc |
67 | 67 |
68 #endif // USE(ACCELERATED_COMPOSITING) | 68 #endif // USE(ACCELERATED_COMPOSITING) |
69 | 69 |
70 #endif | 70 #endif |
OLD | NEW |