| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 117   AtomicString m_emphasisMark; | 117   AtomicString m_emphasisMark; | 
| 118   int m_emphasisMarkOffset; | 118   int m_emphasisMarkOffset; | 
| 119   LayoutTextCombine* m_combinedText; | 119   LayoutTextCombine* m_combinedText; | 
| 120 }; | 120 }; | 
| 121 | 121 | 
| 122 inline AffineTransform TextPainter::rotation( | 122 inline AffineTransform TextPainter::rotation( | 
| 123     const LayoutRect& boxRect, | 123     const LayoutRect& boxRect, | 
| 124     RotationDirection rotationDirection) { | 124     RotationDirection rotationDirection) { | 
| 125   // Why this matrix is correct: consider the case of a clockwise rotation. | 125   // Why this matrix is correct: consider the case of a clockwise rotation. | 
| 126 | 126 | 
| 127   // Let the corner points that define |boxRect| be ABCD, where A is top-left an
     d B is bottom-left. | 127   // Let the corner points that define |boxRect| be ABCD, where A is top-left | 
|  | 128   // and B is bottom-left. | 
| 128 | 129 | 
| 129   // 1. We want B to end up at the same pixel position after rotation as A is be
     fore rotation. | 130   // 1. We want B to end up at the same pixel position after rotation as A is | 
|  | 131   //    before rotation. | 
| 130   // 2. Before rotation, B is at (x(), maxY()) | 132   // 2. Before rotation, B is at (x(), maxY()) | 
| 131   // 3. Rotating clockwise by 90 degrees places B at the coordinates (-maxY(), x
     ()). | 133   // 3. Rotating clockwise by 90 degrees places B at the coordinates | 
|  | 134   //    (-maxY(), x()). | 
| 132   // 4. Point A before rotation is at (x(), y()) | 135   // 4. Point A before rotation is at (x(), y()) | 
| 133   // 5. Therefore the translation from (3) to (4) is (x(), y()) - (-maxY(), x())
      = (x() + maxY(), y() - x()) | 136   // 5. Therefore the translation from (3) to (4) is (x(), y()) - (-maxY(), x()) | 
|  | 137   //    = (x() + maxY(), y() - x()) | 
| 134 | 138 | 
| 135   // A similar argument derives the counter-clockwise case. | 139   // A similar argument derives the counter-clockwise case. | 
| 136   return rotationDirection == Clockwise | 140   return rotationDirection == Clockwise | 
| 137              ? AffineTransform(0, 1, -1, 0, boxRect.x() + boxRect.maxY(), | 141              ? AffineTransform(0, 1, -1, 0, boxRect.x() + boxRect.maxY(), | 
| 138                                boxRect.y() - boxRect.x()) | 142                                boxRect.y() - boxRect.x()) | 
| 139              : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.y(), | 143              : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.y(), | 
| 140                                boxRect.x() + boxRect.maxY()); | 144                                boxRect.x() + boxRect.maxY()); | 
| 141 } | 145 } | 
| 142 | 146 | 
| 143 }  // namespace blink | 147 }  // namespace blink | 
| 144 | 148 | 
| 145 #endif  // TextPainter_h | 149 #endif  // TextPainter_h | 
| OLD | NEW | 
|---|