Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: Source/core/paint/SVGPaintContext.cpp

Issue 967543002: [S.P.] Move svg mask painting to SVGMaskPainter (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: move drawMaskForRenderer too Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> 2 * Copyright (C) 2007, 2008 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) 2009 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
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 16 matching lines...) Expand all
27 27
28 #include "core/frame/FrameHost.h" 28 #include "core/frame/FrameHost.h"
29 #include "core/layout/Layer.h" 29 #include "core/layout/Layer.h"
30 #include "core/layout/PaintInfo.h" 30 #include "core/layout/PaintInfo.h"
31 #include "core/layout/svg/LayoutSVGResourceFilter.h" 31 #include "core/layout/svg/LayoutSVGResourceFilter.h"
32 #include "core/layout/svg/LayoutSVGResourceMasker.h" 32 #include "core/layout/svg/LayoutSVGResourceMasker.h"
33 #include "core/layout/svg/SVGLayoutSupport.h" 33 #include "core/layout/svg/SVGLayoutSupport.h"
34 #include "core/layout/svg/SVGResources.h" 34 #include "core/layout/svg/SVGResources.h"
35 #include "core/layout/svg/SVGResourcesCache.h" 35 #include "core/layout/svg/SVGResourcesCache.h"
36 #include "core/paint/RenderDrawingRecorder.h" 36 #include "core/paint/RenderDrawingRecorder.h"
37 #include "core/paint/SVGMaskPainter.h"
37 #include "platform/FloatConversion.h" 38 #include "platform/FloatConversion.h"
38 39
39 namespace blink { 40 namespace blink {
40 41
41 SVGPaintContext::~SVGPaintContext() 42 SVGPaintContext::~SVGPaintContext()
42 { 43 {
43 if (m_filter) { 44 if (m_filter) {
44 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)); 45 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object));
45 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)->filt er() == m_filter); 46 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)->filt er() == m_filter);
46 47
47 RenderDrawingRecorder recorder(m_originalPaintInfo->context, *m_object, DisplayItem::SVGFilter, LayoutRect::infiniteIntRect()); 48 RenderDrawingRecorder recorder(m_originalPaintInfo->context, *m_object, DisplayItem::SVGFilter, LayoutRect::infiniteIntRect());
48 m_filter->finishEffect(m_object, m_originalPaintInfo->context); 49 m_filter->finishEffect(m_object, m_originalPaintInfo->context);
49 50
50 // Reset the paint info after the filter effect has been completed. 51 // Reset the paint info after the filter effect has been completed.
51 // This isn't strictly required (e.g., m_paintInfo.rect is not used 52 // This isn't strictly required (e.g., m_paintInfo.rect is not used
52 // after this). 53 // after this).
53 m_paintInfo.context = m_originalPaintInfo->context; 54 m_paintInfo.context = m_originalPaintInfo->context;
54 m_paintInfo.rect = m_originalPaintInfo->rect; 55 m_paintInfo.rect = m_originalPaintInfo->rect;
55 } 56 }
56 57
57 if (m_masker) { 58 if (m_masker) {
58 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)); 59 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object));
59 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)->mask er() == m_masker); 60 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)->mask er() == m_masker);
60 m_masker->finishEffect(m_object, m_paintInfo.context); 61 SVGMaskPainter(*m_masker).finishEffect(m_object, m_paintInfo.context);
61 } 62 }
62 63
63 if (m_clipper) { 64 if (m_clipper) {
64 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)); 65 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object));
65 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)->clip per() == m_clipper); 66 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)->clip per() == m_clipper);
66 m_clipper->postApplyStatefulResource(m_object, m_paintInfo.context, m_cl ipperState); 67 m_clipper->postApplyStatefulResource(m_object, m_paintInfo.context, m_cl ipperState);
67 } 68 }
68 } 69 }
69 70
70 bool SVGPaintContext::applyClipMaskAndFilterIfNecessary() 71 bool SVGPaintContext::applyClipMaskAndFilterIfNecessary()
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 return false; 138 return false;
138 m_clipPathRecorder = adoptPtr(new ClipPathRecorder(*m_paintInfo.cont ext, m_object->displayItemClient(), clipPath->path(m_object->objectBoundingBox() ), clipPath->windRule())); 139 m_clipPathRecorder = adoptPtr(new ClipPathRecorder(*m_paintInfo.cont ext, m_object->displayItemClient(), clipPath->path(m_object->objectBoundingBox() ), clipPath->windRule()));
139 } 140 }
140 } 141 }
141 return true; 142 return true;
142 } 143 }
143 144
144 bool SVGPaintContext::applyMaskIfNecessary(SVGResources* resources) 145 bool SVGPaintContext::applyMaskIfNecessary(SVGResources* resources)
145 { 146 {
146 if (LayoutSVGResourceMasker* masker = resources ? resources->masker() : null ptr) { 147 if (LayoutSVGResourceMasker* masker = resources ? resources->masker() : null ptr) {
147 if (!masker->prepareEffect(m_object, m_paintInfo.context)) 148 if (!SVGMaskPainter(*masker).prepareEffect(m_object, m_paintInfo.context ))
148 return false; 149 return false;
149 m_masker = masker; 150 m_masker = masker;
150 } 151 }
151 return true; 152 return true;
152 } 153 }
153 154
154 bool SVGPaintContext::applyFilterIfNecessary(SVGResources* resources) 155 bool SVGPaintContext::applyFilterIfNecessary(SVGResources* resources)
155 { 156 {
156 if (!resources) { 157 if (!resources) {
157 if (m_object->style()->svgStyle().hasFilter()) 158 if (m_object->style()->svgStyle().hasFilter())
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 { 190 {
190 ASSERT(context); 191 ASSERT(context);
191 ASSERT(item); 192 ASSERT(item);
192 ASSERT(!item->needsLayout()); 193 ASSERT(!item->needsLayout());
193 194
194 PaintInfo info(context, LayoutRect::infiniteIntRect(), PaintPhaseForeground, PaintBehaviorNormal); 195 PaintInfo info(context, LayoutRect::infiniteIntRect(), PaintPhaseForeground, PaintBehaviorNormal);
195 item->paint(info, IntPoint()); 196 item->paint(info, IntPoint());
196 } 197 }
197 198
198 } // namespace blink 199 } // namespace blink
OLDNEW
« Source/core/paint/SVGMaskPainter.cpp ('K') | « Source/core/paint/SVGMaskPainter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698