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

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

Issue 9802004: Merge 110563 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1025/
Patch Set: Created 8 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) 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // The SVG specification wants us to clip everything, if clip-path doesn't h ave a child. 148 // The SVG specification wants us to clip everything, if clip-path doesn't h ave a child.
149 if (clipPath.isEmpty()) 149 if (clipPath.isEmpty())
150 clipPath.addRect(FloatRect()); 150 clipPath.addRect(FloatRect());
151 context->clipPath(clipPath, clipRule); 151 context->clipPath(clipPath, clipRule);
152 return true; 152 return true;
153 } 153 }
154 154
155 bool RenderSVGResourceClipper::applyClippingToContext(RenderObject* object, cons t FloatRect& objectBoundingBox, 155 bool RenderSVGResourceClipper::applyClippingToContext(RenderObject* object, cons t FloatRect& objectBoundingBox,
156 const FloatRect& repaintRe ct, GraphicsContext* context) 156 const FloatRect& repaintRe ct, GraphicsContext* context)
157 { 157 {
158 if (!m_clipper.contains(object)) 158 bool missingClipperData = !m_clipper.contains(object);
159 if (missingClipperData)
159 m_clipper.set(object, new ClipperData); 160 m_clipper.set(object, new ClipperData);
160 161
161 bool shouldCreateClipData = false; 162 bool shouldCreateClipData = false;
162 AffineTransform animatedLocalTransform = static_cast<SVGClipPathElement*>(no de())->animatedLocalTransform(); 163 AffineTransform animatedLocalTransform = static_cast<SVGClipPathElement*>(no de())->animatedLocalTransform();
163 ClipperData* clipperData = m_clipper.get(object); 164 ClipperData* clipperData = m_clipper.get(object);
164 if (!clipperData->clipMaskImage) { 165 if (!clipperData->clipMaskImage) {
165 if (pathOnlyClipping(context, animatedLocalTransform, objectBoundingBox) ) 166 if (pathOnlyClipping(context, animatedLocalTransform, objectBoundingBox) )
166 return true; 167 return true;
167 shouldCreateClipData = true; 168 shouldCreateClipData = true;
168 } 169 }
(...skipping 25 matching lines...) Expand all
194 } else 195 } else
195 succeeded = drawContentIntoMaskImage(clipperData, objectBoundingBox) ; 196 succeeded = drawContentIntoMaskImage(clipperData, objectBoundingBox) ;
196 197
197 if (!succeeded) 198 if (!succeeded)
198 clipperData->clipMaskImage.clear(); 199 clipperData->clipMaskImage.clear();
199 } 200 }
200 201
201 if (!clipperData->clipMaskImage) 202 if (!clipperData->clipMaskImage)
202 return false; 203 return false;
203 204
204 SVGImageBufferTools::clipToImageBuffer(context, absoluteTransform, repaintRe ct, clipperData->clipMaskImage); 205 SVGImageBufferTools::clipToImageBuffer(context, absoluteTransform, repaintRe ct, clipperData->clipMaskImage, missingClipperData);
205 return true; 206 return true;
206 } 207 }
207 208
208 bool RenderSVGResourceClipper::drawContentIntoMaskImage(ClipperData* clipperData , const FloatRect& objectBoundingBox) 209 bool RenderSVGResourceClipper::drawContentIntoMaskImage(ClipperData* clipperData , const FloatRect& objectBoundingBox)
209 { 210 {
210 ASSERT(frame()); 211 ASSERT(frame());
211 ASSERT(clipperData); 212 ASSERT(clipperData);
212 ASSERT(clipperData->clipMaskImage); 213 ASSERT(clipperData->clipMaskImage);
213 214
214 GraphicsContext* maskContext = clipperData->clipMaskImage->context(); 215 GraphicsContext* maskContext = clipperData->clipMaskImage->context();
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight()); 335 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight());
335 return transform.mapRect(m_clipBoundaries); 336 return transform.mapRect(m_clipBoundaries);
336 } 337 }
337 338
338 return m_clipBoundaries; 339 return m_clipBoundaries;
339 } 340 }
340 341
341 } 342 }
342 343
343 #endif // ENABLE(SVG) 344 #endif // ENABLE(SVG)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698