| 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" | |
| 11 #include "platform/geometry/FloatPoint.h" | 10 #include "platform/geometry/FloatPoint.h" |
| 12 #include "platform/geometry/FloatRect.h" | 11 #include "platform/geometry/FloatRect.h" |
| 13 #include "platform/geometry/LayoutRect.h" | 12 #include "platform/geometry/LayoutRect.h" |
| 14 #include "platform/graphics/Color.h" | 13 #include "platform/graphics/Color.h" |
| 15 #include "platform/transforms/AffineTransform.h" | 14 #include "platform/transforms/AffineTransform.h" |
| 16 #include "wtf/Allocator.h" | 15 #include "wtf/Allocator.h" |
| 17 #include "wtf/text/AtomicString.h" | 16 #include "wtf/text/AtomicString.h" |
| 18 | 17 |
| 19 namespace blink { | 18 namespace blink { |
| 20 | 19 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 51 | 50 |
| 52 static void updateGraphicsContext(GraphicsContext&, | 51 static void updateGraphicsContext(GraphicsContext&, |
| 53 const Style&, | 52 const Style&, |
| 54 bool horizontal, | 53 bool horizontal, |
| 55 GraphicsContextStateSaver&); | 54 GraphicsContextStateSaver&); |
| 56 | 55 |
| 57 void clipDecorationsStripe(float upper, float stripeWidth, float dilation); | 56 void clipDecorationsStripe(float upper, float stripeWidth, float dilation); |
| 58 void paint(unsigned startOffset, | 57 void paint(unsigned startOffset, |
| 59 unsigned endOffset, | 58 unsigned endOffset, |
| 60 unsigned length, | 59 unsigned length, |
| 61 const Style&, | 60 const Style&); |
| 62 TextBlobPtr* cachedTextBlob = 0); | |
| 63 | 61 |
| 64 struct Style { | 62 struct Style { |
| 65 STACK_ALLOCATED(); | 63 STACK_ALLOCATED(); |
| 66 Color currentColor; | 64 Color currentColor; |
| 67 Color fillColor; | 65 Color fillColor; |
| 68 Color strokeColor; | 66 Color strokeColor; |
| 69 Color emphasisMarkColor; | 67 Color emphasisMarkColor; |
| 70 float strokeWidth; | 68 float strokeWidth; |
| 71 const ShadowList* shadow; | 69 const ShadowList* shadow; |
| 72 | 70 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 97 } | 95 } |
| 98 | 96 |
| 99 enum PaintInternalStep { PaintText, PaintEmphasisMark }; | 97 enum PaintInternalStep { PaintText, PaintEmphasisMark }; |
| 100 | 98 |
| 101 template <PaintInternalStep step> | 99 template <PaintInternalStep step> |
| 102 void paintInternalRun(TextRunPaintInfo&, unsigned from, unsigned to); | 100 void paintInternalRun(TextRunPaintInfo&, unsigned from, unsigned to); |
| 103 | 101 |
| 104 template <PaintInternalStep step> | 102 template <PaintInternalStep step> |
| 105 void paintInternal(unsigned startOffset, | 103 void paintInternal(unsigned startOffset, |
| 106 unsigned endOffset, | 104 unsigned endOffset, |
| 107 unsigned truncationPoint, | 105 unsigned truncationPoint); |
| 108 TextBlobPtr* cachedTextBlob = 0); | |
| 109 | 106 |
| 110 void paintEmphasisMarkForCombinedText(); | 107 void paintEmphasisMarkForCombinedText(); |
| 111 | 108 |
| 112 GraphicsContext& m_graphicsContext; | 109 GraphicsContext& m_graphicsContext; |
| 113 const Font& m_font; | 110 const Font& m_font; |
| 114 const TextRun& m_run; | 111 const TextRun& m_run; |
| 115 LayoutPoint m_textOrigin; | 112 LayoutPoint m_textOrigin; |
| 116 LayoutRect m_textBounds; | 113 LayoutRect m_textBounds; |
| 117 bool m_horizontal; | 114 bool m_horizontal; |
| 118 AtomicString m_emphasisMark; | 115 AtomicString m_emphasisMark; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 142 return rotationDirection == Clockwise | 139 return rotationDirection == Clockwise |
| 143 ? AffineTransform(0, 1, -1, 0, boxRect.x() + boxRect.maxY(), | 140 ? AffineTransform(0, 1, -1, 0, boxRect.x() + boxRect.maxY(), |
| 144 boxRect.y() - boxRect.x()) | 141 boxRect.y() - boxRect.x()) |
| 145 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.y(), | 142 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.y(), |
| 146 boxRect.x() + boxRect.maxY()); | 143 boxRect.x() + boxRect.maxY()); |
| 147 } | 144 } |
| 148 | 145 |
| 149 } // namespace blink | 146 } // namespace blink |
| 150 | 147 |
| 151 #endif // TextPainter_h | 148 #endif // TextPainter_h |
| OLD | NEW |