• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2011 The Android Open Source Project
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 
9 #ifndef SkBitmapRegionDecoder_DEFINED
10 #define SkBitmapRegionDecoder_DEFINED
11 
12 #include "SkBitmap.h"
13 #include "SkRect.h"
14 #include "SkImageDecoder.h"
15 #include "SkStream.h"
16 
17 class SkBitmapRegionDecoder {
18 public:
SkBitmapRegionDecoder(SkImageDecoder * decoder,SkStream * stream,int width,int height)19     SkBitmapRegionDecoder(SkImageDecoder *decoder, SkStream *stream,
20             int width, int height) {
21         fDecoder = decoder;
22         fStream = stream;
23         fWidth = width;
24         fHeight = height;
25     }
~SkBitmapRegionDecoder()26     virtual ~SkBitmapRegionDecoder() {
27         delete fDecoder;
28         fStream->unref();
29     }
30 
31     virtual bool decodeRegion(SkBitmap* bitmap, SkIRect rect,
32                               SkBitmap::Config pref, int sampleSize);
33 
getWidth()34     virtual int getWidth() { return fWidth; }
getHeight()35     virtual int getHeight() { return fHeight; }
36 
getDecoder()37     virtual SkImageDecoder* getDecoder() { return fDecoder; }
38 
39 private:
40     SkImageDecoder *fDecoder;
41     SkStream *fStream;
42     int fWidth;
43     int fHeight;
44 };
45 
46 #endif
47