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

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

Issue 453653003: [SVG] DisplayList-based patterns. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review comments 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) 2007, 2008 Rob Buis <buis@kde.org> 2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org>
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Google, Inc. All rights reserved. 5 * Copyright (C) 2009 Google, Inc. All rights reserved.
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 20 matching lines...) Expand all
31 #include "core/rendering/RenderLayer.h" 31 #include "core/rendering/RenderLayer.h"
32 #include "core/rendering/svg/RenderSVGImage.h" 32 #include "core/rendering/svg/RenderSVGImage.h"
33 #include "core/rendering/svg/RenderSVGResource.h" 33 #include "core/rendering/svg/RenderSVGResource.h"
34 #include "core/rendering/svg/RenderSVGResourceFilter.h" 34 #include "core/rendering/svg/RenderSVGResourceFilter.h"
35 #include "core/rendering/svg/RenderSVGResourceMasker.h" 35 #include "core/rendering/svg/RenderSVGResourceMasker.h"
36 #include "core/rendering/svg/SVGRenderSupport.h" 36 #include "core/rendering/svg/SVGRenderSupport.h"
37 #include "core/rendering/svg/SVGResources.h" 37 #include "core/rendering/svg/SVGResources.h"
38 #include "core/rendering/svg/SVGResourcesCache.h" 38 #include "core/rendering/svg/SVGResourcesCache.h"
39 #include "platform/FloatConversion.h" 39 #include "platform/FloatConversion.h"
40 40
41 static int kMaxImageBufferSize = 4096;
42
43 namespace blink { 41 namespace blink {
44 42
45 SVGRenderingContext::~SVGRenderingContext() 43 SVGRenderingContext::~SVGRenderingContext()
46 { 44 {
47 // Fast path if we don't need to restore anything. 45 // Fast path if we don't need to restore anything.
48 if (!(m_renderingFlags & ActionsNeeded)) 46 if (!(m_renderingFlags & ActionsNeeded))
49 return; 47 return;
50 48
51 ASSERT(m_object && m_paintInfo); 49 ASSERT(m_object && m_paintInfo);
52 50
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 AffineTransform& contentTransformation = currentContentTransformation(); 241 AffineTransform& contentTransformation = currentContentTransformation();
244 AffineTransform savedContentTransformation = contentTransformation; 242 AffineTransform savedContentTransformation = contentTransformation;
245 contentTransformation = subtreeContentTransformation * contentTransformation ; 243 contentTransformation = subtreeContentTransformation * contentTransformation ;
246 244
247 ASSERT(!item->needsLayout()); 245 ASSERT(!item->needsLayout());
248 item->paint(info, IntPoint()); 246 item->paint(info, IntPoint());
249 247
250 contentTransformation = savedContentTransformation; 248 contentTransformation = savedContentTransformation;
251 } 249 }
252 250
253 FloatRect SVGRenderingContext::clampedAbsoluteTargetRect(const FloatRect& absolu teTargetRect)
254 {
255 const FloatSize maxImageBufferSize(kMaxImageBufferSize, kMaxImageBufferSize) ;
256 return FloatRect(absoluteTargetRect.location(), absoluteTargetRect.size().sh runkTo(maxImageBufferSize));
257 }
258
259 void SVGRenderingContext::clear2DRotation(AffineTransform& transform)
260 {
261 AffineTransform::DecomposedType decomposition;
262 transform.decompose(decomposition);
263 decomposition.angle = 0;
264 transform.recompose(decomposition);
265 }
266
267 bool SVGRenderingContext::bufferForeground(OwnPtr<ImageBuffer>& imageBuffer) 251 bool SVGRenderingContext::bufferForeground(OwnPtr<ImageBuffer>& imageBuffer)
268 { 252 {
269 ASSERT(m_paintInfo); 253 ASSERT(m_paintInfo);
270 ASSERT(m_object->isSVGImage()); 254 ASSERT(m_object->isSVGImage());
271 FloatRect boundingBox = m_object->objectBoundingBox(); 255 FloatRect boundingBox = m_object->objectBoundingBox();
272 256
273 // Invalidate an existing buffer if the scale is not correct. 257 // Invalidate an existing buffer if the scale is not correct.
274 if (imageBuffer) { 258 if (imageBuffer) {
275 AffineTransform transform = m_paintInfo->context->getCTM(); 259 AffineTransform transform = m_paintInfo->context->getCTM();
276 IntSize expandedBoundingBox = expandedIntSize(boundingBox.size()); 260 IntSize expandedBoundingBox = expandedIntSize(boundingBox.size());
(...skipping 12 matching lines...) Expand all
289 SVGImagePainter::paintForeground(toRenderSVGImage(*m_object), buffer edInfo); 273 SVGImagePainter::paintForeground(toRenderSVGImage(*m_object), buffer edInfo);
290 } else 274 } else
291 return false; 275 return false;
292 } 276 }
293 277
294 m_paintInfo->context->drawImageBuffer(imageBuffer.get(), boundingBox); 278 m_paintInfo->context->drawImageBuffer(imageBuffer.get(), boundingBox);
295 return true; 279 return true;
296 } 280 }
297 281
298 } // namespace blink 282 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698