| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 if (!m_context || !m_context->is3d()) | 399 if (!m_context || !m_context->is3d()) |
| 400 return 0; | 400 return 0; |
| 401 | 401 |
| 402 WebGLRenderingContext* ctx = static_cast<WebGLRenderingContext*>(m_context.g
et()); | 402 WebGLRenderingContext* ctx = static_cast<WebGLRenderingContext*>(m_context.g
et()); |
| 403 | 403 |
| 404 return ctx->paintRenderingResultsToImageData(); | 404 return ctx->paintRenderingResultsToImageData(); |
| 405 } | 405 } |
| 406 | 406 |
| 407 IntSize HTMLCanvasElement::convertLogicalToDevice(const IntSize& logicalSize) co
nst | 407 IntSize HTMLCanvasElement::convertLogicalToDevice(const IntSize& logicalSize) co
nst |
| 408 { | 408 { |
| 409 float width = ceilf(logicalSize.width() * m_deviceScaleFactor); | 409 FloatSize deviceSize = logicalSize * m_deviceScaleFactor; |
| 410 float height = ceilf(logicalSize.height() * m_deviceScaleFactor); | 410 return expandedIntSize(deviceSize); |
| 411 return IntSize(width, height); | |
| 412 } | 411 } |
| 413 | 412 |
| 414 SecurityOrigin* HTMLCanvasElement::securityOrigin() const | 413 SecurityOrigin* HTMLCanvasElement::securityOrigin() const |
| 415 { | 414 { |
| 416 return document().securityOrigin(); | 415 return document().securityOrigin(); |
| 417 } | 416 } |
| 418 | 417 |
| 419 StyleResolver* HTMLCanvasElement::styleResolver() | 418 StyleResolver* HTMLCanvasElement::styleResolver() |
| 420 { | 419 { |
| 421 return document().styleResolver(); | 420 return document().styleResolver(); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 ASSERT(m_hasCreatedImageBuffer); | 548 ASSERT(m_hasCreatedImageBuffer); |
| 550 IntSize unscaledSize = size(); | 549 IntSize unscaledSize = size(); |
| 551 IntSize size = convertLogicalToDevice(unscaledSize); | 550 IntSize size = convertLogicalToDevice(unscaledSize); |
| 552 AffineTransform transform; | 551 AffineTransform transform; |
| 553 if (size.width() && size.height()) | 552 if (size.width() && size.height()) |
| 554 transform.scaleNonUniform(size.width() / unscaledSize.width(), size.heig
ht() / unscaledSize.height()); | 553 transform.scaleNonUniform(size.width() / unscaledSize.width(), size.heig
ht() / unscaledSize.height()); |
| 555 return m_imageBuffer->baseTransform() * transform; | 554 return m_imageBuffer->baseTransform() * transform; |
| 556 } | 555 } |
| 557 | 556 |
| 558 } | 557 } |
| OLD | NEW |