Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(512)

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h

Issue 2565323003: Move gif image decoder to SkCodec (Closed)
Patch Set: Clarify code with mo'bettah comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 // The default condition is that the frame status needs to be FramePartial or 389 // The default condition is that the frame status needs to be FramePartial or
390 // FrameComplete, since the data of previous frames is copied in 390 // FrameComplete, since the data of previous frames is copied in
391 // InitFrameBuffer() before setting the status to FramePartial. For WebP, 391 // InitFrameBuffer() before setting the status to FramePartial. For WebP,
392 // however, the status needs to be FrameComplete since the complete buffer is 392 // however, the status needs to be FrameComplete since the complete buffer is
393 // used to do alpha blending in WEBPImageDecoder::ApplyPostProcessing(). 393 // used to do alpha blending in WEBPImageDecoder::ApplyPostProcessing().
394 // 394 //
395 // Before calling this, verify that frame |index| exists by checking that 395 // Before calling this, verify that frame |index| exists by checking that
396 // |index| is smaller than |frame_buffer_cache_|.size(). 396 // |index| is smaller than |frame_buffer_cache_|.size().
397 virtual bool FrameStatusSufficientForSuccessors(size_t index) { 397 virtual bool FrameStatusSufficientForSuccessors(size_t index) {
398 DCHECK(index < frame_buffer_cache_.size()); 398 DCHECK(index < frame_buffer_cache_.size());
399 return frame_buffer_cache_[index].GetStatus() != ImageFrame::kFrameEmpty; 399 ImageFrame::Status frame_status = frame_buffer_cache_[index].GetStatus();
400 return frame_status == ImageFrame::kFramePartial ||
401 frame_status == ImageFrame::kFrameComplete;
400 } 402 }
401 403
402 private: 404 private:
403 // Some code paths compute the size of the image as "width * height * 4" 405 // Some code paths compute the size of the image as "width * height * 4"
404 // and return it as a (signed) int. Avoid overflow. 406 // and return it as a (signed) int. Avoid overflow.
405 static bool SizeCalculationMayOverflow(unsigned width, unsigned height) { 407 static bool SizeCalculationMayOverflow(unsigned width, unsigned height) {
406 unsigned long long total_size = static_cast<unsigned long long>(width) * 408 unsigned long long total_size = static_cast<unsigned long long>(width) *
407 static_cast<unsigned long long>(height); 409 static_cast<unsigned long long>(height);
408 return total_size > ((1 << 29) - 1); 410 return total_size > ((1 << 29) - 1);
409 } 411 }
(...skipping 15 matching lines...) Expand all
425 bool has_histogrammed_color_space_ = false; 427 bool has_histogrammed_color_space_ = false;
426 428
427 sk_sp<SkColorSpace> embedded_color_space_ = nullptr; 429 sk_sp<SkColorSpace> embedded_color_space_ = nullptr;
428 bool source_to_target_color_transform_needs_update_ = false; 430 bool source_to_target_color_transform_needs_update_ = false;
429 std::unique_ptr<SkColorSpaceXform> source_to_target_color_transform_; 431 std::unique_ptr<SkColorSpaceXform> source_to_target_color_transform_;
430 }; 432 };
431 433
432 } // namespace blink 434 } // namespace blink
433 435
434 #endif 436 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698