| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 { | 280 { |
| 281 ASSERT(m_paintInfo); | 281 ASSERT(m_paintInfo); |
| 282 ASSERT(m_object->isSVGImage()); | 282 ASSERT(m_object->isSVGImage()); |
| 283 FloatRect boundingBox = m_object->objectBoundingBox(); | 283 FloatRect boundingBox = m_object->objectBoundingBox(); |
| 284 | 284 |
| 285 // Invalidate an existing buffer if the scale is not correct. | 285 // Invalidate an existing buffer if the scale is not correct. |
| 286 if (imageBuffer) { | 286 if (imageBuffer) { |
| 287 AffineTransform transform = m_paintInfo->context->getCTM(GraphicsContext
::DefinitelyIncludeDeviceScale); | 287 AffineTransform transform = m_paintInfo->context->getCTM(GraphicsContext
::DefinitelyIncludeDeviceScale); |
| 288 IntSize expandedBoundingBox = expandedIntSize(boundingBox.size()); | 288 IntSize expandedBoundingBox = expandedIntSize(boundingBox.size()); |
| 289 IntSize bufferSize(static_cast<int>(ceil(expandedBoundingBox.width() * t
ransform.xScale())), static_cast<int>(ceil(expandedBoundingBox.height() * transf
orm.yScale()))); | 289 IntSize bufferSize(static_cast<int>(ceil(expandedBoundingBox.width() * t
ransform.xScale())), static_cast<int>(ceil(expandedBoundingBox.height() * transf
orm.yScale()))); |
| 290 if (bufferSize != imageBuffer->internalSize()) | 290 if (bufferSize != imageBuffer->size()) |
| 291 imageBuffer.clear(); | 291 imageBuffer.clear(); |
| 292 } | 292 } |
| 293 | 293 |
| 294 // Create a new buffer and paint the foreground into it. | 294 // Create a new buffer and paint the foreground into it. |
| 295 if (!imageBuffer) { | 295 if (!imageBuffer) { |
| 296 if ((imageBuffer = m_paintInfo->context->createCompatibleBuffer(expanded
IntSize(boundingBox.size()), true))) { | 296 if ((imageBuffer = m_paintInfo->context->createCompatibleBuffer(expanded
IntSize(boundingBox.size())))) { |
| 297 GraphicsContext* bufferedRenderingContext = imageBuffer->context(); | 297 GraphicsContext* bufferedRenderingContext = imageBuffer->context(); |
| 298 bufferedRenderingContext->translate(-boundingBox.x(), -boundingBox.y
()); | 298 bufferedRenderingContext->translate(-boundingBox.x(), -boundingBox.y
()); |
| 299 PaintInfo bufferedInfo(*m_paintInfo); | 299 PaintInfo bufferedInfo(*m_paintInfo); |
| 300 bufferedInfo.context = bufferedRenderingContext; | 300 bufferedInfo.context = bufferedRenderingContext; |
| 301 toRenderSVGImage(m_object)->paintForeground(bufferedInfo); | 301 toRenderSVGImage(m_object)->paintForeground(bufferedInfo); |
| 302 } else | 302 } else |
| 303 return false; | 303 return false; |
| 304 } | 304 } |
| 305 | 305 |
| 306 m_paintInfo->context->drawImageBuffer(imageBuffer.get(), boundingBox); | 306 m_paintInfo->context->drawImageBuffer(imageBuffer.get(), boundingBox); |
| 307 return true; | 307 return true; |
| 308 } | 308 } |
| 309 | 309 |
| 310 } | 310 } |
| OLD | NEW |