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

Side by Side Diff: cc/CCFontAtlas.h

Issue 11122003: [cc] Rename all cc/ filenames to Chromium style (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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/CCDrawQuad.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 // Temporary forwarding header
6 #define CCFontAtlas_h 6 #include "cc/font_atlas.h"
7
8 #if USE(ACCELERATED_COMPOSITING)
9
10 #include <string>
11
12 #include "base/basictypes.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "IntRect.h"
15 #include "SkBitmap.h"
16
17 class SkCanvas;
18
19 namespace gfx {
20 class Point;
21 }
22
23 namespace cc {
24
25 class Color;
26 class FontDescription;
27 class GraphicsContext;
28 class IntSize;
29
30 // This class provides basic ability to draw text onto the heads-up display.
31 class CCFontAtlas {
32 public:
33 static scoped_ptr<CCFontAtlas> create(SkBitmap bitmap, IntRect asciiToRectTa ble[128], int fontHeight)
34 {
35 return make_scoped_ptr(new CCFontAtlas(bitmap, asciiToRectTable, fontHei ght));
36 }
37 ~CCFontAtlas();
38
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
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
43 // target canvas bounds.
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;
46
47 // Draws the entire atlas at the specified position, just for debugging purp oses.
48 void drawDebugAtlas(SkCanvas*, const gfx::Point& destPosition) const;
49
50 private:
51 CCFontAtlas(SkBitmap, IntRect asciiToRectTable[128], int fontHeight);
52
53 void drawOneLineOfTextInternal(SkCanvas*, const SkPaint&, const std::string& , const gfx::Point& destPosition) const;
54
55 // The actual texture atlas containing all the pre-rendered glyphs.
56 SkBitmap m_atlas;
57
58 // The look-up tables mapping ascii characters to their IntRect locations on the atlas.
59 IntRect m_asciiToRectTable[128];
60
61 int m_fontHeight;
62
63 DISALLOW_COPY_AND_ASSIGN(CCFontAtlas);
64 };
65
66 } // namespace cc
67
68 #endif // USE(ACCELERATED_COMPOSITING)
69
70 #endif
OLDNEW
« no previous file with comments | « cc/CCDrawQuad.cpp ('k') | cc/CCFontAtlas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698