OLD | NEW |
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 19 matching lines...) Expand all Loading... |
30 #include "core/paint/SVGImagePainter.h" | 30 #include "core/paint/SVGImagePainter.h" |
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/RenderSVGResourceFilter.h" | 33 #include "core/rendering/svg/RenderSVGResourceFilter.h" |
34 #include "core/rendering/svg/RenderSVGResourceMasker.h" | 34 #include "core/rendering/svg/RenderSVGResourceMasker.h" |
35 #include "core/rendering/svg/SVGRenderSupport.h" | 35 #include "core/rendering/svg/SVGRenderSupport.h" |
36 #include "core/rendering/svg/SVGResources.h" | 36 #include "core/rendering/svg/SVGResources.h" |
37 #include "core/rendering/svg/SVGResourcesCache.h" | 37 #include "core/rendering/svg/SVGResourcesCache.h" |
38 #include "platform/FloatConversion.h" | 38 #include "platform/FloatConversion.h" |
39 | 39 |
40 static int kMaxImageBufferSize = 4096; | |
41 | |
42 namespace blink { | 40 namespace blink { |
43 | 41 |
44 SVGRenderingContext::~SVGRenderingContext() | 42 SVGRenderingContext::~SVGRenderingContext() |
45 { | 43 { |
46 // Fast path if we don't need to restore anything. | 44 // Fast path if we don't need to restore anything. |
47 if (!(m_renderingFlags & ActionsNeeded)) | 45 if (!(m_renderingFlags & ActionsNeeded)) |
48 return; | 46 return; |
49 | 47 |
50 ASSERT(m_object && m_paintInfo); | 48 ASSERT(m_object && m_paintInfo); |
51 | 49 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 void SVGRenderingContext::renderSubtree(GraphicsContext* context, RenderObject*
item) | 245 void SVGRenderingContext::renderSubtree(GraphicsContext* context, RenderObject*
item) |
248 { | 246 { |
249 ASSERT(context); | 247 ASSERT(context); |
250 ASSERT(item); | 248 ASSERT(item); |
251 ASSERT(!item->needsLayout()); | 249 ASSERT(!item->needsLayout()); |
252 | 250 |
253 PaintInfo info(context, PaintInfo::infiniteRect(), PaintPhaseForeground, Pai
ntBehaviorNormal); | 251 PaintInfo info(context, PaintInfo::infiniteRect(), PaintPhaseForeground, Pai
ntBehaviorNormal); |
254 item->paint(info, IntPoint()); | 252 item->paint(info, IntPoint()); |
255 } | 253 } |
256 | 254 |
257 FloatRect SVGRenderingContext::clampedAbsoluteTargetRect(const FloatRect& absolu
teTargetRect) | |
258 { | |
259 const FloatSize maxImageBufferSize(kMaxImageBufferSize, kMaxImageBufferSize)
; | |
260 return FloatRect(absoluteTargetRect.location(), absoluteTargetRect.size().sh
runkTo(maxImageBufferSize)); | |
261 } | |
262 | |
263 void SVGRenderingContext::clear2DRotation(AffineTransform& transform) | |
264 { | |
265 AffineTransform::DecomposedType decomposition; | |
266 transform.decompose(decomposition); | |
267 decomposition.angle = 0; | |
268 transform.recompose(decomposition); | |
269 } | |
270 | |
271 bool SVGRenderingContext::bufferForeground(OwnPtr<ImageBuffer>& imageBuffer) | 255 bool SVGRenderingContext::bufferForeground(OwnPtr<ImageBuffer>& imageBuffer) |
272 { | 256 { |
273 ASSERT(m_paintInfo); | 257 ASSERT(m_paintInfo); |
274 ASSERT(m_object->isSVGImage()); | 258 ASSERT(m_object->isSVGImage()); |
275 FloatRect boundingBox = m_object->objectBoundingBox(); | 259 FloatRect boundingBox = m_object->objectBoundingBox(); |
276 | 260 |
277 // Invalidate an existing buffer if the scale is not correct. | 261 // Invalidate an existing buffer if the scale is not correct. |
278 if (imageBuffer) { | 262 if (imageBuffer) { |
279 AffineTransform transform = m_paintInfo->context->getCTM(); | 263 AffineTransform transform = m_paintInfo->context->getCTM(); |
280 IntSize expandedBoundingBox = expandedIntSize(boundingBox.size()); | 264 IntSize expandedBoundingBox = expandedIntSize(boundingBox.size()); |
(...skipping 12 matching lines...) Expand all Loading... |
293 SVGImagePainter::paintForeground(toRenderSVGImage(*m_object), buffer
edInfo); | 277 SVGImagePainter::paintForeground(toRenderSVGImage(*m_object), buffer
edInfo); |
294 } else | 278 } else |
295 return false; | 279 return false; |
296 } | 280 } |
297 | 281 |
298 m_paintInfo->context->drawImageBuffer(imageBuffer.get(), boundingBox); | 282 m_paintInfo->context->drawImageBuffer(imageBuffer.get(), boundingBox); |
299 return true; | 283 return true; |
300 } | 284 } |
301 | 285 |
302 } // namespace blink | 286 } // namespace blink |
OLD | NEW |