| 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 |
| 11 * License as published by the Free Software Foundation; either | 11 * License as published by the Free Software Foundation; either |
| 12 * version 2 of the License, or (at your option) any later version. | 12 * version 2 of the License, or (at your option) any later version. |
| 13 * | 13 * |
| 14 * This library is distributed in the hope that it will be useful, | 14 * This library is distributed in the hope that it will be useful, |
| 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 * Library General Public License for more details. | 17 * Library General Public License for more details. |
| 18 * | 18 * |
| 19 * You should have received a copy of the GNU Library General Public License | 19 * You should have received a copy of the GNU Library General Public License |
| 20 * along with this library; see the file COPYING.LIB. If not, write to | 20 * along with this library; see the file COPYING.LIB. If not, write to |
| 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 22 * Boston, MA 02110-1301, USA. | 22 * Boston, MA 02110-1301, USA. |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #ifndef SVGPaintContext_h | 25 #ifndef SVGPaintContext_h |
| 26 #define SVGPaintContext_h | 26 #define SVGPaintContext_h |
| 27 | 27 |
| 28 #include "core/layout/svg/LayoutSVGResourceClipper.h" | |
| 29 #include "core/layout/svg/LayoutSVGResourcePaintServer.h" | 28 #include "core/layout/svg/LayoutSVGResourcePaintServer.h" |
| 29 #include "core/paint/ClipPathClipper.h" |
| 30 #include "core/paint/ObjectPaintProperties.h" | 30 #include "core/paint/ObjectPaintProperties.h" |
| 31 #include "core/paint/PaintInfo.h" | 31 #include "core/paint/PaintInfo.h" |
| 32 #include "core/paint/SVGClipPainter.h" | |
| 33 #include "core/paint/SVGFilterPainter.h" | 32 #include "core/paint/SVGFilterPainter.h" |
| 34 #include "core/paint/TransformRecorder.h" | 33 #include "core/paint/TransformRecorder.h" |
| 35 #include "platform/graphics/paint/ClipPathRecorder.h" | |
| 36 #include "platform/graphics/paint/CompositingRecorder.h" | 34 #include "platform/graphics/paint/CompositingRecorder.h" |
| 37 #include "platform/graphics/paint/ScopedPaintChunkProperties.h" | 35 #include "platform/graphics/paint/ScopedPaintChunkProperties.h" |
| 38 #include "platform/transforms/AffineTransform.h" | 36 #include "platform/transforms/AffineTransform.h" |
| 39 #include <memory> | 37 #include <memory> |
| 40 | 38 |
| 41 namespace blink { | 39 namespace blink { |
| 42 | 40 |
| 43 class LayoutObject; | 41 class LayoutObject; |
| 44 class LayoutSVGResourceFilter; | 42 class LayoutSVGResourceFilter; |
| 45 class LayoutSVGResourceMasker; | 43 class LayoutSVGResourceMasker; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 Optional<ScopedPaintChunkProperties> m_transformPropertyScope; | 84 Optional<ScopedPaintChunkProperties> m_transformPropertyScope; |
| 87 }; | 85 }; |
| 88 | 86 |
| 89 class SVGPaintContext { | 87 class SVGPaintContext { |
| 90 STACK_ALLOCATED(); | 88 STACK_ALLOCATED(); |
| 91 public: | 89 public: |
| 92 SVGPaintContext(const LayoutObject& object, const PaintInfo& paintInfo) | 90 SVGPaintContext(const LayoutObject& object, const PaintInfo& paintInfo) |
| 93 : m_object(object) | 91 : m_object(object) |
| 94 , m_paintInfo(paintInfo) | 92 , m_paintInfo(paintInfo) |
| 95 , m_filter(nullptr) | 93 , m_filter(nullptr) |
| 96 , m_clipper(nullptr) | |
| 97 , m_clipperState(SVGClipPainter::ClipperNotApplied) | |
| 98 , m_masker(nullptr) | 94 , m_masker(nullptr) |
| 99 #if ENABLE(ASSERT) | 95 #if ENABLE(ASSERT) |
| 100 , m_applyClipMaskAndFilterIfNecessaryCalled(false) | 96 , m_applyClipMaskAndFilterIfNecessaryCalled(false) |
| 101 #endif | 97 #endif |
| 102 { } | 98 { } |
| 103 | 99 |
| 104 ~SVGPaintContext(); | 100 ~SVGPaintContext(); |
| 105 | 101 |
| 106 PaintInfo& paintInfo() { return m_filterPaintInfo ? *m_filterPaintInfo : m_p
aintInfo; } | 102 PaintInfo& paintInfo() { return m_filterPaintInfo ? *m_filterPaintInfo : m_p
aintInfo; } |
| 107 | 103 |
| 108 // Return true if these operations aren't necessary or if they are successfu
lly applied. | 104 // Return true if these operations aren't necessary or if they are successfu
lly applied. |
| 109 bool applyClipMaskAndFilterIfNecessary(); | 105 bool applyClipMaskAndFilterIfNecessary(); |
| 110 | 106 |
| 111 static void paintSubtree(GraphicsContext&, const LayoutObject*); | 107 static void paintSubtree(GraphicsContext&, const LayoutObject*); |
| 112 | 108 |
| 113 // TODO(fs): This functions feels a bit misplaced (we don't want this to | 109 // TODO(fs): This functions feels a bit misplaced (we don't want this to |
| 114 // turn into the new kitchen sink). Move it if a better location surfaces. | 110 // turn into the new kitchen sink). Move it if a better location surfaces. |
| 115 static bool paintForLayoutObject(const PaintInfo&, const ComputedStyle&, con
st LayoutObject&, LayoutSVGResourceMode, SkPaint&, const AffineTransform* additi
onalPaintServerTransform = nullptr); | 111 static bool paintForLayoutObject(const PaintInfo&, const ComputedStyle&, con
st LayoutObject&, LayoutSVGResourceMode, SkPaint&, const AffineTransform* additi
onalPaintServerTransform = nullptr); |
| 116 | 112 |
| 117 private: | 113 private: |
| 118 void applyCompositingIfNecessary(); | 114 void applyCompositingIfNecessary(); |
| 119 | 115 void applyClipIfNecessary(); |
| 120 // Return true if no clipping is necessary or if the clip is successfully ap
plied. | |
| 121 bool applyClipIfNecessary(SVGResources*); | |
| 122 | 116 |
| 123 // Return true if no masking is necessary or if the mask is successfully app
lied. | 117 // Return true if no masking is necessary or if the mask is successfully app
lied. |
| 124 bool applyMaskIfNecessary(SVGResources*); | 118 bool applyMaskIfNecessary(SVGResources*); |
| 125 | 119 |
| 126 // Return true if no filtering is necessary or if the filter is successfully
applied. | 120 // Return true if no filtering is necessary or if the filter is successfully
applied. |
| 127 bool applyFilterIfNecessary(SVGResources*); | 121 bool applyFilterIfNecessary(SVGResources*); |
| 128 | 122 |
| 129 bool isIsolationInstalled() const; | 123 bool isIsolationInstalled() const; |
| 130 | 124 |
| 131 const LayoutObject& m_object; | 125 const LayoutObject& m_object; |
| 132 PaintInfo m_paintInfo; | 126 PaintInfo m_paintInfo; |
| 133 std::unique_ptr<PaintInfo> m_filterPaintInfo; | 127 std::unique_ptr<PaintInfo> m_filterPaintInfo; |
| 134 LayoutSVGResourceFilter* m_filter; | 128 LayoutSVGResourceFilter* m_filter; |
| 135 LayoutSVGResourceClipper* m_clipper; | |
| 136 SVGClipPainter::ClipperState m_clipperState; | |
| 137 LayoutSVGResourceMasker* m_masker; | 129 LayoutSVGResourceMasker* m_masker; |
| 138 std::unique_ptr<CompositingRecorder> m_compositingRecorder; | 130 std::unique_ptr<CompositingRecorder> m_compositingRecorder; |
| 139 std::unique_ptr<ClipPathRecorder> m_clipPathRecorder; | 131 Optional<ClipPathClipper> m_clipPathClipper; |
| 140 std::unique_ptr<SVGFilterRecordingContext> m_filterRecordingContext; | 132 std::unique_ptr<SVGFilterRecordingContext> m_filterRecordingContext; |
| 141 #if ENABLE(ASSERT) | 133 #if ENABLE(ASSERT) |
| 142 bool m_applyClipMaskAndFilterIfNecessaryCalled; | 134 bool m_applyClipMaskAndFilterIfNecessaryCalled; |
| 143 #endif | 135 #endif |
| 144 }; | 136 }; |
| 145 | 137 |
| 146 } // namespace blink | 138 } // namespace blink |
| 147 | 139 |
| 148 #endif // SVGPaintContext_h | 140 #endif // SVGPaintContext_h |
| OLD | NEW |