summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/image-decoders/wx/ImageDecoderWx.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-10-08 17:19:54 +0100
committerSteve Block <steveblock@google.com>2009-10-20 00:41:58 +0100
commit231d4e3152a9c27a73b6ac7badbe6be673aa3ddf (patch)
treea6c7e2d6cd7bfa7011cc39abbb436142d7a4a7c8 /WebCore/platform/image-decoders/wx/ImageDecoderWx.cpp
parente196732677050bd463301566a68a643b6d14b907 (diff)
downloadexternal_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.zip
external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.gz
external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.bz2
Merge webkit.org at R49305 : Automatic merge by git.
Change-Id: I8968561bc1bfd72b8923b7118d3728579c6dbcc7
Diffstat (limited to 'WebCore/platform/image-decoders/wx/ImageDecoderWx.cpp')
-rw-r--r--WebCore/platform/image-decoders/wx/ImageDecoderWx.cpp105
1 files changed, 8 insertions, 97 deletions
diff --git a/WebCore/platform/image-decoders/wx/ImageDecoderWx.cpp b/WebCore/platform/image-decoders/wx/ImageDecoderWx.cpp
index 8e8809e..3cadf1c 100644
--- a/WebCore/platform/image-decoders/wx/ImageDecoderWx.cpp
+++ b/WebCore/platform/image-decoders/wx/ImageDecoderWx.cpp
@@ -37,73 +37,21 @@
namespace WebCore {
-RGBA32Buffer::RGBA32Buffer()
- : m_hasAlpha(false)
- , m_status(FrameEmpty)
- , m_duration(0)
- , m_disposalMethod(DisposeNotSpecified)
-{
-}
-
-void RGBA32Buffer::clear()
-{
- m_bytes.clear();
- m_status = FrameEmpty;
- // NOTE: Do not reset other members here; clearFrameBufferCache()
- // calls this to free the bitmap data, but other functions like
- // initFrameBuffer() and frameComplete() may still need to read
- // other metadata out of this frame later.
-}
-
-void RGBA32Buffer::zeroFill()
-{
- m_bytes.fill(0);
- m_hasAlpha = true;
-}
-
-void RGBA32Buffer::copyBitmapData(const RGBA32Buffer& other)
-{
- if (this == &other)
- return;
-
- m_bytes = other.m_bytes;
- m_size = other.m_size;
- setHasAlpha(other.m_hasAlpha);
-}
-
-bool RGBA32Buffer::setSize(int newWidth, int newHeight)
-{
- // NOTE: This has no way to check for allocation failure if the
- // requested size was too big...
- m_bytes.resize(newWidth * newHeight);
- m_size = IntSize(newWidth, newHeight);
-
- // Zero the image.
- zeroFill();
-
- return true;
-}
-
NativeImagePtr RGBA32Buffer::asNewNativeImage() const
{
- const unsigned char* bytes = (const unsigned char*)m_bytes.data();
-
- typedef wxPixelData<wxBitmap, wxAlphaPixelFormat> WxPixelData;
-
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;
-
- // 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.
- for (long i = 0; i < m_bytes.size() * sizeof(PixelData); i += sizeof(PixelData)) {
+ 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];
@@ -112,12 +60,11 @@ NativeImagePtr RGBA32Buffer::asNewNativeImage() const
p++;
pixelCounter++;
- if ( (pixelCounter % width() ) == 0 ) {
+ if ((pixelCounter % width()) == 0) {
rowCounter++;
p = rowStart;
p.MoveTo(data, 0, rowCounter);
}
-
}
#if !wxCHECK_VERSION(2,9,0)
bmp->UseAlpha();
@@ -125,7 +72,7 @@ NativeImagePtr RGBA32Buffer::asNewNativeImage() const
ASSERT(bmp->IsOk());
#if USE(WXGC)
- wxGraphicsBitmap* bitmap = new wxGraphicsBitmap(wxGraphicsRenderer::GetDefaultRenderer()->CreateBitmap(*bmp));
+ wxGraphicsBitmap* bitmap = new wxGraphicsBitmap(wxGraphicsRenderer::GetDefaultRenderer()->CreateBitmap(*bmp));
delete bmp;
return bitmap;
#else
@@ -133,40 +80,4 @@ NativeImagePtr RGBA32Buffer::asNewNativeImage() const
#endif
}
-bool RGBA32Buffer::hasAlpha() const
-{
- return m_hasAlpha;
-}
-
-void RGBA32Buffer::setHasAlpha(bool alpha)
-{
- m_hasAlpha = alpha;
-}
-
-void RGBA32Buffer::setStatus(FrameStatus status)
-{
- m_status = status;
-}
-
-RGBA32Buffer& RGBA32Buffer::operator=(const RGBA32Buffer& other)
-{
- if (this == &other)
- return *this;
-
- copyBitmapData(other);
- setRect(other.rect());
- setStatus(other.status());
- setDuration(other.duration());
- setDisposalMethod(other.disposalMethod());
- return *this;
-}
-
-int RGBA32Buffer::width() const {
- return m_size.width();
-}
-
-int RGBA32Buffer::height() const {
- return m_size.height();
-}
-
} // namespace WebCore