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 dimensions() describe destination. |
scroggo
2015/07/31 13:35:33
The comment used to distinguish between the dimens
emmaleer
2015/07/31 18:41:56
Acknowledged.
| |
119 * Other fields describe the dst. | |
120 * @param dst Destination to write pixels. Must match info and dstRowBytes | 119 * @param dst Destination to write pixels. Must match info and dstRowBytes |
121 * @param dstRowBytes rowBytes for dst. | 120 * @param dstRowBytes rowBytes for 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 srcWidth is the width of the source. Used to calculate the width samplesize. | |
scroggo
2015/07/31 13:35:33
I think this could use a little bit more explanati
emmaleer
2015/07/31 18:41:56
Acknowledged.
| |
125 * @return A new SkSwizzler or NULL on failure. | 125 * @return A new SkSwizzler or NULL on failure. |
126 */ | 126 */ |
127 static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable, | 127 static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable, |
128 const SkImageInfo&, void* dst, | 128 const SkImageInfo& dstInfo, void* dst, |
129 size_t dstRowBytes, | 129 size_t dstRowBytes, |
130 SkCodec::ZeroInitialized); | 130 SkCodec::ZeroInitialized, int srcWidth); |
131 | 131 |
132 /** | 132 /** |
133 * Fill the remainder of the destination with a single color | 133 * Fill the remainder of the destination with a single color |
134 * | 134 * |
135 * @param dstStartRow | 135 * @param dstStartRow |
136 * The destination row to fill from. | 136 * The destination row to fill from. |
137 * | 137 * |
138 * @param numRows | 138 * @param numRows |
139 * The number of rows to fill. | 139 * The number of rows to fill. |
140 * | 140 * |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 const RowProc fRowProc; | 238 const RowProc fRowProc; |
239 const SkPMColor* fColorTable; // Unowned pointer | 239 const SkPMColor* fColorTable; // Unowned pointer |
240 const int fDeltaSrc; // if bitsPerPixel % 8 == 0 | 240 const int fDeltaSrc; // if bitsPerPixel % 8 == 0 |
241 // deltaSrc is bytesPerPixel | 241 // deltaSrc is bytesPerPixel |
242 // else | 242 // else |
243 // deltaSrc is bitsPerPixel | 243 // deltaSrc is bitsPerPixel |
244 const SkImageInfo fDstInfo; | 244 const SkImageInfo fDstInfo; |
245 void* fDstRow; | 245 void* fDstRow; |
246 const size_t fDstRowBytes; | 246 const size_t fDstRowBytes; |
247 int fCurrY; | 247 int fCurrY; |
248 const int fX0; // first X coord to sample | |
249 const int fSampleX; // step between X samples | |
248 | 250 |
249 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, | 251 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, |
250 const SkImageInfo& info, void* dst, size_t rowBytes); | 252 const SkImageInfo& info, void* dst, size_t rowBytes, int sampleX) ; |
251 | 253 |
252 }; | 254 }; |
253 #endif // SkSwizzler_DEFINED | 255 #endif // SkSwizzler_DEFINED |
OLD | NEW |