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

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

Issue 1260673002: SkScaledCodec class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Stop DM from running large interlaced images on 32-bit Ubuntu GCE bots b/c they are running out of … 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 | « src/codec/SkScaledCodec.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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 * 110 *
111 */ 111 */
112 static int BytesPerPixel(SrcConfig sc) { 112 static int BytesPerPixel(SrcConfig sc) {
113 SkASSERT(SkIsAlign8(BitsPerPixel(sc))); 113 SkASSERT(SkIsAlign8(BitsPerPixel(sc)));
114 return BitsPerPixel(sc) >> 3; 114 return BitsPerPixel(sc) >> 3;
115 } 115 }
116 116
117 /** 117 /**
118 * Create a new SkSwizzler. 118 * Create a new SkSwizzler.
119 * @param SrcConfig Description of the format of the source. 119 * @param SrcConfig Description of the format of the source.
120 * @param SkImageInfo dimensions() describe both the src and the dst. 120 * @param dstInfo describes the destination.
121 * Other fields describe the dst.
122 * @param ZeroInitialized Whether dst is zero-initialized. The 121 * @param ZeroInitialized Whether dst is zero-initialized. The
123 implementation may choose to skip writing zeroes 122 implementation may choose to skip writing zeroes
124 * if set to kYes_ZeroInitialized. 123 * if set to kYes_ZeroInitialized.
124 * @param srcInfo is the info of the source. Used to calculate the width sa mplesize.
125 * Width sampling is supported by the swizzler, by skipping pixels when
126 swizzling the row. Height sampling is not supported by t he swizzler,
127 but is implemented in SkScaledCodec.
128 Sampling in Y can be done by a client with a scanline de coder,
129 but sampling in X allows the swizzler to skip swizzling pixels and
130 reading from and writing to memory.
125 * @return A new SkSwizzler or NULL on failure. 131 * @return A new SkSwizzler or NULL on failure.
126 */ 132 */
127 static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable, 133 static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable,
128 const SkImageInfo&, SkCodec::ZeroInitializ ed); 134 const SkImageInfo& dstInfo, SkCodec::ZeroI nitialized,
129 135 const SkImageInfo& srcInfo);
130 /** 136 /**
131 * Fill the remainder of the destination with a single color 137 * Fill the remainder of the destination with a single color
132 * 138 *
133 * @param dstStartRow 139 * @param dstStartRow
134 * The destination row to fill from. 140 * The destination row to fill from.
135 * 141 *
136 * @param numRows 142 * @param numRows
137 * The number of rows to fill. 143 * The number of rows to fill.
138 * 144 *
139 * @param colorOrIndex 145 * @param colorOrIndex
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 * transparent, or neither 180 * transparent, or neither
175 */ 181 */
176 ResultAlpha swizzle(void* dst, const uint8_t* SK_RESTRICT src); 182 ResultAlpha swizzle(void* dst, const uint8_t* SK_RESTRICT src);
177 183
178 private: 184 private:
179 185
180 /** 186 /**
181 * Method for converting raw data to Skia pixels. 187 * Method for converting raw data to Skia pixels.
182 * @param dstRow Row in which to write the resulting pixels. 188 * @param dstRow Row in which to write the resulting pixels.
183 * @param src Row of src data, in format specified by SrcConfig 189 * @param src Row of src data, in format specified by SrcConfig
184 * @param width Width in pixels 190 * @param dstWidth Width in pixels of the destination
185 * @param deltaSrc if bitsPerPixel % 8 == 0, deltaSrc is bytesPerPixel 191 * @param deltaSrc if bitsPerPixel % 8 == 0, deltaSrc is bytesPerPixel
186 * else, deltaSrc is bitsPerPixel 192 * else, deltaSrc is bitsPerPixel
187 * @param ctable Colors (used for kIndex source). 193 * @param ctable Colors (used for kIndex source).
194 * @param offset The offset before the first pixel to sample.
195 Is in bytes or bits based on what deltaSrc is in.
188 */ 196 */
189 typedef ResultAlpha (*RowProc)(void* SK_RESTRICT dstRow, 197 typedef ResultAlpha (*RowProc)(void* SK_RESTRICT dstRow,
190 const uint8_t* SK_RESTRICT src, 198 const uint8_t* SK_RESTRICT src,
191 int width, int deltaSrc, 199 int dstWidth, int deltaSrc, int offset,
192 const SkPMColor ctable[]); 200 const SkPMColor ctable[]);
193 201
194 const RowProc fRowProc; 202 const RowProc fRowProc;
195 const SkPMColor* fColorTable; // Unowned pointer 203 const SkPMColor* fColorTable; // Unowned pointer
196 const int fDeltaSrc; // if bitsPerPixel % 8 == 0 204 const int fDeltaSrc; // if bitsPerPixel % 8 == 0
197 // deltaSrc is bytesPerPixel 205 // deltaSrc is bytesPerPixel
198 // else 206 // else
199 // deltaSrc is bitsPerPixel 207 // deltaSrc is bitsPerPixel
200 const SkImageInfo fDstInfo; 208 const SkImageInfo fDstInfo;
201 int fCurrY; 209 int fCurrY;
210 const int fX0; // first X coord to sample
211 const int fSampleX; // step between X samples
202 212
203 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, 213 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, const SkImag eInfo& info,
204 const SkImageInfo& info); 214 int sampleX);
205
206 }; 215 };
207 #endif // SkSwizzler_DEFINED 216 #endif // SkSwizzler_DEFINED
OLDNEW
« no previous file with comments | « src/codec/SkScaledCodec.cpp ('k') | src/codec/SkSwizzler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698