OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #ifndef SkMallocPixelRef_DEFINED | 9 #ifndef SkMallocPixelRef_DEFINED |
10 #define SkMallocPixelRef_DEFINED | 10 #define SkMallocPixelRef_DEFINED |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 void* getAddr() const { return fStorage; } | 76 void* getAddr() const { return fStorage; } |
77 | 77 |
78 class PRFactory : public SkPixelRefFactory { | 78 class PRFactory : public SkPixelRefFactory { |
79 public: | 79 public: |
80 virtual SkPixelRef* create(const SkImageInfo&, | 80 virtual SkPixelRef* create(const SkImageInfo&, |
81 size_t rowBytes, | 81 size_t rowBytes, |
82 SkColorTable*) SK_OVERRIDE; | 82 SkColorTable*) SK_OVERRIDE; |
83 }; | 83 }; |
84 | 84 |
| 85 #ifdef SK_SUPPORT_LEGACY_PIXELREF_UNFLATTENABLE |
85 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMallocPixelRef) | 86 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMallocPixelRef) |
| 87 #endif |
86 | 88 |
87 protected: | 89 protected: |
88 // The ownPixels version of this constructor is deprecated. | 90 // The ownPixels version of this constructor is deprecated. |
89 SkMallocPixelRef(const SkImageInfo&, void* addr, size_t rb, SkColorTable*, | 91 SkMallocPixelRef(const SkImageInfo&, void* addr, size_t rb, SkColorTable*, |
90 bool ownPixels); | 92 bool ownPixels); |
| 93 #ifdef SK_SUPPORT_LEGACY_PIXELREF_UNFLATTENABLE |
91 SkMallocPixelRef(SkReadBuffer& buffer); | 94 SkMallocPixelRef(SkReadBuffer& buffer); |
| 95 #endif |
92 virtual ~SkMallocPixelRef(); | 96 virtual ~SkMallocPixelRef(); |
93 | 97 |
94 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE; | 98 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE; |
95 virtual void onUnlockPixels() SK_OVERRIDE; | 99 virtual void onUnlockPixels() SK_OVERRIDE; |
96 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | |
97 virtual size_t getAllocatedSizeInBytes() const SK_OVERRIDE; | 100 virtual size_t getAllocatedSizeInBytes() const SK_OVERRIDE; |
98 | 101 |
99 private: | 102 private: |
100 void* fStorage; | 103 void* fStorage; |
101 SkColorTable* fCTable; | 104 SkColorTable* fCTable; |
102 size_t fRB; | 105 size_t fRB; |
103 ReleaseProc fReleaseProc; | 106 ReleaseProc fReleaseProc; |
104 void* fReleaseProcContext; | 107 void* fReleaseProcContext; |
105 | 108 |
106 SkMallocPixelRef(const SkImageInfo&, void* addr, size_t rb, SkColorTable*, | 109 SkMallocPixelRef(const SkImageInfo&, void* addr, size_t rb, SkColorTable*, |
107 ReleaseProc proc, void* context); | 110 ReleaseProc proc, void* context); |
108 | 111 |
109 typedef SkPixelRef INHERITED; | 112 typedef SkPixelRef INHERITED; |
110 }; | 113 }; |
111 | 114 |
112 | 115 |
113 #endif | 116 #endif |
OLD | NEW |