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

Side by Side Diff: ui/gfx/render_text.h

Issue 2928703005: Revert of cc: Move SkShader construction to a single spot in PaintShader (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/PaintShader.h ('k') | ui/gfx/render_text.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 UI_GFX_RENDER_TEXT_H_ 5 #ifndef UI_GFX_RENDER_TEXT_H_
6 #define UI_GFX_RENDER_TEXT_H_ 6 #define UI_GFX_RENDER_TEXT_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 19 matching lines...) Expand all
30 #include "ui/gfx/geometry/size_f.h" 30 #include "ui/gfx/geometry/size_f.h"
31 #include "ui/gfx/geometry/vector2d.h" 31 #include "ui/gfx/geometry/vector2d.h"
32 #include "ui/gfx/range/range.h" 32 #include "ui/gfx/range/range.h"
33 #include "ui/gfx/range/range_f.h" 33 #include "ui/gfx/range/range_f.h"
34 #include "ui/gfx/selection_model.h" 34 #include "ui/gfx/selection_model.h"
35 #include "ui/gfx/shadow_value.h" 35 #include "ui/gfx/shadow_value.h"
36 #include "ui/gfx/text_constants.h" 36 #include "ui/gfx/text_constants.h"
37 37
38 class SkDrawLooper; 38 class SkDrawLooper;
39 struct SkPoint; 39 struct SkPoint;
40 class SkShader;
40 class SkTypeface; 41 class SkTypeface;
41 42
42 namespace gfx { 43 namespace gfx {
43 namespace test { 44 namespace test {
44 class RenderTextTestApi; 45 class RenderTextTestApi;
45 } 46 }
46 47
47 class Canvas; 48 class Canvas;
48 struct DecoratedText; 49 struct DecoratedText;
49 class Font; 50 class Font;
50 51
51 namespace internal { 52 namespace internal {
52 53
53 // Internal helper class used by derived classes to draw text through Skia. 54 // Internal helper class used by derived classes to draw text through Skia.
54 class GFX_EXPORT SkiaTextRenderer { 55 class GFX_EXPORT SkiaTextRenderer {
55 public: 56 public:
56 explicit SkiaTextRenderer(Canvas* canvas); 57 explicit SkiaTextRenderer(Canvas* canvas);
57 virtual ~SkiaTextRenderer(); 58 virtual ~SkiaTextRenderer();
58 59
59 void SetDrawLooper(sk_sp<SkDrawLooper> draw_looper); 60 void SetDrawLooper(sk_sp<SkDrawLooper> draw_looper);
60 void SetFontRenderParams(const FontRenderParams& params, 61 void SetFontRenderParams(const FontRenderParams& params,
61 bool subpixel_rendering_suppressed); 62 bool subpixel_rendering_suppressed);
62 void SetTypeface(sk_sp<SkTypeface> typeface); 63 void SetTypeface(sk_sp<SkTypeface> typeface);
63 void SetTextSize(SkScalar size); 64 void SetTextSize(SkScalar size);
64 void SetForegroundColor(SkColor foreground); 65 void SetForegroundColor(SkColor foreground);
65 void SetShader(std::unique_ptr<cc::PaintShader> shader); 66 void SetShader(sk_sp<SkShader> shader);
66 // Sets underline metrics to use if the text will be drawn with an underline. 67 // Sets underline metrics to use if the text will be drawn with an underline.
67 // If not set, default values based on the size of the text will be used. The 68 // If not set, default values based on the size of the text will be used. The
68 // two metrics must be set together. 69 // two metrics must be set together.
69 void SetUnderlineMetrics(SkScalar thickness, SkScalar position); 70 void SetUnderlineMetrics(SkScalar thickness, SkScalar position);
70 void DrawSelection(const std::vector<Rect>& selection, SkColor color); 71 void DrawSelection(const std::vector<Rect>& selection, SkColor color);
71 virtual void DrawPosText(const SkPoint* pos, 72 virtual void DrawPosText(const SkPoint* pos,
72 const uint16_t* glyphs, 73 const uint16_t* glyphs,
73 size_t glyph_count); 74 size_t glyph_count);
74 // Draw underline and strike-through text decorations. 75 // Draw underline and strike-through text decorations.
75 // Based on |SkCanvas::DrawTextDecorations()| and constants from: 76 // Based on |SkCanvas::DrawTextDecorations()| and constants from:
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 // Lines computed by EnsureLayout. These should be invalidated upon 857 // Lines computed by EnsureLayout. These should be invalidated upon
857 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. 858 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls.
858 std::vector<internal::Line> lines_; 859 std::vector<internal::Line> lines_;
859 860
860 DISALLOW_COPY_AND_ASSIGN(RenderText); 861 DISALLOW_COPY_AND_ASSIGN(RenderText);
861 }; 862 };
862 863
863 } // namespace gfx 864 } // namespace gfx
864 865
865 #endif // UI_GFX_RENDER_TEXT_H_ 866 #endif // UI_GFX_RENDER_TEXT_H_
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/PaintShader.h ('k') | ui/gfx/render_text.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698