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

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

Issue 2889653002: Remove cullRect() from PaintOpBuffer. (Closed)
Patch Set: movecullrect2 rebase-once-and-for-all Created 3 years, 7 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } else { 115 } else {
116 // A viewbox overrides patternContentUnits, per spec. 116 // A viewbox overrides patternContentUnits, per spec.
117 if (attributes.PatternContentUnits() == 117 if (attributes.PatternContentUnits() ==
118 SVGUnitTypes::kSvgUnitTypeObjectboundingbox) 118 SVGUnitTypes::kSvgUnitTypeObjectboundingbox)
119 tile_transform.Scale(client_bounding_box.Width(), 119 tile_transform.Scale(client_bounding_box.Width(),
120 client_bounding_box.Height()); 120 client_bounding_box.Height());
121 } 121 }
122 122
123 std::unique_ptr<PatternData> pattern_data = WTF::WrapUnique(new PatternData); 123 std::unique_ptr<PatternData> pattern_data = WTF::WrapUnique(new PatternData);
124 pattern_data->pattern = Pattern::CreatePaintRecordPattern( 124 pattern_data->pattern = Pattern::CreatePaintRecordPattern(
125 AsPaintRecord(tile_bounds, tile_transform)); 125 AsPaintRecord(tile_bounds.Size(), tile_transform),
126 FloatRect(FloatPoint(), tile_bounds.Size()));
126 127
127 // Compute pattern space transformation. 128 // Compute pattern space transformation.
128 pattern_data->transform.Translate(tile_bounds.X(), tile_bounds.Y()); 129 pattern_data->transform.Translate(tile_bounds.X(), tile_bounds.Y());
129 pattern_data->transform.PreMultiply(attributes.PatternTransform()); 130 pattern_data->transform.PreMultiply(attributes.PatternTransform());
130 131
131 return pattern_data; 132 return pattern_data;
132 } 133 }
133 134
134 SVGPaintServer LayoutSVGResourcePattern::PreparePaintServer( 135 SVGPaintServer LayoutSVGResourcePattern::PreparePaintServer(
135 const LayoutObject& object) { 136 const LayoutObject& object) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 if (linked_resource == expected_layout_object) 190 if (linked_resource == expected_layout_object)
190 return expected_layout_object; 191 return expected_layout_object;
191 content_layout_object = linked_resource; 192 content_layout_object = linked_resource;
192 } 193 }
193 // There was a cycle, just use this resource as the "content resource" even 194 // There was a cycle, just use this resource as the "content resource" even
194 // though it will be empty (have no children). 195 // though it will be empty (have no children).
195 return this; 196 return this;
196 } 197 }
197 198
198 sk_sp<PaintRecord> LayoutSVGResourcePattern::AsPaintRecord( 199 sk_sp<PaintRecord> LayoutSVGResourcePattern::AsPaintRecord(
199 const FloatRect& tile_bounds, 200 const FloatSize& size,
200 const AffineTransform& tile_transform) const { 201 const AffineTransform& tile_transform) const {
201 DCHECK(!should_collect_pattern_attributes_); 202 DCHECK(!should_collect_pattern_attributes_);
202 203
203 AffineTransform content_transform; 204 AffineTransform content_transform;
204 if (Attributes().PatternContentUnits() == 205 if (Attributes().PatternContentUnits() ==
205 SVGUnitTypes::kSvgUnitTypeObjectboundingbox) 206 SVGUnitTypes::kSvgUnitTypeObjectboundingbox)
206 content_transform = tile_transform; 207 content_transform = tile_transform;
207 208
208 FloatRect bounds(FloatPoint(), tile_bounds.Size()); 209 FloatRect bounds(FloatPoint(), size);
209 const LayoutSVGResourceContainer* pattern_layout_object = 210 const LayoutSVGResourceContainer* pattern_layout_object =
210 ResolveContentElement(); 211 ResolveContentElement();
211 DCHECK(pattern_layout_object); 212 DCHECK(pattern_layout_object);
212 DCHECK(!pattern_layout_object->NeedsLayout()); 213 DCHECK(!pattern_layout_object->NeedsLayout());
213 214
214 SubtreeContentTransformScope content_transform_scope(content_transform); 215 SubtreeContentTransformScope content_transform_scope(content_transform);
215 216
216 PaintRecordBuilder builder(bounds); 217 PaintRecordBuilder builder(bounds);
217 for (LayoutObject* child = pattern_layout_object->FirstChild(); child; 218 for (LayoutObject* child = pattern_layout_object->FirstChild(); child;
218 child = child->NextSibling()) 219 child = child->NextSibling())
219 SVGPaintContext::PaintResourceSubtree(builder.Context(), child); 220 SVGPaintContext::PaintResourceSubtree(builder.Context(), child);
220 PaintRecorder paint_recorder; 221 PaintRecorder paint_recorder;
221 PaintCanvas* canvas = paint_recorder.beginRecording(bounds); 222 PaintCanvas* canvas = paint_recorder.beginRecording(bounds);
222 canvas->save(); 223 canvas->save();
223 canvas->concat(AffineTransformToSkMatrix(tile_transform)); 224 canvas->concat(AffineTransformToSkMatrix(tile_transform));
224 builder.EndRecording(*canvas); 225 builder.EndRecording(*canvas);
225 canvas->restore(); 226 canvas->restore();
226 return paint_recorder.finishRecordingAsPicture(); 227 return paint_recorder.finishRecordingAsPicture();
227 } 228 }
228 229
229 } // namespace blink 230 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698