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 "base/basictypes.h" |
10 #include "IntRect.h" | 11 #include "IntRect.h" |
11 #include "SkBitmap.h" | 12 #include "SkBitmap.h" |
12 #include <string> | 13 #include <string> |
13 #include <wtf/OwnPtr.h> | 14 #include <wtf/OwnPtr.h> |
14 #include <wtf/PassOwnPtr.h> | 15 #include <wtf/PassOwnPtr.h> |
15 | 16 |
16 class SkCanvas; | 17 class SkCanvas; |
17 | 18 |
18 namespace cc { | 19 namespace cc { |
19 | 20 |
20 class Color; | 21 class Color; |
21 class FontDescription; | 22 class FontDescription; |
22 class GraphicsContext; | 23 class GraphicsContext; |
23 class IntPoint; | 24 class IntPoint; |
24 class IntSize; | 25 class IntSize; |
25 | 26 |
26 // This class provides basic ability to draw text onto the heads-up display. | 27 // This class provides basic ability to draw text onto the heads-up display. |
27 class CCFontAtlas { | 28 class CCFontAtlas { |
28 WTF_MAKE_NONCOPYABLE(CCFontAtlas); | |
29 public: | 29 public: |
30 static PassOwnPtr<CCFontAtlas> create(SkBitmap bitmap, IntRect asciiToRectTa
ble[128], int fontHeight) | 30 static PassOwnPtr<CCFontAtlas> create(SkBitmap bitmap, IntRect asciiToRectTa
ble[128], int fontHeight) |
31 { | 31 { |
32 return adoptPtr(new CCFontAtlas(bitmap, asciiToRectTable, fontHeight)); | 32 return adoptPtr(new CCFontAtlas(bitmap, asciiToRectTable, fontHeight)); |
33 } | 33 } |
34 ~CCFontAtlas(); | 34 ~CCFontAtlas(); |
35 | 35 |
36 // Draws multiple lines of text where each line of text is separated by '\n'
. | 36 // Draws multiple lines of text where each line of text is separated by '\n'
. |
37 // - Correct glyphs will be drawn for ASCII codes in the range 32-127; any c
haracters | 37 // - Correct glyphs will be drawn for ASCII codes in the range 32-127; any c
haracters |
38 // outside that range will be displayed as a default rectangle glyph. | 38 // outside that range will be displayed as a default rectangle glyph. |
(...skipping 10 matching lines...) Expand all Loading... |
49 | 49 |
50 void drawOneLineOfTextInternal(SkCanvas*, const SkPaint&, const std::string&
, const IntPoint& destPosition) const; | 50 void drawOneLineOfTextInternal(SkCanvas*, const SkPaint&, const std::string&
, const IntPoint& destPosition) const; |
51 | 51 |
52 // The actual texture atlas containing all the pre-rendered glyphs. | 52 // The actual texture atlas containing all the pre-rendered glyphs. |
53 SkBitmap m_atlas; | 53 SkBitmap m_atlas; |
54 | 54 |
55 // The look-up tables mapping ascii characters to their IntRect locations on
the atlas. | 55 // The look-up tables mapping ascii characters to their IntRect locations on
the atlas. |
56 IntRect m_asciiToRectTable[128]; | 56 IntRect m_asciiToRectTable[128]; |
57 | 57 |
58 int m_fontHeight; | 58 int m_fontHeight; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(CCFontAtlas); |
59 }; | 61 }; |
60 | 62 |
61 } // namespace cc | 63 } // namespace cc |
62 | 64 |
63 #endif // USE(ACCELERATED_COMPOSITING) | 65 #endif // USE(ACCELERATED_COMPOSITING) |
64 | 66 |
65 #endif | 67 #endif |
OLD | NEW |