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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 * @param ZeroInitialized Whether dst is zero-initialized. The | 121 * @param ZeroInitialized Whether dst is zero-initialized. The |
122 implementation may choose to skip writing zeroes | 122 implementation may choose to skip writing zeroes |
123 * 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. | 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 | 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, | 126 swizzling the row. Height sampling is not supported by t
he swizzler, |
127 but is implemented in SkScaledCodec. | 127 but is implemented in SkScaledCodec. |
128 Sampling in Y can be done by a client with a scanline de
coder, | 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 | 129 but sampling in X allows the swizzler to skip swizzling
pixels and |
130 reading from and writing to memory. | 130 reading from and writing to memory. |
131 * @return A new SkSwizzler or NULL on failure. | 131 * @return A new SkSwizzler or nullptr on failure. |
132 */ | 132 */ |
133 static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable, | 133 static SkSwizzler* CreateSwizzler(SrcConfig, const SkPMColor* ctable, |
134 const SkImageInfo& dstInfo, SkCodec::ZeroI
nitialized, | 134 const SkImageInfo& dstInfo, SkCodec::ZeroI
nitialized, |
135 const SkImageInfo& srcInfo); | 135 const SkImageInfo& srcInfo); |
136 /** | 136 /** |
137 * Fill the remainder of the destination with a single color | 137 * Fill the remainder of the destination with a single color |
138 * | 138 * |
139 * @param dstStartRow | 139 * @param dstStartRow |
140 * The destination row to fill from. | 140 * The destination row to fill from. |
141 * | 141 * |
142 * @param numRows | 142 * @param numRows |
143 * The number of rows to fill. | 143 * The number of rows to fill. |
144 * | 144 * |
145 * @param colorOrIndex | 145 * @param colorOrIndex |
146 * @param colorTable | 146 * @param colorTable |
147 * If dstInfo.colorType() is kIndex8, colorOrIndex is assumed to be a uint8_
t | 147 * If dstInfo.colorType() is kIndex8, colorOrIndex is assumed to be a uint8_
t |
148 * index, and colorTable is ignored. Each 8-bit pixel will be set to (uint8_
t) | 148 * index, and colorTable is ignored. Each 8-bit pixel will be set to (uint8_
t) |
149 * index. | 149 * index. |
150 * | 150 * |
151 * If dstInfo.colorType() is kN32, colorOrIndex is treated differently depen
ding on | 151 * If dstInfo.colorType() is kN32, colorOrIndex is treated differently depen
ding on |
152 * whether colorTable is NULL: | 152 * whether colorTable is nullptr: |
153 * | 153 * |
154 * A NULL colorTable means colorOrIndex is treated as an SkPMColor (premul o
r | 154 * A nullptr colorTable means colorOrIndex is treated as an SkPMColor (premu
l or |
155 * unpremul, depending on dstInfo.alphaType()). Each 4-byte pixel will be se
t to | 155 * unpremul, depending on dstInfo.alphaType()). Each 4-byte pixel will be se
t to |
156 * colorOrIndex. | 156 * colorOrIndex. |
157 | 157 |
158 * A non-NULL colorTable means colorOrIndex is treated as a uint8_t index in
to | 158 * A non-nullptr colorTable means colorOrIndex is treated as a uint8_t index
into |
159 * the colorTable. i.e. each 4-byte pixel will be set to | 159 * the colorTable. i.e. each 4-byte pixel will be set to |
160 * colorTable[(uint8_t) colorOrIndex]. | 160 * colorTable[(uint8_t) colorOrIndex]. |
161 * | 161 * |
162 * If dstInfo.colorType() is kGray, colorOrIndex is always treated as an 8-b
it color. | 162 * If dstInfo.colorType() is kGray, colorOrIndex is always treated as an 8-b
it color. |
163 * | 163 * |
164 * Other SkColorTypes are not supported. | 164 * Other SkColorTypes are not supported. |
165 * | 165 * |
166 */ | 166 */ |
167 static void Fill(void* dstStartRow, const SkImageInfo& dstInfo, size_t dstRo
wBytes, | 167 static void Fill(void* dstStartRow, const SkImageInfo& dstInfo, size_t dstRo
wBytes, |
168 uint32_t numRows, uint32_t colorOrIndex, const SkPMColor* colorTable
); | 168 uint32_t numRows, uint32_t colorOrIndex, const SkPMColor* colorTable
); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // deltaSrc is bitsPerPixel | 207 // deltaSrc is bitsPerPixel |
208 const SkImageInfo fDstInfo; | 208 const SkImageInfo fDstInfo; |
209 int fCurrY; | 209 int fCurrY; |
210 const int fX0; // first X coord to sample | 210 const int fX0; // first X coord to sample |
211 const int fSampleX; // step between X samples | 211 const int fSampleX; // step between X samples |
212 | 212 |
213 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, const SkImag
eInfo& info, | 213 SkSwizzler(RowProc proc, const SkPMColor* ctable, int deltaSrc, const SkImag
eInfo& info, |
214 int sampleX); | 214 int sampleX); |
215 }; | 215 }; |
216 #endif // SkSwizzler_DEFINED | 216 #endif // SkSwizzler_DEFINED |
OLD | NEW |