OLD | NEW |
---|---|
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 Loading... | |
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 swi zzling the row. | |
scroggo
2015/07/31 19:31:58
Maybe this should also explain why we chose to sup
emmaleer
2015/07/31 20:43:10
Acknowledged.
| |
124 * Height sampling is not supported by the swizzler, but is implemented in SkScaledCodec. | |
123 * @return A new SkSwizzler or NULL on failure. | 125 * @return A new SkSwizzler or NULL on failure. |
124 */ | 126 */ |
125 static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable, | 127 static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable, |
126 const SkImageInfo&, SkCodec::ZeroInitializ ed); | 128 const SkImageInfo& dstInfo, SkCodec::ZeroI nitialized, |
127 | 129 int srcWidth); |
128 /** | 130 /** |
129 * Fill the remainder of the destination with a single color | 131 * Fill the remainder of the destination with a single color |
130 * | 132 * |
131 * @param dstStartRow | 133 * @param dstStartRow |
132 * The destination row to fill from. | 134 * The destination row to fill from. |
133 * | 135 * |
134 * @param numRows | 136 * @param numRows |
135 * The number of rows to fill. | 137 * The number of rows to fill. |
136 * | 138 * |
137 * @param colorOrIndex | 139 * @param colorOrIndex |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 const SkPMColor ctable[]); | 192 const SkPMColor ctable[]); |
191 | 193 |
192 const RowProc fRowProc; | 194 const RowProc fRowProc; |
193 const SkPMColor* fColorTable; // Unowned pointer | 195 const SkPMColor* fColorTable; // Unowned pointer |
194 const int fDeltaSrc; // if bitsPerPixel % 8 == 0 | 196 const int fDeltaSrc; // if bitsPerPixel % 8 == 0 |
195 // deltaSrc is bytesPerPixel | 197 // deltaSrc is bytesPerPixel |
196 // else | 198 // else |
197 // deltaSrc is bitsPerPixel | 199 // deltaSrc is bitsPerPixel |
198 const SkImageInfo fDstInfo; | 200 const SkImageInfo fDstInfo; |
199 int fCurrY; | 201 int fCurrY; |
202 const int fX0; // first X coord to sample | |
203 const int fSampleX; // step between X samples | |
200 | 204 |
201 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, | 205 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, const SkImag eInfo& info, |
202 const SkImageInfo& info); | 206 int sampleX); |
203 | |
204 }; | 207 }; |
205 #endif // SkSwizzler_DEFINED | 208 #endif // SkSwizzler_DEFINED |
OLD | NEW |