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

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

Issue 1092303003: Scanline decoding for jpeg (Closed) Base URL: https://skia.googlesource.com/skia.git@index-scanline
Patch Set: Return a reference to ImageInfo Created 5 years, 7 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/SkJpegCodec.h » ('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 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
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() const { return fDstInfo; }
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
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
OLDNEW
« no previous file with comments | « no previous file | src/codec/SkJpegCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698