| 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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 633             // Otherwise, a jpeg image is opaque. | 633             // Otherwise, a jpeg image is opaque. | 
| 634             bool success = bm->setInfo(SkImageInfo::Make(smpl.scaledWidth(), smp
      l.scaledHeight(), | 634             bool success = bm->setInfo(SkImageInfo::Make(smpl.scaledWidth(), smp
      l.scaledHeight(), | 
| 635                                                          colorType, alphaType)); | 635                                                          colorType, alphaType)); | 
| 636             return success ? kSuccess : kFailure; | 636             return success ? kSuccess : kFailure; | 
| 637         } else { | 637         } else { | 
| 638             return return_failure(cinfo, *bm, "start_decompress"); | 638             return return_failure(cinfo, *bm, "start_decompress"); | 
| 639         } | 639         } | 
| 640     } | 640     } | 
| 641     sampleSize = recompute_sampleSize(sampleSize, cinfo); | 641     sampleSize = recompute_sampleSize(sampleSize, cinfo); | 
| 642 | 642 | 
| 643 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER |  | 
| 644     // should we allow the Chooser (if present) to pick a colortype for us??? |  | 
| 645     if (!this->chooseFromOneChoice(colorType, cinfo.output_width, cinfo.output_h
      eight)) { |  | 
| 646         return return_failure(cinfo, *bm, "chooseFromOneChoice"); |  | 
| 647     } |  | 
| 648 #endif |  | 
| 649 |  | 
| 650     SkScaledBitmapSampler sampler(cinfo.output_width, cinfo.output_height, sampl
      eSize); | 643     SkScaledBitmapSampler sampler(cinfo.output_width, cinfo.output_height, sampl
      eSize); | 
| 651     // Assume an A8 bitmap is not opaque to avoid the check of each | 644     // Assume an A8 bitmap is not opaque to avoid the check of each | 
| 652     // individual pixel. It is very unlikely to be opaque, since | 645     // individual pixel. It is very unlikely to be opaque, since | 
| 653     // an opaque A8 bitmap would not be very interesting. | 646     // an opaque A8 bitmap would not be very interesting. | 
| 654     // Otherwise, a jpeg image is opaque. | 647     // Otherwise, a jpeg image is opaque. | 
| 655     bm->setInfo(SkImageInfo::Make(sampler.scaledWidth(), sampler.scaledHeight(), | 648     bm->setInfo(SkImageInfo::Make(sampler.scaledWidth(), sampler.scaledHeight(), | 
| 656                                   colorType, alphaType)); | 649                                   colorType, alphaType)); | 
| 657     if (SkImageDecoder::kDecodeBounds_Mode == mode) { | 650     if (SkImageDecoder::kDecodeBounds_Mode == mode) { | 
| 658         return kSuccess; | 651         return kSuccess; | 
| 659     } | 652     } | 
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1446     return SkImageDecoder::kUnknown_Format; | 1439     return SkImageDecoder::kUnknown_Format; | 
| 1447 } | 1440 } | 
| 1448 | 1441 | 
| 1449 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { | 1442 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { | 
| 1450     return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL; | 1443     return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL; | 
| 1451 } | 1444 } | 
| 1452 | 1445 | 
| 1453 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory); | 1446 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory); | 
| 1454 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg); | 1447 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg); | 
| 1455 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory); | 1448 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory); | 
| OLD | NEW | 
|---|