| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright (C) 2010 Tieto Corporation. | 2 Copyright (C) 2010 Tieto Corporation. |
| 3 | 3 |
| 4 This library is free software; you can redistribute it and/or | 4 This library is free software; you can redistribute it and/or |
| 5 modify it under the terms of the GNU Lesser General Public | 5 modify it under the terms of the GNU Lesser General Public |
| 6 License as published by the Free Software Foundation; either | 6 License as published by the Free Software Foundation; either |
| 7 version 2.1 of the License, or (at your option) any later version. | 7 version 2.1 of the License, or (at your option) any later version. |
| 8 | 8 |
| 9 This library is distributed in the hope that it will be useful, | 9 This library is distributed in the hope that it will be useful, |
| 10 but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1607 // Is image already loaded? If not, load it. | 1607 // Is image already loaded? If not, load it. |
| 1608 if (image->data()) | 1608 if (image->data()) |
| 1609 nativeImage = QImage::fromData(reinterpret_cast<const uchar*>(image->dat
a()->data()), image->data()->size()).convertToFormat(QImage::Format_ARGB32); | 1609 nativeImage = QImage::fromData(reinterpret_cast<const uchar*>(image->dat
a()->data()), image->data()->size()).convertToFormat(QImage::Format_ARGB32); |
| 1610 else { | 1610 else { |
| 1611 QPixmap* nativePixmap = image->nativeImageForCurrentFrame(); | 1611 QPixmap* nativePixmap = image->nativeImageForCurrentFrame(); |
| 1612 nativeImage = nativePixmap->toImage().convertToFormat(QImage::Format_ARG
B32); | 1612 nativeImage = nativePixmap->toImage().convertToFormat(QImage::Format_ARG
B32); |
| 1613 } | 1613 } |
| 1614 AlphaOp neededAlphaOp = AlphaDoNothing; | 1614 AlphaOp neededAlphaOp = AlphaDoNothing; |
| 1615 if (premultiplyAlpha) | 1615 if (premultiplyAlpha) |
| 1616 neededAlphaOp = AlphaDoPremultiply; | 1616 neededAlphaOp = AlphaDoPremultiply; |
| 1617 outputVector.resize(nativeImage.byteCount()); | 1617 |
| 1618 unsigned int packedSize; |
| 1619 // Output data is tightly packed (alignment == 1). |
| 1620 if (computeImageSizeInBytes(format, type, image->width(), image->height(), 1
, &packedSize, 0) != GraphicsContext3D::NO_ERROR) |
| 1621 return false; |
| 1622 outputVector.resize(packedSize); |
| 1623 |
| 1618 return packPixels(nativeImage.bits(), SourceFormatBGRA8, image->width(), ima
ge->height(), 0, format, type, neededAlphaOp, outputVector.data()); | 1624 return packPixels(nativeImage.bits(), SourceFormatBGRA8, image->width(), ima
ge->height(), 0, format, type, neededAlphaOp, outputVector.data()); |
| 1619 } | 1625 } |
| 1620 | 1626 |
| 1621 void GraphicsContext3D::setContextLostCallback(PassOwnPtr<ContextLostCallback>) | 1627 void GraphicsContext3D::setContextLostCallback(PassOwnPtr<ContextLostCallback>) |
| 1622 { | 1628 { |
| 1623 } | 1629 } |
| 1624 | 1630 |
| 1625 void GraphicsContext3D::setErrorMessageCallback(PassOwnPtr<ErrorMessageCallback>
) | 1631 void GraphicsContext3D::setErrorMessageCallback(PassOwnPtr<ErrorMessageCallback>
) |
| 1626 { | 1632 { |
| 1627 } | 1633 } |
| 1628 | 1634 |
| 1629 } | 1635 } |
| 1630 | 1636 |
| 1631 #endif // ENABLE(WEBGL) | 1637 #endif // ENABLE(WEBGL) |
| OLD | NEW |