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

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

Issue 323013004: Clean up transform methods in GraphicsContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2nd Attempt Mac build fix Created 6 years, 6 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
« no previous file with comments | « Source/core/rendering/svg/SVGInlineTextBox.cpp ('k') | Source/core/svg/graphics/SVGImage.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/SVGInlineTextBox.cpp ('k') | Source/core/svg/graphics/SVGImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698