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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
490 return; | 490 return; |
491 | 491 |
492 if (deviceSize.width() > MaxSkiaDim || deviceSize.height() > MaxSkiaDim) | 492 if (deviceSize.width() > MaxSkiaDim || deviceSize.height() > MaxSkiaDim) |
493 return; | 493 return; |
494 | 494 |
495 IntSize bufferSize(deviceSize.width(), deviceSize.height()); | 495 IntSize bufferSize(deviceSize.width(), deviceSize.height()); |
496 if (!bufferSize.width() || !bufferSize.height()) | 496 if (!bufferSize.width() || !bufferSize.height()) |
497 return; | 497 return; |
498 | 498 |
499 RenderingMode renderingMode = shouldAccelerate(bufferSize) ? Accelerated : U nacceleratedNonPlatformBuffer; | 499 RenderingMode renderingMode = shouldAccelerate(bufferSize) ? Accelerated : U nacceleratedNonPlatformBuffer; |
500 int msaaSampleCount = 0; | |
501 if (Accelerated == renderingMode && document().settings()->antialiased2dCanv asEnabled()) | |
Stephen White
2013/10/18 20:13:12
Nit: blink style doesn't reverse the == operands (
bsalomon
2013/10/21 13:48:47
Done, to be more consistent other blink code.
| |
502 msaaSampleCount = document().settings()->accelerated2dCanvasMSAASampleCo unt(); | |
500 OpacityMode opacityMode = !m_context || m_context->hasAlpha() ? NonOpaque : Opaque; | 503 OpacityMode opacityMode = !m_context || m_context->hasAlpha() ? NonOpaque : Opaque; |
501 m_imageBuffer = ImageBuffer::create(size(), m_deviceScaleFactor, renderingMo de, opacityMode); | 504 m_imageBuffer = ImageBuffer::create(size(), m_deviceScaleFactor, renderingMo de, opacityMode, msaaSampleCount); |
502 if (!m_imageBuffer) | 505 if (!m_imageBuffer) |
503 return; | 506 return; |
504 setExternallyAllocatedMemory(4 * width() * height()); | 507 setExternallyAllocatedMemory(4 * width() * height()); |
505 m_imageBuffer->context()->setShouldClampToSourceRect(false); | 508 m_imageBuffer->context()->setShouldClampToSourceRect(false); |
506 m_imageBuffer->context()->setImageInterpolationQuality(DefaultInterpolationQ uality); | 509 m_imageBuffer->context()->setImageInterpolationQuality(DefaultInterpolationQ uality); |
507 if (document().settings() && !document().settings()->antialiased2dCanvasEnab led()) | 510 if (document().settings() && !document().settings()->antialiased2dCanvasEnab led()) |
508 m_imageBuffer->context()->setShouldAntialias(false); | 511 m_imageBuffer->context()->setShouldAntialias(false); |
509 // GraphicsContext's defaults don't always agree with the 2d canvas spec. | 512 // GraphicsContext's defaults don't always agree with the 2d canvas spec. |
510 // See CanvasRenderingContext2D::State::State() for more information. | 513 // See CanvasRenderingContext2D::State::State() for more information. |
511 m_imageBuffer->context()->setMiterLimit(10); | 514 m_imageBuffer->context()->setMiterLimit(10); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
580 FloatSize unscaledSize = size(); | 583 FloatSize unscaledSize = size(); |
581 FloatSize deviceSize = convertLogicalToDevice(unscaledSize); | 584 FloatSize deviceSize = convertLogicalToDevice(unscaledSize); |
582 IntSize size(deviceSize.width(), deviceSize.height()); | 585 IntSize size(deviceSize.width(), deviceSize.height()); |
583 AffineTransform transform; | 586 AffineTransform transform; |
584 if (size.width() && size.height()) | 587 if (size.width() && size.height()) |
585 transform.scaleNonUniform(size.width() / unscaledSize.width(), size.heig ht() / unscaledSize.height()); | 588 transform.scaleNonUniform(size.width() / unscaledSize.width(), size.heig ht() / unscaledSize.height()); |
586 return m_imageBuffer->baseTransform() * transform; | 589 return m_imageBuffer->baseTransform() * transform; |
587 } | 590 } |
588 | 591 |
589 } | 592 } |
OLD | NEW |