| 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" | 28 #include "core/layout/svg/LayoutSVGResourceClipper.h" |
| 29 #include "core/layout/svg/LayoutSVGResourcePaintServer.h" | 29 #include "core/layout/svg/LayoutSVGResourcePaintServer.h" |
| 30 #include "core/paint/ObjectPaintProperties.h" |
| 30 #include "core/paint/PaintInfo.h" | 31 #include "core/paint/PaintInfo.h" |
| 31 #include "core/paint/SVGClipPainter.h" | 32 #include "core/paint/SVGClipPainter.h" |
| 32 #include "core/paint/SVGFilterPainter.h" | 33 #include "core/paint/SVGFilterPainter.h" |
| 34 #include "core/paint/TransformRecorder.h" |
| 33 #include "platform/graphics/paint/ClipPathRecorder.h" | 35 #include "platform/graphics/paint/ClipPathRecorder.h" |
| 34 #include "platform/graphics/paint/CompositingRecorder.h" | 36 #include "platform/graphics/paint/CompositingRecorder.h" |
| 37 #include "platform/graphics/paint/ScopedPaintChunkProperties.h" |
| 35 #include "platform/transforms/AffineTransform.h" | 38 #include "platform/transforms/AffineTransform.h" |
| 36 #include <memory> | 39 #include <memory> |
| 37 | 40 |
| 38 namespace blink { | 41 namespace blink { |
| 39 | 42 |
| 40 class LayoutObject; | 43 class LayoutObject; |
| 41 class LayoutSVGResourceFilter; | 44 class LayoutSVGResourceFilter; |
| 42 class LayoutSVGResourceMasker; | 45 class LayoutSVGResourceMasker; |
| 43 class SVGResources; | 46 class SVGResources; |
| 44 | 47 |
| 48 // This class hooks up the correct paint property transform node when spv2 is en
abled, and otherwise |
| 49 // works like a TransformRecorder which emits Transform display items for spv1. |
| 50 class SVGTransformContext : public TransformRecorder { |
| 51 STACK_ALLOCATED(); |
| 52 public: |
| 53 SVGTransformContext(GraphicsContext& context, const LayoutObject& object, co
nst AffineTransform& transform) |
| 54 : TransformRecorder(context, object, transform) |
| 55 { |
| 56 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 57 const auto* objectProperties = object.objectPaintProperties(); |
| 58 if (!objectProperties) |
| 59 return; |
| 60 if (object.isSVGRoot()) { |
| 61 // If a transform exists, we can rely on a layer existing to app
ly it. |
| 62 DCHECK(!objectProperties || !objectProperties->transform() || ob
ject.hasLayer()); |
| 63 if (objectProperties->svgLocalToBorderBoxTransform()) { |
| 64 // FIXME(pdr): Enable the following DCHECK once the pixel sn
apping logic has |
| 65 // been included in svgLocalToBorderBox. |
| 66 // DCHECK(objectProperties->svgLocalToBorderBoxTransform()->
matrix() == transform.toTransformationMatrix()); |
| 67 auto& paintController = context.getPaintController(); |
| 68 PaintChunkProperties properties(paintController.currentPaint
ChunkProperties()); |
| 69 properties.transform = objectProperties->svgLocalToBorderBox
Transform(); |
| 70 m_transformPropertyScope.emplace(paintController, properties
); |
| 71 } |
| 72 } else { |
| 73 DCHECK(object.isSVG()); |
| 74 // Should only be used by LayoutSVGRoot. |
| 75 DCHECK(!objectProperties->svgLocalToBorderBoxTransform()); |
| 76 |
| 77 if (objectProperties->transform()) { |
| 78 DCHECK(objectProperties->transform()->matrix() == transform.
toTransformationMatrix()); |
| 79 auto& paintController = context.getPaintController(); |
| 80 PaintChunkProperties properties(paintController.currentPaint
ChunkProperties()); |
| 81 properties.transform = objectProperties->transform(); |
| 82 m_transformPropertyScope.emplace(paintController, properties
); |
| 83 } |
| 84 } |
| 85 } |
| 86 } |
| 87 private: |
| 88 Optional<ScopedPaintChunkProperties> m_transformPropertyScope; |
| 89 }; |
| 90 |
| 45 class SVGPaintContext { | 91 class SVGPaintContext { |
| 46 STACK_ALLOCATED(); | 92 STACK_ALLOCATED(); |
| 47 public: | 93 public: |
| 48 SVGPaintContext(const LayoutObject& object, const PaintInfo& paintInfo) | 94 SVGPaintContext(const LayoutObject& object, const PaintInfo& paintInfo) |
| 49 : m_object(object) | 95 : m_object(object) |
| 50 , m_paintInfo(paintInfo) | 96 , m_paintInfo(paintInfo) |
| 51 , m_filter(nullptr) | 97 , m_filter(nullptr) |
| 52 , m_clipper(nullptr) | 98 , m_clipper(nullptr) |
| 53 , m_clipperState(SVGClipPainter::ClipperNotApplied) | 99 , m_clipperState(SVGClipPainter::ClipperNotApplied) |
| 54 , m_masker(nullptr) | 100 , m_masker(nullptr) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 std::unique_ptr<ClipPathRecorder> m_clipPathRecorder; | 141 std::unique_ptr<ClipPathRecorder> m_clipPathRecorder; |
| 96 std::unique_ptr<SVGFilterRecordingContext> m_filterRecordingContext; | 142 std::unique_ptr<SVGFilterRecordingContext> m_filterRecordingContext; |
| 97 #if ENABLE(ASSERT) | 143 #if ENABLE(ASSERT) |
| 98 bool m_applyClipMaskAndFilterIfNecessaryCalled; | 144 bool m_applyClipMaskAndFilterIfNecessaryCalled; |
| 99 #endif | 145 #endif |
| 100 }; | 146 }; |
| 101 | 147 |
| 102 } // namespace blink | 148 } // namespace blink |
| 103 | 149 |
| 104 #endif // SVGPaintContext_h | 150 #endif // SVGPaintContext_h |
| OLD | NEW |