Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: cc/CCFontAtlas.h

Issue 10900021: Use std::string instead of WTF::String / TextStream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/CCActiveAnimation.cpp ('k') | cc/CCFontAtlas.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "IntRect.h" 10 #include "IntRect.h"
11 #include "SkBitmap.h" 11 #include "SkBitmap.h"
12 #include <string>
12 #include <wtf/OwnPtr.h> 13 #include <wtf/OwnPtr.h>
13 #include <wtf/PassOwnPtr.h> 14 #include <wtf/PassOwnPtr.h>
14 #include <wtf/text/WTFString.h>
15 15
16 class SkCanvas; 16 class SkCanvas;
17 17
18 namespace WebCore { 18 namespace WebCore {
19 19
20 class Color; 20 class Color;
21 class FontDescription; 21 class FontDescription;
22 class GraphicsContext; 22 class GraphicsContext;
23 class IntPoint; 23 class IntPoint;
24 class IntSize; 24 class IntSize;
25 25
26 // This class provides basic ability to draw text onto the heads-up display. 26 // This class provides basic ability to draw text onto the heads-up display.
27 class CCFontAtlas { 27 class CCFontAtlas {
28 WTF_MAKE_NONCOPYABLE(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.
39 // - IntSize clip is used to avoid wasting time drawing things that are outs ide the 39 // - IntSize clip is used to avoid wasting time drawing things that are outs ide the
40 // target canvas bounds. 40 // target canvas bounds.
41 // - Should only be called only on the impl thread. 41 // - Should only be called only on the impl thread.
42 void drawText(SkCanvas*, const SkPaint&, const String& text, const IntPoint& destPosition, const IntSize& clip) const; 42 void drawText(SkCanvas*, const SkPaint&, const std::string& text, const IntP oint& destPosition, const IntSize& clip) const;
43 43
44 // Draws the entire atlas at the specified position, just for debugging purp oses. 44 // Draws the entire atlas at the specified position, just for debugging purp oses.
45 void drawDebugAtlas(SkCanvas*, const IntPoint& destPosition) const; 45 void drawDebugAtlas(SkCanvas*, const IntPoint& destPosition) const;
46 46
47 private: 47 private:
48 CCFontAtlas(SkBitmap, IntRect asciiToRectTable[128], int fontHeight); 48 CCFontAtlas(SkBitmap, IntRect asciiToRectTable[128], int fontHeight);
49 49
50 void drawOneLineOfTextInternal(SkCanvas*, const SkPaint&, const String&, con st 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 }; 59 };
60 60
61 } // namespace WebCore 61 } // namespace WebCore
62 62
63 #endif // USE(ACCELERATED_COMPOSITING) 63 #endif // USE(ACCELERATED_COMPOSITING)
64 64
65 #endif 65 #endif
OLDNEW
« no previous file with comments | « cc/CCActiveAnimation.cpp ('k') | cc/CCFontAtlas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698