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

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

Issue 1160183003: Use SkPictureBuilder in SVGShapePainter, and generalize SkPictureBuilder. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 if (!context->displayItemList()->displayItemConstructionIsDisabled()) 125 if (!context->displayItemList()->displayItemConstructionIsDisabled())
126 context->displayItemList()->add(BeginClipPathDisplayItem::create(lay outObject, clipPath)); 126 context->displayItemList()->add(BeginClipPathDisplayItem::create(lay outObject, clipPath));
127 } else { 127 } else {
128 BeginClipPathDisplayItem clipPathDisplayItem(layoutObject, clipPath); 128 BeginClipPathDisplayItem clipPathDisplayItem(layoutObject, clipPath);
129 clipPathDisplayItem.replay(*context); 129 clipPathDisplayItem.replay(*context);
130 } 130 }
131 131
132 return true; 132 return true;
133 } 133 }
134 134
135 PassRefPtr<const SkPicture> LayoutSVGResourceClipper::createContentPicture(Affin eTransform& contentTransformation, const FloatRect& targetBoundingBox) 135 PassRefPtr<const SkPicture> LayoutSVGResourceClipper::createContentPicture(Affin eTransform& contentTransformation, const FloatRect& targetBoundingBox,
136 GraphicsContext* context)
136 { 137 {
137 ASSERT(frame()); 138 ASSERT(frame());
138 139
139 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { 140 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
140 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox .y()); 141 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox .y());
141 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB oundingBox.height()); 142 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB oundingBox.height());
142 } 143 }
143 144
144 if (m_clipContentPicture) 145 if (m_clipContentPicture)
145 return m_clipContentPicture; 146 return m_clipContentPicture;
146 147
147 SubtreeContentTransformScope contentTransformScope(contentTransformation); 148 SubtreeContentTransformScope contentTransformScope(contentTransformation);
148 149
149 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat es) to avoid the intersection 150 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat es) to avoid the intersection
150 // with local clips/mask, which may yield incorrect results when mixing obje ctBoundingBox and 151 // with local clips/mask, which may yield incorrect results when mixing obje ctBoundingBox and
151 // userSpaceOnUse units (http://crbug.com/294900). 152 // userSpaceOnUse units (http://crbug.com/294900).
152 FloatRect bounds = strokeBoundingBox(); 153 FloatRect bounds = strokeBoundingBox();
153 154
154 SkPictureBuilder pictureBuilder(bounds); 155 SkPictureBuilder pictureBuilder(bounds, nullptr, context);
155 156
156 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element() ); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement )) { 157 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element() ); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement )) {
157 LayoutObject* layoutObject = childElement->layoutObject(); 158 LayoutObject* layoutObject = childElement->layoutObject();
158 if (!layoutObject) 159 if (!layoutObject)
159 continue; 160 continue;
160 161
161 const ComputedStyle* style = layoutObject->style(); 162 const ComputedStyle* style = layoutObject->style();
162 if (!style || style->display() == NONE || style->visibility() != VISIBLE ) 163 if (!style || style->display() == NONE || style->visibility() != VISIBLE )
163 continue; 164 continue;
164 165
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 AffineTransform transform; 255 AffineTransform transform;
255 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); 256 transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
256 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight()); 257 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight());
257 return transform.mapRect(m_clipBoundaries); 258 return transform.mapRect(m_clipBoundaries);
258 } 259 }
259 260
260 return m_clipBoundaries; 261 return m_clipBoundaries;
261 } 262 }
262 263
263 } 264 }
OLDNEW
« no previous file with comments | « Source/core/layout/svg/LayoutSVGResourceClipper.h ('k') | Source/core/layout/svg/LayoutSVGResourceMasker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698