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 SkScanlineDecoder_DEFINED | 8 #ifndef SkScanlineDecoder_DEFINED |
9 #define SkScanlineDecoder_DEFINED | 9 #define SkScanlineDecoder_DEFINED |
10 | 10 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 return this->onReallyHasAlpha(); | 70 return this->onReallyHasAlpha(); |
71 } | 71 } |
72 | 72 |
73 protected: | 73 protected: |
74 SkScanlineDecoder(const SkImageInfo& requested) | 74 SkScanlineDecoder(const SkImageInfo& requested) |
75 : fDstInfo(requested) | 75 : fDstInfo(requested) |
76 , fCurrScanline(0) {} | 76 , fCurrScanline(0) {} |
77 | 77 |
78 virtual bool onReallyHasAlpha() const { return false; } | 78 virtual bool onReallyHasAlpha() const { return false; } |
79 | 79 |
80 const SkImageInfo dstInfo() { return fDstInfo; } | |
scroggo
2015/04/24 13:14:28
This method can be const
msarett
2015/04/24 15:08:44
Done.
| |
81 | |
80 private: | 82 private: |
81 const SkImageInfo fDstInfo; | 83 const SkImageInfo fDstInfo; |
82 int fCurrScanline; | 84 int fCurrScanline; |
83 | 85 |
84 // Naive default version just calls onGetScanlines on temp memory. | 86 // Naive default version just calls onGetScanlines on temp memory. |
85 virtual SkImageGenerator::Result onSkipScanlines(int countLines) { | 87 virtual SkImageGenerator::Result onSkipScanlines(int countLines) { |
86 SkAutoMalloc storage(fDstInfo.minRowBytes()); | 88 SkAutoMalloc storage(fDstInfo.minRowBytes()); |
87 // Note that we pass 0 to rowBytes so we continue to use the same memory . | 89 // Note that we pass 0 to rowBytes so we continue to use the same memory . |
88 // Also note that while getScanlines checks that rowBytes is big enough, | 90 // Also note that while getScanlines checks that rowBytes is big enough, |
89 // onGetScanlines bypasses that check. | 91 // onGetScanlines bypasses that check. |
(...skipping 16 matching lines...) Expand all Loading... | |
106 } | 108 } |
107 } | 109 } |
108 | 110 |
109 /** | 111 /** |
110 * This function will be called after reading/skipping all scanlines to do | 112 * This function will be called after reading/skipping all scanlines to do |
111 * any necessary cleanups. | 113 * any necessary cleanups. |
112 */ | 114 */ |
113 virtual void onFinish() {} // Default does nothing. | 115 virtual void onFinish() {} // Default does nothing. |
114 }; | 116 }; |
115 #endif // SkScanlineDecoder_DEFINED | 117 #endif // SkScanlineDecoder_DEFINED |
OLD | NEW |