| 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/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/style/ComputedStyleConstants.h" | 9 #include "core/style/ComputedStyleConstants.h" |
| 10 #include "platform/fonts/TextBlob.h" | 10 #include "platform/fonts/TextBlob.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 struct PaintInfo; | 27 struct PaintInfo; |
| 28 class ShadowList; | 28 class ShadowList; |
| 29 class TextRun; | 29 class TextRun; |
| 30 struct TextRunPaintInfo; | 30 struct TextRunPaintInfo; |
| 31 | 31 |
| 32 class CORE_EXPORT TextPainter { | 32 class CORE_EXPORT TextPainter { |
| 33 STACK_ALLOCATED(); | 33 STACK_ALLOCATED(); |
| 34 public: | 34 public: |
| 35 struct Style; | 35 struct Style; |
| 36 | 36 |
| 37 TextPainter(GraphicsContext*, const Font&, const TextRun&, const LayoutPoint
& textOrigin, const LayoutRect& textBounds, bool horizontal); | 37 TextPainter(GraphicsContext&, const Font&, const TextRun&, const LayoutPoint
& textOrigin, const LayoutRect& textBounds, bool horizontal); |
| 38 ~TextPainter(); | 38 ~TextPainter(); |
| 39 | 39 |
| 40 void setEmphasisMark(const AtomicString&, TextEmphasisPosition); | 40 void setEmphasisMark(const AtomicString&, TextEmphasisPosition); |
| 41 void setCombinedText(LayoutTextCombine* combinedText) { m_combinedText = com
binedText; } | 41 void setCombinedText(LayoutTextCombine* combinedText) { m_combinedText = com
binedText; } |
| 42 | 42 |
| 43 static void updateGraphicsContext(GraphicsContext*, const Style&, bool horiz
ontal, GraphicsContextStateSaver&); | 43 static void updateGraphicsContext(GraphicsContext&, const Style&, bool horiz
ontal, GraphicsContextStateSaver&); |
| 44 | 44 |
| 45 void paint(int startOffset, int endOffset, int length, const Style&, TextBlo
bPtr* cachedTextBlob = 0); | 45 void paint(int startOffset, int endOffset, int length, const Style&, TextBlo
bPtr* cachedTextBlob = 0); |
| 46 | 46 |
| 47 struct Style { | 47 struct Style { |
| 48 STACK_ALLOCATED(); | 48 STACK_ALLOCATED(); |
| 49 Color currentColor; | 49 Color currentColor; |
| 50 Color fillColor; | 50 Color fillColor; |
| 51 Color strokeColor; | 51 Color strokeColor; |
| 52 Color emphasisMarkColor; | 52 Color emphasisMarkColor; |
| 53 float strokeWidth; | 53 float strokeWidth; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 79 enum PaintInternalStep { PaintText, PaintEmphasisMark }; | 79 enum PaintInternalStep { PaintText, PaintEmphasisMark }; |
| 80 | 80 |
| 81 template <PaintInternalStep step> | 81 template <PaintInternalStep step> |
| 82 void paintInternalRun(TextRunPaintInfo&, int from, int to); | 82 void paintInternalRun(TextRunPaintInfo&, int from, int to); |
| 83 | 83 |
| 84 template <PaintInternalStep step> | 84 template <PaintInternalStep step> |
| 85 void paintInternal(int startOffset, int endOffset, int truncationPoint, Text
BlobPtr* cachedTextBlob = 0); | 85 void paintInternal(int startOffset, int endOffset, int truncationPoint, Text
BlobPtr* cachedTextBlob = 0); |
| 86 | 86 |
| 87 void paintEmphasisMarkForCombinedText(); | 87 void paintEmphasisMarkForCombinedText(); |
| 88 | 88 |
| 89 GraphicsContext* m_graphicsContext; | 89 GraphicsContext& m_graphicsContext; |
| 90 const Font& m_font; | 90 const Font& m_font; |
| 91 const TextRun& m_run; | 91 const TextRun& m_run; |
| 92 LayoutPoint m_textOrigin; | 92 LayoutPoint m_textOrigin; |
| 93 LayoutRect m_textBounds; | 93 LayoutRect m_textBounds; |
| 94 bool m_horizontal; | 94 bool m_horizontal; |
| 95 AtomicString m_emphasisMark; | 95 AtomicString m_emphasisMark; |
| 96 int m_emphasisMarkOffset; | 96 int m_emphasisMarkOffset; |
| 97 LayoutTextCombine* m_combinedText; | 97 LayoutTextCombine* m_combinedText; |
| 98 }; | 98 }; |
| 99 | 99 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 110 // 5. Therefore the translation from (3) to (4) is (x(), y()) - (-maxY(), x(
)) = (x() + maxY(), y() - x()) | 110 // 5. Therefore the translation from (3) to (4) is (x(), y()) - (-maxY(), x(
)) = (x() + maxY(), y() - x()) |
| 111 | 111 |
| 112 // A similar argument derives the counter-clockwise case. | 112 // A similar argument derives the counter-clockwise case. |
| 113 return rotationDirection == Clockwise ? AffineTransform(0, 1, -1, 0, boxRect
.x() + boxRect.maxY(), boxRect.y() - boxRect.x()) | 113 return rotationDirection == Clockwise ? AffineTransform(0, 1, -1, 0, boxRect
.x() + boxRect.maxY(), boxRect.y() - boxRect.x()) |
| 114 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.y(), boxRect.x() +
boxRect.maxY()); | 114 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.y(), boxRect.x() +
boxRect.maxY()); |
| 115 } | 115 } |
| 116 | 116 |
| 117 } // namespace blink | 117 } // namespace blink |
| 118 | 118 |
| 119 #endif // TextPainter_h | 119 #endif // TextPainter_h |
| OLD | NEW |