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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 size_t rowBytes, SkColorTable*, | 57 size_t rowBytes, SkColorTable*, |
58 void* addr, ReleaseProc proc, | 58 void* addr, ReleaseProc proc, |
59 void* context); | 59 void* context); |
60 | 60 |
61 /** | 61 /** |
62 * Return a new SkMallocPixelRef that will use the provided | 62 * Return a new SkMallocPixelRef that will use the provided |
63 * SkData, rowBytes, and optional colortable as pixel storage. | 63 * SkData, rowBytes, and optional colortable as pixel storage. |
64 * The SkData will be ref()ed and on destruction of the PielRef, | 64 * The SkData will be ref()ed and on destruction of the PielRef, |
65 * the SkData will be unref()ed. | 65 * the SkData will be unref()ed. |
66 * | 66 * |
67 * @param offset (in bytes) into the provided SkData that the | |
68 * first pixel is located at. | |
69 * | |
70 * This pixelref will ref() the specified colortable (if not NULL). | 67 * This pixelref will ref() the specified colortable (if not NULL). |
71 * | 68 * |
72 * Returns NULL on failure. | 69 * Returns NULL on failure. |
73 */ | 70 */ |
74 static SkMallocPixelRef* NewWithData(const SkImageInfo& info, | 71 static SkMallocPixelRef* NewWithData(const SkImageInfo& info, |
75 size_t rowBytes, | 72 size_t rowBytes, |
76 SkColorTable* ctable, | 73 SkColorTable* ctable, |
77 SkData* data, | 74 SkData* data); |
78 size_t offset = 0); | |
79 | 75 |
80 void* getAddr() const { return fStorage; } | 76 void* getAddr() const { return fStorage; } |
81 | 77 |
82 class PRFactory : public SkPixelRefFactory { | 78 class PRFactory : public SkPixelRefFactory { |
83 public: | 79 public: |
84 virtual SkPixelRef* create(const SkImageInfo&, | 80 virtual SkPixelRef* create(const SkImageInfo&, |
85 SkColorTable*) SK_OVERRIDE; | 81 SkColorTable*) SK_OVERRIDE; |
86 }; | 82 }; |
87 | 83 |
88 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMallocPixelRef) | 84 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMallocPixelRef) |
(...skipping 18 matching lines...) Expand all Loading... |
107 void* fReleaseProcContext; | 103 void* fReleaseProcContext; |
108 | 104 |
109 SkMallocPixelRef(const SkImageInfo&, void* addr, size_t rb, SkColorTable*, | 105 SkMallocPixelRef(const SkImageInfo&, void* addr, size_t rb, SkColorTable*, |
110 ReleaseProc proc, void* context); | 106 ReleaseProc proc, void* context); |
111 | 107 |
112 typedef SkPixelRef INHERITED; | 108 typedef SkPixelRef INHERITED; |
113 }; | 109 }; |
114 | 110 |
115 | 111 |
116 #endif | 112 #endif |
OLD | NEW |