Chromium Code Reviews| Index: ui/gfx/render_text.h |
| =================================================================== |
| --- ui/gfx/render_text.h (revision 112983) |
| +++ ui/gfx/render_text.h (working copy) |
| @@ -12,7 +12,9 @@ |
| #include "base/gtest_prod_util.h" |
| #include "base/i18n/rtl.h" |
| #include "base/string16.h" |
| +#include "third_party/skia/include/core/SkCanvas.h" |
|
msw
2011/12/06 18:40:56
Can you forward declare SkCanvas instead?
Alexei Svitkine (slow)
2011/12/06 19:10:12
Done.
|
| #include "third_party/skia/include/core/SkColor.h" |
| +#include "third_party/skia/include/core/SkPoint.h" |
|
msw
2011/12/06 18:40:56
Can you forward declare SkPoint instead?
Alexei Svitkine (slow)
2011/12/06 19:10:12
Done.
|
| #include "ui/base/range/range.h" |
| #include "ui/gfx/font.h" |
| #include "ui/gfx/point.h" |
| @@ -21,6 +23,36 @@ |
| namespace gfx { |
| +class Canvas; |
| +class RenderTextTest; |
| + |
| +namespace internal { |
| + |
| +// Internal helper class used by derived classes to draw text through Skia. |
| +class SkiaTextRenderer { |
|
msw
2011/12/06 18:40:56
Does this belong in its own file? That might help
Alexei Svitkine (slow)
2011/12/06 19:10:12
At the moment its not really a very general class
msw
2011/12/07 01:08:45
Fair enough, this is fine for now.
A snazzy subdir
|
| + public: |
| + explicit SkiaTextRenderer(Canvas* canvas); |
| + ~SkiaTextRenderer(); |
| + |
| + void Init(); |
| + void SetFont(const gfx::Font& font); |
| + void SetForegroundColor(SkColor foreground); |
| + void DrawSelection(const std::vector<Rect>& selection, SkColor color); |
| + void DrawPosText(const SkPoint* pos, |
| + const uint16* glyphs, |
| + size_t glyph_count); |
| + void DrawDecorations(int x, int y, int width, bool underline, bool strike); |
| + void DrawCursor(const gfx::Rect& bounds); |
| + |
| + private: |
| + SkCanvas* canvas_skia_; |
| + SkPaint paint_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SkiaTextRenderer); |
| +}; |
| + |
| +} // namespace internal |
| + |
| // Color settings for text, backgrounds and cursor. |
| // These are tentative, and should be derived from theme, system |
| // settings and current settings. |
| @@ -31,9 +63,6 @@ |
| const SkColor kUnfocusedSelectionColor = SK_ColorLTGRAY; |
| const SkColor kCursorColor = SK_ColorBLACK; |
| -class Canvas; |
| -class RenderTextTest; |
| - |
| // A visual style applicable to a range of text. |
| struct UI_EXPORT StyleRange { |
| StyleRange(); |