| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 // used to do alpha blending in WEBPImageDecoder::ApplyPostProcessing(). | 392 // used to do alpha blending in WEBPImageDecoder::ApplyPostProcessing(). |
| 393 // | 393 // |
| 394 // Before calling this, verify that frame |index| exists by checking that | 394 // Before calling this, verify that frame |index| exists by checking that |
| 395 // |index| is smaller than |frame_buffer_cache_|.size(). | 395 // |index| is smaller than |frame_buffer_cache_|.size(). |
| 396 virtual bool FrameStatusSufficientForSuccessors(size_t index) { | 396 virtual bool FrameStatusSufficientForSuccessors(size_t index) { |
| 397 DCHECK(index < frame_buffer_cache_.size()); | 397 DCHECK(index < frame_buffer_cache_.size()); |
| 398 return frame_buffer_cache_[index].GetStatus() != ImageFrame::kFrameEmpty; | 398 return frame_buffer_cache_[index].GetStatus() != ImageFrame::kFrameEmpty; |
| 399 } | 399 } |
| 400 | 400 |
| 401 private: | 401 private: |
| 402 enum class SniffResult { JPEG, PNG, GIF, WEBP, ICO, BMP, kInvalid }; | |
| 403 | |
| 404 static SniffResult DetermineImageType(const char* data, size_t length); | |
| 405 | |
| 406 // Some code paths compute the size of the image as "width * height * 4" | 402 // Some code paths compute the size of the image as "width * height * 4" |
| 407 // and return it as a (signed) int. Avoid overflow. | 403 // and return it as a (signed) int. Avoid overflow. |
| 408 static bool SizeCalculationMayOverflow(unsigned width, unsigned height) { | 404 static bool SizeCalculationMayOverflow(unsigned width, unsigned height) { |
| 409 unsigned long long total_size = static_cast<unsigned long long>(width) * | 405 unsigned long long total_size = static_cast<unsigned long long>(width) * |
| 410 static_cast<unsigned long long>(height); | 406 static_cast<unsigned long long>(height); |
| 411 return total_size > ((1 << 29) - 1); | 407 return total_size > ((1 << 29) - 1); |
| 412 } | 408 } |
| 413 | 409 |
| 414 bool purge_aggressively_; | 410 bool purge_aggressively_; |
| 415 | 411 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 428 bool has_histogrammed_color_space_ = false; | 424 bool has_histogrammed_color_space_ = false; |
| 429 | 425 |
| 430 sk_sp<SkColorSpace> embedded_color_space_ = nullptr; | 426 sk_sp<SkColorSpace> embedded_color_space_ = nullptr; |
| 431 bool source_to_target_color_transform_needs_update_ = false; | 427 bool source_to_target_color_transform_needs_update_ = false; |
| 432 std::unique_ptr<SkColorSpaceXform> source_to_target_color_transform_; | 428 std::unique_ptr<SkColorSpaceXform> source_to_target_color_transform_; |
| 433 }; | 429 }; |
| 434 | 430 |
| 435 } // namespace blink | 431 } // namespace blink |
| 436 | 432 |
| 437 #endif | 433 #endif |
| OLD | NEW |