| 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 "SkBmpMaskCodec.h" | 8 #include "SkBmpMaskCodec.h" |
| 9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 SkCodecPrintf("Error: cannot initialize swizzler.\n"); | 51 SkCodecPrintf("Error: cannot initialize swizzler.\n"); |
| 52 return kInvalidConversion; | 52 return kInvalidConversion; |
| 53 } | 53 } |
| 54 | 54 |
| 55 return this->decode(dstInfo, dst, dstRowBytes, opts); | 55 return this->decode(dstInfo, dst, dstRowBytes, opts); |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool SkBmpMaskCodec::initializeSwizzler(const SkImageInfo& dstInfo) { | 58 bool SkBmpMaskCodec::initializeSwizzler(const SkImageInfo& dstInfo) { |
| 59 // Allocate space for a row buffer | 59 // Allocate space for a row buffer |
| 60 const size_t rowBytes = SkAlign4(compute_row_bytes(dstInfo.width(), this->bi
tsPerPixel())); | 60 const size_t rowBytes = SkAlign4(compute_row_bytes(dstInfo.width(), this->bi
tsPerPixel())); |
| 61 fSrcBuffer.reset(SkNEW_ARRAY(uint8_t, rowBytes)); | 61 fSrcBuffer.reset(new uint8_t[rowBytes]); |
| 62 | 62 |
| 63 // Create the swizzler | 63 // Create the swizzler |
| 64 fMaskSwizzler.reset(SkMaskSwizzler::CreateMaskSwizzler( | 64 fMaskSwizzler.reset(SkMaskSwizzler::CreateMaskSwizzler( |
| 65 dstInfo, fMasks, this->bitsPerPixel())); | 65 dstInfo, fMasks, this->bitsPerPixel())); |
| 66 | 66 |
| 67 if (NULL == fMaskSwizzler.get()) { | 67 if (NULL == fMaskSwizzler.get()) { |
| 68 return false; | 68 return false; |
| 69 } | 69 } |
| 70 | 70 |
| 71 return true; | 71 return true; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 101 | 101 |
| 102 // Decode the row in destination format | 102 // Decode the row in destination format |
| 103 int row = SkBmpCodec::kBottomUp_RowOrder == this->rowOrder() ? height -
1 - y : y; | 103 int row = SkBmpCodec::kBottomUp_RowOrder == this->rowOrder() ? height -
1 - y : y; |
| 104 void* dstRow = SkTAddOffset<void>(dst, row * dstRowBytes); | 104 void* dstRow = SkTAddOffset<void>(dst, row * dstRowBytes); |
| 105 fMaskSwizzler->swizzle(dstRow, srcRow); | 105 fMaskSwizzler->swizzle(dstRow, srcRow); |
| 106 } | 106 } |
| 107 | 107 |
| 108 // Finished decoding the entire image | 108 // Finished decoding the entire image |
| 109 return kSuccess; | 109 return kSuccess; |
| 110 } | 110 } |
| OLD | NEW |