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 SVGRootPainter_h | 5 #ifndef SVGRootPainter_h |
6 #define SVGRootPainter_h | 6 #define SVGRootPainter_h |
7 | 7 |
8 #include "wtf/Allocator.h" | 8 #include "wtf/Allocator.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 struct PaintInfo; | 12 struct PaintInfo; |
13 class AffineTransform; | 13 class AffineTransform; |
14 class IntRect; | 14 class IntRect; |
15 class LayoutPoint; | 15 class LayoutPoint; |
16 class LayoutSVGRoot; | 16 class LayoutSVGRoot; |
17 | 17 |
18 class SVGRootPainter { | 18 class SVGRootPainter { |
19 STACK_ALLOCATED(); | 19 STACK_ALLOCATED(); |
20 | 20 |
21 public: | 21 public: |
22 SVGRootPainter(const LayoutSVGRoot& layoutSVGRoot) | 22 SVGRootPainter(const LayoutSVGRoot& layoutSVGRoot) |
23 : m_layoutSVGRoot(layoutSVGRoot) {} | 23 : m_layoutSVGRoot(layoutSVGRoot) {} |
24 | 24 |
25 void paintReplaced(const PaintInfo&, const LayoutPoint&); | 25 void paintReplaced(const PaintInfo&, const LayoutPoint&); |
26 | 26 |
27 // The embedded SVG document uses an unsnapped viewport box for layout, while
SVG root's border | 27 // The embedded SVG document uses an unsnapped viewport box for layout, while |
28 // box ultimately gets snapped during paint. This translate/scale transform is
applied to | 28 // SVG root's border box ultimately gets snapped during paint. This |
29 // compensate the difference, in addition to applying the local to border box
transform. | 29 // translate/scale transform is applied to compensate the difference, in |
| 30 // addition to applying the local to border box transform. |
30 AffineTransform transformToPixelSnappedBorderBox( | 31 AffineTransform transformToPixelSnappedBorderBox( |
31 const LayoutPoint& paintOffset) const; | 32 const LayoutPoint& paintOffset) const; |
32 | 33 |
33 private: | 34 private: |
34 IntRect pixelSnappedSize(const LayoutPoint& paintOffset) const; | 35 IntRect pixelSnappedSize(const LayoutPoint& paintOffset) const; |
35 | 36 |
36 const LayoutSVGRoot& m_layoutSVGRoot; | 37 const LayoutSVGRoot& m_layoutSVGRoot; |
37 }; | 38 }; |
38 | 39 |
39 } // namespace blink | 40 } // namespace blink |
40 | 41 |
41 #endif // SVGRootPainter_h | 42 #endif // SVGRootPainter_h |
OLD | NEW |