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

Side by Side Diff: Source/core/layout/svg/LayoutSVGResourceClipper.cpp

Issue 1048223002: Add DisplayItemListPictureRecorder (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/layout/svg/LayoutSVGResourceMasker.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
5 * Copyright (C) 2011 Dirk Schulze <krit@webkit.org> 5 * Copyright (C) 2011 Dirk Schulze <krit@webkit.org>
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 18 matching lines...) Expand all
29 #include "core/layout/PaintInfo.h" 29 #include "core/layout/PaintInfo.h"
30 #include "core/layout/svg/SVGLayoutSupport.h" 30 #include "core/layout/svg/SVGLayoutSupport.h"
31 #include "core/layout/svg/SVGResources.h" 31 #include "core/layout/svg/SVGResources.h"
32 #include "core/layout/svg/SVGResourcesCache.h" 32 #include "core/layout/svg/SVGResourcesCache.h"
33 #include "core/paint/CompositingRecorder.h" 33 #include "core/paint/CompositingRecorder.h"
34 #include "core/paint/TransformRecorder.h" 34 #include "core/paint/TransformRecorder.h"
35 #include "core/svg/SVGUseElement.h" 35 #include "core/svg/SVGUseElement.h"
36 #include "platform/RuntimeEnabledFeatures.h" 36 #include "platform/RuntimeEnabledFeatures.h"
37 #include "platform/graphics/paint/ClipPathDisplayItem.h" 37 #include "platform/graphics/paint/ClipPathDisplayItem.h"
38 #include "platform/graphics/paint/CompositingDisplayItem.h" 38 #include "platform/graphics/paint/CompositingDisplayItem.h"
39 #include "platform/graphics/paint/DisplayItemList.h" 39 #include "platform/graphics/paint/DisplayItemListPictureRecorder.h"
40 #include "platform/graphics/paint/DrawingDisplayItem.h" 40 #include "platform/graphics/paint/DrawingDisplayItem.h"
41 #include "third_party/skia/include/core/SkPicture.h" 41 #include "third_party/skia/include/core/SkPicture.h"
42 42
43 namespace blink { 43 namespace blink {
44 44
45 LayoutSVGResourceClipper::LayoutSVGResourceClipper(SVGClipPathElement* node) 45 LayoutSVGResourceClipper::LayoutSVGResourceClipper(SVGClipPathElement* node)
46 : LayoutSVGResourceContainer(node) 46 : LayoutSVGResourceContainer(node)
47 , m_inClipExpansion(false) 47 , m_inClipExpansion(false)
48 { 48 {
49 } 49 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 if (m_clipContentPicture) 147 if (m_clipContentPicture)
148 return m_clipContentPicture; 148 return m_clipContentPicture;
149 149
150 SubtreeContentTransformScope contentTransformScope(contentTransformation); 150 SubtreeContentTransformScope contentTransformScope(contentTransformation);
151 151
152 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat es) to avoid the intersection 152 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat es) to avoid the intersection
153 // with local clips/mask, which may yield incorrect results when mixing obje ctBoundingBox and 153 // with local clips/mask, which may yield incorrect results when mixing obje ctBoundingBox and
154 // userSpaceOnUse units (http://crbug.com/294900). 154 // userSpaceOnUse units (http://crbug.com/294900).
155 FloatRect bounds = strokeBoundingBox(); 155 FloatRect bounds = strokeBoundingBox();
156 156
157 OwnPtr<DisplayItemList> displayItemList; 157 DisplayItemListPictureRecorder pictureRecorder(bounds);
chrishtr 2015/03/31 21:52:51 This is getting a little out of hand with lots of
158 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) 158 GraphicsContext& context = pictureRecorder.context();
159 displayItemList = DisplayItemList::create();
160 GraphicsContext context(nullptr, displayItemList.get());
161 context.beginRecording(bounds);
162 159
163 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element() ); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement )) { 160 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element() ); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement )) {
164 LayoutObject* layoutObject = childElement->layoutObject(); 161 LayoutObject* layoutObject = childElement->layoutObject();
165 if (!layoutObject) 162 if (!layoutObject)
166 continue; 163 continue;
167 164
168 const ComputedStyle* style = layoutObject->style(); 165 const ComputedStyle* style = layoutObject->style();
169 if (!style || style->display() == NONE || style->visibility() != VISIBLE ) 166 if (!style || style->display() == NONE || style->visibility() != VISIBLE )
170 continue; 167 continue;
171 168
(...skipping 19 matching lines...) Expand all
191 188
192 // Switch to a paint behavior where all children of this <clipPath> will be laid out using special constraints: 189 // Switch to a paint behavior where all children of this <clipPath> will be laid out using special constraints:
193 // - fill-opacity/stroke-opacity/opacity set to 1 190 // - fill-opacity/stroke-opacity/opacity set to 1
194 // - masker/filter not applied when laying out the children 191 // - masker/filter not applied when laying out the children
195 // - fill is set to the initial fill paint server (solid, black) 192 // - fill is set to the initial fill paint server (solid, black)
196 // - stroke is set to the initial stroke paint server (none) 193 // - stroke is set to the initial stroke paint server (none)
197 PaintInfo info(&context, LayoutRect::infiniteIntRect(), PaintPhaseForegr ound, PaintBehaviorRenderingClipPathAsMask); 194 PaintInfo info(&context, LayoutRect::infiniteIntRect(), PaintPhaseForegr ound, PaintBehaviorRenderingClipPathAsMask);
198 layoutObject->paint(info, IntPoint()); 195 layoutObject->paint(info, IntPoint());
199 } 196 }
200 197
201 if (displayItemList) 198 m_clipContentPicture = pictureRecorder.endRecording();
202 displayItemList->replay(&context);
203 m_clipContentPicture = context.endRecording();
204 return m_clipContentPicture; 199 return m_clipContentPicture;
205 } 200 }
206 201
207 void LayoutSVGResourceClipper::calculateClipContentPaintInvalidationRect() 202 void LayoutSVGResourceClipper::calculateClipContentPaintInvalidationRect()
208 { 203 {
209 // This is a rough heuristic to appraise the clip size and doesn't consider clip on clip. 204 // This is a rough heuristic to appraise the clip size and doesn't consider clip on clip.
210 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element() ); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement )) { 205 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element() ); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement )) {
211 LayoutObject* layoutObject = childElement->layoutObject(); 206 LayoutObject* layoutObject = childElement->layoutObject();
212 if (!layoutObject) 207 if (!layoutObject)
213 continue; 208 continue;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 AffineTransform transform; 264 AffineTransform transform;
270 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); 265 transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
271 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight()); 266 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight());
272 return transform.mapRect(m_clipBoundaries); 267 return transform.mapRect(m_clipBoundaries);
273 } 268 }
274 269
275 return m_clipBoundaries; 270 return m_clipBoundaries;
276 } 271 }
277 272
278 } 273 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/layout/svg/LayoutSVGResourceMasker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698