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 22 matching lines...) Expand all Loading... |
33 default: | 33 default: |
34 return false; | 34 return false; |
35 } | 35 } |
36 } | 36 } |
37 | 37 |
38 | 38 |
39 /* | 39 /* |
40 * Creates an instance of the decoder | 40 * Creates an instance of the decoder |
41 */ | 41 */ |
42 SkBmpMaskCodec::SkBmpMaskCodec(const SkImageInfo& info, SkStream* stream, | 42 SkBmpMaskCodec::SkBmpMaskCodec(const SkImageInfo& info, SkStream* stream, |
| 43 SkBmpCodec::BmpInputFormat inputFormat, |
43 uint16_t bitsPerPixel, SkMasks* masks, | 44 uint16_t bitsPerPixel, SkMasks* masks, |
44 SkBmpCodec::RowOrder rowOrder) | 45 SkBmpCodec::RowOrder rowOrder) |
45 : INHERITED(info, stream, bitsPerPixel, rowOrder) | 46 : INHERITED(info, stream, inputFormat, bitsPerPixel, rowOrder) |
46 , fMasks(masks) | 47 , fMasks(masks) |
47 , fMaskSwizzler(NULL) | 48 , fMaskSwizzler(NULL) |
48 , fSrcBuffer(NULL) | 49 , fSrcBuffer(NULL) |
49 {} | 50 {} |
50 | 51 |
51 /* | 52 /* |
52 * Initiates the bitmap decode | 53 * Initiates the bitmap decode |
53 */ | 54 */ |
54 SkCodec::Result SkBmpMaskCodec::onGetPixels(const SkImageInfo& dstInfo, | 55 SkCodec::Result SkBmpMaskCodec::onGetPixels(const SkImageInfo& dstInfo, |
55 void* dst, size_t dstRowBytes, | 56 void* dst, size_t dstRowBytes, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 129 |
129 // Decode the row in destination format | 130 // Decode the row in destination format |
130 int row = SkBmpCodec::kBottomUp_RowOrder == this->rowOrder() ? height -
1 - y : y; | 131 int row = SkBmpCodec::kBottomUp_RowOrder == this->rowOrder() ? height -
1 - y : y; |
131 void* dstRow = SkTAddOffset<void>(dst, row * dstRowBytes); | 132 void* dstRow = SkTAddOffset<void>(dst, row * dstRowBytes); |
132 fMaskSwizzler->swizzle(dstRow, srcRow); | 133 fMaskSwizzler->swizzle(dstRow, srcRow); |
133 } | 134 } |
134 | 135 |
135 // Finished decoding the entire image | 136 // Finished decoding the entire image |
136 return kSuccess; | 137 return kSuccess; |
137 } | 138 } |
| 139 |
| 140 SkCodec::Result SkBmpMaskCodec::onStart(const SkImageInfo& dstInfo, |
| 141 const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputCo
lorCount) { |
| 142 // Initialize a the mask swizzler |
| 143 if (!this->initializeSwizzler(dstInfo)) { |
| 144 SkCodecPrintf("Error: cannot initialize swizzler.\n"); |
| 145 return SkCodec::kInvalidConversion; |
| 146 } |
| 147 |
| 148 return SkCodec::kSuccess; |
| 149 } |
OLD | NEW |