• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef SkImageRef_ashmem_DEFINED
2 #define SkImageRef_ashmem_DEFINED
3 
4 #include "SkImageRef.h"
5 
6 struct SkAshmemRec {
7     int     fFD;
8     void*   fAddr;
9     size_t  fSize;
10     bool    fPinned;
11 };
12 
13 class SkImageRef_ashmem : public SkImageRef {
14 public:
15     SkImageRef_ashmem(SkStream*, SkBitmap::Config, int sampleSize = 1);
16     virtual ~SkImageRef_ashmem();
17 
18     // overrides
19     virtual void flatten(SkFlattenableWriteBuffer&) const;
getFactory()20     virtual Factory getFactory() const {
21         return Create;
22     }
23     static SkPixelRef* Create(SkFlattenableReadBuffer&);
24 
25 protected:
26     virtual bool onDecode(SkImageDecoder* codec, SkStream* stream,
27                           SkBitmap* bitmap, SkBitmap::Config config,
28                           SkImageDecoder::Mode mode);
29 
30     virtual void* onLockPixels(SkColorTable**);
31     virtual void onUnlockPixels();
32 
33 private:
34     SkImageRef_ashmem(SkFlattenableReadBuffer&);
35     void closeFD();
36 
37     SkColorTable* fCT;
38     SkAshmemRec fRec;
39 
40     typedef SkImageRef INHERITED;
41 };
42 
43 #endif
44