| 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 if (!paintsIntoCanvasBuffer() && !document()->printing()) | 318 if (!paintsIntoCanvasBuffer() && !document()->printing()) |
| 319 return; | 319 return; |
| 320 m_context->paintRenderingResultsToCanvas(); | 320 m_context->paintRenderingResultsToCanvas(); |
| 321 } | 321 } |
| 322 | 322 |
| 323 if (hasCreatedImageBuffer()) { | 323 if (hasCreatedImageBuffer()) { |
| 324 ImageBuffer* imageBuffer = buffer(); | 324 ImageBuffer* imageBuffer = buffer(); |
| 325 if (imageBuffer) { | 325 if (imageBuffer) { |
| 326 CompositeOperator compositeOperator = !m_context || m_context->hasAl
pha() ? CompositeSourceOver : CompositeCopy; | 326 CompositeOperator compositeOperator = !m_context || m_context->hasAl
pha() ? CompositeSourceOver : CompositeCopy; |
| 327 if (m_presentedImage) | 327 if (m_presentedImage) |
| 328 context->drawImage(m_presentedImage.get(), ColorSpaceDeviceRGB,
pixelSnappedIntRect(r), compositeOperator, DoNotRespectImageOrientation, useLowQ
ualityScale); | 328 context->drawImage(m_presentedImage.get(), pixelSnappedIntRect(r
), compositeOperator, DoNotRespectImageOrientation, useLowQualityScale); |
| 329 else | 329 else |
| 330 context->drawImageBuffer(imageBuffer, ColorSpaceDeviceRGB, pixel
SnappedIntRect(r), compositeOperator, BlendModeNormal, useLowQualityScale); | 330 context->drawImageBuffer(imageBuffer, pixelSnappedIntRect(r), co
mpositeOperator, BlendModeNormal, useLowQualityScale); |
| 331 } | 331 } |
| 332 } | 332 } |
| 333 | 333 |
| 334 if (is3D()) | 334 if (is3D()) |
| 335 static_cast<WebGLRenderingContext*>(m_context.get())->markLayerComposite
d(); | 335 static_cast<WebGLRenderingContext*>(m_context.get())->markLayerComposite
d(); |
| 336 } | 336 } |
| 337 | 337 |
| 338 bool HTMLCanvasElement::is3D() const | 338 bool HTMLCanvasElement::is3D() const |
| 339 { | 339 { |
| 340 return m_context && m_context->is3d(); | 340 return m_context && m_context->is3d(); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 | 489 |
| 490 if (deviceSize.width() > MaxSkiaDim || deviceSize.height() > MaxSkiaDim) | 490 if (deviceSize.width() > MaxSkiaDim || deviceSize.height() > MaxSkiaDim) |
| 491 return; | 491 return; |
| 492 | 492 |
| 493 IntSize bufferSize(deviceSize.width(), deviceSize.height()); | 493 IntSize bufferSize(deviceSize.width(), deviceSize.height()); |
| 494 if (!bufferSize.width() || !bufferSize.height()) | 494 if (!bufferSize.width() || !bufferSize.height()) |
| 495 return; | 495 return; |
| 496 | 496 |
| 497 RenderingMode renderingMode = shouldAccelerate(bufferSize) ? Accelerated : U
nacceleratedNonPlatformBuffer; | 497 RenderingMode renderingMode = shouldAccelerate(bufferSize) ? Accelerated : U
nacceleratedNonPlatformBuffer; |
| 498 OpacityMode opacityMode = !m_context || m_context->hasAlpha() ? NonOpaque :
Opaque; | 498 OpacityMode opacityMode = !m_context || m_context->hasAlpha() ? NonOpaque :
Opaque; |
| 499 m_imageBuffer = ImageBuffer::create(size(), m_deviceScaleFactor, ColorSpaceD
eviceRGB, renderingMode, opacityMode); | 499 m_imageBuffer = ImageBuffer::create(size(), m_deviceScaleFactor, renderingMo
de, opacityMode); |
| 500 if (!m_imageBuffer) | 500 if (!m_imageBuffer) |
| 501 return; | 501 return; |
| 502 m_imageBuffer->context()->setShadowsIgnoreTransforms(true); | 502 m_imageBuffer->context()->setShadowsIgnoreTransforms(true); |
| 503 m_imageBuffer->context()->setImageInterpolationQuality(DefaultInterpolationQ
uality); | 503 m_imageBuffer->context()->setImageInterpolationQuality(DefaultInterpolationQ
uality); |
| 504 if (document()->settings() && !document()->settings()->antialiased2dCanvasEn
abled()) | 504 if (document()->settings() && !document()->settings()->antialiased2dCanvasEn
abled()) |
| 505 m_imageBuffer->context()->setShouldAntialias(false); | 505 m_imageBuffer->context()->setShouldAntialias(false); |
| 506 m_imageBuffer->context()->setStrokeThickness(1); | 506 m_imageBuffer->context()->setStrokeThickness(1); |
| 507 m_contextStateSaver = adoptPtr(new GraphicsContextStateSaver(*m_imageBuffer-
>context())); | 507 m_contextStateSaver = adoptPtr(new GraphicsContextStateSaver(*m_imageBuffer-
>context())); |
| 508 | 508 |
| 509 if (m_context && m_context->is2d()) { | 509 if (m_context && m_context->is2d()) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 HTMLElement::reportMemoryUsage(memoryObjectInfo); | 581 HTMLElement::reportMemoryUsage(memoryObjectInfo); |
| 582 info.addMember(m_observers, "observers"); | 582 info.addMember(m_observers, "observers"); |
| 583 info.addMember(m_context, "context"); | 583 info.addMember(m_context, "context"); |
| 584 info.addMember(m_imageBuffer, "imageBuffer"); | 584 info.addMember(m_imageBuffer, "imageBuffer"); |
| 585 info.addMember(m_contextStateSaver, "contextStateSaver"); | 585 info.addMember(m_contextStateSaver, "contextStateSaver"); |
| 586 info.addMember(m_presentedImage, "presentedImage"); | 586 info.addMember(m_presentedImage, "presentedImage"); |
| 587 info.addMember(m_copiedImage, "copiedImage"); | 587 info.addMember(m_copiedImage, "copiedImage"); |
| 588 } | 588 } |
| 589 | 589 |
| 590 } | 590 } |
| OLD | NEW |