Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(571)

Side by Side Diff: include/core/SkPixelSerializer.h

Issue 1512333002: SkPixelSerializer: remove deprecated virtual (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/ImageTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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* encode(const SkPixmap& pixmap) { 35 SkData* encode(const SkPixmap& pixmap) { return this->onEncode(pixmap); }
36 SkData* data = this->onEncode(pixmap);
37 return data ? data : this->onEncodePixels(
38 pixmap.info(), pixmap.addr(), pixmap.rowBytes());
39 }
40 36
41 protected: 37 protected:
42 /** 38 /**
43 * Return true if you want to serialize the encoded data, false if you want 39 * Return true if you want to serialize the encoded data, false if you want
44 * another version serialized (e.g. the result of encodePixels). 40 * another version serialized (e.g. the result of this->encode()).
45 */ 41 */
46 virtual bool onUseEncodedData(const void* data, size_t len) = 0; 42 virtual bool onUseEncodedData(const void* data, size_t len) = 0;
47 43
48 /** 44 /**
49 * If you want to encode these pixels, return the encoded data as an SkData 45 * If you want to encode these pixels, return the encoded data as an SkData
50 * Return null if you want to serialize the raw pixels. 46 * Return null if you want to serialize the raw pixels.
51 */ 47 */
52 // NOTE: onEncodePixels() is deprecated and removed in a later CL. 48 virtual SkData* onEncode(const SkPixmap&) = 0;
53 // Subclasses should implement onEncode() instead. Subclasses
54 // should implement at least one of onEncodePixels() or
55 // onUseEncodedData().
56 virtual SkData* onEncodePixels(const SkImageInfo&,
57 const void* /*pixels*/,
58 size_t /*rowBytes*/) {
59 return nullptr;
60 }
61 virtual SkData* onEncode(const SkPixmap&) { return nullptr; }
62 }; 49 };
63 #endif // SkPixelSerializer_DEFINED 50 #endif // SkPixelSerializer_DEFINED
OLDNEW
« no previous file with comments | « no previous file | tests/ImageTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698