OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 SkCodec_DEFINED | 8 #ifndef SkCodec_DEFINED |
9 #define SkCodec_DEFINED | 9 #define SkCodec_DEFINED |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 * initially returns a non-opaque answer, but completing the decode | 64 * initially returns a non-opaque answer, but completing the decode |
65 * reveals that the image is actually opaque. | 65 * reveals that the image is actually opaque. |
66 */ | 66 */ |
67 #ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO | 67 #ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO |
68 bool onGetInfo(SkImageInfo* info) SK_OVERRIDE { | 68 bool onGetInfo(SkImageInfo* info) SK_OVERRIDE { |
69 *info = fInfo; | 69 *info = fInfo; |
70 return true; | 70 return true; |
71 } | 71 } |
72 #endif | 72 #endif |
73 | 73 |
| 74 // Helper for subclasses. |
| 75 const SkImageInfo& getOriginalInfo() { return fInfo; } |
| 76 |
74 virtual SkISize onGetScaledDimensions(float /* desiredScale */) const { | 77 virtual SkISize onGetScaledDimensions(float /* desiredScale */) const { |
75 // By default, scaling is not supported. | 78 // By default, scaling is not supported. |
76 return fInfo.dimensions(); | 79 return fInfo.dimensions(); |
77 } | 80 } |
78 | 81 |
79 virtual SkEncodedFormat onGetEncodedFormat() const = 0; | 82 virtual SkEncodedFormat onGetEncodedFormat() const = 0; |
80 | 83 |
81 /** | 84 /** |
82 * If the stream was previously read, attempt to rewind. | 85 * If the stream was previously read, attempt to rewind. |
83 * @returns: | 86 * @returns: |
(...skipping 19 matching lines...) Expand all Loading... |
103 } | 106 } |
104 | 107 |
105 private: | 108 private: |
106 const SkImageInfo fInfo; | 109 const SkImageInfo fInfo; |
107 SkAutoTDelete<SkStream> fStream; | 110 SkAutoTDelete<SkStream> fStream; |
108 bool fNeedsRewind; | 111 bool fNeedsRewind; |
109 | 112 |
110 typedef SkImageGenerator INHERITED; | 113 typedef SkImageGenerator INHERITED; |
111 }; | 114 }; |
112 #endif // SkCodec_DEFINED | 115 #endif // SkCodec_DEFINED |
OLD | NEW |