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

Side by Side Diff: Source/core/paint/TextPainter.h

Issue 734313004: Move InlineTextBox::rotation to TextPainter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/paint/InlineTextBoxPainter.cpp ('k') | Source/core/paint/TextPainter.cpp » ('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 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/rendering/FloatToLayoutUnit.h"
8 #include "core/rendering/style/RenderStyleConstants.h" 9 #include "core/rendering/style/RenderStyleConstants.h"
9 #include "platform/fonts/TextBlob.h" 10 #include "platform/fonts/TextBlob.h"
10 #include "platform/geometry/FloatPoint.h" 11 #include "platform/geometry/FloatPoint.h"
11 #include "platform/geometry/FloatRect.h" 12 #include "platform/geometry/FloatRect.h"
12 #include "platform/graphics/Color.h" 13 #include "platform/graphics/Color.h"
14 #include "platform/transforms/AffineTransform.h"
13 #include "wtf/text/AtomicString.h" 15 #include "wtf/text/AtomicString.h"
14 16
15 namespace blink { 17 namespace blink {
16 18
17 class Font; 19 class Font;
18 class GraphicsContext; 20 class GraphicsContext;
19 class GraphicsContextStateSaver; 21 class GraphicsContextStateSaver;
20 class RenderCombineText; 22 class RenderCombineText;
21 class RenderObject; 23 class RenderObject;
22 class RenderStyle; 24 class RenderStyle;
(...skipping 28 matching lines...) Expand all
51 && strokeColor == other.strokeColor 53 && strokeColor == other.strokeColor
52 && emphasisMarkColor == other.emphasisMarkColor 54 && emphasisMarkColor == other.emphasisMarkColor
53 && strokeWidth == other.strokeWidth 55 && strokeWidth == other.strokeWidth
54 && shadow == other.shadow; 56 && shadow == other.shadow;
55 } 57 }
56 bool operator!=(const Style& other) { return !(*this == other); } 58 bool operator!=(const Style& other) { return !(*this == other); }
57 }; 59 };
58 static Style textPaintingStyle(RenderObject&, RenderStyle*, bool forceBlackT ext, bool isPrinting); 60 static Style textPaintingStyle(RenderObject&, RenderStyle*, bool forceBlackT ext, bool isPrinting);
59 static Style selectionPaintingStyle(RenderObject&, bool haveSelection, bool forceBlackText, bool isPrinting, const Style& textStyle); 61 static Style selectionPaintingStyle(RenderObject&, bool haveSelection, bool forceBlackText, bool isPrinting, const Style& textStyle);
60 62
63 enum RotationDirection { Counterclockwise, Clockwise };
64 static AffineTransform rotation(const FloatRectWillBeLayoutRect& boxRect, Ro tationDirection);
65
61 private: 66 private:
62 void updateGraphicsContext(const Style& style, GraphicsContextStateSaver& sa ver) 67 void updateGraphicsContext(const Style& style, GraphicsContextStateSaver& sa ver)
63 { 68 {
64 updateGraphicsContext(m_graphicsContext, style, m_horizontal, saver); 69 updateGraphicsContext(m_graphicsContext, style, m_horizontal, saver);
65 } 70 }
66 71
67 enum PaintInternalStep { PaintText, PaintEmphasisMark }; 72 enum PaintInternalStep { PaintText, PaintEmphasisMark };
68 73
69 template <PaintInternalStep step> 74 template <PaintInternalStep step>
70 void paintInternalRun(TextRunPaintInfo&, int from, int to); 75 void paintInternalRun(TextRunPaintInfo&, int from, int to);
71 76
72 template <PaintInternalStep step> 77 template <PaintInternalStep step>
73 void paintInternal(int startOffset, int endOffset, int truncationPoint, Text BlobPtr* cachedTextBlob = 0); 78 void paintInternal(int startOffset, int endOffset, int truncationPoint, Text BlobPtr* cachedTextBlob = 0);
74 79
75 void paintEmphasisMarkForCombinedText(); 80 void paintEmphasisMarkForCombinedText();
76 81
77 GraphicsContext* m_graphicsContext; 82 GraphicsContext* m_graphicsContext;
78 const Font& m_font; 83 const Font& m_font;
79 const TextRun& m_run; 84 const TextRun& m_run;
80 FloatPoint m_textOrigin; 85 FloatPoint m_textOrigin;
81 FloatRect m_textBounds; 86 FloatRect m_textBounds;
82 bool m_horizontal; 87 bool m_horizontal;
83 AtomicString m_emphasisMark; 88 AtomicString m_emphasisMark;
84 int m_emphasisMarkOffset; 89 int m_emphasisMarkOffset;
85 RenderCombineText* m_combinedText; 90 RenderCombineText* m_combinedText;
86 }; 91 };
87 92
93 inline AffineTransform TextPainter::rotation(const FloatRectWillBeLayoutRect& bo xRect, RotationDirection rotationDirection)
94 {
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());
97 }
98
88 } // namespace blink 99 } // namespace blink
89 100
90 #endif // TextPainter_h 101 #endif // TextPainter_h
OLDNEW
« no previous file with comments | « Source/core/paint/InlineTextBoxPainter.cpp ('k') | Source/core/paint/TextPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698