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 #include "SkColorPriv.h" | 8 #include "SkColorPriv.h" |
9 #include "SkSwizzler.h" | 9 #include "SkSwizzler.h" |
10 #include "SkTemplates.h" | 10 #include "SkTemplates.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 src += deltaSrc; | 129 src += deltaSrc; |
130 alphaMask &= alpha; | 130 alphaMask &= alpha; |
131 } | 131 } |
132 return alphaMask != 0xFF; | 132 return alphaMask != 0xFF; |
133 } | 133 } |
134 */ | 134 */ |
135 | 135 |
136 SkSwizzler* SkSwizzler::CreateSwizzler(SkSwizzler::SrcConfig sc, const SkPMColor
* ctable, | 136 SkSwizzler* SkSwizzler::CreateSwizzler(SkSwizzler::SrcConfig sc, const SkPMColor
* ctable, |
137 const SkImageInfo& info, void* dst, | 137 const SkImageInfo& info, void* dst, |
138 size_t dstRowBytes, bool skipZeroes) { | 138 size_t dstRowBytes, bool skipZeroes) { |
139 if (info.colorType() == kUnknown_SkColorType) { | 139 if (info.colorType() == kUnknown_SkColorType || kUnknown == sc) { |
140 return NULL; | 140 return NULL; |
141 } | 141 } |
142 if (info.minRowBytes() > dstRowBytes) { | 142 if (info.minRowBytes() > dstRowBytes) { |
143 return NULL; | 143 return NULL; |
144 } | 144 } |
145 if (kIndex == sc && NULL == ctable) { | 145 if (kIndex == sc && NULL == ctable) { |
146 return NULL; | 146 return NULL; |
147 } | 147 } |
148 RowProc proc = NULL; | 148 RowProc proc = NULL; |
149 switch (sc) { | 149 switch (sc) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 , fSrcPixelSize(srcBpp) | 206 , fSrcPixelSize(srcBpp) |
207 , fDstInfo(info) | 207 , fDstInfo(info) |
208 , fDstRow(dst) | 208 , fDstRow(dst) |
209 , fDstRowBytes(rowBytes) | 209 , fDstRowBytes(rowBytes) |
210 , fCurrY(0) | 210 , fCurrY(0) |
211 { | 211 { |
212 } | 212 } |
213 | 213 |
214 bool SkSwizzler::next(const uint8_t* SK_RESTRICT src) { | 214 bool SkSwizzler::next(const uint8_t* SK_RESTRICT src) { |
215 SkASSERT(fCurrY < fDstInfo.height()); | 215 SkASSERT(fCurrY < fDstInfo.height()); |
| 216 SkASSERT(fDstRow != NULL); |
216 const bool hadAlpha = fRowProc(fDstRow, src, fDstInfo.width(), fSrcPixelSize
, | 217 const bool hadAlpha = fRowProc(fDstRow, src, fDstInfo.width(), fSrcPixelSize
, |
217 fCurrY, fColorTable); | 218 fCurrY, fColorTable); |
218 fCurrY++; | 219 fCurrY++; |
219 fDstRow = SkTAddOffset<void>(fDstRow, fDstRowBytes); | 220 fDstRow = SkTAddOffset<void>(fDstRow, fDstRowBytes); |
220 return hadAlpha; | 221 return hadAlpha; |
221 } | 222 } |
OLD | NEW |