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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePattern.cpp

Issue 1789063005: Add sk_sp helpers and switch Blink SkShader clients to the new APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fromSkSp, review comments Created 4 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) 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
4 * Copyright 2014 The Chromium Authors. All rights reserved. 4 * Copyright 2014 The Chromium Authors. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 break; 172 break;
173 if (linkedResource == expectedLayoutObject) 173 if (linkedResource == expectedLayoutObject)
174 return expectedLayoutObject; 174 return expectedLayoutObject;
175 contentLayoutObject = linkedResource; 175 contentLayoutObject = linkedResource;
176 } 176 }
177 // There was a cycle, just use this resource as the "content resource" even 177 // There was a cycle, just use this resource as the "content resource" even
178 // though it will be empty (have no children). 178 // though it will be empty (have no children).
179 return this; 179 return this;
180 } 180 }
181 181
182 PassRefPtr<const SkPicture> LayoutSVGResourcePattern::asPicture(const FloatRect& tileBounds, 182 PassRefPtr<SkPicture> LayoutSVGResourcePattern::asPicture(const FloatRect& tileB ounds,
183 const AffineTransform& tileTransform) const 183 const AffineTransform& tileTransform) const
184 { 184 {
185 ASSERT(!m_shouldCollectPatternAttributes); 185 ASSERT(!m_shouldCollectPatternAttributes);
186 186
187 AffineTransform contentTransform; 187 AffineTransform contentTransform;
188 if (attributes().patternContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECT BOUNDINGBOX) 188 if (attributes().patternContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECT BOUNDINGBOX)
189 contentTransform = tileTransform; 189 contentTransform = tileTransform;
190 190
191 FloatRect bounds(FloatPoint(), tileBounds.size()); 191 FloatRect bounds(FloatPoint(), tileBounds.size());
192 SkPictureBuilder pictureBuilder(bounds); 192 SkPictureBuilder pictureBuilder(bounds);
193 193
194 const LayoutSVGResourceContainer* patternLayoutObject = resolveContentElemen t(); 194 const LayoutSVGResourceContainer* patternLayoutObject = resolveContentElemen t();
195 ASSERT(patternLayoutObject && !patternLayoutObject->needsLayout()); 195 ASSERT(patternLayoutObject && !patternLayoutObject->needsLayout());
196 196
197 SubtreeContentTransformScope contentTransformScope(contentTransform); 197 SubtreeContentTransformScope contentTransformScope(contentTransform);
198 198
199 { 199 {
200 TransformRecorder transformRecorder(pictureBuilder.context(), *patternLa youtObject, tileTransform); 200 TransformRecorder transformRecorder(pictureBuilder.context(), *patternLa youtObject, tileTransform);
201 for (LayoutObject* child = patternLayoutObject->firstChild(); child; chi ld = child->nextSibling()) 201 for (LayoutObject* child = patternLayoutObject->firstChild(); child; chi ld = child->nextSibling())
202 SVGPaintContext::paintSubtree(pictureBuilder.context(), child); 202 SVGPaintContext::paintSubtree(pictureBuilder.context(), child);
203 } 203 }
204 204
205 return pictureBuilder.endRecording(); 205 return pictureBuilder.endRecording();
206 } 206 }
207 207
208 } // namespace blink 208 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698