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

Side by Side Diff: src/codec/SkBmpStandardCodec.cpp

Issue 1641273003: Support decoding opaque to *premul (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update SkMaskSwizzler to support opaque to premul Created 4 years, 10 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 #include "SkBmpStandardCodec.h" 8 #include "SkBmpStandardCodec.h"
9 #include "SkCodecPriv.h" 9 #include "SkCodecPriv.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 case 4: 175 case 4:
176 config = SkSwizzler::kIndex4; 176 config = SkSwizzler::kIndex4;
177 break; 177 break;
178 case 8: 178 case 8:
179 config = SkSwizzler::kIndex; 179 config = SkSwizzler::kIndex;
180 break; 180 break;
181 case 24: 181 case 24:
182 config = SkSwizzler::kBGR; 182 config = SkSwizzler::kBGR;
183 break; 183 break;
184 case 32: 184 case 32:
185 if (kOpaque_SkAlphaType == dstInfo.alphaType()) { 185 if (kOpaque_SkAlphaType == this->getInfo().alphaType()) {
186 config = SkSwizzler::kBGRX; 186 config = SkSwizzler::kBGRX;
187 } else { 187 } else {
188 config = SkSwizzler::kBGRA; 188 config = SkSwizzler::kBGRA;
189 } 189 }
190 break; 190 break;
191 default: 191 default:
192 SkASSERT(false); 192 SkASSERT(false);
193 return false; 193 return false;
194 } 194 }
195 195
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 int modulus; 330 int modulus;
331 SkTDivMod(srcX, 8, &quotient, &modulus); 331 SkTDivMod(srcX, 8, &quotient, &modulus);
332 uint32_t shift = 7 - modulus; 332 uint32_t shift = 7 - modulus;
333 uint32_t alphaBit = (fSrcBuffer.get()[quotient] >> shift) & 0x1; 333 uint32_t alphaBit = (fSrcBuffer.get()[quotient] >> shift) & 0x1;
334 dstRow[dstX] &= alphaBit - 1; 334 dstRow[dstX] &= alphaBit - 1;
335 srcX += sampleX; 335 srcX += sampleX;
336 } 336 }
337 } 337 }
338 } 338 }
339 339
340 uint32_t SkBmpStandardCodec::onGetFillValue(SkColorType colorType, SkAlphaType a lphaType) const { 340 uint32_t SkBmpStandardCodec::onGetFillValue(SkColorType colorType) const {
341 const SkPMColor* colorPtr = get_color_ptr(fColorTable.get()); 341 const SkPMColor* colorPtr = get_color_ptr(fColorTable.get());
342 if (colorPtr) { 342 if (colorPtr) {
343 return get_color_table_fill_value(colorType, colorPtr, 0); 343 return get_color_table_fill_value(colorType, colorPtr, 0);
344 } 344 }
345 return INHERITED::onGetFillValue(colorType, alphaType); 345 return INHERITED::onGetFillValue(colorType);
346 } 346 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698