| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 TextPainter_h | 5 #ifndef TextPainter_h |
| 6 #define TextPainter_h | 6 #define TextPainter_h |
| 7 | 7 |
| 8 #include "core/layout/line/FloatToLayoutUnit.h" | 8 #include "core/layout/line/FloatToLayoutUnit.h" |
| 9 #include "core/layout/style/LayoutStyleConstants.h" | 9 #include "core/layout/style/LayoutStyleConstants.h" |
| 10 #include "platform/fonts/TextBlob.h" | 10 #include "platform/fonts/TextBlob.h" |
| 11 #include "platform/geometry/FloatPoint.h" | 11 #include "platform/geometry/FloatPoint.h" |
| 12 #include "platform/geometry/FloatRect.h" | 12 #include "platform/geometry/FloatRect.h" |
| 13 #include "platform/graphics/Color.h" | 13 #include "platform/graphics/Color.h" |
| 14 #include "platform/transforms/AffineTransform.h" | 14 #include "platform/transforms/AffineTransform.h" |
| 15 #include "wtf/text/AtomicString.h" | 15 #include "wtf/text/AtomicString.h" |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 | 18 |
| 19 class Font; | 19 class Font; |
| 20 class GraphicsContext; | 20 class GraphicsContext; |
| 21 class GraphicsContextStateSaver; | 21 class GraphicsContextStateSaver; |
| 22 class RenderCombineText; | 22 class LayoutTextCombine; |
| 23 class LayoutObject; | 23 class LayoutObject; |
| 24 class LayoutStyle; | 24 class LayoutStyle; |
| 25 class ShadowList; | 25 class ShadowList; |
| 26 class TextRun; | 26 class TextRun; |
| 27 struct TextRunPaintInfo; | 27 struct TextRunPaintInfo; |
| 28 | 28 |
| 29 class TextPainter { | 29 class TextPainter { |
| 30 public: | 30 public: |
| 31 struct Style; | 31 struct Style; |
| 32 | 32 |
| 33 TextPainter(GraphicsContext*, const Font&, const TextRun&, const FloatPoint&
textOrigin, const FloatRect& textBounds, bool horizontal); | 33 TextPainter(GraphicsContext*, const Font&, const TextRun&, const FloatPoint&
textOrigin, const FloatRect& textBounds, bool horizontal); |
| 34 ~TextPainter(); | 34 ~TextPainter(); |
| 35 | 35 |
| 36 void setEmphasisMark(const AtomicString&, TextEmphasisPosition); | 36 void setEmphasisMark(const AtomicString&, TextEmphasisPosition); |
| 37 void setCombinedText(RenderCombineText* combinedText) { m_combinedText = com
binedText; } | 37 void setCombinedText(LayoutTextCombine* combinedText) { m_combinedText = com
binedText; } |
| 38 | 38 |
| 39 static void updateGraphicsContext(GraphicsContext*, const Style&, bool horiz
ontal, GraphicsContextStateSaver&); | 39 static void updateGraphicsContext(GraphicsContext*, const Style&, bool horiz
ontal, GraphicsContextStateSaver&); |
| 40 | 40 |
| 41 void paint(int startOffset, int endOffset, int length, const Style&, TextBlo
bPtr* cachedTextBlob = 0); | 41 void paint(int startOffset, int endOffset, int length, const Style&, TextBlo
bPtr* cachedTextBlob = 0); |
| 42 | 42 |
| 43 struct Style { | 43 struct Style { |
| 44 Color fillColor; | 44 Color fillColor; |
| 45 Color strokeColor; | 45 Color strokeColor; |
| 46 Color emphasisMarkColor; | 46 Color emphasisMarkColor; |
| 47 float strokeWidth; | 47 float strokeWidth; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 void paintEmphasisMarkForCombinedText(); | 80 void paintEmphasisMarkForCombinedText(); |
| 81 | 81 |
| 82 GraphicsContext* m_graphicsContext; | 82 GraphicsContext* m_graphicsContext; |
| 83 const Font& m_font; | 83 const Font& m_font; |
| 84 const TextRun& m_run; | 84 const TextRun& m_run; |
| 85 FloatPoint m_textOrigin; | 85 FloatPoint m_textOrigin; |
| 86 FloatRect m_textBounds; | 86 FloatRect m_textBounds; |
| 87 bool m_horizontal; | 87 bool m_horizontal; |
| 88 AtomicString m_emphasisMark; | 88 AtomicString m_emphasisMark; |
| 89 int m_emphasisMarkOffset; | 89 int m_emphasisMarkOffset; |
| 90 RenderCombineText* m_combinedText; | 90 LayoutTextCombine* m_combinedText; |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 inline AffineTransform TextPainter::rotation(const FloatRectWillBeLayoutRect& bo
xRect, RotationDirection rotationDirection) | 93 inline AffineTransform TextPainter::rotation(const FloatRectWillBeLayoutRect& bo
xRect, RotationDirection rotationDirection) |
| 94 { | 94 { |
| 95 return rotationDirection == Clockwise ? AffineTransform(0, 1, -1, 0, boxRect
.x() + boxRect.maxY(), boxRect.maxY() - boxRect.x()) | 95 return rotationDirection == Clockwise ? AffineTransform(0, 1, -1, 0, boxRect
.x() + boxRect.maxY(), boxRect.maxY() - boxRect.x()) |
| 96 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.maxY(), boxRect.x()
+ boxRect.maxY()); | 96 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.maxY(), boxRect.x()
+ boxRect.maxY()); |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace blink | 99 } // namespace blink |
| 100 | 100 |
| 101 #endif // TextPainter_h | 101 #endif // TextPainter_h |
| OLD | NEW |