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

Side by Side Diff: src/codec/SkSwizzler.h

Issue 1390213002: Add subsetting to SkScanlineDecoder (Closed) Base URL: https://skia.googlesource.com/skia.git@fill-refactor
Patch Set: Response to comments Created 5 years, 2 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 | « src/codec/SkMaskSwizzler.cpp ('k') | src/codec/SkSwizzler.cpp » ('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 SkSwizzler_DEFINED 8 #ifndef SkSwizzler_DEFINED
9 #define SkSwizzler_DEFINED 9 #define SkSwizzler_DEFINED
10 10
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 SkASSERT(SkIsAlign8(BitsPerPixel(sc))); 114 SkASSERT(SkIsAlign8(BitsPerPixel(sc)));
115 return BitsPerPixel(sc) >> 3; 115 return BitsPerPixel(sc) >> 3;
116 } 116 }
117 117
118 /** 118 /**
119 * Create a new SkSwizzler. 119 * Create a new SkSwizzler.
120 * @param SrcConfig Description of the format of the source. 120 * @param SrcConfig Description of the format of the source.
121 * @param ctable Unowned pointer to an array of up to 256 colors for an 121 * @param ctable Unowned pointer to an array of up to 256 colors for an
122 * index source. 122 * index source.
123 * @param dstInfo Describes the destination. 123 * @param dstInfo Describes the destination.
124 * @param ZeroInitialized Whether dst is zero-initialized. The 124 * @param options Indicates if dst is zero-initialized. The
125 * implementation may choose to skip writing zeroes 125 * implementation may choose to skip writing zeroes
126 * if set to kYes_ZeroInitialized. 126 * if set to kYes_ZeroInitialized.
127 * Contains subset information.
127 * @return A new SkSwizzler or nullptr on failure. 128 * @return A new SkSwizzler or nullptr on failure.
128 */ 129 */
129 static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable, 130 static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable,
130 const SkImageInfo& dstInfo, SkCodec::ZeroI nitialized); 131 const SkImageInfo& dstInfo, const SkCodec: :Options&);
131 132
132 /** 133 /**
133 * Swizzle a line. Generally this will be called height times, once 134 * Swizzle a line. Generally this will be called height times, once
134 * for each row of source. 135 * for each row of source.
135 * By allowing the caller to pass in the dst pointer, we give the caller 136 * By allowing the caller to pass in the dst pointer, we give the caller
136 * flexibility to use the swizzler even when the encoded data does not 137 * flexibility to use the swizzler even when the encoded data does not
137 * store the rows in order. This also improves usability for scaled and 138 * store the rows in order. This also improves usability for scaled and
138 * subset decodes. 139 * subset decodes.
139 * @param dst Where we write the output. 140 * @param dst Where we write the output.
140 * @param src The next row of the source data. 141 * @param src The next row of the source data.
(...skipping 25 matching lines...) Expand all
166 * @param offset The offset before the first pixel to sample. 167 * @param offset The offset before the first pixel to sample.
167 Is in bytes or bits based on what deltaSrc is in. 168 Is in bytes or bits based on what deltaSrc is in.
168 */ 169 */
169 typedef ResultAlpha (*RowProc)(void* SK_RESTRICT dstRow, 170 typedef ResultAlpha (*RowProc)(void* SK_RESTRICT dstRow,
170 const uint8_t* SK_RESTRICT src, 171 const uint8_t* SK_RESTRICT src,
171 int dstWidth, int bpp, int deltaSrc, int offs et, 172 int dstWidth, int bpp, int deltaSrc, int offs et,
172 const SkPMColor ctable[]); 173 const SkPMColor ctable[]);
173 174
174 const RowProc fRowProc; 175 const RowProc fRowProc;
175 const SkPMColor* fColorTable; // Unowned pointer 176 const SkPMColor* fColorTable; // Unowned pointer
176 const int fDeltaSrc; // if bitsPerPixel % 8 == 0 177 const int fSrcOffset; // Offset of the src in pixels, allows for partial
177 // deltaSrc is bytesPerPixel 178 // scanline decodes.
178 // else 179 int fX0; // Start coordinate for the src, may b e different than
179 // deltaSrc is bitsPerPixel 180 // fSrcOffset if we are sampling.
180 const int fSrcWidth; // Width of the source - i.e. before a ny sampling. 181 const int fSrcWidth; // Width of the source - i.e. before a ny sampling.
181 int fDstWidth; // Width of dst, which may differ with sampling. 182 int fDstWidth; // Width of dst, which may differ with sampling.
182 int fX0; // first X coord to sample
183 int fSampleX; // step between X samples 183 int fSampleX; // step between X samples
184 const int fBPP; // if bitsPerPixel % 8 == 0
185 // fBPP is bytesPerPixel
186 // else
187 // fBPP is bitsPerPixel
184 188
185 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, int srcWidth ); 189 SkSwizzler(RowProc proc, const SkPMColor* ctable, int srcOffset, int srcWidt h, int bpp);
186 190
187 int onSetSampleX(int) override; 191 int onSetSampleX(int) override;
188 192
189 }; 193 };
190 #endif // SkSwizzler_DEFINED 194 #endif // SkSwizzler_DEFINED
OLDNEW
« no previous file with comments | « src/codec/SkMaskSwizzler.cpp ('k') | src/codec/SkSwizzler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698