Home | History | Annotate | Download | only in images
      1 #ifndef SkBitmapRegionDecoder_DEFINED
      2 #define SkBitmapRegionDecoder_DEFINED
      3 
      4 #include "SkBitmap.h"
      5 #include "SkRect.h"
      6 #include "SkImageDecoder.h"
      7 #include "SkStream.h"
      8 
      9 class SkBitmapRegionDecoder {
     10 public:
     11     SkBitmapRegionDecoder(SkImageDecoder *decoder, SkStream *stream,
     12             int width, int height) {
     13         fDecoder = decoder;
     14         fStream = stream;
     15         fWidth = width;
     16         fHeight = height;
     17     }
     18     virtual ~SkBitmapRegionDecoder() {
     19         delete fDecoder;
     20         fStream->unref();
     21     }
     22 
     23     virtual bool decodeRegion(SkBitmap* bitmap, SkIRect rect,
     24                               SkBitmap::Config pref, int sampleSize);
     25 
     26     virtual int getWidth() { return fWidth; }
     27     virtual int getHeight() { return fHeight; }
     28 
     29     virtual SkImageDecoder* getDecoder() { return fDecoder; }
     30 
     31 private:
     32     SkImageDecoder *fDecoder;
     33     SkStream *fStream;
     34     int fWidth;
     35     int fHeight;
     36 };
     37 
     38 #endif
     39