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

Side by Side Diff: include/codec/SkScanlineDecoder.h

Issue 1287423002: Scanline decoding for bmp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Response to comments - Does not compile - Needs rebase for conv_poss update Created 5 years, 4 months 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 | src/codec/SkBmpCodec.h » ('j') | src/codec/SkBmpCodec.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 * FIXME: see skbug.com/3582. 132 * FIXME: see skbug.com/3582.
133 */ 133 */
134 bool reallyHasAlpha() const { 134 bool reallyHasAlpha() const {
135 return this->onReallyHasAlpha(); 135 return this->onReallyHasAlpha();
136 } 136 }
137 137
138 protected: 138 protected:
139 SkScanlineDecoder(const SkImageInfo& srcInfo) 139 SkScanlineDecoder(const SkImageInfo& srcInfo)
140 : fSrcInfo(srcInfo) 140 : fSrcInfo(srcInfo)
141 , fDstInfo() 141 , fDstInfo()
142 , fOptions()
142 , fCurrScanline(0) {} 143 , fCurrScanline(0) {}
143 144
144 virtual bool onReallyHasAlpha() const { return false; } 145 virtual bool onReallyHasAlpha() const { return false; }
145 146
146 const SkImageInfo& dstInfo() const { return fDstInfo; } 147 const SkImageInfo& dstInfo() const { return fDstInfo; }
147 148
149 const SkCodec::Options& options() const { return fOptions; }
150
148 private: 151 private:
149 const SkImageInfo fSrcInfo; 152 const SkImageInfo fSrcInfo;
150 SkImageInfo fDstInfo; 153 SkImageInfo fDstInfo;
154 SkCodec::Options fOptions;
151 int fCurrScanline; 155 int fCurrScanline;
152 156
153 virtual SkCodec::Result onStart(const SkImageInfo& dstInfo, 157 virtual SkCodec::Result onStart(const SkImageInfo& dstInfo,
154 const SkCodec::Options& options, 158 const SkCodec::Options& options,
155 SkPMColor ctable[], int* ctableCount) = 0; 159 SkPMColor ctable[], int* ctableCount) = 0;
156 160
157 // Naive default version just calls onGetScanlines on temp memory. 161 // Naive default version just calls onGetScanlines on temp memory.
158 virtual SkCodec::Result onSkipScanlines(int countLines) { 162 virtual SkCodec::Result onSkipScanlines(int countLines) {
159 SkAutoMalloc storage(fDstInfo.minRowBytes()); 163 SkAutoMalloc storage(fDstInfo.minRowBytes());
160 // Note that we pass 0 to rowBytes so we continue to use the same memory . 164 // Note that we pass 0 to rowBytes so we continue to use the same memory .
161 // Also note that while getScanlines checks that rowBytes is big enough, 165 // Also note that while getScanlines checks that rowBytes is big enough,
162 // onGetScanlines bypasses that check. 166 // onGetScanlines bypasses that check.
163 // Calling the virtual method also means we do not double count 167 // Calling the virtual method also means we do not double count
164 // countLines. 168 // countLines.
165 return this->onGetScanlines(storage.get(), countLines, 0); 169 return this->onGetScanlines(storage.get(), countLines, 0);
166 } 170 }
167 171
168 virtual SkCodec::Result onGetScanlines(void* dst, int countLines, 172 virtual SkCodec::Result onGetScanlines(void* dst, int countLines,
169 size_t rowBytes) = 0; 173 size_t rowBytes) = 0;
170 174
171 }; 175 };
172 #endif // SkScanlineDecoder_DEFINED 176 #endif // SkScanlineDecoder_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/codec/SkBmpCodec.h » ('j') | src/codec/SkBmpCodec.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698