pleyo.com

/src/trunk2/BAL/Implementations/ImageDecoders/Generic/JPEG/JPEGImageDecoder.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2007 Pleyo.  All rights reserved.
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions
00006  * are met:
00007  *
00008  * 1.  Redistributions of source code must retain the above copyright
00009  *     notice, this list of conditions and the following disclaimer.
00010  * 2.  Redistributions in binary form must reproduce the above copyright
00011  *     notice, this list of conditions and the following disclaimer in the
00012  *     documentation and/or other materials provided with the distribution.
00013  * 3.  Neither the name of Pleyo nor the names of
00014  *     its contributors may be used to endorse or promote products derived
00015  *     from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY PLEYO AND ITS CONTRIBUTORS "AS IS" AND ANY
00018  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00019  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00020  * DISCLAIMED. IN NO EVENT SHALL PLEYO OR ITS CONTRIBUTORS BE LIABLE FOR ANY
00021  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00022  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00023  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028  #ifndef BAL_JPEG_DECODER_H_
00029 #define BAL_JPEG_DECODER_H_
00030 
00031 #include "BIImageDecoder.h"
00032 #include "ImageDecoderCommonImplementation.h"
00033 #include "ImageObserver.h"
00034 
00035 namespace BC {
00036 
00037 class JPEGImageReader;
00038 
00044 class BCJPEGImageDecoder : public BAL::BIImageDecoder
00045 {
00046 public:
00047     BCJPEGImageDecoder();
00048     virtual ~BCJPEGImageDecoder();
00049 
00050     // Take the data and store it.
00051     virtual void setData(const Vector<char>* data, bool allDataReceived);
00052 
00053     // Whether or not the size information has been decoded yet.
00054     virtual bool isSizeAvailable() const;
00055 
00056     virtual BAL::RGBA32Buffer* frameBufferAtIndex(size_t index);
00057 
00058     virtual bool supportsAlpha() const { return false; }
00059 
00060     virtual IntSize size() const { return mImageDecoderCommonImplementation.size(); }
00061 
00062     virtual int frameCount() { return 1; }
00063 
00064     virtual int repetitionCount() const { return WebCore::cAnimationNone; }
00065 
00066 public:
00067     // Following implementation needs to be public, to be accessed by reader
00068     void decode(bool sizeOnly = false) const;
00069 
00070     JPEGImageReader* reader() { return m_reader; }
00071 
00072     void setSize(int width, int height) {
00073         if (!mImageDecoderCommonImplementation.isSizeAvailable()) {
00074             mImageDecoderCommonImplementation.setSizeAvailable(true);
00075             mImageDecoderCommonImplementation.setSize( IntSize(width, height) );
00076         }
00077     }
00078 
00079     bool outputScanlines();
00080     void jpegComplete();
00081 
00082 private:
00083     mutable JPEGImageReader* m_reader;
00084 
00085     ImageDecoderCommonImplementation mImageDecoderCommonImplementation;
00086 };
00087 
00088 }
00089 
00090 #endif

Generated on Wed Nov 21 20:04:16 2007 for Origyn Web Browser by Doxygen 1.5.3

pleyo.com
pleyo.com