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 "SkBmpRLECodec.h" | 8 #include "SkBmpRLECodec.h" |
9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 25 matching lines...) Expand all Loading... | |
36 */ | 36 */ |
37 SkCodec::Result SkBmpRLECodec::onGetPixels(const SkImageInfo& dstInfo, | 37 SkCodec::Result SkBmpRLECodec::onGetPixels(const SkImageInfo& dstInfo, |
38 void* dst, size_t dstRowBytes, | 38 void* dst, size_t dstRowBytes, |
39 const Options& opts, | 39 const Options& opts, |
40 SkPMColor* inputColorPtr, | 40 SkPMColor* inputColorPtr, |
41 int* inputColorCount) { | 41 int* inputColorCount) { |
42 if (opts.fSubset) { | 42 if (opts.fSubset) { |
43 // Subsets are not supported. | 43 // Subsets are not supported. |
44 return kUnimplemented; | 44 return kUnimplemented; |
45 } | 45 } |
46 // FIXME: This may be my misunderstanding of this class, but it seems like | |
47 // scaling could be supported? | |
msarett
2015/10/01 19:34:33
Yes sampling in the x dimension is already impleme
scroggo
2015/10/01 21:16:57
What do you think is the right way to handle it? I
msarett
2015/10/01 22:53:06
I haven't given this enough thought yet.
In my mi
| |
46 if (dstInfo.dimensions() != this->getInfo().dimensions()) { | 48 if (dstInfo.dimensions() != this->getInfo().dimensions()) { |
47 SkCodecPrintf("Error: scaling not supported.\n"); | 49 SkCodecPrintf("Error: scaling not supported.\n"); |
48 return kInvalidScale; | 50 return kInvalidScale; |
49 } | 51 } |
50 if (!conversion_possible(dstInfo, this->getInfo())) { | 52 if (!conversion_possible(dstInfo, this->getInfo())) { |
51 SkCodecPrintf("Error: cannot convert input type to output type.\n"); | 53 SkCodecPrintf("Error: cannot convert input type to output type.\n"); |
52 return kInvalidConversion; | 54 return kInvalidConversion; |
53 } | 55 } |
54 | 56 |
55 Result result = this->prepareToDecode(dstInfo, opts, inputColorPtr, inputCol orCount); | 57 Result result = this->prepareToDecode(dstInfo, opts, inputColorPtr, inputCol orCount); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
262 | 264 |
263 // Copy the color table to the client if necessary | 265 // Copy the color table to the client if necessary |
264 copy_color_table(dstInfo, this->fColorTable, inputColorPtr, inputColorCount) ; | 266 copy_color_table(dstInfo, this->fColorTable, inputColorPtr, inputColorCount) ; |
265 | 267 |
266 // Initialize a buffer for encoded RLE data | 268 // Initialize a buffer for encoded RLE data |
267 if (!this->initializeStreamBuffer()) { | 269 if (!this->initializeStreamBuffer()) { |
268 SkCodecPrintf("Error: cannot initialize stream buffer.\n"); | 270 SkCodecPrintf("Error: cannot initialize stream buffer.\n"); |
269 return SkCodec::kInvalidConversion; | 271 return SkCodec::kInvalidConversion; |
270 } | 272 } |
271 | 273 |
272 SkScaledCodec::ComputeSampleSize(dstInfo, this->getInfo(), &fSampleX, NULL); | 274 SkScaledCodec::ComputeSampleSize(dstInfo.dimensions(), this->getInfo().dimen sions(), |
275 &fSampleX, NULL); | |
273 | 276 |
274 return SkCodec::kSuccess; | 277 return SkCodec::kSuccess; |
275 } | 278 } |
276 | 279 |
277 /* | 280 /* |
278 * Performs the bitmap decoding for RLE input format | 281 * Performs the bitmap decoding for RLE input format |
279 * RLE decoding is performed all at once, rather than a one row at a time | 282 * RLE decoding is performed all at once, rather than a one row at a time |
280 */ | 283 */ |
281 SkCodec::Result SkBmpRLECodec::decodeRows(const SkImageInfo& dstInfo, | 284 SkCodec::Result SkBmpRLECodec::decodeRows(const SkImageInfo& dstInfo, |
282 void* dst, size_t dstRowBytes, | 285 void* dst, size_t dstRowBytes, |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
459 | 462 |
460 // Set the indicated number of pixels | 463 // Set the indicated number of pixels |
461 for (int which = 0; x < endX; x++) { | 464 for (int which = 0; x < endX; x++) { |
462 setPixel(dst, dstRowBytes, dstInfo, x, y, indices[which]); | 465 setPixel(dst, dstRowBytes, dstInfo, x, y, indices[which]); |
463 which = !which; | 466 which = !which; |
464 } | 467 } |
465 } | 468 } |
466 } | 469 } |
467 } | 470 } |
468 } | 471 } |
OLD | NEW |