diff options
Diffstat (limited to 'WebCore/platform/image-decoders')
-rw-r--r-- | WebCore/platform/image-decoders/ImageDecoder.h | 2 | ||||
-rw-r--r-- | WebCore/platform/image-decoders/qt/RGBA32BufferQt.cpp | 4 | ||||
-rw-r--r-- | WebCore/platform/image-decoders/wx/ImageDecoderWx.cpp | 54 |
3 files changed, 33 insertions, 27 deletions
diff --git a/WebCore/platform/image-decoders/ImageDecoder.h b/WebCore/platform/image-decoders/ImageDecoder.h index 8c9b7f1..08f4aa2 100644 --- a/WebCore/platform/image-decoders/ImageDecoder.h +++ b/WebCore/platform/image-decoders/ImageDecoder.h @@ -197,7 +197,7 @@ namespace WebCore { // The ImageDecoder class represents a base class for specific image format decoders // (e.g., GIF, JPG, PNG, ICO) to derive from. All decoders decode into RGBA32 format // and the base class manages the RGBA32 frame cache. - class ImageDecoder { + class ImageDecoder : public Noncopyable { public: // ENABLE(IMAGE_DECODER_DOWN_SAMPLING) allows image decoders to write directly to // scaled output buffers by down sampling. Call setMaxNumPixels() to specify the diff --git a/WebCore/platform/image-decoders/qt/RGBA32BufferQt.cpp b/WebCore/platform/image-decoders/qt/RGBA32BufferQt.cpp index da6ab38..5e9b527 100644 --- a/WebCore/platform/image-decoders/qt/RGBA32BufferQt.cpp +++ b/WebCore/platform/image-decoders/qt/RGBA32BufferQt.cpp @@ -34,9 +34,9 @@ namespace WebCore { RGBA32Buffer::RGBA32Buffer() - : m_status(FrameEmpty) - , m_hasAlpha(false) + : m_hasAlpha(false) , m_size() + , m_status(FrameEmpty) , m_duration(0) , m_disposalMethod(DisposeNotSpecified) { diff --git a/WebCore/platform/image-decoders/wx/ImageDecoderWx.cpp b/WebCore/platform/image-decoders/wx/ImageDecoderWx.cpp index 3cadf1c..e6e45b7 100644 --- a/WebCore/platform/image-decoders/wx/ImageDecoderWx.cpp +++ b/WebCore/platform/image-decoders/wx/ImageDecoderWx.cpp @@ -40,35 +40,41 @@ namespace WebCore { NativeImagePtr RGBA32Buffer::asNewNativeImage() const { wxBitmap* bmp = new wxBitmap(width(), height(), 32); - typedef wxPixelData<wxBitmap, wxAlphaPixelFormat> WxPixelData; - WxPixelData data(*bmp); - - // NB: It appears that the data is in BGRA format instead of RGBA format. - // This code works properly on both ppc and intel, meaning the issue is - // likely not an issue of byte order getting mixed up on different archs. - const unsigned char* bytes = (const unsigned char*)m_bytes.data(); - int rowCounter = 0; - long pixelCounter = 0; - WxPixelData::Iterator p(data); - WxPixelData::Iterator rowStart = p; - for (size_t i = 0; i < m_bytes.size() * sizeof(PixelData); i += sizeof(PixelData)) { - p.Red() = bytes[i+2]; - p.Green() = bytes[i+1]; - p.Blue() = bytes[i+0]; - p.Alpha() = bytes[i+3]; + + { + typedef wxPixelData<wxBitmap, wxAlphaPixelFormat> WxPixelData; + WxPixelData data(*bmp); - p++; + // NB: It appears that the data is in BGRA format instead of RGBA format. + // This code works properly on both ppc and intel, meaning the issue is + // likely not an issue of byte order getting mixed up on different archs. + const unsigned char* bytes = (const unsigned char*)m_bytes.data(); + int rowCounter = 0; + long pixelCounter = 0; + WxPixelData::Iterator p(data); + WxPixelData::Iterator rowStart = p; + for (size_t i = 0; i < m_bytes.size() * sizeof(PixelData); i += sizeof(PixelData)) { + p.Red() = bytes[i + 2]; + p.Green() = bytes[i + 1]; + p.Blue() = bytes[i + 0]; + p.Alpha() = bytes[i + 3]; + + p++; - pixelCounter++; - if ((pixelCounter % width()) == 0) { - rowCounter++; - p = rowStart; - p.MoveTo(data, 0, rowCounter); + pixelCounter++; + if ((pixelCounter % width()) == 0) { + rowCounter++; + p = rowStart; + p.MoveTo(data, 0, rowCounter); + } } - } #if !wxCHECK_VERSION(2,9,0) - bmp->UseAlpha(); + bmp->UseAlpha(); #endif + } // ensure that WxPixelData is destroyed as it unlocks the bitmap data in + // its dtor and we can't access it (notably in CreateBitmap() below) + // before this is done + ASSERT(bmp->IsOk()); #if USE(WXGC) |