| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "platform/graphics/gpu/WebGLImageConversion.h" | 6 #include "platform/graphics/gpu/WebGLImageConversion.h" |
| 7 | 7 |
| 8 #include "platform/CheckedInt.h" | 8 #include "platform/CheckedInt.h" |
| 9 #include "platform/graphics/ImageObserver.h" | 9 #include "platform/graphics/ImageObserver.h" |
| 10 #include "platform/graphics/cpu/arm/WebGLImageConversionNEON.h" | 10 #include "platform/graphics/cpu/arm/WebGLImageConversionNEON.h" |
| (...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1577 // do AlphaDoUnmultiply if UNPACK_PREMULTIPLY_ALPHA_WEBGL is set to fals
e. | 1577 // do AlphaDoUnmultiply if UNPACK_PREMULTIPLY_ALPHA_WEBGL is set to fals
e. |
| 1578 if (m_imageHtmlDomSource != HtmlDomVideo) | 1578 if (m_imageHtmlDomSource != HtmlDomVideo) |
| 1579 m_alphaOp = AlphaDoUnmultiply; | 1579 m_alphaOp = AlphaDoUnmultiply; |
| 1580 } | 1580 } |
| 1581 if (!m_skiaImage) | 1581 if (!m_skiaImage) |
| 1582 return false; | 1582 return false; |
| 1583 | 1583 |
| 1584 m_imageSourceFormat = SK_B32_SHIFT ? DataFormatRGBA8 : DataFormatBGRA8; | 1584 m_imageSourceFormat = SK_B32_SHIFT ? DataFormatRGBA8 : DataFormatBGRA8; |
| 1585 m_imageWidth = m_skiaImage->bitmap().width(); | 1585 m_imageWidth = m_skiaImage->bitmap().width(); |
| 1586 m_imageHeight = m_skiaImage->bitmap().height(); | 1586 m_imageHeight = m_skiaImage->bitmap().height(); |
| 1587 if (!m_imageWidth || !m_imageHeight) | 1587 if (!m_imageWidth || !m_imageHeight) { |
| 1588 m_skiaImage.clear(); |
| 1588 return false; | 1589 return false; |
| 1590 } |
| 1589 // Fail if the image was downsampled because of memory limits. | 1591 // Fail if the image was downsampled because of memory limits. |
| 1590 if (m_imageWidth != (unsigned)m_image->size().width() || m_imageHeight != (u
nsigned)m_image->size().height()) | 1592 if (m_imageWidth != (unsigned)m_image->size().width() || m_imageHeight != (u
nsigned)m_image->size().height()) { |
| 1593 m_skiaImage.clear(); |
| 1591 return false; | 1594 return false; |
| 1595 } |
| 1592 m_imageSourceUnpackAlignment = 0; | 1596 m_imageSourceUnpackAlignment = 0; |
| 1593 m_skiaImage->bitmap().lockPixels(); | 1597 m_skiaImage->bitmap().lockPixels(); |
| 1594 m_imagePixelData = m_skiaImage->bitmap().getPixels(); | 1598 m_imagePixelData = m_skiaImage->bitmap().getPixels(); |
| 1595 return true; | 1599 return true; |
| 1596 } | 1600 } |
| 1597 | 1601 |
| 1598 unsigned WebGLImageConversion::getClearBitsByFormat(GLenum format) | 1602 unsigned WebGLImageConversion::getClearBitsByFormat(GLenum format) |
| 1599 { | 1603 { |
| 1600 switch (format) { | 1604 switch (format) { |
| 1601 case GL_ALPHA: | 1605 case GL_ALPHA: |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1766 } | 1770 } |
| 1767 | 1771 |
| 1768 FormatConverter converter(width, height, sourceData, destinationData, srcStr
ide, dstStride); | 1772 FormatConverter converter(width, height, sourceData, destinationData, srcStr
ide, dstStride); |
| 1769 converter.convert(sourceDataFormat, dstDataFormat, alphaOp); | 1773 converter.convert(sourceDataFormat, dstDataFormat, alphaOp); |
| 1770 if (!converter.Success()) | 1774 if (!converter.Success()) |
| 1771 return false; | 1775 return false; |
| 1772 return true; | 1776 return true; |
| 1773 } | 1777 } |
| 1774 | 1778 |
| 1775 } // namespace WebCore | 1779 } // namespace WebCore |
| OLD | NEW |