blob: 193a01d35f70f0163fe3600b003531e0aa13bacb [file] [log] [blame]
reed@android.com8a1c16f2008-12-17 15:59:43 +00001#ifndef SkImageRef_ashmem_DEFINED
2#define SkImageRef_ashmem_DEFINED
3
4#include "SkImageRef.h"
5
6struct SkAshmemRec {
7 int fFD;
8 void* fAddr;
9 size_t fSize;
10 bool fPinned;
11};
12
13class SkImageRef_ashmem : public SkImageRef {
14public:
15 SkImageRef_ashmem(SkStream*, SkBitmap::Config, int sampleSize = 1);
16 virtual ~SkImageRef_ashmem();
17
18protected:
19 virtual bool onDecode(SkImageDecoder* codec, SkStream* stream,
20 SkBitmap* bitmap, SkBitmap::Config config,
21 SkImageDecoder::Mode mode);
22
23 virtual void* onLockPixels(SkColorTable**);
24 virtual void onUnlockPixels();
25
26private:
27 void closeFD();
28
29 SkColorTable* fCT;
30 SkAshmemRec fRec;
31
32 typedef SkImageRef INHERITED;
33};
34
35#endif