Chromium Code Reviews| 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 27 matching lines...) Expand all Loading... | |
| 38 | 38 |
| 39 class LayoutObject; | 39 class LayoutObject; |
| 40 class LayoutSVGResourceFilter; | 40 class LayoutSVGResourceFilter; |
| 41 class LayoutSVGResourceMasker; | 41 class LayoutSVGResourceMasker; |
| 42 class SVGResources; | 42 class SVGResources; |
| 43 | 43 |
| 44 class SVGPaintContext { | 44 class SVGPaintContext { |
| 45 STACK_ALLOCATED(); | 45 STACK_ALLOCATED(); |
| 46 public: | 46 public: |
| 47 SVGPaintContext(const LayoutObject& object, const PaintInfo& paintInfo) | 47 SVGPaintContext(const LayoutObject& object, const PaintInfo& paintInfo) |
| 48 : m_object(&object) | 48 : m_object(object) |
| 49 , m_paintInfo(paintInfo) | 49 , m_paintInfo(paintInfo) |
| 50 , m_originalPaintInfo(&paintInfo) | |
| 51 , m_filter(nullptr) | 50 , m_filter(nullptr) |
| 52 , m_clipper(nullptr) | 51 , m_clipper(nullptr) |
| 53 , m_clipperState(SVGClipPainter::ClipperNotApplied) | 52 , m_clipperState(SVGClipPainter::ClipperNotApplied) |
| 54 , m_masker(nullptr) | 53 , m_masker(nullptr) |
| 55 #if ENABLE(ASSERT) | 54 #if ENABLE(ASSERT) |
| 56 , m_applyClipMaskAndFilterIfNecessaryCalled(false) | 55 , m_applyClipMaskAndFilterIfNecessaryCalled(false) |
| 57 #endif | 56 #endif |
| 58 { } | 57 { } |
| 59 | 58 |
| 60 ~SVGPaintContext(); | 59 ~SVGPaintContext(); |
| 61 | 60 |
| 62 PaintInfo& paintInfo() { return m_paintInfo; } | 61 PaintInfo& paintInfo() { return m_filterPaintInfo ? *m_filterPaintInfo : m_p aintInfo; } |
| 63 | 62 |
| 64 // Return true if these operations aren't necessary or if they are successfu lly applied. | 63 // Return true if these operations aren't necessary or if they are successfu lly applied. |
| 65 bool applyClipMaskAndFilterIfNecessary(); | 64 bool applyClipMaskAndFilterIfNecessary(); |
| 66 | 65 |
| 67 static void paintSubtree(GraphicsContext*, const LayoutObject*); | 66 static void paintSubtree(GraphicsContext&, const LayoutObject*); |
| 68 | 67 |
| 69 // TODO(fs): This functions feels a bit misplaced (we don't want this to | 68 // TODO(fs): This functions feels a bit misplaced (we don't want this to |
| 70 // turn into the new kitchen sink). Move it if a better location surfaces. | 69 // turn into the new kitchen sink). Move it if a better location surfaces. |
| 71 static bool paintForLayoutObject(const PaintInfo&, const ComputedStyle&, con st LayoutObject&, LayoutSVGResourceMode, SkPaint&, const AffineTransform* additi onalPaintServerTransform = nullptr); | 70 static bool paintForLayoutObject(const PaintInfo&, const ComputedStyle&, con st LayoutObject&, LayoutSVGResourceMode, SkPaint&, const AffineTransform* additi onalPaintServerTransform = nullptr); |
| 72 | 71 |
| 73 private: | 72 private: |
| 74 void applyCompositingIfNecessary(); | 73 void applyCompositingIfNecessary(); |
| 75 | 74 |
| 76 // Return true if no clipping is necessary or if the clip is successfully ap plied. | 75 // Return true if no clipping is necessary or if the clip is successfully ap plied. |
| 77 bool applyClipIfNecessary(SVGResources*); | 76 bool applyClipIfNecessary(SVGResources*); |
| 78 | 77 |
| 79 // Return true if no masking is necessary or if the mask is successfully app lied. | 78 // Return true if no masking is necessary or if the mask is successfully app lied. |
| 80 bool applyMaskIfNecessary(SVGResources*); | 79 bool applyMaskIfNecessary(SVGResources*); |
| 81 | 80 |
| 82 // Return true if no filtering is necessary or if the filter is successfully applied. | 81 // Return true if no filtering is necessary or if the filter is successfully applied. |
| 83 bool applyFilterIfNecessary(SVGResources*); | 82 bool applyFilterIfNecessary(SVGResources*); |
| 84 | 83 |
| 85 bool isIsolationInstalled() const; | 84 bool isIsolationInstalled() const; |
| 86 | 85 |
| 87 const LayoutObject* m_object; | 86 const LayoutObject& m_object; |
| 88 PaintInfo m_paintInfo; | 87 PaintInfo m_paintInfo; |
| 89 const PaintInfo* m_originalPaintInfo; | 88 OwnPtr<PaintInfo> m_filterPaintInfo; |
|
Xianzhu
2015/12/10 16:55:36
We no longer allow changing the context field of P
| |
| 90 LayoutSVGResourceFilter* m_filter; | 89 LayoutSVGResourceFilter* m_filter; |
| 91 LayoutSVGResourceClipper* m_clipper; | 90 LayoutSVGResourceClipper* m_clipper; |
| 92 SVGClipPainter::ClipperState m_clipperState; | 91 SVGClipPainter::ClipperState m_clipperState; |
| 93 LayoutSVGResourceMasker* m_masker; | 92 LayoutSVGResourceMasker* m_masker; |
| 94 OwnPtr<CompositingRecorder> m_compositingRecorder; | 93 OwnPtr<CompositingRecorder> m_compositingRecorder; |
| 95 OwnPtr<ClipPathRecorder> m_clipPathRecorder; | 94 OwnPtr<ClipPathRecorder> m_clipPathRecorder; |
| 96 OwnPtr<SVGFilterRecordingContext> m_filterRecordingContext; | 95 OwnPtr<SVGFilterRecordingContext> m_filterRecordingContext; |
| 97 #if ENABLE(ASSERT) | 96 #if ENABLE(ASSERT) |
| 98 bool m_applyClipMaskAndFilterIfNecessaryCalled; | 97 bool m_applyClipMaskAndFilterIfNecessaryCalled; |
| 99 #endif | 98 #endif |
| 100 }; | 99 }; |
| 101 | 100 |
| 102 } // namespace blink | 101 } // namespace blink |
| 103 | 102 |
| 104 #endif // SVGPaintContext_h | 103 #endif // SVGPaintContext_h |
| OLD | NEW |