Index: ui/gfx/render_text.h |
=================================================================== |
--- ui/gfx/render_text.h (revision 113402) |
+++ ui/gfx/render_text.h (working copy) |
@@ -13,14 +13,47 @@ |
#include "base/i18n/rtl.h" |
#include "base/string16.h" |
#include "third_party/skia/include/core/SkColor.h" |
+#include "third_party/skia/include/core/SkPaint.h" |
#include "ui/base/range/range.h" |
#include "ui/gfx/font.h" |
#include "ui/gfx/point.h" |
#include "ui/gfx/rect.h" |
#include "ui/gfx/selection_model.h" |
+class SkCanvas; |
+struct SkPoint; |
+ |
namespace gfx { |
+class Canvas; |
+class RenderTextTest; |
+ |
+namespace internal { |
+ |
+// Internal helper class used by derived classes to draw text through Skia. |
+class SkiaTextRenderer { |
+ public: |
+ explicit SkiaTextRenderer(Canvas* canvas); |
+ ~SkiaTextRenderer(); |
+ |
+ 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 +64,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(); |
@@ -245,6 +275,9 @@ |
Point ToTextPoint(const Point& point); |
Point ToViewPoint(const Point& point); |
+ // Returns the origin point for drawing text via Skia. |
+ Point GetOriginForSkiaDrawing(); |
+ |
private: |
friend class RenderTextTest; |