| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 79 | 79 |
| 80 std::unique_ptr<DeferredImageDecoder> DeferredImageDecoder::CreateForTesting( | 80 std::unique_ptr<DeferredImageDecoder> DeferredImageDecoder::CreateForTesting( |
| 81 std::unique_ptr<ImageDecoder> actual_decoder) { | 81 std::unique_ptr<ImageDecoder> actual_decoder) { |
| 82 return WTF::WrapUnique(new DeferredImageDecoder(std::move(actual_decoder))); | 82 return WTF::WrapUnique(new DeferredImageDecoder(std::move(actual_decoder))); |
| 83 } | 83 } |
| 84 | 84 |
| 85 DeferredImageDecoder::DeferredImageDecoder( | 85 DeferredImageDecoder::DeferredImageDecoder( |
| 86 std::unique_ptr<ImageDecoder> actual_decoder) | 86 std::unique_ptr<ImageDecoder> actual_decoder) |
| 87 : actual_decoder_(std::move(actual_decoder)), | 87 : actual_decoder_(std::move(actual_decoder)), |
| 88 repetition_count_(kAnimationNone), | 88 repetition_count_(kCAnimationNone), |
| 89 all_data_received_(false), | 89 all_data_received_(false), |
| 90 can_yuv_decode_(false), | 90 can_yuv_decode_(false), |
| 91 has_hot_spot_(false) {} | 91 has_hot_spot_(false) {} |
| 92 | 92 |
| 93 DeferredImageDecoder::~DeferredImageDecoder() {} | 93 DeferredImageDecoder::~DeferredImageDecoder() {} |
| 94 | 94 |
| 95 String DeferredImageDecoder::FilenameExtension() const { | 95 String DeferredImageDecoder::FilenameExtension() const { |
| 96 return actual_decoder_ ? actual_decoder_->FilenameExtension() | 96 return actual_decoder_ ? actual_decoder_->FilenameExtension() |
| 97 : filename_extension_; | 97 : filename_extension_; |
| 98 } | 98 } |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 has_hot_spot_ = actual_decoder_->HotSpot(hot_spot_); | 259 has_hot_spot_ = actual_decoder_->HotSpot(hot_spot_); |
| 260 filename_extension_ = actual_decoder_->FilenameExtension(); | 260 filename_extension_ = actual_decoder_->FilenameExtension(); |
| 261 // JPEG images support YUV decoding; other decoders do not. (WebP could in the | 261 // JPEG images support YUV decoding; other decoders do not. (WebP could in the |
| 262 // future.) | 262 // future.) |
| 263 can_yuv_decode_ = RuntimeEnabledFeatures::decodeToYUVEnabled() && | 263 can_yuv_decode_ = RuntimeEnabledFeatures::decodeToYUVEnabled() && |
| 264 (filename_extension_ == "jpg"); | 264 (filename_extension_ == "jpg"); |
| 265 has_embedded_color_space_ = actual_decoder_->HasEmbeddedColorSpace(); | 265 has_embedded_color_space_ = actual_decoder_->HasEmbeddedColorSpace(); |
| 266 color_space_for_sk_images_ = actual_decoder_->ColorSpaceForSkImages(); | 266 color_space_for_sk_images_ = actual_decoder_->ColorSpaceForSkImages(); |
| 267 | 267 |
| 268 const bool is_single_frame = | 268 const bool is_single_frame = |
| 269 actual_decoder_->RepetitionCount() == kAnimationNone || | 269 actual_decoder_->RepetitionCount() == kCAnimationNone || |
| 270 (all_data_received_ && actual_decoder_->FrameCount() == 1u); | 270 (all_data_received_ && actual_decoder_->FrameCount() == 1u); |
| 271 const SkISize decoded_size = | 271 const SkISize decoded_size = |
| 272 SkISize::Make(actual_decoder_->DecodedSize().Width(), | 272 SkISize::Make(actual_decoder_->DecodedSize().Width(), |
| 273 actual_decoder_->DecodedSize().Height()); | 273 actual_decoder_->DecodedSize().Height()); |
| 274 frame_generator_ = ImageFrameGenerator::Create( | 274 frame_generator_ = ImageFrameGenerator::Create( |
| 275 decoded_size, !is_single_frame, actual_decoder_->GetColorBehavior()); | 275 decoded_size, !is_single_frame, actual_decoder_->GetColorBehavior()); |
| 276 } | 276 } |
| 277 | 277 |
| 278 void DeferredImageDecoder::PrepareLazyDecodedFrames() { | 278 void DeferredImageDecoder::PrepareLazyDecodedFrames() { |
| 279 if (!actual_decoder_ || !actual_decoder_->IsSizeAvailable()) | 279 if (!actual_decoder_ || !actual_decoder_->IsSizeAvailable()) |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 358 |
| 359 namespace WTF { | 359 namespace WTF { |
| 360 template <> | 360 template <> |
| 361 struct VectorTraits<blink::DeferredFrameData> | 361 struct VectorTraits<blink::DeferredFrameData> |
| 362 : public SimpleClassVectorTraits<blink::DeferredFrameData> { | 362 : public SimpleClassVectorTraits<blink::DeferredFrameData> { |
| 363 STATIC_ONLY(VectorTraits); | 363 STATIC_ONLY(VectorTraits); |
| 364 static const bool kCanInitializeWithMemset = | 364 static const bool kCanInitializeWithMemset = |
| 365 false; // Not all DeferredFrameData members initialize to 0. | 365 false; // Not all DeferredFrameData members initialize to 0. |
| 366 }; | 366 }; |
| 367 } | 367 } |
| OLD | NEW |