OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
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 #ifndef SkPixelSerializer_DEFINED | 8 #ifndef SkPixelSerializer_DEFINED |
9 #define SkPixelSerializer_DEFINED | 9 #define SkPixelSerializer_DEFINED |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 * false, serialize another version (e.g. the result of encodePixels). | 25 * false, serialize another version (e.g. the result of encodePixels). |
26 */ | 26 */ |
27 bool useEncodedData(const void* data, size_t len) { | 27 bool useEncodedData(const void* data, size_t len) { |
28 return this->onUseEncodedData(data, len); | 28 return this->onUseEncodedData(data, len); |
29 } | 29 } |
30 | 30 |
31 /** | 31 /** |
32 * Call to get the client's version of encoding these pixels. If it | 32 * Call to get the client's version of encoding these pixels. If it |
33 * returns NULL, serialize the raw pixels. | 33 * returns NULL, serialize the raw pixels. |
34 */ | 34 */ |
35 SkData* encodePixels(const SkImageInfo& info, void* pixels, size_t rowBytes)
{ | 35 SkData* encodePixels(const SkImageInfo& info, const void* pixels, size_t row
Bytes) { |
36 return this->onEncodePixels(info, pixels, rowBytes); | 36 return this->onEncodePixels(info, pixels, rowBytes); |
37 } | 37 } |
38 | 38 |
39 protected: | 39 protected: |
40 /** | 40 /** |
41 * Return true if you want to serialize the encoded data, false if you want | 41 * Return true if you want to serialize the encoded data, false if you want |
42 * another version serialized (e.g. the result of encodePixels). | 42 * another version serialized (e.g. the result of encodePixels). |
43 */ | 43 */ |
44 virtual bool onUseEncodedData(const void* data, size_t len) = 0; | 44 virtual bool onUseEncodedData(const void* data, size_t len) = 0; |
45 | 45 |
46 /** | 46 /** |
47 * If you want to encode these pixels, return the encoded data as an SkData | 47 * If you want to encode these pixels, return the encoded data as an SkData |
48 * Return null if you want to serialize the raw pixels. | 48 * Return null if you want to serialize the raw pixels. |
49 */ | 49 */ |
50 virtual SkData* onEncodePixels(const SkImageInfo&, void* pixels, size_t rowB
ytes) = 0; | 50 virtual SkData* onEncodePixels(const SkImageInfo&, const void* pixels, size_
t rowBytes) = 0; |
51 }; | 51 }; |
52 #endif // SkPixelSerializer_DEFINED | 52 #endif // SkPixelSerializer_DEFINED |
OLD | NEW |