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