| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 SVGClipPainter_h | 5 #ifndef SVGClipPainter_h |
| 6 #define SVGClipPainter_h | 6 #define SVGClipPainter_h |
| 7 | 7 |
| 8 #include "platform/geometry/FloatRect.h" | 8 #include "platform/geometry/FloatRect.h" |
| 9 #include "platform/graphics/paint/DisplayItemClient.h" | 9 #include "platform/graphics/paint/DisplayItemClient.h" |
| 10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class AffineTransform; | 14 class AffineTransform; |
| 15 class GraphicsContext; | 15 class GraphicsContext; |
| 16 class LayoutObject; | 16 class LayoutObject; |
| 17 class LayoutSVGResourceClipper; | 17 class LayoutSVGResourceClipper; |
| 18 | 18 |
| 19 enum class ClipperState; |
| 20 |
| 19 class SVGClipPainter { | 21 class SVGClipPainter { |
| 20 STACK_ALLOCATED(); | 22 STACK_ALLOCATED(); |
| 21 public: | 23 public: |
| 22 enum ClipperState { | |
| 23 ClipperNotApplied, | |
| 24 ClipperAppliedPath, | |
| 25 ClipperAppliedMask | |
| 26 }; | |
| 27 | |
| 28 SVGClipPainter(LayoutSVGResourceClipper& clip) : m_clip(clip) { } | 24 SVGClipPainter(LayoutSVGResourceClipper& clip) : m_clip(clip) { } |
| 29 | 25 |
| 30 bool prepareEffect(const LayoutObject&, const FloatRect&, const FloatRect&,
const FloatPoint&, GraphicsContext&, ClipperState&); | 26 bool prepareEffect(const LayoutObject&, const FloatRect&, const FloatRect&,
const FloatPoint&, GraphicsContext&, ClipperState&); |
| 31 void finishEffect(const LayoutObject&, GraphicsContext&, ClipperState&); | 27 void finishEffect(const LayoutObject&, GraphicsContext&, ClipperState&); |
| 32 | 28 |
| 33 private: | 29 private: |
| 34 // Return false if there is a problem drawing the mask. | 30 // Return false if there is a problem drawing the mask. |
| 35 bool drawClipAsMask(GraphicsContext&, const LayoutObject&, const FloatRect&
targetBoundingBox, | 31 bool drawClipAsMask(GraphicsContext&, const LayoutObject&, const FloatRect&
targetBoundingBox, |
| 36 const FloatRect& targetPaintInvalidationRect, const AffineTransform&, co
nst FloatPoint&); | 32 const FloatRect& targetPaintInvalidationRect, const AffineTransform&, co
nst FloatPoint&); |
| 37 | 33 |
| 38 LayoutSVGResourceClipper& m_clip; | 34 LayoutSVGResourceClipper& m_clip; |
| 39 }; | 35 }; |
| 40 | 36 |
| 41 } // namespace blink | 37 } // namespace blink |
| 42 | 38 |
| 43 #endif // SVGClipPainter_h | 39 #endif // SVGClipPainter_h |
| OLD | NEW |