OLD | NEW |
1 /** | 1 /** |
2 * Copyright (C) 2007 Rob Buis <buis@kde.org> | 2 * Copyright (C) 2007 Rob Buis <buis@kde.org> |
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2009 Google, Inc. All rights reserved. | 5 * Copyright (C) 2009 Google, Inc. All rights reserved. |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * Copyright (C) 2012 Zoltan Herczeg <zherczeg@webkit.org>. | 7 * Copyright (C) 2012 Zoltan Herczeg <zherczeg@webkit.org>. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "platform/transforms/AffineTransform.h" | 36 #include "platform/transforms/AffineTransform.h" |
37 #include <memory> | 37 #include <memory> |
38 | 38 |
39 namespace blink { | 39 namespace blink { |
40 | 40 |
41 class LayoutObject; | 41 class LayoutObject; |
42 class LayoutSVGResourceFilter; | 42 class LayoutSVGResourceFilter; |
43 class LayoutSVGResourceMasker; | 43 class LayoutSVGResourceMasker; |
44 class SVGResources; | 44 class SVGResources; |
45 | 45 |
46 // This class hooks up the correct paint property transform node when spv2 is en
abled, and otherwise | 46 // This class hooks up the correct paint property transform node when spv2 is |
47 // works like a TransformRecorder which emits Transform display items for spv1. | 47 // enabled, and otherwise works like a TransformRecorder which emits Transform |
| 48 // display items for spv1. |
48 class SVGTransformContext : public TransformRecorder { | 49 class SVGTransformContext : public TransformRecorder { |
49 STACK_ALLOCATED(); | 50 STACK_ALLOCATED(); |
50 | 51 |
51 public: | 52 public: |
52 SVGTransformContext(GraphicsContext& context, | 53 SVGTransformContext(GraphicsContext& context, |
53 const LayoutObject& object, | 54 const LayoutObject& object, |
54 const AffineTransform& transform) | 55 const AffineTransform& transform) |
55 : TransformRecorder(context, object, transform) { | 56 : TransformRecorder(context, object, transform) { |
56 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 57 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
57 const auto* objectProperties = object.objectPaintProperties(); | 58 const auto* objectProperties = object.objectPaintProperties(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 #endif | 109 #endif |
109 { | 110 { |
110 } | 111 } |
111 | 112 |
112 ~SVGPaintContext(); | 113 ~SVGPaintContext(); |
113 | 114 |
114 PaintInfo& paintInfo() { | 115 PaintInfo& paintInfo() { |
115 return m_filterPaintInfo ? *m_filterPaintInfo : m_paintInfo; | 116 return m_filterPaintInfo ? *m_filterPaintInfo : m_paintInfo; |
116 } | 117 } |
117 | 118 |
118 // Return true if these operations aren't necessary or if they are successfull
y applied. | 119 // Return true if these operations aren't necessary or if they are |
| 120 // successfully applied. |
119 bool applyClipMaskAndFilterIfNecessary(); | 121 bool applyClipMaskAndFilterIfNecessary(); |
120 | 122 |
121 static void paintSubtree(GraphicsContext&, const LayoutObject*); | 123 static void paintSubtree(GraphicsContext&, const LayoutObject*); |
122 | 124 |
123 // TODO(fs): This functions feels a bit misplaced (we don't want this to | 125 // TODO(fs): This functions feels a bit misplaced (we don't want this to |
124 // turn into the new kitchen sink). Move it if a better location surfaces. | 126 // turn into the new kitchen sink). Move it if a better location surfaces. |
125 static bool paintForLayoutObject( | 127 static bool paintForLayoutObject( |
126 const PaintInfo&, | 128 const PaintInfo&, |
127 const ComputedStyle&, | 129 const ComputedStyle&, |
128 const LayoutObject&, | 130 const LayoutObject&, |
129 LayoutSVGResourceMode, | 131 LayoutSVGResourceMode, |
130 SkPaint&, | 132 SkPaint&, |
131 const AffineTransform* additionalPaintServerTransform = nullptr); | 133 const AffineTransform* additionalPaintServerTransform = nullptr); |
132 | 134 |
133 private: | 135 private: |
134 void applyCompositingIfNecessary(); | 136 void applyCompositingIfNecessary(); |
135 void applyClipIfNecessary(); | 137 void applyClipIfNecessary(); |
136 | 138 |
137 // Return true if no masking is necessary or if the mask is successfully appli
ed. | 139 // Return true if no masking is necessary or if the mask is successfully |
| 140 // applied. |
138 bool applyMaskIfNecessary(SVGResources*); | 141 bool applyMaskIfNecessary(SVGResources*); |
139 | 142 |
140 // Return true if no filtering is necessary or if the filter is successfully a
pplied. | 143 // Return true if no filtering is necessary or if the filter is successfully |
| 144 // applied. |
141 bool applyFilterIfNecessary(SVGResources*); | 145 bool applyFilterIfNecessary(SVGResources*); |
142 | 146 |
143 bool isIsolationInstalled() const; | 147 bool isIsolationInstalled() const; |
144 | 148 |
145 const LayoutObject& m_object; | 149 const LayoutObject& m_object; |
146 PaintInfo m_paintInfo; | 150 PaintInfo m_paintInfo; |
147 std::unique_ptr<PaintInfo> m_filterPaintInfo; | 151 std::unique_ptr<PaintInfo> m_filterPaintInfo; |
148 LayoutSVGResourceFilter* m_filter; | 152 LayoutSVGResourceFilter* m_filter; |
149 LayoutSVGResourceMasker* m_masker; | 153 LayoutSVGResourceMasker* m_masker; |
150 std::unique_ptr<CompositingRecorder> m_compositingRecorder; | 154 std::unique_ptr<CompositingRecorder> m_compositingRecorder; |
151 Optional<ClipPathClipper> m_clipPathClipper; | 155 Optional<ClipPathClipper> m_clipPathClipper; |
152 std::unique_ptr<SVGFilterRecordingContext> m_filterRecordingContext; | 156 std::unique_ptr<SVGFilterRecordingContext> m_filterRecordingContext; |
153 #if ENABLE(ASSERT) | 157 #if ENABLE(ASSERT) |
154 bool m_applyClipMaskAndFilterIfNecessaryCalled; | 158 bool m_applyClipMaskAndFilterIfNecessaryCalled; |
155 #endif | 159 #endif |
156 }; | 160 }; |
157 | 161 |
158 } // namespace blink | 162 } // namespace blink |
159 | 163 |
160 #endif // SVGPaintContext_h | 164 #endif // SVGPaintContext_h |
OLD | NEW |