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

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

Issue 1260673002: SkScaledCodec class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Move Jpeg Swizzler to ScanlineDecoder 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
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 * 108 *
109 */ 109 */
110 static int BytesPerPixel(SrcConfig sc) { 110 static int BytesPerPixel(SrcConfig sc) {
111 SkASSERT(SkIsAlign8(BitsPerPixel(sc))); 111 SkASSERT(SkIsAlign8(BitsPerPixel(sc)));
112 return BitsPerPixel(sc) >> 3; 112 return BitsPerPixel(sc) >> 3;
113 } 113 }
114 114
115 /** 115 /**
116 * Create a new SkSwizzler. 116 * Create a new SkSwizzler.
117 * @param SrcConfig Description of the format of the source. 117 * @param SrcConfig Description of the format of the source.
118 * @param SkImageInfo dimensions() describe both the src and the dst. 118 * @param dstInfo describes the destination.
119 * Other fields describe the dst.
120 * @param ZeroInitialized Whether dst is zero-initialized. The 119 * @param ZeroInitialized Whether dst is zero-initialized. The
121 implementation may choose to skip writing zeroes 120 implementation may choose to skip writing zeroes
122 * if set to kYes_ZeroInitialized. 121 * if set to kYes_ZeroInitialized.
122 * @param srcWidth is the width of the source. Used to calculate the width samplesize.
123 * Width sampling is supported by the swizzler, by skipping pixels when
124 swizzling the row. Height sampling is not supported by t he swizzler,
125 but is implemented in SkScaledCodec.
126 Sampling in Y can be done by a client with a scanline de coder,
127 but sampling in X allows the swizzler to skip swizzling pixels and
128 reading from and writing to memory.
123 * @return A new SkSwizzler or NULL on failure. 129 * @return A new SkSwizzler or NULL on failure.
124 */ 130 */
125 static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable, 131 static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable,
126 const SkImageInfo&, SkCodec::ZeroInitializ ed); 132 const SkImageInfo& dstInfo, SkCodec::ZeroI nitialized,
127 133 int srcWidth);
128 /** 134 /**
129 * Fill the remainder of the destination with a single color 135 * Fill the remainder of the destination with a single color
130 * 136 *
131 * @param dstStartRow 137 * @param dstStartRow
132 * The destination row to fill from. 138 * The destination row to fill from.
133 * 139 *
134 * @param numRows 140 * @param numRows
135 * The number of rows to fill. 141 * The number of rows to fill.
136 * 142 *
137 * @param colorOrIndex 143 * @param colorOrIndex
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 const SkPMColor ctable[]); 196 const SkPMColor ctable[]);
191 197
192 const RowProc fRowProc; 198 const RowProc fRowProc;
193 const SkPMColor* fColorTable; // Unowned pointer 199 const SkPMColor* fColorTable; // Unowned pointer
194 const int fDeltaSrc; // if bitsPerPixel % 8 == 0 200 const int fDeltaSrc; // if bitsPerPixel % 8 == 0
195 // deltaSrc is bytesPerPixel 201 // deltaSrc is bytesPerPixel
196 // else 202 // else
197 // deltaSrc is bitsPerPixel 203 // deltaSrc is bitsPerPixel
198 const SkImageInfo fDstInfo; 204 const SkImageInfo fDstInfo;
199 int fCurrY; 205 int fCurrY;
206 const int fX0; // first X coord to sample
207 const int fSampleX; // step between X samples
200 208
201 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, 209 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, const SkImag eInfo& info,
202 const SkImageInfo& info); 210 int sampleX);
203
204 }; 211 };
205 #endif // SkSwizzler_DEFINED 212 #endif // SkSwizzler_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698