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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp

Issue 2878363003: Revert of Fix ImageAnimation constant names after Blink renaming (Closed)
Patch Set: Created 3 years, 7 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 * 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 18 matching lines...) Expand all
29 #include "platform/image-decoders/gif/GIFImageReader.h" 29 #include "platform/image-decoders/gif/GIFImageReader.h"
30 #include "platform/wtf/NotFound.h" 30 #include "platform/wtf/NotFound.h"
31 #include "platform/wtf/PtrUtil.h" 31 #include "platform/wtf/PtrUtil.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 GIFImageDecoder::GIFImageDecoder(AlphaOption alpha_option, 35 GIFImageDecoder::GIFImageDecoder(AlphaOption alpha_option,
36 const ColorBehavior& color_behavior, 36 const ColorBehavior& color_behavior,
37 size_t max_decoded_bytes) 37 size_t max_decoded_bytes)
38 : ImageDecoder(alpha_option, color_behavior, max_decoded_bytes), 38 : ImageDecoder(alpha_option, color_behavior, max_decoded_bytes),
39 repetition_count_(kAnimationLoopOnce) {} 39 repetition_count_(kCAnimationLoopOnce) {}
40 40
41 GIFImageDecoder::~GIFImageDecoder() {} 41 GIFImageDecoder::~GIFImageDecoder() {}
42 42
43 void GIFImageDecoder::OnSetData(SegmentReader* data) { 43 void GIFImageDecoder::OnSetData(SegmentReader* data) {
44 if (reader_) 44 if (reader_)
45 reader_->setData(data); 45 reader_->setData(data);
46 } 46 }
47 47
48 int GIFImageDecoder::RepetitionCount() const { 48 int GIFImageDecoder::RepetitionCount() const {
49 // This value can arrive at any point in the image data stream. Most GIFs 49 // This value can arrive at any point in the image data stream. Most GIFs
(...skipping 14 matching lines...) Expand all
64 // Second, a GIF might never set a loop count at all, in which case we 64 // Second, a GIF might never set a loop count at all, in which case we
65 // should continue to treat it as a "loop once" animation. We don't need 65 // should continue to treat it as a "loop once" animation. We don't need
66 // special code here either, because in this case we'll never change 66 // special code here either, because in this case we'll never change
67 // |repetition_count_| from its default value. 67 // |repetition_count_| from its default value.
68 // 68 //
69 // Third, we use the same GIFImageReader for counting frames and we might 69 // Third, we use the same GIFImageReader for counting frames and we might
70 // see the loop count and then encounter a decoding error which happens 70 // see the loop count and then encounter a decoding error which happens
71 // later in the stream. It is also possible that no frames are in the 71 // later in the stream. It is also possible that no frames are in the
72 // stream. In these cases we should just loop once. 72 // stream. In these cases we should just loop once.
73 if (IsAllDataReceived() && ParseCompleted() && reader_->imagesCount() == 1) 73 if (IsAllDataReceived() && ParseCompleted() && reader_->imagesCount() == 1)
74 repetition_count_ = kAnimationNone; 74 repetition_count_ = kCAnimationNone;
75 else if (Failed() || (reader_ && (!reader_->imagesCount()))) 75 else if (Failed() || (reader_ && (!reader_->imagesCount())))
76 repetition_count_ = kAnimationLoopOnce; 76 repetition_count_ = kCAnimationLoopOnce;
77 else if (reader_ && reader_->loopCount() != cLoopCountNotSeen) 77 else if (reader_ && reader_->loopCount() != cLoopCountNotSeen)
78 repetition_count_ = reader_->loopCount(); 78 repetition_count_ = reader_->loopCount();
79 return repetition_count_; 79 return repetition_count_;
80 } 80 }
81 81
82 bool GIFImageDecoder::FrameIsCompleteAtIndex(size_t index) const { 82 bool GIFImageDecoder::FrameIsCompleteAtIndex(size_t index) const {
83 return reader_ && (index < reader_->imagesCount()) && 83 return reader_ && (index < reader_->imagesCount()) &&
84 reader_->frameContext(index)->isComplete(); 84 reader_->frameContext(index)->isComplete();
85 } 85 }
86 86
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 current_buffer_saw_alpha_ = false; 273 current_buffer_saw_alpha_ = false;
274 } 274 }
275 275
276 bool GIFImageDecoder::CanReusePreviousFrameBuffer(size_t frame_index) const { 276 bool GIFImageDecoder::CanReusePreviousFrameBuffer(size_t frame_index) const {
277 DCHECK(frame_index < frame_buffer_cache_.size()); 277 DCHECK(frame_index < frame_buffer_cache_.size());
278 return frame_buffer_cache_[frame_index].GetDisposalMethod() != 278 return frame_buffer_cache_[frame_index].GetDisposalMethod() !=
279 ImageFrame::kDisposeOverwritePrevious; 279 ImageFrame::kDisposeOverwritePrevious;
280 } 280 }
281 281
282 } // namespace blink 282 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698