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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/paint/InlineTextBoxPainter.cpp ('k') | Source/core/paint/TextPainter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/TextPainter.h
diff --git a/Source/core/paint/TextPainter.h b/Source/core/paint/TextPainter.h
index 074ba6e78aa67482e514bf61cc64210b83c12b3c..55c847f5e2c52edb78b5205477b7f4f8dcd388aa 100644
--- a/Source/core/paint/TextPainter.h
+++ b/Source/core/paint/TextPainter.h
@@ -5,11 +5,13 @@
#ifndef TextPainter_h
#define TextPainter_h
+#include "core/rendering/FloatToLayoutUnit.h"
#include "core/rendering/style/RenderStyleConstants.h"
#include "platform/fonts/TextBlob.h"
#include "platform/geometry/FloatPoint.h"
#include "platform/geometry/FloatRect.h"
#include "platform/graphics/Color.h"
+#include "platform/transforms/AffineTransform.h"
#include "wtf/text/AtomicString.h"
namespace blink {
@@ -58,6 +60,9 @@ public:
static Style textPaintingStyle(RenderObject&, RenderStyle*, bool forceBlackText, bool isPrinting);
static Style selectionPaintingStyle(RenderObject&, bool haveSelection, bool forceBlackText, bool isPrinting, const Style& textStyle);
+ enum RotationDirection { Counterclockwise, Clockwise };
+ static AffineTransform rotation(const FloatRectWillBeLayoutRect& boxRect, RotationDirection);
+
private:
void updateGraphicsContext(const Style& style, GraphicsContextStateSaver& saver)
{
@@ -85,6 +90,12 @@ private:
RenderCombineText* m_combinedText;
};
+inline AffineTransform TextPainter::rotation(const FloatRectWillBeLayoutRect& boxRect, RotationDirection rotationDirection)
+{
+ return rotationDirection == Clockwise ? AffineTransform(0, 1, -1, 0, boxRect.x() + boxRect.maxY(), boxRect.maxY() - boxRect.x())
+ : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.maxY(), boxRect.x() + boxRect.maxY());
+}
+
} // namespace blink
#endif // TextPainter_h
« 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