OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2007 The Android Open Source Project | 2 * Copyright 2007 The Android Open Source Project |
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 | 8 |
9 #include "SkImageDecoder.h" | 9 #include "SkImageDecoder.h" |
10 #include "SkImageEncoder.h" | 10 #include "SkImageEncoder.h" |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 // an opaque A8 bitmap would not be very interesting. | 606 // an opaque A8 bitmap would not be very interesting. |
607 // Otherwise, a jpeg image is opaque. | 607 // Otherwise, a jpeg image is opaque. |
608 return bm->setInfo(SkImageInfo::Make(smpl.scaledWidth(), smpl.scaled
Height(), | 608 return bm->setInfo(SkImageInfo::Make(smpl.scaledWidth(), smpl.scaled
Height(), |
609 colorType, alphaType)); | 609 colorType, alphaType)); |
610 } else { | 610 } else { |
611 return return_false(cinfo, *bm, "start_decompress"); | 611 return return_false(cinfo, *bm, "start_decompress"); |
612 } | 612 } |
613 } | 613 } |
614 sampleSize = recompute_sampleSize(sampleSize, cinfo); | 614 sampleSize = recompute_sampleSize(sampleSize, cinfo); |
615 | 615 |
| 616 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER |
616 // should we allow the Chooser (if present) to pick a colortype for us??? | 617 // should we allow the Chooser (if present) to pick a colortype for us??? |
617 if (!this->chooseFromOneChoice(colorType, cinfo.output_width, cinfo.output_h
eight)) { | 618 if (!this->chooseFromOneChoice(colorType, cinfo.output_width, cinfo.output_h
eight)) { |
618 return return_false(cinfo, *bm, "chooseFromOneChoice"); | 619 return return_false(cinfo, *bm, "chooseFromOneChoice"); |
619 } | 620 } |
| 621 #endif |
620 | 622 |
621 SkScaledBitmapSampler sampler(cinfo.output_width, cinfo.output_height, sampl
eSize); | 623 SkScaledBitmapSampler sampler(cinfo.output_width, cinfo.output_height, sampl
eSize); |
622 // Assume an A8 bitmap is not opaque to avoid the check of each | 624 // Assume an A8 bitmap is not opaque to avoid the check of each |
623 // individual pixel. It is very unlikely to be opaque, since | 625 // individual pixel. It is very unlikely to be opaque, since |
624 // an opaque A8 bitmap would not be very interesting. | 626 // an opaque A8 bitmap would not be very interesting. |
625 // Otherwise, a jpeg image is opaque. | 627 // Otherwise, a jpeg image is opaque. |
626 bm->setInfo(SkImageInfo::Make(sampler.scaledWidth(), sampler.scaledHeight(), | 628 bm->setInfo(SkImageInfo::Make(sampler.scaledWidth(), sampler.scaledHeight(), |
627 colorType, alphaType)); | 629 colorType, alphaType)); |
628 if (SkImageDecoder::kDecodeBounds_Mode == mode) { | 630 if (SkImageDecoder::kDecodeBounds_Mode == mode) { |
629 return true; | 631 return true; |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 return SkImageDecoder::kUnknown_Format; | 1233 return SkImageDecoder::kUnknown_Format; |
1232 } | 1234 } |
1233 | 1235 |
1234 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { | 1236 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { |
1235 return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL; | 1237 return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL; |
1236 } | 1238 } |
1237 | 1239 |
1238 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory); | 1240 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory); |
1239 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg); | 1241 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg); |
1240 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory); | 1242 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory); |
OLD | NEW |