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

Side by Side Diff: Source/core/rendering/svg/RenderSVGResourceClipper.cpp

Issue 666403002: Decouple content transform fiddling from SVGRenderingContext::renderSubtree (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 { 222 {
223 ASSERT(context); 223 ASSERT(context);
224 224
225 AffineTransform contentTransformation; 225 AffineTransform contentTransformation;
226 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { 226 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
227 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox .y()); 227 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox .y());
228 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB oundingBox.height()); 228 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB oundingBox.height());
229 context->concatCTM(contentTransformation); 229 context->concatCTM(contentTransformation);
230 } 230 }
231 231
232 if (!m_clipContentDisplayList) 232 if (!m_clipContentDisplayList) {
233 createDisplayList(context, contentTransformation); 233 SubtreeContentTransformScope contentTransformScope(contentTransformation );
234 createDisplayList(context);
235 }
234 236
235 ASSERT(m_clipContentDisplayList); 237 ASSERT(m_clipContentDisplayList);
236 context->drawDisplayList(m_clipContentDisplayList.get()); 238 context->drawDisplayList(m_clipContentDisplayList.get());
237 } 239 }
238 240
239 void RenderSVGResourceClipper::createDisplayList(GraphicsContext* context, 241 void RenderSVGResourceClipper::createDisplayList(GraphicsContext* context)
240 const AffineTransform& contentTransformation)
241 { 242 {
242 ASSERT(context); 243 ASSERT(context);
243 ASSERT(frame()); 244 ASSERT(frame());
244 245
245 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat es) to avoid the intersection 246 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat es) to avoid the intersection
246 // with local clips/mask, which may yield incorrect results when mixing obje ctBoundingBox and 247 // with local clips/mask, which may yield incorrect results when mixing obje ctBoundingBox and
247 // userSpaceOnUse units (http://crbug.com/294900). 248 // userSpaceOnUse units (http://crbug.com/294900).
248 FloatRect bounds = strokeBoundingBox(); 249 FloatRect bounds = strokeBoundingBox();
249 context->beginRecording(bounds); 250 context->beginRecording(bounds);
250 251
(...skipping 27 matching lines...) Expand all
278 279
279 // Only shapes, paths and texts are allowed for clipping. 280 // Only shapes, paths and texts are allowed for clipping.
280 if (!renderer->isSVGShape() && !renderer->isSVGText()) 281 if (!renderer->isSVGShape() && !renderer->isSVGText())
281 continue; 282 continue;
282 283
283 context->setFillRule(newClipRule); 284 context->setFillRule(newClipRule);
284 285
285 if (isUseElement) 286 if (isUseElement)
286 renderer = childElement->renderer(); 287 renderer = childElement->renderer();
287 288
288 SVGRenderingContext::renderSubtree(context, renderer, contentTransformat ion); 289 SVGRenderingContext::renderSubtree(context, renderer);
289 } 290 }
290 291
291 frame()->view()->setPaintBehavior(oldBehavior); 292 frame()->view()->setPaintBehavior(oldBehavior);
292 293
293 m_clipContentDisplayList = context->endRecording(); 294 m_clipContentDisplayList = context->endRecording();
294 } 295 }
295 296
296 void RenderSVGResourceClipper::calculateClipContentPaintInvalidationRect() 297 void RenderSVGResourceClipper::calculateClipContentPaintInvalidationRect()
297 { 298 {
298 // This is a rough heuristic to appraise the clip size and doesn't consider clip on clip. 299 // This is a rough heuristic to appraise the clip size and doesn't consider clip on clip.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 AffineTransform transform; 359 AffineTransform transform;
359 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); 360 transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
360 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight()); 361 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight());
361 return transform.mapRect(m_clipBoundaries); 362 return transform.mapRect(m_clipBoundaries);
362 } 363 }
363 364
364 return m_clipBoundaries; 365 return m_clipBoundaries;
365 } 366 }
366 367
367 } 368 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGResourceClipper.h ('k') | Source/core/rendering/svg/RenderSVGResourceMasker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698