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 | |
77 virtual SkISize onGetScaledDimensions(float /* desiredScale */) const { | 74 virtual SkISize onGetScaledDimensions(float /* desiredScale */) const { |
78 // By default, scaling is not supported. | 75 // By default, scaling is not supported. |
79 return fInfo.dimensions(); | 76 return fInfo.dimensions(); |
80 } | 77 } |
81 | 78 |
82 virtual SkEncodedFormat onGetEncodedFormat() const = 0; | 79 virtual SkEncodedFormat onGetEncodedFormat() const = 0; |
83 | 80 |
84 /** | 81 /** |
85 * If the stream was previously read, attempt to rewind. | 82 * If the stream was previously read, attempt to rewind. |
86 * @returns: | 83 * @returns: |
(...skipping 19 matching lines...) Expand all Loading... |
106 } | 103 } |
107 | 104 |
108 private: | 105 private: |
109 const SkImageInfo fInfo; | 106 const SkImageInfo fInfo; |
110 SkAutoTDelete<SkStream> fStream; | 107 SkAutoTDelete<SkStream> fStream; |
111 bool fNeedsRewind; | 108 bool fNeedsRewind; |
112 | 109 |
113 typedef SkImageGenerator INHERITED; | 110 typedef SkImageGenerator INHERITED; |
114 }; | 111 }; |
115 #endif // SkCodec_DEFINED | 112 #endif // SkCodec_DEFINED |
OLD | NEW |